]> ncurses.scripts.mit.edu Git - ncurses.git/commitdiff
ncurses 6.1 - patch 20190817
authorThomas E. Dickey <dickey@invisible-island.net>
Sun, 18 Aug 2019 00:33:55 +0000 (00:33 +0000)
committerThomas E. Dickey <dickey@invisible-island.net>
Sun, 18 Aug 2019 00:33:55 +0000 (00:33 +0000)
+ amend 20181208 changes for wbkgd() and wbkgrnd(), fixing a few
  details where it still differed from SVr4.
+ fix some cppcheck warnings, mostly style, in ncurses test-programs.

23 files changed:
NEWS
VERSION
dist.mk
ncurses/base/lib_bkgd.c
package/debian-mingw/changelog
package/debian-mingw64/changelog
package/debian/changelog
package/mingw-ncurses.nsi
package/mingw-ncurses.spec
package/ncurses.spec
package/ncursest.spec
test/blue.c
test/bs.c
test/cardfile.c
test/chgat.c
test/clip_printw.c
test/color_content.c
test/color_set.c
test/demo_altkeys.c
test/demo_defkey.c
test/demo_forms.c
test/demo_menus.c
test/test_sgr.c

diff --git a/NEWS b/NEWS
index 1f356c4ba01f179ee1b44f1df6d33842b34472d9..c7b0ac6cc41a010b9135d52c87db1e24e1d7ed9b 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.3361 2019/08/10 19:05:52 tom Exp $
+-- $Id: NEWS,v 1.3364 2019/08/17 21:47:27 tom Exp $
 -------------------------------------------------------------------------------
 
 This is a log of changes that ncurses has gone through since Zeyd started
@@ -45,6 +45,11 @@ 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.
 
+20190817
+       + amend 20181208 changes for wbkgd() and wbkgrnd(), fixing a few
+         details where it still differed from SVr4.
+       + fix some cppcheck warnings, mostly style, in ncurses test-programs.
+
 20190810
        + fix a few more coverity warnings.
 
diff --git a/VERSION b/VERSION
index f1fe46df10a0da6cc671f56b34908c1273012205..8362207f44a49cd97a50f79ef5e699a5b2c8f34a 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-5:0:10 6.1     20190810
+5:0:10 6.1     20190817
diff --git a/dist.mk b/dist.mk
index bc0ff9856fb34b64042bf27520cd60fabb556f1c..6630c1be975760240a9dcf4748f42d6a7980c576 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.1300 2019/08/10 12:52:53 tom Exp $
+# $Id: dist.mk,v 1.1301 2019/08/17 13:26:39 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 = 20190810
+NCURSES_PATCH = 20190817
 
 # We don't append the patch to the version, since this only applies to releases
 VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
index d0d39d845364fcbb396ad6fc43ac5db76dd56897..aa1db21e4fa8f5f050b8fc0ae64a55eecf2dd91c 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2016,2018 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2018,2019 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            *
@@ -36,7 +36,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_bkgd.c,v 1.52 2018/12/09 00:09:17 tom Exp $")
+MODULE_ID("$Id: lib_bkgd.c,v 1.53 2019/08/17 20:59:41 tom Exp $")
 
 /*
  * Set the window's background information.
@@ -145,6 +145,11 @@ wbkgrnd(WINDOW *win, const ARG_CH_T ch)
        memset(&old_bkgd, 0, sizeof(old_bkgd));
        (void) wgetbkgrnd(win, &old_bkgd);
 
+       if (!memcmp(&old_bkgd, &new_bkgd, sizeof(new_bkgd))) {
+           T(("...unchanged"));
+           returnCode(OK);
+       }
+
        old_char = old_bkgd;
        RemAttr(old_char, ~A_CHARTEXT);
        old_attr = AttrOf(old_bkgd);
@@ -153,6 +158,8 @@ wbkgrnd(WINDOW *win, const ARG_CH_T ch)
        if (!(old_attr & A_COLOR)) {
            old_pair = 0;
        }
+       T(("... old background char %s, attr %s, pair %d",
+          _tracechar(CharOf(old_char)), _traceattr(old_attr), old_pair));
 
        new_char = new_bkgd;
        RemAttr(new_char, ~A_CHARTEXT);
@@ -163,15 +170,20 @@ wbkgrnd(WINDOW *win, const ARG_CH_T ch)
        if (!Charable(new_bkgd)) {
            new_char = old_char;
        }
+       if (!(new_attr & A_COLOR)) {
+           new_pair = 0;
+       }
+       T(("... new background char %s, attr %s, pair %d",
+          _tracechar(CharOf(new_char)), _traceattr(new_attr), new_pair));
 
        (void) wbkgrndset(win, CHREF(new_bkgd));
 
        /* SVr4 updates color pair if old/new match, otherwise just attrs */
        if ((new_pair != 0) && (new_pair == old_pair)) {
-           SetAttr(win->_nc_bkgd, new_attr);
-           SetPair(win->_nc_bkgd, new_pair);
+           WINDOW_ATTRS(win) = new_attr;
+           SET_WINDOW_PAIR(win, new_pair);
        } else {
-           SetAttr(win->_nc_bkgd, new_attr);
+           WINDOW_ATTRS(win) = new_attr;
        }
 
        for (y = 0; y <= win->_maxy; y++) {
@@ -195,7 +207,7 @@ wbkgrnd(WINDOW *win, const ARG_CH_T ch)
                                | (new_attr & ALL_BUT_COLOR));
                    }
                } else {
-                   SetAttr(*cp, new_attr);
+                   SetAttr(*cp, (tmp_attr & ~old_attr) | new_attr);
                    SetPair(*cp, new_pair);
                }
            }
index f035c1122d7e04ec3e59b62375812b92858aa5c1..82080e2dfa80807afb84206ef95ad6d76d4d2e58 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (6.1+20190810) unstable; urgency=low
+ncurses6 (6.1+20190817) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 10 Aug 2019 08:52:53 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 17 Aug 2019 09:26:39 -0400
 
 ncurses6 (5.9-20131005) unstable; urgency=low
 
index f035c1122d7e04ec3e59b62375812b92858aa5c1..82080e2dfa80807afb84206ef95ad6d76d4d2e58 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (6.1+20190810) unstable; urgency=low
+ncurses6 (6.1+20190817) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 10 Aug 2019 08:52:53 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 17 Aug 2019 09:26:39 -0400
 
 ncurses6 (5.9-20131005) unstable; urgency=low
 
index 3edff2ebc4f897a3037ac174451327edb75f6a05..7f69ca236c65db5b09fa47750f8d85844ce4eb89 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (6.1+20190810) unstable; urgency=low
+ncurses6 (6.1+20190817) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 10 Aug 2019 08:52:53 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 17 Aug 2019 09:26:39 -0400
 
 ncurses6 (5.9-20120608) unstable; urgency=low
 
index 41acfea1505d0b93fa6e054a9a1a6c06506aab16..ed12eedab356efcf9c818905fe2f452ef6c633f2 100644 (file)
@@ -1,4 +1,4 @@
-; $Id: mingw-ncurses.nsi,v 1.346 2019/08/10 12:52:53 tom Exp $\r
+; $Id: mingw-ncurses.nsi,v 1.347 2019/08/17 13:26:39 tom Exp $\r
 \r
 ; TODO add examples\r
 ; TODO bump ABI to 6\r
@@ -10,7 +10,7 @@
 !define VERSION_MAJOR "6"\r
 !define VERSION_MINOR "1"\r
 !define VERSION_YYYY  "2019"\r
-!define VERSION_MMDD  "0810"\r
+!define VERSION_MMDD  "0817"\r
 !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}\r
 \r
 !define MY_ABI   "5"\r
index 1181f3821f67b75e8f9368424aba5773acaa8bdb..369162c2f078597ed96d1ba16ab940c81729955c 100644 (file)
@@ -3,7 +3,7 @@
 Summary: shared libraries for terminal handling
 Name: mingw32-ncurses6
 Version: 6.1
-Release: 20190810
+Release: 20190817
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
index 2fc4434eab91b72143efa58db28e4e3e03192c36..c99e6a5a1758c8f799670a655b9f7c300962afd1 100644 (file)
@@ -1,7 +1,7 @@
 Summary: shared libraries for terminal handling
 Name: ncurses6
 Version: 6.1
-Release: 20190810
+Release: 20190817
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
index 51ad7103fb6c76baec9cb4e4a63d153d2d119525..9caf5836de6484ec9ebf17f60cd392bee62927e5 100644 (file)
@@ -1,7 +1,7 @@
 Summary: Curses library with POSIX thread support.
 Name: ncursest6
 Version: 6.1
-Release: 20190810
+Release: 20190817
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
index 9c4108a41a6a6d51717bc4ab8c747bfc136914b1..0889ff06c228d6e99f622973974c199dd5017c8b 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2017,2019 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            *
@@ -36,7 +36,7 @@
  *****************************************************************************/
 
 /*
- * $Id: blue.c,v 1.51 2017/09/30 17:43:18 tom Exp $
+ * $Id: blue.c,v 1.52 2019/08/17 21:49:19 tom Exp $
  */
 
 #include <test.priv.h>
@@ -153,14 +153,14 @@ init_vars(void)
 static void
 shuffle(int size)
 {
-    int i, j, numswaps, swapnum, temp;
+    int numswaps, swapnum;
 
     numswaps = size * 10;      /* an arbitrary figure */
 
     for (swapnum = 0; swapnum < numswaps; swapnum++) {
-       i = rand() % size;
-       j = rand() % size;
-       temp = deck[i];
+       int i = rand() % size;
+       int j = rand() % size;
+       int temp = deck[i];
        deck[i] = deck[j];
        deck[j] = temp;
     }
@@ -169,11 +169,11 @@ shuffle(int size)
 static void
 deal_cards(void)
 {
-    int ptr, card = 0, value, csuit, crank, suit, aces[4];
+    int card = 0, value, csuit, crank, suit, aces[4];
 
     memset(aces, 0, sizeof(aces));
     for (suit = HEARTS; suit <= CLUBS; suit++) {
-       ptr = freeptr[suit];
+       int ptr = freeptr[suit];
        grid[ptr++] = NOCARD;   /* 1st card space is blank */
        while ((ptr % GRID_WIDTH) != 0) {
            value = deck[card++];
@@ -388,10 +388,10 @@ play_game(void)
 static int
 collect_discards(void)
 {
-    int row, col, cardno = 0, finish, gridno;
+    int row, col, cardno = 0, gridno;
 
     for (row = HEARTS; row <= CLUBS; row++) {
-       finish = 0;
+       int finish = 0;
        for (col = 1; col < GRID_WIDTH; col++) {
            gridno = row * GRID_WIDTH + col;
 
index b8893e6243beba33acf724d4ba33f78b3d3ec91d..4de4dbc7f987f3a4141f3305d1cfd5bbbf8b0d31 100644 (file)
--- a/test/bs.c
+++ b/test/bs.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2017,2018 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2018,2019 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            *
@@ -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.73 2018/05/12 15:07:51 tom Exp $
+ * $Id: bs.c,v 1.74 2019/08/17 21:49:19 tom Exp $
  */
 
 #include <test.priv.h>
@@ -548,14 +548,15 @@ initgame(void)
 static int
 getcoord(int atcpu)
 {
-    int ny, nx, c;
-
     if (atcpu)
        cgoto(cury, curx);
     else
        pgoto(cury, curx);
     (void) refresh();
+
     for (;;) {
+       int ny, nx, c;
+
        if (atcpu) {
            MvPrintw(CYBASE + BDEPTH + 1, CXBASE + 11, "(%d, %c)",
                     curx, 'A' + cury);
@@ -731,10 +732,9 @@ static int
 awinna(void)
 {
     int i, j;
-    ship_t *ss;
 
     for (i = 0; i < 2; ++i) {
-       ss = (i) ? cpuship : plyship;
+       ship_t *ss = (i) ? cpuship : plyship;
        for (j = 0; j < SHIPTYPES; ++j, ++ss)
            if (ss->length > ss->hits)
                break;
@@ -761,9 +761,11 @@ hitship(int x, int y)
            if (++ss->hits < ss->length)        /* still afloat? */
                return ((ship_t *) NULL);
            else {              /* sunk! */
-               int i, j;
+               int i;
+
+               if (!closepack) {
+                   int j;
 
-               if (!closepack)
                    for (j = -1; j <= 1; j++) {
                        int bx = ss->x + j * xincr[(ss->dir + 2) % dir_MAX];
                        int by = ss->y + j * yincr[(ss->dir + 2) % dir_MAX];
@@ -792,6 +794,7 @@ hitship(int x, int y)
                            }
                        }
                    }
+               }
 
                for (i = 0; i < ss->length; ++i) {
                    int x1 = ss->x + i * xincr[ss->dir];
@@ -884,12 +887,12 @@ plyturn(void)
 static int
 sgetc(const char *s)
 {
-    const char *s1;
-    int ch;
-
     (void) refresh();
+
     for (;;) {
-       ch = getch();
+       int ch = getch();
+       const char *s1;
+
        if (islower(ch))
            ch = toupper(ch);
        if (is_QUIT(ch))
@@ -1161,9 +1164,9 @@ playagain(void)
 static void
 do_options(int c, char *op[])
 {
-    register int i;
-
     if (c > 1) {
+       int i;
+
        for (i = 1; i < c; i++) {
            switch (op[i][0]) {
            default:
index ba9e8de53bae1f8b2eff2c0485247f9dc849e37c..a782342e226b61df055d7f4d36af69a401a509f8 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1999-2016,2017 Free Software Foundation, Inc.              *
+ * Copyright (c) 1999-2017,2019 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
  *
- * $Id: cardfile.c,v 1.45 2017/10/19 21:14:25 tom Exp $
+ * $Id: cardfile.c,v 1.46 2019/08/17 21:49:40 tom Exp $
  *
  * File format: text beginning in column 1 is a title; other text is content.
  */
@@ -125,10 +125,12 @@ add_title(const char *title)
 static void
 add_content(CARD * card, const char *content)
 {
-    size_t total, offset;
+    size_t total;
 
     content = skip(content);
     if ((total = strlen(content)) != 0) {
+       size_t offset;
+
        if (card->content != 0 && (offset = strlen(card->content)) != 0) {
            total += 1 + offset;
            card->content = typeRealloc(char, total + 1, card->content);
@@ -173,10 +175,11 @@ static void
 read_data(char *fname)
 {
     FILE *fp;
-    CARD *card = 0;
-    char buffer[BUFSIZ];
 
     if ((fp = fopen(fname, "r")) != 0) {
+       CARD *card = 0;
+       char buffer[BUFSIZ];
+
        while (fgets(buffer, sizeof(buffer), fp)) {
            trim(buffer);
            if (isspace(UChar(*buffer))) {
@@ -197,15 +200,17 @@ static void
 write_data(const char *fname)
 {
     FILE *fp;
-    CARD *p = 0;
-    int n;
 
     if (!strcmp(fname, default_name))
        fname = "cardfile.out";
 
     if ((fp = fopen(fname, "w")) != 0) {
+       CARD *p = 0;
+
        for (p = all_cards; p != 0; p = p->link) {
            FIELD **f = form_fields(p->form);
+           int n;
+
            for (n = 0; f[n] != 0; n++) {
                char *s = field_buffer(f[n], 0);
                if (s != 0
@@ -365,7 +370,7 @@ show_legend(void)
 
 #if (defined(KEY_RESIZE) && HAVE_WRESIZE) || NO_LEAKS
 static void
-free_form_fields(FIELD ** f)
+free_form_fields(FIELD **f)
 {
     int n;
 
@@ -391,7 +396,6 @@ cardfile(char *fname)
     int form_high;
     int y;
     int x;
-    int ch = ERR;
     int finished = FALSE;
 
     show_legend();
@@ -432,6 +436,8 @@ cardfile(char *fname)
     order_cards(top_card, visible_cards);
 
     while (!finished) {
+       int ch = ERR;
+
        update_panels();
        doupdate();
 
@@ -522,13 +528,11 @@ cardfile(char *fname)
     }
 #if NO_LEAKS
     while (all_cards != 0) {
-       FIELD **f;
-
        p = all_cards;
        all_cards = all_cards->link;
 
        if (isVisible(p)) {
-           f = form_fields(p->form);
+           FIELD **f = form_fields(p->form);
 
            unpost_form(p->form);       /* ...so we can free it */
            free_form(p->form); /* this also disconnects the fields */
index 72dd48b6afff9765e4a8b48674c06d7f29fdb01f..5c82aee366fbe4f1dc09544f8758ebf11de6c7b7 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2006-2012,2017 Free Software Foundation, Inc.              *
+ * Copyright (c) 2006-2017,2019 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: chgat.c,v 1.17 2017/09/28 23:04:14 tom Exp $
+ * $Id: chgat.c,v 1.18 2019/08/17 21:49:19 tom Exp $
  *
  * test-driver for chgat/wchgat/mvchgat/mvwchgat
  */
@@ -75,10 +75,11 @@ color_params(size_t state, short *pair)
     };
     /* *INDENT-ON* */
 
-    static bool first = TRUE;
     const char *result = 0;
 
     if (has_colors()) {
+       static bool first = TRUE;
+
        if (first) {
            size_t n;
 
index a1ee516bad2f28b1f2dca13881ad37be2d8765f7..f7689e6f0218fc1ee29a07c49c6502a3ae079129 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2008-2016,2017 Free Software Foundation, Inc.              *
+ * Copyright (c) 2008-2017,2019 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: clip_printw.c,v 1.15 2017/09/28 23:07:23 tom Exp $
+ * $Id: clip_printw.c,v 1.16 2019/08/17 21:49:40 tom Exp $
  *
  * demonstrate how to use printw without wrapping.
  */
@@ -56,7 +56,7 @@ typedef struct {
 } STATUS;
 
 static int
-clip_wprintw(WINDOW *win, NCURSES_CONST char *fmt,...)
+clip_wprintw(WINDOW *win, NCURSES_CONST char *fmt, ...)
 {
     int y0, x0, y1, x1, width;
     WINDOW *sub;
@@ -103,10 +103,11 @@ color_params(unsigned state, int *pair)
     };
     /* *INDENT-ON* */
 
-    static bool first = TRUE;
     const char *result = 0;
 
     if (has_colors()) {
+       static bool first = TRUE;
+
        if (first) {
            unsigned n;
 
index bb1f076af4f40f1be0bf32a51810b54937a56187..8b11982a2bbcc3e3f5f033451ccfbc0508260872 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: color_content.c,v 1.10 2019/01/21 01:05:44 tom Exp $
+ * $Id: color_content.c,v 1.11 2019/08/17 21:29:13 tom Exp $
  */
 
 #define NEED_TIME_H
@@ -251,7 +251,6 @@ int
 main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
 {
     int i;
-    int repeat;
 
     while ((i = getopt(argc, argv, "f:il:npr:sx")) != -1) {
        switch (i) {
@@ -305,6 +304,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
            }
        }
     } else {
+       int repeat;
 
        for (repeat = 0; repeat < r_opt; ++repeat) {
            run_test();
index 477d049c8b5e431f721caa961c669f5a561f44bb..cfe3755bd7de292efe6a40fd43c6ce67807327c5 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2003-2012,2014 Free Software Foundation, Inc.              *
+ * Copyright (c) 2003-2014,2019 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.8 2014/02/01 22:10:42 tom Exp $
+ * $Id: color_set.c,v 1.9 2019/08/17 21:49:19 tom Exp $
  */
 
 #include <test.priv.h>
@@ -39,13 +39,14 @@ int
 main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
 {
     NCURSES_COLOR_T f, b;
-    int i;
 
     initscr();
     cbreak();
     noecho();
 
     if (has_colors()) {
+       int i;
+
        start_color();
 
        (void) pair_content(0, &f, &b);
index 0f4e898a7a6c38baca71e14a77d6dfcaaa8d0761..d85bac48bce22e0b3b2e03b96e75628674ac41a7 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2005-2017,2018 Free Software Foundation, Inc.              *
+ * Copyright (c) 2005-2018,2019 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: demo_altkeys.c,v 1.12 2018/12/29 17:52:53 tom Exp $
+ * $Id: demo_altkeys.c,v 1.13 2019/08/17 21:49:40 tom Exp $
  *
  * Demonstrate the define_key() function.
  * Thomas Dickey - 2005/10/22
@@ -47,11 +47,12 @@ static void
 log_last_line(WINDOW *win)
 {
     FILE *fp;
-    int y, x, n;
-    char temp[256];
 
     if ((fp = fopen(MY_LOGFILE, "a")) != 0) {
+       char temp[256];
+       int y, x, n;
        int need = sizeof(temp) - 1;
+
        if (need > COLS)
            need = COLS;
        getyx(win, y, x);
@@ -75,8 +76,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
     int n;
     int ch;
 #if HAVE_GETTIMEOFDAY
-    int secs, msecs;
-    struct timeval current, previous;
+    struct timeval previous;
 #endif
 
     unlink(MY_LOGFILE);
@@ -119,8 +119,10 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
     while ((ch = getch()) != ERR) {
        bool escaped = (ch >= MY_KEYS);
        const char *name = keyname(escaped ? (ch - MY_KEYS) : ch);
-
 #if HAVE_GETTIMEOFDAY
+       int secs, msecs;
+       struct timeval current;
+
        gettimeofday(&current, 0);
        secs = (int) (current.tv_sec - previous.tv_sec);
        msecs = (int) ((current.tv_usec - previous.tv_usec) / 1000);
index 616a855722ba2ef1d14c4515e50e601722d75d2c..e5bb9c2680e0ccdaec27062d4d5cee6ab3a83e86 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2002-2017,2018 Free Software Foundation, Inc.              *
+ * Copyright (c) 2002-2018,2019 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: demo_defkey.c,v 1.28 2018/02/12 09:57:31 tom Exp $
+ * $Id: demo_defkey.c,v 1.29 2019/08/17 21:49:19 tom Exp $
  *
  * Demonstrate the define_key() function.
  * Thomas Dickey - 2002/11/23
@@ -45,10 +45,10 @@ static void
 log_last_line(WINDOW *win)
 {
     FILE *fp;
-    int y, x, n;
-    char temp[256];
 
     if ((fp = fopen(MY_LOGFILE, "a")) != 0) {
+       char temp[256];
+       int y, x, n;
        int need = sizeof(temp) - 1;
        if (need > COLS)
            need = COLS;
@@ -98,11 +98,12 @@ static char *
 visible(const char *string)
 {
     char *result = 0;
-    size_t need = 1;
-    int pass;
-    int n;
 
     if (string != 0 && *string != '\0') {
+       int pass;
+       int n;
+       size_t need = 1;
+
        for (pass = 0; pass < 2; ++pass) {
            for (n = 0; string[n] != '\0'; ++n) {
                char temp[80];
@@ -185,7 +186,6 @@ duplicate(WINDOW *win, NCURSES_CONST char *name, int code)
 
     if (value != 0) {
        const char *prefix = 0;
-       char temp[BUFSIZ];
 
        if (!(strncmp) (value, "\033[", (size_t) 2)) {
            prefix = "\033O";
@@ -193,6 +193,7 @@ duplicate(WINDOW *win, NCURSES_CONST char *name, int code)
            prefix = "\033[";
        }
        if (prefix != 0) {
+           char temp[BUFSIZ];
            _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp))
                        "%s%s", prefix, value + 2);
            really_define_key(win, temp, code);
index b0a388e4b895661d2efba6f3fa41d998ca2cbd77..ccfb86e311fec9d2d20feee68f3cf3deaea53f28 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2003-2017,2018 Free Software Foundation, Inc.              *
+ * Copyright (c) 2003-2018,2019 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: demo_forms.c,v 1.55 2018/07/14 23:26:02 tom Exp $
+ * $Id: demo_forms.c,v 1.56 2019/08/17 21:49:19 tom Exp $
  *
  * Demonstrate a variety of functions from the form library.
  * Thomas Dickey - 2003/4/26
@@ -338,9 +338,6 @@ static void
 show_current_field(WINDOW *win, FORM *form)
 {
     FIELD *field;
-    FIELDTYPE *type;
-    char *buffer;
-    int nbuf;
     int field_rows, field_cols, field_max;
     int currow, curcol;
 
@@ -355,7 +352,11 @@ show_current_field(WINDOW *win, FORM *form)
     if (data_behind(form))
        waddstr(win, " behind");
     waddch(win, '\n');
+
     if ((field = current_field(form)) != 0) {
+       FIELDTYPE *type;
+       int nbuf;
+
        wprintw(win, "Page %d%s, Field %d/%d%s:",
                form_page(form),
                new_page(field) ? "*" : "",
@@ -411,6 +412,7 @@ show_current_field(WINDOW *win, FORM *form)
 
        waddstr(win, "\n");
        for (nbuf = 0; nbuf <= 2; ++nbuf) {
+           char *buffer;
            if ((buffer = field_buffer(field, nbuf)) != 0) {
                wprintw(win, "buffer %d:", nbuf);
                (void) wattrset(win, A_REVERSE);
@@ -430,13 +432,11 @@ show_current_field(WINDOW *win, FORM *form)
 static void
 demo_forms(void)
 {
-    WINDOW *w;
     FORM *form;
     FIELD *f[100];             /* will memset to zero */
-    int finished = 0, c;
+    int c;
     unsigned n = 0;
     int pg;
-    WINDOW *also;
     const char *fname;
     static const char *my_enum[] =
     {"first", "second", "third", 0};
@@ -544,6 +544,9 @@ demo_forms(void)
     f[n] = (FIELD *) 0;
 
     if ((form = new_form(f)) != 0) {
+       WINDOW *w;
+       WINDOW *also;
+       int finished = 0;
 
        display_form(form);
 
index 844afa7e26e0ab4a648b0b6ec0f9bade4c6bdd7e..6e94b44b3b1ac738803be433369765d5ee30f290 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: demo_menus.c,v 1.67 2019/08/10 19:25:27 tom Exp $
+ * $Id: demo_menus.c,v 1.68 2019/08/17 21:45:32 tom Exp $
  *
  * Demonstrate a variety of functions from the menu library.
  * Thomas Dickey - 2005/4/9
@@ -309,12 +309,11 @@ menu_create(ITEM ** items, int count, int ncols, MenuNo number)
 static void
 menu_destroy(MENU * m)
 {
-    int count;
-
     Trace(("menu_destroy %p", (void *) m));
     if (m != 0) {
        ITEM **items = menu_items(m);
        const char *blob = 0;
+       int count;
 
        count = item_count(m);
        Trace(("menu_destroy %p count %d", (void *) m, count));
@@ -429,7 +428,6 @@ build_select_menu(MenuNo number, char *filename)
            && (sb.st_mode & S_IFMT) == S_IFREG
            && sb.st_size != 0) {
            size_t size = (size_t) sb.st_size;
-           unsigned j, k;
            char *blob = typeMalloc(char, size + 1);
            MENU_DATA *list = typeCalloc(MENU_DATA, size + 1);
 
@@ -442,6 +440,7 @@ build_select_menu(MenuNo number, char *filename)
                if (fp != 0) {
                    if (fread(blob, sizeof(char), size, fp) == size) {
                        bool mark = TRUE;
+                       unsigned j, k;
                        for (j = k = 0; j < size; ++j) {
                            if (mark) {
                                list[k++].name = blob + j;
@@ -609,7 +608,6 @@ perform_trace_menu(int cmd)
 /* interactively set the trace level */
 {
     ITEM **ip;
-    unsigned newtrace;
     int result;
 
     for (ip = menu_items(mpTrace); *ip; ip++) {
@@ -625,7 +623,7 @@ perform_trace_menu(int cmd)
 
     if (result == E_OK) {
        if (update_trace_menu(mpTrace) || cmd == REQ_TOGGLE_ITEM) {
-           newtrace = 0;
+           unsigned newtrace = 0;
            for (ip = menu_items(mpTrace); *ip; ip++) {
                if (item_value(*ip)) {
                    MENU_DATA *td = (MENU_DATA *) item_userptr(*ip);
index 4ed5954359c65fe7bfbb282f991c7784999aa464..71811140f6356b130b6104a4a697d57544786659 100644 (file)
@@ -29,7 +29,7 @@
 /*
  * Author: Thomas E. Dickey
  *
- * $Id: test_sgr.c,v 1.13 2019/07/28 18:13:39 tom Exp $
+ * $Id: test_sgr.c,v 1.14 2019/08/17 21:36:44 tom Exp $
  *
  * A simple demo of the sgr/sgr0 terminal capabilities.
  */
@@ -147,7 +147,7 @@ dumpit(unsigned bits, unsigned ignore, const char *sgr, const char *sgr0)
     static char params[] = "SURBDBIPA";
     unsigned n;
 
-    printf("%4d ", bits);
+    printf("%4u ", bits);
     bits &= ~ignore;
     for (n = 0; n < MAXPAR; ++n) {
        putchar((int) ((bits & (unsigned) (1 << n)) ? params[n] : '-'));