]> ncurses.scripts.mit.edu Git - ncurses.git/commitdiff
ncurses 5.9 - patch 20121215
authorThomas E. Dickey <dickey@invisible-island.net>
Sun, 16 Dec 2012 01:26:24 +0000 (01:26 +0000)
committerThomas E. Dickey <dickey@invisible-island.net>
Sun, 16 Dec 2012 01:26:24 +0000 (01:26 +0000)
+ fix several warnings from clang 3.1 --analyze, includes correcting
  a null-pointer check in _nc_mvcur_resume.
+ correct display of double-width characters with MinGW port (report
  by Erwin Waterlander).
+ replace MinGW's wcrtomb(), fixing a problem with _nc_viscbuf
> fixes based on Coverity report:
+ correct coloring in test/bs.c
+ correct check for 8-bit value in _nc_insert_ch().
+ remove dead code in progs/tset.c, test/linedata.h
+ add null-pointer checks in lib_tracemse.c, panel.priv.h, and some
  test-programs.

30 files changed:
NEWS
dist.mk
ncurses/base/lib_color.c
ncurses/base/lib_insch.c
ncurses/curses.priv.h
ncurses/tinfo/lib_setup.c
ncurses/tinfo/make_hash.c
ncurses/tinfo/trim_sgr0.c
ncurses/trace/lib_tracemse.c
ncurses/tty/lib_mvcur.c
ncurses/tty/tty_update.c
ncurses/widechar/lib_wunctrl.c
ncurses/win32con/win_driver.c
package/debian/changelog
package/ncurses.spec
panel/panel.priv.h
progs/dump_entry.c
progs/tic.c
progs/tset.c
test/bs.c
test/color_set.c
test/ins_wide.c
test/inserts.c
test/linedata.h
test/movewindow.c
test/test_add_wchstr.c
test/test_addchstr.c
test/test_addstr.c
test/test_addwstr.c
test/worm.c

diff --git a/NEWS b/NEWS
index 0d840d404be1dbe0e50ed771081bec62df5c7edd..cfe9286e1656f16074a8631c6b1e39b36e205b34 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -25,7 +25,7 @@
 -- sale, use or other dealings in this Software without prior written        --
 -- authorization.                                                            --
 -------------------------------------------------------------------------------
--- $Id: NEWS,v 1.1992 2012/12/09 00:24:36 tom Exp $
+-- $Id: NEWS,v 1.1998 2012/12/16 00:13:07 tom Exp $
 -------------------------------------------------------------------------------
 
 This is a log of changes that ncurses has gone through since Zeyd started
@@ -45,6 +45,19 @@ 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.
 
+20121215
+       + fix several warnings from clang 3.1 --analyze, includes correcting
+         a null-pointer check in _nc_mvcur_resume.
+       + correct display of double-width characters with MinGW port (report
+         by Erwin Waterlander).
+       + replace MinGW's wcrtomb(), fixing a problem with _nc_viscbuf 
+       > fixes based on Coverity report:
+       + correct coloring in test/bs.c
+       + correct check for 8-bit value in _nc_insert_ch().
+       + remove dead code in progs/tset.c, test/linedata.h
+       + add null-pointer checks in lib_tracemse.c, panel.priv.h, and some
+         test-programs.
+
 20121208
        + modify test/knight.c to show the number of choices possible for
          each position in automove option, e.g., to allow user to follow
diff --git a/dist.mk b/dist.mk
index 24e594b1b1b8822029eb05fa40cb07e2c24595a3..776b2c16b818d14b751f0936699e55d3e3d9a61f 100644 (file)
--- 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.904 2012/12/08 15:04:46 tom Exp $
+# $Id: dist.mk,v 1.905 2012/12/15 16:32: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 = 20121208
+NCURSES_PATCH = 20121215
 
 # We don't append the patch to the version, since this only applies to releases
 VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
index 0a68e309fcfb039eba45da6bc630a050f698cfc7..003929871f99fe8962f5313f9ec42ae2d4f67e3f 100644 (file)
@@ -45,7 +45,7 @@
 #define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: lib_color.c,v 1.105 2012/06/09 20:34:11 tom Exp $")
+MODULE_ID("$Id: lib_color.c,v 1.106 2012/12/15 19:14:34 tom Exp $")
 
 #ifdef USE_TERM_DRIVER
 #define CanChange      InfoOf(SP_PARM).canchange
@@ -804,7 +804,8 @@ NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_DCLx
                                    1, outc);
            return;
        } else if (SP_PARM != 0) {
-           pair_content((short) pair, &fg, &bg);
+           if (pair_content((short) pair, &fg, &bg) == ERR)
+               return;
        }
     }
 
index e21ec02bc84f30d5b2821d453a66ed9f47c305a1..7a9ab0825d575c40be9152fdc1786781d35c5dc0 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,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            *
@@ -43,7 +43,7 @@
 #include <curses.priv.h>
 #include <ctype.h>
 
-MODULE_ID("$Id: lib_insch.c,v 1.32 2009/10/24 22:04:35 tom Exp $")
+MODULE_ID("$Id: lib_insch.c,v 1.33 2012/12/15 22:51:12 tom Exp $")
 
 /*
  * Insert the given character, updating the current location to simplify
@@ -82,7 +82,7 @@ _nc_insert_ch(SCREEN *sp, WINDOW *win, chtype ch)
 #if USE_WIDEC_SUPPORT
               WINDOW_EXT(win, addch_used) == 0 &&
 #endif
-              is8bits(ChCharOf(ch)) &&
+              is8bits(ch) &&
               (isprint(ChCharOf(ch)) ||
                (ChAttrOf(ch) & A_ALTCHARSET) ||
                (sp != 0 && sp->_legacy_coding && !iscntrl(ChCharOf(ch))))) {
@@ -101,7 +101,7 @@ _nc_insert_ch(SCREEN *sp, WINDOW *win, chtype ch)
                *temp1 = _nc_render(win, wch);
                win->_curx++;
            }
-       } else if (is8bits(ChCharOf(ch)) && iscntrl(ChCharOf(ch))) {
+       } else if (is8bits(ch) && iscntrl(ChCharOf(ch))) {
            s = NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx ChCharOf(ch));
            while (*s != '\0') {
                code = _nc_insert_ch(sp, win, ChAttrOf(ch) | UChar(*s));
index 940dddf4b74bbc594bdf38f5a0bc8091b62ce4de..46445329f1c5452b92eee956ca93788e76bed7ec 100644 (file)
@@ -34,7 +34,7 @@
  ****************************************************************************/
 
 /*
- * $Id: curses.priv.h,v 1.512 2012/12/08 20:19:40 tom Exp $
+ * $Id: curses.priv.h,v 1.514 2012/12/15 20:03:45 tom Exp $
  *
  *     curses.priv.h
  *
@@ -1418,7 +1418,7 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
                                AttrOf(dst) |= (attr_t) (ext + 1)
 
 #define if_WIDEC(code)  code
-#define Charable(ch)   ((SP_PARM != 0 && SP_PARM->_legacy_coding)      \
+#define Charable(ch)   ((SP_PARM->_legacy_coding)                      \
                         || (AttrOf(ch) & A_ALTCHARSET)                 \
                         || (!isWidecExt(ch) &&                         \
                             (ch).chars[1] == L'\0' &&                  \
@@ -2046,6 +2046,7 @@ extern NCURSES_EXPORT(int) _nc_eventlist_timeout(_nc_eventlist *);
 
 extern int __MINGW_NOTHROW _nc_wctomb(char *, wchar_t);
 #define wctomb(s,wc) _nc_wctomb(s,wc)
+#define wcrtomb(s,wc,n) _nc_wctomb(s,wc)
 
 extern int __MINGW_NOTHROW _nc_mbtowc(wchar_t *, const char *, size_t);
 #define mbtowc(pwc,s,n) _nc_mbtowc(pwc,s,n)
index 9467b7df6b3097a68003bb8a00214d7647de7536..6e738e0f5a7dafaeb013557fb74e1839c5873ccf 100644 (file)
@@ -48,7 +48,7 @@
 #include <locale.h>
 #endif
 
-MODULE_ID("$Id: lib_setup.c,v 1.154 2012/12/08 22:01:26 tom Exp $")
+MODULE_ID("$Id: lib_setup.c,v 1.155 2012/12/15 19:04:54 tom Exp $")
 
 /****************************************************************************
  *
@@ -438,7 +438,7 @@ _nc_update_screensize(SCREEN *sp)
      * 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 (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)) {
index 99e4bd4fbd781eb813760ef975d3616bc7e73bea..38980d2492edc8c5d0bac14f1455dcfabf79ab04 100644 (file)
@@ -44,7 +44,7 @@
 
 #include <ctype.h>
 
-MODULE_ID("$Id: make_hash.c,v 1.9 2012/11/18 01:30:03 tom Exp $")
+MODULE_ID("$Id: make_hash.c,v 1.10 2012/12/16 00:40:14 tom Exp $")
 
 /*
  *     _nc_make_hash_table()
@@ -275,8 +275,7 @@ main(int argc, char **argv)
        printf("static struct name_table_entry *_nc_%s_table = 0;\n\n", root_name);
     } else {
 
-       printf("static struct name_table_entry %s _nc_%s_table[] =\n",
-              bigstring ? "" : "const",
+       printf("static struct name_table_entry const _nc_%s_table[] =\n",
               root_name);
        printf("{\n");
        for (n = 0; n < CAPTABSIZE; n++) {
index ee18c7317b3456cfb4de37bb5be882505c42a838..ec5e2b78dbf0344ebaf7530001fa649f6a4d6eac 100644 (file)
@@ -36,7 +36,7 @@
 
 #include <tic.h>
 
-MODULE_ID("$Id: trim_sgr0.c,v 1.14 2012/02/22 22:34:31 tom Exp $")
+MODULE_ID("$Id: trim_sgr0.c,v 1.15 2012/12/15 20:57:17 tom Exp $")
 
 #undef CUR
 #define CUR tp->
@@ -48,21 +48,28 @@ MODULE_ID("$Id: trim_sgr0.c,v 1.14 2012/02/22 22:34:31 tom Exp $")
 static char *
 set_attribute_9(TERMTYPE *tp, int flag)
 {
-    const char *result;
+    const char *value;
+    char *result;
 
-    if ((result = tparm(set_attributes, 0, 0, 0, 0, 0, 0, 0, 0, flag)) == 0)
-       result = "";
-    return strdup(result);
+    value = tparm(set_attributes, 0, 0, 0, 0, 0, 0, 0, 0, flag);
+    if (PRESENT(value))
+       result = strdup(value);
+    else
+       result = 0;
+    return result;
 }
 
 static int
 is_csi(const char *s)
 {
-    if (UChar(s[0]) == CSI)
-       return 1;
-    else if (s[0] == ESC && s[1] == L_BRACK)
-       return 2;
-    return 0;
+    int result = 0;
+    if (s != 0) {
+       if (UChar(s[0]) == CSI)
+           result = 1;
+       else if (s[0] == ESC && s[1] == L_BRACK)
+           result = 2;
+    }
+    return result;
 }
 
 static char *
@@ -97,7 +104,7 @@ skip_delay(const char *s)
 static bool
 rewrite_sgr(char *s, char *attr)
 {
-    if (PRESENT(s)) {
+    if (s != 0) {
        if (PRESENT(attr)) {
            size_t len_s = strlen(s);
            size_t len_a = strlen(attr);
@@ -121,33 +128,35 @@ static bool
 similar_sgr(char *a, char *b)
 {
     bool result = FALSE;
-    int csi_a = is_csi(a);
-    int csi_b = is_csi(b);
-    size_t len_a;
-    size_t len_b;
+    if (a != 0 && b != 0) {
+       int csi_a = is_csi(a);
+       int csi_b = is_csi(b);
+       size_t len_a;
+       size_t len_b;
 
-    TR(TRACE_DATABASE, ("similar_sgr:\n\t%s\n\t%s",
-                       _nc_visbuf2(1, a),
-                       _nc_visbuf2(2, b)));
-    if (csi_a != 0 && csi_b != 0 && csi_a == csi_b) {
-       a += csi_a;
-       b += csi_b;
-       if (*a != *b) {
-           a = skip_zero(a);
-           b = skip_zero(b);
+       TR(TRACE_DATABASE, ("similar_sgr:\n\t%s\n\t%s",
+                           _nc_visbuf2(1, a),
+                           _nc_visbuf2(2, b)));
+       if (csi_a != 0 && csi_b != 0 && csi_a == csi_b) {
+           a += csi_a;
+           b += csi_b;
+           if (*a != *b) {
+               a = skip_zero(a);
+               b = skip_zero(b);
+           }
        }
+       len_a = strlen(a);
+       len_b = strlen(b);
+       if (len_a && len_b) {
+           if (len_a > len_b)
+               result = (strncmp(a, b, len_b) == 0);
+           else
+               result = (strncmp(a, b, len_a) == 0);
+       }
+       TR(TRACE_DATABASE, ("...similar_sgr: %d\n\t%s\n\t%s", result,
+                           _nc_visbuf2(1, a),
+                           _nc_visbuf2(2, b)));
     }
-    len_a = strlen(a);
-    len_b = strlen(b);
-    if (len_a && len_b) {
-       if (len_a > len_b)
-           result = (strncmp(a, b, len_b) == 0);
-       else
-           result = (strncmp(a, b, len_a) == 0);
-    }
-    TR(TRACE_DATABASE, ("...similar_sgr: %d\n\t%s\n\t%s", result,
-                       _nc_visbuf2(1, a),
-                       _nc_visbuf2(2, b)));
     return result;
 }
 
index e062a26af52371c2352287999c89bf35cb890f3a..51ffa2ef7634884bf02816032ddbbc548c09b301 100644 (file)
@@ -38,7 +38,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_tracemse.c,v 1.20 2012/02/22 22:40:24 tom Exp $")
+MODULE_ID("$Id: lib_tracemse.c,v 1.21 2012/12/15 23:51:19 tom Exp $")
 
 #ifdef TRACE
 
@@ -114,24 +114,33 @@ _trace_mmask_t(SCREEN *sp, mmask_t code)
 NCURSES_EXPORT(char *)
 _nc_tracemouse(SCREEN *sp, MEVENT const *ep)
 {
-    _nc_SPRINTF(my_buffer, _nc_SLIMIT(sizeof(my_buffer))
-               TRACEMSE_FMT,
-               ep->id,
-               ep->x,
-               ep->y,
-               ep->z,
-               (unsigned long) ep->bstate);
-
-    (void) _trace_mmask_t(sp, ep->bstate);
-    _nc_STRCAT(my_buffer, "}", sizeof(my_buffer));
-    return (my_buffer);
+    char *result = 0;
+
+    if (sp != 0) {
+       _nc_SPRINTF(my_buffer, _nc_SLIMIT(sizeof(my_buffer))
+                   TRACEMSE_FMT,
+                   ep->id,
+                   ep->x,
+                   ep->y,
+                   ep->z,
+                   (unsigned long) ep->bstate);
+
+       (void) _trace_mmask_t(sp, ep->bstate);
+       _nc_STRCAT(my_buffer, "}", sizeof(my_buffer));
+       result = (my_buffer);
+    }
+    return result;
 }
 
 NCURSES_EXPORT(mmask_t)
 _nc_retrace_mmask_t(SCREEN *sp, mmask_t code)
 {
-    *my_buffer = '\0';
-    T((T_RETURN("{%s}"), _trace_mmask_t(sp, code)));
+    if (sp != 0) {
+       *my_buffer = '\0';
+       T((T_RETURN("{%s}"), _trace_mmask_t(sp, code)));
+    } else {
+       T((T_RETURN("{?}")));
+    }
     return code;
 }
 
index 8de26c4f6a80800937e550f83f8f34acc78b5b5d..78453e35f0db9f89811b6e5d41322cc2d5d4d005 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            *
 #define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: lib_mvcur.c,v 1.127 2011/10/22 16:09:52 tom Exp $")
+MODULE_ID("$Id: lib_mvcur.c,v 1.128 2012/12/15 20:59:27 tom Exp $")
 
 #define WANT_CHAR(sp, y, x) NewScreen(sp)->_line[y].text[x]    /* desired state */
 
@@ -285,7 +285,7 @@ NCURSES_EXPORT(void)
 NCURSES_SP_NAME(_nc_mvcur_resume) (NCURSES_SP_DCL0)
 /* what to do at initialization time and after each shellout */
 {
-    if (SP_PARM && !IsTermInfo(SP_PARM))
+    if (!SP_PARM || !IsTermInfo(SP_PARM))
        return;
 
     /* initialize screen for cursor access */
@@ -327,13 +327,14 @@ NCURSES_EXPORT(void)
 NCURSES_SP_NAME(_nc_mvcur_init) (NCURSES_SP_DCL0)
 /* initialize the cost structure */
 {
-    if (SP_PARM->_ofp && isatty(fileno(SP_PARM->_ofp)))
+    if (SP_PARM->_ofp && isatty(fileno(SP_PARM->_ofp))) {
        SP_PARM->_char_padding = ((BAUDBYTE * 1000 * 10)
                                  / (BAUDRATE(SP_PARM) > 0
                                     ? BAUDRATE(SP_PARM)
                                     : 9600));
-    else
+    } else {
        SP_PARM->_char_padding = 1;     /* must be nonzero */
+    }
     if (SP_PARM->_char_padding <= 0)
        SP_PARM->_char_padding = 1;     /* must be nonzero */
     TR(TRACE_CHARPUT | TRACE_MOVE, ("char_padding %d msecs", SP_PARM->_char_padding));
index 368beaf4d123f95cee3fbb83aa8555b3dcfe8356..9be997389993818ed765078665f3b0844d809d97 100644 (file)
@@ -82,7 +82,7 @@
 
 #include <ctype.h>
 
-MODULE_ID("$Id: tty_update.c,v 1.271 2012/08/25 21:04:03 tom Exp $")
+MODULE_ID("$Id: tty_update.c,v 1.272 2012/12/15 21:00:19 tom Exp $")
 
 /*
  * This define controls the line-breakout optimization.  Every once in a
@@ -1076,24 +1076,22 @@ ClrToEOL(NCURSES_SP_DCLx NCURSES_CH_T blank, int needclear)
 {
     int j;
 
-    if (SP_PARM != 0) {
-       if (CurScreen(SP_PARM) != 0
-           && SP_PARM->_cursrow >= 0) {
-           for (j = SP_PARM->_curscol; j < screen_columns(SP_PARM); j++) {
-               if (j >= 0) {
-                   NCURSES_CH_T *cp =
-                   &(CurScreen(SP_PARM)->_line[SP_PARM->_cursrow].text[j]);
-
-                   if (!CharEq(*cp, blank)) {
-                       *cp = blank;
-                       needclear = TRUE;
-                   }
+    if (CurScreen(SP_PARM) != 0
+       && SP_PARM->_cursrow >= 0) {
+       for (j = SP_PARM->_curscol; j < screen_columns(SP_PARM); j++) {
+           if (j >= 0) {
+               NCURSES_CH_T *cp =
+               &(CurScreen(SP_PARM)->_line[SP_PARM->_cursrow].text[j]);
+
+               if (!CharEq(*cp, blank)) {
+                   *cp = blank;
+                   needclear = TRUE;
                }
            }
        }
     }
 
-    if (needclear && (SP_PARM != 0)) {
+    if (needclear) {
        UpdateAttrs(SP_PARM, blank);
        TPUTS_TRACE("clr_eol");
        if (clr_eol && SP_PARM->_el_cost <= (screen_columns(SP_PARM) - SP_PARM->_curscol)) {
@@ -1117,9 +1115,6 @@ ClrToEOS(NCURSES_SP_DCLx NCURSES_CH_T blank)
 {
     int row, col;
 
-    if (0 == SP_PARM)
-       return;
-
     row = SP_PARM->_cursrow;
     col = SP_PARM->_curscol;
 
@@ -2155,33 +2150,33 @@ _nc_screen_init(void)
 NCURSES_EXPORT(void)
 NCURSES_SP_NAME(_nc_screen_wrap) (NCURSES_SP_DCL0)
 {
-    if (SP_PARM == 0)
-       return;
+    if (SP_PARM != 0) {
 
-    UpdateAttrs(SP_PARM, normal);
+       UpdateAttrs(SP_PARM, normal);
 #if NCURSES_EXT_FUNCS
-    if (SP_PARM->_coloron
-       && !SP_PARM->_default_color) {
-       static const NCURSES_CH_T blank = NewChar(BLANK_TEXT);
-       SP_PARM->_default_color = TRUE;
-       NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_ARGx
-                                      -1,
-                                      0,
-                                      FALSE,
-                                      NCURSES_SP_NAME(_nc_outch));
-       SP_PARM->_default_color = FALSE;
-
-       TINFO_MVCUR(NCURSES_SP_ARGx
-                   SP_PARM->_cursrow,
-                   SP_PARM->_curscol,
-                   screen_lines(SP_PARM) - 1,
-                   0);
-
-       ClrToEOL(NCURSES_SP_ARGx blank, TRUE);
-    }
+       if (SP_PARM->_coloron
+           && !SP_PARM->_default_color) {
+           static const NCURSES_CH_T blank = NewChar(BLANK_TEXT);
+           SP_PARM->_default_color = TRUE;
+           NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_ARGx
+                                          -1,
+                                          0,
+                                          FALSE,
+                                          NCURSES_SP_NAME(_nc_outch));
+           SP_PARM->_default_color = FALSE;
+
+           TINFO_MVCUR(NCURSES_SP_ARGx
+                       SP_PARM->_cursrow,
+                       SP_PARM->_curscol,
+                       screen_lines(SP_PARM) - 1,
+                       0);
+
+           ClrToEOL(NCURSES_SP_ARGx blank, TRUE);
+       }
 #endif
-    if (SP_PARM->_color_defs) {
-       NCURSES_SP_NAME(_nc_reset_colors) (NCURSES_SP_ARG);
+       if (SP_PARM->_color_defs) {
+           NCURSES_SP_NAME(_nc_reset_colors) (NCURSES_SP_ARG);
+       }
     }
 }
 
index c2328a43a0efc60fe03bd4f44d94ca6bf0ebe0a4..45d495203fc6c34cf3b16175ceef85016ae09543 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2001-2010,2011 Free Software Foundation, Inc.              *
+ * Copyright (c) 2001-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            *
@@ -35,7 +35,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_wunctrl.c,v 1.15 2011/05/28 22:06:26 tom Exp $")
+MODULE_ID("$Id: lib_wunctrl.c,v 1.16 2012/12/15 20:53:42 tom Exp $")
 
 NCURSES_EXPORT(wchar_t *)
 NCURSES_SP_NAME(wunctrl) (NCURSES_SP_DCLx cchar_t *wc)
@@ -45,7 +45,7 @@ NCURSES_SP_NAME(wunctrl) (NCURSES_SP_DCLx cchar_t *wc)
 
     if (wc == 0) {
        result = 0;
-    } else if (Charable(*wc)) {
+    } else if (SP_PARM != 0 && Charable(*wc)) {
        const char *p =
        NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx
                                 (unsigned) _nc_to_char((wint_t)CharOf(*wc)));
index 02cd378c9e2e4079d7ac2b29200bbfa0a3b7ea5c..03313270cea079d8d3f673808f85c1c6a1940fe9 100644 (file)
@@ -38,7 +38,7 @@
 #include <curses.priv.h>
 #define CUR my_term.type.
 
-MODULE_ID("$Id: win_driver.c,v 1.14 2012/09/22 19:15:14 tom Exp $")
+MODULE_ID("$Id: win_driver.c,v 1.15 2012/12/15 19:39:49 tom Exp $")
 
 #define WINMAGIC NCDRV_MAGIC(NCDRV_WINCONSOLE)
 
@@ -143,9 +143,10 @@ MapAttr(TERMINAL_CONTROL_BLOCK * TCB, WORD res, attr_t ch)
  * TODO: _nc_wacs should be part of sp.
  */
 static BOOL
-con_write16(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, cchar_t *str, int n)
+con_write16(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, cchar_t *str, int limit)
 {
-    CHAR_INFO ci[n];
+    int actual = 0;
+    CHAR_INFO ci[limit];
     COORD loc, siz;
     SMALL_RECT rec;
     int i;
@@ -159,34 +160,37 @@ con_write16(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, cchar_t *str, int n)
 
     SetSP();
 
-    for (i = 0; i < n; i++) {
+    for (i = actual = 0; i < limit; i++) {
        ch = str[i];
-       ci[i].Char.UnicodeChar = CharOf(ch);
-       ci[i].Attributes = MapAttr(TCB,
-                                  PropOf(TCB)->SBI.wAttributes,
-                                  AttrOf(ch));
+       if (isWidecExt(ch))
+           continue;
+       ci[actual].Char.UnicodeChar = CharOf(ch);
+       ci[actual].Attributes = MapAttr(TCB,
+                                       PropOf(TCB)->SBI.wAttributes,
+                                       AttrOf(ch));
        if (AttrOf(ch) & A_ALTCHARSET) {
            if (_nc_wacs) {
                int which = CharOf(ch);
                if (which > 0
                    && which < ACS_LEN
                    && CharOf(_nc_wacs[which]) != 0) {
-                   ci[i].Char.UnicodeChar = CharOf(_nc_wacs[which]);
+                   ci[actual].Char.UnicodeChar = CharOf(_nc_wacs[which]);
                } else {
-                   ci[i].Char.UnicodeChar = ' ';
+                   ci[actual].Char.UnicodeChar = ' ';
                }
            }
        }
+       ++actual;
     }
 
     loc.X = (short) 0;
     loc.Y = (short) 0;
-    siz.X = (short) n;
+    siz.X = (short) actual;
     siz.Y = 1;
 
     rec.Left = (short) x;
     rec.Top = (short) y;
-    rec.Right = (short) (x + n - 1);
+    rec.Right = (short) (x + limit - 1);
     rec.Bottom = rec.Top;
 
     return WriteConsoleOutputW(TCB->hdl, ci, siz, loc, &rec);
index 1a041ffa49740a045774fa5d303eace2c7f27bca..ffadf002daae1fc5e11c6bd29641337a9d87b153 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (5.9-20121208) unstable; urgency=low
+ncurses6 (5.9-20121215) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 08 Dec 2012 10:12:21 -0500
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 15 Dec 2012 11:32:40 -0500
 
 ncurses6 (5.9-20120608) unstable; urgency=low
 
index 50f411bd1f9388c9b78c0821fb6ad7fcdab42855..538bf1a592de890d0edfec1bcc19854914ffd4e0 100644 (file)
@@ -1,7 +1,7 @@
 Summary: shared libraries for terminal handling
 Name: ncurses6
 Release: 5.9
-Version: 20121208
+Version: 20121215
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{release}-%{version}.tgz
index 016a84c18532c72acc9bce5c84b0e79d1cb21dfc..76607fb2c0cad688df27210150329fd704a205a7 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,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            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 
-/* $Id: panel.priv.h,v 1.24 2011/05/21 18:55:07 tom Exp $ */
+/* $Id: panel.priv.h,v 1.25 2012/12/15 23:57:43 tom Exp $ */
 
 #ifndef NCURSES_PANEL_PRIV_H
 #define NCURSES_PANEL_PRIV_H 1
@@ -89,7 +89,7 @@ struct screen;              /* forward declaration */
 #define GetScreenHook(sp) \
                        struct panelhook* ph = NCURSES_SP_NAME(_nc_panelhook)(sp)
 #define GetPanelHook(pan) \
-                       GetScreenHook(_nc_screen_of((pan)->win))
+                       GetScreenHook(pan ? _nc_screen_of((pan)->win) : 0)
 #define GetWindowHook(win) \
                        SCREEN* sp = _nc_screen_of(win); \
                        GetScreenHook(sp)
index 31deedb2de18f48c8b702f895405c1fe9296ac38..56610e9db2b0decc4488f96c4d4b3ce027cdbe97 100644 (file)
@@ -39,7 +39,7 @@
 #include "termsort.c"          /* this C file is generated */
 #include <parametrized.h>      /* so is this */
 
-MODULE_ID("$Id: dump_entry.c,v 1.101 2012/10/27 19:45:17 tom Exp $")
+MODULE_ID("$Id: dump_entry.c,v 1.102 2012/12/15 18:25:56 tom Exp $")
 
 #define INDENT                 8
 #define DISCARD(string) string = ABSENT_STRING
@@ -100,6 +100,8 @@ static const char *separator, *trailer;
 #define StrIndirect(j)  ((sortmode == S_NOSORT) ? (j) : str_indirect[j])
 #endif
 
+static void failed(const char *) GCC_NORETURN;
+
 static void
 failed(const char *s)
 {
@@ -828,7 +830,9 @@ fmt_entry(TERMTYPE *tterm,
            }
        }
        /* e.g., trimmed_sgr0 */
-       if (capability != tterm->Strings[i])
+       if (capability != ABSENT_STRING &&
+           capability != CANCELLED_STRING &&
+           capability != tterm->Strings[i])
            free(capability);
     }
     len += (int) (num_strings * 2);
index 717a1fb35126bbb79b2544b03907c2c810d0d933..9ad79d47fb5773c8abef3aa9e033c0c488fe3eec 100644 (file)
@@ -46,7 +46,7 @@
 #include <hashed_db.h>
 #include <transform.h>
 
-MODULE_ID("$Id: tic.c,v 1.180 2012/12/08 22:17:22 tom Exp $")
+MODULE_ID("$Id: tic.c,v 1.182 2012/12/16 00:03:12 tom Exp $")
 
 #define STDIN_NAME "<stdin>"
 
@@ -552,7 +552,7 @@ matches(char **needle, const char *haystack)
     return (code);
 }
 
-static const char *
+static char *
 valid_db_path(const char *nominal)
 {
     struct stat sb;
@@ -623,7 +623,7 @@ static void
 show_databases(const char *outdir)
 {
     bool specific = (outdir != 0) || getenv("TERMINFO") != 0;
-    const char *result;
+    char *result;
     const char *tried = 0;
 
     if (outdir == 0) {
@@ -631,6 +631,7 @@ show_databases(const char *outdir)
     }
     if ((result = valid_db_path(outdir)) != 0) {
        printf("%s\n", result);
+       free(result);
     } else {
        tried = outdir;
     }
@@ -638,6 +639,7 @@ show_databases(const char *outdir)
     if ((outdir = _nc_home_terminfo())) {
        if ((result = valid_db_path(outdir)) != 0) {
            printf("%s\n", result);
+           free(result);
        } else if (!specific) {
            tried = outdir;
        }
index bf3bf1929c285af5d51616ad9423139658d5fb4b..f7f00c5ef94c397308c7dc0cbdc92a245d56ad06 100644 (file)
@@ -119,7 +119,7 @@ char *ttyname(int fd);
 #include <dump_entry.h>
 #include <transform.h>
 
-MODULE_ID("$Id: tset.c,v 1.89 2012/02/22 22:50:47 tom Exp $")
+MODULE_ID("$Id: tset.c,v 1.90 2012/12/15 23:01:17 tom Exp $")
 
 /*
  * SCO defines TIOCGSIZE and the corresponding struct.  Other systems (SunOS,
@@ -474,9 +474,6 @@ add_mapping(const char *port, char *arg)
        mapp->speed = tbaudrate(p);
     }
 
-    if (arg == (char *) 0)     /* Non-optional type. */
-       goto badmopt;
-
     mapp->type = arg;
 
     /* Terminate porttype, if specified. */
index f8784853c7620cf233452089adf655d779685b30..ebcabc42d3bfabd7f4b75d747e30e53e60c1bc83 100644 (file)
--- a/test/bs.c
+++ b/test/bs.c
@@ -34,7 +34,7 @@
  * v2.0 featuring strict ANSI/POSIX conformance, November 1993.
  * v2.1 with ncurses mouse support, September 1995
  *
- * $Id: bs.c,v 1.56 2012/12/08 23:35:58 tom Exp $
+ * $Id: bs.c,v 1.59 2012/12/16 00:20:49 tom Exp $
  */
 
 #include <test.priv.h>
@@ -110,7 +110,7 @@ static char sub[] = "Submarine";
 static char destroy[] = "Destroyer";
 static char ptboat[] = "PT Boat";
 
-static char name[40];
+static char *your_name;
 static char dftname[] = "stranger";
 
 /* direction constants */
@@ -220,11 +220,12 @@ intro(void)
 
     CATCHALL(uninitgame);
 
-    if ((tmpname = getlogin()) != 0) {
-       (void) strcpy(name, tmpname);
-       name[0] = (char) toupper(UChar(name[0]));
-    } else
-       (void) strcpy(name, dftname);
+    if ((tmpname = getlogin()) != 0 &&
+       (your_name = strdup(tmpname)) != 0) {
+       your_name[0] = (char) toupper(UChar(your_name[0]));
+    } else {
+       your_name = dftname;
+    }
 
     (void) initscr();
     keypad(stdscr, TRUE);
@@ -955,8 +956,8 @@ cpufire(int x, int y)
     bool hit, sunk;
     ship_t *ss = NULL;
 
-    hit = board[PLAYER][x][y] ? MARK_HIT : MARK_MISS;
-    hits[COMPUTER][x][y] = (char) hit;
+    hit = board[PLAYER][x][y];
+    hits[COMPUTER][x][y] = (hit ? MARK_HIT : MARK_MISS);
     MvPrintw(PROMPTLINE, 0,
             "I shoot at %c%d. I %s!", y + 'A', x, hit ? "hit" :
             "miss");
@@ -1133,16 +1134,16 @@ playagain(void)
        ++cpuwon;
     else
        ++plywon;
-    j = 18 + (int) strlen(name);
+    j = 18 + (int) strlen(your_name);
     if (plywon >= 10)
        ++j;
     if (cpuwon >= 10)
        ++j;
     MvPrintw(1, (COLWIDTH - j) / 2,
-            "%s: %d     Computer: %d", name, plywon, cpuwon);
+            "%s: %d     Computer: %d", your_name, plywon, cpuwon);
 
     prompt(2, (awinna())? "Want to be humiliated again, %s [yn]? "
-          : "Going to give me a chance for revenge, %s [yn]? ", name);
+          : "Going to give me a chance for revenge, %s [yn]? ", your_name);
     return (sgetc("YN") == 'Y');
 }
 
index 2e981cba9f1189184eb3aa8a372ea4e551e480e7..041e6fd76fbb7c6e0e722b043c6628a7f0863f61 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2003-2006,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 2003-2008,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            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: color_set.c,v 1.6 2008/02/10 00:18:01 tom Exp $
+ * $Id: color_set.c,v 1.7 2012/12/15 22:04:14 tom Exp $
  */
 
 #include <test.priv.h>
@@ -48,7 +48,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
     if (has_colors()) {
        start_color();
 
-       pair_content(0, &f, &b);
+       (void) pair_content(0, &f, &b);
        printw("pair 0 contains (%d,%d)\n", f, b);
        getch();
 
index 6e4e7275cdf6723f75db63e865f32a86640c19a8..a168dc112fcb52c73b9b3108abc920f442707505 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: ins_wide.c,v 1.19 2012/12/09 01:13:56 tom Exp $
+ * $Id: ins_wide.c,v 1.20 2012/12/16 00:51:02 tom Exp $
  *
  * Demonstrate the wins_wstr() and wins_wch functions.
  * Thomas Dickey - 2002/11/23
@@ -294,11 +294,13 @@ test_inserts(int level)
        case key_RECUR:
            test_inserts(level + 1);
 
-           touchwin(look);
+           if (look)
+               touchwin(look);
            touchwin(work);
            touchwin(show);
 
-           wnoutrefresh(look);
+           if (look)
+               wnoutrefresh(look);
            wnoutrefresh(work);
            wnoutrefresh(show);
 
index ffac333691864dcc242838760fb19676ab0183ed..ae38fa21752167566de9d00a92f67521c916f50a 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: inserts.c,v 1.26 2012/12/09 00:51:51 tom Exp $
+ * $Id: inserts.c,v 1.27 2012/12/16 00:35:27 tom Exp $
  *
  * Demonstrate the winsstr() and winsch functions.
  * Thomas Dickey - 2002/10/19
@@ -219,11 +219,13 @@ test_inserts(int level)
        case key_RECUR:
            test_inserts(level + 1);
 
-           touchwin(look);
+           if (look)
+               touchwin(look);
            touchwin(work);
            touchwin(show);
 
-           wnoutrefresh(look);
+           if (look)
+               wnoutrefresh(look);
            wnoutrefresh(work);
            wnoutrefresh(show);
 
index 2510ee72f646ece49d43941b9b85710c3c35cb32..751bc6b5db27284762535b4a2a38784c844c38ef 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2009,2010 Free Software Foundation, Inc.                   *
+ * Copyright (c) 2009-2010,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            *
@@ -85,10 +85,8 @@ read_linedata(WINDOW *work)
                    beep();
                    continue;
                }
-           } else if (code != ERR) {
-               result = (int) ch;
-               break;
            } else {
+               result = (int) ch;
                break;
            }
        }
index 11521a0722388bc06fd9bbe728eb9d5d7915a3ce..612cb8823cb75cbabb200f2f9701654a5a72d1e2 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: movewindow.c,v 1.37 2012/10/27 19:37:56 tom Exp $
+ * $Id: movewindow.c,v 1.38 2012/12/15 18:36:40 tom Exp $
  *
  * Demonstrate move functions for windows and derived windows from the curses
  * library.
@@ -218,8 +218,16 @@ selectcell(WINDOW *parent,
            res.x = ulj + j;
            return (&res);
        }
-       i %= si;
-       j %= sj;
+
+       if (si <= 0)
+           i = 0;
+       else
+           i %= si;
+
+       if (sj <= 0)
+           j = 0;
+       else
+           j %= sj;
 
        /*
         * If the caller can handle continuous movement, return the result.
index 6b1b2d7a54be7c18babbabeae266d8e4437b67dd..c509f0035ac55129d34ce3e2764620d7b9da2ada 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: test_add_wchstr.c,v 1.19 2012/11/24 20:04:13 tom Exp $
+ * $Id: test_add_wchstr.c,v 1.20 2012/12/16 00:12:04 tom Exp $
  *
  * Demonstrate the waddwchstr() and wadd_wch functions.
  * Thomas Dickey - 2009/9/12
@@ -371,11 +371,13 @@ test_add_wchstr(int level)
        case key_RECUR:
            test_add_wchstr(level + 1);
 
-           touchwin(look);
+           if (look)
+               touchwin(look);
            touchwin(work);
            touchwin(show);
 
-           wnoutrefresh(look);
+           if (look)
+               wnoutrefresh(look);
            wnoutrefresh(work);
            wnoutrefresh(show);
 
index abb4380a31c83207ff54211d35bc44dadcec5dc7..2aae844e7651bdf4215944eb6448e8d247f77991 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: test_addchstr.c,v 1.17 2012/12/09 00:50:39 tom Exp $
+ * $Id: test_addchstr.c,v 1.18 2012/12/16 00:36:27 tom Exp $
  *
  * Demonstrate the waddchstr() and waddch functions.
  * Thomas Dickey - 2009/9/12
@@ -294,11 +294,13 @@ test_adds(int level)
        case key_RECUR:
            test_adds(level + 1);
 
-           touchwin(look);
+           if (look)
+               touchwin(look);
            touchwin(work);
            touchwin(show);
 
-           wnoutrefresh(look);
+           if (look)
+               wnoutrefresh(look);
            wnoutrefresh(work);
            wnoutrefresh(show);
 
index a6876a89bf352bb1aa74930979dd634a4ba1b169..a14cdedcc9e04f05956e4d6cdbb38c9a42f7f095 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: test_addstr.c,v 1.9 2012/11/24 19:49:02 tom Exp $
+ * $Id: test_addstr.c,v 1.10 2012/12/16 00:14:10 tom Exp $
  *
  * Demonstrate the waddstr() and waddch functions.
  * Thomas Dickey - 2009/9/12
@@ -213,11 +213,13 @@ test_adds(int level)
        case key_RECUR:
            test_adds(level + 1);
 
-           touchwin(look);
+           if (look)
+               touchwin(look);
            touchwin(work);
            touchwin(show);
 
-           wnoutrefresh(look);
+           if (look)
+               wnoutrefresh(look);
            wnoutrefresh(work);
            wnoutrefresh(show);
 
index e369b6671280080654228f9ceeea3c3f72b3ed32..cb057faf955a8ff680f793fc9017190e5388d7d5 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: test_addwstr.c,v 1.10 2012/11/24 20:04:54 tom Exp $
+ * $Id: test_addwstr.c,v 1.11 2012/12/16 00:11:18 tom Exp $
  *
  * Demonstrate the waddwstr() and wadd_wch functions.
  * Thomas Dickey - 2009/9/12
@@ -299,11 +299,13 @@ test_inserts(int level)
        case key_RECUR:
            test_inserts(level + 1);
 
-           touchwin(look);
+           if (look)
+               touchwin(look);
            touchwin(work);
            touchwin(show);
 
-           wnoutrefresh(look);
+           if (look)
+               wnoutrefresh(look);
            wnoutrefresh(work);
            wnoutrefresh(show);
 
index 1f0a6fcb3fe389aa7eb8d8cf91dc140270844501..f64911c632cf053ee612e642ba41a3d704d7eb71 100644 (file)
@@ -61,7 +61,7 @@ Options:
   traces will be dumped.  The program stops and waits for one character of
   input at the beginning and end of the interval.
 
-  $Id: worm.c,v 1.61 2012/10/27 19:37:17 tom Exp $
+  $Id: worm.c,v 1.62 2012/12/15 18:32:40 tom Exp $
 */
 
 #include <test.priv.h>
@@ -431,6 +431,7 @@ main(int argc, char *argv[])
     struct worm *w;
     int *ip;
     bool done = FALSE;
+    int max_refs;
 
     setlocale(LC_ALL, "");
 
@@ -513,8 +514,9 @@ main(int argc, char *argv[])
     }
 #endif /* A_COLOR */
 
-    refs = typeMalloc(int *, (size_t) LINES);
-    for (y = 0; y < LINES; y++) {
+    max_refs = LINES;
+    refs = typeMalloc(int *, (size_t) max_refs);
+    for (y = 0; y < max_refs; y++) {
        refs[y] = typeMalloc(int, (size_t) COLS);
        for (x = 0; x < COLS; x++) {
            refs[y][x] = 0;
@@ -608,7 +610,7 @@ main(int argc, char *argv[])
     Trace(("Cleanup"));
     cleanup();
 #ifdef NO_LEAKS
-    for (y = 0; y < LINES; y++) {
+    for (y = 0; y < max_refs; y++) {
        free(refs[y]);
     }
     free(refs);