mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
Lunatic: Fix cast-qual warnings having to do with L_RunString.
git-svn-id: https://svn.eduke32.com/eduke32@5590 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
7f5654879d
commit
f1d187d378
6 changed files with 10 additions and 10 deletions
|
@ -40,7 +40,7 @@ extern void (*L_OutOfMemFunc)(void);
|
||||||
int L_CreateState(L_State *estate, const char *name, void (*StateSetupFunc)(lua_State *));
|
int L_CreateState(L_State *estate, const char *name, void (*StateSetupFunc)(lua_State *));
|
||||||
void L_DestroyState(L_State *estate);
|
void L_DestroyState(L_State *estate);
|
||||||
int L_RunOnce(L_State *estate, const char *fn);
|
int L_RunOnce(L_State *estate, const char *fn);
|
||||||
int L_RunString(L_State *estate, char *buf, int dofreebuf, int size, const char *name);
|
int L_RunString(L_State *estate, char const *buf, int size, const char *name);
|
||||||
|
|
||||||
static inline int L_IsInitialized(const L_State *estate) { return (estate->L != NULL); }
|
static inline int L_IsInitialized(const L_State *estate) { return (estate->L != NULL); }
|
||||||
|
|
||||||
|
|
|
@ -9168,7 +9168,7 @@ int32_t initengine(void)
|
||||||
{
|
{
|
||||||
char *luastr = "_LUNATIC_AUX=true; decl=require('ffi').cdef; require'defs_common'";
|
char *luastr = "_LUNATIC_AUX=true; decl=require('ffi').cdef; require'defs_common'";
|
||||||
|
|
||||||
if (L_RunString(&g_engState, luastr, 0, -1, "eng"))
|
if (L_RunString(&g_engState, luastr, -1, "eng"))
|
||||||
return E_FatalError("Failed setting up engine Lua state");
|
return E_FatalError("Failed setting up engine Lua state");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -187,7 +187,7 @@ static void L_ErrorPrint(const char *errmsg)
|
||||||
|
|
||||||
// size < 0: length of <buf> is determined using strlen()
|
// size < 0: length of <buf> is determined using strlen()
|
||||||
// size >= 0: size given, for loading of LuaJIT bytecode
|
// size >= 0: size given, for loading of LuaJIT bytecode
|
||||||
int L_RunString(L_State *estate, char *buf, int dofreebuf, int size, const char *name)
|
int L_RunString(L_State *estate, char const *buf, int size, const char *name)
|
||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
lua_State *L = estate->L;
|
lua_State *L = estate->L;
|
||||||
|
@ -202,8 +202,6 @@ int L_RunString(L_State *estate, char *buf, int dofreebuf, int size, const char
|
||||||
else
|
else
|
||||||
i = luaL_loadbuffer(L, buf, size, name);
|
i = luaL_loadbuffer(L, buf, size, name);
|
||||||
Bassert(lua_gettop(L)==2);
|
Bassert(lua_gettop(L)==2);
|
||||||
if (dofreebuf)
|
|
||||||
Bfree(buf);
|
|
||||||
|
|
||||||
if (i == LUA_ERRMEM)
|
if (i == LUA_ERRMEM)
|
||||||
L_OutOfMemFunc();
|
L_OutOfMemFunc();
|
||||||
|
@ -243,5 +241,7 @@ int L_RunOnce(L_State *estate, const char *fn)
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
return L_RunString(estate, buf, 1, -1, fn);
|
int const retval = L_RunString(estate, buf, -1, fn);
|
||||||
|
Bfree(buf);
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8908,7 +8908,7 @@ static int32_t osdcmd_lua(const osdfuncparm_t *parm)
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = L_RunString(&g_EmState, (char *)parm->parms[0], 0, -1, "console");
|
ret = L_RunString(&g_EmState, parm->parms[0], -1, "console");
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
OSD_Printf("Error running the Lua code (error code %d)\n", ret);
|
OSD_Printf("Error running the Lua code (error code %d)\n", ret);
|
||||||
else
|
else
|
||||||
|
@ -9988,7 +9988,7 @@ int32_t ExtPostStartupWindow(void)
|
||||||
{
|
{
|
||||||
extern const char luaJIT_BC_defs_m32[];
|
extern const char luaJIT_BC_defs_m32[];
|
||||||
|
|
||||||
int32_t i = L_RunString(&g_EmState, (char *)luaJIT_BC_defs_m32, 0,
|
int32_t i = L_RunString(&g_EmState, luaJIT_BC_defs_m32,
|
||||||
LUNATIC_DEFS_M32_BC_SIZE, "defs_m32.ilua");
|
LUNATIC_DEFS_M32_BC_SIZE, "defs_m32.ilua");
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -11049,7 +11049,7 @@ void El_CreateGameState(void)
|
||||||
{
|
{
|
||||||
extern const char luaJIT_BC_defs[];
|
extern const char luaJIT_BC_defs[];
|
||||||
|
|
||||||
if ((i = L_RunString(&g_ElState, (char *)luaJIT_BC_defs, 0,
|
if ((i = L_RunString(&g_ElState, luaJIT_BC_defs,
|
||||||
LUNATIC_DEFS_BC_SIZE, "defs.ilua")))
|
LUNATIC_DEFS_BC_SIZE, "defs.ilua")))
|
||||||
{
|
{
|
||||||
initprintf("Lunatic: Error preparing global ELua state (code %d)\n", i);
|
initprintf("Lunatic: Error preparing global ELua state (code %d)\n", i);
|
||||||
|
|
|
@ -698,7 +698,7 @@ static int32_t osdcmd_lua(const osdfuncparm_t *parm)
|
||||||
|
|
||||||
// For the 'lua' OSD command, don't make errors appear on-screen:
|
// For the 'lua' OSD command, don't make errors appear on-screen:
|
||||||
el_addNewErrors = 0;
|
el_addNewErrors = 0;
|
||||||
ret = L_RunString(&g_ElState, (char *)parm->parms[0], 0, -1, "console");
|
ret = L_RunString(&g_ElState, parm->parms[0], -1, "console");
|
||||||
el_addNewErrors = 1;
|
el_addNewErrors = 1;
|
||||||
|
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
|
|
Loading…
Reference in a new issue