aboutsummaryrefslogtreecommitdiff
path: root/llex.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-05-08 12:49:39 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-05-08 12:49:39 -0300
commitd827e96f33056bcc0daca0c04b3273604f9d5986 (patch)
treeec3d9fb723319edc0105d7bea652c8d07c064770 /llex.c
parent3f0ea90aa8b8493485637f6e8d2a070a1ac0d5cb (diff)
downloadlua-d827e96f33056bcc0daca0c04b3273604f9d5986.tar.gz
lua-d827e96f33056bcc0daca0c04b3273604f9d5986.tar.bz2
lua-d827e96f33056bcc0daca0c04b3273604f9d5986.zip
Using 'l_uint32' for unicode codepoints in scanner
'l_uint32' is enough for unicode codepoints (versus unsigned long), and the utf-8 library already uses that type.
Diffstat (limited to 'llex.c')
-rw-r--r--llex.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/llex.c b/llex.c
index 9d93224f..edeb48fe 100644
--- a/llex.c
+++ b/llex.c
@@ -359,12 +359,12 @@ static int readhexaesc (LexState *ls) {
359** for error reporting in case of errors; 'i' counts the number of 359** for error reporting in case of errors; 'i' counts the number of
360** saved characters, so that they can be removed if case of success. 360** saved characters, so that they can be removed if case of success.
361*/ 361*/
362static unsigned long readutf8esc (LexState *ls) { 362static l_uint32 readutf8esc (LexState *ls) {
363 unsigned long r; 363 l_uint32 r;
364 int i = 4; /* number of chars to be removed: start with #"\u{X" */ 364 int i = 4; /* number of chars to be removed: start with #"\u{X" */
365 save_and_next(ls); /* skip 'u' */ 365 save_and_next(ls); /* skip 'u' */
366 esccheck(ls, ls->current == '{', "missing '{'"); 366 esccheck(ls, ls->current == '{', "missing '{'");
367 r = cast_ulong(gethexa(ls)); /* must have at least one digit */ 367 r = cast_uint(gethexa(ls)); /* must have at least one digit */
368 while (cast_void(save_and_next(ls)), lisxdigit(ls->current)) { 368 while (cast_void(save_and_next(ls)), lisxdigit(ls->current)) {
369 i++; 369 i++;
370 esccheck(ls, r <= (0x7FFFFFFFu >> 4), "UTF-8 value too large"); 370 esccheck(ls, r <= (0x7FFFFFFFu >> 4), "UTF-8 value too large");