]> git.saurik.com Git - wxWidgets.git/commitdiff
1. added wxAssertIsEqual() function to be used in wxASSERT()
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 9 Jun 2001 16:35:38 +0000 (16:35 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 9 Jun 2001 16:35:38 +0000 (16:35 +0000)
2. made wxTrap() public, documented it

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10472 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/intl.cpp
src/common/log.cpp
src/common/string.cpp

index 6c376a95a6c505b4c88e3ec004ef6977a0dcfcd2..01d449fd5346e6f8c5686abe0feeec6d30b1c41b 100644 (file)
@@ -94,9 +94,7 @@ typedef unsigned char size_t8;
             {
                 // Asserting a sizeof directly causes some compilers to
                 // issue a "using constant in a conditional expression" warning
-                size_t intsize = sizeof(int);
-
-                wxASSERT_MSG( intsize == 4,
+                wxASSERT_MSG( wxAssertIsEqual(sizeof(int), 4),
                               "size_t32 is incorrectly defined!" );
             }
         } intsizechecker;
index a73e2cdefa0973e13ee5d552e26e6f3e4c2fd9a7..4ee9687b9f421527eba4c5d1134941ba188078d4 100644 (file)
@@ -705,8 +705,14 @@ const wxChar *wxSysErrorMsg(unsigned long nErrCode)
 
 #ifdef  __WXDEBUG__
 
+// wxASSERT() helper
+bool wxAssertIsEqual(int x, int y)
+{
+    return x == y;
+}
+
 // break into the debugger
-void Trap()
+void wxTrap()
 {
 #ifdef __WXMSW__
     DebugBreak();
@@ -732,7 +738,7 @@ void wxOnAssert(const wxChar *szFile, int nLine, const wxChar *szMsg)
 
     if ( s_bInAssert ) {
         // He-e-e-e-elp!! we're trapped in endless loop
-        Trap();
+        wxTrap();
 
         s_bInAssert = FALSE;
 
@@ -777,7 +783,7 @@ void wxOnAssert(const wxChar *szFile, int nLine, const wxChar *szMsg)
         switch ( ::MessageBox(NULL, szBuf, _T("Debug"),
                               MB_YESNOCANCEL | MB_ICONSTOP ) ) {
             case IDYES:
-                Trap();
+                wxTrap();
                 break;
 
             case IDCANCEL:
@@ -790,7 +796,7 @@ void wxOnAssert(const wxChar *szFile, int nLine, const wxChar *szMsg)
         switch ( wxMessageBox(szBuf, wxT("Debug"),
                               wxYES_NO | wxCANCEL | wxICON_STOP ) ) {
             case wxYES:
-                Trap();
+                wxTrap();
                 break;
 
             case wxCANCEL:
@@ -802,7 +808,7 @@ void wxOnAssert(const wxChar *szFile, int nLine, const wxChar *szMsg)
 #endif // GUI or MSW
 
 #else // !GUI
-        Trap();
+        wxTrap();
 #endif // GUI/!GUI
     }
 
index a53c4378f9a6f3d2fd100dfab3019d18e61d01cd..c8a3bf6694b558f31015ecf6ecfc230befe29026 100644 (file)
@@ -86,10 +86,10 @@ static const struct
 } g_strEmpty = { {-1, 0, 0}, wxT('\0') };
 
 #if defined(__VISAGECPP__) && __IBMCPP__ >= 400
-// must define this static for VA or else you get multiply defined symbols everywhere
+// must define this static for VA or else you get multiply defined symbols
+// everywhere
 const unsigned int wxSTRING_MAXLEN = UINT_MAX - 100;
-
-#endif
+#endif // Visual Age
 
 // empty C style string: points to 'string data' byte of g_strEmpty
 extern const wxChar WXDLLEXPORT *wxEmptyString = &g_strEmpty.dummy;
@@ -1870,8 +1870,14 @@ void wxArrayString::Copy(const wxArrayString& src)
 void wxArrayString::Grow()
 {
   // only do it if no more place
-  if( m_nCount == m_nSize ) {
-    if( m_nSize == 0 ) {
+  if ( m_nCount == m_nSize ) {
+    // if ARRAY_DEFAULT_INITIAL_SIZE were set to 0, the initially empty would
+    // be never resized!
+    #if ARRAY_DEFAULT_INITIAL_SIZE == 0
+      #error "ARRAY_DEFAULT_INITIAL_SIZE must be > 0!"
+    #endif
+
+    if ( m_nSize == 0 ) {
       // was empty, alloc some memory
       m_nSize = ARRAY_DEFAULT_INITIAL_SIZE;
       m_pItems = new wxChar *[m_nSize];