[FFmpeg-devel] [PATCH] lavu/opt: add const to av_opt_copy arg

Michael Niedermayer michaelni at gmx.at
Sun Nov 23 02:29:53 CET 2014


On Sun, Nov 23, 2014 at 01:01:19AM +0100, Lukasz Marek wrote:
> On 23.11.2014 00:58, Lukasz Marek wrote:
> >Signed-off-by: Lukasz Marek <lukasz.m.luki2 at gmail.com>
> >---
> >  libavutil/opt.c | 2 +-
> >  libavutil/opt.h | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> >
> >diff --git a/libavutil/opt.c b/libavutil/opt.c
> >index 0546a37..47b1f0c 100644
> >--- a/libavutil/opt.c
> >+++ b/libavutil/opt.c
> >@@ -1570,7 +1570,7 @@ static int opt_size(enum AVOptionType type)
> >      return 0;
> >  }
> >
> >-int av_opt_copy(void *dst, void *src)
> >+int av_opt_copy(void *dst, FF_CONST_AVUTIL53 void *src)
> >  {
> >      const AVOption *o = NULL;
> >      const AVClass *c;
> >diff --git a/libavutil/opt.h b/libavutil/opt.h
> >index 7338e78..6b6c996 100644
> >--- a/libavutil/opt.h
> >+++ b/libavutil/opt.h
> >@@ -825,7 +825,7 @@ int av_opt_query_ranges(AVOptionRanges **, void *obj, const char *key, int flags
> >   * @param src  Object to copy into
> >   * @return 0 on success, negative on error
> >   */
> >-int av_opt_copy(void *dest, void *src);
> >+int av_opt_copy(void *dest, FF_CONST_AVUTIL53 void *src);
> >
> >  /**
> >   * Get a default list of allowed ranges for the given option.
> >
> 
> I added FF_CONST_AVUTILS53 macro, but is this really needed? Cannot
> be just const?
> I'm asking because I think it doesn't fix anything.
> I guess is it API/ABI thing, but why?

a user application could have a function pointer like

all_ffmpeg_functions->opt_copy = av_opt_copy;

and if we add const the prototype changes and this can fail to build
with some compiler flags or C++ or whatever

and yes i have seen an application that had function pointers to
ffmpeg functions

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

You can kill me, but you cannot change the truth.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141123/e2c44e56/attachment.asc>


More information about the ffmpeg-devel mailing list