[Scummvm-cvs-logs] CVS: scummvm/bs2 interpreter.cpp,1.5,1.6 protocol.cpp,1.4,1.5
Max Horn
fingolfin at users.sourceforge.net
Sat Sep 6 18:52:03 CEST 2003
Update of /cvsroot/scummvm/scummvm/bs2
In directory sc8-pr-cvs1:/tmp/cvs-serv2660
Modified Files:
interpreter.cpp protocol.cpp
Log Message:
some endian fixes
Index: interpreter.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/interpreter.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- interpreter.cpp 28 Jul 2003 11:54:26 -0000 1.5
+++ interpreter.cpp 7 Sep 2003 01:51:15 -0000 1.6
@@ -330,10 +330,10 @@
// 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 @@
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 @@
#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));
Index: protocol.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/protocol.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- protocol.cpp 30 Jul 2003 19:25:29 -0000 1.4
+++ protocol.cpp 7 Sep 2003 01:51:15 -0000 1.5
@@ -206,7 +206,7 @@
point=(uint32*) text_header+1; //point to the lookup table
- return( (uint8*) (file+ *(point+text_line)) );
+ return( (uint8*) (file + READ_LE_UINT32(point+text_line)) );
}
//---------------------------------------------------------------
// Used for testing text & speech (see FN_I_speak in speech.cpp)
More information about the Scummvm-git-logs
mailing list