[Scummvm-cvs-logs] SF.net SVN: scummvm:[53500] scummvm/trunk/engines/m4
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Fri Oct 15 17:05:23 CEST 2010
Revision: 53500
http://scummvm.svn.sourceforge.net/scummvm/?rev=53500&view=rev
Author: thebluegr
Date: 2010-10-15 15:05:23 +0000 (Fri, 15 Oct 2010)
Log Message:
-----------
M4: Fixed code analysis warnings - bug #3087845
Modified Paths:
--------------
scummvm/trunk/engines/m4/console.cpp
scummvm/trunk/engines/m4/converse.cpp
scummvm/trunk/engines/m4/dialogs.cpp
scummvm/trunk/engines/m4/mads_logic.cpp
Modified: scummvm/trunk/engines/m4/console.cpp
===================================================================
--- scummvm/trunk/engines/m4/console.cpp 2010-10-15 14:37:50 UTC (rev 53499)
+++ scummvm/trunk/engines/m4/console.cpp 2010-10-15 15:05:23 UTC (rev 53500)
@@ -61,8 +61,10 @@
return atoi(s);
// Hexadecimal string
- uint tmp;
- sscanf(s, "%xh", &tmp);
+ uint tmp = 0;
+ int read = sscanf(s, "%xh", &tmp);
+ if (read < 1)
+ error("strToInt failed on string \"%s\"", s);
return (int)tmp;
}
Modified: scummvm/trunk/engines/m4/converse.cpp
===================================================================
--- scummvm/trunk/engines/m4/converse.cpp 2010-10-15 14:37:50 UTC (rev 53499)
+++ scummvm/trunk/engines/m4/converse.cpp 2010-10-15 15:05:23 UTC (rev 53500)
@@ -541,6 +541,9 @@
if (debugFlag) printf("Reply data offset: %i\n", data);
}
+ if (!curEntry)
+ error("Converse::loadConversation(): curEntry is NULL while adding a reply");
+
curEntry->entries.push_back(replyEntry);
setEntryInfo(replyEntry->offset, replyEntry->entryType,
curNode, _convNodes[curNode]->entries.size() - 1);
@@ -572,6 +575,8 @@
} else if (replyEntry != NULL && replyEntry->entryType == kWeightedReply) {
parentEntry = replyEntry->entries[currentWeightedEntry];
currentWeightedEntry++;
+ } else {
+ error("Converse::loadConversation(): Unexpected reply entry while processing TEXT/MESG chunk");
}
size = convS->readUint32LE();
Modified: scummvm/trunk/engines/m4/dialogs.cpp
===================================================================
--- scummvm/trunk/engines/m4/dialogs.cpp 2010-10-15 14:37:50 UTC (rev 53499)
+++ scummvm/trunk/engines/m4/dialogs.cpp 2010-10-15 15:05:23 UTC (rev 53500)
@@ -297,7 +297,7 @@
char *lineP = &dialogLine[0];
char *cmdP = NULL;
- while (*(srcP - 1) != '\0') {
+ while (srcP && *(srcP - 1) != '\0') {
if ((*srcP == '\n') || (*srcP == '\0')) {
// Line completed
*lineP = '\0';
Modified: scummvm/trunk/engines/m4/mads_logic.cpp
===================================================================
--- scummvm/trunk/engines/m4/mads_logic.cpp 2010-10-15 14:37:50 UTC (rev 53499)
+++ scummvm/trunk/engines/m4/mads_logic.cpp 2010-10-15 15:05:23 UTC (rev 53500)
@@ -658,12 +658,12 @@
case OP_NOT: // logical nots top item on stack
param = stack.pop().get();
- stack.push(ScriptVar((uint32)!param & 0xffff));
+ stack.push(ScriptVar((uint32)!(param & 0xffff)));
break;
case OP_COMP: // complements top item on stack
param = stack.pop().get();
- stack.push(ScriptVar(~param & 0xffff));
+ stack.push(ScriptVar(~(param & 0xffff)));
break;
case OP_NEG: // negates top item on stack
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