From: Thomas E. Dickey Date: Sun, 25 Nov 2012 02:13:01 +0000 (+0000) Subject: ncurses 5.9 - patch 20121124 X-Git-Tag: v6.0~127 X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=commitdiff_plain;h=8554ac8f8bb70116fbc962f529168d273e950e2b;hp=98d8891f42d8acac5c2ade39d163f386057a22e4 ncurses 5.9 - patch 20121124 + correct order of color initialization versus display in some of the test-programs, e.g., test_addstr.c > fixes based on Coverity report: + delete windows on exit from some of the test-programs. --- diff --git a/NEWS b/NEWS index 5245e26b..c81d27e8 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.1974 2012/11/18 02:16:21 tom Exp $ +-- $Id: NEWS,v 1.1976 2012/11/24 20:02:52 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -45,6 +45,12 @@ 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. +20121124 + + correct order of color initialization versus display in some of the + test-programs, e.g., test_addstr.c + > fixes based on Coverity report: + + delete windows on exit from some of the test-programs. + 20121117 > fixes based on Coverity report: + add missing braces around FreeAndNull in two places. diff --git a/dist.mk b/dist.mk index 66aecea0..2a8ff69f 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.901 2012/11/17 16:48:42 tom Exp $ +# $Id: dist.mk,v 1.902 2012/11/24 17:11:44 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 = 5 NCURSES_MINOR = 9 -NCURSES_PATCH = 20121117 +NCURSES_PATCH = 20121124 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/ncurses/tinfo/captoinfo.c b/ncurses/tinfo/captoinfo.c index b768a498..db46e209 100644 --- a/ncurses/tinfo/captoinfo.c +++ b/ncurses/tinfo/captoinfo.c @@ -93,7 +93,7 @@ #include #include -MODULE_ID("$Id: captoinfo.c,v 1.73 2012/10/27 21:27:02 tom Exp $") +MODULE_ID("$Id: captoinfo.c,v 1.75 2012/11/24 20:48:54 tom Exp $") #define MAX_PUSHED 16 /* max # args we can push onto the stack */ @@ -704,7 +704,8 @@ _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parameteriz && ((in0 == 4 && in1 == 10 && in2 == 48) || (in0 == 3 && in1 == 9 && in2 == 38))) { /* dumb-down an optimized case from xterm-256color for termcap */ - str = strstr(str, ";m"); + if ((str = strstr(str, ";m")) == 0) + break; /* cannot happen */ ++str; if (in2 == 48) { bufptr = save_string(bufptr, "[48;5;%dm"); @@ -846,7 +847,7 @@ _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parameteriz * but that may not be the end of the string. */ assert(str != 0); - if (*str == '\0') + if (str == 0 || *str == '\0') break; } /* endwhile (*str) */ diff --git a/package/debian/changelog b/package/debian/changelog index 2fb230dc..894518d1 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,8 +1,8 @@ -ncurses6 (5.9-20121117) unstable; urgency=low +ncurses6 (5.9-20121124) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 17 Nov 2012 11:58:08 -0500 + -- Thomas E. Dickey Sat, 24 Nov 2012 12:13:21 -0500 ncurses6 (5.9-20120608) unstable; urgency=low diff --git a/package/ncurses.spec b/package/ncurses.spec index d7b6901b..dbbf12d8 100644 --- a/package/ncurses.spec +++ b/package/ncurses.spec @@ -1,7 +1,7 @@ Summary: shared libraries for terminal handling Name: ncurses6 Release: 5.9 -Version: 20121117 +Version: 20121124 License: X11 Group: Development/Libraries Source: ncurses-%{release}-%{version}.tgz diff --git a/test/ditto.c b/test/ditto.c index 36644f12..921f216b 100644 --- a/test/ditto.c +++ b/test/ditto.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * + * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,7 +29,7 @@ /* * Author: Thomas E. Dickey (1998-on) * - * $Id: ditto.c,v 1.41 2011/05/21 18:55:07 tom Exp $ + * $Id: ditto.c,v 1.42 2012/11/24 20:16:18 tom Exp $ * * The program illustrates how to set up multiple screens from a single * program. @@ -80,6 +80,7 @@ typedef struct { int which1; /* this screen's index in DITTO[] array */ int length; /* length of windows[] and peeks[] */ char **titles; /* per-window titles */ + WINDOW **parents; /* display boxes around each screen's data */ WINDOW **windows; /* display data from each screen */ PEEK *peeks; /* indices for each screen's fifo */ FIFO fifo; /* fifo for this screen */ @@ -204,6 +205,7 @@ init_screen( scrollok(stdscr, TRUE); box(stdscr, 0, 0); + target->parents = typeCalloc(WINDOW *, (size_t) target->length); target->windows = typeCalloc(WINDOW *, (size_t) target->length); target->peeks = typeCalloc(PEEK, (size_t) target->length); @@ -223,6 +225,7 @@ init_screen( nodelay(inner, TRUE); #endif + target->parents[k] = outer; target->windows[k] = inner; } doupdate(); diff --git a/test/ins_wide.c b/test/ins_wide.c index 38ffd763..07af7eda 100644 --- a/test/ins_wide.c +++ b/test/ins_wide.c @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: ins_wide.c,v 1.17 2012/06/09 20:29:33 tom Exp $ + * $Id: ins_wide.c,v 1.18 2012/11/24 19:57:17 tom Exp $ * * Demonstrate the wins_wstr() and wins_wch functions. * Thomas Dickey - 2002/11/23 @@ -242,6 +242,15 @@ test_inserts(int level) (void) cbreak(); /* take input chars one at a time, no wait for \n */ (void) noecho(); /* don't echo input */ keypad(stdscr, TRUE); + + /* + * Show the characters inserted in color, to distinguish from those + * that are shifted. + */ + if (has_colors()) { + start_color(); + init_pair(1, COLOR_WHITE, COLOR_BLUE); + } } limit = LINES - 5; @@ -275,13 +284,7 @@ test_inserts(int level) doupdate(); - /* - * Show the characters inserted in color, to distinguish from those that - * are shifted. - */ if (has_colors()) { - start_color(); - init_pair(1, COLOR_WHITE, COLOR_BLUE); wbkgdset(work, (chtype) (COLOR_PAIR(1) | ' ')); } diff --git a/test/inserts.c b/test/inserts.c index 56b8ebe4..b858668a 100644 --- a/test/inserts.c +++ b/test/inserts.c @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: inserts.c,v 1.24 2012/06/09 20:29:33 tom Exp $ + * $Id: inserts.c,v 1.25 2012/11/24 19:57:17 tom Exp $ * * Demonstrate the winsstr() and winsch functions. * Thomas Dickey - 2002/10/19 @@ -167,6 +167,15 @@ test_inserts(int level) (void) cbreak(); /* take input chars one at a time, no wait for \n */ (void) noecho(); /* don't echo input */ keypad(stdscr, TRUE); + + /* + * Show the characters inserted in color, to distinguish from those + * that are shifted. + */ + if (has_colors()) { + start_color(); + init_pair(1, COLOR_WHITE, COLOR_BLUE); + } } limit = LINES - 5; @@ -200,13 +209,7 @@ test_inserts(int level) doupdate(); - /* - * Show the characters inserted in color, to distinguish from those that - * are shifted. - */ if (has_colors()) { - start_color(); - init_pair(1, COLOR_WHITE, COLOR_BLUE); wbkgdset(work, (chtype) (COLOR_PAIR(1) | ' ')); } diff --git a/test/test_add_wchstr.c b/test/test_add_wchstr.c index 1bca8955..6b1b2d7a 100644 --- a/test/test_add_wchstr.c +++ b/test/test_add_wchstr.c @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: test_add_wchstr.c,v 1.17 2012/10/27 19:37:30 tom Exp $ + * $Id: test_add_wchstr.c,v 1.19 2012/11/24 20:04:13 tom Exp $ * * Demonstrate the waddwchstr() and wadd_wch functions. * Thomas Dickey - 2009/9/12 @@ -319,6 +319,15 @@ test_add_wchstr(int level) (void) cbreak(); /* take input chars one at a time, no wait for \n */ (void) noecho(); /* don't echo input */ keypad(stdscr, TRUE); + + /* + * Show the characters added in color, to distinguish from those that + * are shifted. + */ + if (has_colors()) { + start_color(); + init_pair(1, COLOR_WHITE, COLOR_BLUE); + } } limit = LINES - 5; @@ -352,13 +361,7 @@ test_add_wchstr(int level) doupdate(); - /* - * Show the characters added in color, to distinguish from those that - * are shifted. - */ if (has_colors()) { - start_color(); - init_pair(1, COLOR_WHITE, COLOR_BLUE); wbkgdset(work, (chtype) (COLOR_PAIR(1) | ' ')); } @@ -516,8 +519,8 @@ test_add_wchstr(int level) break; } } + delwin(show); if (level > 0) { - delwin(show); delwin(work); delwin(look); } diff --git a/test/test_addchstr.c b/test/test_addchstr.c index 6b4093e7..cc3dc497 100644 --- a/test/test_addchstr.c +++ b/test/test_addchstr.c @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: test_addchstr.c,v 1.15 2012/10/27 19:31:42 tom Exp $ + * $Id: test_addchstr.c,v 1.16 2012/11/24 19:51:05 tom Exp $ * * Demonstrate the waddchstr() and waddch functions. * Thomas Dickey - 2009/9/12 @@ -239,6 +239,15 @@ test_adds(int level) (void) cbreak(); /* take input chars one at a time, no wait for \n */ (void) noecho(); /* don't echo input */ keypad(stdscr, TRUE); + + /* + * Show the characters added in color, to distinguish from those that + * are shifted. + */ + if (has_colors()) { + start_color(); + init_pair(1, COLOR_WHITE, COLOR_BLUE); + } } limit = LINES - 5; @@ -272,13 +281,7 @@ test_adds(int level) doupdate(); - /* - * Show the characters added in color, to distinguish from those that - * are shifted. - */ if (has_colors()) { - start_color(); - init_pair(1, COLOR_WHITE, COLOR_BLUE); show_attr = (attr_t) COLOR_PAIR(1); wbkgdset(work, show_attr | ' '); } else { diff --git a/test/test_addstr.c b/test/test_addstr.c index d67146e7..a6876a89 100644 --- a/test/test_addstr.c +++ b/test/test_addstr.c @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: test_addstr.c,v 1.7 2012/06/09 20:29:33 tom Exp $ + * $Id: test_addstr.c,v 1.9 2012/11/24 19:49:02 tom Exp $ * * Demonstrate the waddstr() and waddch functions. * Thomas Dickey - 2009/9/12 @@ -161,6 +161,15 @@ test_adds(int level) (void) cbreak(); /* take input chars one at a time, no wait for \n */ (void) noecho(); /* don't echo input */ keypad(stdscr, TRUE); + + /* + * Show the characters added in color, to distinguish from those that + * are shifted. + */ + if (has_colors()) { + start_color(); + init_pair(1, COLOR_WHITE, COLOR_BLUE); + } } limit = LINES - 5; @@ -194,13 +203,7 @@ test_adds(int level) doupdate(); - /* - * Show the characters added in color, to distinguish from those that - * are shifted. - */ if (has_colors()) { - start_color(); - init_pair(1, COLOR_WHITE, COLOR_BLUE); wbkgdset(work, (chtype) (COLOR_PAIR(1) | ' ')); } @@ -361,8 +364,8 @@ test_adds(int level) break; } } + delwin(show); if (level > 0) { - delwin(show); delwin(work); delwin(look); } diff --git a/test/test_addwstr.c b/test/test_addwstr.c index 9a4ee155..e369b667 100644 --- a/test/test_addwstr.c +++ b/test/test_addwstr.c @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: test_addwstr.c,v 1.8 2012/06/09 20:29:33 tom Exp $ + * $Id: test_addwstr.c,v 1.10 2012/11/24 20:04:54 tom Exp $ * * Demonstrate the waddwstr() and wadd_wch functions. * Thomas Dickey - 2009/9/12 @@ -247,6 +247,15 @@ test_inserts(int level) (void) cbreak(); /* take input chars one at a time, no wait for \n */ (void) noecho(); /* don't echo input */ keypad(stdscr, TRUE); + + /* + * Show the characters inserted in color, to distinguish from those that + * are shifted. + */ + if (has_colors()) { + start_color(); + init_pair(1, COLOR_WHITE, COLOR_BLUE); + } } limit = LINES - 5; @@ -280,13 +289,7 @@ test_inserts(int level) doupdate(); - /* - * Show the characters inserted in color, to distinguish from those that - * are shifted. - */ if (has_colors()) { - start_color(); - init_pair(1, COLOR_WHITE, COLOR_BLUE); wbkgdset(work, (chtype) (COLOR_PAIR(1) | ' ')); } @@ -446,8 +449,8 @@ test_inserts(int level) break; } } + delwin(show); if (level > 0) { - delwin(show); delwin(work); delwin(look); } diff --git a/test/testcurs.c b/test/testcurs.c index 06d70d84..8310f3f8 100644 --- a/test/testcurs.c +++ b/test/testcurs.c @@ -6,7 +6,7 @@ * wrs(5/28/93) -- modified to be consistent (perform identically) with either * PDCurses or under Unix System V, R4 * - * $Id: testcurs.c,v 1.45 2012/11/03 19:27:18 tom Exp $ + * $Id: testcurs.c,v 1.46 2012/11/24 19:38:20 tom Exp $ */ #include @@ -681,9 +681,11 @@ padTest(WINDOW *dummy GCC_UNUSED) raw(); wgetch(pad); - spad = subpad(pad, 12, 25, 6, 52); - MvWAddStr(spad, 2, 2, "This is a new subpad"); - box(spad, 0, 0); + if ((spad = subpad(pad, 12, 25, 6, 52)) != 0) { + MvWAddStr(spad, 2, 2, "This is a new subpad"); + box(spad, 0, 0); + delwin(spad); + } prefresh(pad, 0, 0, 0, 0, 15, 75); keypad(pad, TRUE); raw();