]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/string.cpp
Added OnKeyDown, OnKeyUp.
[wxWidgets.git] / src / common / string.cpp
index 9d056390460addaaaf1d1c1bd676bcabe599b3db..c4101484cf9b94d1dda19abd536b1d5a70033d27 100644 (file)
 #include <string.h>
 #include <stdlib.h>
 
-// This probably isn't right, what should it be Vadim?
-// Otherwise we end up with no wxVsprintf defined.
-#ifdef __WXMOTIF__
-#define HAVE_VPRINTF
-#endif
-
-#ifdef wxUSE_WCSRTOMBS
+#if wxUSE_WCSRTOMBS
   #include <wchar.h>    // for wcsrtombs(), see comments where it's used
 #endif // GNU
 
@@ -106,8 +100,10 @@ extern const char *g_szNul = &g_strEmpty.dummy;
     // always available), but it's unsafe because it doesn't check for buffer
     // size - so give a warning
     #define wxVsprintf(buffer,len,format,argptr) vsprintf(buffer,format, argptr)
+#ifndef __SC__
     #pragma message("Using sprintf() because no snprintf()-like function defined")
 #endif
+#endif
 
 // ----------------------------------------------------------------------------
 // global functions
@@ -275,7 +271,7 @@ wxString::wxString(const wchar_t *pwz)
 
   // NB: GNU libc5 wcstombs() is completely broken, don't use it (it doesn't
   //     honor the 3rd parameter, thus it will happily crash here).
-#ifdef wxUSE_WCSRTOMBS
+#if wxUSE_WCSRTOMBS
   // don't know if it's really needed (or if we can pass NULL), but better safe
   // than quick
   mbstate_t mbstate;  
@@ -345,6 +341,10 @@ void wxString::AllocBeforeWrite(size_t nLen)
     pData->Unlock();
     AllocBuffer(nLen);
   }
+  else {
+    // update the string length
+    pData->nDataLength = nLen;
+  }
 
   wxASSERT( !GetStringData()->IsShared() );  // we must be the only owner
 }