diff options
author | wm4 <wm4@nowhere> | 2013-05-21 00:10:06 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-05-21 00:12:13 +0200 |
commit | 1ced961b92699ba2289406a999312c00d1139e2b (patch) | |
tree | 05e393f176205ad0408c1b8db1b95875a6deddef | |
parent | d356f3efd278d38e0b0cfca05b37e40d40118f6a (diff) | |
download | mpv-1ced961b92699ba2289406a999312c00d1139e2b.tar.bz2 mpv-1ced961b92699ba2289406a999312c00d1139e2b.tar.xz |
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.
-rw-r--r-- | core/m_option.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/core/m_option.c b/core/m_option.c index e291165cbf..e9feef7db9 100644 --- a/core/m_option.c +++ b/core/m_option.c @@ -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) return false; - for (int n = 0; ; n += 2) { - if (!a->attribs[n] && !b->attribs[n]) - return true; - if (!a->attribs[n] || !b->attribs[n]) - return false; + + int a_attr_count = 0; + while (a->attribs && a->attribs[a_attr_count]) + a_attr_count++; + 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) return false; } - abort(); + return true; } static int obj_settings_list_del(struct bstr opt_name, struct bstr param, |