diff options
author | Yotam Barnoy | 2010-09-14 14:57:30 +0000 |
---|---|---|
committer | Yotam Barnoy | 2010-09-14 14:57:30 +0000 |
commit | 94b41f5d2e75b43700902c12ba4fd0fd9426b0e8 (patch) | |
tree | 1836e90364e2d57a3560ce0ce48b4d23f233081b /common | |
parent | 9dfb24851c2a5cf5454dfbf63f085f73b8bd17c0 (diff) | |
download | scummvm-rg350-94b41f5d2e75b43700902c12ba4fd0fd9426b0e8.tar.gz scummvm-rg350-94b41f5d2e75b43700902c12ba4fd0fd9426b0e8.tar.bz2 scummvm-rg350-94b41f5d2e75b43700902c12ba4fd0fd9426b0e8.zip |
COMMON: remove virtual functions from BufferedStreams
As Max pointed out to me, they don't work as expected when called from constructors/destructors.
svn-id: r52724
Diffstat (limited to 'common')
-rw-r--r-- | common/stream.cpp | 20 | ||||
-rw-r--r-- | common/stream.h | 4 |
2 files changed, 2 insertions, 22 deletions
diff --git a/common/stream.cpp b/common/stream.cpp index 718c806ff3..8f8f278afd 100644 --- a/common/stream.cpp +++ b/common/stream.cpp @@ -231,21 +231,13 @@ BufferedReadStream::BufferedReadStream(ReadStream *parentStream, uint32 bufSize, _realBufSize(bufSize) { assert(parentStream); - allocBuf(bufSize); - assert(_buf); -} - -void BufferedReadStream::allocBuf(uint32 bufSize) { _buf = new byte[bufSize]; + assert(_buf); } BufferedReadStream::~BufferedReadStream() { if (_disposeParentStream) delete _parentStream; - deallocBuf(); -} - -void BufferedReadStream::deallocBuf() { delete[] _buf; } @@ -334,7 +326,7 @@ BufferedWriteStream::BufferedWriteStream(WriteStream *parentStream, uint32 bufSi _bufSize(bufSize) { assert(parentStream); - allocBuf(bufSize); + _buf = new byte[bufSize]; assert(_buf); } @@ -344,14 +336,6 @@ BufferedWriteStream::~BufferedWriteStream() { if (_disposeParentStream) delete _parentStream; - deallocBuf(); -} - -void BufferedWriteStream::allocBuf(uint32 bufSize) { - _buf = new byte[bufSize]; -} - -void BufferedWriteStream::deallocBuf() { delete[] _buf; } diff --git a/common/stream.h b/common/stream.h index 10cc8c79cd..4e627c2b1d 100644 --- a/common/stream.h +++ b/common/stream.h @@ -497,8 +497,6 @@ protected: bool _eos; // end of stream uint32 _bufSize; uint32 _realBufSize; - void allocBuf(uint32 bufSize); - void deallocBuf(); public: BufferedReadStream(ReadStream *parentStream, uint32 bufSize, DisposeAfterUse::Flag disposeParentStream = DisposeAfterUse::NO); @@ -538,8 +536,6 @@ protected: uint32 _pos; uint32 _bufSize; bool flushBuffer(); // write out the data in the buffer - void allocBuf(uint32 bufSize); - void deallocBuf(); public: BufferedWriteStream(WriteStream *parentStream, uint32 bufSize, DisposeAfterUse::Flag disposeParentStream = DisposeAfterUse::NO); |