aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/bitstream.h11
-rw-r--r--engines/macventure/text.cpp4
-rw-r--r--video/bink_decoder.cpp4
-rw-r--r--video/smk_decoder.cpp6
4 files changed, 13 insertions, 12 deletions
diff --git a/common/bitstream.h b/common/bitstream.h
index b789f2ac8d..325118bbee 100644
--- a/common/bitstream.h
+++ b/common/bitstream.h
@@ -28,6 +28,7 @@
#include "common/scummsys.h"
#include "common/textconsole.h"
#include "common/stream.h"
+#include "common/types.h"
namespace Common {
@@ -88,8 +89,8 @@ protected:
template<int valueBits, bool isLE, bool isMSB2LSB>
class BitStreamImpl : public BitStream {
private:
- SeekableReadStream *_stream; ///< The input stream.
- bool _disposeAfterUse; ///< Should we delete the stream on destruction?
+ SeekableReadStream *_stream; ///< The input stream.
+ DisposeAfterUse::Flag _disposeAfterUse; ///< Should we delete the stream on destruction?
uint32 _value; ///< Current value.
uint8 _inValue; ///< Position within the current value.
@@ -132,7 +133,7 @@ private:
public:
/** Create a bit stream using this input data stream and optionally delete it on destruction. */
- BitStreamImpl(SeekableReadStream *stream, bool disposeAfterUse = false) :
+ BitStreamImpl(SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::NO) :
_stream(stream), _disposeAfterUse(disposeAfterUse), _value(0), _inValue(0) {
if ((valueBits != 8) && (valueBits != 16) && (valueBits != 32))
@@ -141,14 +142,14 @@ public:
/** Create a bit stream using this input data stream. */
BitStreamImpl(SeekableReadStream &stream) :
- _stream(&stream), _disposeAfterUse(false), _value(0), _inValue(0) {
+ _stream(&stream), _disposeAfterUse(DisposeAfterUse::NO), _value(0), _inValue(0) {
if ((valueBits != 8) && (valueBits != 16) && (valueBits != 32))
error("BitStreamImpl: Invalid memory layout %d, %d, %d", valueBits, isLE, isMSB2LSB);
}
~BitStreamImpl() {
- if (_disposeAfterUse)
+ if (_disposeAfterUse == DisposeAfterUse::YES)
delete _stream;
}
diff --git a/engines/macventure/text.cpp b/engines/macventure/text.cpp
index b4d67a1306..d8e18fffdf 100644
--- a/engines/macventure/text.cpp
+++ b/engines/macventure/text.cpp
@@ -50,7 +50,7 @@ TextAsset::TextAsset(MacVentureEngine *engine, ObjID objid, ObjID source, ObjID
void TextAsset::decodeOld() {
Common::SeekableReadStream *res = _container->getItem(_id);
uint16 strLen = res->readUint16BE();
- Common::BitStream32BELSB stream(res, true);
+ Common::BitStream32BELSB stream(res, DisposeAfterUse::YES);
char *str = new char[strLen + 1];
bool lowercase = false;
char c;
@@ -114,7 +114,7 @@ void TextAsset::decodeOld() {
void TextAsset::decodeHuffman() {
_decoded = Common::String("");
Common::SeekableReadStream *res = _container->getItem(_id);
- Common::BitStream8MSB stream(res, true);
+ Common::BitStream8MSB stream(res, DisposeAfterUse::YES);
uint16 strLen = 0;
if (stream.getBit()) {
strLen = stream.getBits(15);
diff --git a/video/bink_decoder.cpp b/video/bink_decoder.cpp
index a228377a27..cf37e0f06b 100644
--- a/video/bink_decoder.cpp
+++ b/video/bink_decoder.cpp
@@ -187,7 +187,7 @@ void BinkDecoder::readNextPacket() {
audio.sampleCount = _bink->readUint32LE() / (2 * audio.channels);
audio.bits = new Common::BitStream32LELSB(new Common::SeekableSubReadStream(_bink,
- audioPacketStart + 4, audioPacketEnd), true);
+ audioPacketStart + 4, audioPacketEnd), DisposeAfterUse::YES);
audioTrack->decodePacket();
@@ -204,7 +204,7 @@ void BinkDecoder::readNextPacket() {
uint32 videoPacketEnd = _bink->pos() + frameSize;
frame.bits = new Common::BitStream32LELSB(new Common::SeekableSubReadStream(_bink,
- videoPacketStart, videoPacketEnd), true);
+ videoPacketStart, videoPacketEnd), DisposeAfterUse::YES);
videoTrack->decodePacket(frame);
diff --git a/video/smk_decoder.cpp b/video/smk_decoder.cpp
index ee7a4ce689..4a2ada0e3a 100644
--- a/video/smk_decoder.cpp
+++ b/video/smk_decoder.cpp
@@ -386,7 +386,7 @@ bool SmackerDecoder::loadStream(Common::SeekableReadStream *stream) {
byte *huffmanTrees = (byte *) malloc(_header.treesSize);
_fileStream->read(huffmanTrees, _header.treesSize);
- Common::BitStream8LSB bs(new Common::MemoryReadStream(huffmanTrees, _header.treesSize, DisposeAfterUse::YES), true);
+ Common::BitStream8LSB bs(new Common::MemoryReadStream(huffmanTrees, _header.treesSize, DisposeAfterUse::YES), DisposeAfterUse::YES);
videoTrack->readTrees(bs, _header.mMapSize, _header.mClrSize, _header.fullSize, _header.typeSize);
_firstFrameStart = _fileStream->pos();
@@ -469,7 +469,7 @@ void SmackerDecoder::readNextPacket() {
_fileStream->read(frameData, frameDataSize);
- Common::BitStream8LSB bs(new Common::MemoryReadStream(frameData, frameDataSize + 1, DisposeAfterUse::YES), true);
+ Common::BitStream8LSB bs(new Common::MemoryReadStream(frameData, frameDataSize + 1, DisposeAfterUse::YES), DisposeAfterUse::YES);
videoTrack->decodeFrame(bs);
_fileStream->seek(startPos + frameSize);
@@ -773,7 +773,7 @@ Audio::AudioStream *SmackerDecoder::SmackerAudioTrack::getAudioStream() const {
}
void SmackerDecoder::SmackerAudioTrack::queueCompressedBuffer(byte *buffer, uint32 bufferSize, uint32 unpackedSize) {
- Common::BitStream8LSB audioBS(new Common::MemoryReadStream(buffer, bufferSize), true);
+ Common::BitStream8LSB audioBS(new Common::MemoryReadStream(buffer, bufferSize), DisposeAfterUse::YES);
bool dataPresent = audioBS.getBit();
if (!dataPresent)