From: Thomas E. Dickey Date: Sat, 10 Aug 2019 23:58:30 +0000 (+0000) Subject: ncurses 6.1 - patch 20190810 X-Git-Tag: v6.2~25 X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=commitdiff_plain;h=d76c9bfec68e0efa6e1b8e95b32b66caf25cfc12 ncurses 6.1 - patch 20190810 + fix a few more coverity warnings. --- diff --git a/NEWS b/NEWS index bae5f746..1f356c4b 100644 --- a/NEWS +++ b/NEWS @@ -25,7 +25,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: NEWS,v 1.3359 2019/08/03 22:31:47 tom Exp $ +-- $Id: NEWS,v 1.3361 2019/08/10 19:05:52 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -45,6 +45,9 @@ See the AUTHORS file for the corresponding full names. Changes through 1.9.9e did not credit all contributions; it is not possible to add this information. +20190810 + + fix a few more coverity warnings. + 20190803 + improve loop limits in _nc_scroll_window() to handle a case where the scrolled data is a pad which is taller than the window (patch diff --git a/VERSION b/VERSION index ffb0171e..f1fe46df 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5:0:10 6.1 20190803 +5:0:10 6.1 20190810 diff --git a/dist.mk b/dist.mk index 9cce7f56..bc0ff985 100644 --- a/dist.mk +++ b/dist.mk @@ -25,7 +25,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: dist.mk,v 1.1299 2019/08/03 13:57:42 tom Exp $ +# $Id: dist.mk,v 1.1300 2019/08/10 12:52:53 tom Exp $ # Makefile for creating ncurses distributions. # # This only needs to be used directly as a makefile by developers, but @@ -37,7 +37,7 @@ SHELL = /bin/sh # These define the major/minor/patch versions of ncurses. NCURSES_MAJOR = 6 NCURSES_MINOR = 1 -NCURSES_PATCH = 20190803 +NCURSES_PATCH = 20190810 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/ncurses/base/lib_mouse.c b/ncurses/base/lib_mouse.c index 891b7d55..34723f08 100644 --- a/ncurses/base/lib_mouse.c +++ b/ncurses/base/lib_mouse.c @@ -84,7 +84,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_mouse.c,v 1.182 2019/07/20 20:42:43 tom Exp $") +MODULE_ID("$Id: lib_mouse.c,v 1.183 2019/08/10 17:11:50 tom Exp $") #include @@ -438,7 +438,7 @@ allow_gpm_mouse(SCREEN *sp GCC_UNUSED) #if USE_WEAK_SYMBOLS /* Danger Robinson: do not use dlopen for libgpm if already loaded */ - if ((Gpm_Wgetch)) { + if ((Gpm_Wgetch) != 0) { if (!sp->_mouse_gpm_loaded) { T(("GPM library was already dlopen'd, not by us")); } diff --git a/ncurses/tinfo/lib_setup.c b/ncurses/tinfo/lib_setup.c index 04acfb49..b1d1e1ae 100644 --- a/ncurses/tinfo/lib_setup.c +++ b/ncurses/tinfo/lib_setup.c @@ -48,7 +48,7 @@ #include #endif -MODULE_ID("$Id: lib_setup.c,v 1.202 2019/07/28 19:33:40 tom Exp $") +MODULE_ID("$Id: lib_setup.c,v 1.204 2019/08/10 17:08:00 tom Exp $") /**************************************************************************** * @@ -446,23 +446,24 @@ _nc_update_screensize(SCREEN *sp) int old_cols = columns; #endif - TINFO_GET_SIZE(sp, sp->_term, &new_lines, &new_cols); - - /* - * See is_term_resized() and resizeterm(). - * We're doing it this way because those functions belong to the upper - * ncurses library, while this resides in the lower terminfo library. - */ - if (sp != 0 && sp->_resize != 0) { - if ((new_lines != old_lines) || (new_cols != old_cols)) { - sp->_resize(NCURSES_SP_ARGx new_lines, new_cols); - } else if (sp->_sig_winch && (sp->_ungetch != 0)) { - sp->_ungetch(SP_PARM, KEY_RESIZE); /* so application can know this */ + if (sp != 0) { + TINFO_GET_SIZE(sp, sp->_term, &new_lines, &new_cols); + /* + * See is_term_resized() and resizeterm(). + * We're doing it this way because those functions belong to the upper + * ncurses library, while this resides in the lower terminfo library. + */ + if (sp->_resize != 0) { + if ((new_lines != old_lines) || (new_cols != old_cols)) { + sp->_resize(NCURSES_SP_ARGx new_lines, new_cols); + } else if (sp->_sig_winch && (sp->_ungetch != 0)) { + sp->_ungetch(SP_PARM, KEY_RESIZE); /* so application can know this */ + } + sp->_sig_winch = FALSE; } - sp->_sig_winch = FALSE; } } -#endif +#endif /* USE_SIZECHANGE */ /**************************************************************************** * @@ -776,6 +777,8 @@ TINFO_SETUP_TERM(TERMINAL **tp, } else if (status == TGETENT_NO) { ret_error1(status, "unknown terminal type.\n", myname, free(myname)); + } else { + ret_error0(status, "unexpected return-code\n"); } } #if NCURSES_EXT_NUMBERS diff --git a/ncurses/tinfo/tinfo_driver.c b/ncurses/tinfo/tinfo_driver.c index 9b6dbb72..450cded0 100644 --- a/ncurses/tinfo/tinfo_driver.c +++ b/ncurses/tinfo/tinfo_driver.c @@ -51,7 +51,7 @@ # endif #endif -MODULE_ID("$Id: tinfo_driver.c,v 1.64 2019/07/28 18:43:09 tom Exp $") +MODULE_ID("$Id: tinfo_driver.c,v 1.66 2019/08/10 18:36:08 tom Exp $") /* * SCO defines TIOCGSIZE and the corresponding struct. Other systems (SunOS, @@ -188,6 +188,8 @@ drv_CanHandle(TERMINAL_CONTROL_BLOCK * TCB, const char *tname, int *errret) } else if (status == TGETENT_NO) { ret_error1(status, "unknown terminal type.\n", tname, NO_COPY); + } else { + ret_error0(status, "unexpected return-code\n"); } } result = TRUE; @@ -1340,23 +1342,29 @@ drv_keyok(TERMINAL_CONTROL_BLOCK * TCB, int c, int flag) unsigned ch = (unsigned) c; if (flag) { while ((s = _nc_expand_try(sp->_key_ok, - ch, &count, (size_t) 0)) != 0 - && _nc_remove_key(&(sp->_key_ok), ch)) { - code = _nc_add_to_try(&(sp->_keytry), s, ch); - free(s); - count = 0; - if (code != OK) - break; + ch, &count, (size_t) 0)) != 0) { + if (_nc_remove_key(&(sp->_key_ok), ch)) { + code = _nc_add_to_try(&(sp->_keytry), s, ch); + free(s); + count = 0; + if (code != OK) + break; + } else { + free(s); + } } } else { while ((s = _nc_expand_try(sp->_keytry, - ch, &count, (size_t) 0)) != 0 - && _nc_remove_key(&(sp->_keytry), ch)) { - code = _nc_add_to_try(&(sp->_key_ok), s, ch); - free(s); - count = 0; - if (code != OK) - break; + ch, &count, (size_t) 0)) != 0) { + if (_nc_remove_key(&(sp->_keytry), ch)) { + code = _nc_add_to_try(&(sp->_key_ok), s, ch); + free(s); + count = 0; + if (code != OK) + break; + } else { + free(s); + } } } } diff --git a/package/debian-mingw/changelog b/package/debian-mingw/changelog index 7ec38ab1..f035c112 100644 --- a/package/debian-mingw/changelog +++ b/package/debian-mingw/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.1+20190803) unstable; urgency=low +ncurses6 (6.1+20190810) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 03 Aug 2019 09:57:42 -0400 + -- Thomas E. Dickey Sat, 10 Aug 2019 08:52:53 -0400 ncurses6 (5.9-20131005) unstable; urgency=low diff --git a/package/debian-mingw64/changelog b/package/debian-mingw64/changelog index 7ec38ab1..f035c112 100644 --- a/package/debian-mingw64/changelog +++ b/package/debian-mingw64/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.1+20190803) unstable; urgency=low +ncurses6 (6.1+20190810) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 03 Aug 2019 09:57:42 -0400 + -- Thomas E. Dickey Sat, 10 Aug 2019 08:52:53 -0400 ncurses6 (5.9-20131005) unstable; urgency=low diff --git a/package/debian/changelog b/package/debian/changelog index 052c1249..3edff2eb 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.1+20190803) unstable; urgency=low +ncurses6 (6.1+20190810) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 03 Aug 2019 09:57:42 -0400 + -- Thomas E. Dickey Sat, 10 Aug 2019 08:52:53 -0400 ncurses6 (5.9-20120608) unstable; urgency=low diff --git a/package/mingw-ncurses.nsi b/package/mingw-ncurses.nsi index ac42149f..41acfea1 100644 --- a/package/mingw-ncurses.nsi +++ b/package/mingw-ncurses.nsi @@ -1,4 +1,4 @@ -; $Id: mingw-ncurses.nsi,v 1.345 2019/08/03 13:57:42 tom Exp $ +; $Id: mingw-ncurses.nsi,v 1.346 2019/08/10 12:52:53 tom Exp $ ; TODO add examples ; TODO bump ABI to 6 @@ -10,7 +10,7 @@ !define VERSION_MAJOR "6" !define VERSION_MINOR "1" !define VERSION_YYYY "2019" -!define VERSION_MMDD "0803" +!define VERSION_MMDD "0810" !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD} !define MY_ABI "5" diff --git a/package/mingw-ncurses.spec b/package/mingw-ncurses.spec index 165a4d61..1181f382 100644 --- a/package/mingw-ncurses.spec +++ b/package/mingw-ncurses.spec @@ -3,7 +3,7 @@ Summary: shared libraries for terminal handling Name: mingw32-ncurses6 Version: 6.1 -Release: 20190803 +Release: 20190810 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/package/ncurses.spec b/package/ncurses.spec index 935b16d1..2fc4434e 100644 --- a/package/ncurses.spec +++ b/package/ncurses.spec @@ -1,7 +1,7 @@ Summary: shared libraries for terminal handling Name: ncurses6 Version: 6.1 -Release: 20190803 +Release: 20190810 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/package/ncursest.spec b/package/ncursest.spec index 6b6df00b..51ad7103 100644 --- a/package/ncursest.spec +++ b/package/ncursest.spec @@ -1,7 +1,7 @@ Summary: Curses library with POSIX thread support. Name: ncursest6 Version: 6.1 -Release: 20190803 +Release: 20190810 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/test/demo_menus.c b/test/demo_menus.c index 5673deff..844afa7e 100644 --- a/test/demo_menus.c +++ b/test/demo_menus.c @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: demo_menus.c,v 1.66 2019/04/06 20:42:48 tom Exp $ + * $Id: demo_menus.c,v 1.67 2019/08/10 19:25:27 tom Exp $ * * Demonstrate a variety of functions from the menu library. * Thomas Dickey - 2005/4/9 @@ -110,6 +110,8 @@ static WINDOW *status; static bool loaded_file = FALSE; static char empty[1]; + +#ifdef TRACE static void failed(const char *s) GCC_NORETURN; static void @@ -119,6 +121,7 @@ failed(const char *s) endwin(); ExitProgram(EXIT_FAILURE); } +#endif /* Common function to allow ^T to toggle trace-mode in the middle of a test * so that trace-files can be made smaller. diff --git a/test/ncurses.c b/test/ncurses.c index 9088f96f..ce72252a 100644 --- a/test/ncurses.c +++ b/test/ncurses.c @@ -40,7 +40,7 @@ AUTHOR Author: Eric S. Raymond 1993 Thomas E. Dickey (beginning revision 1.27 in 1996). -$Id: ncurses.c,v 1.515 2019/04/20 20:34:11 tom Exp $ +$Id: ncurses.c,v 1.516 2019/08/10 19:38:41 tom Exp $ ***************************************************************************/ @@ -7876,11 +7876,15 @@ main(int argc, char *argv[]) { int c; int my_e_param = 1; +#ifdef NCURSES_VERSION_PATCH #if HAVE_USE_DEFAULT_COLORS int default_fg = COLOR_WHITE; int default_bg = COLOR_BLACK; - bool assumed_colors = FALSE; bool default_colors = FALSE; +#if HAVE_ASSUME_DEFAULT_COLORS + bool assumed_colors = FALSE; +#endif +#endif #endif bool monochrome = FALSE; #if HAVE_COLOR_CONTENT @@ -7892,7 +7896,9 @@ main(int argc, char *argv[]) while ((c = getopt(argc, argv, "a:dEe:fhmp:s:Tt:x")) != -1) { switch (c) { +#ifdef NCURSES_VERSION_PATCH #if HAVE_USE_DEFAULT_COLORS +#if HAVE_ASSUME_DEFAULT_COLORS case 'a': assumed_colors = TRUE; switch (sscanf(optarg, "%d,%d", &default_fg, &default_bg)) { @@ -7904,10 +7910,12 @@ main(int argc, char *argv[]) break; } break; +#endif case 'd': default_colors = TRUE; break; #endif +#endif #if HAVE_USE_ENV case 'E': use_env(FALSE);