diff options
-rw-r--r-- | src/Bindings/LuaState.cpp | 7 | ||||
-rw-r--r-- | src/Bindings/ManualBindings.cpp | 9 | ||||
-rw-r--r-- | src/MersenneTwister.h | 2 |
3 files changed, 15 insertions, 3 deletions
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp index ca7f6b255..45a066efe 100644 --- a/src/Bindings/LuaState.cpp +++ b/src/Bindings/LuaState.cpp @@ -677,6 +677,11 @@ void cLuaState::Push(void * a_Ptr) { ASSERT(IsValid()); + // Investigate the cause of this - what is the callstack? + LOGWARNING("Lua engine encountered an error - attempting to push a plain pointer"); + LogStackTrace(); + ASSERT(!"A plain pointer should never be pushed on Lua stack"); + lua_pushnil(m_LuaState); m_NumCurrentFunctionArgs += 1; } @@ -1265,6 +1270,8 @@ void cLuaState::LogStack(const char * a_Header) void cLuaState::LogStack(lua_State * a_LuaState, const char * a_Header) { + UNUSED(a_Header); // The param seems unused when compiling for release, so the compiler warns + LOGD((a_Header != NULL) ? a_Header : "Lua C API Stack contents:"); for (int i = lua_gettop(a_LuaState); i > 0; i--) { diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp index 2f3f3ee91..461186d3b 100644 --- a/src/Bindings/ManualBindings.cpp +++ b/src/Bindings/ManualBindings.cpp @@ -1321,7 +1321,9 @@ static int tolua_cPluginManager_ForEachCommand(lua_State * tolua_S) private: virtual bool Command(const AString & a_Command, const cPlugin * a_Plugin, const AString & a_Permission, const AString & a_HelpString) override { - lua_rawgeti( LuaState, LUA_REGISTRYINDEX, FuncRef); /* Push function reference */ + UNUSED(a_Plugin); + + lua_rawgeti(LuaState, LUA_REGISTRYINDEX, FuncRef); /* Push function reference */ tolua_pushcppstring(LuaState, a_Command); tolua_pushcppstring(LuaState, a_Permission); tolua_pushcppstring(LuaState, a_HelpString); @@ -1396,7 +1398,10 @@ static int tolua_cPluginManager_ForEachConsoleCommand(lua_State * tolua_S) private: virtual bool Command(const AString & a_Command, const cPlugin * a_Plugin, const AString & a_Permission, const AString & a_HelpString) override { - lua_rawgeti( LuaState, LUA_REGISTRYINDEX, FuncRef); /* Push function reference */ + UNUSED(a_Plugin); + UNUSED(a_Permission); + + lua_rawgeti(LuaState, LUA_REGISTRYINDEX, FuncRef); /* Push function reference */ tolua_pushcppstring(LuaState, a_Command); tolua_pushcppstring(LuaState, a_HelpString); diff --git a/src/MersenneTwister.h b/src/MersenneTwister.h index 784ac605d..f4c7b0699 100644 --- a/src/MersenneTwister.h +++ b/src/MersenneTwister.h @@ -207,7 +207,7 @@ inline void MTRand::seed( uint32 *const bigSeed, const uint32 seedLength ) initialize(19650218UL); int i = 1; uint32 j = 0; - int k = ( N > seedLength ? N : seedLength ); + int k = ( (uint32)N > seedLength ? (uint32)N : seedLength ); for( ; k; --k ) { state[i] = |