From 7909fc43507a0e352ad7b7c9ced60ef154a69f62 Mon Sep 17 00:00:00 2001 From: suda-morris <362953310@qq.com> Date: Sun, 13 Sep 2026 21:29:22 +0800 Subject: [PATCH] fix(cbortojson): keep strchr() result const for C23 GCC in C23 mode gives strchr() the const of its argument, so assigning the result into a char * is -Wdiscarded-qualifiers. That becomes a build error under -Werror. esc is only used as a pointer into the const escapeChars table, so const is correct. --- src/cbortojson.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cbortojson.c b/src/cbortojson.c index 9a1cccfd..58de1b17 100644 --- a/src/cbortojson.c +++ b/src/cbortojson.c @@ -341,7 +341,7 @@ static CborError escape_text_string(char **str, size_t *alloc, size_t *offsetp, static const char escapedChars[] = "btnrf\"\\"; unsigned char c = input[i]; - char *esc = c > 0 ? strchr(escapeChars, c) : NULL; + const char *esc = c > 0 ? strchr(escapeChars, c) : NULL; if (esc) { buf[offset++] = '\\'; buf[offset++] = escapedChars[esc - escapeChars];