mirror of
https://github.com/mpv-player/mpv
synced 2025-01-28 10:33:20 +00:00
player/lua: use mp_msg_find_level in check_loglevel
Fixes off by one error. Allows to use MSGL_STATS, but since this is internal value, this is mostly cosmetic change.
This commit is contained in:
parent
29e677fea5
commit
2f91e1441e
@ -487,10 +487,9 @@ error_out:
|
|||||||
static int check_loglevel(lua_State *L, int arg)
|
static int check_loglevel(lua_State *L, int arg)
|
||||||
{
|
{
|
||||||
const char *level = luaL_checkstring(L, arg);
|
const char *level = luaL_checkstring(L, arg);
|
||||||
for (int n = 0; n < MSGL_MAX; n++) {
|
int n = mp_msg_find_level(level);
|
||||||
if (mp_log_levels[n] && strcasecmp(mp_log_levels[n], level) == 0)
|
if (n >= 0)
|
||||||
return n;
|
return n;
|
||||||
}
|
|
||||||
luaL_error(L, "Invalid log level '%s'", level);
|
luaL_error(L, "Invalid log level '%s'", level);
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user