diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-05-08 12:49:39 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-05-08 12:49:39 -0300 |
commit | d827e96f33056bcc0daca0c04b3273604f9d5986 (patch) | |
tree | ec3d9fb723319edc0105d7bea652c8d07c064770 /lobject.c | |
parent | 3f0ea90aa8b8493485637f6e8d2a070a1ac0d5cb (diff) | |
download | lua-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 'lobject.c')
-rw-r--r-- | lobject.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -382,7 +382,7 @@ size_t luaO_str2num (const char *s, TValue *o) { | |||
382 | } | 382 | } |
383 | 383 | ||
384 | 384 | ||
385 | int luaO_utf8esc (char *buff, unsigned long x) { | 385 | int luaO_utf8esc (char *buff, l_uint32 x) { |
386 | int n = 1; /* number of bytes put in buffer (backwards) */ | 386 | int n = 1; /* number of bytes put in buffer (backwards) */ |
387 | lua_assert(x <= 0x7FFFFFFFu); | 387 | lua_assert(x <= 0x7FFFFFFFu); |
388 | if (x < 0x80) /* ascii? */ | 388 | if (x < 0x80) /* ascii? */ |
@@ -637,7 +637,8 @@ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { | |||
637 | } | 637 | } |
638 | case 'U': { /* an 'unsigned long' as a UTF-8 sequence */ | 638 | case 'U': { /* an 'unsigned long' as a UTF-8 sequence */ |
639 | char bf[UTF8BUFFSZ]; | 639 | char bf[UTF8BUFFSZ]; |
640 | int len = luaO_utf8esc(bf, va_arg(argp, unsigned long)); | 640 | unsigned long arg = va_arg(argp, unsigned long); |
641 | int len = luaO_utf8esc(bf, cast(l_uint32, arg)); | ||
641 | addstr2buff(&buff, bf + UTF8BUFFSZ - len, cast_uint(len)); | 642 | addstr2buff(&buff, bf + UTF8BUFFSZ - len, cast_uint(len)); |
642 | break; | 643 | break; |
643 | } | 644 | } |