From 34b6664dcb28b18ca3f08ed5e36da094b007eb7b Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 1 Oct 2014 08:52:33 -0300 Subject: better to use 'long' to represent UTF-8 code points --- lutf8lib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lutf8lib.c') diff --git a/lutf8lib.c b/lutf8lib.c index e9557d61..3cf2f1cf 100644 --- a/lutf8lib.c +++ b/lutf8lib.c @@ -1,5 +1,5 @@ /* -** $Id: lutf8lib.c,v 1.9 2014/05/14 18:33:37 roberto Exp roberto $ +** $Id: lutf8lib.c,v 1.10 2014/07/16 13:56:14 roberto Exp roberto $ ** Standard library for UTF-8 manipulation ** See Copyright Notice in lua.h */ @@ -123,9 +123,9 @@ static int codepoint (lua_State *L) { static void pushutfchar (lua_State *L, int arg) { - int code = luaL_checkint(L, arg); + lua_Integer code = luaL_checkinteger(L, arg); luaL_argcheck(L, 0 <= code && code <= MAXUNICODE, arg, "value out of range"); - lua_pushfstring(L, "%U", code); + lua_pushfstring(L, "%U", (long)code); } @@ -157,7 +157,7 @@ static int utfchar (lua_State *L) { static int byteoffset (lua_State *L) { size_t len; const char *s = luaL_checklstring(L, 1, &len); - int n = luaL_checkint(L, 2); + lua_Integer n = luaL_checkinteger(L, 2); lua_Integer posi = (n >= 0) ? 1 : len + 1; posi = u_posrelat(luaL_optinteger(L, 3, posi), len); luaL_argcheck(L, 1 <= posi && --posi <= (lua_Integer)len, 3, -- cgit v1.2.3-55-g6feb