From 082b1cdeaa4fb720cca6e9cbad19c83df69f448c Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 3 Mar 2014 12:48:11 +0100 Subject: m_property: allow setting string properties via M_PROPERTY_SET_STRING Setting string options to strings over the m_option fallback (i.e. M_PROPERTY_SET_STRING is called if the option type is CONF_TYPE_STRING) failed. This was because m_option_parse() returns 0. 0 still means success, but the property code tried to be clever, and considered 0 not a success in order to disallow setting flags to an emtpy string (which in turn is allowed, because the command line allows flag options without parameters). Fix this by removing the overly clever code. This could happen when e.g. using the "set" command on options/title (a string option), and also was a problem for the client API. Closes #610. --- options/m_property.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'options') diff --git a/options/m_property.c b/options/m_property.c index 1dad9bd290..4efe68f83d 100644 --- a/options/m_property.c +++ b/options/m_property.c @@ -158,8 +158,7 @@ int m_property_do(struct mp_log *log, const m_option_t *prop_list, case M_PROPERTY_SET_STRING: { if (!log) return M_PROPERTY_ERROR; - // (reject 0 return value: success, but empty string with flag) - if (m_option_parse(log, &opt, bstr0(name), bstr0(arg), &val) <= 0) + if (m_option_parse(log, &opt, bstr0(name), bstr0(arg), &val) < 0) return M_PROPERTY_ERROR; r = do_action(prop_list, name, M_PROPERTY_SET, &val, ctx); m_option_free(&opt, &val); -- cgit v1.2.3