On 6/10/17 4:47 PM, Diego Biurrun wrote:
> ---
>  avtools/cmdutils.c         |  2 +-
>  avtools/cmdutils.h         |  2 +-
>  libavcodec/options.c       |  5 +++--
>  libavfilter/avfilter.c     |  4 ++--
>  libavfilter/vf_delogo.c    |  2 +-
>  libavfilter/vf_drawtext.c  |  2 +-
>  libavfilter/vsrc_movie.c   |  2 +-
>  libavfilter/vsrc_testsrc.c |  4 ++--
>  libavformat/avio.c         |  4 ++--
>  libavformat/options.c      |  4 ++--
>  libavutil/internal.h       |  4 ++--
>  libavutil/log.c            | 26 +++++++++++++-------------
>  libavutil/log.h            | 12 ++++++------
>  libavutil/tests/opt.c      |  2 +-
>  libswscale/options.c       |  2 +-
>  15 files changed, 39 insertions(+), 38 deletions(-)
> 
> diff --git a/avtools/cmdutils.c b/avtools/cmdutils.c
> index ed55210..9c8e86b 100644
> --- a/avtools/cmdutils.c
> +++ b/avtools/cmdutils.c
> @@ -80,7 +80,7 @@ void uninit_opts(void)
>      av_dict_free(&resample_opts);
>  }
>  
> -void log_callback_help(void *ptr, int level, const char *fmt, va_list vl)
> +void log_callback_help(const void *ptr, int level, const char *fmt, va_list 
> vl)
>  {
>      vfprintf(stdout, fmt, vl);
>  }
> diff --git a/avtools/cmdutils.h b/avtools/cmdutils.h
> index cc78ac5..6a49b6b 100644
> --- a/avtools/cmdutils.h
> +++ b/avtools/cmdutils.h
> @@ -69,7 +69,7 @@ void uninit_opts(void);
>   * Trivial log callback.
>   * Only suitable for show_help and similar since it lacks prefix handling.
>   */
> -void log_callback_help(void* ptr, int level, const char* fmt, va_list vl);
> +void log_callback_help(const void *ptr, int level, const char *fmt, va_list 
> vl);
>  
>  /**
>   * Override the cpuflags mask.
> diff --git a/libavcodec/options.c b/libavcodec/options.c
> index 765bcb7..85b5aab 100644
> --- a/libavcodec/options.c
> +++ b/libavcodec/options.c
> @@ -37,8 +37,9 @@ FF_DISABLE_DEPRECATION_WARNINGS
>  #include "options_table.h"
>  FF_ENABLE_DEPRECATION_WARNINGS
>  
> -static const char* context_to_name(void* ptr) {
> -    AVCodecContext *avc= ptr;
> +static const char *context_to_name(const void *ptr)
> +{
> +    const AVCodecContext *avc = ptr;
>  
>      if(avc && avc->codec && avc->codec->name)
>          return avc->codec->name;
> diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
> index 83c1a7c..99b1722 100644
> --- a/libavfilter/avfilter.c
> +++ b/libavfilter/avfilter.c
> @@ -333,9 +333,9 @@ int avfilter_pad_count(const AVFilterPad *pads)
>      return count;
>  }
>  
> -static const char *filter_name(void *p)
> +static const char *filter_name(const void *p)
>  {
> -    AVFilterContext *filter = p;
> +    const AVFilterContext *filter = p;
>      return filter->filter->name;
>  }
>  
> diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c
> index dc58078..43bad70 100644
> --- a/libavfilter/vf_delogo.c
> +++ b/libavfilter/vf_delogo.c
> @@ -149,7 +149,7 @@ static const AVOption delogo_options[]= {
>      { NULL },
>  };
>  
> -static const char *delogo_get_name(void *ctx)
> +static const char *delogo_get_name(const void *ctx)
>  {
>      return "delogo";
>  }
> diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
> index a5e3f91..27f974a 100644
> --- a/libavfilter/vf_drawtext.c
> +++ b/libavfilter/vf_drawtext.c
> @@ -203,7 +203,7 @@ static const AVOption drawtext_options[]= {
>      { NULL},
>  };
>  
> -static const char *drawtext_get_name(void *ctx)
> +static const char *drawtext_get_name(const void *ctx)
>  {
>      return "drawtext";
>  }
> diff --git a/libavfilter/vsrc_movie.c b/libavfilter/vsrc_movie.c
> index aff6e62..731ee24 100644
> --- a/libavfilter/vsrc_movie.c
> +++ b/libavfilter/vsrc_movie.c
> @@ -75,7 +75,7 @@ static const AVOption movie_options[]= {
>      { NULL },
>  };
>  
> -static const char *movie_get_name(void *ctx)
> +static const char *movie_get_name(const void *ctx)
>  {
>      return "movie";
>  }
> diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
> index 5bd458c..d4b2e7e 100644
> --- a/libavfilter/vsrc_testsrc.c
> +++ b/libavfilter/vsrc_testsrc.c
> @@ -143,7 +143,7 @@ static int request_frame(AVFilterLink *outlink)
>  
>  #if CONFIG_TESTSRC_FILTER
>  
> -static const char *testsrc_get_name(void *ctx)
> +static const char *testsrc_get_name(const void *ctx)
>  {
>      return "testsrc";
>  }
> @@ -371,7 +371,7 @@ AVFilter ff_vsrc_testsrc = {
>  
>  #if CONFIG_RGBTESTSRC_FILTER
>  
> -static const char *rgbtestsrc_get_name(void *ctx)
> +static const char *rgbtestsrc_get_name(const void *ctx)
>  {
>      return "rgbtestsrc";
>  }
> diff --git a/libavformat/avio.c b/libavformat/avio.c
> index 1692f1b..702aac6 100644
> --- a/libavformat/avio.c
> +++ b/libavformat/avio.c
> @@ -32,9 +32,9 @@
>  
>  /** @name Logging context. */
>  /*@{*/
> -static const char *urlcontext_to_name(void *ptr)
> +static const char *urlcontext_to_name(const void *ptr)
>  {
> -    URLContext *h = (URLContext *)ptr;
> +    const URLContext *h = ptr;
>      if (h->prot)
>          return h->prot->name;
>      else
> diff --git a/libavformat/options.c b/libavformat/options.c
> index f0d2c47..4ef4aa7 100644
> --- a/libavformat/options.c
> +++ b/libavformat/options.c
> @@ -34,9 +34,9 @@ FF_DISABLE_DEPRECATION_WARNINGS
>  #include "options_table.h"
>  FF_ENABLE_DEPRECATION_WARNINGS
>  
> -static const char* format_to_name(void* ptr)
> +static const char *format_to_name(const void *ptr)
>  {
> -    AVFormatContext* fc = (AVFormatContext*) ptr;
> +    const AVFormatContext *fc = ptr;
>      if(fc->iformat) return fc->iformat->name;
>      else if(fc->oformat) return fc->oformat->name;
>      else return "NULL";
> diff --git a/libavutil/internal.h b/libavutil/internal.h
> index 8a0076f..714807a 100644
> --- a/libavutil/internal.h
> +++ b/libavutil/internal.h
> @@ -196,7 +196,7 @@
>   *                field is a pointer to an AVClass struct
>   * @param[in] msg string containing the name of the missing feature
>   */
> -void avpriv_report_missing_feature(void *avc,
> +void avpriv_report_missing_feature(const void *avc,
>                                     const char *msg, ...) av_printf_format(2, 
> 3);
>  
>  /**
> @@ -207,7 +207,7 @@ void avpriv_report_missing_feature(void *avc,
>   *                a pointer to an AVClass struct
>   * @param[in] msg string containing the name of the missing feature
>   */
> -void avpriv_request_sample(void *avc,
> +void avpriv_request_sample(const void *avc,
>                             const char *msg, ...) av_printf_format(2, 3);
>  
>  #if HAVE_LIBC_MSVCRT
> diff --git a/libavutil/log.c b/libavutil/log.c
> index 37427ef..a4b1ded 100644
> --- a/libavutil/log.c
> +++ b/libavutil/log.c
> @@ -115,19 +115,19 @@ static void colored_fputs(int level, int tint, const 
> char *str)
>      }
>  }
>  
> -const char *av_default_item_name(void *ptr)
> +const char *av_default_item_name(const void *ptr)
>  {
>      return (*(AVClass **) ptr)->class_name;
>  }
>  
> -void av_log_default_callback(void *avcl, int level, const char *fmt, va_list 
> vl)
> +void av_log_default_callback(const void *avcl, int level, const char *fmt, 
> va_list vl)
>  {
>      static int print_prefix = 1;
>      static int count;
>      static char prev[1024];
>      char line[1024];
>      static int is_atty;
> -    AVClass* avc = avcl ? *(AVClass **) avcl : NULL;
> +    const AVClass *avc = avcl ? *(const AVClass **) avcl : NULL;
>      unsigned tint = level & 0xff00;
>  
>      level &= 0xff;
> @@ -137,8 +137,8 @@ void av_log_default_callback(void *avcl, int level, const 
> char *fmt, va_list vl)
>      line[0] = 0;
>      if (print_prefix && avc) {
>          if (avc->parent_log_context_offset) {
> -            AVClass** parent = *(AVClass ***) (((uint8_t *) avcl) +
> -                                   avc->parent_log_context_offset);
> +            const AVClass **parent = *(const AVClass ***)
> +                                     (((uint8_t *) avcl) + 
> avc->parent_log_context_offset);
>              if (parent && *parent) {
>                  snprintf(line, sizeof(line), "[%s @ %p] ",
>                           (*parent)->item_name(parent), parent);
> @@ -177,12 +177,12 @@ void av_log_default_callback(void *avcl, int level, 
> const char *fmt, va_list vl)
>  #endif
>  }
>  
> -static void (*av_log_callback)(void*, int, const char*, va_list) =
> +static void (*av_log_callback)(const void *, int, const char *, va_list) =
>      av_log_default_callback;
>  
> -void av_log(void* avcl, int level, const char *fmt, ...)
> +void av_log(const void *avcl, int level, const char *fmt, ...)
>  {
> -    AVClass* avc = avcl ? *(AVClass **) avcl : NULL;
> +    const AVClass *avc = avcl ? *(const AVClass **) avcl : NULL;
>      va_list vl;
>      va_start(vl, fmt);
>      if (avc && avc->version >= (50 << 16 | 15 << 8 | 2) &&
> @@ -192,7 +192,7 @@ void av_log(void* avcl, int level, const char *fmt, ...)
>      va_end(vl);
>  }
>  
> -void av_vlog(void* avcl, int level, const char *fmt, va_list vl)
> +void av_vlog(const void *avcl, int level, const char *fmt, va_list vl)
>  {
>      av_log_callback(avcl, level, fmt, vl);
>  }
> @@ -212,12 +212,12 @@ void av_log_set_flags(int arg)
>      flags = arg;
>  }
>  
> -void av_log_set_callback(void (*callback)(void*, int, const char*, va_list))
> +void av_log_set_callback(void (*callback)(const void *, int, const char *, 
> va_list))
>  {
>      av_log_callback = callback;
>  }
>  
> -static void missing_feature_sample(int sample, void *avc, const char *msg,
> +static void missing_feature_sample(int sample, const void *avc, const char 
> *msg,
>                                     va_list argument_list)
>  {
>      av_vlog(avc, AV_LOG_WARNING, msg, argument_list);
> @@ -231,7 +231,7 @@ static void missing_feature_sample(int sample, void *avc, 
> const char *msg,
>                 "and contact the libav-devel mailing list.\n");
>  }
>  
> -void avpriv_request_sample(void *avc, const char *msg, ...)
> +void avpriv_request_sample(const void *avc, const char *msg, ...)
>  {
>      va_list argument_list;
>  
> @@ -240,7 +240,7 @@ void avpriv_request_sample(void *avc, const char *msg, 
> ...)
>      va_end(argument_list);
>  }
>  
> -void avpriv_report_missing_feature(void *avc, const char *msg, ...)
> +void avpriv_report_missing_feature(const void *avc, const char *msg, ...)
>  {
>      va_list argument_list;
>  
> diff --git a/libavutil/log.h b/libavutil/log.h
> index ce00bcc..3e55e0f 100644
> --- a/libavutil/log.h
> +++ b/libavutil/log.h
> @@ -42,7 +42,7 @@ typedef struct AVClass {
>       * A pointer to a function which returns the name of a context
>       * instance ctx associated with the class.
>       */
> -    const char* (*item_name)(void* ctx);
> +    const char *(*item_name)(const void *ctx);
>  
>      /**
>       * a pointer to the first option specified in the class if any or NULL
> @@ -177,7 +177,7 @@ typedef struct AVClass {
>   * @param fmt The format string (printf-compatible) that specifies how
>   *        subsequent arguments are converted to output.
>   */
> -void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 
> 4);
> +void av_log(const void *avcl, int level, const char *fmt, ...) 
> av_printf_format(3, 4);
>  
>  
>  /**
> @@ -195,7 +195,7 @@ void av_log(void *avcl, int level, const char *fmt, ...) 
> av_printf_format(3, 4);
>   *        subsequent arguments are converted to output.
>   * @param vl The arguments referenced by the format string.
>   */
> -void av_vlog(void *avcl, int level, const char *fmt, va_list vl);
> +void av_vlog(const void *avcl, int level, const char *fmt, va_list vl);
>  
>  /**
>   * Get the current log level
> @@ -222,7 +222,7 @@ void av_log_set_level(int level);
>   *
>   * @param callback A logging function with a compatible signature.
>   */
> -void av_log_set_callback(void (*callback)(void*, int, const char*, va_list));
> +void av_log_set_callback(void (*callback)(const void *, int, const char *, 
> va_list));
>  
>  /**
>   * Default logging callback
> @@ -237,7 +237,7 @@ void av_log_set_callback(void (*callback)(void*, int, 
> const char*, va_list));
>   *        subsequent arguments are converted to output.
>   * @param vl The arguments referenced by the format string.
>   */
> -void av_log_default_callback(void *avcl, int level, const char *fmt,
> +void av_log_default_callback(const void *avcl, int level, const char *fmt,
>                               va_list vl);
>  
>  /**
> @@ -247,7 +247,7 @@ void av_log_default_callback(void *avcl, int level, const 
> char *fmt,
>   *
>   * @return The AVClass class_name
>   */
> -const char* av_default_item_name(void* ctx);
> +const char *av_default_item_name(const void *ctx);
>  
>  /**
>   * Skip repeated messages, this requires the user app to use av_log() 
> instead of
> diff --git a/libavutil/tests/opt.c b/libavutil/tests/opt.c
> index 9ed9d2b..ec6f0eb 100644
> --- a/libavutil/tests/opt.c
> +++ b/libavutil/tests/opt.c
> @@ -53,7 +53,7 @@ static const AVOption test_options[] = {
>      { NULL },
>  };
>  
> -static const char *test_get_name(void *ctx)
> +static const char *test_get_name(const void *ctx)
>  {
>      return "test";
>  }
> diff --git a/libswscale/options.c b/libswscale/options.c
> index 2371b67..208613d 100644
> --- a/libswscale/options.c
> +++ b/libswscale/options.c
> @@ -24,7 +24,7 @@
>  #include "swscale.h"
>  #include "swscale_internal.h"
>  
> -static const char *sws_context_to_name(void *ptr)
> +static const char *sws_context_to_name(const void *ptr)
>  {
>      return "swscaler";
>  }
> 

should not hurt if it survives fate.

lu
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to