summaryrefslogtreecommitdiff
path: root/ncurses/trace/lib_traceatr.c
diff options
context:
space:
mode:
Diffstat (limited to 'ncurses/trace/lib_traceatr.c')
-rw-r--r--ncurses/trace/lib_traceatr.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/ncurses/trace/lib_traceatr.c b/ncurses/trace/lib_traceatr.c
index b36286253d6d..63dc9f22dfe5 100644
--- a/ncurses/trace/lib_traceatr.c
+++ b/ncurses/trace/lib_traceatr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright 2018-2022,2024 Thomas E. Dickey *
+ * Copyright 2018-2024,2025 Thomas E. Dickey *
* Copyright 1998-2017,2018 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -44,7 +44,7 @@
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_traceatr.c,v 1.96 2024/02/04 00:11:35 tom Exp $")
+MODULE_ID("$Id: lib_traceatr.c,v 1.101 2025/11/16 16:08:54 tom Exp $")
#define COLOR_OF(c) ((c < 0) ? "default" : (c > 7 ? color_of(c) : colors[c].name))
@@ -126,7 +126,7 @@ _traceattr2(int bufnum, chtype newmode)
#undef DATA
char *result = _nc_trace_buf(bufnum, (size_t) BUFSIZ);
- if (result != 0) {
+ if (result != NULL) {
size_t n;
unsigned save_nc_tracing = _nc_tracing;
@@ -167,7 +167,7 @@ _traceattr2(int bufnum, chtype newmode)
}
}
if (ChAttrOf(newmode) == A_NORMAL) {
- if (result != 0 && result[1] != '\0')
+ if (result != NULL && result[1] != '\0')
(void) _nc_trace_bufcat(bufnum, "|");
(void) _nc_trace_bufcat(bufnum, "A_NORMAL");
}
@@ -248,14 +248,14 @@ _nc_altcharset_name(attr_t attr, chtype ch)
};
#undef DATA
- const char *result = 0;
+ const char *result = NULL;
#if NCURSES_SP_FUNCS
(void) sp;
#endif
- if (SP_PARM != 0 && (attr & A_ALTCHARSET) && (acs_chars != 0)) {
+ if (SP_PARM != NULL && (attr & A_ALTCHARSET) && (acs_chars != NULL)) {
char *cp;
- char *found = 0;
+ const char *found = NULL;
for (cp = acs_chars; cp[0] && cp[1]; cp += 2) {
if (ChCharOf(UChar(cp[1])) == ChCharOf(ch)) {
@@ -264,7 +264,7 @@ _nc_altcharset_name(attr_t attr, chtype ch)
}
}
- if (found != 0) {
+ if (found != NULL) {
size_t n;
ch = ChCharOf(UChar(*found));
@@ -284,12 +284,12 @@ _tracechtype2(int bufnum, chtype ch)
{
char *result = _nc_trace_buf(bufnum, (size_t) BUFSIZ);
- if (result != 0) {
+ if (result != NULL) {
const char *found;
attr_t attr = ChAttrOf(ch);
_nc_STRCPY(result, l_brace, TRACE_BUF_SIZE(bufnum));
- if ((found = _nc_altcharset_name(attr, ch)) != 0) {
+ if ((found = _nc_altcharset_name(attr, ch)) != NULL) {
(void) _nc_trace_bufcat(bufnum, found);
attr &= ~A_ALTCHARSET;
} else
@@ -328,13 +328,13 @@ _tracecchar_t2(int bufnum, const cchar_t *ch)
{
char *result = _nc_trace_buf(bufnum, (size_t) BUFSIZ);
- if (result != 0) {
+ if (result != NULL) {
_nc_STRCPY(result, l_brace, TRACE_BUF_SIZE(bufnum));
- if (ch != 0) {
+ if (ch != NULL) {
const char *found;
attr_t attr = AttrOfD(ch);
- if ((found = _nc_altcharset_name(attr, (chtype) CharOfD(ch))) != 0) {
+ if ((found = _nc_altcharset_name(attr, (chtype) CharOfD(ch))) != NULL) {
(void) _nc_trace_bufcat(bufnum, found);
attr &= ~A_ALTCHARSET;
} else if (isWidecExt(CHDEREF(ch))) {
@@ -363,7 +363,7 @@ _tracecchar_t2(int bufnum, const cchar_t *ch)
UChar(ch->chars[PUTC_i])));
}
break;
- } else if (ch->chars[PUTC_i] > assume_unicode) {
+ } else if ((int) ch->chars[PUTC_i] > assume_unicode) {
char temp[80];
_nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp))
"{%d:\\u%04lx}",
@@ -371,7 +371,7 @@ _tracecchar_t2(int bufnum, const cchar_t *ch)
(unsigned long) ch->chars[PUTC_i]);
(void) _nc_trace_bufcat(bufnum, temp);
attr &= ~A_CHARTEXT; /* ignore WidecExt(ch) */
- } else {
+ } else if (PUTC_n > 1 || !is8bits(ch->chars[PUTC_i])) {
for (n = 0; n < PUTC_n; n++) {
if (n)
(void) _nc_trace_bufcat(bufnum, ", ");
@@ -379,6 +379,11 @@ _tracecchar_t2(int bufnum, const cchar_t *ch)
_nc_tracechar(CURRENT_SCREEN,
UChar(PUTC_buf[n])));
}
+ } else {
+ char temp[2];
+ temp[0] = (char) ch->chars[PUTC_i];
+ temp[1] = 0;
+ (void) _nc_trace_bufcat(bufnum, temp);
}
}
(void) _nc_trace_bufcat(bufnum, " }");