[FFmpeg-devel] [PATCH] cmdutils: change signature to list_fmts()

Måns Rullgård mans
Sat Mar 12 13:03:04 CET 2011


Stefano Sabatini <stefano.sabatini-lala at poste.it> writes:

> Make it accept a function returning a char *.
>
> Fix warning:
> ffmpeg.c: In function ?opt_audio_sample_fmt?:
> ffmpeg.c:2877: warning: passing argument 1 of ?list_fmts? from incompatible pointer type
> cmdutils.h:163: note: expected ?void (*)(char *, int,  int)? but argument is of type ?char * (*)(char *, int,  enum AVSampleFormat)?
> ---
>  cmdutils.c |    2 +-
>  cmdutils.h |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/cmdutils.c b/cmdutils.c
> index 514ebad..38638a7 100644
> --- a/cmdutils.c
> +++ b/cmdutils.c
> @@ -506,7 +506,7 @@ void show_license(void)
>      );
>  }
>
> -void list_fmts(void (*get_fmt_string)(char *buf, int buf_size, int fmt), int nb_fmts)
> +void list_fmts(char *(*get_fmt_string)(char *buf, int buf_size, int fmt), int nb_fmts)
>  {
>      int i;
>      char fmt_str[128];
> diff --git a/cmdutils.h b/cmdutils.h
> index c3d8a42..4627b76 100644
> --- a/cmdutils.h
> +++ b/cmdutils.h
> @@ -160,7 +160,7 @@ void set_context_opts(void *ctx, void *opts_ctx, int flags, AVCodec *codec);
>   */
>  void print_error(const char *filename, int err);
>
> -void list_fmts(void (*get_fmt_string)(char *buf, int buf_size, int fmt), int nb_fmts);
> +void list_fmts(char *(*get_fmt_string)(char *buf, int buf_size, int fmt), int nb_fmts);
>
>  /**
>   * Print the program banner to stderr. The banner contents depend on the
> -- 
> 1.7.2.3

Why is this implemented in this way anyway?  It is only used in once
place, so passing function pointers around seems unnecessary.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list