]> granicus.if.org Git - nethack/commitdiff
clear up some reported curses warnings
authornhmall <nhmall@nethack.org>
Sun, 6 Oct 2019 13:07:49 +0000 (09:07 -0400)
committernhmall <nhmall@nethack.org>
Sun, 6 Oct 2019 13:07:49 +0000 (09:07 -0400)
win/curses/cursdial.c
win/curses/cursinit.c
win/curses/cursmesg.c
win/curses/cursmisc.c
win/curses/cursstat.c

index 0df4921fb71e58ffe1d3de292eb9cb9a26eeede6..0dea1d26efb316610ea5c5eebcc6008b707a2e81 100644 (file)
@@ -392,6 +392,7 @@ curses_ext_cmd()
         extwin = newwin(1, w - 2, y0 + 1, x0 + 1);
         if (w - 4 < maxlen)
             maxlen = w - 4;
+        nhUse(h); /* needed only to give getmaxyx three arguments */
     } else {
         curses_get_window_xy(MESSAGE_WIN, &winx, &winy);
         curses_get_window_size(MESSAGE_WIN, &messageh, &messagew);
index de8730fb5ca700481df8fb82920e5e9dbe3a8809..594849ae275d3bb245c3b7a266980baeeffa0482 100644 (file)
@@ -462,7 +462,7 @@ curses_choose_character()
         tmpchoice[count] = toupper(tmpchoice[count]);
     }
 
-    sprintf(choice, "%s%s", choice, tmpchoice);
+    strcat(choice, tmpchoice);
 
     /* prevent an unnecessary prompt */
     rigid_role_checks();
index dfca0939724aa402c66c96b79c12028a2a9143e3..f55085c8a639ef527776e9f6ecab4dc2af00343e 100644 (file)
@@ -202,7 +202,7 @@ curses_block(boolean noscroll) /* noscroll - blocking because of msgtype
         prev_x = mx, prev_y = my;
         blink = 0;
     }
-    moreattr = !iflags.wc2_guicolor ? A_REVERSE : NONE;
+    moreattr = !iflags.wc2_guicolor ? (int) A_REVERSE : NONE;
     curses_toggle_color_attr(win, MORECOLOR, moreattr, ON);
     if (blink) {
         wattron(win, A_BLINK);
index 1eb42fa1e25caa014648b3da72f8fd3d94cab04d..80ff91c6598e95b72897017652a49e722e0e872a 100644 (file)
@@ -40,13 +40,18 @@ static int parse_escape_sequence(void);
 int
 curses_read_char()
 {
-    int ch, tmpch;
+    int ch;
+#if defined(ALT_0) || defined(ALT_9) || defined(ALT_A) || defined(ALT_Z)
+    int tmpch;
+#endif
 
     /* cancel message suppression; all messages have had a chance to be read */
     curses_got_input();
 
     ch = getch();
+#if defined(ALT_0) || defined(ALT_9) || defined(ALT_A) || defined(ALT_Z)
     tmpch = ch;
+#endif
     ch = curses_convert_keys(ch);
 
     if (ch == 0) {
@@ -372,7 +377,6 @@ curses_str_remainder(const char *str, int width, int line_num)
     int strsize = strlen(str) + 1;
 #if __STDC_VERSION__ >= 199901L
     char substr[strsize];
-    char curstr[strsize];
     char tmpstr[strsize];
 
     strcpy(substr, str);
@@ -381,7 +385,6 @@ curses_str_remainder(const char *str, int width, int line_num)
 #define BUFSZ 256
 #endif
     char substr[BUFSZ * 2];
-    char curstr[BUFSZ * 2];
     char tmpstr[BUFSZ * 2];
 
     if (strsize > (BUFSZ * 2) - 1) {
@@ -409,10 +412,6 @@ curses_str_remainder(const char *str, int width, int line_num)
         if (last_space == 0) {  /* No spaces found */
             last_space = count - 1;
         }
-        for (count = 0; count < last_space; count++) {
-            curstr[count] = substr[count];
-        }
-        curstr[count] = '\0';
         if (substr[count] == '\0') {
             break;
         }
index 664b9e31e46adf25e283104b112e2723d6c8d166..69f0f758cc465db3e4a7569a1dfbee0426439778 100644 (file)
@@ -228,6 +228,7 @@ draw_status()
             curs_reset_windows(TRUE, TRUE);
             win = curses_get_nhwin(STATUS_WIN);
         }
+        nhUse(ax);  /* getmaxyx macro isn't sufficient */
     }
 
     werase(win);
@@ -513,6 +514,7 @@ boolean border;
                        conditions would go if they were on this line */
                     condstart += (cap_and_hunger == 2) ? spacing[BL_CAP]
                                  : (cap_and_hunger == 0) ? 1 : 0;
+                    nhUse(conddummy);   /* getyx needed 3 args */
                 }
                 if (!(cap_and_hunger & 1))
                     continue;
@@ -533,6 +535,7 @@ boolean border;
                          t = (width - (border ? 0 : 1)) - (ex - 1);
                          ebuf[max(t, 2)] = '\0'; /* might still wrap... */
                      }
+                     nhUse(ey); /* getyx needed 3 args */
                 }
                 break;
             case BL_SCORE: