From 49f7aab62af7e5d5b46c551c1620a8a89f448f7e Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 18 May 2017 09:34:58 -0300 Subject: [PATCH] 'lua_rawlen' returns 'lua_Unsigned' instead of 'size_t'. (Real length of strings and userdata are limited by Lua integers, but table length is hard to compute limiting it to 'size_t'.) --- lapi.c | 4 ++-- lua.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lapi.c b/lapi.c index facf9541..e7d59b45 100644 --- a/lapi.c +++ b/lapi.c @@ -1,5 +1,5 @@ /* -** $Id: lapi.c,v 2.265 2017/04/24 16:59:26 roberto Exp roberto $ +** $Id: lapi.c,v 2.266 2017/05/11 18:57:46 roberto Exp roberto $ ** Lua API ** See Copyright Notice in lua.h */ @@ -389,7 +389,7 @@ LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) { } -LUA_API size_t lua_rawlen (lua_State *L, int idx) { +LUA_API lua_Unsigned lua_rawlen (lua_State *L, int idx) { StkId o = index2addr(L, idx); switch (ttype(o)) { case LUA_TSHRSTR: return tsvalue(o)->shrlen; diff --git a/lua.h b/lua.h index d9962cec..735a2599 100644 --- a/lua.h +++ b/lua.h @@ -1,5 +1,5 @@ /* -** $Id: lua.h,v 1.332 2016/12/22 15:51:20 roberto Exp roberto $ +** $Id: lua.h,v 1.333 2017/02/23 21:07:34 roberto Exp roberto $ ** Lua - A Scripting Language ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) ** See Copyright Notice at the end of this file @@ -182,7 +182,7 @@ LUA_API lua_Number (lua_tonumberx) (lua_State *L, int idx, int *isnum); LUA_API lua_Integer (lua_tointegerx) (lua_State *L, int idx, int *isnum); LUA_API int (lua_toboolean) (lua_State *L, int idx); LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len); -LUA_API size_t (lua_rawlen) (lua_State *L, int idx); +LUA_API lua_Unsigned (lua_rawlen) (lua_State *L, int idx); LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); LUA_API void *(lua_touserdata) (lua_State *L, int idx); LUA_API lua_State *(lua_tothread) (lua_State *L, int idx);