Fixed cGZipFile::ReadRestOfFile returning incorrect value.
This commit is contained in:
parent
9447cd20f3
commit
4dc5650023
@ -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!
|
// Since the gzip format doesn't really support getting the uncompressed length, we need to read incrementally. Yuck!
|
||||||
int NumBytesRead = 0;
|
int NumBytesRead = 0;
|
||||||
|
int TotalBytes = 0;
|
||||||
char Buffer[64 KiB];
|
char Buffer[64 KiB];
|
||||||
while ((NumBytesRead = gzread(m_File, Buffer, sizeof(Buffer))) > 0)
|
while ((NumBytesRead = gzread(m_File, Buffer, sizeof(Buffer))) > 0)
|
||||||
{
|
{
|
||||||
|
TotalBytes += NumBytesRead;
|
||||||
a_Contents.append(Buffer, NumBytesRead);
|
a_Contents.append(Buffer, NumBytesRead);
|
||||||
}
|
}
|
||||||
return NumBytesRead;
|
// NumBytesRead is < 0 on error
|
||||||
|
return (NumBytesRead >= 0) ? TotalBytes : NumBytesRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user