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:
@@ -382,7 +382,7 @@ size_t luaO_str2num (const char *s, TValue *o) {
|
||||
}
|
||||
|
||||
|
||||
int luaO_utf8esc (char *buff, unsigned long x) {
|
||||
int luaO_utf8esc (char *buff, l_uint32 x) {
|
||||
int n = 1; /* number of bytes put in buffer (backwards) */
|
||||
lua_assert(x <= 0x7FFFFFFFu);
|
||||
if (x < 0x80) /* ascii? */
|
||||
@@ -637,7 +637,8 @@ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) {
|
||||
}
|
||||
case 'U': { /* an 'unsigned long' as a UTF-8 sequence */
|
||||
char bf[UTF8BUFFSZ];
|
||||
int len = luaO_utf8esc(bf, va_arg(argp, unsigned long));
|
||||
unsigned long arg = va_arg(argp, unsigned long);
|
||||
int len = luaO_utf8esc(bf, cast(l_uint32, arg));
|
||||
addstr2buff(&buff, bf + UTF8BUFFSZ - len, cast_uint(len));
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user