]> ncurses.scripts.mit.edu Git - ncurses.git/commitdiff
ncurses 5.9 - patch 20121124
authorThomas E. Dickey <dickey@invisible-island.net>
Sun, 25 Nov 2012 02:13:01 +0000 (02:13 +0000)
committerThomas E. Dickey <dickey@invisible-island.net>
Sun, 25 Nov 2012 02:13:01 +0000 (02:13 +0000)
+ 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.

13 files changed:
NEWS
dist.mk
ncurses/tinfo/captoinfo.c
package/debian/changelog
package/ncurses.spec
test/ditto.c
test/ins_wide.c
test/inserts.c
test/test_add_wchstr.c
test/test_addchstr.c
test/test_addstr.c
test/test_addwstr.c
test/testcurs.c

diff --git a/NEWS b/NEWS
index 5245e26be4ed57768c926b08b8f580adf9649aea..c81d27e82eca2230fbd97ef41fa1798e0149cf8a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -25,7 +25,7 @@
 -- sale, use or other dealings in this Software without prior written        --
 -- authorization.                                                            --
 -------------------------------------------------------------------------------
 -- 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
 -------------------------------------------------------------------------------
 
 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.
 
 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.
 20121117
        > fixes based on Coverity report:
        + add missing braces around FreeAndNull in two places.
diff --git a/dist.mk b/dist.mk
index 66aecea0a0d29826b17fb7385152683fdef69507..2a8ff69fc6f031d75eb81676ad45d79af0c9c30f 100644 (file)
--- a/dist.mk
+++ b/dist.mk
@@ -25,7 +25,7 @@
 # use or other dealings in this Software without prior written               #
 # authorization.                                                             #
 ##############################################################################
 # 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
 # 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
 # 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)
 
 # We don't append the patch to the version, since this only applies to releases
 VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
index b768a4987e3277cd495a6b93a92f4085f534ec90..db46e2096903912075e52385c377ac0928ad632a 100644 (file)
@@ -93,7 +93,7 @@
 #include <ctype.h>
 #include <tic.h>
 
 #include <ctype.h>
 #include <tic.h>
 
-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 */
 
 
 #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 */
                   && ((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");
            ++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);
         * but that may not be the end of the string.
         */
        assert(str != 0);
-       if (*str == '\0')
+       if (str == 0 || *str == '\0')
            break;
 
     }                          /* endwhile (*str) */
            break;
 
     }                          /* endwhile (*str) */
index 2fb230dc73fbe70f7aefde8e3ed041bc2b240dbd..894518d1d6e457b7d1e61094dd6bf5fe06a1ab96 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (5.9-20121117) unstable; urgency=low
+ncurses6 (5.9-20121124) unstable; urgency=low
 
   * latest weekly patch
 
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 17 Nov 2012 11:58:08 -0500
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 24 Nov 2012 12:13:21 -0500
 
 ncurses6 (5.9-20120608) unstable; urgency=low
 
 
 ncurses6 (5.9-20120608) unstable; urgency=low
 
index d7b6901b7c57cf8d449ac0db07d2fde4cdd19dc7..dbbf12d8623a044c7db2b63aece0cea20dc13ddf 100644 (file)
@@ -1,7 +1,7 @@
 Summary: shared libraries for terminal handling
 Name: ncurses6
 Release: 5.9
 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
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{release}-%{version}.tgz
index 36644f1274b9e427ad685ca2d4ceb287d9974a7a..921f216bb56157d733c8bc877ff38a0e9a457aaf 100644 (file)
@@ -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            *
  *                                                                          *
  * 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)
  *
 /*
  * 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.
  *
  * 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 */
     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 */
     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);
 
     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);
 
     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
 
        nodelay(inner, TRUE);
 #endif
 
+       target->parents[k] = outer;
        target->windows[k] = inner;
     }
     doupdate();
        target->windows[k] = inner;
     }
     doupdate();
index 38ffd7637d00b27041110d85096ddb09abacfe3c..07af7eda0ad360a84c88e5dd32b9b90812203081 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
  * 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
  *
  * 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);
        (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;
     }
 
     limit = LINES - 5;
@@ -275,13 +284,7 @@ test_inserts(int level)
 
     doupdate();
 
 
     doupdate();
 
-    /*
-     * Show the characters inserted in color, to distinguish from those that
-     * are shifted.
-     */
     if (has_colors()) {
     if (has_colors()) {
-       start_color();
-       init_pair(1, COLOR_WHITE, COLOR_BLUE);
        wbkgdset(work, (chtype) (COLOR_PAIR(1) | ' '));
     }
 
        wbkgdset(work, (chtype) (COLOR_PAIR(1) | ' '));
     }
 
index 56b8ebe4834def846f5ff617d64194ea440412c7..b858668af2a028043e90f55429d2805952ecb73f 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
  * 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
  *
  * 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);
        (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;
     }
 
     limit = LINES - 5;
@@ -200,13 +209,7 @@ test_inserts(int level)
 
     doupdate();
 
 
     doupdate();
 
-    /*
-     * Show the characters inserted in color, to distinguish from those that
-     * are shifted.
-     */
     if (has_colors()) {
     if (has_colors()) {
-       start_color();
-       init_pair(1, COLOR_WHITE, COLOR_BLUE);
        wbkgdset(work, (chtype) (COLOR_PAIR(1) | ' '));
     }
 
        wbkgdset(work, (chtype) (COLOR_PAIR(1) | ' '));
     }
 
index 1bca895573a9ae884519cf441e33232af5a13f4f..6b1b2d7a54be7c18babbabeae266d8e4437b67dd 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
  * 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
  *
  * 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);
        (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;
     }
 
     limit = LINES - 5;
@@ -352,13 +361,7 @@ test_add_wchstr(int level)
 
     doupdate();
 
 
     doupdate();
 
-    /*
-     * Show the characters added in color, to distinguish from those that
-     * are shifted.
-     */
     if (has_colors()) {
     if (has_colors()) {
-       start_color();
-       init_pair(1, COLOR_WHITE, COLOR_BLUE);
        wbkgdset(work, (chtype) (COLOR_PAIR(1) | ' '));
     }
 
        wbkgdset(work, (chtype) (COLOR_PAIR(1) | ' '));
     }
 
@@ -516,8 +519,8 @@ test_add_wchstr(int level)
            break;
        }
     }
            break;
        }
     }
+    delwin(show);
     if (level > 0) {
     if (level > 0) {
-       delwin(show);
        delwin(work);
        delwin(look);
     }
        delwin(work);
        delwin(look);
     }
index 6b4093e745b7369bd2d0bdbc151dc70e5d35e3ac..cc3dc4978cc172efb6ac22ac5a69bc866954a270 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
  * 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
  *
  * 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);
        (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;
     }
 
     limit = LINES - 5;
@@ -272,13 +281,7 @@ test_adds(int level)
 
     doupdate();
 
 
     doupdate();
 
-    /*
-     * Show the characters added in color, to distinguish from those that
-     * are shifted.
-     */
     if (has_colors()) {
     if (has_colors()) {
-       start_color();
-       init_pair(1, COLOR_WHITE, COLOR_BLUE);
        show_attr = (attr_t) COLOR_PAIR(1);
        wbkgdset(work, show_attr | ' ');
     } else {
        show_attr = (attr_t) COLOR_PAIR(1);
        wbkgdset(work, show_attr | ' ');
     } else {
index d67146e7d8e30944d6bfa6f1a69c231c783ab5c0..a6876a89bf352bb1aa74930979dd634a4ba1b169 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
  * 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
  *
  * 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);
        (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;
     }
 
     limit = LINES - 5;
@@ -194,13 +203,7 @@ test_adds(int level)
 
     doupdate();
 
 
     doupdate();
 
-    /*
-     * Show the characters added in color, to distinguish from those that
-     * are shifted.
-     */
     if (has_colors()) {
     if (has_colors()) {
-       start_color();
-       init_pair(1, COLOR_WHITE, COLOR_BLUE);
        wbkgdset(work, (chtype) (COLOR_PAIR(1) | ' '));
     }
 
        wbkgdset(work, (chtype) (COLOR_PAIR(1) | ' '));
     }
 
@@ -361,8 +364,8 @@ test_adds(int level)
            break;
        }
     }
            break;
        }
     }
+    delwin(show);
     if (level > 0) {
     if (level > 0) {
-       delwin(show);
        delwin(work);
        delwin(look);
     }
        delwin(work);
        delwin(look);
     }
index 9a4ee15553e530914e57551a2d1bdc760b139724..e369b6671280080654228f9ceeea3c3f72b3ed32 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
  * 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
  *
  * 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);
        (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;
     }
 
     limit = LINES - 5;
@@ -280,13 +289,7 @@ test_inserts(int level)
 
     doupdate();
 
 
     doupdate();
 
-    /*
-     * Show the characters inserted in color, to distinguish from those that
-     * are shifted.
-     */
     if (has_colors()) {
     if (has_colors()) {
-       start_color();
-       init_pair(1, COLOR_WHITE, COLOR_BLUE);
        wbkgdset(work, (chtype) (COLOR_PAIR(1) | ' '));
     }
 
        wbkgdset(work, (chtype) (COLOR_PAIR(1) | ' '));
     }
 
@@ -446,8 +449,8 @@ test_inserts(int level)
            break;
        }
     }
            break;
        }
     }
+    delwin(show);
     if (level > 0) {
     if (level > 0) {
-       delwin(show);
        delwin(work);
        delwin(look);
     }
        delwin(work);
        delwin(look);
     }
index 06d70d8430956e0e5db178cdf0920d16c5a1e1a4..8310f3f855915b4ef73d3d3d74801fc5f7ffb3c5 100644 (file)
@@ -6,7 +6,7 @@
  *  wrs(5/28/93) -- modified to be consistent (perform identically) with either
  *                  PDCurses or under Unix System V, R4
  *
  *  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 <test.priv.h>
  */
 
 #include <test.priv.h>
@@ -681,9 +681,11 @@ padTest(WINDOW *dummy GCC_UNUSED)
        raw();
        wgetch(pad);
 
        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();
        prefresh(pad, 0, 0, 0, 0, 15, 75);
        keypad(pad, TRUE);
        raw();