Skip to content

Commit

Permalink
Compose: Fix UTF-8 BOM detection
Browse files Browse the repository at this point in the history
The leading UTF-8 BOM detection code is misplaced as it is executed
after each EOL.

Fixed by moving the code before the goto labels.
  • Loading branch information
wismill committed Oct 30, 2023
1 parent 9e88718 commit 6c54681
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/compose/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,17 +527,17 @@ parse(struct xkb_compose_table *table, struct scanner *s,
enum { MAX_ERRORS = 10 };
int num_errors = 0;

/* Skip UTF-8 encoded BOM (U+FEFF) */
/* See: https://www.unicode.org/faq/utf_bom.html#bom5 */
scanner_str(s, "\xef\xbb\xbf", 3);

initial:
production.len = 0;
production.has_keysym = false;
production.has_string = false;
production.mods = 0;
production.modmask = 0;

/* Skip UTF-8 encoded BOM (U+FEFF) */
/* See: https://www.unicode.org/faq/utf_bom.html#bom5 */
scanner_str(s, "\xef\xbb\xbf", 3);

/* fallthrough */

initial_eol:
Expand Down

0 comments on commit 6c54681

Please sign in to comment.