From b7733aeef1b6e69e6bf4f9b416a48fc107ce0b55 Mon Sep 17 00:00:00 2001 From: herman ten brugge Date: Thu, 11 Aug 2022 08:37:00 +0200 Subject: [PATCH] Fix wchar_t strings with 'x', 'u' and 'U' --- tccpp.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tccpp.c b/tccpp.c index e033a29b..7a9cbcff 100644 --- a/tccpp.c +++ b/tccpp.c @@ -2163,13 +2163,16 @@ static void parse_escape_string(CString *outstr, const uint8_t *buf, int is_long c = c - '0'; else if (i > 0) expect("more hex digits in universal-character-name"); - else { - c = n; - goto add_char_nonext; - } + else + goto add_hex_or_ucn; n = n * 16 + c; p++; } while (--i); + if (is_long) { + add_hex_or_ucn: + c = n; + goto add_char_nonext; + } cstr_u8cat(outstr, n); continue; case 'a':