aboutsummaryrefslogtreecommitdiff
path: root/engines/m4/console.cpp
diff options
context:
space:
mode:
authorYotam Barnoy2010-10-31 11:08:43 +0000
committerYotam Barnoy2010-10-31 11:08:43 +0000
commit94c8d0a14df429a1b25bd9f5c5d75497fd0ddbd1 (patch)
tree3df2a4ae7967c56d464729669fc06ce4e93dff36 /engines/m4/console.cpp
parent8df4278ba8cfbf71228e1927f9db635a9a30a57f (diff)
parentdca3c8d8bfc6c4db38cf8e8291818dd472041d4e (diff)
downloadscummvm-rg350-94c8d0a14df429a1b25bd9f5c5d75497fd0ddbd1.tar.gz
scummvm-rg350-94c8d0a14df429a1b25bd9f5c5d75497fd0ddbd1.tar.bz2
scummvm-rg350-94c8d0a14df429a1b25bd9f5c5d75497fd0ddbd1.zip
Updated with latest from trunk
svn-id: r53976
Diffstat (limited to 'engines/m4/console.cpp')
-rw-r--r--engines/m4/console.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/engines/m4/console.cpp b/engines/m4/console.cpp
index 71c70e3e1b..32ccdab787 100644
--- a/engines/m4/console.cpp
+++ b/engines/m4/console.cpp
@@ -61,8 +61,10 @@ static int strToInt(const char *s) {
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;
}
@@ -319,17 +321,25 @@ bool MadsConsole::cmdMessage(int argc, const char **argv) {
DebugPrintf("message 'objnum'\n");
} else if (!strcmp(argv[1], "list_quotes")) {
// Dump the quotes list
+#if 0
+ // FIXME: The following code is not portable and hence has been disabled.
+ // Try replacing FILE by Common::DumpFile.
FILE *destFile = fopen("mads_quotes.txt", "wb");
for (uint i = 0; i < _vm->globals()->getQuotesSize(); ++i)
fprintf(destFile, "%.3d - %s\n", i, _vm->globals()->getQuote(i));
fclose(destFile);
+#endif
} else if (!strcmp(argv[1], "list_vocab")) {
// Dump the vocab list
+#if 0
+ // FIXME: The following code is not portable and hence has been disabled.
+ // Try replacing FILE by Common::DumpFile.
FILE *destFile = fopen("mads_vocab.txt", "wb");
for (uint i = 1; i <= _vm->globals()->getVocabSize(); ++i)
fprintf(destFile, "%.3d/%.3x - %s\n", i, i, _vm->globals()->getVocab(i));
fclose(destFile);
+#endif
} else {
int messageIdx = strToInt(argv[1]);