Fixed code warnings on smlua files (32-bit)

This commit is contained in:
MysterD 2022-02-06 15:19:44 -08:00
parent 55c1e94081
commit e95a1d48e0
2 changed files with 7 additions and 7 deletions

View file

@ -84,7 +84,7 @@ static int smlua__get_field(lua_State* L) {
return 0;
}
u8* p = ((u8*)pointer) + data->valueOffset;
u8* p = ((u8*)(intptr_t)pointer) + data->valueOffset;
switch (data->valueType) {
case LVT_BOOL: lua_pushboolean(L, *(u8* )p); break;
case LVT_U8: lua_pushinteger(L, *(u8* )p); break;
@ -150,7 +150,7 @@ static int smlua__set_field(lua_State* L) {
return 0;
}
u8* p = ((u8*)pointer) + data->valueOffset;
u8* p = ((u8*)(intptr_t)pointer) + data->valueOffset;
switch (data->valueType) {
case LVT_BOOL:*(u8*) p = smlua_to_boolean(L, -1); break;
case LVT_U8: *(u8*) p = smlua_to_integer(L, -1); break;

View file

@ -109,13 +109,13 @@ void* smlua_to_cobject(lua_State* L, int index, u16 lot) {
// get pointer
lua_getfield(L, index, "_pointer");
void* pointer = (void*)smlua_to_integer(L, -1);
void* pointer = (void*)(intptr_t)smlua_to_integer(L, -1);
lua_pop(L, 1);
if (!gSmLuaConvertSuccess) { return NULL; }
// check allowlist
if (!smlua_cobject_allowlist_contains(lot, (u64)pointer)) {
LOG_LUA("smlua_to_cobject received a pointer not in allow list. '%u', '%llu", lot, (u64)pointer);
if (!smlua_cobject_allowlist_contains(lot, (u64)(intptr_t)pointer)) {
LOG_LUA("smlua_to_cobject received a pointer not in allow list. '%u', '%llu", lot, (u64)(intptr_t)pointer);
gSmLuaConvertSuccess = false;
return NULL;
}
@ -197,12 +197,12 @@ void smlua_push_object(lua_State* L, u16 lot, void* p) {
return;
}
// add to allowlist
smlua_cobject_allowlist_add(lot, (u64)p);
smlua_cobject_allowlist_add(lot, (u64)(intptr_t)p);
lua_newtable(L);
int t = lua_gettop(L);
smlua_push_integer_field(t, "_lot", lot);
smlua_push_integer_field(t, "_pointer", (u64)p);
smlua_push_integer_field(t, "_pointer", (u64)(intptr_t)p);
lua_pushglobaltable(L);
lua_getfield(gLuaState, -1, "_CObject");
lua_setmetatable(L, -3);