don't expect errno to be set to EOVERFLOW if vsnprintf() fails
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36290 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
455c8f1d55
commit
b1727cfef7
@ -1839,23 +1839,13 @@ int wxString::PrintfV(const wxChar* pszFormat, va_list argptr)
|
|||||||
|
|
||||||
// vsnprintf() may return either -1 (traditional Unix behaviour) or the
|
// vsnprintf() may return either -1 (traditional Unix behaviour) or the
|
||||||
// total number of characters which would have been written if the
|
// total number of characters which would have been written if the
|
||||||
// buffer were large enough
|
// buffer were large enough (newer standards such as Unix98)
|
||||||
if ( len >= 0 && len <= size )
|
if ( len >= 0 && len <= size )
|
||||||
{
|
{
|
||||||
// ok, there was enough space
|
// ok, there was enough space
|
||||||
break;
|
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
|
// still not enough, double it again
|
||||||
size *= 2;
|
size *= 2;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user