1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-13 18:45:25 +00:00

m_option: fix parameter comparison for vf-toggle

The vf-toggle option parsing (normally used for runtime video filter
switching only) was missing comparing the parameter values. Fix this,
and also make the code a bit more robust.
This commit is contained in:
wm4 2013-05-21 00:10:06 +02:00
parent d356f3efd2
commit 1ced961b92

View File

@ -2033,15 +2033,20 @@ static bool obj_setting_equals(m_obj_settings_t *a, m_obj_settings_t *b)
{ {
if (strcmp(a->name, b->name) != 0) if (strcmp(a->name, b->name) != 0)
return false; return false;
for (int n = 0; ; n += 2) {
if (!a->attribs[n] && !b->attribs[n]) int a_attr_count = 0;
return true; while (a->attribs && a->attribs[a_attr_count])
if (!a->attribs[n] || !b->attribs[n]) a_attr_count++;
return false; int b_attr_count = 0;
while (b->attribs && b->attribs[b_attr_count])
b_attr_count++;
if (a_attr_count != b_attr_count)
return false;
for (int n = 0; n < a_attr_count; n++) {
if (strcmp(a->attribs[n], b->attribs[n]) != 0) if (strcmp(a->attribs[n], b->attribs[n]) != 0)
return false; return false;
} }
abort(); return true;
} }
static int obj_settings_list_del(struct bstr opt_name, struct bstr param, static int obj_settings_list_del(struct bstr opt_name, struct bstr param,