From 04539cb235b06fd8cacf5c4c40081bd86e0dfa04 Mon Sep 17 00:00:00 2001 From: dholland Date: Sun, 7 Aug 2011 06:03:45 +0000 Subject: Fix up some lint. --- hack/hack.apply.c | 6 +++--- hack/hack.c | 6 +++--- hack/hack.do_name.c | 11 ++++++----- hack/hack.dog.c | 19 ++++++++++--------- hack/hack.eat.c | 12 ++++++------ hack/hack.engrave.c | 11 +++++++---- hack/hack.invent.c | 6 ++++-- hack/hack.mkobj.c | 7 ++++--- hack/hack.mkshop.c | 6 +++--- hack/hack.mon.c | 5 +++-- hack/hack.objnam.c | 10 +++++----- hack/hack.shk.c | 5 +++-- hack/hack.trap.c | 6 +++--- hack/hack.wizard.c | 6 +++--- 14 files changed, 63 insertions(+), 53 deletions(-) (limited to 'hack') diff --git a/hack/hack.apply.c b/hack/hack.apply.c index 24d7443a..c99efd53 100644 --- a/hack/hack.apply.c +++ b/hack/hack.apply.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.apply.c,v 1.12 2011/08/06 20:42:43 dholland Exp $ */ +/* $NetBSD: hack.apply.c,v 1.13 2011/08/07 06:03:45 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.apply.c,v 1.12 2011/08/06 20:42:43 dholland Exp $"); +__RCSID("$NetBSD: hack.apply.c,v 1.13 2011/08/07 06:03:45 dholland Exp $"); #endif /* not lint */ #include "hack.h" @@ -108,7 +108,7 @@ doapply(void) use_magic_whistle(obj); break; } - /* fall into next case */ + /* FALLTHROUGH */ case WHISTLE: use_whistle(obj); break; diff --git a/hack/hack.c b/hack/hack.c index 8b1731a2..25a429c2 100644 --- a/hack/hack.c +++ b/hack/hack.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.c,v 1.10 2010/02/03 15:34:38 roy Exp $ */ +/* $NetBSD: hack.c,v 1.11 2011/08/07 06:03:45 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.c,v 1.10 2010/02/03 15:34:38 roy Exp $"); +__RCSID("$NetBSD: hack.c,v 1.11 2011/08/07 06:03:45 dholland Exp $"); #endif /* not lint */ #include "hack.h" @@ -600,7 +600,7 @@ lookaround(void) break; if (flags.run != 1) goto stop; - /* fall into next case */ + /* FALLTHROUGH */ case CORR_SYM: corr: if (flags.run == 1 || flags.run == 3) { diff --git a/hack/hack.do_name.c b/hack/hack.do_name.c index 9cf5e40b..c01e35b4 100644 --- a/hack/hack.do_name.c +++ b/hack/hack.do_name.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.do_name.c,v 1.12 2011/08/06 20:29:37 dholland Exp $ */ +/* $NetBSD: hack.do_name.c,v 1.13 2011/08/07 06:03:45 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.do_name.c,v 1.12 2011/08/06 20:29:37 dholland Exp $"); +__RCSID("$NetBSD: hack.do_name.c,v 1.13 2011/08/07 06:03:45 dholland Exp $"); #endif /* not lint */ #include @@ -119,7 +119,8 @@ do_mname(void) { char buf[BUFSZ]; coord cc; - int cx, cy, lth; + int cx, cy; + size_t lth; unsigned i; struct monst *mtmp, *mtmp2; cc = getpos(0, "the monster you want to name"); @@ -173,7 +174,7 @@ static void do_oname(struct obj *obj) { struct obj *otmp, *otmp2; - int lth; + size_t lth; char buf[BUFSZ]; pline("What do you want to name %s? ", doname(obj)); getlin(buf); @@ -295,7 +296,7 @@ xmonnam(struct monst *mtmp, int vb) (void) strlcpy(buf, shkname(mtmp), sizeof(buf)); break; } - /* fall into next case */ + /* FALLTHROUGH */ default: (void) snprintf(buf, sizeof(buf), "the %s%s", mtmp->minvis ? "invisible " : "", diff --git a/hack/hack.dog.c b/hack/hack.dog.c index bc8f88dd..a76e7ffe 100644 --- a/hack/hack.dog.c +++ b/hack/hack.dog.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.dog.c,v 1.11 2009/08/12 07:28:40 dholland Exp $ */ +/* $NetBSD: hack.dog.c,v 1.12 2011/08/07 06:03:45 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.dog.c,v 1.11 2009/08/12 07:28:40 dholland Exp $"); +__RCSID("$NetBSD: hack.dog.c,v 1.12 2011/08/07 06:03:45 dholland Exp $"); #endif /* not lint */ #include "hack.h" @@ -177,7 +177,7 @@ dogfood(struct obj *obj) default: if (!obj->cursed) return (APPORT); - /* fall into next case */ + /* FALLTHROUGH */ case BALL_SYM: case CHAIN_SYM: case ROCK_SYM: @@ -475,12 +475,13 @@ int inroom(xchar x, xchar y) { #ifndef QUEST - struct mkroom *croom = &rooms[0]; - while (croom->hx >= 0) { - if (croom->hx >= x - 1 && croom->lx <= x + 1 && - croom->hy >= y - 1 && croom->ly <= y + 1) - return (croom - rooms); - croom++; + int pos = 0; + + while (rooms[pos].hx >= 0) { + if (rooms[pos].hx >= x - 1 && rooms[pos].lx <= x + 1 && + rooms[pos].hy >= y - 1 && rooms[pos].ly <= y + 1) + return pos; + pos++; } #endif /* QUEST */ return (-1); /* not in room or on door */ diff --git a/hack/hack.eat.c b/hack/hack.eat.c index bf8703bd..a6c404e7 100644 --- a/hack/hack.eat.c +++ b/hack/hack.eat.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.eat.c,v 1.11 2011/08/06 20:42:43 dholland Exp $ */ +/* $NetBSD: hack.eat.c,v 1.12 2011/08/07 06:03:45 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.eat.c,v 1.11 2011/08/06 20:42:43 dholland Exp $"); +__RCSID("$NetBSD: hack.eat.c,v 1.12 2011/08/07 06:03:45 dholland Exp $"); #endif /* not lint */ #include "hack.h" @@ -495,11 +495,11 @@ eatcorpse(struct obj *otmp) case 'n': u.uhp = u.uhpmax; flags.botl = 1; - /* fall into next case */ + /* FALLTHROUGH */ case '@': pline("You cannibal! You will be sorry for this!"); /* not tp++; */ - /* fall into next case */ + /* FALLTHROUGH */ case 'd': Aggravate_monster |= INTRINSIC; break; @@ -512,12 +512,12 @@ eatcorpse(struct obj *otmp) Invis |= INTRINSIC; See_invisible |= INTRINSIC; } - /* fall into next case */ + /* FALLTHROUGH */ case 'y': #ifdef QUEST u.uhorizon++; #endif /* QUEST */ - /* fall into next case */ + /* FALLTHROUGH */ case 'B': Confusion = 50; break; diff --git a/hack/hack.engrave.c b/hack/hack.engrave.c index 2f7d3a2a..cd82725d 100644 --- a/hack/hack.engrave.c +++ b/hack/hack.engrave.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.engrave.c,v 1.13 2011/08/06 20:42:43 dholland Exp $ */ +/* $NetBSD: hack.engrave.c,v 1.14 2011/08/07 06:03:45 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.engrave.c,v 1.13 2011/08/06 20:42:43 dholland Exp $"); +__RCSID("$NetBSD: hack.engrave.c,v 1.14 2011/08/07 06:03:45 dholland Exp $"); #endif /* not lint */ #include @@ -105,7 +105,8 @@ sengr_at(const char *s, xchar x, xchar y) { struct engr *ep = engr_at(x, y); char *t; - int n; + size_t n; + if (ep && ep->engr_time <= moves) { t = ep->engr_txt; /* @@ -132,8 +133,10 @@ void wipe_engr_at(xchar x, xchar y, xchar cnt) { struct engr *ep = engr_at(x, y); - int lth, pos; + int pos; char ch; + size_t lth; + if (ep) { if ((ep->engr_type != DUST) || Levitation) { cnt = rn2(1 + 50 / (cnt + 1)) ? 0 : 1; diff --git a/hack/hack.invent.c b/hack/hack.invent.c index 2a6fddb6..82284f10 100644 --- a/hack/hack.invent.c +++ b/hack/hack.invent.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.invent.c,v 1.17 2011/08/06 20:42:43 dholland Exp $ */ +/* $NetBSD: hack.invent.c,v 1.18 2011/08/07 06:03:45 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.invent.c,v 1.17 2011/08/06 20:42:43 dholland Exp $"); +__RCSID("$NetBSD: hack.invent.c,v 1.18 2011/08/07 06:03:45 dholland Exp $"); #endif /* not lint */ #include @@ -664,10 +664,12 @@ askchain(struct obj *objchn, char *olets, int allflag, switch (sym) { case 'a': allflag = 1; + /* FALLTHROUGH */ case 'y': cnt += (*fn) (otmp); if (--max == 0) goto ret; + break; case 'n': default: break; diff --git a/hack/hack.mkobj.c b/hack/hack.mkobj.c index 43f6c26c..334d1f2e 100644 --- a/hack/hack.mkobj.c +++ b/hack/hack.mkobj.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.mkobj.c,v 1.8 2009/08/12 07:28:41 dholland Exp $ */ +/* $NetBSD: hack.mkobj.c,v 1.9 2011/08/07 06:03:45 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.mkobj.c,v 1.8 2009/08/12 07:28:41 dholland Exp $"); +__RCSID("$NetBSD: hack.mkobj.c,v 1.9 2011/08/07 06:03:45 dholland Exp $"); #endif /* not lint */ #include "hack.h" @@ -141,9 +141,10 @@ mksobj(int otyp) if (otmp->otyp == TIN) otmp->spe = rnd(...); #endif /* NOT_YET_IMPLEMENTED */ - /* fall into next case */ + /* FALLTHROUGH */ case GEM_SYM: otmp->quan = rn2(6) ? 1 : 2; + break; case TOOL_SYM: case CHAIN_SYM: case BALL_SYM: diff --git a/hack/hack.mkshop.c b/hack/hack.mkshop.c index 7157a37b..6c3da2fc 100644 --- a/hack/hack.mkshop.c +++ b/hack/hack.mkshop.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.mkshop.c,v 1.10 2009/08/12 07:28:41 dholland Exp $ */ +/* $NetBSD: hack.mkshop.c,v 1.11 2011/08/07 06:03:45 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.mkshop.c,v 1.10 2009/08/12 07:28:41 dholland Exp $"); +__RCSID("$NetBSD: hack.mkshop.c,v 1.11 2011/08/07 06:03:45 dholland Exp $"); #endif /* not lint */ #include @@ -188,7 +188,7 @@ gottype: return; shk->isshk = shk->mpeaceful = 1; shk->msleep = 0; - shk->mtrapseen = ~0; /* we know all the traps already */ + shk->mtrapseen = ~0U; /* we know all the traps already */ ESHK->shoproom = roomno; ESHK->shoplevel = dlevel; ESHK->shd = doors[sh]; diff --git a/hack/hack.mon.c b/hack/hack.mon.c index ef80361c..8dd587ec 100644 --- a/hack/hack.mon.c +++ b/hack/hack.mon.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.mon.c,v 1.13 2011/08/06 20:29:37 dholland Exp $ */ +/* $NetBSD: hack.mon.c,v 1.14 2011/08/07 06:03:45 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.mon.c,v 1.13 2011/08/06 20:29:37 dholland Exp $"); +__RCSID("$NetBSD: hack.mon.c,v 1.14 2011/08/07 06:03:45 dholland Exp $"); #endif /* not lint */ #include @@ -848,6 +848,7 @@ killed(struct monst *mtmp) { int ul = u.ulevel; int ml = mdat->mlevel; + int tmp2; if (ul < 14) /* points are given based on present and * future level */ diff --git a/hack/hack.objnam.c b/hack/hack.objnam.c index b3eb4679..eb0421b2 100644 --- a/hack/hack.objnam.c +++ b/hack/hack.objnam.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.objnam.c,v 1.10 2009/08/12 07:28:41 dholland Exp $ */ +/* $NetBSD: hack.objnam.c,v 1.11 2011/08/07 06:03:45 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.objnam.c,v 1.10 2009/08/12 07:28:41 dholland Exp $"); +__RCSID("$NetBSD: hack.objnam.c,v 1.11 2011/08/07 06:03:45 dholland Exp $"); #endif /* not lint */ #include @@ -200,7 +200,7 @@ xname(struct obj *obj) break; } /* fungis ? */ - /* fall into next case */ + /* FALLTHROUGH */ case WEAPON_SYM: if (obj->otyp == WORM_TOOTH && pl) { pl = 0; @@ -212,7 +212,7 @@ xname(struct obj *obj) Strcpy(buf, "crysknives"); break; } - /* fall into next case */ + /* FALLTHROUGH */ case ARMOR_SYM: case CHAIN_SYM: case ROCK_SYM: @@ -358,7 +358,7 @@ doname(struct obj *obj) case ARMOR_SYM: if (obj->owornmask & W_ARMOR) strlcat(bp, " (being worn)", bpmax); - /* fall into next case */ + /* FALLTHROUGH */ case WEAPON_SYM: if (obj->known) { strlcat(prefix, sitoa(obj->spe), sizeof(prefix)); diff --git a/hack/hack.shk.c b/hack/hack.shk.c index ee873518..3c6f962f 100644 --- a/hack/hack.shk.c +++ b/hack/hack.shk.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.shk.c,v 1.12 2011/08/06 20:29:37 dholland Exp $ */ +/* $NetBSD: hack.shk.c,v 1.13 2011/08/07 06:03:45 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.shk.c,v 1.12 2011/08/06 20:29:37 dholland Exp $"); +__RCSID("$NetBSD: hack.shk.c,v 1.13 2011/08/07 06:03:45 dholland Exp $"); #endif /* not lint */ #include @@ -890,6 +890,7 @@ getprice(struct obj *obj) break; case CHAIN_SYM: pline("Strange ..., carrying a chain?"); + /* FALLTHROUGH */ case BALL_SYM: tmp = 10; break; diff --git a/hack/hack.trap.c b/hack/hack.trap.c index b2614555..55ba9378 100644 --- a/hack/hack.trap.c +++ b/hack/hack.trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.trap.c,v 1.9 2009/08/12 07:28:41 dholland Exp $ */ +/* $NetBSD: hack.trap.c,v 1.10 2011/08/07 06:03:45 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.trap.c,v 1.9 2009/08/12 07:28:41 dholland Exp $"); +__RCSID("$NetBSD: hack.trap.c,v 1.10 2011/08/07 06:03:45 dholland Exp $"); #endif /* not lint */ #include @@ -336,7 +336,7 @@ float_down(void) case TRAPDOOR: if (!xdnstair || u.ustuck) break; - /* fall into next case */ + /* FALLTHROUGH */ default: dotrap(trap); } diff --git a/hack/hack.wizard.c b/hack/hack.wizard.c index 72115382..0cd00c7f 100644 --- a/hack/hack.wizard.c +++ b/hack/hack.wizard.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.wizard.c,v 1.9 2009/08/12 07:28:41 dholland Exp $ */ +/* $NetBSD: hack.wizard.c,v 1.10 2011/08/07 06:03:45 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.wizard.c,v 1.9 2009/08/12 07:28:41 dholland Exp $"); +__RCSID("$NetBSD: hack.wizard.c,v 1.10 2011/08/07 06:03:45 dholland Exp $"); #endif /* not lint */ /* wizard code - inspired by rogue code from Merlyn Leroy (digi-g!brian) */ @@ -221,7 +221,7 @@ inrange(struct monst *mtmp) pline("\"Destroy the thief, my pets!\""); aggravate(); /* aggravate all the * monsters */ - /* fall into next case */ + /* FALLTHROUGH */ case 2: if (flags.no_of_wizards == 1 && rnd(5) == 0) /* -- cgit v1.2.3-56-ge451