aboutsummaryrefslogtreecommitdiff
path: root/common/substream.h
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/substream.h
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/substream.h')
-rw-r--r--common/substream.h11
1 files changed, 3 insertions, 8 deletions
diff --git a/common/substream.h b/common/substream.h
index f4f79ff02f..7e67389da1 100644
--- a/common/substream.h
+++ b/common/substream.h
@@ -23,6 +23,7 @@
#ifndef COMMON_SUBSTREAM_H
#define COMMON_SUBSTREAM_H
+#include "common/ptr.h"
#include "common/stream.h"
#include "common/types.h"
@@ -38,24 +39,18 @@ namespace Common {
*/
class SubReadStream : virtual public ReadStream {
protected:
- ReadStream *_parentStream;
- DisposeAfterUse::Flag _disposeParentStream;
+ DisposablePtr<ReadStream> _parentStream;
uint32 _pos;
uint32 _end;
bool _eos;
public:
SubReadStream(ReadStream *parentStream, uint32 end, DisposeAfterUse::Flag disposeParentStream = DisposeAfterUse::NO)
- : _parentStream(parentStream),
- _disposeParentStream(disposeParentStream),
+ : _parentStream(parentStream, disposeParentStream),
_pos(0),
_end(end),
_eos(false) {
assert(parentStream);
}
- ~SubReadStream() {
- if (_disposeParentStream)
- delete _parentStream;
- }
virtual bool eos() const { return _eos | _parentStream->eos(); }
virtual bool err() const { return _parentStream->err(); }