1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-28 10:02:17 +00:00

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.
This commit is contained in:
wm4 2013-04-23 14:21:08 +02:00
parent 355b980a72
commit 50ce2bd6c8

View File

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