From c0d636fe32133bd702b7fdacda99a6669360c2ea Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 13 Aug 2022 09:09:10 -0400 Subject: [PATCH] a couple of warnings invent.c: In function 'getobj': invent.c:1579:29: warning: 'cnt' may be used uninitialized [-Wmaybe-uninitialized] 1579 | if (cnt < 1 || otmp->quan <= cnt) | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~ invent.c:1529:10: note: 'cnt' was declared here 1529 | long cnt; | ^~~ ../win/X11/winstat.c: In function 'update_fancy_status_field': ../win/X11/winstat.c:1920:28: warning: declaration of 'active' shadows a global declaration [-Wshadow] 1920 | static boolean active = FALSE; | ^~~~~~ In file included from ../include/hack.h:196, from ../win/X11/winstat.c:36: ../include/wintype.h:180:5: note: shadowed declaration is here 180 | active = 0x001, | ^~~~~~ --- src/invent.c | 2 +- win/X11/winstat.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/invent.c b/src/invent.c index d9001b9b5..7260c2028 100644 --- a/src/invent.c +++ b/src/invent.c @@ -1526,7 +1526,7 @@ getobj( * between "you don't have anything to " * versus "you don't have anything _else_ to " * (also used for GETOBJ_EXCLUDE_NONINVENT) */ - long cnt; + long cnt = 0L; boolean cntgiven = FALSE; boolean msggiven = FALSE; boolean oneloop = FALSE; diff --git a/win/X11/winstat.c b/win/X11/winstat.c index 6baf30ff3..778471b52 100644 --- a/win/X11/winstat.c +++ b/win/X11/winstat.c @@ -1917,12 +1917,12 @@ update_fancy_status_field(int i, int color, int attributes) * * Break out with this. */ - static boolean active = FALSE; + static boolean isactive = FALSE; - if (!active) { - active = TRUE; + if (!isactive) { + isactive = TRUE; impossible("update_other: unknown shown value"); - active = FALSE; + isactive = FALSE; } val = 0L; break;