]> granicus.if.org Git - nethack/commitdiff
a couple of warnings
authornhmall <nhmall@nethack.org>
Sat, 13 Aug 2022 13:09:10 +0000 (09:09 -0400)
committernhmall <nhmall@nethack.org>
Sat, 13 Aug 2022 13:09:10 +0000 (09:09 -0400)
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
win/X11/winstat.c

index d9001b9b51eaf4c49e979291cf918c0470bfdaf2..7260c202812bc75aa74c879613ab4f3b13dedf6a 100644 (file)
@@ -1526,7 +1526,7 @@ getobj(
                        * between "you don't have anything to <foo>"
                        * versus "you don't have anything _else_ to <foo>"
                        * (also used for GETOBJ_EXCLUDE_NONINVENT) */
-    long cnt;
+    long cnt = 0L;
     boolean cntgiven = FALSE;
     boolean msggiven = FALSE;
     boolean oneloop = FALSE;
index 6baf30ff3e81027c6a5f06dd08062f1053ba06f5..778471b528282622800f770bafa5b109157fe5cc 100644 (file)
@@ -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;