SHERLOCK: Fix two Valgrind warnings in the 3DO image decoder

The 3DO Serrated Scalpel intro now runs without any Valgrind
warnings, up to the point where it should be showing the credits.
This commit is contained in:
Torbjörn Andersson 2015-06-12 00:17:24 +02:00
parent 5df022d75b
commit 8d62faf619

View File

@ -384,14 +384,14 @@ void ImageFile3DO::load3DOCelFile(Common::SeekableReadStream &stream) {
chunkTag = stream.readUint32BE();
chunkSize = stream.readUint32BE();
if (stream.eos() || stream.err())
break;
if (chunkSize < 8)
error("load3DOCelFile: Invalid chunk size");
uint32 dataSize = chunkSize - 8;
if (stream.eos() || stream.err())
break;
switch (chunkTag) {
case MKTAG('A', 'N', 'I', 'M'):
// animation header
@ -636,7 +636,10 @@ inline uint16 ImageFile3DO::celGetBits(const byte *&dataPtr, byte bitCount, byte
// Go to next byte
dataPtr++;
currentByte = *dataPtr; dataBitsLeft = 8;
dataBitsLeft = 8;
if (resultBitsLeft) {
currentByte = *dataPtr;
}
}
}
return result;