From c3c78324792aaf7830b3c189d77b5e37ab929555 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Mon, 14 Dec 2009 23:47:22 +0000 Subject: [PATCH] Factorize opt+1 out in parse_options(), simplify. Originally committed as revision 20872 to svn://svn.ffmpeg.org/ffmpeg/trunk --- cmdutils.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cmdutils.c b/cmdutils.c index a1bf6d5d4e..68ef726dd3 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -130,10 +130,11 @@ void parse_options(int argc, char **argv, const OptionDef *options, handleoptions = 0; continue; } - po= find_option(options, opt + 1); - if (!po->name && opt[1] == 'n' && opt[2] == 'o') { + opt++; + po= find_option(options, opt); + if (!po->name && opt[0] == 'n' && opt[1] == 'o') { /* handle 'no' bool option */ - po = find_option(options, opt + 3); + po = find_option(options, opt + 2); if (!(po->name && (po->flags & OPT_BOOL))) goto unknown_opt; bool_val = 0; @@ -160,13 +161,13 @@ unknown_opt: } else if (po->flags & OPT_BOOL) { *po->u.int_arg = bool_val; } 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) { - *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) { - *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) { - if(po->u.func2_arg(opt+1, arg)<0) + if(po->u.func2_arg(opt, arg)<0) goto unknown_opt; } else { po->u.func_arg(arg);