aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2010-10-18 22:17:41 +0000
committerJohannes Schickel2010-10-18 22:17:41 +0000
commita821d65efe255d9e86c5d7dc5f711152bb68fbed (patch)
tree4901617c7020ae5eb581071fa19df55324e1c588
parent521751e8d7810ee603669fd2e4c2b35dd1da4bf0 (diff)
downloadscummvm-rg350-a821d65efe255d9e86c5d7dc5f711152bb68fbed.tar.gz
scummvm-rg350-a821d65efe255d9e86c5d7dc5f711152bb68fbed.tar.bz2
scummvm-rg350-a821d65efe255d9e86c5d7dc5f711152bb68fbed.zip
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. svn-id: r53593
-rw-r--r--engines/sword25/util/pluto/pluto.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/engines/sword25/util/pluto/pluto.cpp b/engines/sword25/util/pluto/pluto.cpp
index 9e7d0c804d..2a39e98719 100644
--- a/engines/sword25/util/pluto/pluto.cpp
+++ b/engines/sword25/util/pluto/pluto.cpp
@@ -624,7 +624,12 @@ static void persist(PersistInfo *pi)
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);