From f79af94ad91dfe693eb9779caf71ea892fb1eff6 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sun, 12 Apr 2020 01:22:49 +0000 Subject: [PATCH] ncurses 6.2 - patch 20200411 + fix find_pair(), overlooked when refactoring for _nc_reserve_pairs() (report/testcase by Brad Town, cf: 20170812). + add a trailing null for magic-string in putwin, flagged by gcc 10 + update check for gcc version versus gnat to work with gcc 10.x --- NEWS | 8 +++++++- VERSION | 2 +- configure | 2 +- dist.mk | 4 ++-- ncurses/base/lib_screen.c | 4 ++-- ncurses/base/new_pair.c | 23 +++++++++++++++-------- ncurses/new_pair.h | 5 ++--- package/debian-mingw/changelog | 4 ++-- package/debian-mingw64/changelog | 4 ++-- package/debian/changelog | 4 ++-- package/mingw-ncurses.nsi | 4 ++-- package/mingw-ncurses.spec | 2 +- package/ncurses.spec | 2 +- package/ncursest.spec | 2 +- 14 files changed, 41 insertions(+), 29 deletions(-) diff --git a/NEWS b/NEWS index 0af90c5b..ec054959 100644 --- a/NEWS +++ b/NEWS @@ -26,7 +26,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: NEWS,v 1.3471 2020/04/04 21:07:47 tom Exp $ +-- $Id: NEWS,v 1.3475 2020/04/11 17:01:12 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -46,6 +46,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. +20200411 + + fix find_pair(), overlooked when refactoring for _nc_reserve_pairs() + (report/testcase by Brad Town, cf: 20170812). + + add a trailing null for magic-string in putwin, flagged by gcc 10 + + update check for gcc version versus gnat to work with gcc 10.x + 20200404 + modify -fvisibility check to work with g++ > fixes for building with Visual Studio C++ and msys2 (patches by diff --git a/VERSION b/VERSION index b8883445..570cd2b2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5:0:10 6.2 20200404 +5:0:10 6.2 20200411 diff --git a/configure b/configure index d0174d0c..dde5a1b0 100755 --- a/configure +++ b/configure @@ -24744,7 +24744,7 @@ echo "${ECHO_T}$cf_cv_gnat_version" >&6 test -z "$cf_cv_gnat_version" && cf_cv_gnat_version=no case $cf_cv_gnat_version in -(3.1[1-9]*|3.[2-9]*|[4-9].*|20[0-9][0-9]) +(3.1[1-9]*|3.[2-9]*|[4-9].*|20[0-9][0-9]|[1-9][0-9].*) cf_cv_prog_gnat_correct=yes ;; (*) diff --git a/dist.mk b/dist.mk index ebf85c8e..a186c9f8 100644 --- a/dist.mk +++ b/dist.mk @@ -26,7 +26,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: dist.mk,v 1.1344 2020/04/04 09:17:00 tom Exp $ +# $Id: dist.mk,v 1.1345 2020/04/11 13:11:52 tom Exp $ # Makefile for creating ncurses distributions. # # This only needs to be used directly as a makefile by developers, but @@ -38,7 +38,7 @@ SHELL = /bin/sh # These define the major/minor/patch versions of ncurses. NCURSES_MAJOR = 6 NCURSES_MINOR = 2 -NCURSES_PATCH = 20200404 +NCURSES_PATCH = 20200411 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/ncurses/base/lib_screen.c b/ncurses/base/lib_screen.c index 164356dc..fd22cd51 100644 --- a/ncurses/base/lib_screen.c +++ b/ncurses/base/lib_screen.c @@ -42,7 +42,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_screen.c,v 1.97 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_screen.c,v 1.98 2020/04/06 00:33:50 tom Exp $") #define MAX_SIZE 0x3fff /* 16k is big enough for a window or pad */ @@ -67,7 +67,7 @@ MODULE_ID("$Id: lib_screen.c,v 1.97 2020/02/02 23:34:34 tom Exp $") * format. It happens to be unused in the file 5.22 database (2015/03/07). */ static const char my_magic[] = -{'\210', '\210', '\210', '\210'}; +{'\210', '\210', '\210', '\210', 0}; #if NCURSES_EXT_PUTWIN typedef enum { diff --git a/ncurses/base/new_pair.c b/ncurses/base/new_pair.c index 547ab281..92131232 100644 --- a/ncurses/base/new_pair.c +++ b/ncurses/base/new_pair.c @@ -61,7 +61,7 @@ #endif -MODULE_ID("$Id: new_pair.c,v 1.19 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: new_pair.c,v 1.20 2020/04/11 16:06:56 tom Exp $") #if NCURSES_EXT_COLORS @@ -144,17 +144,16 @@ static int _nc_find_color_pair(SCREEN *sp, int fg, int bg) { colorpair_t find; - int result; + int result = -1; void *pp; find.fg = fg; find.bg = bg; - if (sp != 0 && - (pp = tfind(&find, &sp->_ordered_pairs, compare_data)) != 0) { - colorpair_t *temp = *(colorpair_t **) pp; - result = (int) (temp - sp->_color_pairs); - } else { - result = -1; + if (sp != 0) { + if ((pp = tfind(&find, &sp->_ordered_pairs, compare_data)) != 0) { + colorpair_t *temp = *(colorpair_t **) pp; + result = (int) (temp - sp->_color_pairs); + } } return result; } @@ -197,7 +196,10 @@ NCURSES_EXPORT(void) _nc_reset_color_pair(SCREEN *sp, int pair, colorpair_t * next) { colorpair_t *last; + if (ValidPair(sp, pair)) { + bool used; + ReservePairs(sp, pair); last = &(sp->_color_pairs[pair]); delink_color_pair(sp, pair); @@ -205,6 +207,11 @@ _nc_reset_color_pair(SCREEN *sp, int pair, colorpair_t * next) (last->fg != next->fg || last->bg != next->bg)) { /* remove the old entry from fast index */ tdelete(last, &sp->_ordered_pairs, compare_data); + used = FALSE; + } else { + used = (last->mode != cpFREE); + } + if (!used) { /* create a new entry in fast index */ *last = *next; tsearch(last, &sp->_ordered_pairs, compare_data); diff --git a/ncurses/new_pair.h b/ncurses/new_pair.h index 811abc11..dfda8907 100644 --- a/ncurses/new_pair.h +++ b/ncurses/new_pair.h @@ -34,7 +34,7 @@ /* * Common type definitions and macros for new_pair.c, lib_color.c * - * $Id: new_pair.h,v 1.10 2020/02/02 23:34:34 tom Exp $ + * $Id: new_pair.h,v 1.11 2020/04/11 16:43:47 tom Exp $ */ #ifndef NEW_PAIR_H @@ -77,8 +77,7 @@ typedef enum { cpKEEP = -1, /* color pair 0 */ cpFREE = 0, /* free for use */ - cpINIT = 1, /* init_pair() */ - cpAUTO = 1 /* alloc_pair() */ + cpINIT = 1 /* initialized */ } CPMODE; typedef struct _color_pairs diff --git a/package/debian-mingw/changelog b/package/debian-mingw/changelog index ae92601d..a2d3d304 100644 --- a/package/debian-mingw/changelog +++ b/package/debian-mingw/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.2+20200404) unstable; urgency=low +ncurses6 (6.2+20200411) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 04 Apr 2020 05:17:00 -0400 + -- Thomas E. Dickey Sat, 11 Apr 2020 09:11:52 -0400 ncurses6 (5.9-20131005) unstable; urgency=low diff --git a/package/debian-mingw64/changelog b/package/debian-mingw64/changelog index ae92601d..a2d3d304 100644 --- a/package/debian-mingw64/changelog +++ b/package/debian-mingw64/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.2+20200404) unstable; urgency=low +ncurses6 (6.2+20200411) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 04 Apr 2020 05:17:00 -0400 + -- Thomas E. Dickey Sat, 11 Apr 2020 09:11:52 -0400 ncurses6 (5.9-20131005) unstable; urgency=low diff --git a/package/debian/changelog b/package/debian/changelog index 3412c6f1..13d22d0f 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.2+20200404) unstable; urgency=low +ncurses6 (6.2+20200411) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 04 Apr 2020 05:17:00 -0400 + -- Thomas E. Dickey Sat, 11 Apr 2020 09:11:52 -0400 ncurses6 (5.9-20120608) unstable; urgency=low diff --git a/package/mingw-ncurses.nsi b/package/mingw-ncurses.nsi index c39f852b..2d891b19 100644 --- a/package/mingw-ncurses.nsi +++ b/package/mingw-ncurses.nsi @@ -1,4 +1,4 @@ -; $Id: mingw-ncurses.nsi,v 1.388 2020/04/04 09:17:00 tom Exp $ +; $Id: mingw-ncurses.nsi,v 1.389 2020/04/11 13:11:52 tom Exp $ ; TODO add examples ; TODO bump ABI to 6 @@ -10,7 +10,7 @@ !define VERSION_MAJOR "6" !define VERSION_MINOR "2" !define VERSION_YYYY "2020" -!define VERSION_MMDD "0404" +!define VERSION_MMDD "0411" !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD} !define MY_ABI "5" diff --git a/package/mingw-ncurses.spec b/package/mingw-ncurses.spec index bbadd329..083b9448 100644 --- a/package/mingw-ncurses.spec +++ b/package/mingw-ncurses.spec @@ -3,7 +3,7 @@ Summary: shared libraries for terminal handling Name: mingw32-ncurses6 Version: 6.2 -Release: 20200404 +Release: 20200411 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/package/ncurses.spec b/package/ncurses.spec index 0668b147..6d9f928d 100644 --- a/package/ncurses.spec +++ b/package/ncurses.spec @@ -1,7 +1,7 @@ Summary: shared libraries for terminal handling Name: ncurses6 Version: 6.2 -Release: 20200404 +Release: 20200411 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/package/ncursest.spec b/package/ncursest.spec index 7a3339f2..fcb76d01 100644 --- a/package/ncursest.spec +++ b/package/ncursest.spec @@ -1,7 +1,7 @@ Summary: Curses library with POSIX thread support. Name: ncursest6 Version: 6.2 -Release: 20200404 +Release: 20200411 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz -- 2.45.0