X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fncurses.c;h=fd1dcd3b35fe8f555be5b832e629c880074a8cbf;hp=f50530ab63723e9b134ede62433829412f34921b;hb=265e45e43e9917e8b9ecc2bf9d23867a3ede2ecd;hpb=1f7a36fe16b11bb4aab51be89bbc1b0f75936b78 diff --git a/test/ncurses.c b/test/ncurses.c index f50530ab..fd1dcd3b 100644 --- a/test/ncurses.c +++ b/test/ncurses.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2019,2020 Thomas E. Dickey * + * Copyright 2018-2020,2021 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -41,7 +41,7 @@ AUTHOR Author: Eric S. Raymond 1993 Thomas E. Dickey (beginning revision 1.27 in 1996). -$Id: ncurses.c,v 1.523 2020/08/29 16:22:03 juergen Exp $ +$Id: ncurses.c,v 1.526 2021/05/22 19:45:57 tom Exp $ ***************************************************************************/ @@ -166,7 +166,7 @@ static RGB_DATA *all_colors; #endif static void main_menu(bool); -static void failed(const char *s) GCC_NORETURN; +static GCC_NORETURN void failed(const char *s); static void failed(const char *s) @@ -855,7 +855,7 @@ wgetch_test(unsigned level, WINDOW *win, int delay) setup_getch(win, flags); wgetch_help(win, flags); } else if (c == 'g') { - waddstr(win, "getstr test: "); + waddstr(win, "wgetnstr test: "); echo(); c = wgetnstr(win, buf, sizeof(buf) - 1); noecho(); @@ -1113,7 +1113,7 @@ wget_wch_test(unsigned level, WINDOW *win, int delay) setup_getch(win, flags); wgetch_help(win, flags); } else if (c == 'g') { - waddstr(win, "getstr test: "); + waddstr(win, "wgetn_str test: "); echo(); code = wgetn_wstr(win, wint_buf, BUFSIZ - 1); noecho(); @@ -5531,7 +5531,7 @@ panner_legend(int line) "Number repeats. Toggle legend:? filler:a timer:t scrollmark:s." }; int n = ((int) SIZEOF(legend) - (LINES - line)); - if (n >= 0) { + if (n >= 0 && n < (int) SIZEOF(legend)) { if (move(line, 0) != ERR) { if (show_panner_legend) printw("%s", legend[n]); @@ -6232,7 +6232,7 @@ tracetrace(unsigned tlevel) } _nc_SPRINTF(buf, _nc_SLIMIT(need) "0x%02x = {", tlevel); if (tlevel == 0) { - _nc_STRCAT(buf, t_tbl[0].name, need); + _nc_STRCAT(buf, t_tbl[0].name ? t_tbl[0].name : "", need); _nc_STRCAT(buf, ", ", need); } else { for (n = 1; t_tbl[n].name != 0; n++) @@ -7618,8 +7618,10 @@ settings_test(bool recur GCC_UNUSED) #if HAVE_COLOR_CONTENT show_boolean_setting("can_change_color", can_change_color()); #endif - show_setting_name("LINES"); printw("%d\n", LINES); - show_setting_name("COLS"); printw("%d\n", COLS); + show_setting_name("LINES"); + printw("%d\n", LINES); + show_setting_name("COLS"); + printw("%d\n", COLS); Pause(); erase(); stop_curses(); @@ -7787,7 +7789,7 @@ main_menu(bool top) int (*doit) (bool); char command; - unsigned n; + unsigned n; do { printf("This is the ncurses main menu (uppercase for wide-characters)\n"); for (n = 0; n < SIZEOF(cmds); ++n) {