From e89891fa5e27a1a6f895f45d324f2b407c41539b Mon Sep 17 00:00:00 2001 From: Andrew Aitchison Date: Wed, 4 Sep 2024 21:37:57 +0100 Subject: [PATCH 1/1] Debug: fix coding for signedness Broken-by: 2d75f09c2df0 --- src/src/string.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/src/string.c b/src/src/string.c index f652b3815..2b62233d8 100644 --- a/src/src/string.c +++ b/src/src/string.c @@ -1687,11 +1687,14 @@ while (*fp) case '{' : zg = string_catn(zg, US"{BO}", 4); break; case '}' : zg = string_catn(zg, US"{BC}", 4); break; default: - if ( (*s < 32) || (*s > 127) ) - zg = string_fmt_append(zg, "{%02x}", *s); + { + unsigned char u = *s; + if ( (u < 32) || (u > 127) ) + zg = string_fmt_append(zg, "{%02x}", u); else zg = string_catn(zg, US s, 1); break; + } } if (zg) { s = CS zg->s; precision = slen = gstring_length(zg); } else { s = ""; slen = 0; } -- 2.30.2