summaryrefslogtreecommitdiffstats
path: root/options
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-03-03 12:48:11 +0100
committerwm4 <wm4@nowhere>2014-03-03 12:48:41 +0100
commit082b1cdeaa4fb720cca6e9cbad19c83df69f448c (patch)
tree286bae41f9052a954bae41d09ab3d2ee67a326fe /options
parent4bc0e3feac2a39c5ab6cff628bc9494723b94bb4 (diff)
downloadmpv-082b1cdeaa4fb720cca6e9cbad19c83df69f448c.tar.bz2
mpv-082b1cdeaa4fb720cca6e9cbad19c83df69f448c.tar.xz
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.
Diffstat (limited to 'options')
-rw-r--r--options/m_property.c3
1 files changed, 1 insertions, 2 deletions
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);