diff options
author | Max Horn | 2010-11-18 20:27:15 +0000 |
---|---|---|
committer | Max Horn | 2010-11-18 20:27:15 +0000 |
commit | 9fb1e2b17ea294b06297139198cd80c06783a714 (patch) | |
tree | 73ee6bee476d6b470caa53390d70591b6c55ee20 /common/stream.cpp | |
parent | 9531b7766ca99e1c6aac78474a4c73188dbad00f (diff) | |
download | scummvm-rg350-9fb1e2b17ea294b06297139198cd80c06783a714.tar.gz scummvm-rg350-9fb1e2b17ea294b06297139198cd80c06783a714.tar.bz2 scummvm-rg350-9fb1e2b17ea294b06297139198cd80c06783a714.zip |
COMMON: Change wrapBufferedWriteStream() to always disposes wrapped stream
This is the only we need right now, and it saves a few bytes per
instance. The template approach I used before has the drawback that it
increases the binary size, which negates the benefit. Thanks to LordHoto
for pointing this out.
svn-id: r54344
Diffstat (limited to 'common/stream.cpp')
-rw-r--r-- | common/stream.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/common/stream.cpp b/common/stream.cpp index b82a70409a..2abd6fc986 100644 --- a/common/stream.cpp +++ b/common/stream.cpp @@ -421,7 +421,6 @@ namespace { /** * Wrapper class which adds buffering to any WriteStream. */ -template <DisposeAfterUse::Flag _disposeParentStream> class BufferedWriteStream : public WriteStream { protected: WriteStream *_parentStream; @@ -462,8 +461,7 @@ public: const bool flushResult = flushBuffer(); assert(flushResult); - if (_disposeParentStream) - delete _parentStream; + delete _parentStream; delete[] _buf; } @@ -492,15 +490,9 @@ public: } // End of nameless namespace -WriteStream *wrapBufferedWriteStream(WriteStream *parentStream, uint32 bufSize, DisposeAfterUse::Flag disposeParentStream) { - if (parentStream) { - switch (disposeParentStream) { - case DisposeAfterUse::YES: - return new BufferedWriteStream<DisposeAfterUse::YES>(parentStream, bufSize); - case DisposeAfterUse::NO: - return new BufferedWriteStream<DisposeAfterUse::NO>(parentStream, bufSize); - } - } +WriteStream *wrapBufferedWriteStream(WriteStream *parentStream, uint32 bufSize) { + if (parentStream) + return new BufferedWriteStream(parentStream, bufSize); return 0; } |