git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36303
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
for ( ;; )
{
wxStringBuffer tmp(*this, size + 1);
for ( ;; )
{
wxStringBuffer tmp(*this, size + 1);
// 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 (newer standards such as Unix98)
// 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 (newer standards such as Unix98)
- if ( len >= 0 && len <= size )
+ if ( len < 0 )
+ {
+ // still not enough, as we don't know how much we need, double the
+ // current size of the buffer
+ size *= 2;
+ }
+ else if ( len > size )
+ {
+ size = len;
+ }
+ else // ok, there was enough space
- // ok, there was enough space
-
- // still not enough, double it again
- size *= 2;
}
// we could have overshot
}
// we could have overshot