aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2019-06-22 10:33:37 -0700
committerPaul Gilbert2019-06-22 14:40:50 -0700
commitd4075b188d9834c9901639f517aebf38ee584ee0 (patch)
treef98e241b5e992ca0208192a2b8b1cb7ca31c4199 /engines
parent8b509bbfee6d9c82d8f05e569f61f5781917cbda (diff)
downloadscummvm-rg350-d4075b188d9834c9901639f517aebf38ee584ee0.tar.gz
scummvm-rg350-d4075b188d9834c9901639f517aebf38ee584ee0.tar.bz2
scummvm-rg350-d4075b188d9834c9901639f517aebf38ee584ee0.zip
GLK: ALAN2: Further gcc warning fixes
Diffstat (limited to 'engines')
-rw-r--r--engines/glk/alan2/alan2.cpp2
-rw-r--r--engines/glk/alan2/debug.cpp4
-rw-r--r--engines/glk/alan2/decode.cpp2
-rw-r--r--engines/glk/alan2/exe.cpp7
-rw-r--r--engines/glk/alan2/inter.cpp42
-rw-r--r--engines/glk/alan2/main.cpp4
-rw-r--r--engines/glk/alan2/parse.cpp4
-rw-r--r--engines/glk/alan2/parse.h8
-rw-r--r--engines/glk/alan2/types.h24
9 files changed, 54 insertions, 43 deletions
diff --git a/engines/glk/alan2/alan2.cpp b/engines/glk/alan2/alan2.cpp
index 5953f834f0..1ae5ddad35 100644
--- a/engines/glk/alan2/alan2.cpp
+++ b/engines/glk/alan2/alan2.cpp
@@ -145,7 +145,7 @@ void Alan2::synchronizeSave(Common::Serializer &s) {
}
// Sync scores
- for (i = 0; (int)scores[i] != EOD; i++)
+ for (i = 0; scores[i] != EOD; i++)
syncVal(s, &scores[i]);
}
diff --git a/engines/glk/alan2/debug.cpp b/engines/glk/alan2/debug.cpp
index 96ce46cf13..b455db6930 100644
--- a/engines/glk/alan2/debug.cpp
+++ b/engines/glk/alan2/debug.cpp
@@ -296,8 +296,8 @@ void debug() {
lin = 1;
c = buf[0];
i = 0;
- sscanf(&buf[1], "%d", &i);
- } while (buf && c == '\0');
+ (void)sscanf(&buf[1], "%d", &i);
+ } while (/*buf &&*/ c == '\0');
switch (toUpper(c)) {
case 'H':
diff --git a/engines/glk/alan2/decode.cpp b/engines/glk/alan2/decode.cpp
index 4f89380272..1995637eb0 100644
--- a/engines/glk/alan2/decode.cpp
+++ b/engines/glk/alan2/decode.cpp
@@ -37,7 +37,7 @@ static int inputBit() {
if (!bitsToGo) { /* More bits available ? */
decodeBuffer = txtfil->readByte(); /* No, so get more */
- if (decodeBuffer == EOD) {
+ if ((uint)decodeBuffer == EOD) {
garbageBits++;
if (garbageBits > VALUEBITS - 2)
syserr("Error in encoded data file.");
diff --git a/engines/glk/alan2/exe.cpp b/engines/glk/alan2/exe.cpp
index fd5e36cea8..fd3b065b46 100644
--- a/engines/glk/alan2/exe.cpp
+++ b/engines/glk/alan2/exe.cpp
@@ -1057,9 +1057,6 @@ void look() {
}
-static char savfnm[256];
-
-
/*----------------------------------------------------------------------
save()
@@ -1067,7 +1064,7 @@ static char savfnm[256];
*/
void save() {
- g_vm->saveGame();
+ (void)g_vm->saveGame();
}
@@ -1078,7 +1075,7 @@ void save() {
*/
void restore() {
- g_vm->loadGame();
+ (void)g_vm->loadGame();
}
diff --git a/engines/glk/alan2/inter.cpp b/engines/glk/alan2/inter.cpp
index 0c7d51d67e..8675739a5c 100644
--- a/engines/glk/alan2/inter.cpp
+++ b/engines/glk/alan2/inter.cpp
@@ -416,9 +416,10 @@ void interpret(Aaddr adr) {
if (stpflg)
printf("HERE \t%5ld", id);
push(isHere(id));
- if (stpflg)
+ if (stpflg) {
if (top()) printf("\t(TRUE)");
else printf("\t(FALSE)");
+ }
break;
}
case I_NEAR: {
@@ -427,9 +428,10 @@ void interpret(Aaddr adr) {
if (stpflg)
printf("NEAR \t%5ld", id);
push(isNear(id));
- if (stpflg)
+ if (stpflg) {
if (top()) printf("\t(TRUE)");
else printf("\t(FALSE)");
+ }
break;
}
case I_USE: {
@@ -448,9 +450,10 @@ void interpret(Aaddr adr) {
if (stpflg)
printf("IN \t%5ld, %5ld ", obj, cnt);
push(in(obj, cnt));
- if (stpflg)
+ if (stpflg) {
if (top()) printf("\t(TRUE)");
else printf("\t(FALSE)");
+ }
break;
}
case I_DESCRIBE: {
@@ -529,9 +532,10 @@ void interpret(Aaddr adr) {
else printf("FALSE");
}
push(lh && rh);
- if (stpflg)
+ if (stpflg) {
if (top()) printf("\t(TRUE)");
else printf("\t(FALSE)");
+ }
break;
}
case I_OR: {
@@ -548,9 +552,10 @@ void interpret(Aaddr adr) {
else printf("FALSE");
}
push(lh || rh);
- if (stpflg)
+ if (stpflg) {
if (top()) printf("\t(TRUE)");
else printf("\t(FALSE)");
+ }
break;
}
case I_NE: {
@@ -562,9 +567,10 @@ void interpret(Aaddr adr) {
if (stpflg)
printf("NE \t%5ld, %5ld", lh, rh);
push(lh != rh);
- if (stpflg)
+ if (stpflg) {
if (top()) printf("\t(TRUE)");
else printf("\t(FALSE)");
+ }
break;
}
case I_EQ: {
@@ -576,9 +582,10 @@ void interpret(Aaddr adr) {
if (stpflg)
printf("EQ \t%5ld, %5ld", lh, rh);
push(lh == rh);
- if (stpflg)
+ if (stpflg) {
if (top()) printf("\t(TRUE)");
else printf("\t(FALSE)");
+ }
break;
}
case I_STREQ: {
@@ -590,9 +597,10 @@ void interpret(Aaddr adr) {
if (stpflg)
printf("STREQ \t%5ld, %5ld", lh, rh);
push(streq((char *)lh, (char *)rh));
- if (stpflg)
+ if (stpflg) {
if (top()) printf("\t(TRUE)");
else printf("\t(FALSE)");
+ }
break;
}
case I_STREXACT: {
@@ -604,9 +612,10 @@ void interpret(Aaddr adr) {
if (stpflg)
printf("STREXACT \t%5ld, %5ld", lh, rh);
push(strcmp((char *)lh, (char *)rh) == 0);
- if (stpflg)
+ if (stpflg) {
if (top()) printf("\t(TRUE)");
else printf("\t(FALSE)");
+ }
free((void *)lh);
free((void *)rh);
break;
@@ -620,9 +629,10 @@ void interpret(Aaddr adr) {
if (stpflg)
printf("LE \t%5ld, %5ld", lh, rh);
push(lh <= rh);
- if (stpflg)
+ if (stpflg) {
if (top()) printf("\t(TRUE)");
else printf("\t(FALSE)");
+ }
break;
}
case I_GE: {
@@ -634,9 +644,10 @@ void interpret(Aaddr adr) {
if (stpflg)
printf("GE \t%5ld, %5ld", lh, rh);
push(lh >= rh);
- if (stpflg)
+ if (stpflg) {
if (top()) printf("\t(TRUE)");
else printf("\t(FALSE)");
+ }
break;
}
case I_LT: {
@@ -648,9 +659,10 @@ void interpret(Aaddr adr) {
if (stpflg)
printf("LT \t%5ld, %5ld", lh, rh);
push((signed int)lh < (signed int)rh);
- if (stpflg)
+ if (stpflg) {
if (top()) printf("\t(TRUE)");
else printf("\t(FALSE)");
+ }
break;
}
case I_GT: {
@@ -662,9 +674,10 @@ void interpret(Aaddr adr) {
if (stpflg)
printf("GT \t%5ld, %5ld", lh, rh);
push(lh > rh);
- if (stpflg)
+ if (stpflg) {
if (top()) printf("\t(TRUE)");
else printf("\t(FALSE)");
+ }
break;
}
case I_PLUS: {
@@ -728,9 +741,10 @@ void interpret(Aaddr adr) {
else printf("FALSE");
}
push(!val);
- if (stpflg)
+ if (stpflg) {
if (top()) printf("\t\t(TRUE)");
else printf("\t\t(FALSE)");
+ }
break;
}
case I_MAX: {
diff --git a/engines/glk/alan2/main.cpp b/engines/glk/alan2/main.cpp
index 56e5f72dc8..f0c2d0e73e 100644
--- a/engines/glk/alan2/main.cpp
+++ b/engines/glk/alan2/main.cpp
@@ -224,7 +224,7 @@ void statusline() {
Print some text and log it if logging is on.
*/
-void logprint(char str[]) {
+static void logprint(const char str[]) {
printf(str);
if (logflg)
fprintf(logfil, "%s", str);
@@ -293,7 +293,7 @@ void *allocate(unsigned long len /* IN - Length to allocate */) {
Justify a string so that it wraps at end of screen.
*/
-static void just(char str[]) {
+static void just(const char str[]) {
logprint(str);
}
diff --git a/engines/glk/alan2/parse.cpp b/engines/glk/alan2/parse.cpp
index a977546de0..24961c91e9 100644
--- a/engines/glk/alan2/parse.cpp
+++ b/engines/glk/alan2/parse.cpp
@@ -41,8 +41,8 @@ namespace Alan2 {
/* PUBLIC DATA */
-int wrds[LISTLEN / 2] = {EOD}; /* List of parsed words */
-int wrdidx; /* and an index into it */
+Aword wrds[LISTLEN / 2] = {EOD}; // List of parsed words
+int wrdidx; // and an index into it
Boolean plural = FALSE;
diff --git a/engines/glk/alan2/parse.h b/engines/glk/alan2/parse.h
index 1e513011fa..af3276fd14 100644
--- a/engines/glk/alan2/parse.h
+++ b/engines/glk/alan2/parse.h
@@ -28,10 +28,10 @@
namespace Glk {
namespace Alan2 {
-extern int wrds[]; /* List of Parsed Word */
-extern int wrdidx; /* and an index into it */
+extern Aword wrds[]; // List of Parsed Word
+extern int wrdidx; // and an index into it
-extern ParamElem *params; /* List of parameters */
+extern ParamElem *params; // List of parameters
extern Boolean plural;
extern LitElem litValues[];
@@ -39,7 +39,7 @@ extern int litCount;
extern int vrbwrd;
-/* Parse a new player command */
+// Parse a new player command
extern void parse(void);
} // End of namespace Alan2
diff --git a/engines/glk/alan2/types.h b/engines/glk/alan2/types.h
index 7c8a414af3..b6be432f7e 100644
--- a/engines/glk/alan2/types.h
+++ b/engines/glk/alan2/types.h
@@ -59,18 +59,18 @@ namespace Alan2 {
#define addrTo(x) (&memory[x])
/* The word classes are represented as numbers but in the dictonary they are generated as bits */
-#define isVerb(word) (word < dictsize && (dict[word]._class&((Aword)1L<<WRD_VRB))!=0)
-#define isConj(word) (word < dictsize && (dict[word]._class&((Aword)1L<<WRD_CONJ))!=0)
-#define isBut(word) (word < dictsize && (dict[word]._class&((Aword)1L<<WRD_BUT))!=0)
-#define isThem(word) (word < dictsize && (dict[word]._class&((Aword)1L<<WRD_THEM))!=0)
-#define isIt(word) (word < dictsize && (dict[word]._class&((Aword)1L<<WRD_IT))!=0)
-#define isNoun(word) (word < dictsize && (dict[word]._class&((Aword)1L<<WRD_NOUN))!=0)
-#define isAdj(word) (word < dictsize && (dict[word]._class&((Aword)1L<<WRD_ADJ))!=0)
-#define isPrep(word) (word < dictsize && (dict[word]._class&((Aword)1L<<WRD_PREP))!=0)
-#define isAll(word) (word < dictsize && (dict[word]._class&((Aword)1L<<WRD_ALL))!=0)
-#define isDir(word) (word < dictsize && (dict[word]._class&((Aword)1L<<WRD_DIR))!=0)
-#define isNoise(word) (word < dictsize && (dict[word]._class&((Aword)1L<<WRD_NOISE))!=0)
-#define isLiteral(word) (word >= dictsize)
+#define isVerb(word) ((int)word < dictsize && (dict[word]._class&((Aword)1L<<WRD_VRB))!=0)
+#define isConj(word) ((int)word < dictsize && (dict[word]._class&((Aword)1L<<WRD_CONJ))!=0)
+#define isBut(word) ((int)word < dictsize && (dict[word]._class&((Aword)1L<<WRD_BUT))!=0)
+#define isThem(word) ((int)word < dictsize && (dict[word]._class&((Aword)1L<<WRD_THEM))!=0)
+#define isIt(word) ((int)word < dictsize && (dict[word]._class&((Aword)1L<<WRD_IT))!=0)
+#define isNoun(word) ((int)word < dictsize && (dict[word]._class&((Aword)1L<<WRD_NOUN))!=0)
+#define isAdj(word) ((int)word < dictsize && (dict[word]._class&((Aword)1L<<WRD_ADJ))!=0)
+#define isPrep(word) ((int)word < dictsize && (dict[word]._class&((Aword)1L<<WRD_PREP))!=0)
+#define isAll(word) ((int)word < dictsize && (dict[word]._class&((Aword)1L<<WRD_ALL))!=0)
+#define isDir(word) ((int)word < dictsize && (dict[word]._class&((Aword)1L<<WRD_DIR))!=0)
+#define isNoise(word) ((int)word < dictsize && (dict[word]._class&((Aword)1L<<WRD_NOISE))!=0)
+#define isLiteral(word) ((int)word >= dictsize)
/* TYPES */