+ fixes for compiler warnings/cppcheck.
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
--- $Id: NEWS,v 1.3955 2023/05/20 18:39:29 tom Exp $
+-- $Id: NEWS,v 1.3957 2023/05/27 20:09:50 tom Exp $
-------------------------------------------------------------------------------
This is a log of changes that ncurses has gone through since Zeyd started
Changes through 1.9.9e did not credit all contributions;
it is not possible to add this information.
+20230527
+ + fixes for compiler warnings/cppcheck.
+
20230520
+ fixes for compiler warnings in MinGW environments.
-5:0:10 6.4 20230520
+5:0:10 6.4 20230527
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
-# $Id: dist.mk,v 1.1545 2023/05/20 14:39:41 tom Exp $
+# $Id: dist.mk,v 1.1546 2023/05/27 09:18:04 tom Exp $
# Makefile for creating ncurses distributions.
#
# This only needs to be used directly as a makefile by developers, but
# These define the major/minor/patch versions of ncurses.
NCURSES_MAJOR = 6
NCURSES_MINOR = 4
-NCURSES_PATCH = 20230520
+NCURSES_PATCH = 20230527
# We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_mouse.c,v 1.198 2023/03/25 23:27:28 tom Exp $")
+MODULE_ID("$Id: lib_mouse.c,v 1.199 2023/05/27 20:13:10 tom Exp $")
#include <tic.h>
{
bool result = FALSE;
- T((T_CALLED("_nc_mouse_init(%p)"), sp));
+ T((T_CALLED("_nc_mouse_init(%p)"), (void *)sp));
if (sp != 0) {
if (!sp->_mouse_initialized) {
/****************************************************************************
- * Copyright 2020,2021 Thomas E. Dickey *
+ * Copyright 2020-2021,2023 Thomas E. Dickey *
* Copyright 1998-2010,2011 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
#include <curses.priv.h>
-MODULE_ID("$Id: lib_refresh.c,v 1.47 2021/11/06 22:22:03 tom Exp $")
+MODULE_ID("$Id: lib_refresh.c,v 1.48 2023/05/27 20:13:10 tom Exp $")
NCURSES_EXPORT(int)
wrefresh(WINDOW *win)
});
if_WIDEC({
- static cchar_t blank = BLANK;
int last_dst = begx + ((last_src < win->_maxx)
? last_src
: win->_maxx);
*/
if (fix_left < dst_col || fix_right > last_dst) {
for (j = fix_left; j <= fix_right; ++j) {
+ static cchar_t blank = BLANK;
nline->text[j] = blank;
CHANGED_CELL(nline, j);
}
****************************************************************************/
/*
- * $Id: curses.priv.h,v 1.666 2023/05/20 18:20:39 tom Exp $
+ * $Id: curses.priv.h,v 1.667 2023/05/27 20:13:10 tom Exp $
*
* curses.priv.h
*
/* strings.c */
extern NCURSES_EXPORT(string_desc *) _nc_str_init (string_desc *, char *, size_t);
extern NCURSES_EXPORT(string_desc *) _nc_str_null (string_desc *, size_t);
-extern NCURSES_EXPORT(string_desc *) _nc_str_copy (string_desc *, string_desc *);
+extern NCURSES_EXPORT(string_desc *) _nc_str_copy (string_desc *, const string_desc *);
extern NCURSES_EXPORT(bool) _nc_safe_strcat (string_desc *, const char *);
extern NCURSES_EXPORT(bool) _nc_safe_strcpy (string_desc *, const char *);
extern NCURSES_EXPORT(int) _nc_setup_tinfo(const char *, TERMTYPE2 *);
extern NCURSES_EXPORT(int) _nc_setupscreen (int, int, FILE *, int, int);
extern NCURSES_EXPORT(int) _nc_timed_wait (SCREEN *, int, int, int * EVENTLIST_2nd(_nc_eventlist *));
-extern NCURSES_EXPORT(int) _nc_trans_string (char *, char *);
+extern NCURSES_EXPORT(int) _nc_trans_string (char *, const char *);
extern NCURSES_EXPORT(void) _nc_init_termtype (TERMTYPE2 *const);
extern NCURSES_EXPORT(void) _nc_do_color (int, int, int, NCURSES_OUTC);
extern NCURSES_EXPORT(void) _nc_flush (void);
extern NCURSES_EXPORT(void) _nc_db_iterator_leaks(void);
extern NCURSES_EXPORT(void) _nc_keyname_leaks(void);
extern NCURSES_EXPORT(void) _nc_names_leaks(void);
-extern NCURSES_EXPORT(void) _nc_tgetent_leak(TERMINAL *);
+extern NCURSES_EXPORT(void) _nc_tgetent_leak(const TERMINAL *);
extern NCURSES_EXPORT(void) _nc_tgetent_leaks(void);
#endif
#include <tic.h>
-MODULE_ID("$Id: alloc_ttype.c,v 1.48 2023/04/22 15:50:28 tom Exp $")
+MODULE_ID("$Id: alloc_ttype.c,v 1.49 2023/05/27 20:13:10 tom Exp $")
#if NCURSES_XNAMES
/*
int j, k;
DEBUG(3, (T_CALLED("adjust_cancels(%s), from(%s)"),
- to ? NonNull(to->term_names) : "?",
- from ? NonNull(from->term_names) : "?"));
+ NonNull(to->term_names),
+ NonNull(from->term_names)));
for (j = first; j < last;) {
char *name = to->ext_Names[j];
int j_str = to->num_Strings - first - to->ext_Strings;
#include <tic.h>
-MODULE_ID("$Id: comp_parse.c,v 1.132 2023/05/20 18:08:48 tom Exp $")
+MODULE_ID("$Id: comp_parse.c,v 1.133 2023/05/27 20:13:10 tom Exp $")
static void sanity_check2(TERMTYPE2 *, bool);
NCURSES_IMPEXP void (NCURSES_API *_nc_check_termtype2) (TERMTYPE2 *, bool) = sanity_check2;
if (_nc_tail) {
/* set up the head pointer */
- for (_nc_head = _nc_tail; _nc_head->last; _nc_head = _nc_head->last)
- continue;
+ for (_nc_head = _nc_tail; _nc_head->last; _nc_head = _nc_head->last) {
+ /* EMPTY */ ;
+ }
DEBUG(2, ("head = %s", _nc_head->tterm.term_names));
DEBUG(2, ("tail = %s", _nc_tail->tterm.term_names));
#include <ctype.h>
#include <tic.h>
-MODULE_ID("$Id: comp_scan.c,v 1.121 2023/05/20 18:33:33 tom Exp $")
+MODULE_ID("$Id: comp_scan.c,v 1.122 2023/05/27 20:13:10 tom Exp $")
/*
* Maximum length of string capability we'll accept before raising an error.
static NCURSES_INLINE int
eat_escaped_newline(int ch)
{
- if (ch == '\\')
- while ((ch = next_char()) == '\n' || iswhite(ch))
- continue;
+ if (ch == '\\') {
+ while ((ch = next_char()) == '\n' || iswhite(ch)) {
+ /* EMPTY */ ;
+ }
+ }
return ch;
}
while ((ch = next_char()) == '\n' || iswhite(ch)) {
if (ch == '\n')
had_newline = TRUE;
- continue;
}
ch = eat_escaped_newline(ch);
dot_flag = TRUE;
DEBUG(8, ("dot-flag set"));
- while ((ch = next_char()) == '.' || iswhite(ch))
- continue;
+ while ((ch = next_char()) == '.' || iswhite(ch)) {
+ /* EMPTY */ ;
+ }
}
if (ch == EOF) {
/* throw away trailing /, *$/ */
for (--tok_ptr;
iswhite(*tok_ptr) || *tok_ptr == ',';
- tok_ptr--)
- continue;
+ tok_ptr--) {
+ /* EMPTY */ ;
+ }
tok_ptr[1] = '\0';
}
*/
NCURSES_EXPORT(int)
-_nc_trans_string(char *ptr, char *last)
+_nc_trans_string(char *ptr, const char *const last)
{
int count = 0;
int number = 0;
/****************************************************************************
- * Copyright 2019-2021,2022 Thomas E. Dickey *
+ * Copyright 2019-2022,2023 Thomas E. Dickey *
* Copyright 2006-2012,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
#include <tic.h>
-MODULE_ID("$Id: entries.c,v 1.34 2022/08/13 16:57:35 tom Exp $")
+MODULE_ID("$Id: entries.c,v 1.35 2023/05/27 20:13:10 tom Exp $")
/****************************************************************************
*
NCURSES_EXPORT_VAR(ENTRY *) _nc_tail = 0;
static ENTRY *
-_nc_delink_entry(ENTRY * headp, TERMTYPE2 *tterm)
+_nc_delink_entry(ENTRY * headp, const TERMTYPE2 *const tterm)
/* delink the allocated storage for the given list entry */
{
ENTRY *ep, *last;
/****************************************************************************
- * Copyright 2018,2020 Thomas E. Dickey *
+ * Copyright 2018-2020,2023 Thomas E. Dickey *
* Copyright 1998-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_termcap.c,v 1.88 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: lib_termcap.c,v 1.89 2023/05/27 20:13:10 tom Exp $")
NCURSES_EXPORT_VAR(char *) UP = 0;
NCURSES_EXPORT_VAR(char *) BC = 0;
#undef CacheInx
#define CacheInx num
NCURSES_EXPORT(void)
-_nc_tgetent_leak(TERMINAL *termp)
+_nc_tgetent_leak(const TERMINAL *const termp)
{
if (termp != 0) {
int num;
/****************************************************************************
- * Copyright 2020 Thomas E. Dickey *
+ * Copyright 2020,2023 Thomas E. Dickey *
* Copyright 2000-2012,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
#include <curses.priv.h>
#include <tic.h>
-MODULE_ID("$Id: strings.c,v 1.10 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: strings.c,v 1.11 2023/05/27 20:13:10 tom Exp $")
/****************************************************************************
* Useful string functions (especially for mvcur)
* Copy a descriptor
*/
NCURSES_EXPORT(string_desc *)
-_nc_str_copy(string_desc * dst, string_desc * src)
+_nc_str_copy(string_desc * dst, const string_desc * const src)
{
*dst = *src;
return dst;
#include <tic.h>
-MODULE_ID("$Id: write_entry.c,v 1.126 2023/04/29 20:30:57 tom Exp $")
+MODULE_ID("$Id: write_entry.c,v 1.127 2023/05/27 20:13:10 tom Exp $")
#if 1
#define TRACE_OUT(p) DEBUG(2, p)
char dir[sizeof(LEAF_FMT)];
char *s = 0;
- if (code == 0 || (s = (strchr) (dirnames, code)) == 0)
+ if (code == 0 || (s = (strchr) (dirnames, code)) == 0) {
_nc_err_abort("Illegal terminfo subdirectory \"" LEAF_FMT "\"", code);
-
- if (verified[s - dirnames])
- return;
-
- _nc_SPRINTF(dir, _nc_SLIMIT(sizeof(dir)) LEAF_FMT, code);
- if (make_db_root(dir) < 0) {
- _nc_err_abort("%s/%s: permission denied", _nc_tic_dir(0), dir);
+ } else if (!verified[s - dirnames]) {
+ _nc_SPRINTF(dir, _nc_SLIMIT(sizeof(dir)) LEAF_FMT, code);
+ if (make_db_root(dir) < 0) {
+ _nc_err_abort("%s/%s: permission denied", _nc_tic_dir(0), dir);
+ } else {
+ verified[s - dirnames] = TRUE;
+ }
}
-
- verified[s - dirnames] = TRUE;
}
#endif /* !USE_HASHED_DB */
if (ptr != name_list) {
*ptr = '\0';
- for (ptr = name_list; *ptr != '\0' && *ptr != '|'; ptr++)
- continue;
+ for (ptr = name_list; *ptr != '\0' && *ptr != '|'; ptr++) {
+ /* EMPTY */ ;
+ }
if (*ptr == '\0')
other_names = ptr;
/****************************************************************************
- * Copyright 2019-2020,2021 Thomas E. Dickey *
+ * Copyright 2019-2021,2023 Thomas E. Dickey *
* Copyright 2001-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
#include <tic.h>
#include <ctype.h>
-MODULE_ID("$Id: visbuf.c,v 1.53 2021/02/27 20:07:57 tom Exp $")
+MODULE_ID("$Id: visbuf.c,v 1.54 2023/05/27 20:13:10 tom Exp $")
#define NUM_VISBUFS 4
static char *
_nc_vischar(char *tp, unsigned c LIMIT_ARG)
{
- if (c == '"' || c == '\\') {
+ if (tp == NULL) {
+ return NULL;
+ } else if (c == '"' || c == '\\') {
*tp++ = '\\';
*tp++ = (char) c;
} else if (is7bits((int) c) && (isgraph((int) c) || c == ' ')) {
-ncurses6 (6.4+20230520) unstable; urgency=low
+ncurses6 (6.4+20230527) unstable; urgency=low
* latest weekly patch
- -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 20 May 2023 10:39:41 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 27 May 2023 05:18:04 -0400
ncurses6 (5.9+20131005) unstable; urgency=low
-ncurses6 (6.4+20230520) unstable; urgency=low
+ncurses6 (6.4+20230527) unstable; urgency=low
* latest weekly patch
- -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 20 May 2023 10:39:41 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 27 May 2023 05:18:04 -0400
ncurses6 (5.9+20131005) unstable; urgency=low
-ncurses6 (6.4+20230520) unstable; urgency=low
+ncurses6 (6.4+20230527) unstable; urgency=low
* latest weekly patch
- -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 20 May 2023 10:39:41 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 27 May 2023 05:18:04 -0400
ncurses6 (5.9+20120608) unstable; urgency=low
-; $Id: mingw-ncurses.nsi,v 1.585 2023/05/20 14:39:41 tom Exp $\r
+; $Id: mingw-ncurses.nsi,v 1.586 2023/05/27 09:18:04 tom Exp $\r
\r
; TODO add examples\r
; TODO bump ABI to 6\r
!define VERSION_MAJOR "6"\r
!define VERSION_MINOR "4"\r
!define VERSION_YYYY "2023"\r
-!define VERSION_MMDD "0520"\r
+!define VERSION_MMDD "0527"\r
!define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}\r
\r
!define MY_ABI "5"\r
Summary: shared libraries for terminal handling
Name: mingw32-ncurses6
Version: 6.4
-Release: 20230520
+Release: 20230527
License: X11
Group: Development/Libraries
URL: https://invisible-island.net/ncurses/
Summary: shared libraries for terminal handling
Name: ncurses6
Version: 6.4
-Release: 20230520
+Release: 20230527
License: X11
Group: Development/Libraries
URL: https://invisible-island.net/ncurses/
Summary: Curses library with POSIX thread support.
Name: ncursest6
Version: 6.4
-Release: 20230520
+Release: 20230527
License: X11
Group: Development/Libraries
Source: ncurses-%{version}-%{release}.tgz
#include <termsort.h> /* this C file is generated */
#include <parametrized.h> /* so is this */
-MODULE_ID("$Id: dump_entry.c,v 1.195 2023/01/21 21:25:21 tom Exp $")
+MODULE_ID("$Id: dump_entry.c,v 1.196 2023/05/27 20:13:10 tom Exp $")
#define DISCARD(string) string = ABSENT_STRING
#define PRINTF (void) printf
}
static bool
-kill_string(TERMTYPE2 *tterm, char *cap)
+kill_string(TERMTYPE2 *tterm, const char *const cap)
{
unsigned n;
for (n = 0; n < NUM_STRINGS(tterm); ++n) {
outbuf.used = (size_t) j;
} else if (!infodump && ch == '\\') {
outbuf.used = (size_t) j;
- } else if (ch == delim && (j == 0 || outbuf.text[j - 1] != '\\')) {
+ } else if (ch == delim && (outbuf.text[j - 1] != '\\')) {
outbuf.used = (size_t) (j + 1);
} else {
break;
/****************************************************************************
- * Copyright 2020-2021,2022 Thomas E. Dickey *
+ * Copyright 2020-2022,2023 Thomas E. Dickey *
* Copyright 1998-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
#include <dump_entry.h>
-MODULE_ID("$Id: infocmp.c,v 1.156 2022/09/24 10:13:06 tom Exp $")
+MODULE_ID("$Id: infocmp.c,v 1.157 2023/05/27 20:13:10 tom Exp $")
#define MAX_STRING 1024 /* maximum formatted string */
}
static bool
-no_string(char *value)
+no_string(const char *const value)
{
bool result = (value == ABSENT_STRING);
if (!strcmp(s_absent, s_cancel))
/****************************************************************************
- * Copyright 2020-2021,2022 Thomas E. Dickey *
+ * Copyright 2020-2022,2023 Thomas E. Dickey *
* Copyright 2008-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
#include <progs.priv.h>
#include <tty_settings.h>
-MODULE_ID("$Id: tabs.c,v 1.51 2022/02/26 22:44:44 tom Exp $")
+MODULE_ID("$Id: tabs.c,v 1.52 2023/05/27 20:13:10 tom Exp $")
static GCC_NORETURN void usage(void);
}
static void
-print_ruler(int *tab_list, const char *new_line)
+print_ruler(const int *const tab_list, const char *new_line)
{
int last = 0;
int n;
/* set tty modes to -ocrnl to allow \r */
if (isatty(STDOUT_FILENO)) {
TTY new_settings = tty_settings;
- new_settings.c_oflag &= (unsigned)~OCRNL;
+ new_settings.c_oflag &= (unsigned) ~OCRNL;
update_tty_settings(&tty_settings, &new_settings);
change_tty = TRUE;
new_line = "\r\n";
#include <parametrized.h>
#include <transform.h>
-MODULE_ID("$Id: tic.c,v 1.321 2023/04/08 15:51:57 tom Exp $")
+MODULE_ID("$Id: tic.c,v 1.322 2023/05/27 20:13:10 tom Exp $")
#define STDIN_NAME "<stdin>"
char *q;
memset(mapped, 0, sizeof(mapped));
+ memset(missing, 0, sizeof(missing));
for (p = acs_chars; *p != '\0'; p += 2) {
if (p[1] == '\0') {
_nc_warning("acsc has odd number of characters");
for (j = 0; j < 4; ++j) {
skip[j] = FALSE;
for (k = 0; k < j; ++k) {
- if (j != k
- && !strcmp(list[j], list[k])) {
+ if (!strcmp(list[j], list[k])) {
char *value = _nc_tic_expand(list[k], TRUE, 0);
_nc_warning("repeated cursor control %s", value);
repeated = TRUE;
check_infotocap(TERMTYPE2 *tp, int i, const char *value)
{
const char *name = ExtStrname(tp, i, strnames);
- int params = ((i < (int) SIZEOF(parametrized))
- ? parametrized[i]
- : ((*value == 'k')
- ? 0
- : has_params(value, FALSE)));
char *ti_value = NULL;
- char *tc_value;
- bool embedded;
assert(SIZEOF(parametrized) == STRCOUNT);
if (!VALID_STRING(value) || (ti_value = strdup(value)) == NULL) {
_nc_warning("tic-expansion of %s failed", name);
- } else if ((tc_value = _nc_infotocap(name, ti_value, params)) == ABSENT_STRING) {
- _nc_warning("tic-conversion of %s failed", name);
- } else if (params > 0) {
- int limit = 5;
- int count;
- bool first = TRUE;
-
- if (!strcmp(name, "setf")
- || !strcmp(name, "setb")
- || !strcmp(name, "setaf")
- || !strcmp(name, "setab")) {
- if ((limit = max_colors) > 256)
- limit = 256;
- }
- for (count = 0; count < limit; ++count) {
- char *ti_check = check_1_infotocap(name, ti_value, count);
- char *tc_check = check_1_infotocap(name, tc_value, count);
-
- if (strcmp(ti_check, tc_check)) {
- if (first) {
- fprintf(stderr, "check_infotocap(%s)\n", name);
- fprintf(stderr, "...ti '%s'\n", _nc_visbuf2(0, ti_value));
- fprintf(stderr, "...tc '%s'\n", _nc_visbuf2(0, tc_value));
- first = FALSE;
+ } else {
+ char *tc_value;
+ bool embedded;
+ int params = ((i < (int) SIZEOF(parametrized))
+ ? parametrized[i]
+ : ((*value == 'k')
+ ? 0
+ : has_params(value, FALSE)));
+
+ if ((tc_value = _nc_infotocap(name, ti_value, params)) == ABSENT_STRING) {
+ _nc_warning("tic-conversion of %s failed", name);
+ } else if (params > 0) {
+ int limit = 5;
+ int count;
+ bool first = TRUE;
+
+ if (!strcmp(name, "setf")
+ || !strcmp(name, "setb")
+ || !strcmp(name, "setaf")
+ || !strcmp(name, "setab")) {
+ if ((limit = max_colors) > 256)
+ limit = 256;
+ }
+ for (count = 0; count < limit; ++count) {
+ char *ti_check = check_1_infotocap(name, ti_value, count);
+ char *tc_check = check_1_infotocap(name, tc_value, count);
+
+ if (strcmp(ti_check, tc_check)) {
+ if (first) {
+ fprintf(stderr, "check_infotocap(%s)\n", name);
+ fprintf(stderr, "...ti '%s'\n", _nc_visbuf2(0, ti_value));
+ fprintf(stderr, "...tc '%s'\n", _nc_visbuf2(0, tc_value));
+ first = FALSE;
+ }
+ _nc_warning("tparm-conversion of %s(%d) differs between\n\tterminfo %s\n\ttermcap %s",
+ name, count,
+ _nc_visbuf2(0, ti_check),
+ _nc_visbuf2(1, tc_check));
}
- _nc_warning("tparm-conversion of %s(%d) differs between\n\tterminfo %s\n\ttermcap %s",
- name, count,
- _nc_visbuf2(0, ti_check),
- _nc_visbuf2(1, tc_check));
+ free(ti_check);
+ free(tc_check);
+ }
+ } else if (params == 0 && !same_ti_tc(ti_value, tc_value, &embedded)) {
+ if (embedded) {
+ _nc_warning("termcap equivalent of %s cannot use embedded delay", name);
+ } else {
+ _nc_warning("tic-conversion of %s changed value\n\tfrom %s\n\tto %s",
+ name, ti_value, tc_value);
}
- free(ti_check);
- free(tc_check);
- }
- } else if (params == 0 && !same_ti_tc(ti_value, tc_value, &embedded)) {
- if (embedded) {
- _nc_warning("termcap equivalent of %s cannot use embedded delay", name);
- } else {
- _nc_warning("tic-conversion of %s changed value\n\tfrom %s\n\tto %s",
- name, ti_value, tc_value);
}
+ free(ti_value);
}
- free(ti_value);
}
static char *
/****************************************************************************
- * Copyright 2018-2021,2022 Thomas E. Dickey *
+ * Copyright 2018-2022,2023 Thomas E. Dickey *
* Copyright 1998-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* v2.0 featuring strict ANSI/POSIX conformance, November 1993.
* v2.1 with ncurses mouse support, September 1995
*
- * $Id: bs.c,v 1.78 2022/12/11 00:18:37 tom Exp $
+ * $Id: bs.c,v 1.79 2023/05/27 20:13:10 tom Exp $
*/
#include <test.priv.h>
ch = toupper(ch);
if (is_QUIT(ch))
uninitgame(0);
- for (s1 = s; *s1 && ch != *s1; ++s1)
- continue;
+ for (s1 = s; *s1 && ch != *s1; ++s1) {
+ /* EMPTY */ ;
+ }
if (*s1) {
AddCh(ch);
(void) refresh();
}
}
} else
- while ((turn ? cputurn() : plyturn()) && awinna() == -1)
- continue;
+ while ((turn ? cputurn() : plyturn()) && awinna() == -1) {
+ /* EMPTY */ ;
+ }
turn = OTHER;
}
} while
/****************************************************************************
- * Copyright 2018-2020,2022 Thomas E. Dickey *
+ * Copyright 2018-2022,2023 Thomas E. Dickey *
* Copyright 2003-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* authorization. *
****************************************************************************/
/*
- * $Id: demo_forms.c,v 1.61 2022/12/04 00:40:11 tom Exp $
+ * $Id: demo_forms.c,v 1.62 2023/05/27 20:13:10 tom Exp $
*
* Demonstrate a variety of functions from the form library.
* Thomas Dickey - 2003/4/26
#define O_SELECTABLE (O_ACTIVE | O_VISIBLE)
static FIELD *
-another_field(FORM *form, FIELD *field)
+another_field(FORM *form, const FIELD *const field)
{
FIELD **f = form_fields(form);
FIELD *result = 0;
/****************************************************************************
- * Copyright 2019-2021,2022 Thomas E. Dickey *
+ * Copyright 2019-2022,2023 Thomas E. Dickey *
* Copyright 2003-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* authorization. *
****************************************************************************/
/*
- * $Id: demo_menus.c,v 1.79 2022/12/04 00:40:11 tom Exp $
+ * $Id: demo_menus.c,v 1.80 2023/05/27 20:13:10 tom Exp $
*
* Demonstrate a variety of functions from the menu library.
* Thomas Dickey - 2005/4/9
}
if (code == E_REQUEST_DENIED)
beep();
- continue;
}
}
/****************************************************************************
- * Copyright 2019-2021,2022 Thomas E. Dickey *
+ * Copyright 2019-2022,2023 Thomas E. Dickey *
* Copyright 2005-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
/*
* Author: Thomas E. Dickey
*
- * $Id: demo_termcap.c,v 1.64 2022/12/10 23:22:09 tom Exp $
+ * $Id: demo_termcap.c,v 1.65 2023/05/27 20:13:10 tom Exp $
*
* A simple demo of the termcap interface.
*/
#define EachCapName(n) n = 33; n < 127; ++n
static char *
-make_dbitem(char *p, char *q)
+make_dbitem(const char *const p, const char *const q)
{
size_t need = strlen(e_opt) + 2 + (size_t) (p - q);
char *result = malloc(need);
static void
parse_description(const char *input_name)
{
- static char empty[1];
+ static char empty[1] =
+ {0};
FILE *fp;
struct stat sb;
failed("cannot allocate memory for input-file");
}
- if ((fp = fopen(input_name, "r")) == 0)
+ if ((fp = fopen(input_name, "r")) == 0) {
failed("cannot open input-file");
- len = fread(my_blob, sizeof(char), (size_t) sb.st_size, fp);
- my_blob[sb.st_size] = '\0';
- fclose(fp);
+ } else {
+ len = fread(my_blob, sizeof(char), (size_t) sb.st_size, fp);
+ my_blob[sb.st_size] = '\0';
+ fclose(fp);
+ }
/*
* First, get rid of comments and escaped newlines, as well as repeated
/****************************************************************************
- * Copyright 2019-2021,2022 Thomas E. Dickey *
+ * Copyright 2019-2022,2023 Thomas E. Dickey *
* Copyright 2009-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
/*
* Author: Thomas E. Dickey
*
- * $Id: demo_terminfo.c,v 1.56 2022/12/10 23:22:09 tom Exp $
+ * $Id: demo_terminfo.c,v 1.57 2023/05/27 20:13:10 tom Exp $
*
* A simple demo of the terminfo interface.
*/
#define FNAME(type) "%s %-*s = ", #type, f_opt ? 24 : FCOLS
static char *
-make_dbitem(char *p, char *q)
+make_dbitem(const char *const p, const char *const q)
{
size_t need = strlen(e_opt) + 2 + (size_t) (p - q);
char *result = malloc(need);
static void
parse_description(const char *input_name)
{
- static char empty[1];
+ static char empty[1] =
+ {0};
FILE *fp;
struct stat sb;
failed("cannot allocate memory for input-file");
}
- if ((fp = fopen(input_name, "r")) == 0)
+ if ((fp = fopen(input_name, "r")) == 0) {
failed("cannot open input-file");
- len = fread(my_blob, sizeof(char), (size_t) sb.st_size, fp);
- my_blob[sb.st_size] = '\0';
- fclose(fp);
+ } else {
+ len = fread(my_blob, sizeof(char), (size_t) sb.st_size, fp);
+ my_blob[sb.st_size] = '\0';
+ fclose(fp);
+ }
/*
* First, get rid of comments and escaped newlines, as well as repeated
/****************************************************************************
- * Copyright 2019-2020,2022 Thomas E. Dickey *
+ * Copyright 2019-2022,2023 Thomas E. Dickey *
* Copyright 2006-2014,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* authorization. *
****************************************************************************/
/*
- * $Id: echochar.c,v 1.25 2022/12/10 22:28:50 tom Exp $
+ * $Id: echochar.c,v 1.26 2023/05/27 20:13:10 tom Exp $
*
* Demonstrate the echochar function (compare to dots.c).
* Thomas Dickey - 2006/11/4
}
static void
-set_color(char *my_pairs, int fg, int bg)
+set_color(const char *const my_pairs, int fg, int bg)
{
int pair = (fg * COLORS) + bg;
if (pair < COLOR_PAIRS) {
/****************************************************************************
- * Copyright 2018-2021,2022 Thomas E. Dickey *
+ * Copyright 2018-2022,2023 Thomas E. Dickey *
* Copyright 2006-2013,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* authorization. *
****************************************************************************/
/*
- * $Id: movewindow.c,v 1.53 2022/12/10 23:31:31 tom Exp $
+ * $Id: movewindow.c,v 1.54 2023/05/27 20:13:10 tom Exp $
*
* Demonstrate move functions for windows and derived windows from the curses
* library.
all_windows = typeRealloc(FRAME, need, all_windows);
if (!all_windows)
failed("add_window");
+ have = need;
}
all_windows[num_windows].parent = parent;
all_windows[num_windows].child = child;
}
static int
-window2num(WINDOW *win)
+window2num(const WINDOW *const win)
{
int n;
int result = -1;
}
static void
-recur_move_window(WINDOW *parent, int dy, int dx)
+recur_move_window(const WINDOW *const parent, int dy, int dx)
{
unsigned n;
Author: Eric S. Raymond <esr@snark.thyrsus.com> 1993
Thomas E. Dickey (beginning revision 1.27 in 1996).
-$Id: ncurses.c,v 1.534 2023/02/25 19:30:27 tom Exp $
+$Id: ncurses.c,v 1.535 2023/05/27 20:13:10 tom Exp $
***************************************************************************/
* Resize both and paint the box in the parent.
*/
static void
-resize_boxes(unsigned level, WINDOW *win)
+resize_boxes(unsigned level, const WINDOW *const win)
{
unsigned n;
int base = 5;
*/
#if defined(KEY_RESIZE) && HAVE_WRESIZE
static void
-resize_wide_boxes(unsigned level, WINDOW *win)
+resize_wide_boxes(unsigned level, const WINDOW *const win)
{
unsigned n;
int base = 5;
break;
if (c == E_REQUEST_DENIED)
beep();
- continue;
}
MvPrintw(LINES - 2, 0,
set_item_value(*ip, TRUE);
}
- while (run_trace_menu(m))
- continue;
+ while (run_trace_menu(m)) {
+ /* EMPTY */ ;
+ }
newtrace = 0;
for (ip = menu_items(m); *ip; ip++)
/****************************************************************************
- * Copyright 2020,2022 Thomas E. Dickey *
+ * Copyright 2020-2022,2023 Thomas E. Dickey *
* Copyright 2009-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* authorization. *
****************************************************************************/
/*
- * $Id: test_addwstr.c,v 1.21 2022/12/10 22:28:50 tom Exp $
+ * $Id: test_addwstr.c,v 1.22 2023/05/27 20:13:10 tom Exp $
*
* Demonstrate the waddwstr() and wadd_wch functions.
* Thomas Dickey - 2009/9/12
}
static int
-ColOf(wchar_t *buffer, int length, int margin)
+ColOf(const wchar_t *const buffer, int length, int margin)
{
int n;
int result;
/****************************************************************************
- * Copyright 2022 Thomas E. Dickey *
+ * Copyright 2022,2023 Thomas E. Dickey *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
****************************************************************************/
/*
- * $Id: test_delwin.c,v 1.4 2022/12/10 22:14:07 tom Exp $
+ * $Id: test_delwin.c,v 1.5 2023/05/27 20:34:51 tom Exp $
*/
#include <test.priv.h>
show_rc("Deleted parent",
"should fail, it still has a subwindow",
- rc = delwin(parent));
+ delwin(parent));
next_step(stdscr);
show_rc("Deleted child1",
"should succeed",
/****************************************************************************
- * Copyright 2019-2021,2022 Thomas E. Dickey *
+ * Copyright 2019-2022,2023 Thomas E. Dickey *
* Copyright 2015-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
/*
* Author: Thomas E. Dickey
*
- * $Id: test_sgr.c,v 1.21 2022/12/10 23:23:27 tom Exp $
+ * $Id: test_sgr.c,v 1.22 2023/05/27 20:13:10 tom Exp $
*
* A simple demo of the sgr/sgr0 terminal capabilities.
*/
static long total_values;
static char *
-make_dbitem(char *p, char *q)
+make_dbitem(const char *const p, const char *const q)
{
size_t need = strlen(e_opt) + 2 + (size_t) (p - q);
char *result = malloc(need);