From 1ced961b92699ba2289406a999312c00d1139e2b Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 21 May 2013 00:10:06 +0200 Subject: 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. --- core/m_option.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'core') 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, -- cgit v1.2.3