Skip to content

Commit

Permalink
Use GCC case ranges more
Browse files Browse the repository at this point in the history
Simplifies the code; no change in behavior.

Suggested-by: Marek Marczykowski-Górecki <[email protected]>
  • Loading branch information
DemiMarie committed Jan 31, 2023
1 parent b566640 commit f6e93a8
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions qrexec-lib/unpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit f6e93a8

Please sign in to comment.