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

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.
This commit is contained in:
wm4 2014-03-03 12:48:11 +01:00
parent 4bc0e3feac
commit 082b1cdeaa

View File

@ -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);