From f6e93a82436ebf8a6356a848be89d9ccb9193760 Mon Sep 17 00:00:00 2001 From: Demi Marie Obenour Date: Tue, 26 Jul 2022 14:26:24 -0400 Subject: [PATCH] Use GCC case ranges more MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Simplifies the code; no change in behavior. Suggested-by: Marek Marczykowski-Górecki --- qrexec-lib/unpack.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/qrexec-lib/unpack.c b/qrexec-lib/unpack.c index a0346844..3e241459 100644 --- a/qrexec-lib/unpack.c +++ b/qrexec-lib/unpack.c @@ -211,10 +211,7 @@ static int validate_utf8_char(const unsigned char *untrusted_c) { return 0; code_point = *untrusted_c & 0x3F; break; - case 0xE1: case 0xE2: case 0xE3: case 0xE4: - case 0xE5: case 0xE6: case 0xE7: case 0xE8: - case 0xE9: case 0xEA: case 0xEB: case 0xEC: - case 0xED: case 0xEE: case 0xEF: + case 0xE1 ... 0xEF: total_size = 3; tails_count = 2; code_point = *untrusted_c & 0xF; @@ -228,7 +225,7 @@ static int validate_utf8_char(const unsigned char *untrusted_c) { return 0; code_point = *untrusted_c & 0x3F; break; - case 0xF1: case 0xF2: case 0xF3: case 0xF4: + case 0xF1 ... 0xF4: total_size = 4; tails_count = 3; code_point = *untrusted_c & 0x7;