summaryrefslogtreecommitdiffstats
path: root/options/m_option.c
diff options
context:
space:
mode:
Diffstat (limited to 'options/m_option.c')
-rw-r--r--options/m_option.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/options/m_option.c b/options/m_option.c
index 165656500d..bd8e3357b9 100644
--- a/options/m_option.c
+++ b/options/m_option.c
@@ -1736,11 +1736,22 @@ static int read_subparam(struct mp_log *log, bstr optname,
}
p = bstr_cut(p, 1);
} else if (bstr_eatstart0(&p, "[")) {
- if (!bstr_split_tok(p, "]", &subparam, &p)) {
+ bstr s = p;
+ int balance = 1;
+ while (p.len && balance > 0) {
+ if (p.start[0] == '[') {
+ balance++;
+ } else if (p.start[0] == ']') {
+ balance--;
+ }
+ p = bstr_cut(p, 1);
+ }
+ if (balance != 0) {
mp_err(log, "Terminating ']' missing for '%.*s'\n",
BSTR_P(optname));
return M_OPT_INVALID;
}
+ subparam = bstr_splice(s, 0, s.len - p.len - 1);
} else if (bstr_eatstart0(&p, "%")) {
int optlen = bstrtoll(p, &p, 0);
if (!bstr_startswith0(p, "%") || (optlen > p.len - 1)) {
@@ -2934,6 +2945,11 @@ static int parse_obj_settings_list(struct mp_log *log, const m_option_t *opt,
}
if (op == OP_CLR) {
+ if (param.len) {
+ mp_err(log, "Option %.*s: -clr does not take an argument.\n",
+ BSTR_P(name));
+ return M_OPT_INVALID;
+ }
if (dst)
free_obj_settings_list(dst);
return 0;