From 5fa28d9ac15ff11842cdd1375df3bf3ce1112cb7 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sun, 11 Feb 2024 01:30:51 +0000 Subject: [PATCH] ncurses 6.4 - patch 20240210 + compiler-warning fixes, while investigating an optimizer bug in "gcc (MacPorts gcc13 13.2.0_4+stdlib_flag) 13.2.0" which results in only the first byte of a multibyte character being printed to the screen. --- NEWS | 8 +++++++- VERSION | 2 +- dist.mk | 4 ++-- man/tabs.1 | 4 ++-- ncurses/tinfo/comp_parse.c | 8 +++----- 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 +- test/test.priv.h | 28 +++++++++++++++------------- test/test_mouse.c | 10 ++++++---- 14 files changed, 47 insertions(+), 39 deletions(-) diff --git a/NEWS b/NEWS index 33feec26..331b4cda 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.4075 2024/02/04 00:53:44 tom Exp $ +-- $Id: NEWS,v 1.4078 2024/02/10 23:48:51 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. +20240210 + + compiler-warning fixes, while investigating an optimizer bug in + "gcc (MacPorts gcc13 13.2.0_4+stdlib_flag) 13.2.0" + which results in only the first byte of a multibyte character being + printed to the screen. + 20240203 + minor changes to tracing and locale-checks. diff --git a/VERSION b/VERSION index 3ad45547..cd1c0655 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5:0:10 6.4 20240203 +5:0:10 6.4 20240210 diff --git a/dist.mk b/dist.mk index 163c0b51..8a24cb7d 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.1596 2024/02/03 10:52:10 tom Exp $ +# $Id: dist.mk,v 1.1597 2024/02/10 12:26:54 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 = 4 -NCURSES_PATCH = 20240203 +NCURSES_PATCH = 20240210 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/man/tabs.1 b/man/tabs.1 index eedb1d2b..3e683d68 100644 --- a/man/tabs.1 +++ b/man/tabs.1 @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2021,2023 Thomas E. Dickey * +.\" Copyright 2018-2023,2024 Thomas E. Dickey * .\" Copyright 2008-2016,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,7 +27,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: tabs.1,v 1.54 2024/01/20 16:54:03 tom Exp $ +.\" $Id: tabs.1,v 1.55 2024/01/20 16:54:03 tom Exp $ .TH @TABS@ 1 2024-01-20 "ncurses 6.4" "User commands" .ie \n(.g \{\ .ds `` \(lq diff --git a/ncurses/tinfo/comp_parse.c b/ncurses/tinfo/comp_parse.c index 4244df4e..dec4b925 100644 --- a/ncurses/tinfo/comp_parse.c +++ b/ncurses/tinfo/comp_parse.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2022,2023 Thomas E. Dickey * + * Copyright 2018-2023,2024 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -48,7 +48,7 @@ #include -MODULE_ID("$Id: comp_parse.c,v 1.133 2023/05/27 20:13:10 tom Exp $") +MODULE_ID("$Id: comp_parse.c,v 1.134 2024/02/10 15:52:11 tom Exp $") static void sanity_check2(TERMTYPE2 *, bool); NCURSES_IMPEXP void (NCURSES_API *_nc_check_termtype2) (TERMTYPE2 *, bool) = sanity_check2; @@ -404,7 +404,7 @@ _nc_resolve_uses2(bool fullresolve, bool literal) ENTRY *qp, *rp, *lastread = 0; bool keepgoing; unsigned i, j; - int unresolved, total_unresolved, multiples; + int total_unresolved, multiples; DEBUG(2, (T_CALLED("_nc_resolve_uses2"))); @@ -444,7 +444,6 @@ _nc_resolve_uses2(bool fullresolve, bool literal) total_unresolved = 0; _nc_curr_col = -1; for_entry_list(qp) { - unresolved = 0; for (i = 0; i < qp->nuses; i++) { bool foundit; char *child = _nc_first_name(qp->tterm.term_names); @@ -513,7 +512,6 @@ _nc_resolve_uses2(bool fullresolve, bool literal) /* no good, mark this one unresolvable and complain */ if (!foundit) { - unresolved++; total_unresolved++; _nc_curr_line = (int) lookline; diff --git a/package/debian-mingw/changelog b/package/debian-mingw/changelog index 619876e3..935c5a27 100644 --- a/package/debian-mingw/changelog +++ b/package/debian-mingw/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.4+20240203) unstable; urgency=low +ncurses6 (6.4+20240210) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 03 Feb 2024 05:52:10 -0500 + -- Thomas E. Dickey Sat, 10 Feb 2024 07:26:54 -0500 ncurses6 (5.9+20131005) unstable; urgency=low diff --git a/package/debian-mingw64/changelog b/package/debian-mingw64/changelog index 619876e3..935c5a27 100644 --- a/package/debian-mingw64/changelog +++ b/package/debian-mingw64/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.4+20240203) unstable; urgency=low +ncurses6 (6.4+20240210) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 03 Feb 2024 05:52:10 -0500 + -- Thomas E. Dickey Sat, 10 Feb 2024 07:26:54 -0500 ncurses6 (5.9+20131005) unstable; urgency=low diff --git a/package/debian/changelog b/package/debian/changelog index deb1c258..3ba3b221 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.4+20240203) unstable; urgency=low +ncurses6 (6.4+20240210) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 03 Feb 2024 05:52:10 -0500 + -- Thomas E. Dickey Sat, 10 Feb 2024 07:26:54 -0500 ncurses6 (5.9+20120608) unstable; urgency=low diff --git a/package/mingw-ncurses.nsi b/package/mingw-ncurses.nsi index 05db5415..8c34878f 100644 --- a/package/mingw-ncurses.nsi +++ b/package/mingw-ncurses.nsi @@ -1,4 +1,4 @@ -; $Id: mingw-ncurses.nsi,v 1.631 2024/02/03 10:52:10 tom Exp $ +; $Id: mingw-ncurses.nsi,v 1.632 2024/02/10 12:26:54 tom Exp $ ; TODO add examples ; TODO bump ABI to 6 @@ -10,7 +10,7 @@ !define VERSION_MAJOR "6" !define VERSION_MINOR "4" !define VERSION_YYYY "2024" -!define VERSION_MMDD "0203" +!define VERSION_MMDD "0210" !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD} !define MY_ABI "5" diff --git a/package/mingw-ncurses.spec b/package/mingw-ncurses.spec index 48824614..72b2e7b4 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.4 -Release: 20240203 +Release: 20240210 License: X11 Group: Development/Libraries URL: https://invisible-island.net/ncurses/ diff --git a/package/ncurses.spec b/package/ncurses.spec index 6af03fb9..df5949af 100644 --- a/package/ncurses.spec +++ b/package/ncurses.spec @@ -1,7 +1,7 @@ Summary: shared libraries for terminal handling Name: ncurses6 Version: 6.4 -Release: 20240203 +Release: 20240210 License: X11 Group: Development/Libraries URL: https://invisible-island.net/ncurses/ diff --git a/package/ncursest.spec b/package/ncursest.spec index c14511b6..719ebada 100644 --- a/package/ncursest.spec +++ b/package/ncursest.spec @@ -1,7 +1,7 @@ Summary: Curses library with POSIX thread support. Name: ncursest6 Version: 6.4 -Release: 20240203 +Release: 20240210 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/test/test.priv.h b/test/test.priv.h index 7b18557d..a901185b 100644 --- a/test/test.priv.h +++ b/test/test.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2022,2023 Thomas E. Dickey * + * Copyright 2018-2023,2024 Thomas E. Dickey * * Copyright 1998-2017,2018 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -30,7 +30,7 @@ /**************************************************************************** * Author: Thomas E. Dickey 1996-on * ****************************************************************************/ -/* $Id: test.priv.h,v 1.217 2023/11/11 00:23:26 tom Exp $ */ +/* $Id: test.priv.h,v 1.218 2024/02/10 14:40:03 tom Exp $ */ #ifndef __TEST_PRIV_H #define __TEST_PRIV_H 1 @@ -752,25 +752,27 @@ extern int optind; ," -V show version of curses" #if HAVE_CURSES_VERSION -#define format_version(buffer) strcpy(buffer, curses_version()) +#define format_version(buffer, size) strcpy(buffer, curses_version()) #elif defined(NCURSES_VERSION_MAJOR) && defined(NCURSES_VERSION_MINOR) && defined(NCURSES_VERSION_PATCH) -#define format_version(buffer) sprintf(buffer, "ncurses %d.%d.%d", \ - NCURSES_VERSION_MAJOR, \ - NCURSES_VERSION_MINOR, \ - NCURSES_VERSION_PATCH) +#define format_version(buffer, size) \ + _nc_SPRINTF(buffer, _nc_SLIMIT(size) "ncurses %d.%d.%d", \ + NCURSES_VERSION_MAJOR, \ + NCURSES_VERSION_MINOR, \ + NCURSES_VERSION_PATCH) #else -#define format_version(buffer) strcpy(buffer, "ncurses-examples") +#define format_version(buffer, size) strcpy(buffer, "ncurses-examples") #endif #define VERSION_COMMON() \ static char *version_common(char **argv) { \ char *base = argv[0]; \ char *part = strrchr(base, '/'); \ - char *result = malloc(strlen(base) + 80); \ + size_t need = strlen(base) + 80; \ + char *result = malloc(need); \ if (result != NULL) { \ if (part++ == NULL) part = base; \ - sprintf(result, "%.20s: ", part); \ - format_version(result + strlen(result)); \ + _nc_SPRINTF(result, _nc_SLIMIT(need) "%.20s: ", part); \ + format_version(result + strlen(result), need - strlen(result)); \ } \ return result; \ } \ @@ -1112,14 +1114,14 @@ extern int TABSIZE; #if HAVE_CLOCK_GETTIME # define GetClockTime(t) clock_gettime(CLOCK_REALTIME, t) # define TimeType struct timespec -# define TimeScale 1000000000L /* 1e9 */ +# define TimeScale 1000000000L /* 1e9 */ # define ElapsedSeconds(b,e) \ (double) (((e)->tv_sec - (b)->tv_sec) \ + ((e)->tv_nsec - (b)->tv_nsec) / TimeScale) #elif HAVE_GETTIMEOFDAY # define GetClockTime(t) gettimeofday(t, 0) # define TimeType struct timeval -# define TimeScale 1000000L /* 1e6 */ +# define TimeScale 1000000L /* 1e6 */ # define ElapsedSeconds(b,e) \ (double) (((e)->tv_sec - (b)->tv_sec) \ + ((e)->tv_usec - (b)->tv_usec) / TimeScale) diff --git a/test/test_mouse.c b/test/test_mouse.c index 91791050..126d2d6d 100644 --- a/test/test_mouse.c +++ b/test/test_mouse.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2022,2023 Thomas E. Dickey * + * Copyright 2022-2023,2024 Thomas E. Dickey * * Copyright 2022 Leonid S. Usov * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -22,7 +22,7 @@ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************/ /* - * $Id: test_mouse.c,v 1.28 2023/04/16 17:36:47 tom Exp $ + * $Id: test_mouse.c,v 1.29 2024/02/10 14:39:40 tom Exp $ * * Author: Leonid S Usov * @@ -152,6 +152,7 @@ main(int argc, char *argv[]) int interval = 0; int ch; MEVENT event; + size_t my_len; char *my_environ = NULL; const char *term_format = "TERM=%s"; @@ -164,9 +165,10 @@ main(int argc, char *argv[]) rawmode = TRUE; break; case 'T': - my_environ = malloc(strlen(term_format) + strlen(optarg)); + my_len = strlen(term_format) + strlen(optarg) + 1; + my_environ = malloc(my_len); if (my_environ != NULL) { - sprintf(my_environ, term_format, optarg); + _nc_SPRINTF(my_environ, _nc_SLIMIT(my_len) term_format, optarg); putenv(my_environ); } break; -- 2.45.0