Squasgh -Wextra warnings.

This commit is contained in:
Eric S. Raymond 2017-06-15 19:39:43 -04:00
parent 2182dc23ff
commit eaee02aa09
5 changed files with 8 additions and 8 deletions

View file

@ -22,7 +22,7 @@
VERS=1.0 VERS=1.0
CC?=gcc CC?=gcc
CCFLAGS+=-std=c99 -D _DEFAULT_SOURCE -Wall -Wpedantic -g CCFLAGS+=-std=c99 -D _DEFAULT_SOURCE -Wall -Wpedantic -Wextra -g
LIBS= LIBS=
UNAME_S := $(shell uname -s) UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux) ifeq ($(UNAME_S),Linux)

View file

@ -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. */ /* Inventory. If object, treat same as find. Else report on current burden. */
{ {
int spk=NO_CARRY; 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 16: /* TOSS */ return GO_UNKNOWN;
case 17: /* QUIT */ return quit(input); case 17: /* QUIT */ return quit(input);
case 18: /* FIND */ return GO_UNKNOWN; case 18: /* FIND */ return GO_UNKNOWN;
case 19: /* INVEN */ return inven(obj); case 19: /* INVEN */ return inven();
case 20: /* FEED */ return GO_UNKNOWN; case 20: /* FEED */ return GO_UNKNOWN;
case 21: /* FILL */ return fill(verb, obj); case 21: /* FILL */ return fill(verb, obj);
case 22: /* BLAST */ return blast(); case 22: /* BLAST */ return blast();

6
misc.c
View file

@ -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. // 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 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'; copy[i + 1] = 's';
packed_to_token(PARMS[pi], parameters[pi]); 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'; copy[i + 1] = 's';
packed_to_token(PARMS[pi], parameters[pi]); 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]);
} }

View 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 Ninneman. Eric received Don Woods's encouragement to update and ship
the game; Jason signed on early in the process to help. The assistance the game; Jason signed on early in the process to help. The assistance
of Peje Nilsson in restructuring some particularly grotty gotos is of Peje Nilsson in restructuring some particularly grotty gotos is
gratefully acknowledged. gratefully acknowledged. Petr Voropaev contributed fuzz testing.
== Nomenclature == == Nomenclature ==

View file

@ -110,7 +110,7 @@ void score(enum termination mode)
SETPRM(1,score,mxscor); SETPRM(1,score,mxscor);
SETPRM(3,game.turns,game.turns); SETPRM(3,game.turns,game.turns);
RSPEAK(TOTAL_SCORE); RSPEAK(TOTAL_SCORE);
for (long i=1; i<=CLSSES; i++) { for (long i=1; i<=(long)CLSSES; i++) {
if(CVAL[i] >= score) { if(CVAL[i] >= score) {
newspeak(class_messages[i]); newspeak(class_messages[i]);
i=CVAL[i]+1-score; i=CVAL[i]+1-score;