]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/string.cpp
Fixed event handling for DialogEd
[wxWidgets.git] / src / common / string.cpp
index 7739a1b864cb51fa443fe2132481bce063e014ea..05dce3179ba7984c279628cbd326afe6a0ecf7b6 100644 (file)
@@ -212,7 +212,7 @@ wxString::wxString(const void *pStart, const void *pEnd)
 wxString::wxString(const wchar_t *pwz)
 {
   // first get necessary size
 wxString::wxString(const wchar_t *pwz)
 {
   // first get necessary size
-  size_t nLen = wcstombs(NULL, pwz, 0);
+  size_t nLen = wcstombs((char *) NULL, pwz, 0);
 
   // empty?
   if ( nLen != 0 ) {
 
   // empty?
   if ( nLen != 0 ) {
@@ -930,13 +930,15 @@ wxString& wxString::insert(size_t nPos, const wxString& str)
   wxASSERT( str.GetStringData()->IsValid() );
   wxASSERT( nPos <= Len() );
 
   wxASSERT( str.GetStringData()->IsValid() );
   wxASSERT( nPos <= Len() );
 
-  wxString strTmp;
-  char *pc = strTmp.GetWriteBuf(Len() + str.Len());
-  strncpy(pc, c_str(), nPos);
-  strcpy(pc + nPos, str);
-  strcpy(pc + nPos + str.Len(), c_str() + nPos);
-  strTmp.UngetWriteBuf();
-  *this = strTmp;
+  if ( !str.IsEmpty() ) {
+    wxString strTmp;
+    char *pc = strTmp.GetWriteBuf(Len() + str.Len());
+    strncpy(pc, c_str(), nPos);
+    strcpy(pc + nPos, str);
+    strcpy(pc + nPos + str.Len(), c_str() + nPos);
+    strTmp.UngetWriteBuf();
+    *this = strTmp;
+  }
 
   return *this;
 }
 
   return *this;
 }
@@ -1075,7 +1077,7 @@ wxArrayString::wxArrayString()
 {
   m_nSize  =
   m_nCount = 0;
 {
   m_nSize  =
   m_nCount = 0;
-  m_pItems = NULL;
+  m_pItems = (char **) NULL;
 }
 
 // copy ctor
 }
 
 // copy ctor
@@ -1083,7 +1085,7 @@ wxArrayString::wxArrayString(const wxArrayString& src)
 {
   m_nSize  =
   m_nCount = 0;
 {
   m_nSize  =
   m_nCount = 0;
-  m_pItems = NULL;
+  m_pItems = (char **) NULL;
 
   *this = src;
 }
 
   *this = src;
 }