aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYotam Barnoy2010-09-14 14:57:30 +0000
committerYotam Barnoy2010-09-14 14:57:30 +0000
commit94b41f5d2e75b43700902c12ba4fd0fd9426b0e8 (patch)
tree1836e90364e2d57a3560ce0ce48b4d23f233081b
parent9dfb24851c2a5cf5454dfbf63f085f73b8bd17c0 (diff)
downloadscummvm-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
-rw-r--r--common/stream.cpp20
-rw-r--r--common/stream.h4
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);