[Scummvm-cvs-logs] SF.net SVN: scummvm:[53593] scummvm/trunk/engines/sword25/util/pluto/pluto. cpp

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Tue Oct 19 00:17:41 CEST 2010


Revision: 53593
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53593&view=rev
Author:   lordhoto
Date:     2010-10-18 22:17:41 +0000 (Mon, 18 Oct 2010)

Log Message:
-----------
SWORD25: Fix compilation on 64bit arches by casting a pointer to ssize_t instead of int.

This should be no permanent solution. I added a small fixme comment near the
cast so it won't be forgotten.

Modified Paths:
--------------
    scummvm/trunk/engines/sword25/util/pluto/pluto.cpp

Modified: scummvm/trunk/engines/sword25/util/pluto/pluto.cpp
===================================================================
--- scummvm/trunk/engines/sword25/util/pluto/pluto.cpp	2010-10-18 22:17:18 UTC (rev 53592)
+++ scummvm/trunk/engines/sword25/util/pluto/pluto.cpp	2010-10-18 22:17:41 UTC (rev 53593)
@@ -624,7 +624,12 @@
 	if(!lua_isnil(pi->L, -1)) {
 					/* perms reftbl ... obj ref */
 		int zero = 0;
-		int ref = (int)lua_touserdata(pi->L, -1);
+		// 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 ssize_t should silence most (all?) compilers,
+		// since ssize_t is supposedly the same size as a pointer on most
+		// (modern) architectures.
+		int ref = (ssize_t)lua_touserdata(pi->L, -1);
 		pi->writer(pi->L, &zero, sizeof(int), pi->ud);
 		pi->writer(pi->L, &ref, sizeof(int), pi->ud);
 		lua_pop(pi->L, 1);


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