Fixed an issue in the area cooker where unneeded padding is written to the file if the padding is exactly 32 bytes

This commit is contained in:
parax0 2016-03-19 03:00:13 -06:00
parent c1014f4748
commit 3d6993a1ec
1 changed files with 2 additions and 2 deletions

View File

@ -277,14 +277,14 @@ void CAreaCooker::FinishBlock()
if (EnableCompression)
{
bool Success = CompressionUtil::CompressSegmentedData((u8*) mCompressedData.Data(), mCompressedData.Size(), CompressedBuf.data(), CompressedSize, UseZlib);
u32 PadBytes = (32 - (CompressedSize % 32)) & 0x3F;
u32 PadBytes = (32 - (CompressedSize % 32)) & 0x1F;
WriteCompressedData = Success && (CompressedSize + PadBytes < (u32) mCompressedData.Size());
}
if (WriteCompressedData)
{
u32 PadBytes = 32 - (CompressedSize % 32);
PadBytes &= 0x3F;
PadBytes &= 0x1F;
for (u32 iPad = 0; iPad < PadBytes; iPad++)
mAreaData.WriteByte(0);