[Scummvm-cvs-logs] SF.net SVN: scummvm:[38562] scummvm/trunk/engines/sci/exereader.cpp
wjpalenstijn at users.sourceforge.net
wjpalenstijn at users.sourceforge.net
Thu Feb 19 21:20:14 CET 2009
Revision: 38562
http://scummvm.svn.sourceforge.net/scummvm/?rev=38562&view=rev
Author: wjpalenstijn
Date: 2009-02-19 20:20:14 +0000 (Thu, 19 Feb 2009)
Log Message:
-----------
Function call order in expressions isn't well-defined. Also fix missing shift and moved some comments.
Modified Paths:
--------------
scummvm/trunk/engines/sci/exereader.cpp
Modified: scummvm/trunk/engines/sci/exereader.cpp
===================================================================
--- scummvm/trunk/engines/sci/exereader.cpp 2009-02-19 19:03:41 UTC (rev 38561)
+++ scummvm/trunk/engines/sci/exereader.cpp 2009-02-19 20:20:14 UTC (rev 38562)
@@ -116,6 +116,7 @@
// Calculate code segment offset in exe file
filepos += exeStream->readUint16LE(); // at pos 22, +2
+ filepos <<= 4;
// First relocation item offset should be 0x1c
if (exeStream->readUint16LE() != 0x1c) // at pos 24, +2
@@ -156,7 +157,8 @@
_bitCount--;
if (_bitCount <= 0) {
- _bits = input->readByte() | input->readByte() << 8;
+ _bits = input->readByte();
+ _bits |= input->readByte() << 8;
if (_bitCount == -1) { /* special case for first bit word */
bit = _bits & 1;
@@ -174,19 +176,6 @@
int len = exeStream->size();
unsigned char *buffer = NULL;
char result_string[10]; /* string-encoded result, copied from buf */
- int state = 0;
- /* 'state' encodes how far we have matched the version pattern
- ** "n.nnn.nnn"
- **
- ** n.nnn.nnn
- ** 0123456789
- **
- ** Since we cannot be certain that the pattern does not begin with an
- ** alphanumeric character, some states are ambiguous.
- ** The pattern is expected to be terminated with a non-alphanumeric
- ** character.
- */
-
// Read the executable
bool isLZEXE = isLZEXECompressed(exeStream);
@@ -235,7 +224,8 @@
} else
repeat += 2;
} else {
- repeat = ((getBit(exeStream) << 1) | getBit(exeStream)) + 2;
+ repeat = getBit(exeStream) << 1;
+ repeat += getBit(exeStream) + 2;
offset = exeStream->readByte() | 0xFF00;
}
@@ -250,6 +240,20 @@
// Find SCI version number
+ int state = 0;
+ /* 'state' encodes how far we have matched the version pattern
+ ** "n.nnn.nnn"
+ **
+ ** n.nnn.nnn
+ ** 0123456789
+ **
+ ** Since we cannot be certain that the pattern does not begin with an
+ ** alphanumeric character, some states are ambiguous.
+ ** The pattern is expected to be terminated with a non-alphanumeric
+ ** character.
+ */
+
+
int accept;
unsigned char *buf = buffer;
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