avoid reallocating the buffer in case we're being called repeatedly on

a fixed-size buffer
This commit is contained in:
Glenn Maynard
2005-09-07 23:33:38 +00:00
parent cc76a438f2
commit fa1966f972
+2 -1
View File
@@ -136,7 +136,6 @@ int RageFileObj::Read( void *pBuffer, size_t iBytes )
int RageFileObj::Read( CString &sBuffer, int iBytes )
{
sBuffer.erase( sBuffer.begin(), sBuffer.end() );
sBuffer.reserve( iBytes != -1? iBytes: this->GetFileSize() );
int iRet = 0;
@@ -157,6 +156,8 @@ int RageFileObj::Read( CString &sBuffer, int iBytes )
iRet += iGot;
}
sBuffer.erase( sBuffer.begin()+iRet );
return iRet;
}