Squasgh -Wextra warnings.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 15 Jun 2017 23:39:43 +0000 (19:39 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 15 Jun 2017 23:39:43 +0000 (19:39 -0400)
Makefile
actions.c
misc.c
notes.adoc
score.c

index 88fd80719260b4c08fa344158f4a1a41039c2add..3c0e965e14bace008c5444111b57306bd6966fad 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@
 VERS=1.0
 
 CC?=gcc
 VERS=1.0
 
 CC?=gcc
-CCFLAGS+=-std=c99 -D _DEFAULT_SOURCE -Wall -Wpedantic -g
+CCFLAGS+=-std=c99 -D _DEFAULT_SOURCE -Wall -Wpedantic -Wextra -g
 LIBS=
 UNAME_S := $(shell uname -s)
 ifeq ($(UNAME_S),Linux)
 LIBS=
 UNAME_S := $(shell uname -s)
 ifeq ($(UNAME_S),Linux)
index e88773e94245869e39f0dc3ce598c0f82127a647..346d04a7b604534115060d79a39b2c1980581951 100644 (file)
--- a/actions.c
+++ b/actions.c
@@ -614,7 +614,7 @@ static int fly(token_t verb, token_t obj)
     return GO_TERMINATE;
 }
 
     return GO_TERMINATE;
 }
 
-static int inven(token_t obj)
+static int inven(void)
 /* Inventory. If object, treat same as find.  Else report on current burden. */
 {
     int spk=NO_CARRY;
 /* Inventory. If object, treat same as find.  Else report on current burden. */
 {
     int spk=NO_CARRY;
@@ -1087,7 +1087,7 @@ int action(FILE *input, enum speechpart part, long verb, token_t obj)
                    case 16: /* TOSS  */ return GO_UNKNOWN; 
                    case 17: /* QUIT  */ return quit(input);   
                    case 18: /* FIND  */ return GO_UNKNOWN; 
                    case 16: /* TOSS  */ return GO_UNKNOWN; 
                    case 17: /* QUIT  */ return quit(input);   
                    case 18: /* FIND  */ return GO_UNKNOWN; 
-                   case 19: /* INVEN */ return inven(obj);   
+                   case 19: /* INVEN */ return inven();
                    case 20: /* FEED  */ return GO_UNKNOWN; 
                    case 21: /* FILL  */ return fill(verb, obj);   
                    case 22: /* BLAST */ return blast();   
                    case 20: /* FEED  */ return GO_UNKNOWN; 
                    case 21: /* FILL  */ return fill(verb, obj);   
                    case 22: /* BLAST */ return blast();   
diff --git a/misc.c b/misc.c
index b0f24b803e328cec5e9e60f1a2067a8854049c34..243381a86330d1df2221b4f3ee6975b8b5cd6b34 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -67,7 +67,7 @@ void newspeak(char* msg)
  
   // Handle format specifiers (including the custom %C, %L, %S) by adjusting the parameter accordingly, and replacing the specifier with %s.
   int pi = 0; // parameter index
  
   // Handle format specifiers (including the custom %C, %L, %S) by adjusting the parameter accordingly, and replacing the specifier with %s.
   int pi = 0; // parameter index
-  for (int i = 0; i < strlen(msg); ++i)
+  for (int i = 0; i < (int)strlen(msg); ++i)
     {
       if (msg[i] == '%')
        {
     {
       if (msg[i] == '%')
        {
@@ -105,7 +105,7 @@ void newspeak(char* msg)
            {
              copy[i + 1] = 's';
              packed_to_token(PARMS[pi], parameters[pi]);
            {
              copy[i + 1] = 's';
              packed_to_token(PARMS[pi], parameters[pi]);
-             for (int j = 0; j < strlen(parameters[pi]); ++j)
+             for (int j = 0; j < (int)strlen(parameters[pi]); ++j)
                {
                  parameters[pi][j] = tolower(parameters[pi][j]);
                }
                {
                  parameters[pi][j] = tolower(parameters[pi][j]);
                }
@@ -116,7 +116,7 @@ void newspeak(char* msg)
            {
              copy[i + 1] = 's';
              packed_to_token(PARMS[pi], parameters[pi]);
            {
              copy[i + 1] = 's';
              packed_to_token(PARMS[pi], parameters[pi]);
-             for (int j = 0; j < strlen(parameters[pi]); ++j)
+             for (int j = 0; j < (int)strlen(parameters[pi]); ++j)
                {
                  parameters[pi][j] = tolower(parameters[pi][j]);
                }
                {
                  parameters[pi][j] = tolower(parameters[pi][j]);
                }
index a4eabf4680fdff449aee4716bd7c579b4a54eb1e..fd3504a6f2ce68a4d62668690e3b4542f0cf070e 100644 (file)
@@ -11,7 +11,7 @@ The principal maintainers of this code are Eric S. Raymond and Jason
 Ninneman.  Eric received Don Woods's encouragement to update and ship
 the game; Jason signed on early in the process to help. The assistance
 of Peje Nilsson in restructuring some particularly grotty gotos is
 Ninneman.  Eric received Don Woods's encouragement to update and ship
 the game; Jason signed on early in the process to help. The assistance
 of Peje Nilsson in restructuring some particularly grotty gotos is
-gratefully acknowledged.
+gratefully acknowledged. Petr Voropaev contributed fuzz testing.
 
 == Nomenclature ==
 
 
 == Nomenclature ==
 
diff --git a/score.c b/score.c
index a9ab765aed73e90261230c6f08f1a5e12ad853eb..594b637578d1270822c9b183218efaeba26ab2e3 100644 (file)
--- a/score.c
+++ b/score.c
@@ -110,7 +110,7 @@ void score(enum termination mode)
     SETPRM(1,score,mxscor);
     SETPRM(3,game.turns,game.turns);
     RSPEAK(TOTAL_SCORE);
     SETPRM(1,score,mxscor);
     SETPRM(3,game.turns,game.turns);
     RSPEAK(TOTAL_SCORE);
-    for (long i=1; i<=CLSSES; i++) {
+    for (long i=1; i<=(long)CLSSES; i++) {
        if(CVAL[i] >= score) {
            newspeak(class_messages[i]);
            i=CVAL[i]+1-score;
        if(CVAL[i] >= score) {
            newspeak(class_messages[i]);
            i=CVAL[i]+1-score;