X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ad5bb7d6a69b25a7508dea70503b986f29f80de1..cccb455e3099ab1bcf4e91944a69e77f28fc0758:/src/common/string.cpp diff --git a/src/common/string.cpp b/src/common/string.cpp index 796827ec71..be45802169 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -1839,20 +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 - // 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 nor OpenVMS nor MacOS (not X) - // not OS/2 (not Innotek libc). -#if !defined(__WXMSW__) && !defined(__WXPALMOS__) && !defined( __VMS ) && !(defined(__WXMAC__) && !defined(__WXMAC_OSX__)) && !(defined(__EMX__) && !defined(__INNOTEK_LIBC__)) - || 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; }