[Scummvm-cvs-logs] scummvm master -> 807d18e46031e38af700e8bfac0e0ed41fce5868

RichieSams adastley at gmail.com
Fri Sep 12 23:06:18 CEST 2014


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
807d18e460 SWORD25: Make save files x32/x64 agnostic


Commit: 807d18e46031e38af700e8bfac0e0ed41fce5868
    https://github.com/scummvm/scummvm/commit/807d18e46031e38af700e8bfac0e0ed41fce5868
Author: Adrian Astley (adastley at gmail.com)
Date: 2014-09-12T16:05:19-05:00

Commit Message:
SWORD25: Make save files x32/x64 agnostic

Changed paths:
    engines/sword25/util/pluto/pluto.cpp



diff --git a/engines/sword25/util/pluto/pluto.cpp b/engines/sword25/util/pluto/pluto.cpp
index fb477c1..c5ec496 100644
--- a/engines/sword25/util/pluto/pluto.cpp
+++ b/engines/sword25/util/pluto/pluto.cpp
@@ -944,12 +944,6 @@ static void persist(PersistInfo *pi)
 	if(!lua_isnil(pi->L, -1)) {
 					/* perms reftbl ... obj ref */
 		int zero = 0;
-		// FIXME: Casting a pointer to an integer data type is a bad idea we
-		// should really get rid of this by fixing the design of this code.
-		// For now casting to size_t should silence most (all?) compilers,
-		// since size_t is supposedly the same size as a pointer on most
-		// (modern) architectures.
-		int ref = (int)(size_t)lua_touserdata(pi->L, -1);
 		pi_write(pi, &zero, sizeof(int), pi->ud);
 		if (humanReadable) {
 			snprintf(hrBuf, hrBufSize, "persist_seenobject\n");
@@ -958,7 +952,8 @@ static void persist(PersistInfo *pi)
 #ifdef TOTEXT
 		printf("persist_seenobject\n");
 #endif
-		pi_write(pi, &ref, sizeof(int), pi->ud);
+		int *ref = (int *)lua_touserdata(pi->L, -1);
+		pi_write(pi, ref, sizeof(int), pi->ud);
 		if (humanReadable) {
 			snprintf(hrBuf, hrBufSize, "persist_touserdata_ref %d\n", ref);
 			hrOut(pi);
@@ -1011,7 +1006,8 @@ static void persist(PersistInfo *pi)
 	}
 	lua_pushvalue(pi->L, -1);
 					/* perms reftbl ... obj obj */
-	lua_pushlightuserdata(pi->L, (void *)(++(pi->counter)));
+	int *ref = (int *)lua_newuserdata(pi->L, sizeof(int));
+	*ref = ++(pi->counter);
 					/* perms reftbl ... obj obj ref */
 	lua_rawset(pi->L, 2);
 					/* perms reftbl ... obj */






More information about the Scummvm-git-logs mailing list