Alexandra Khirnova <[email protected]> writes:

> ---
>  cmdutils.c |   10 +++++++++-
>  1 files changed, 9 insertions(+), 1 deletions(-)
>
> diff --git a/cmdutils.c b/cmdutils.c
> index 1c2bf46..bd066d8 100644
> --- a/cmdutils.c
> +++ b/cmdutils.c
> @@ -288,7 +288,7 @@ void parse_options(void *optctx, int argc, char **argv, 
> const OptionDef *options
>                     void (* parse_arg_function)(void *, const char*))
>  {
>      const char *opt;
> -    int optindex, handleoptions = 1, ret;
> +    int optindex, handleoptions = 1, ret, last_parse_arg_index = 0;
>
>      /* perform system-dependent conversions for arguments list */
>      prepare_app_arguments(&argc, &argv);
> @@ -311,8 +311,16 @@ void parse_options(void *optctx, int argc, char **argv, 
> const OptionDef *options
>          } else {
>              if (parse_arg_function)
>                  parse_arg_function(optctx, opt);
> +            last_parse_arg_index = optindex;
>          }
>      }
> +    if ((optindex - last_parse_arg_index)) {

Useless double brackets.

> +        int i;
> +        av_log(NULL, AV_LOG_WARNING, "Trailing options found: ");
> +        for (i = (optindex - last_parse_arg_index); i > 0; i--)

More useless brackets.

> +            av_log(NULL, AV_LOG_WARNING, "%s ", argv[argc - i]);
> +        av_log(NULL, AV_LOG_WARNING, "they will be ignored.\n");
> +    }

Why is this loop counting in such a complicated way?  Why not count
upward from the first index to be printed?

Also, the message printed will look rather weird.

-- 
Måns Rullgård
[email protected]
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to