aboutsummaryrefslogtreecommitdiff
path: root/ltablib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-07-29 13:01:00 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-07-29 13:01:00 -0300
commit3ccbae84d2be8e2978a65bcea15b3fffba7664f5 (patch)
tree5d375f2e0c64840e2849620043aafe9bd17e46d9 /ltablib.c
parent255d59ed5e2743b97626eff57444f44defc39270 (diff)
downloadlua-3ccbae84d2be8e2978a65bcea15b3fffba7664f5.tar.gz
lua-3ccbae84d2be8e2978a65bcea15b3fffba7664f5.tar.bz2
lua-3ccbae84d2be8e2978a65bcea15b3fffba7664f5.zip
added some casts between integral types (to avoid warnings)
Diffstat (limited to 'ltablib.c')
-rw-r--r--ltablib.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ltablib.c b/ltablib.c
index 5d27cb2f..cc72cc4b 100644
--- a/ltablib.c
+++ b/ltablib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltablib.c,v 1.71 2014/07/16 12:44:52 roberto Exp roberto $ 2** $Id: ltablib.c,v 1.72 2014/07/25 18:46:00 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*/
@@ -227,13 +227,13 @@ static int unpack (lua_State *L) {
227 e = luaL_opt(L, luaL_checkinteger, 3, luaL_len(L, 1)); 227 e = luaL_opt(L, luaL_checkinteger, 3, luaL_len(L, 1));
228 if (i > e) return 0; /* empty range */ 228 if (i > e) return 0; /* empty range */
229 n = (lua_Unsigned)e - i; /* number of elements minus 1 (avoid overflows) */ 229 n = (lua_Unsigned)e - i; /* number of elements minus 1 (avoid overflows) */
230 if (n >= (unsigned int)INT_MAX || !lua_checkstack(L, ++n)) 230 if (n >= (unsigned int)INT_MAX || !lua_checkstack(L, (int)(++n)))
231 return luaL_error(L, "too many results to unpack"); 231 return luaL_error(L, "too many results to unpack");
232 do { /* must have at least one element */ 232 do { /* must have at least one element */
233 (*ta.geti)(L, 1, i); /* push arg[i..e] */ 233 (*ta.geti)(L, 1, i); /* push arg[i..e] */
234 } while (i++ < e); 234 } while (i++ < e);
235 235
236 return n; 236 return (int)n;
237} 237}
238 238
239/* }====================================================== */ 239/* }====================================================== */
@@ -334,11 +334,11 @@ static void auxsort (lua_State *L, TabA *ta, int l, int u) {
334 334
335static int sort (lua_State *L) { 335static int sort (lua_State *L) {
336 TabA ta; 336 TabA ta;
337 int n = aux_getn(L, 1, &ta); 337 int n = (int)aux_getn(L, 1, &ta);
338 luaL_checkstack(L, 50, ""); /* assume array is smaller than 2^50 */ 338 luaL_checkstack(L, 50, ""); /* assume array is smaller than 2^50 */
339 if (!lua_isnoneornil(L, 2)) /* is there a 2nd argument? */ 339 if (!lua_isnoneornil(L, 2)) /* is there a 2nd argument? */
340 luaL_checktype(L, 2, LUA_TFUNCTION); 340 luaL_checktype(L, 2, LUA_TFUNCTION);
341 lua_settop(L, 2); /* make sure there is two arguments */ 341 lua_settop(L, 2); /* make sure there are two arguments */
342 auxsort(L, &ta, 1, n); 342 auxsort(L, &ta, 1, n);
343 return 0; 343 return 0;
344} 344}