diff options
| -rw-r--r-- | ltests.c | 18 |
1 files changed, 9 insertions, 9 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltests.c,v 2.197 2014/11/14 18:15:17 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 2.198 2014/11/25 14:51:33 roberto Exp roberto $ |
| 3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -540,7 +540,7 @@ static int listk (lua_State *L) { | |||
| 540 | 540 | ||
| 541 | static int listlocals (lua_State *L) { | 541 | static int listlocals (lua_State *L) { |
| 542 | Proto *p; | 542 | Proto *p; |
| 543 | int pc = (int)luaL_checkinteger(L, 2) - 1; | 543 | int pc = cast_int(luaL_checkinteger(L, 2)) - 1; |
| 544 | int i = 0; | 544 | int i = 0; |
| 545 | const char *name; | 545 | const char *name; |
| 546 | luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), | 546 | luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), |
| @@ -682,7 +682,7 @@ static int stacklevel (lua_State *L) { | |||
| 682 | 682 | ||
| 683 | static int table_query (lua_State *L) { | 683 | static int table_query (lua_State *L) { |
| 684 | const Table *t; | 684 | const Table *t; |
| 685 | int i = (int)luaL_optinteger(L, 2, -1); | 685 | int i = cast_int(luaL_optinteger(L, 2, -1)); |
| 686 | luaL_checktype(L, 1, LUA_TTABLE); | 686 | luaL_checktype(L, 1, LUA_TTABLE); |
| 687 | t = hvalue(obj_at(L, 1)); | 687 | t = hvalue(obj_at(L, 1)); |
| 688 | if (i == -1) { | 688 | if (i == -1) { |
| @@ -715,7 +715,7 @@ static int table_query (lua_State *L) { | |||
| 715 | 715 | ||
| 716 | static int string_query (lua_State *L) { | 716 | static int string_query (lua_State *L) { |
| 717 | stringtable *tb = &G(L)->strt; | 717 | stringtable *tb = &G(L)->strt; |
| 718 | int s = (int)luaL_optinteger(L, 1, 0) - 1; | 718 | int s = cast_int(luaL_optinteger(L, 1, 0)) - 1; |
| 719 | if (s == -1) { | 719 | if (s == -1) { |
| 720 | lua_pushinteger(L ,tb->size); | 720 | lua_pushinteger(L ,tb->size); |
| 721 | lua_pushinteger(L ,tb->nuse); | 721 | lua_pushinteger(L ,tb->nuse); |
| @@ -753,14 +753,14 @@ static int getref (lua_State *L) { | |||
| 753 | 753 | ||
| 754 | static int unref (lua_State *L) { | 754 | static int unref (lua_State *L) { |
| 755 | int level = lua_gettop(L); | 755 | int level = lua_gettop(L); |
| 756 | luaL_unref(L, LUA_REGISTRYINDEX, (int)luaL_checkinteger(L, 1)); | 756 | luaL_unref(L, LUA_REGISTRYINDEX, cast_int(luaL_checkinteger(L, 1))); |
| 757 | lua_assert(lua_gettop(L) == level); | 757 | lua_assert(lua_gettop(L) == level); |
| 758 | return 0; | 758 | return 0; |
| 759 | } | 759 | } |
| 760 | 760 | ||
| 761 | 761 | ||
| 762 | static int upvalue (lua_State *L) { | 762 | static int upvalue (lua_State *L) { |
| 763 | int n = (int)luaL_checkinteger(L, 2); | 763 | int n = cast_int(luaL_checkinteger(L, 2)); |
| 764 | luaL_checktype(L, 1, LUA_TFUNCTION); | 764 | luaL_checktype(L, 1, LUA_TFUNCTION); |
| 765 | if (lua_isnone(L, 3)) { | 765 | if (lua_isnone(L, 3)) { |
| 766 | const char *name = lua_getupvalue(L, 1, n); | 766 | const char *name = lua_getupvalue(L, 1, n); |
| @@ -989,7 +989,7 @@ static int getnum_aux (lua_State *L, lua_State *L1, const char **pc) { | |||
| 989 | int sig = 1; | 989 | int sig = 1; |
| 990 | skip(pc); | 990 | skip(pc); |
| 991 | if (**pc == '.') { | 991 | if (**pc == '.') { |
| 992 | res = lua_tointeger(L1, -1); | 992 | res = cast_int(lua_tointeger(L1, -1)); |
| 993 | lua_pop(L1, 1); | 993 | lua_pop(L1, 1); |
| 994 | (*pc)++; | 994 | (*pc)++; |
| 995 | return res; | 995 | return res; |
| @@ -1343,7 +1343,7 @@ static struct X { int x; } x; | |||
| 1343 | else if EQ("tostring") { | 1343 | else if EQ("tostring") { |
| 1344 | const char *s = lua_tostring(L1, getindex); | 1344 | const char *s = lua_tostring(L1, getindex); |
| 1345 | const char *s1 = lua_pushstring(L1, s); | 1345 | const char *s1 = lua_pushstring(L1, s); |
| 1346 | lua_assert((s == NULL && s1 == NULL) || (strcmp)(s, s1) == 0); | 1346 | lua_assert((s == NULL && s1 == NULL) || strcmp(s, s1) == 0); |
| 1347 | } | 1347 | } |
| 1348 | else if EQ("type") { | 1348 | else if EQ("type") { |
| 1349 | lua_pushstring(L1, luaL_typename(L1, getnum)); | 1349 | lua_pushstring(L1, luaL_typename(L1, getnum)); |
| @@ -1465,7 +1465,7 @@ static int sethook (lua_State *L) { | |||
| 1465 | else { | 1465 | else { |
| 1466 | const char *scpt = luaL_checkstring(L, 1); | 1466 | const char *scpt = luaL_checkstring(L, 1); |
| 1467 | const char *smask = luaL_checkstring(L, 2); | 1467 | const char *smask = luaL_checkstring(L, 2); |
| 1468 | int count = (int)luaL_optinteger(L, 3, 0); | 1468 | int count = cast_int(luaL_optinteger(L, 3, 0)); |
| 1469 | int mask = 0; | 1469 | int mask = 0; |
| 1470 | if (strchr(smask, 'c')) mask |= LUA_MASKCALL; | 1470 | if (strchr(smask, 'c')) mask |= LUA_MASKCALL; |
| 1471 | if (strchr(smask, 'r')) mask |= LUA_MASKRET; | 1471 | if (strchr(smask, 'r')) mask |= LUA_MASKRET; |
