diff options
Diffstat (limited to 'lobject.c')
-rw-r--r-- | lobject.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lobject.c,v 2.88 2014/07/30 14:00:14 roberto Exp roberto $ | 2 | ** $Id: lobject.c,v 2.89 2014/08/01 17:24:02 roberto Exp roberto $ |
3 | ** Some generic functions over Lua objects | 3 | ** Some generic functions over Lua objects |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -310,8 +310,9 @@ size_t luaO_str2num (const char *s, TValue *o) { | |||
310 | } | 310 | } |
311 | 311 | ||
312 | 312 | ||
313 | int luaO_utf8esc (char *buff, unsigned int x) { | 313 | int luaO_utf8esc (char *buff, unsigned long x) { |
314 | int n = 1; /* number of bytes put in buffer (backwards) */ | 314 | int n = 1; /* number of bytes put in buffer (backwards) */ |
315 | lua_assert(x <= 0x10FFFF); | ||
315 | if (x < 0x80) /* ascii? */ | 316 | if (x < 0x80) /* ascii? */ |
316 | buff[UTF8BUFFSZ - 1] = x; | 317 | buff[UTF8BUFFSZ - 1] = x; |
317 | else { /* need continuation bytes */ | 318 | else { /* need continuation bytes */ |
@@ -402,7 +403,7 @@ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { | |||
402 | } | 403 | } |
403 | case 'U': { | 404 | case 'U': { |
404 | char buff[UTF8BUFFSZ]; | 405 | char buff[UTF8BUFFSZ]; |
405 | int l = luaO_utf8esc(buff, va_arg(argp, int)); | 406 | int l = luaO_utf8esc(buff, cast(long, va_arg(argp, long))); |
406 | pushstr(L, buff + UTF8BUFFSZ - l, l); | 407 | pushstr(L, buff + UTF8BUFFSZ - l, l); |
407 | break; | 408 | break; |
408 | } | 409 | } |