[Scummvm-cvs-logs] SF.net SVN: scummvm:[54323] scummvm/trunk/engines

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Thu Nov 18 17:38:04 CET 2010


Revision: 54323
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54323&view=rev
Author:   fingolfin
Date:     2010-11-18 16:38:03 +0000 (Thu, 18 Nov 2010)

Log Message:
-----------
ENGINES: Do not use MemoryReadStream where (Seekable)ReadStream suffices; avoid using 'using'

Modified Paths:
--------------
    scummvm/trunk/engines/draci/script.cpp
    scummvm/trunk/engines/draci/script.h
    scummvm/trunk/engines/gob/resources.cpp
    scummvm/trunk/engines/gob/resources.h
    scummvm/trunk/engines/saga/actor.h
    scummvm/trunk/engines/saga/animation.cpp
    scummvm/trunk/engines/saga/objectmap.cpp
    scummvm/trunk/engines/saga/objectmap.h
    scummvm/trunk/engines/saga/resource.cpp
    scummvm/trunk/engines/saga/saga.h
    scummvm/trunk/engines/saga/script.h
    scummvm/trunk/engines/saga/sprite.cpp
    scummvm/trunk/engines/saga/sthread.cpp

Modified: scummvm/trunk/engines/draci/script.cpp
===================================================================
--- scummvm/trunk/engines/draci/script.cpp	2010-11-18 16:08:56 UTC (rev 54322)
+++ scummvm/trunk/engines/draci/script.cpp	2010-11-18 16:38:03 UTC (rev 54323)
@@ -900,7 +900,7 @@
  * @brief Evaluates mathematical expressions
  * @param reader Stream reader set to the beginning of the expression
  */
-int Script::handleMathExpression(Common::MemoryReadStream *reader) const {
+int Script::handleMathExpression(Common::ReadStream *reader) const {
 	Common::Stack<int> stk;
 	mathExpressionObject obj;
 	GPL2Operator oper;

Modified: scummvm/trunk/engines/draci/script.h
===================================================================
--- scummvm/trunk/engines/draci/script.h	2010-11-18 16:08:56 UTC (rev 54322)
+++ scummvm/trunk/engines/draci/script.h	2010-11-18 16:38:03 UTC (rev 54323)
@@ -30,7 +30,7 @@
 #include "common/stream.h"
 
 namespace Common {
-	class MemoryReadStream;
+	class ReadStream;
 }
 
 namespace Draci {
@@ -193,7 +193,7 @@
 
 	void setupCommandList();
 	const GPL2Command *findCommand(byte num, byte subnum) const;
-	int handleMathExpression(Common::MemoryReadStream *reader) const;
+	int handleMathExpression(Common::ReadStream *reader) const;
 
 	DraciEngine *_vm;
 };

Modified: scummvm/trunk/engines/gob/resources.cpp
===================================================================
--- scummvm/trunk/engines/gob/resources.cpp	2010-11-18 16:08:56 UTC (rev 54322)
+++ scummvm/trunk/engines/gob/resources.cpp	2010-11-18 16:38:03 UTC (rev 54323)
@@ -71,7 +71,7 @@
 	return _height;
 }
 
-Common::MemoryReadStream *Resource::stream() const {
+Common::SeekableReadStream *Resource::stream() const {
 	return _stream;
 }
 
@@ -95,7 +95,7 @@
 	return _size;
 }
 
-Common::MemoryReadStream *TextItem::stream() const {
+Common::SeekableReadStream *TextItem::stream() const {
 	return _stream;
 }
 

Modified: scummvm/trunk/engines/gob/resources.h
===================================================================
--- scummvm/trunk/engines/gob/resources.h	2010-11-18 16:08:56 UTC (rev 54322)
+++ scummvm/trunk/engines/gob/resources.h	2010-11-18 16:38:03 UTC (rev 54323)
@@ -29,7 +29,7 @@
 #include "common/str.h"
 
 namespace Common {
-	class MemoryReadStream;
+	class SeekableReadStream;
 }
 
 namespace Gob {
@@ -47,7 +47,7 @@
 	int16 getWidth () const;
 	int16 getHeight() const;
 
-	Common::MemoryReadStream *stream() const;
+	Common::SeekableReadStream *stream() const;
 
 private:
 	byte *_data;
@@ -56,7 +56,7 @@
 	int16 _height;
 	bool  _needFree;
 
-	Common::MemoryReadStream *_stream;
+	Common::SeekableReadStream *_stream;
 };
 
 class TextItem {
@@ -67,13 +67,13 @@
 	byte *getData() const;
 	int32 getSize() const;
 
-	Common::MemoryReadStream *stream() const;
+	Common::SeekableReadStream *stream() const;
 
 private:
 	byte *_data;
 	int32 _size;
 
-	Common::MemoryReadStream *_stream;
+	Common::SeekableReadStream *_stream;
 };
 
 class Resources {

Modified: scummvm/trunk/engines/saga/actor.h
===================================================================
--- scummvm/trunk/engines/saga/actor.h	2010-11-18 16:08:56 UTC (rev 54322)
+++ scummvm/trunk/engines/saga/actor.h	2010-11-18 16:38:03 UTC (rev 54323)
@@ -267,7 +267,7 @@
 		screenPoint.x = x / ACTOR_LMULT;
 		screenPoint.y = y / ACTOR_LMULT - z;
 	}
-	void fromStream(MemoryReadStream &stream) {
+	void fromStream(Common::ReadStream &stream) {
 		x = stream.readUint16LE();
 		y = stream.readUint16LE();
 		z = stream.readUint16LE();

Modified: scummvm/trunk/engines/saga/animation.cpp
===================================================================
--- scummvm/trunk/engines/saga/animation.cpp	2010-11-18 16:08:56 UTC (rev 54322)
+++ scummvm/trunk/engines/saga/animation.cpp	2010-11-18 16:38:03 UTC (rev 54323)
@@ -680,7 +680,7 @@
 		error("decodeFrame() Buffer size inadequate");
 	}
 
-	MemoryReadStream readS(&anim->resourceData[frameOffset], anim->resourceData.size() - frameOffset);
+	Common::MemoryReadStream readS(&anim->resourceData[frameOffset], anim->resourceData.size() - frameOffset);
 
 // FIXME: This is thrown when the first video of the IHNM end sequence is shown (the "turn off screen"
 // video), however the video is played correctly and the rest of the end sequence continues normally
@@ -817,7 +817,7 @@
 	int i;
 	bool longData = isLongData();
 
-	MemoryReadStreamEndian readS(&anim->resourceData.front(), anim->resourceData.size(), !_vm->isBigEndian()); // RLE has inversion BE<>LE
+	Common::MemoryReadStreamEndian readS(&anim->resourceData.front(), anim->resourceData.size(), !_vm->isBigEndian()); // RLE has inversion BE<>LE
 
 	while (readS.pos() != readS.size()) {
 		if (reallyFill) {

Modified: scummvm/trunk/engines/saga/objectmap.cpp
===================================================================
--- scummvm/trunk/engines/saga/objectmap.cpp	2010-11-18 16:08:56 UTC (rev 54322)
+++ scummvm/trunk/engines/saga/objectmap.cpp	2010-11-18 16:38:03 UTC (rev 54323)
@@ -45,7 +45,7 @@
 
 namespace Saga {
 
-void HitZone::load(SagaEngine *vm, MemoryReadStreamEndian *readStream, int index, int sceneNumber) {
+void HitZone::load(SagaEngine *vm, Common::MemoryReadStreamEndian *readStream, int index, int sceneNumber) {
 	_index = index;
 	_flags = readStream->readByte();
 	_clickAreas.resize(readStream->readByte());

Modified: scummvm/trunk/engines/saga/objectmap.h
===================================================================
--- scummvm/trunk/engines/saga/objectmap.h	2010-11-18 16:08:56 UTC (rev 54322)
+++ scummvm/trunk/engines/saga/objectmap.h	2010-11-18 16:38:03 UTC (rev 54323)
@@ -36,7 +36,7 @@
 	typedef Common::Array<Point> ClickArea;
 	typedef Common::Array<ClickArea> ClickAreas;
 public:
-	void load(SagaEngine *vm, MemoryReadStreamEndian *readStream, int index, int sceneNumber);
+	void load(SagaEngine *vm, Common::MemoryReadStreamEndian *readStream, int index, int sceneNumber);
 
 	int getIndex() const {
 		return _index;

Modified: scummvm/trunk/engines/saga/resource.cpp
===================================================================
--- scummvm/trunk/engines/saga/resource.cpp	2010-11-18 16:08:56 UTC (rev 54322)
+++ scummvm/trunk/engines/saga/resource.cpp	2010-11-18 16:38:03 UTC (rev 54323)
@@ -58,7 +58,7 @@
 		return false;
 	}
 
-	MemoryReadStreamEndian readS(tableInfo, RSC_TABLEINFO_SIZE, _isBigEndian);
+	Common::MemoryReadStreamEndian readS(tableInfo, RSC_TABLEINFO_SIZE, _isBigEndian);
 
 	resourceTableOffset = readS.readUint32();
 	count = readS.readUint32();
@@ -77,7 +77,7 @@
 	if (result) {
 		_table.resize(count);
 
-		MemoryReadStreamEndian readS1(tableBuffer.getBuffer(), tableBuffer.size(), _isBigEndian);
+		Common::MemoryReadStreamEndian readS1(tableBuffer.getBuffer(), tableBuffer.size(), _isBigEndian);
 
 		for (i = 0; i < count; i++) {
 			resourceData = &_table[i];

Modified: scummvm/trunk/engines/saga/saga.h
===================================================================
--- scummvm/trunk/engines/saga/saga.h	2010-11-18 16:08:56 UTC (rev 54322)
+++ scummvm/trunk/engines/saga/saga.h	2010-11-18 16:38:03 UTC (rev 54323)
@@ -83,9 +83,6 @@
 
 class ResourceContext;
 
-using Common::MemoryReadStream;
-using Common::MemoryReadStreamEndian;
-
 // #define SAGA_DEBUG 1		// define for test functions
 #define SAGA_IMAGE_DATA_OFFSET 776
 #define SAGA_IMAGE_HEADER_LEN  8
@@ -480,9 +477,10 @@
 	}
 };
 
-class ByteArrayReadStreamEndian : public MemoryReadStreamEndian {
+class ByteArrayReadStreamEndian : public Common::MemoryReadStreamEndian {
 public:
-	ByteArrayReadStreamEndian(const ByteArray & byteArray, bool bigEndian = false) : MemoryReadStreamEndian(byteArray.getBuffer(), byteArray.size(), bigEndian) {
+	ByteArrayReadStreamEndian(const ByteArray & byteArray, bool bigEndian = false)
+		: Common::MemoryReadStreamEndian(byteArray.getBuffer(), byteArray.size(), bigEndian) {
 	}
 };
 

Modified: scummvm/trunk/engines/saga/script.h
===================================================================
--- scummvm/trunk/engines/saga/script.h	2010-11-18 16:08:56 UTC (rev 54322)
+++ scummvm/trunk/engines/saga/script.h	2010-11-18 16:38:03 UTC (rev 54323)
@@ -270,7 +270,7 @@
 
 typedef Common::List<ScriptThread> ScriptThreadList;
 
-#define SCRIPTOP_PARAMS ScriptThread *thread, MemoryReadStream *scriptS, bool &stopParsing, bool &breakOut
+#define SCRIPTOP_PARAMS ScriptThread *thread, Common::SeekableReadStream *scriptS, bool &stopParsing, bool &breakOut
 #define SCRIPTFUNC_PARAMS ScriptThread *thread, int nArgs, bool &disContinue
 #define OPCODE(x) {&Script::x, #x}
 

Modified: scummvm/trunk/engines/saga/sprite.cpp
===================================================================
--- scummvm/trunk/engines/saga/sprite.cpp	2010-11-18 16:08:56 UTC (rev 54322)
+++ scummvm/trunk/engines/saga/sprite.cpp	2010-11-18 16:38:03 UTC (rev 54323)
@@ -122,7 +122,7 @@
 		spritePointer += offset;
 
 		if (bigHeader) {
-			MemoryReadStreamEndian readS2(spritePointer, 8, _spriteContext->isBigEndian());
+			Common::MemoryReadStreamEndian readS2(spritePointer, 8, _spriteContext->isBigEndian());
 
 			spriteInfo->xAlign = readS2.readSint16();
 			spriteInfo->yAlign = readS2.readSint16();
@@ -132,7 +132,7 @@
 
 			spriteDataPointer = spritePointer + readS2.pos();
 		} else {
-			MemoryReadStreamEndian readS2(spritePointer, 4);
+			Common::MemoryReadStreamEndian readS2(spritePointer, 4);
 
 			spriteInfo->xAlign = readS2.readSByte();
 			spriteInfo->yAlign = readS2.readSByte();
@@ -438,7 +438,7 @@
 
 	memset(outPointer, 0, _decodeBuf.size());
 
-	MemoryReadStream readS(inputBuffer, inLength);
+	Common::MemoryReadStream readS(inputBuffer, inLength);
 
 	while (!readS.eos() && (outPointer < outPointerEnd)) {
 		bg_runcount = readS.readByte();

Modified: scummvm/trunk/engines/saga/sthread.cpp
===================================================================
--- scummvm/trunk/engines/saga/sthread.cpp	2010-11-18 16:08:56 UTC (rev 54322)
+++ scummvm/trunk/engines/saga/sthread.cpp	2010-11-18 16:38:03 UTC (rev 54323)
@@ -198,7 +198,7 @@
 	bool breakOut = false;
 	int operandChar;
 
-	MemoryReadStream scriptS(thread._moduleBase, thread._moduleBaseSize);
+	Common::MemoryReadStream scriptS(thread._moduleBase, thread._moduleBaseSize);
 
 	scriptS.seek(thread._instructionOffset);
 


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