Added gcc option '-Wconversion'
No warnings for standard numerical types. Still pending alternative numerical types.
This commit is contained in:
@@ -192,7 +192,7 @@ static int tconcat (lua_State *L) {
|
||||
static int tpack (lua_State *L) {
|
||||
int i;
|
||||
int n = lua_gettop(L); /* number of elements to pack */
|
||||
lua_createtable(L, n, 1); /* create result table */
|
||||
lua_createtable(L, cast_uint(n), 1); /* create result table */
|
||||
lua_insert(L, 1); /* put it at index 1 */
|
||||
for (i = n; i >= 1; i--) /* assign elements */
|
||||
lua_seti(L, 1, i);
|
||||
@@ -207,7 +207,7 @@ static int tunpack (lua_State *L) {
|
||||
lua_Integer i = luaL_optinteger(L, 2, 1);
|
||||
lua_Integer e = luaL_opt(L, luaL_checkinteger, 3, luaL_len(L, 1));
|
||||
if (i > e) return 0; /* empty range */
|
||||
n = (lua_Unsigned)e - i; /* number of elements minus 1 (avoid overflows) */
|
||||
n = l_castS2U(e) - l_castS2U(i); /* number of elements minus 1 */
|
||||
if (l_unlikely(n >= (unsigned int)INT_MAX ||
|
||||
!lua_checkstack(L, (int)(++n))))
|
||||
return luaL_error(L, "too many results to unpack");
|
||||
|
||||
Reference in New Issue
Block a user