[FFmpeg-devel] [PATCH 4/4] lavu/opt: copy dict in av_opt_copy

Michael Niedermayer michaelni at gmx.at
Sat Nov 8 20:36:57 CET 2014


On Sat, Nov 08, 2014 at 08:19:09PM +0100, Lukasz Marek wrote:
> On 08.11.2014 19:36, Michael Niedermayer wrote:
> >On Sat, Nov 08, 2014 at 06:13:53PM +0100, Lukasz Marek wrote:
> >>Signed-off-by: Lukasz Marek <lukasz.m.luki2 at gmail.com>
> >>---
> >>  libavutil/opt.c | 7 +++++++
> >>  1 file changed, 7 insertions(+)
> >>
> >>diff --git a/libavutil/opt.c b/libavutil/opt.c
> >>index 0692393..86d3ddf 100644
> >>--- a/libavutil/opt.c
> >>+++ b/libavutil/opt.c
> >>@@ -1596,6 +1596,13 @@ int av_opt_copy(void *dst, void *src)
> >>              *(int*)(field_dst8 + 1) = len;
> >>          } else if (o->type == AV_OPT_TYPE_CONST) {
> >>              // do nothing
> >>+        } else if (o->type == AV_OPT_TYPE_DICT) {
> >>+            if (*field_dst8 != *field_src8)
> >>+                av_dict_free(field_dst8);
> >>+            *field_dst8 = NULL;
> >>+            av_dict_copy(field_dst8, *field_src8, 0);
> >>+            if (av_dict_count(*field_src8) != av_dict_count(*field_dst8))
> >>+                ret = AVERROR(ENOMEM);
> >
> >this results in some warnings:
> >
> >libavutil/opt.c:1601:17: warning: passing argument 1 of ‘av_dict_free’ from incompatible pointer type [enabled by default]
> >libavutil/dict.h:172:6: note: expected ‘struct AVDictionary **’ but argument is of type ‘uint8_t **’
> >libavutil/opt.c:1603:13: warning: passing argument 1 of ‘av_dict_copy’ from incompatible pointer type [enabled by default]
> >libavutil/dict.h:166:6: note: expected ‘struct AVDictionary **’ but argument is of type ‘uint8_t **’
> >libavutil/opt.c:1603:13: warning: passing argument 2 of ‘av_dict_copy’ from incompatible pointer type [enabled by default]
> >libavutil/dict.h:166:6: note: expected ‘const struct AVDictionary *’ but argument is of type ‘uint8_t *’
> >libavutil/opt.c:1604:13: warning: passing argument 1 of ‘av_dict_count’ from incompatible pointer type [enabled by default]
> >libavutil/dict.h:113:5: note: expected ‘const struct AVDictionary *’ but argument is of type ‘uint8_t *’
> >libavutil/opt.c:1604:13: warning: passing argument 1 of ‘av_dict_count’ from incompatible pointer type [enabled by default]
> 
> OK, sorry
> I attached fixed version
> 

>  opt.c |    9 +++++++++
>  1 file changed, 9 insertions(+)
> ce2f2862957ed0228ec483604e2792e813ffb175  0001-lavu-opt-copy-dict-in-av_opt_copy.patch
> From 0b84cf7c4615fb8deeaa3103dacad1616aa0bba2 Mon Sep 17 00:00:00 2001
> From: Lukasz Marek <lukasz.m.luki2 at gmail.com>
> Date: Sat, 8 Nov 2014 18:12:56 +0100
> Subject: [PATCH] lavu/opt: copy dict in av_opt_copy

LGTM

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates
-------------- 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/20141108/46447827/attachment.asc>


More information about the ffmpeg-devel mailing list