[Scummvm-cvs-logs] SF.net SVN: scummvm:[53464] scummvm/trunk/engines/gob

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Fri Oct 15 06:37:44 CEST 2010


Revision: 53464
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53464&view=rev
Author:   drmccoy
Date:     2010-10-15 04:37:44 +0000 (Fri, 15 Oct 2010)

Log Message:
-----------
GOB: Fix Code analysis warnings

See bug report #3087831

Modified Paths:
--------------
    scummvm/trunk/engines/gob/draw.cpp
    scummvm/trunk/engines/gob/draw_playtoons.cpp
    scummvm/trunk/engines/gob/game.cpp
    scummvm/trunk/engines/gob/sound/adlib.cpp

Modified: scummvm/trunk/engines/gob/draw.cpp
===================================================================
--- scummvm/trunk/engines/gob/draw.cpp	2010-10-15 03:33:54 UTC (rev 53463)
+++ scummvm/trunk/engines/gob/draw.cpp	2010-10-15 04:37:44 UTC (rev 53464)
@@ -328,7 +328,7 @@
 			if (coord2)
 				*coord2 *= 2;
 			if (coord1)
-				*coord2 *= 2;
+				*coord1 *= 2;
 			break;
 
 		case 1:

Modified: scummvm/trunk/engines/gob/draw_playtoons.cpp
===================================================================
--- scummvm/trunk/engines/gob/draw_playtoons.cpp	2010-10-15 03:33:54 UTC (rev 53463)
+++ scummvm/trunk/engines/gob/draw_playtoons.cpp	2010-10-15 04:37:44 UTC (rev 53464)
@@ -151,7 +151,7 @@
 
 	case DRAW_PUTPIXEL:
 		switch (_pattern & 0xFF) {
-		case -1:
+		case 0xFF:
 			warning("oPlaytoons_spriteOperation: operation DRAW_PUTPIXEL, pattern -1");
 			break;
 		case 1:

Modified: scummvm/trunk/engines/gob/game.cpp
===================================================================
--- scummvm/trunk/engines/gob/game.cpp	2010-10-15 03:33:54 UTC (rev 53463)
+++ scummvm/trunk/engines/gob/game.cpp	2010-10-15 04:37:44 UTC (rev 53464)
@@ -319,10 +319,12 @@
 
 			_vm->_inter->renewTimeInVars();
 
-			WRITE_VAR(13, _vm->_global->_useMouse);
-			WRITE_VAR(14, _vm->_global->_soundFlags);
-			WRITE_VAR(15, _vm->_global->_fakeVideoMode);
-			WRITE_VAR(16, _vm->_global->_language);
+			if (_vm->_inter->_variables) {
+				WRITE_VAR(13, _vm->_global->_useMouse);
+				WRITE_VAR(14, _vm->_global->_soundFlags);
+				WRITE_VAR(15, _vm->_global->_fakeVideoMode);
+				WRITE_VAR(16, _vm->_global->_language);
+			}
 
 			_vm->_inter->callSub(2);
 
@@ -335,8 +337,9 @@
 
 			_resources->unload();
 
-			for (int i = 0; i < *_vm->_scenery->_pCaptureCounter; i++)
-				capturePop(0);
+			if (_vm->_scenery->_pCaptureCounter)
+				for (int i = 0; i < *_vm->_scenery->_pCaptureCounter; i++)
+					capturePop(0);
 
 			if (skipPlay != -1) {
 				_vm->_goblin->freeObjects();
@@ -357,7 +360,9 @@
 			if (_totToLoad[0] == 0)
 				break;
 
-			strcpy(_curTotFile, _totToLoad);
+			strncpy(_curTotFile, _totToLoad, 14);
+			_curTotFile[13] = '\0';
+
 		}
 	} else {
 		_vm->_inter->initControlVars(0);
@@ -370,7 +375,8 @@
 			_vm->_inter->_terminate = 2;
 	}
 
-	strcpy(_curTotFile, savedTotName);
+	strncpy(_curTotFile, savedTotName, 14);
+	_curTotFile[13] = '\0';
 
 	_vm->_inter->_nestLevel = oldNestLevel;
 	_vm->_inter->_breakFromLevel = oldBreakFrom;

Modified: scummvm/trunk/engines/gob/sound/adlib.cpp
===================================================================
--- scummvm/trunk/engines/gob/sound/adlib.cpp	2010-10-15 03:33:54 UTC (rev 53463)
+++ scummvm/trunk/engines/gob/sound/adlib.cpp	2010-10-15 04:37:44 UTC (rev 53464)
@@ -240,7 +240,7 @@
 	freq = _freqs[_notLin[voice]][note - octa * 12];
 
 	writeOPL(0xA0 + voice,  freq & 0xFF);
-	writeOPL(0xB0 + voice, (freq >> 8) | (octa << 2) | 0x20 * on);
+	writeOPL(0xB0 + voice, (freq >> 8) | (octa << 2) | (0x20 * (on ? 1 : 0)));
 
 	if (!freq)
 		warning("AdLib::setKey Voice %d, note %02X unknown", voice, note);


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