diff options
| -rw-r--r-- | engines/sword25/util/lua/lapi.cpp | 6 | ||||
| -rw-r--r-- | engines/sword25/util/lua/ltable.cpp | 15 | 
2 files changed, 14 insertions, 7 deletions
diff --git a/engines/sword25/util/lua/lapi.cpp b/engines/sword25/util/lua/lapi.cpp index e4a3d86dc3..a38733e1f7 100644 --- a/engines/sword25/util/lua/lapi.cpp +++ b/engines/sword25/util/lua/lapi.cpp @@ -50,7 +50,8 @@ static TValue *index2adr (lua_State *L, int idx) {    if (idx > 0) {      TValue *o = L->base + (idx - 1);      api_check(L, idx <= L->ci->top - L->base); -    if (o >= L->top) return cast(TValue *, luaO_nilobject); +    // FIXME: Get rid of const_cast +    if (o >= L->top) return const_cast<TValue *>(luaO_nilobject);      else return o;    }    else if (idx > LUA_REGISTRYINDEX) { @@ -70,7 +71,8 @@ static TValue *index2adr (lua_State *L, int idx) {        idx = LUA_GLOBALSINDEX - idx;        return (idx <= func->c.nupvalues)                  ? &func->c.upvalue[idx-1] -                : cast(TValue *, luaO_nilobject); +                // FIXME: Get rid of const_cast +                : const_cast<TValue *>(luaO_nilobject);      }    }  } diff --git a/engines/sword25/util/lua/ltable.cpp b/engines/sword25/util/lua/ltable.cpp index 35d763eac3..b2ec0e912a 100644 --- a/engines/sword25/util/lua/ltable.cpp +++ b/engines/sword25/util/lua/ltable.cpp @@ -272,7 +272,8 @@ static void setarrayvector (lua_State *L, Table *t, int size) {  static void setnodevector (lua_State *L, Table *t, int size) {    int lsize;    if (size == 0) {  /* no elements to hash part? */ -    t->node = cast(Node *, dummynode);  /* use common `dummynode' */ +    // FIXME: Get rid of const_cast +    t->node = const_cast<Node *>(dummynode);  /* use common `dummynode' */      lsize = 0;    }    else { @@ -364,7 +365,8 @@ Table *luaH_new (lua_State *L, int narray, int nhash) {    t->array = NULL;    t->sizearray = 0;    t->lsizenode = 0; -  t->node = cast(Node *, dummynode); +  // FIXME: Get rid of const_cast +  t->node = const_cast<Node *>(dummynode);    setarrayvector(L, t, narray);    setnodevector(L, t, nhash);    return t; @@ -495,7 +497,8 @@ TValue *luaH_set (lua_State *L, Table *t, const TValue *key) {    const TValue *p = luaH_get(t, key);    t->flags = 0;    if (p != luaO_nilobject) -    return cast(TValue *, p); +    // FIXME: Get rid of const_cast +    return const_cast<TValue *>(p);    else {      if (ttisnil(key)) luaG_runerror(L, "table index is nil");      else if (ttisnumber(key) && luai_numisnan(nvalue(key))) @@ -508,7 +511,8 @@ TValue *luaH_set (lua_State *L, Table *t, const TValue *key) {  TValue *luaH_setnum (lua_State *L, Table *t, int key) {    const TValue *p = luaH_getnum(t, key);    if (p != luaO_nilobject) -    return cast(TValue *, p); +    // FIXME: Get rid of const_cast +    return const_cast<TValue *>(p);    else {      TValue k;      setnvalue(&k, cast_num(key)); @@ -520,7 +524,8 @@ TValue *luaH_setnum (lua_State *L, Table *t, int key) {  TValue *luaH_setstr (lua_State *L, Table *t, TString *key) {    const TValue *p = luaH_getstr(t, key);    if (p != luaO_nilobject) -    return cast(TValue *, p); +    // FIXME: Get rid of const_cast +    return const_cast<TValue *>(p);    else {      TValue k;      setsvalue(L, &k, key);  | 
