diff options
author | wm4 <wm4@nowhere> | 2013-12-15 23:20:54 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-12-16 20:03:00 +0100 |
commit | b65a6c3cd0cac1f86a3a5069514867c48a9fa4e3 (patch) | |
tree | 1e3091e6fc305b7104c45caac893c20546b2ecc8 | |
parent | fe367272bd18b65f5ca334bd158bbc58f0bf894f (diff) | |
download | mpv-b65a6c3cd0cac1f86a3a5069514867c48a9fa4e3.tar.bz2 mpv-b65a6c3cd0cac1f86a3a5069514867c48a9fa4e3.tar.xz |
input: remove weird syntax for skipping optional arguments
-rw-r--r-- | mpvcore/input/input.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/mpvcore/input/input.c b/mpvcore/input/input.c index df6c11b032..c7081e6514 100644 --- a/mpvcore/input/input.c +++ b/mpvcore/input/input.c @@ -142,7 +142,7 @@ static const struct mp_cmd_def mp_cmds[] = { { MP_CMD_SEEK, "seek", { ARG_TIME, - OARG_CHOICE(0, ({"relative", 0}, {"0", 0}, + OARG_CHOICE(0, ({"relative", 0}, {"0", 0}, {"-", 0}, {"absolute-percent", 1}, {"1", 1}, {"absolute", 2}, {"2", 2})), OARG_CHOICE(0, ({"default-precise", 0}, {"0", 0}, @@ -191,7 +191,7 @@ static const struct mp_cmd_def mp_cmds[] = { { MP_CMD_SCREENSHOT, "screenshot", { OARG_CHOICE(2, ({"video", 0}, {"window", 1}, - {"subtitles", 2})), + {"subtitles", 2}, {"-", 2})), OARG_CHOICE(0, ({"single", 0}, {"each-frame", 1})), }}, @@ -1022,14 +1022,8 @@ static int parse_cmd(struct input_ctx *ictx, struct mp_cmd **dest, bstr str, } } else { bool got_token = read_token(str, &str, &arg); - if (is_vararg) { - if (!got_token) - continue; - } else { - // Explicitly select default for an optional argument - if (got_token && opt->defval && bstr_equals0(arg, "-")) - got_token = false; - } + if (is_vararg && !got_token) + continue; // Skip optional arguments if (!got_token && opt->defval) { struct mp_cmd_arg *cmdarg = &cmd->args[cmd->nargs]; |