aboutsummaryrefslogtreecommitdiff
path: root/common/stream.cpp
diff options
context:
space:
mode:
authorMatthew Hoops2011-08-26 22:44:17 -0400
committerMatthew Hoops2011-08-26 22:44:17 -0400
commit4a69dc13d92e82fff85dc5a3a923b74ced259ffa (patch)
tree8945cd3745fd65f28b043caf7b1beddbbce2b2a1 /common/stream.cpp
parentad293b249e74dd1cfbdbd721d02145efbdaf9eca (diff)
parent5e174cbfe466dbbe8e5470b0a00de1481b986181 (diff)
downloadscummvm-rg350-4a69dc13d92e82fff85dc5a3a923b74ced259ffa.tar.gz
scummvm-rg350-4a69dc13d92e82fff85dc5a3a923b74ced259ffa.tar.bz2
scummvm-rg350-4a69dc13d92e82fff85dc5a3a923b74ced259ffa.zip
Merge remote branch 'upstream/master' into pegasus
Diffstat (limited to 'common/stream.cpp')
-rw-r--r--common/stream.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/common/stream.cpp b/common/stream.cpp
index 60b40d0df2..30b3bca497 100644
--- a/common/stream.cpp
+++ b/common/stream.cpp
@@ -20,6 +20,7 @@
*
*/
+#include "common/ptr.h"
#include "common/stream.h"
#include "common/memstream.h"
#include "common/substream.h"
@@ -258,8 +259,7 @@ namespace {
*/
class BufferedReadStream : virtual public ReadStream {
protected:
- ReadStream *_parentStream;
- DisposeAfterUse::Flag _disposeParentStream;
+ DisposablePtr<ReadStream> _parentStream;
byte *_buf;
uint32 _pos;
bool _eos; // end of stream
@@ -278,8 +278,7 @@ public:
};
BufferedReadStream::BufferedReadStream(ReadStream *parentStream, uint32 bufSize, DisposeAfterUse::Flag disposeParentStream)
- : _parentStream(parentStream),
- _disposeParentStream(disposeParentStream),
+ : _parentStream(parentStream, disposeParentStream),
_pos(0),
_eos(false),
_bufSize(0),
@@ -291,8 +290,6 @@ BufferedReadStream::BufferedReadStream(ReadStream *parentStream, uint32 bufSize,
}
BufferedReadStream::~BufferedReadStream() {
- if (_disposeParentStream)
- delete _parentStream;
delete[] _buf;
}