From a4a209a2f60a709051b0a6a4b20288569e6f4c97 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sat, 27 Dec 2008 19:37:49 +0000 Subject: Initializing the lookahead values, too. No more valgrind warnings anymore :) svn-id: r35581 --- graphics/video/smk_player.cpp | 10 +++++++--- 1 file 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 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) -- cgit v1.2.3