Module Name: src Committed By: dholland Date: Sun Aug 7 06:03:45 UTC 2011
Modified Files: src/games/hack: hack.apply.c hack.c hack.do_name.c hack.dog.c hack.eat.c hack.engrave.c hack.invent.c hack.mkobj.c hack.mkshop.c hack.mon.c hack.objnam.c hack.shk.c hack.trap.c hack.wizard.c Log Message: Fix up some lint. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/games/hack/hack.apply.c \ src/games/hack/hack.do_name.c src/games/hack/hack.shk.c cvs rdiff -u -r1.10 -r1.11 src/games/hack/hack.c src/games/hack/hack.mkshop.c \ src/games/hack/hack.objnam.c cvs rdiff -u -r1.11 -r1.12 src/games/hack/hack.dog.c \ src/games/hack/hack.eat.c cvs rdiff -u -r1.13 -r1.14 src/games/hack/hack.engrave.c \ src/games/hack/hack.mon.c cvs rdiff -u -r1.17 -r1.18 src/games/hack/hack.invent.c cvs rdiff -u -r1.8 -r1.9 src/games/hack/hack.mkobj.c cvs rdiff -u -r1.9 -r1.10 src/games/hack/hack.trap.c \ src/games/hack/hack.wizard.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/games/hack/hack.apply.c diff -u src/games/hack/hack.apply.c:1.12 src/games/hack/hack.apply.c:1.13 --- src/games/hack/hack.apply.c:1.12 Sat Aug 6 20:42:43 2011 +++ src/games/hack/hack.apply.c Sun Aug 7 06:03:45 2011 @@ -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 <sys/cdefs.h> #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 @@ use_magic_whistle(obj); break; } - /* fall into next case */ + /* FALLTHROUGH */ case WHISTLE: use_whistle(obj); break; Index: src/games/hack/hack.do_name.c diff -u src/games/hack/hack.do_name.c:1.12 src/games/hack/hack.do_name.c:1.13 --- src/games/hack/hack.do_name.c:1.12 Sat Aug 6 20:29:37 2011 +++ src/games/hack/hack.do_name.c Sun Aug 7 06:03:45 2011 @@ -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 <sys/cdefs.h> #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 <stdlib.h> @@ -119,7 +119,8 @@ { 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 @@ 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 @@ (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 " : "", Index: src/games/hack/hack.shk.c diff -u src/games/hack/hack.shk.c:1.12 src/games/hack/hack.shk.c:1.13 --- src/games/hack/hack.shk.c:1.12 Sat Aug 6 20:29:37 2011 +++ src/games/hack/hack.shk.c Sun Aug 7 06:03:45 2011 @@ -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 <sys/cdefs.h> #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 <stdlib.h> @@ -890,6 +890,7 @@ break; case CHAIN_SYM: pline("Strange ..., carrying a chain?"); + /* FALLTHROUGH */ case BALL_SYM: tmp = 10; break; Index: src/games/hack/hack.c diff -u src/games/hack/hack.c:1.10 src/games/hack/hack.c:1.11 --- src/games/hack/hack.c:1.10 Wed Feb 3 15:34:38 2010 +++ src/games/hack/hack.c Sun Aug 7 06:03:45 2011 @@ -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 <sys/cdefs.h> #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 @@ break; if (flags.run != 1) goto stop; - /* fall into next case */ + /* FALLTHROUGH */ case CORR_SYM: corr: if (flags.run == 1 || flags.run == 3) { Index: src/games/hack/hack.mkshop.c diff -u src/games/hack/hack.mkshop.c:1.10 src/games/hack/hack.mkshop.c:1.11 --- src/games/hack/hack.mkshop.c:1.10 Wed Aug 12 07:28:41 2009 +++ src/games/hack/hack.mkshop.c Sun Aug 7 06:03:45 2011 @@ -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 <sys/cdefs.h> #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 <stdlib.h> @@ -188,7 +188,7 @@ 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]; Index: src/games/hack/hack.objnam.c diff -u src/games/hack/hack.objnam.c:1.10 src/games/hack/hack.objnam.c:1.11 --- src/games/hack/hack.objnam.c:1.10 Wed Aug 12 07:28:41 2009 +++ src/games/hack/hack.objnam.c Sun Aug 7 06:03:45 2011 @@ -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 <sys/cdefs.h> #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 <stdlib.h> @@ -200,7 +200,7 @@ break; } /* fungis ? */ - /* fall into next case */ + /* FALLTHROUGH */ case WEAPON_SYM: if (obj->otyp == WORM_TOOTH && pl) { pl = 0; @@ -212,7 +212,7 @@ Strcpy(buf, "crysknives"); break; } - /* fall into next case */ + /* FALLTHROUGH */ case ARMOR_SYM: case CHAIN_SYM: case ROCK_SYM: @@ -358,7 +358,7 @@ 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)); Index: src/games/hack/hack.dog.c diff -u src/games/hack/hack.dog.c:1.11 src/games/hack/hack.dog.c:1.12 --- src/games/hack/hack.dog.c:1.11 Wed Aug 12 07:28:40 2009 +++ src/games/hack/hack.dog.c Sun Aug 7 06:03:45 2011 @@ -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 <sys/cdefs.h> #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 @@ default: if (!obj->cursed) return (APPORT); - /* fall into next case */ + /* FALLTHROUGH */ case BALL_SYM: case CHAIN_SYM: case ROCK_SYM: @@ -475,12 +475,13 @@ 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 */ Index: src/games/hack/hack.eat.c diff -u src/games/hack/hack.eat.c:1.11 src/games/hack/hack.eat.c:1.12 --- src/games/hack/hack.eat.c:1.11 Sat Aug 6 20:42:43 2011 +++ src/games/hack/hack.eat.c Sun Aug 7 06:03:45 2011 @@ -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 <sys/cdefs.h> #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 @@ 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 @@ 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; Index: src/games/hack/hack.engrave.c diff -u src/games/hack/hack.engrave.c:1.13 src/games/hack/hack.engrave.c:1.14 --- src/games/hack/hack.engrave.c:1.13 Sat Aug 6 20:42:43 2011 +++ src/games/hack/hack.engrave.c Sun Aug 7 06:03:45 2011 @@ -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 <sys/cdefs.h> #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 <stdlib.h> @@ -105,7 +105,8 @@ { 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 @@ 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; Index: src/games/hack/hack.mon.c diff -u src/games/hack/hack.mon.c:1.13 src/games/hack/hack.mon.c:1.14 --- src/games/hack/hack.mon.c:1.13 Sat Aug 6 20:29:37 2011 +++ src/games/hack/hack.mon.c Sun Aug 7 06:03:45 2011 @@ -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 <sys/cdefs.h> #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 <stdlib.h> @@ -848,6 +848,7 @@ { int ul = u.ulevel; int ml = mdat->mlevel; + int tmp2; if (ul < 14) /* points are given based on present and * future level */ Index: src/games/hack/hack.invent.c diff -u src/games/hack/hack.invent.c:1.17 src/games/hack/hack.invent.c:1.18 --- src/games/hack/hack.invent.c:1.17 Sat Aug 6 20:42:43 2011 +++ src/games/hack/hack.invent.c Sun Aug 7 06:03:45 2011 @@ -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 <sys/cdefs.h> #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 <assert.h> @@ -664,10 +664,12 @@ switch (sym) { case 'a': allflag = 1; + /* FALLTHROUGH */ case 'y': cnt += (*fn) (otmp); if (--max == 0) goto ret; + break; case 'n': default: break; Index: src/games/hack/hack.mkobj.c diff -u src/games/hack/hack.mkobj.c:1.8 src/games/hack/hack.mkobj.c:1.9 --- src/games/hack/hack.mkobj.c:1.8 Wed Aug 12 07:28:41 2009 +++ src/games/hack/hack.mkobj.c Sun Aug 7 06:03:45 2011 @@ -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 <sys/cdefs.h> #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 @@ 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: Index: src/games/hack/hack.trap.c diff -u src/games/hack/hack.trap.c:1.9 src/games/hack/hack.trap.c:1.10 --- src/games/hack/hack.trap.c:1.9 Wed Aug 12 07:28:41 2009 +++ src/games/hack/hack.trap.c Sun Aug 7 06:03:45 2011 @@ -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 <sys/cdefs.h> #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 <stdlib.h> @@ -336,7 +336,7 @@ case TRAPDOOR: if (!xdnstair || u.ustuck) break; - /* fall into next case */ + /* FALLTHROUGH */ default: dotrap(trap); } Index: src/games/hack/hack.wizard.c diff -u src/games/hack/hack.wizard.c:1.9 src/games/hack/hack.wizard.c:1.10 --- src/games/hack/hack.wizard.c:1.9 Wed Aug 12 07:28:41 2009 +++ src/games/hack/hack.wizard.c Sun Aug 7 06:03:45 2011 @@ -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 <sys/cdefs.h> #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 @@ 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) /*