From: Eric S. Raymond Date: Thu, 15 Jun 2017 23:39:43 +0000 (-0400) Subject: Squasgh -Wextra warnings. X-Git-Tag: 1.1~290^2~1 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=eaee02aa09d1db40ea10d3b77e7df1e2e9c6b9ba;p=open-adventure.git Squasgh -Wextra warnings. --- diff --git a/Makefile b/Makefile index 88fd807..3c0e965 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ 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) diff --git a/actions.c b/actions.c index e88773e..346d04a 100644 --- a/actions.c +++ b/actions.c @@ -614,7 +614,7 @@ static int fly(token_t verb, token_t obj) 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; @@ -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 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(); diff --git a/misc.c b/misc.c index b0f24b8..243381a 100644 --- 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 - for (int i = 0; i < strlen(msg); ++i) + for (int i = 0; i < (int)strlen(msg); ++i) { if (msg[i] == '%') { @@ -105,7 +105,7 @@ void newspeak(char* msg) { 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]); } @@ -116,7 +116,7 @@ void newspeak(char* msg) { 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]); } diff --git a/notes.adoc b/notes.adoc index a4eabf4..fd3504a 100644 --- a/notes.adoc +++ b/notes.adoc @@ -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 -gratefully acknowledged. +gratefully acknowledged. Petr Voropaev contributed fuzz testing. == Nomenclature == diff --git a/score.c b/score.c index a9ab765..594b637 100644 --- 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); - 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;