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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Thu Oct 28 02:26:26 CEST 2010


Revision: 53899
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53899&view=rev
Author:   fingolfin
Date:     2010-10-28 00:26:25 +0000 (Thu, 28 Oct 2010)

Log Message:
-----------
SWORD25: Start to rename read/write methods of *PersistenceBlock classes

All should be renamed to reduce risk of accidental incorrect use.

Modified Paths:
--------------
    scummvm/trunk/engines/sword25/gfx/animation.cpp
    scummvm/trunk/engines/sword25/gfx/animationtemplate.cpp
    scummvm/trunk/engines/sword25/gfx/staticbitmap.cpp
    scummvm/trunk/engines/sword25/gfx/text.cpp
    scummvm/trunk/engines/sword25/input/inputengine.cpp
    scummvm/trunk/engines/sword25/kernel/inputpersistenceblock.cpp
    scummvm/trunk/engines/sword25/kernel/inputpersistenceblock.h
    scummvm/trunk/engines/sword25/kernel/outputpersistenceblock.cpp
    scummvm/trunk/engines/sword25/kernel/outputpersistenceblock.h
    scummvm/trunk/engines/sword25/script/luascript.cpp

Modified: scummvm/trunk/engines/sword25/gfx/animation.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/animation.cpp	2010-10-28 00:25:33 UTC (rev 53898)
+++ scummvm/trunk/engines/sword25/gfx/animation.cpp	2010-10-28 00:26:25 UTC (rev 53899)
@@ -562,7 +562,7 @@
 	if (_animationResourcePtr) {
 		uint marker = 0;
 		writer.write(marker);
-		writer.write(_animationResourcePtr->getFileName());
+		writer.writeString(_animationResourcePtr->getFileName());
 	} else if (_animationTemplateHandle) {
 		uint marker = 1;
 		writer.write(marker);
@@ -578,13 +578,13 @@
 	// The following is only there to for compatibility with older saves
 	// resp. the original engine.
 	writer.write((uint)1);
-	writer.write(Common::String("LuaLoopPointCB"));
+	writer.writeString("LuaLoopPointCB");
 	writer.write(getHandle());
 	writer.write((uint)1);
-	writer.write(Common::String("LuaActionCB"));
+	writer.writeString("LuaActionCB");
 	writer.write(getHandle());
 	writer.write((uint)1);
-	writer.write(Common::String("LuaDeleteCB"));
+	writer.writeString("LuaDeleteCB");
 	writer.write(getHandle());
 
 	result &= RenderObject::persistChildren(writer);
@@ -617,7 +617,7 @@
 	reader.read(marker);
 	if (marker == 0) {
 		Common::String resourceFilename;
-		reader.read(resourceFilename);
+		reader.readString(resourceFilename);
 		initializeAnimationResource(resourceFilename);
 	} else if (marker == 1) {
 		reader.read(_animationTemplateHandle);
@@ -639,7 +639,7 @@
 	// loop point callback
 	reader.read(callbackCount);
 	assert(callbackCount == 1);
-	reader.read(callbackFunctionName);
+	reader.readString(callbackFunctionName);
 	assert(callbackFunctionName == "LuaLoopPointCB");
 	reader.read(callbackData);
 	assert(callbackData == getHandle());
@@ -647,7 +647,7 @@
 	// loop point callback
 	reader.read(callbackCount);
 	assert(callbackCount == 1);
-	reader.read(callbackFunctionName);
+	reader.readString(callbackFunctionName);
 	assert(callbackFunctionName == "LuaActionCB");
 	reader.read(callbackData);
 	assert(callbackData == getHandle());
@@ -655,7 +655,7 @@
 	// loop point callback
 	reader.read(callbackCount);
 	assert(callbackCount == 1);
-	reader.read(callbackFunctionName);
+	reader.readString(callbackFunctionName);
 	assert(callbackFunctionName == "LuaDeleteCB");
 	reader.read(callbackData);
 	assert(callbackData == getHandle());

Modified: scummvm/trunk/engines/sword25/gfx/animationtemplate.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/animationtemplate.cpp	2010-10-28 00:25:33 UTC (rev 53898)
+++ scummvm/trunk/engines/sword25/gfx/animationtemplate.cpp	2010-10-28 00:26:25 UTC (rev 53899)
@@ -195,13 +195,13 @@
 		writer.write(Iter->hotspotY);
 		writer.write(Iter->flipV);
 		writer.write(Iter->flipH);
-		writer.write(Iter->fileName);
-		writer.write(Iter->action);
+		writer.writeString(Iter->fileName);
+		writer.writeString(Iter->action);
 		++Iter;
 	}
 
 	// Restliche Member persistieren.
-	writer.write(_sourceAnimationPtr->getFileName());
+	writer.writeString(_sourceAnimationPtr->getFileName());
 	writer.write(_valid);
 
 	return Result;
@@ -224,15 +224,15 @@
 		reader.read(frame.hotspotY);
 		reader.read(frame.flipV);
 		reader.read(frame.flipH);
-		reader.read(frame.fileName);
-		reader.read(frame.action);
+		reader.readString(frame.fileName);
+		reader.readString(frame.action);
 
 		_frames.push_back(frame);
 	}
 
 	// Die Animations-Resource wird f\xFCr die gesamte Lebensdauer des Objektes gelockt
 	Common::String sourceAnimation;
-	reader.read(sourceAnimation);
+	reader.readString(sourceAnimation);
 	_sourceAnimationPtr = requestSourceAnimation(sourceAnimation);
 
 	reader.read(_valid);

Modified: scummvm/trunk/engines/sword25/gfx/staticbitmap.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/staticbitmap.cpp	2010-10-28 00:25:33 UTC (rev 53898)
+++ scummvm/trunk/engines/sword25/gfx/staticbitmap.cpp	2010-10-28 00:26:25 UTC (rev 53899)
@@ -162,7 +162,7 @@
 	bool result = true;
 
 	result &= Bitmap::persist(writer);
-	writer.write(_resourceFilename);
+	writer.writeString(_resourceFilename);
 
 	result &= RenderObject::persistChildren(writer);
 
@@ -174,7 +174,7 @@
 
 	result &= Bitmap::unpersist(reader);
 	Common::String resourceFilename;
-	reader.read(resourceFilename);
+	reader.readString(resourceFilename);
 	result &= initBitmapResource(resourceFilename);
 
 	result &= RenderObject::unpersistChildren(reader);

Modified: scummvm/trunk/engines/sword25/gfx/text.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/text.cpp	2010-10-28 00:25:33 UTC (rev 53898)
+++ scummvm/trunk/engines/sword25/gfx/text.cpp	2010-10-28 00:26:25 UTC (rev 53899)
@@ -313,8 +313,8 @@
 	result &= RenderObject::persist(writer);
 
 	writer.write(_modulationColor);
-	writer.write(_font);
-	writer.write(_text);
+	writer.writeString(_font);
+	writer.writeString(_text);
 	writer.write(_autoWrap);
 	writer.write(_autoWrapThreshold);
 
@@ -335,11 +335,11 @@
 	// So wird das Layout automatisch aktualisiert und auch alle anderen notwendigen Methoden ausgef\xFChrt.
 
 	Common::String font;
-	reader.read(font);
+	reader.readString(font);
 	setFont(font);
 
 	Common::String text;
-	reader.read(text);
+	reader.readString(text);
 	setText(text);
 
 	bool autoWrap;

Modified: scummvm/trunk/engines/sword25/input/inputengine.cpp
===================================================================
--- scummvm/trunk/engines/sword25/input/inputengine.cpp	2010-10-28 00:25:33 UTC (rev 53898)
+++ scummvm/trunk/engines/sword25/input/inputengine.cpp	2010-10-28 00:26:25 UTC (rev 53899)
@@ -243,13 +243,13 @@
 	// Note: We do this only for compatibility with older engines resp.
 	// the original engine.
 	writer.write((uint)1);
-	writer.write(Common::String("LuaCommandCB"));
+	writer.writeString("LuaCommandCB");
 
 	// Write out the number of command callbacks and their names.
 	// Note: We do this only for compatibility with older engines resp.
 	// the original engine.
 	writer.write((uint)1);
-	writer.write(Common::String("LuaCharacterCB"));
+	writer.writeString("LuaCharacterCB");
 
 	return true;
 }
@@ -264,7 +264,7 @@
 	reader.read(commandCallbackCount);
 	assert(commandCallbackCount == 1);
 
-	reader.read(callbackFunctionName);
+	reader.readString(callbackFunctionName);
 	assert(callbackFunctionName == "LuaCommandCB");
 
 	// Read number of character callbacks and their names.
@@ -274,7 +274,7 @@
 	reader.read(characterCallbackCount);
 	assert(characterCallbackCount == 1);
 
-	reader.read(callbackFunctionName);
+	reader.readString(callbackFunctionName);
 	assert(callbackFunctionName == "LuaCharacterCB");
 
 	return reader.isGood();

Modified: scummvm/trunk/engines/sword25/kernel/inputpersistenceblock.cpp
===================================================================
--- scummvm/trunk/engines/sword25/kernel/inputpersistenceblock.cpp	2010-10-28 00:25:33 UTC (rev 53898)
+++ scummvm/trunk/engines/sword25/kernel/inputpersistenceblock.cpp	2010-10-28 00:26:25 UTC (rev 53899)
@@ -93,7 +93,7 @@
 	}
 }
 
-void InputPersistenceBlock::read(Common::String &value) {
+void InputPersistenceBlock::readString(Common::String &value) {
 	value = "";
 
 	if (checkMarker(STRING_MARKER)) {
@@ -107,7 +107,7 @@
 	}
 }
 
-void InputPersistenceBlock::read(Common::Array<byte> &value) {
+void InputPersistenceBlock::readByteArray(Common::Array<byte> &value) {
 	if (checkMarker(BLOCK_MARKER)) {
 		uint size;
 		read(size);

Modified: scummvm/trunk/engines/sword25/kernel/inputpersistenceblock.h
===================================================================
--- scummvm/trunk/engines/sword25/kernel/inputpersistenceblock.h	2010-10-28 00:25:33 UTC (rev 53898)
+++ scummvm/trunk/engines/sword25/kernel/inputpersistenceblock.h	2010-10-28 00:26:25 UTC (rev 53899)
@@ -57,8 +57,8 @@
 	void read(uint &value);
 	void read(float &value);
 	void read(bool &value);
-	void read(Common::String &value);
-	void read(Common::Array<byte> &value);
+	void readString(Common::String &value);
+	void readByteArray(Common::Array<byte> &value);
 
 	bool isGood() const {
 		return _errorState == NONE;

Modified: scummvm/trunk/engines/sword25/kernel/outputpersistenceblock.cpp
===================================================================
--- scummvm/trunk/engines/sword25/kernel/outputpersistenceblock.cpp	2010-10-28 00:25:33 UTC (rev 53898)
+++ scummvm/trunk/engines/sword25/kernel/outputpersistenceblock.cpp	2010-10-28 00:26:25 UTC (rev 53899)
@@ -72,27 +72,20 @@
 	rawWrite(&uintBool, sizeof(uintBool));
 }
 
-void OutputPersistenceBlock::write(const Common::String &string) {
+void OutputPersistenceBlock::writeString(const Common::String &string) {
 	writeMarker(STRING_MARKER);
 
 	write(string.size());
 	rawWrite(string.c_str(), string.size());
 }
 
-void OutputPersistenceBlock::write(Common::Array<byte> &value) {
+void OutputPersistenceBlock::writeByteArray(Common::Array<byte> &value) {
 	writeMarker(BLOCK_MARKER);
 
 	write((uint)value.size());
 	rawWrite(&value[0], value.size());
 }
 
-void OutputPersistenceBlock::write(const void *bufferPtr, size_t size) {
-	writeMarker(BLOCK_MARKER);
-
-	write((int)size);
-	rawWrite(bufferPtr, size);
-}
-
 void OutputPersistenceBlock::writeMarker(byte marker) {
 	_data.push_back(marker);
 }

Modified: scummvm/trunk/engines/sword25/kernel/outputpersistenceblock.h
===================================================================
--- scummvm/trunk/engines/sword25/kernel/outputpersistenceblock.h	2010-10-28 00:25:33 UTC (rev 53898)
+++ scummvm/trunk/engines/sword25/kernel/outputpersistenceblock.h	2010-10-28 00:26:25 UTC (rev 53899)
@@ -48,9 +48,8 @@
 	void write(uint value);
 	void write(float value);
 	void write(bool value);
-	void write(const Common::String &string);
-	void write(Common::Array<byte> &value);
-	void write(const void *bufferPtr, size_t size);
+	void writeString(const Common::String &string);
+	void writeByteArray(Common::Array<byte> &value);
 
 	const void *getData() const {
 		return &_data[0];

Modified: scummvm/trunk/engines/sword25/script/luascript.cpp
===================================================================
--- scummvm/trunk/engines/sword25/script/luascript.cpp	2010-10-28 00:25:33 UTC (rev 53898)
+++ scummvm/trunk/engines/sword25/script/luascript.cpp	2010-10-28 00:26:25 UTC (rev 53899)
@@ -419,7 +419,7 @@
 	pluto_persist(_state, chunkwriter, &chunkData);
 
 	// Persistenzdaten in den Writer schreiben.
-	writer.write(chunkData);
+	writer.writeByteArray(chunkData);
 
 	// Die beiden Tabellen vom Stack nehmen.
 	lua_pop(_state, 2);
@@ -516,7 +516,7 @@
 
 	// Persisted Lua data
 	Common::Array<byte> chunkData;
-	reader.read(chunkData);
+	reader.readByteArray(chunkData);
 
 	// Chunk-Reader initialisation. It is used with pluto_unpersist to restore read data
 	ChunkreaderData cd;


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