]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/string.cpp
Fixed wxBufferedPaintDC for scrolled windows
[wxWidgets.git] / src / common / string.cpp
index 1a86ca3d1b599461da5fc336612a60a7143b6b03..764e1ff3b89a2535ffa28f671eeb901e9eb92fb6 100644 (file)
 #include <string.h>
 #include <stdlib.h>
 
+#ifndef __WXMSW__
+#include <errno.h>
+#endif
+
 #ifdef __SALFORDC__
   #include <clib.h>
 #endif
@@ -319,7 +323,7 @@ bool wxStringBase::AllocBeforeWrite(size_t nLen)
   // it doesn't really matter what the string length is as it's going to be
   // overwritten later but, for extra safety, set it to 0 for now as we may
   // have some junk in m_pchData
-  pData->nDataLength = 0;
+  GetStringData()->nDataLength = 0;
 
   return true;
 }
@@ -1835,7 +1839,14 @@ int wxString::PrintfV(const wxChar* pszFormat, va_list argptr)
         // vsnprintf() may return either -1 (traditional Unix behaviour) or the
         // total number of characters which would have been written if the
         // buffer were large enough
-        if ( len >= 0 && len <= size )
+        // also, it may return an errno may be something like EILSEQ,
+        // in which case we need to break out
+        if ( (len >= 0 && len <= size)
+        // No EOVERFLOW on Windows nor Palm 6.0
+#if !defined(__WXMSW__) && !defined(__WXPALMOS__)
+            || errno != EOVERFLOW
+#endif
+            )
         {
             // ok, there was enough space
             break;