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.
This commit is contained in:
6
llex.c
6
llex.c
@@ -359,12 +359,12 @@ static int readhexaesc (LexState *ls) {
|
||||
** for error reporting in case of errors; 'i' counts the number of
|
||||
** saved characters, so that they can be removed if case of success.
|
||||
*/
|
||||
static unsigned long readutf8esc (LexState *ls) {
|
||||
unsigned long r;
|
||||
static l_uint32 readutf8esc (LexState *ls) {
|
||||
l_uint32 r;
|
||||
int i = 4; /* number of chars to be removed: start with #"\u{X" */
|
||||
save_and_next(ls); /* skip 'u' */
|
||||
esccheck(ls, ls->current == '{', "missing '{'");
|
||||
r = cast_ulong(gethexa(ls)); /* must have at least one digit */
|
||||
r = cast_uint(gethexa(ls)); /* must have at least one digit */
|
||||
while (cast_void(save_and_next(ls)), lisxdigit(ls->current)) {
|
||||
i++;
|
||||
esccheck(ls, r <= (0x7FFFFFFFu >> 4), "UTF-8 value too large");
|
||||
|
||||
Reference in New Issue
Block a user