diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-04-12 11:43:50 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-04-12 11:43:50 -0300 |
commit | b390d7c168ac85f5cef85b6a2a5716e5fde388a8 (patch) | |
tree | 9b66982e302dfebd7caa00bba30dd7fdb62a506f /ltablib.c | |
parent | 218f3584618ec5700c1e2a39f6f5734c3480b59b (diff) | |
download | lua-b390d7c168ac85f5cef85b6a2a5716e5fde388a8.tar.gz lua-b390d7c168ac85f5cef85b6a2a5716e5fde388a8.tar.bz2 lua-b390d7c168ac85f5cef85b6a2a5716e5fde388a8.zip |
detail (avoid "casting down" in case lua_Integer is smaller than int)
Diffstat (limited to 'ltablib.c')
-rw-r--r-- | ltablib.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltablib.c,v 1.67 2014/04/01 18:50:34 roberto Exp roberto $ | 2 | ** $Id: ltablib.c,v 1.68 2014/04/04 16:38:11 roberto Exp roberto $ |
3 | ** Library for Table Manipulation | 3 | ** Library for Table Manipulation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -142,7 +142,7 @@ static int unpack (lua_State *L) { | |||
142 | e = luaL_opt(L, luaL_checkinteger, 3, luaL_len(L, 1)); | 142 | e = luaL_opt(L, luaL_checkinteger, 3, luaL_len(L, 1)); |
143 | if (i > e) return 0; /* empty range */ | 143 | if (i > e) return 0; /* empty range */ |
144 | n = (lua_Unsigned)e - i; /* number of elements minus 1 (avoid overflows) */ | 144 | n = (lua_Unsigned)e - i; /* number of elements minus 1 (avoid overflows) */ |
145 | if (n >= (lua_Unsigned)INT_MAX || !lua_checkstack(L, ++n)) | 145 | if (n >= (unsigned int)INT_MAX || !lua_checkstack(L, ++n)) |
146 | return luaL_error(L, "too many results to unpack"); | 146 | return luaL_error(L, "too many results to unpack"); |
147 | do { /* must have at least one element */ | 147 | do { /* must have at least one element */ |
148 | lua_rawgeti(L, 1, i); /* push arg[i..e] */ | 148 | lua_rawgeti(L, 1, i); /* push arg[i..e] */ |