From: nhmall Date: Sun, 6 Oct 2019 13:07:49 +0000 (-0400) Subject: clear up some reported curses warnings X-Git-Tag: v3.6.3.757eca7~44 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=193f8c39bd84f77555d4414ace84a2b210849765;p=nethack clear up some reported curses warnings --- diff --git a/win/curses/cursdial.c b/win/curses/cursdial.c index 0df4921fb..0dea1d26e 100644 --- a/win/curses/cursdial.c +++ b/win/curses/cursdial.c @@ -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); diff --git a/win/curses/cursinit.c b/win/curses/cursinit.c index de8730fb5..594849ae2 100644 --- a/win/curses/cursinit.c +++ b/win/curses/cursinit.c @@ -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(); diff --git a/win/curses/cursmesg.c b/win/curses/cursmesg.c index dfca09397..f55085c8a 100644 --- a/win/curses/cursmesg.c +++ b/win/curses/cursmesg.c @@ -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); diff --git a/win/curses/cursmisc.c b/win/curses/cursmisc.c index 1eb42fa1e..80ff91c65 100644 --- a/win/curses/cursmisc.c +++ b/win/curses/cursmisc.c @@ -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; } diff --git a/win/curses/cursstat.c b/win/curses/cursstat.c index 664b9e31e..69f0f758c 100644 --- a/win/curses/cursstat.c +++ b/win/curses/cursstat.c @@ -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: