commit cef96b73e1820e0f0d65f1616284ec40502e5e44
parent 427e01eb63079e8cf3a41ec03e7aad7d79fc6406
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Mon, 11 Jan 2010 15:38:06 -0200
added casts from int to enumerations to follow C++ rules
Diffstat:
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/lapi.c b/lapi.c
@@ -1,5 +1,5 @@
/*
-** $Id: lapi.c,v 2.108 2010/01/04 18:17:51 roberto Exp roberto $
+** $Id: lapi.c,v 2.109 2010/01/08 15:16:56 roberto Exp roberto $
** Lua API
** See Copyright Notice in lua.h
*/
@@ -300,7 +300,8 @@ LUA_API void lua_arith (lua_State *L, int op) {
luaO_arith(op, nvalue(L->top - 2), nvalue(L->top - 1)));
}
else
- luaV_arith(L, L->top - 2, L->top - 2, L->top - 1, op - LUA_OPADD + TM_ADD);
+ luaV_arith(L, L->top - 2, L->top - 2, L->top - 1,
+ cast(TMS, op - LUA_OPADD + TM_ADD));
L->top--;
lua_unlock(L);
}
diff --git a/lcode.c b/lcode.c
@@ -1,5 +1,5 @@
/*
-** $Id: lcode.c,v 2.41 2009/08/10 15:31:44 roberto Exp roberto $
+** $Id: lcode.c,v 2.42 2009/09/23 20:33:05 roberto Exp roberto $
** Code generator for Lua
** See Copyright Notice in lua.h
*/
@@ -830,15 +830,15 @@ void luaK_posfix (FuncState *fs, BinOpr op, expdesc *e1, expdesc *e2) {
}
case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV:
case OPR_MOD: case OPR_POW: {
- codearith(fs, op - OPR_ADD + OP_ADD, e1, e2);
+ codearith(fs, cast(OpCode, op - OPR_ADD + OP_ADD), e1, e2);
break;
}
case OPR_EQ: case OPR_LT: case OPR_LE: {
- codecomp(fs, op - OPR_EQ + OP_EQ, 1, e1, e2);
+ codecomp(fs, cast(OpCode, op - OPR_EQ + OP_EQ), 1, e1, e2);
break;
}
case OPR_NE: case OPR_GT: case OPR_GE: {
- codecomp(fs, op - OPR_NE + OP_EQ, 0, e1, e2);
+ codecomp(fs, cast(OpCode, op - OPR_NE + OP_EQ), 0, e1, e2);
break;
}
default: lua_assert(0);