aboutsummaryrefslogtreecommitdiff
path: root/common/substream.h
diff options
context:
space:
mode:
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(); }