aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Hesse2008-12-27 19:37:49 +0000
committerSven Hesse2008-12-27 19:37:49 +0000
commita4a209a2f60a709051b0a6a4b20288569e6f4c97 (patch)
tree42bed55a840c86f316f4ba682fbba0267524a31b
parent32ac8d633ace312ed3f5b0c3669786dba06fb009 (diff)
downloadscummvm-rg350-a4a209a2f60a709051b0a6a4b20288569e6f4c97.tar.gz
scummvm-rg350-a4a209a2f60a709051b0a6a4b20288569e6f4c97.tar.bz2
scummvm-rg350-a4a209a2f60a709051b0a6a4b20288569e6f4c97.zip
Initializing the lookahead values, too. No more valgrind warnings anymore :)
svn-id: r35581
-rw-r--r--graphics/video/smk_player.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/graphics/video/smk_player.cpp b/graphics/video/smk_player.cpp
index 96ccd8e5e8..2ea9fe7e44 100644
--- a/graphics/video/smk_player.cpp
+++ b/graphics/video/smk_player.cpp
@@ -482,8 +482,10 @@ bool SMKPlayer::loadFile(const char *fileName) {
Common::Array<byte> huffmanTrees;
huffmanTrees.resize(_header.treesSize + 2);
_fileStream->read(&huffmanTrees[0], _header.treesSize);
+ huffmanTrees[_header.treesSize] = 0;
+ huffmanTrees[_header.treesSize + 1] = 0;
- BitStream bs(&huffmanTrees[0], _header.treesSize + 2);
+ BitStream bs(&huffmanTrees[0], _header.treesSize);
_MMapTree = new BigHuffmanTree(bs);
_MClrTree = new BigHuffmanTree(bs);
@@ -607,8 +609,10 @@ bool SMKPlayer::decodeNextFrame() {
_frameData = (byte *)malloc(frameDataSize + 2);
_fileStream->read(_frameData, frameDataSize);
+ _frameData[frameDataSize] = 0;
+ _frameData[frameDataSize + 1] = 0;
- BitStream bs(_frameData, frameDataSize + 2);
+ BitStream bs(_frameData, frameDataSize);
_MMapTree->reset();
_MClrTree->reset();
@@ -757,7 +761,7 @@ bool SMKPlayer::decodeNextFrame() {
void SMKPlayer::queueCompressedBuffer(byte *buffer, uint32 bufferSize,
uint32 unpackedSize, int streamNum) {
- BitStream audioBS(buffer, bufferSize + 2);
+ BitStream audioBS(buffer, bufferSize);
bool dataPresent = audioBS.getBit();
if (!dataPresent)