[Scummvm-cvs-logs] SF.net SVN: scummvm:[52724] scummvm/trunk/common

Bluddy at users.sourceforge.net Bluddy at users.sourceforge.net
Tue Sep 14 16:57:30 CEST 2010


Revision: 52724
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52724&view=rev
Author:   Bluddy
Date:     2010-09-14 14:57:30 +0000 (Tue, 14 Sep 2010)

Log Message:
-----------
COMMON: remove virtual functions from BufferedStreams

As Max pointed out to me, they don't work as expected when called from constructors/destructors.

Modified Paths:
--------------
    scummvm/trunk/common/stream.cpp
    scummvm/trunk/common/stream.h

Modified: scummvm/trunk/common/stream.cpp
===================================================================
--- scummvm/trunk/common/stream.cpp	2010-09-14 14:18:25 UTC (rev 52723)
+++ scummvm/trunk/common/stream.cpp	2010-09-14 14:57:30 UTC (rev 52724)
@@ -231,21 +231,13 @@
 	_realBufSize(bufSize) {
 
 	assert(parentStream);
-	allocBuf(bufSize);
+	_buf = new byte[bufSize];
 	assert(_buf);
 }
 
-void BufferedReadStream::allocBuf(uint32 bufSize) {
-	_buf = new byte[bufSize];
-}
-
 BufferedReadStream::~BufferedReadStream() {
 	if (_disposeParentStream)
 		delete _parentStream;
-	deallocBuf();
-}
-
-void BufferedReadStream::deallocBuf() {
 	delete[] _buf;
 }
 
@@ -334,7 +326,7 @@
 	_bufSize(bufSize) {
 
 	assert(parentStream);
-	allocBuf(bufSize);
+	_buf = new byte[bufSize];
 	assert(_buf);
 }
 
@@ -344,14 +336,6 @@
 	if (_disposeParentStream)
 		delete _parentStream;
 		
-	deallocBuf();
-}
-
-void BufferedWriteStream::allocBuf(uint32 bufSize) {
-	_buf = new byte[bufSize];
-}
-
-void BufferedWriteStream::deallocBuf() {
 	delete[] _buf;
 }
 

Modified: scummvm/trunk/common/stream.h
===================================================================
--- scummvm/trunk/common/stream.h	2010-09-14 14:18:25 UTC (rev 52723)
+++ scummvm/trunk/common/stream.h	2010-09-14 14:57:30 UTC (rev 52724)
@@ -497,8 +497,6 @@
 	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 @@
 	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);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list