From 28a1a4166849c08668eda374a0673c4305aec32a Mon Sep 17 00:00:00 2001 From: "nethack.allison" Date: Thu, 16 Dec 2004 00:20:54 +0000 Subject: [PATCH] shadowed declaration warning complained that his compiler was giving these warnings: cmd.c:2119: warning: declaration of `expl' shadows a global declaration dungeon.c:292: warning: declaration of `rand' shadows a global declaration exper.c:100: warning: declaration of `exp' shadows a global declaration files.c:278: warning: declaration of `basename' shadows a global declaration hack.c:1102: warning: declaration of `expl' shadows a global declaration pickup.c:2081: warning: declaration of `select' shadows a global declaration role.c:1060: warning: declaration of `conj' shadows a global declaration --- src/cmd.c | 6 +++--- src/dungeon.c | 12 ++++++------ src/exper.c | 12 ++++++------ src/explode.c | 6 +++--- src/files.c | 20 ++++++++++---------- src/hack.c | 6 +++--- src/pickup.c | 10 +++++----- src/role.c | 4 ++-- 8 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/cmd.c b/src/cmd.c index 7ea03af79..87b253a50 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -2202,7 +2202,7 @@ const char *msg; char ctrl; winid win; static const char wiz_only_list[] = "EFGIOVW"; - char buf[BUFSZ], buf2[BUFSZ], *expl; + char buf[BUFSZ], buf2[BUFSZ], *explain; win = create_nhwindow(NHW_TEXT); if (!win) return FALSE; @@ -2214,7 +2214,7 @@ const char *msg; if (letter(sym)) { sym = highc(sym); ctrl = (sym - 'A') + 1; - if ((expl = dowhatdoes_core(ctrl, buf2)) + if ((explain = dowhatdoes_core(ctrl, buf2)) && (!index(wiz_only_list, sym) #ifdef WIZARD || wizard @@ -2225,7 +2225,7 @@ const char *msg; " as specified in the Guidebook"); putstr(win, 0, buf); putstr(win, 0, ""); - putstr(win, 0, expl); + putstr(win, 0, explain); putstr(win, 0, ""); putstr(win, 0, "To use that command, you press"); Sprintf(buf, diff --git a/src/dungeon.c b/src/dungeon.c index 2538b7b8a..aa72d198c 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -279,15 +279,15 @@ struct proto_dungeon *pd; * or dungeon entrance can occupy. * * Note: This follows the acouple (instead of the rcouple) rules for a - * negative random component (rand < 0). These rules are found + * negative random component (randc < 0). These rules are found * in dgn_comp.y. The acouple [absolute couple] section says that * a negative random component means from the (adjusted) base to the * end of the dungeon. */ STATIC_OVL int -level_range(dgn, base, rand, chain, pd, adjusted_base) +level_range(dgn, base, randc, chain, pd, adjusted_base) xchar dgn; - int base, rand, chain; + int base, randc, chain; struct proto_dungeon *pd; int *adjusted_base; { @@ -308,11 +308,11 @@ level_range(dgn, base, rand, chain, pd, adjusted_base) *adjusted_base = base; - if (rand == -1) { /* from base to end of dungeon */ + if (randc == -1) { /* from base to end of dungeon */ return (lmax - base + 1); - } else if (rand) { + } else if (randc) { /* make sure we don't run off the end of the dungeon */ - return (((base + rand - 1) > lmax) ? lmax-base+1 : rand); + return (((base + randc - 1) > lmax) ? lmax-base+1 : randc); } /* else only one choice */ return 1; } diff --git a/src/exper.c b/src/exper.c index e3fa49814..8472669c8 100644 --- a/src/exper.c +++ b/src/exper.c @@ -97,20 +97,20 @@ experience(mtmp, nk) /* return # of exp points for mtmp after nk killed */ } void -more_experienced(exp, rexp) - register int exp, rexp; +more_experienced(exper, rexp) + register int exper, rexp; { - long newexp = u.uexp + exp; - long rexpincr = 4*exp + rexp; + long newexp = u.uexp + exper; + long rexpincr = 4*exper + rexp; long newrexp = u.urexp + rexpincr; /* cap experience and score on wraparound */ - if (newexp < 0 && exp > 0) newexp = LONG_MAX; + if (newexp < 0 && exper > 0) newexp = LONG_MAX; if (newrexp < 0 && rexpincr > 0) newrexp = LONG_MAX; u.uexp = newexp; u.urexp = newrexp; - if(exp + if(exper #ifdef SCORE_ON_BOTL || flags.showscore #endif diff --git a/src/explode.c b/src/explode.c index 6885a3489..1ebf8715b 100644 --- a/src/explode.c +++ b/src/explode.c @@ -5,7 +5,7 @@ #include "hack.h" /* Note: Arrays are column first, while the screen is row first */ -static int expl[3][3] = { +static int explosion[3][3] = { { S_explode1, S_explode4, S_explode7 }, { S_explode2, S_explode5, S_explode8 }, { S_explode3, S_explode6, S_explode9 } @@ -189,7 +189,7 @@ int expltype; for (i=0; i<3; i++) for (j=0; j<3; j++) { if (explmask[i][j] == 2) continue; tmp_at(starting ? DISP_BEAM : DISP_CHANGE, - explosion_to_glyph(expltype,expl[i][j])); + explosion_to_glyph(expltype,explosion[i][j])); tmp_at(i+x-1, j+y-1); starting = 0; } @@ -215,7 +215,7 @@ int expltype; for (i=0; i<3; i++) for (j=0; j<3; j++) { if (explmask[i][j] == 1) show_glyph(i+x-1,j+y-1, - explosion_to_glyph(expltype, expl[i][j])); + explosion_to_glyph(expltype, explosion[i][j])); } } else { /* delay a little bit. */ diff --git a/src/files.c b/src/files.c index 59bfa6ccd..5722de0e4 100644 --- a/src/files.c +++ b/src/files.c @@ -280,30 +280,30 @@ int bufsz; /*ARGSUSED*/ #endif const char * -fqname(basename, whichprefix, buffnum) -const char *basename; +fqname(basenam, whichprefix, buffnum) +const char *basenam; int whichprefix, buffnum; { #ifndef PREFIXES_IN_USE - return basename; + return basenam; #else - if (!basename || whichprefix < 0 || whichprefix >= PREFIX_COUNT) - return basename; + if (!basenam || whichprefix < 0 || whichprefix >= PREFIX_COUNT) + return basenam; if (!fqn_prefix[whichprefix]) - return basename; + return basenam; if (buffnum < 0 || buffnum >= FQN_NUMBUF) { impossible("Invalid fqn_filename_buffer specified: %d", buffnum); buffnum = 0; } - if (strlen(fqn_prefix[whichprefix]) + strlen(basename) >= + if (strlen(fqn_prefix[whichprefix]) + strlen(basenam) >= FQN_MAX_FILENAME) { impossible("fqname too long: %s + %s", fqn_prefix[whichprefix], - basename); - return basename; /* XXX */ + basenam); + return basenam; /* XXX */ } Strcpy(fqn_filename_buffer[buffnum], fqn_prefix[whichprefix]); - return strcat(fqn_filename_buffer[buffnum], basename); + return strcat(fqn_filename_buffer[buffnum], basenam); #endif } diff --git a/src/hack.c b/src/hack.c index b67ad37eb..1a960455c 100644 --- a/src/hack.c +++ b/src/hack.c @@ -1132,17 +1132,17 @@ domove() if (context.forcefight || /* remembered an 'I' && didn't use a move command */ (glyph_is_invisible(levl[x][y].glyph) && !context.nopick)) { - boolean expl = (Upolyd && attacktype(youmonst.data, AT_EXPL)); + boolean explo = (Upolyd && attacktype(youmonst.data, AT_EXPL)); char buf[BUFSZ]; Sprintf(buf,"a vacant spot on the %s", surface(x,y)); You("%s %s.", - expl ? "explode at" : "attack", + explo ? "explode at" : "attack", !Underwater ? "thin air" : is_pool(x,y) ? "empty water" : buf); unmap_object(x, y); /* known empty -- remove 'I' if present */ newsym(x, y); nomul(0); - if (expl) { + if (explo) { u.mh = -1; /* dead in the current form */ rehumanize(); } diff --git a/src/pickup.c b/src/pickup.c index cda4f94c4..42fcd597a 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -2077,7 +2077,7 @@ register int held; #endif boolean one_by_one, allflag, quantum_cat = FALSE, loot_out = FALSE, loot_in = FALSE; - char select[MAXOCLASSES+1]; + char selection[MAXOCLASSES+1]; char qbuf[BUFSZ], emptymsg[BUFSZ], pbuf[QBUFSZ]; long loss = 0L; int cnt = 0, used = 0, @@ -2182,7 +2182,7 @@ ask_again2: container_contents(current_container, FALSE, FALSE); goto ask_again2; case 'y': - if (query_classes(select, &one_by_one, &allflag, + if (query_classes(selection, &one_by_one, &allflag, "take out", current_container->cobj, FALSE, #ifndef GOLDOBJ @@ -2190,7 +2190,7 @@ ask_again2: #endif &menu_on_request)) { if (askchain((struct obj **)¤t_container->cobj, - (one_by_one ? (char *)0 : select), + (one_by_one ? (char *)0 : selection), allflag, out_container, (int FDECL((*),(OBJ_P)))0, 0, "nodot")) @@ -2273,14 +2273,14 @@ ask_again2: } else { /* traditional code */ menu_on_request = 0; - if (query_classes(select, &one_by_one, &allflag, "put in", + if (query_classes(selection, &one_by_one, &allflag, "put in", invent, FALSE, #ifndef GOLDOBJ (u.ugold != 0L), #endif &menu_on_request)) { (void) askchain((struct obj **)&invent, - (one_by_one ? (char *)0 : select), allflag, + (one_by_one ? (char *)0 : selection), allflag, in_container, ck_bag, 0, "nodot"); used = 1; } else if (menu_on_request < 0) { diff --git a/src/role.c b/src/role.c index c751d10cf..394e8823c 100644 --- a/src/role.c +++ b/src/role.c @@ -1057,13 +1057,13 @@ promptsep(buf, num_post_attribs) char *buf; int num_post_attribs; { - const char *conj = "and "; + const char *conjuct = "and "; if (num_post_attribs > 1 && post_attribs < num_post_attribs && post_attribs > 1) Strcat(buf, ","); Strcat(buf, " "); --post_attribs; - if (!post_attribs && num_post_attribs > 1) Strcat(buf, conj); + if (!post_attribs && num_post_attribs > 1) Strcat(buf, conjuct); return buf; } -- 2.40.0