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

Lukasz Marek lukasz.m.luki2 at gmail.com
Sat Nov 8 20:19:09 CET 2014


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lavu-opt-copy-dict-in-av_opt_copy.patch
Type: text/x-patch
Size: 1171 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141108/39fa5834/attachment.bin>


More information about the ffmpeg-devel mailing list