diff options
author | Christoph Mallon | 2011-08-06 16:30:52 +0200 |
---|---|---|
committer | Christoph Mallon | 2011-08-07 15:19:08 +0200 |
commit | a5a8833c059f28c85e392a3cd22c361d38ef95ff (patch) | |
tree | 3b3b69326019444c2c375c66f39cb3013a003591 /audio/decoders/mp3.cpp | |
parent | 2f23ff72c1d804d9d0e3ac09c46f52fd6b23a68c (diff) | |
download | scummvm-rg350-a5a8833c059f28c85e392a3cd22c361d38ef95ff.tar.gz scummvm-rg350-a5a8833c059f28c85e392a3cd22c361d38ef95ff.tar.bz2 scummvm-rg350-a5a8833c059f28c85e392a3cd22c361d38ef95ff.zip |
COMMON: Add DisposablePtr<T>, which replaces many repeated implementations of a dispose flag.
Diffstat (limited to 'audio/decoders/mp3.cpp')
-rw-r--r-- | audio/decoders/mp3.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/audio/decoders/mp3.cpp b/audio/decoders/mp3.cpp index 8d7f006ec7..00669945c2 100644 --- a/audio/decoders/mp3.cpp +++ b/audio/decoders/mp3.cpp @@ -25,6 +25,7 @@ #ifdef USE_MAD #include "common/debug.h" +#include "common/ptr.h" #include "common/stream.h" #include "common/textconsole.h" #include "common/util.h" @@ -52,8 +53,7 @@ protected: MP3_STATE_EOS // end of data reached (may need to loop) }; - Common::SeekableReadStream *_inStream; - DisposeAfterUse::Flag _disposeAfterUse; + Common::DisposablePtr<Common::SeekableReadStream> _inStream; uint _posInFrame; State _state; @@ -95,8 +95,7 @@ protected: }; MP3Stream::MP3Stream(Common::SeekableReadStream *inStream, DisposeAfterUse::Flag dispose) : - _inStream(inStream), - _disposeAfterUse(dispose), + _inStream(inStream, dispose), _posInFrame(0), _state(MP3_STATE_INIT), _length(0, 1000), @@ -134,9 +133,6 @@ MP3Stream::MP3Stream(Common::SeekableReadStream *inStream, DisposeAfterUse::Flag MP3Stream::~MP3Stream() { deinitStream(); - - if (_disposeAfterUse == DisposeAfterUse::YES) - delete _inStream; } void MP3Stream::decodeMP3Data() { |