Silence GCC warnings

...when compiling with -Wall --pedantic
This commit is contained in:
Pasi Kallinen
2015-03-31 08:36:32 +03:00
parent ec7238ac22
commit f2d97b2d00
8 changed files with 12 additions and 29 deletions

View File

@@ -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) {

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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:

View File

@@ -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 <color> aura" */
}
} else if (potion->cursed) {
how = "glow";
if (targobj->blessed) {
func = unbless;
glowcolor = "brown";

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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 */
}