aboutsummaryrefslogtreecommitdiff
path: root/ltablib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-07-27 13:32:59 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-07-27 13:32:59 -0300
commit0acd55898d0aaae8dbc14c8a1bc1e3bdffc8701b (patch)
tree0ac634fed90877130b1f102bf4075af999de2158 /ltablib.c
parent15231d4fb2f6984b25e0353ff46eda1a180b686d (diff)
downloadlua-0acd55898d0aaae8dbc14c8a1bc1e3bdffc8701b.tar.gz
lua-0acd55898d0aaae8dbc14c8a1bc1e3bdffc8701b.tar.bz2
lua-0acd55898d0aaae8dbc14c8a1bc1e3bdffc8701b.zip
Added gcc option '-Wconversion'
No warnings for standard numerical types. Still pending alternative numerical types.
Diffstat (limited to 'ltablib.c')
-rw-r--r--ltablib.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ltablib.c b/ltablib.c
index b5948591..538d585d 100644
--- a/ltablib.c
+++ b/ltablib.c
@@ -192,7 +192,7 @@ static int tconcat (lua_State *L) {
192static int tpack (lua_State *L) { 192static int tpack (lua_State *L) {
193 int i; 193 int i;
194 int n = lua_gettop(L); /* number of elements to pack */ 194 int n = lua_gettop(L); /* number of elements to pack */
195 lua_createtable(L, n, 1); /* create result table */ 195 lua_createtable(L, cast_uint(n), 1); /* create result table */
196 lua_insert(L, 1); /* put it at index 1 */ 196 lua_insert(L, 1); /* put it at index 1 */
197 for (i = n; i >= 1; i--) /* assign elements */ 197 for (i = n; i >= 1; i--) /* assign elements */
198 lua_seti(L, 1, i); 198 lua_seti(L, 1, i);
@@ -207,7 +207,7 @@ static int tunpack (lua_State *L) {
207 lua_Integer i = luaL_optinteger(L, 2, 1); 207 lua_Integer i = luaL_optinteger(L, 2, 1);
208 lua_Integer e = luaL_opt(L, luaL_checkinteger, 3, luaL_len(L, 1)); 208 lua_Integer e = luaL_opt(L, luaL_checkinteger, 3, luaL_len(L, 1));
209 if (i > e) return 0; /* empty range */ 209 if (i > e) return 0; /* empty range */
210 n = (lua_Unsigned)e - i; /* number of elements minus 1 (avoid overflows) */ 210 n = l_castS2U(e) - l_castS2U(i); /* number of elements minus 1 */
211 if (l_unlikely(n >= (unsigned int)INT_MAX || 211 if (l_unlikely(n >= (unsigned int)INT_MAX ||
212 !lua_checkstack(L, (int)(++n)))) 212 !lua_checkstack(L, (int)(++n))))
213 return luaL_error(L, "too many results to unpack"); 213 return luaL_error(L, "too many results to unpack");