diff --git a/win/curses/cursdial.c b/win/curses/cursdial.c index 41d8e9ffa..a6e3d3a3e 100644 --- a/win/curses/cursdial.c +++ b/win/curses/cursdial.c @@ -87,17 +87,10 @@ curses_line_input_dialog(const char *prompt, char *answer, int buffer) int prompt_width = strlen(prompt) + buffer + 1; int prompt_height = 1; int height = prompt_height; -#if __STDC_VERSION__ >= 199901L - char input[buffer]; -#else -#ifndef BUFSZ -#define BUFSZ 256 -#endif char input[BUFSZ]; - buffer = BUFSZ - 1; -#endif - + if (buffer >= (int) sizeof input) + buffer = (int) sizeof input - 1; maxwidth = term_cols - 2; if (iflags.window_inited) { @@ -164,7 +157,9 @@ curses_character_input_dialog(const char *prompt, const char *choices, CHAR_P def) { WINDOW *askwin = NULL; +#ifdef PDCURSES WINDOW *message_window; +#endif int answer, count, maxwidth, map_height, map_width; char *linestr; char askstr[BUFSZ + QBUFSZ]; @@ -518,8 +513,8 @@ curses_add_nhmenu_item(winid wid, int glyph, const ANY_P * identifier, nhmenu *current_menu = get_menu(wid); if (current_menu == NULL) { - impossible - ("curses_add_nhmenu_item: attempt to add item to nonexistent menu"); + impossible( + "curses_add_nhmenu_item: attempt to add item to nonexistent menu"); return; } @@ -568,21 +563,19 @@ void curses_finalize_nhmenu(winid wid, const char *prompt) { int count = 0; + nhmenu_item *menu_item_ptr; nhmenu *current_menu = get_menu(wid); if (current_menu == NULL) { - impossible("curses_finalize_nhmenu: attempt to finalize nonexistent menu"); + impossible( + "curses_finalize_nhmenu: attempt to finalize nonexistent menu"); return; } - - nhmenu_item *menu_item_ptr = current_menu->entries; - while (menu_item_ptr != NULL) { - menu_item_ptr = menu_item_ptr->next_item; + for (menu_item_ptr = current_menu->entries; + menu_item_ptr != NULL; menu_item_ptr = menu_item_ptr->next_item) count++; - } current_menu->num_entries = count; - current_menu->prompt = curses_copy_of(prompt); } @@ -601,7 +594,8 @@ curses_display_nhmenu(winid wid, int how, MENU_ITEM_P ** _selected) *_selected = NULL; if (current_menu == NULL) { - impossible("curses_display_nhmenu: attempt to display nonexistent menu"); + impossible( + "curses_display_nhmenu: attempt to display nonexistent menu"); return '\033'; } @@ -1021,7 +1015,7 @@ menu_display_page(nhmenu *menu, WINDOW * win, int page_num) start_col += 4; } #if 0 - //FIXME: menuglyphs not implemented yet + /* FIXME: menuglyphs not implemented yet */ if (menu_item_ptr->glyph != NO_GLYPH && iflags.use_menu_glyphs) { unsigned special; /*notused */ diff --git a/win/curses/cursinvt.c b/win/curses/cursinvt.c index ebf04a4f4..c88889355 100644 --- a/win/curses/cursinvt.c +++ b/win/curses/cursinvt.c @@ -62,14 +62,15 @@ curses_update_inv(void) /* Adds an inventory item. */ void -curses_add_inv(int y, int glyph, CHAR_P accelerator, attr_t attr, - const char *str) +curses_add_inv(int y, + int glyph UNUSED, + CHAR_P accelerator, attr_t attr, const char *str) { WINDOW *win = curses_get_nhwin(INV_WIN); int color = NO_COLOR; + int x = 0; /* Figure out where to draw the line */ - int x = 0; if (curses_window_has_border(INV_WIN)) { x++; y++; @@ -78,6 +79,7 @@ curses_add_inv(int y, int glyph, CHAR_P accelerator, attr_t attr, wmove(win, y, x); if (accelerator) { attr_t bold = A_BOLD; + wattron(win, bold); waddch(win, accelerator); wattroff(win, bold); @@ -88,17 +90,20 @@ curses_add_inv(int y, int glyph, CHAR_P accelerator, attr_t attr, unsigned dummy = 0; /* Not used */ int color = 0; int symbol = 0; + attr_t glyphclr; + mapglyph(glyph, &symbol, &color, &dummy, u.ux, u.uy); - attr_t glyphclr = curses_color_attr(color, 0); + glyphclr = curses_color_attr(color, 0); wattron(win, glyphclr); wprintw(win, "%c ", symbol); wattroff(win, glyphclr); } #endif - if (accelerator && /* Don't colorize categories */ - iflags.use_menu_color) { + if (accelerator /* Don't colorize categories */ + && iflags.use_menu_color) { char str_mutable[BUFSZ]; + Strcpy(str_mutable, str); attr = 0; get_menu_coloring(str_mutable, &color, (int *) &attr); diff --git a/win/curses/cursmain.c b/win/curses/cursmain.c index f2ab82542..72dbc78b8 100644 --- a/win/curses/cursmain.c +++ b/win/curses/cursmain.c @@ -14,14 +14,14 @@ /* Interface definition, for windows.c */ struct window_procs curses_procs = { "curses", - WC_ALIGN_MESSAGE | WC_ALIGN_STATUS | WC_COLOR | WC_HILITE_PET | - WC_PERM_INVENT | WC_POPUP_DIALOG | WC_SPLASH_SCREEN, - WC2_DARKGRAY | WC2_HITPOINTBAR | + (WC_ALIGN_MESSAGE | WC_ALIGN_STATUS | WC_COLOR | WC_HILITE_PET + | WC_PERM_INVENT | WC_POPUP_DIALOG | WC_SPLASH_SCREEN), + (WC2_DARKGRAY | WC2_HITPOINTBAR #if defined(STATUS_HILITES) - WC2_HILITE_STATUS | + | WC2_HILITE_STATUS #endif - WC2_HITPOINTBAR | WC2_FLUSH_STATUS | - WC2_TERM_SIZE | WC2_WINDOWBORDERS | WC2_PETATTR | WC2_GUICOLOR, + | WC2_HITPOINTBAR | WC2_FLUSH_STATUS + | WC2_TERM_SIZE | WC2_WINDOWBORDERS | WC2_PETATTR | WC2_GUICOLOR), curses_init_nhwindows, curses_player_selection, curses_askname, @@ -110,7 +110,8 @@ init_nhwindows(int* argcp, char** argv) ** windows? Or at least all but WIN_INFO? -dean */ void -curses_init_nhwindows(int *argcp, char **argv) +curses_init_nhwindows(int *argcp UNUSED, + char **argv UNUSED) { #ifdef PDCURSES char window_title[BUFSZ]; @@ -249,7 +250,7 @@ curses_exit_nhwindows(const char *str) /* Prepare the window to be suspended. */ void -curses_suspend_nhwindows(const char *str) +curses_suspend_nhwindows(const char *str UNUSED) { endwin(); } @@ -575,7 +576,8 @@ print_glyph(window, x, y, glyph, bkglyph) It's not used here. */ void -curses_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph, int bkglyph) +curses_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph, + int bkglyph UNUSED) { int ch; int color; @@ -767,8 +769,9 @@ number_pad(state) -- Initialize the number pad to the given state. */ void -curses_number_pad(int state) +curses_number_pad(int state UNUSED) { + return; } /* @@ -812,8 +815,10 @@ outrip(winid, int) genl_outrip for the value and check the #if in rip.c. */ void -curses_outrip(winid wid, int how) +curses_outrip(winid wid UNUSED, + int how UNUSED) { + return; } /* diff --git a/win/curses/cursmesg.c b/win/curses/cursmesg.c index 98e3677d1..fd8c9a875 100644 --- a/win/curses/cursmesg.c +++ b/win/curses/cursmesg.c @@ -143,8 +143,7 @@ curses_block(boolean noscroll) { int height, width, ret = 0; WINDOW *win = curses_get_nhwin(MESSAGE_WIN); - char *resp = " \r\n\033"; /* space, enter, esc */ - + const char *resp = " \r\n\033"; /* space, enter, esc */ curses_get_window_size(MESSAGE_WIN, &height, &width); curses_toggle_color_attr(win, MORECOLOR, NONE, ON); @@ -154,7 +153,8 @@ curses_block(boolean noscroll) /* msgtype=stop should require space/enter rather than * just any key, as we want to prevent YASD from * riding direction keys. */ - while ((ret = wgetch(win)) && !index(resp,(char)ret)); + while ((ret = wgetch(win)) != 0 && !index(resp, (char) ret)) + continue; if (height == 1) { curses_clear_unhighlight_message_window(); } else {