From: Pasi Kallinen Date: Tue, 31 Mar 2015 05:36:32 +0000 (+0300) Subject: Silence GCC warnings X-Git-Tag: NetHack-3.6.0_RC01~506 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f2d97b2d00667989fa88fb54b70be8a867e81ffd;p=nethack Silence GCC warnings ...when compiling with -Wall --pedantic --- diff --git a/src/cmd.c b/src/cmd.c index 51bc10896..8b7408533 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -997,11 +997,8 @@ wiz_levltyp_legend(VOID_ARGS) STATIC_PTR int wiz_smell(VOID_ARGS) { - char out_str[BUFSZ]; - struct permonst *pm = 0; int ans = 0; int mndx; /* monster index */ - int found; /* count of matching mndxs found */ coord cc; /* screen pos of unknown glyph */ int glyph; /* glyph at selected position */ @@ -1015,11 +1012,6 @@ wiz_smell(VOID_ARGS) pline("You can move the cursor to a monster that you want to smell."); do { - /* Reset some variables. */ - pm = (struct permonst *)0; - found = 0; - out_str[0] = '\0'; - pline("Pick a monster to smell."); ans = getpos(&cc, TRUE, "a monster"); if (ans < 0 || cc.x < 0) { diff --git a/src/dig.c b/src/dig.c index f50d8aa76..a99c93729 100644 --- a/src/dig.c +++ b/src/dig.c @@ -1284,7 +1284,7 @@ zap_dig() struct monst *mtmp; struct obj *otmp; struct trap *trap_with_u = (struct trap *)0; - int zx, zy, diridx, digdepth, flow_x, flow_y; + int zx, zy, diridx = 8, digdepth, flow_x = -1, flow_y = -1; boolean shopdoor, shopwall, maze_dig, pitdig = FALSE, pitflow = FALSE; /* @@ -1462,7 +1462,7 @@ zap_dig() } /* while */ tmp_at(DISP_END,0); /* closing call */ - if (pitflow) { + if (pitflow && isok(flow_x, flow_y)) { struct trap *ttmp = t_at(flow_x, flow_y); if (ttmp && (ttmp->ttyp == PIT || ttmp->ttyp == SPIKED_PIT)) { schar filltyp = fillholetyp(ttmp->tx, ttmp->ty, TRUE); diff --git a/src/dog.c b/src/dog.c index fcc258b86..10e33677f 100644 --- a/src/dog.c +++ b/src/dog.c @@ -423,7 +423,7 @@ boolean with_you; * probably because the level is full. * Dump the monster's cargo and leave the monster dead. */ - struct obj *obj, *corpse; + struct obj *obj; while ((obj = mtmp->minvent) != 0) { obj_extract_self(obj); obj_no_longer_held(obj); @@ -437,7 +437,7 @@ boolean with_you; impossible("Can't find relocated object."); } } - corpse = mkcorpstat(CORPSE, (struct monst *)0, mtmp->data, + (void) mkcorpstat(CORPSE, (struct monst *)0, mtmp->data, xlocale, ylocale, CORPSTAT_NONE); mongone(mtmp); } diff --git a/src/mkroom.c b/src/mkroom.c index 2581ce996..6ef03054a 100644 --- a/src/mkroom.c +++ b/src/mkroom.c @@ -219,14 +219,10 @@ struct mkroom *sroom; { struct monst *mon; register int sx,sy,i; - int sh, tx, ty, goldlim, type = sroom->rtype; + int sh, tx = 0, ty = 0, goldlim = 0, type = sroom->rtype; int rmno = (int)((sroom - rooms) + ROOMOFFSET); coord mm; -#ifdef GCC_WARN - tx = ty = goldlim = 0; -#endif - sh = sroom->fdoor; switch(type) { case COURT: diff --git a/src/potion.c b/src/potion.c index d32c65b65..86fdcdff8 100644 --- a/src/potion.c +++ b/src/potion.c @@ -1055,7 +1055,7 @@ boolean useeit; const char *objphrase; /* "Your widget glows" or "Steed's saddle glows" */ { void FDECL((*func), (OBJ_P)) = 0; - const char *how = 0, *glowcolor = 0; + const char *glowcolor = 0; #define COST_alter (-2) #define COST_none (-1) int costchange = COST_none; @@ -1064,7 +1064,6 @@ const char *objphrase; /* "Your widget glows" or "Steed's saddle glows" */ if (!potion || potion->otyp != POT_WATER) return FALSE; if (potion->blessed) { - how = "softly glow"; if (targobj->cursed) { func = uncurse; glowcolor = NH_AMBER; @@ -1076,7 +1075,6 @@ const char *objphrase; /* "Your widget glows" or "Steed's saddle glows" */ altfmt = TRUE; /* "with a aura" */ } } else if (potion->cursed) { - how = "glow"; if (targobj->blessed) { func = unbless; glowcolor = "brown"; diff --git a/src/read.c b/src/read.c index 3ad28e8aa..7d35620bc 100644 --- a/src/read.c +++ b/src/read.c @@ -2198,7 +2198,7 @@ create_particular() { char buf[BUFSZ], *bufp, monclass; int which, tryct, i, firstchoice = NON_PM; - struct permonst *whichpm; + struct permonst *whichpm = NULL; struct monst *mtmp; boolean madeany = FALSE; boolean maketame, makepeaceful, makehostile; diff --git a/src/restore.c b/src/restore.c index be1126be8..4c4b049ce 100644 --- a/src/restore.c +++ b/src/restore.c @@ -1144,9 +1144,9 @@ get_plname_from_file(fd, plbuf) int fd; char *plbuf; { - int rlen, pltmpsiz = 0; - rlen = read(fd, (genericptr_t) &pltmpsiz, sizeof(pltmpsiz)); - rlen = read(fd, (genericptr_t) plbuf, pltmpsiz); + int pltmpsiz = 0; + (void) read(fd, (genericptr_t) &pltmpsiz, sizeof(pltmpsiz)); + (void) read(fd, (genericptr_t) plbuf, pltmpsiz); return; } diff --git a/src/trap.c b/src/trap.c index 775bca5cb..4c8adccbd 100644 --- a/src/trap.c +++ b/src/trap.c @@ -1406,13 +1406,12 @@ struct obj *otmp; { struct monst *steed = u.usteed; int tt; - boolean in_sight, trapkilled, steedhit; + boolean trapkilled, steedhit; if (!steed || !trap) return 0; tt = trap->ttyp; steed->mx = u.ux; steed->my = u.uy; - in_sight = !Blind; trapkilled = steedhit = FALSE; switch (tt) { @@ -4266,7 +4265,7 @@ boolean trapdoor_only; boolean *noticed; /* set to true iff hero notices the effect; */ { /* otherwise left with its previous value intact */ struct trap *t; - boolean ishero = (mon == &youmonst), result; + boolean ishero = (mon == &youmonst); if (mon == u.usteed) ishero = TRUE; t = t_at(ishero ? u.ux : mon->mx, ishero ? u.uy : mon->my); @@ -4281,7 +4280,6 @@ boolean *noticed; /* set to true iff hero notices the effect; */ if (u.utrap) return FALSE; /* already trapped */ *noticed = TRUE; dotrap(t, FORCETRAP); - result = (u.utrap != 0); } else { if (mon->mtrapped) return FALSE; /* already trapped */ /* you notice it if you see the trap close/tremble/whatever @@ -4290,7 +4288,6 @@ boolean *noticed; /* set to true iff hero notices the effect; */ /* monster will be angered; mintrap doesn't handle that */ wakeup(mon); ++force_mintrap; - result = (mintrap(mon) != 0); --force_mintrap; /* mon might now be on the migrating monsters list */ }