mirror of https://git.ffmpeg.org/ffmpeg.git
Factorize opt+1 out in parse_options(), simplify.
Originally committed as revision 20872 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
3d1ebac8f7
commit
c3c7832479
15
cmdutils.c
15
cmdutils.c
|
@ -130,10 +130,11 @@ void parse_options(int argc, char **argv, const OptionDef *options,
|
||||||
handleoptions = 0;
|
handleoptions = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
po= find_option(options, opt + 1);
|
opt++;
|
||||||
if (!po->name && opt[1] == 'n' && opt[2] == 'o') {
|
po= find_option(options, opt);
|
||||||
|
if (!po->name && opt[0] == 'n' && opt[1] == 'o') {
|
||||||
/* handle 'no' bool option */
|
/* handle 'no' bool option */
|
||||||
po = find_option(options, opt + 3);
|
po = find_option(options, opt + 2);
|
||||||
if (!(po->name && (po->flags & OPT_BOOL)))
|
if (!(po->name && (po->flags & OPT_BOOL)))
|
||||||
goto unknown_opt;
|
goto unknown_opt;
|
||||||
bool_val = 0;
|
bool_val = 0;
|
||||||
|
@ -160,13 +161,13 @@ unknown_opt:
|
||||||
} else if (po->flags & OPT_BOOL) {
|
} else if (po->flags & OPT_BOOL) {
|
||||||
*po->u.int_arg = bool_val;
|
*po->u.int_arg = bool_val;
|
||||||
} else if (po->flags & OPT_INT) {
|
} else if (po->flags & OPT_INT) {
|
||||||
*po->u.int_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT_MIN, INT_MAX);
|
*po->u.int_arg = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX);
|
||||||
} else if (po->flags & OPT_INT64) {
|
} else if (po->flags & OPT_INT64) {
|
||||||
*po->u.int64_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT64_MIN, INT64_MAX);
|
*po->u.int64_arg = parse_number_or_die(opt, arg, OPT_INT64, INT64_MIN, INT64_MAX);
|
||||||
} else if (po->flags & OPT_FLOAT) {
|
} else if (po->flags & OPT_FLOAT) {
|
||||||
*po->u.float_arg = parse_number_or_die(opt+1, arg, OPT_FLOAT, -1.0/0.0, 1.0/0.0);
|
*po->u.float_arg = parse_number_or_die(opt, arg, OPT_FLOAT, -1.0/0.0, 1.0/0.0);
|
||||||
} else if (po->flags & OPT_FUNC2) {
|
} else if (po->flags & OPT_FUNC2) {
|
||||||
if(po->u.func2_arg(opt+1, arg)<0)
|
if(po->u.func2_arg(opt, arg)<0)
|
||||||
goto unknown_opt;
|
goto unknown_opt;
|
||||||
} else {
|
} else {
|
||||||
po->u.func_arg(arg);
|
po->u.func_arg(arg);
|
||||||
|
|
Loading…
Reference in New Issue