diff options
author | Johannes Schickel | 2010-10-18 22:17:18 +0000 |
---|---|---|
committer | Johannes Schickel | 2010-10-18 22:17:18 +0000 |
commit | 521751e8d7810ee603669fd2e4c2b35dd1da4bf0 (patch) | |
tree | 414fe623a7a8cb3b53beeba01d8567fe1edc2bdc /engines/sword25/util/lua/ltable.cpp | |
parent | 5c2bcadd214b0af8f10e2915b986735739c42b36 (diff) | |
download | scummvm-rg350-521751e8d7810ee603669fd2e4c2b35dd1da4bf0.tar.gz scummvm-rg350-521751e8d7810ee603669fd2e4c2b35dd1da4bf0.tar.bz2 scummvm-rg350-521751e8d7810ee603669fd2e4c2b35dd1da4bf0.zip |
SWORD25: Use const_cast to cast away constness.
This fixes a few warnings/errors in the LUA code. I added some FIXMEs at the
places where the casts happen, since usually this casting indicates bad
design.
svn-id: r53592
Diffstat (limited to 'engines/sword25/util/lua/ltable.cpp')
-rw-r--r-- | engines/sword25/util/lua/ltable.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
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); |