linux fixup

This commit is contained in:
Glenn Maynard
2006-09-18 23:17:28 +00:00
parent 6e3d48a3d9
commit 0e6a779446
+5 -5
View File
@@ -296,10 +296,10 @@ RString vssprintf( const char *szFormat, va_list argList )
int iNeeded = vsnprintf( &ignore, 0, szFormat, tmp ); int iNeeded = vsnprintf( &ignore, 0, szFormat, tmp );
va_end(tmp); va_end(tmp);
char *buf = GetBuffer( iNeeded+1 ); char *buf = sStr.GetBuffer( iNeeded+1 );
vsnprintf( buf, iNeeded+1, szFormat, argList ); vsnprintf( buf, iNeeded+1, szFormat, argList );
ReleaseBuffer( iNeeded ); sStr.ReleaseBuffer( iNeeded );
return; return sStr;
} }
int iChars = FMT_BLOCK_SIZE; int iChars = FMT_BLOCK_SIZE;
@@ -307,13 +307,13 @@ RString vssprintf( const char *szFormat, va_list argList )
while( 1 ) while( 1 )
{ {
// Grow more than linearly (e.g. 512, 1536, 3072, etc) // Grow more than linearly (e.g. 512, 1536, 3072, etc)
char *buf = GetBuffer(iChars); char *buf = sStr.GetBuffer(iChars);
int iUsed = vsnprintf(buf, iChars-1, szFormat, argList); int iUsed = vsnprintf(buf, iChars-1, szFormat, argList);
if( iUsed == -1 ) if( iUsed == -1 )
{ {
iChars += ((iTry+1) * FMT_BLOCK_SIZE); iChars += ((iTry+1) * FMT_BLOCK_SIZE);
ReleaseBuffer(); sStr.ReleaseBuffer();
++iTry; ++iTry;
continue; continue;
} }