aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorPaul Gilbert2016-09-10 11:16:07 -0400
committerPaul Gilbert2016-09-10 11:16:07 -0400
commitbd010bc79f6a56b51c1414a8cafc64bc248496fe (patch)
treea1b2d0642709e4d79dce8774ba218d107c13e0c9 /common
parent9c7b9e166746a903dc0b7e87967ec257967e1359 (diff)
downloadscummvm-rg350-bd010bc79f6a56b51c1414a8cafc64bc248496fe.tar.gz
scummvm-rg350-bd010bc79f6a56b51c1414a8cafc64bc248496fe.tar.bz2
scummvm-rg350-bd010bc79f6a56b51c1414a8cafc64bc248496fe.zip
COMMON: Converted Common::BitStream to use DisposeAfterUse
Diffstat (limited to 'common')
-rw-r--r--common/bitstream.h11
1 files changed, 6 insertions, 5 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;
}