diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2009-12-14 23:47:22 +0000 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2009-12-14 23:47:22 +0000 |
commit | c3c78324792aaf7830b3c189d77b5e37ab929555 (patch) | |
tree | c32ffc512f6fd1ac5a9b937c62ef9c9a3b88889b /cmdutils.c | |
parent | 3d1ebac8f73875860020d5d7b6929fd1048374d2 (diff) | |
download | ffmpeg-c3c78324792aaf7830b3c189d77b5e37ab929555.tar.gz |
Factorize opt+1 out in parse_options(), simplify.
Originally committed as revision 20872 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'cmdutils.c')
-rw-r--r-- | cmdutils.c | 15 |
1 files 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); |