aboutsummaryrefslogtreecommitdiff
path: root/common/substream.h
diff options
context:
space:
mode:
authorMatthew Hoops2011-08-07 20:11:27 -0400
committerMatthew Hoops2011-08-07 20:11:27 -0400
commitc05c42ecc60c8f928628787272743f169a0d5903 (patch)
treef2b06be630676b7302a1fb62940099b2ec71442d /common/substream.h
parente43a6671fc04f2c67b8efa2c0fdfdd6ec0ea1023 (diff)
parent45dc303159d5bbe77a351df31e6f2d2f97a3412d (diff)
downloadscummvm-rg350-c05c42ecc60c8f928628787272743f169a0d5903.tar.gz
scummvm-rg350-c05c42ecc60c8f928628787272743f169a0d5903.tar.bz2
scummvm-rg350-c05c42ecc60c8f928628787272743f169a0d5903.zip
Merge remote branch 'upstream/master' into soccer
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(); }