[Scummvm-cvs-logs] scummvm master -> d0bb81f5661879f81fb1a17174fa7f2e9085c698

sev- sev at scummvm.org
Wed Nov 2 23:22:23 CET 2011


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
022857a371 COMMON: Fix warning
f6a9c6727d AGI: Fix buffer overflow
d0bb81f566 AGI: Fix warnings


Commit: 022857a3711cef9b3ae60a88c436c212792918f0
    https://github.com/scummvm/scummvm/commit/022857a3711cef9b3ae60a88c436c212792918f0
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2011-11-02T15:09:17-07:00

Commit Message:
COMMON: Fix warning

Changed paths:
    common/translation.cpp



diff --git a/common/translation.cpp b/common/translation.cpp
index 3570e8c..e0386a2 100644
--- a/common/translation.cpp
+++ b/common/translation.cpp
@@ -390,7 +390,7 @@ bool TranslationManager::checkHeader(File &in) {
 	buf[12] = '\0';
 
 	// Check header
-	if (strcmp(buf, "TRANSLATIONS")) {
+	if (strcmp(buf, "TRANSLATIONS") != 0) {
 		warning("File '%s' is not a valid translations data file. Skipping this file", in.getName());
 		return false;
 	}


Commit: f6a9c6727dc11639a11e17fdcf3d0c0a39b8be96
    https://github.com/scummvm/scummvm/commit/f6a9c6727dc11639a11e17fdcf3d0c0a39b8be96
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2011-11-02T15:20:27-07:00

Commit Message:
AGI: Fix buffer overflow

Changed paths:
    engines/agi/opcodes.cpp



diff --git a/engines/agi/opcodes.cpp b/engines/agi/opcodes.cpp
index d1baab9..29fb860 100644
--- a/engines/agi/opcodes.cpp
+++ b/engines/agi/opcodes.cpp
@@ -360,7 +360,7 @@ AgiInstruction insV2[] = {
 
 void AgiEngine::setupOpcodes() {
 	if (getVersion() >= 0x2000) {
-		for (int i = 0; i <= ARRAYSIZE(insV2Test); ++i)
+		for (int i = 0; i < ARRAYSIZE(insV2Test); ++i)
 			_agiCondCommands[i] = insV2Test[i].func;
 		for (int i = 0; i < ARRAYSIZE(insV2); ++i)
 			_agiCommands[i] = insV2[i].func;
@@ -368,7 +368,7 @@ void AgiEngine::setupOpcodes() {
 		logicNamesTest = insV2Test;
 		logicNamesCmd = insV2;
 	} else {
-		for (int i = 0; i <= ARRAYSIZE(insV1Test); ++i)
+		for (int i = 0; i < ARRAYSIZE(insV1Test); ++i)
 			_agiCondCommands[i] = insV1Test[i].func;
 		for (int i = 0; i < ARRAYSIZE(insV1); ++i)
 			_agiCommands[i] = insV1[i].func;


Commit: d0bb81f5661879f81fb1a17174fa7f2e9085c698
    https://github.com/scummvm/scummvm/commit/d0bb81f5661879f81fb1a17174fa7f2e9085c698
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2011-11-02T15:20:40-07:00

Commit Message:
AGI: Fix warnings

Changed paths:
    engines/agi/graphics.cpp
    engines/agi/saveload.cpp
    engines/agi/text.cpp



diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp
index 074e557..4bb3877 100644
--- a/engines/agi/graphics.cpp
+++ b/engines/agi/graphics.cpp
@@ -1083,7 +1083,7 @@ void GfxMgr::putPixelsA(int x, int y, int n, uint8 *p) {
 
 	// Choose the correct screen to read from. If AGI256 or AGI256-2 is used and we're not trying to show the priority information,
 	// then choose the 256 color screen, otherwise choose the 16 color screen (Which also has the priority information).
-	p += _vm->getFeatures() & (GF_AGI256 | GF_AGI256_2) && !_vm->_debug.priority ? FROM_SBUF16_TO_SBUF256_OFFSET : 0;
+	p += ((_vm->getFeatures() & (GF_AGI256 | GF_AGI256_2)) && !_vm->_debug.priority) ? FROM_SBUF16_TO_SBUF256_OFFSET : 0;
 
 	if (_vm->_renderMode == Common::kRenderCGA) {
 		for (x *= 2; n--; p++, x += 2) {
@@ -1091,7 +1091,7 @@ void GfxMgr::putPixelsA(int x, int y, int n, uint8 *p) {
 			*(uint16 *)&_agiScreen[x + y * GFX_WIDTH] = (q >> rShift) & 0x0f0f;
 		}
 	} else {
-		const uint16 mask = _vm->getFeatures() & (GF_AGI256 | GF_AGI256_2) && !_vm->_debug.priority ? 0xffff : 0x0f0f;
+		const uint16 mask = ((_vm->getFeatures() & (GF_AGI256 | GF_AGI256_2)) && !_vm->_debug.priority) ? 0xffff : 0x0f0f;
 		for (x *= 2; n--; p++, x += 2) {
 			register uint16 q = ((uint16)*p << 8) | *p;
 			*(uint16 *)&_agiScreen[x + y * GFX_WIDTH] = (q >> rShift) & mask;
diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp
index 3cebbf5..1bcabd5 100644
--- a/engines/agi/saveload.cpp
+++ b/engines/agi/saveload.cpp
@@ -300,7 +300,7 @@ int AgiEngine::loadGame(const Common::String &fileName, bool checkId) {
 	_game.state = (State)in->readByte();
 
 	in->read(loadId, 8);
-	if (strcmp(loadId, _game.id) && checkId) {
+	if (strcmp(loadId, _game.id) != 0 && checkId) {
 		delete in;
 		warning("This save seems to be from a different AGI game (save from %s, running %s), not loaded", loadId, _game.id);
 		return errBadFileOpen;
@@ -331,7 +331,7 @@ int AgiEngine::loadGame(const Common::String &fileName, bool checkId) {
 			warning("Since your game was only detected via the fallback detector, there is no possibility to assure the save is compatible with your game version");
 
 			debug(0, "The game used for saving is \"%s\".", md5);
-		} else if (strcmp(md5, getGameMD5())) {
+		} else if (strcmp(md5, getGameMD5()) != 0) {
 			warning("Game was saved with different gamedata - you may encounter problems");
 
 			debug(0, "Your game is \"%s\" and save is \"%s\".", getGameMD5(), md5);
diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp
index d502758..3247862 100644
--- a/engines/agi/text.cpp
+++ b/engines/agi/text.cpp
@@ -240,7 +240,6 @@ char *AgiEngine::wordWrapString(const char *s, int *len) {
 
 	while (*s) {
 		pWord = s;
-		wLen = 0;
 
 		while (*s != '\0' && *s != ' ' && *s != '\n' && *s != '\r')
 			s++;






More information about the Scummvm-git-logs mailing list