summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-09-22 08:04:08 +0200
committerwm4 <wm4@nowhere>2012-10-12 10:10:32 +0200
commit84af1733800fd78af61b2ebf5be10673192b68fe (patch)
tree8d1efba46dfb2af05e594360c90c2b2d63c670e3
parentb591688a2774f1142a56e9c2034ecd3002fdb8d8 (diff)
downloadmpv-84af1733800fd78af61b2ebf5be10673192b68fe.tar.bz2
mpv-84af1733800fd78af61b2ebf5be10673192b68fe.tar.xz
commands: cosmetics: rename things
This is Better (tm). The only actual change is that with M_PROPERTY_SET_STRING, the option parser will use the property name, instead whatever was set in the name field of the option returned by M_PROPERTY_GET_TYPE. In most cases, these should be the same, though.
-rw-r--r--command.c4
-rw-r--r--m_property.c8
-rw-r--r--m_property.h14
3 files changed, 13 insertions, 13 deletions
diff --git a/command.c b/command.c
index 53c8326e39..2fcaf2a8bb 100644
--- a/command.c
+++ b/command.c
@@ -1777,7 +1777,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
case MP_CMD_SET: {
cmd->args[0].v.s = translate_legacy_property(cmd, cmd->args[0].v.s);
- int r = mp_property_do(cmd->args[0].v.s, M_PROPERTY_PARSE,
+ int r = mp_property_do(cmd->args[0].v.s, M_PROPERTY_SET_STRING,
cmd->args[1].v.s, mpctx);
if (r == M_PROPERTY_UNKNOWN)
mp_msg(MSGT_CPLAYER, MSGL_WARN,
@@ -1817,7 +1817,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
case MP_CMD_GET_PROPERTY: {
cmd->args[0].v.s = translate_legacy_property(cmd, cmd->args[0].v.s);
char *tmp;
- int r = mp_property_do(cmd->args[0].v.s, M_PROPERTY_TO_STRING,
+ int r = mp_property_do(cmd->args[0].v.s, M_PROPERTY_GET_STRING,
&tmp, mpctx);
if (r <= 0) {
mp_msg(MSGT_CPLAYER, MSGL_WARN,
diff --git a/m_property.c b/m_property.c
index dc856966f3..25c0ef51e8 100644
--- a/m_property.c
+++ b/m_property.c
@@ -88,7 +88,7 @@ int m_property_do(const m_option_t *prop_list, const char *name,
*(char **)arg = str;
return str != NULL;
}
- case M_PROPERTY_TO_STRING: {
+ case M_PROPERTY_GET_STRING: {
if ((r = do_action(prop_list, name, M_PROPERTY_GET, &val, ctx)) <= 0)
return r;
char *str = m_option_print(&opt, &val);
@@ -96,9 +96,9 @@ int m_property_do(const m_option_t *prop_list, const char *name,
*(char **)arg = str;
return str != NULL;
}
- case M_PROPERTY_PARSE: {
+ case M_PROPERTY_SET_STRING: {
// (reject 0 return value: success, but empty string with flag)
- if (m_option_parse(&opt, bstr0(opt->name), bstr0(arg), &val) <= 0)
+ if (m_option_parse(&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);
@@ -184,7 +184,7 @@ char *m_properties_expand_string(const m_option_t *prop_list, char *str,
int method = M_PROPERTY_PRINT;
if (str[0] == '=') {
str += 1;
- method = M_PROPERTY_TO_STRING;
+ method = M_PROPERTY_GET_STRING;
}
int pl = e - str;
char pname[pl + 1];
diff --git a/m_property.h b/m_property.h
index 249a22e969..b5b8af26ee 100644
--- a/m_property.h
+++ b/m_property.h
@@ -52,19 +52,19 @@ enum mp_property_action {
// arg: struct m_property_switch_arg*
M_PROPERTY_SWITCH,
+ // Get a string containing a parsable representation.
+ // Can't be overridden by property implementations.
+ // arg: char**
+ M_PROPERTY_GET_STRING,
+
// Set a new value from a string. The property wrapper parses this using the
// parse function provided by the property type.
// Can't be overridden by property implementations.
// arg: char*
- M_PROPERTY_PARSE,
-
- // Get a string containing a parsable representation.
- // Can't be overridden by property implementations.
- // arg: char**
- M_PROPERTY_TO_STRING,
+ M_PROPERTY_SET_STRING,
// Pass down an action to a sub-property.
- // arg: struct m_property_action_arg*
+ // arg: struct m_property_action_arg*
M_PROPERTY_KEY_ACTION,
};