aboutsummaryrefslogtreecommitdiff
path: root/sword2/interpreter.cpp
diff options
context:
space:
mode:
authorMax Horn2003-09-07 01:51:15 +0000
committerMax Horn2003-09-07 01:51:15 +0000
commit2fb59884f1d6d9fe049a525004d313dbd7a39af8 (patch)
tree5180cc09a4bad9ebbd9722a6760f1e074a7e9709 /sword2/interpreter.cpp
parentb380affbd57cd7a16bf436984e3476472313bfc4 (diff)
downloadscummvm-rg350-2fb59884f1d6d9fe049a525004d313dbd7a39af8.tar.gz
scummvm-rg350-2fb59884f1d6d9fe049a525004d313dbd7a39af8.tar.bz2
scummvm-rg350-2fb59884f1d6d9fe049a525004d313dbd7a39af8.zip
some endian fixes
svn-id: r10056
Diffstat (limited to 'sword2/interpreter.cpp')
-rw-r--r--sword2/interpreter.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/sword2/interpreter.cpp b/sword2/interpreter.cpp
index 319ed2cb08..0dc01f1683 100644
--- a/sword2/interpreter.cpp
+++ b/sword2/interpreter.cpp
@@ -330,10 +330,10 @@ int RunScript ( char * scriptData , char * objectData , uint32 *offset )
// FIXME: 'scriptData' and 'variables' used to be const. However,
// this code writes into 'variables' so it can not be const.
char *variables = scriptData + sizeof(int);
- const char *code = scriptData + *((int *)scriptData) + sizeof(int);
- uint32 noScripts = *((const int32 *)code);
+ const char *code = scriptData + (int)READ_LE_UINT32(scriptData) + sizeof(int);
+ uint32 noScripts = (int)READ_LE_UINT32(code);
if ( (*offset) < noScripts)
- { ip = ((const int *)code)[(*offset)+1];
+ { ip = (int)READ_LE_UINT32((const int *)code + (*offset) + 1);
DEBUG2("Start script %d with offset %d",*offset,ip);
}
else
@@ -354,7 +354,7 @@ int RunScript ( char * scriptData , char * objectData , uint32 *offset )
const int *checksumBlock = (const int *)code;
code += sizeof(int) * 3;
- if (checksumBlock[0] != 12345678)
+ if ((int)READ_LE_UINT32(checksumBlock) != 12345678)
{
#ifdef INSIDE_LINC
AfxMessageBox(CVString("Invalid script in object %s",header->name));
@@ -363,11 +363,11 @@ int RunScript ( char * scriptData , char * objectData , uint32 *offset )
#endif
return(0);
}
- int codeLen = checksumBlock[1];
+ int codeLen = (int)READ_LE_UINT32(checksumBlock + 1);
int checksum = 0;
for (int count = 0 ; count < codeLen ; count++)
checksum += (unsigned char)code[count];
- if ( checksum != checksumBlock[2] )
+ if ( checksum != (int)READ_LE_UINT32(checksumBlock + 2) )
{
#ifdef INSIDE_LINC
AfxMessageBox(CVString("Checksum error in script %s",header->name));