1
0

Fixed cGZipFile::ReadRestOfFile returning incorrect value.

This commit is contained in:
madmaxoft 2014-03-18 13:54:17 +01:00
parent 9447cd20f3
commit 4dc5650023

View File

@ -73,12 +73,15 @@ int cGZipFile::ReadRestOfFile(AString & a_Contents)
// Since the gzip format doesn't really support getting the uncompressed length, we need to read incrementally. Yuck!
int NumBytesRead = 0;
int TotalBytes = 0;
char Buffer[64 KiB];
while ((NumBytesRead = gzread(m_File, Buffer, sizeof(Buffer))) > 0)
{
TotalBytes += NumBytesRead;
a_Contents.append(Buffer, NumBytesRead);
}
return NumBytesRead;
// NumBytesRead is < 0 on error
return (NumBytesRead >= 0) ? TotalBytes : NumBytesRead;
}