From 50ce2bd6c86ea44aef6bf64fdc0af605e45e6612 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 23 Apr 2013 14:21:08 +0200 Subject: m_option: fix positional sub-option skipping Empty sub-option parameters mean the sub-option should be skipped, e.g. -vf gradfun=:10 sets the second option (by position) to 10. This was broken in commit 04f1e2d. --- core/m_option.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/m_option.c b/core/m_option.c index cbae2fb349..a0b4808e2e 100644 --- a/core/m_option.c +++ b/core/m_option.c @@ -1772,7 +1772,7 @@ static int get_obj_param(bstr opt_name, bstr obj_name, const m_struct_t *desc, // positional fields if (val.len == 0) { // Empty field, count it and go on (*nold)++; - return 1; + return 0; } if ((*nold) >= oldmax) { mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Option %.*s: %.*s has only %d params, so you can't give more than %d unnamed params.\n", @@ -1823,7 +1823,7 @@ static int get_obj_params(struct bstr opt_name, struct bstr name, if (r < 0) goto exit; - if (ret) { + if (r > 0 && ret) { MP_TARRAY_APPEND(NULL, args, num_args, bstrto0(NULL, fname)); MP_TARRAY_APPEND(NULL, args, num_args, bstrto0(NULL, fval)); } -- cgit v1.2.3