Evas filters: Fix parsing of instructions with unnamed arguments

This commit is contained in:
Jean-Philippe Andre 2014-04-30 14:48:16 +09:00
parent 64baafe176
commit 27650fb94a
1 changed files with 8 additions and 8 deletions

View File

@ -1575,11 +1575,10 @@ _lua_program_get(lua_State *L)
return pgm; return pgm;
} }
static int static Eina_Bool
_lua_parameter_parse(lua_State *L, Instruction_Param *param, int i) _lua_parameter_parse(lua_State *L, Instruction_Param *param, int i)
{ {
Eina_Bool ok; Eina_Bool ok;
int retc = 0;
if (!param) goto fail; if (!param) goto fail;
if (param->set) if (param->set)
@ -1648,13 +1647,12 @@ _lua_parameter_parse(lua_State *L, Instruction_Param *param, int i)
} }
param->set = EINA_TRUE; param->set = EINA_TRUE;
return EINA_TRUE;
return retc;
fail: fail:
ERR("Invalid value for parameter %s", param->name); ERR("Invalid value for parameter %s", param->name);
luaL_error(L, "Invalid value for parameter %s", param->name); luaL_error(L, "Invalid value for parameter %s", param->name);
return 0; return EINA_FALSE;
} }
static Eina_Bool static Eina_Bool
@ -1709,7 +1707,8 @@ _lua_instruction_run(lua_State *L, Evas_Filter_Instruction *instr)
goto fail; goto fail;
} }
_lua_parameter_parse(L, param, -1); if (!_lua_parameter_parse(L, param, -1))
goto fail;
lua_pop(L, 1); lua_pop(L, 1);
if (seqmode) if (seqmode)
@ -1722,8 +1721,9 @@ _lua_instruction_run(lua_State *L, Evas_Filter_Instruction *instr)
{ {
EINA_INLIST_FOREACH(instr->params, param) EINA_INLIST_FOREACH(instr->params, param)
{ {
if ((++i) >= argc) break; if ((++i) > argc) break;
_lua_parameter_parse(L, param, i); if (!_lua_parameter_parse(L, param, i))
goto fail;
} }
} }