]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed EOVERFLOW handlign after previous commit and also explained what's going on
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 4 May 2005 19:32:53 +0000 (19:32 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 4 May 2005 19:32:53 +0000 (19:32 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33949 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/string.cpp

index b626fd228f211a670099149cb8a3f3c83c98c929..be458021692ad9fb693bb132431d72e5038786d9 100644 (file)
@@ -1839,19 +1839,22 @@ 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
-        //
-        // and it may also set errno to EOVERFLOW apparently (which system does
-        // this?)
-        if ( (len >= 0 && len <= size)
-#ifdef EOVERFLOW
-                && errno != EOVERFLOW
-#endif
-            )
+        if ( len >= 0 && len <= size )
         {
             // ok, there was enough space
             break;
         }
 
+#ifdef EOVERFLOW
+        // if the error is not due to not having enough space (it could be e.g.
+        // EILSEQ), break too -- we'd just eat all available memory uselessly
+        if ( errno != EOVERFLOW )
+        {
+            // no sense in continuing
+            break;
+        }
+#endif // EOVERFLOW
+
         // still not enough, double it again
         size *= 2;
     }