[FFmpeg-devel] [PATCH] Fix some warnings in NUT (de)muxer

Vitor Sessak vitor1001
Fri Mar 26 21:23:33 CET 2010


Michael Niedermayer wrote:
> On Wed, Mar 24, 2010 at 09:03:31PM +0100, Vitor Sessak wrote:
>> Michael Niedermayer wrote:
>>> On Wed, Mar 24, 2010 at 08:35:24PM +0100, Vitor Sessak wrote:
>>>> $subj.
>>>>
>>>> Patch 1:
>>>> libavformat/nutdec.c: In function ?read_seek?:
>>>> libavformat/nutdec.c:862: warning: passing argument 3 of 
>>>> ?av_tree_find? from incompatible pointer type
>>>> ./libavutil/tree.h:44: note: expected ?int (*)(void *, const void *)? 
>>>> but argument is of type ?int (*)(struct Syncpoint *, struct Syncpoint 
>>>> *)?
>>>> libavformat/nutdec.c:871: warning: passing argument 3 of 
>>>> ?av_tree_find? from incompatible pointer type
>>>> ./libavutil/tree.h:44: note: expected ?int (*)(void *, const void *)? 
>>>> but argument is of type ?int (*)(struct Syncpoint *, struct Syncpoint 
>>>> *)?
>>>> libavformat/nutdec.c:879: warning: passing argument 3 of 
>>>> ?av_tree_find? from incompatible pointer type
>>>> ./libavutil/tree.h:44: note: expected ?int (*)(void *, const void *)? 
>>>> but argument is of type ?int (*)(struct Syncpoint *, struct Syncpoint 
>>>> *)?
>>>> CC	libavformat/nutenc.o
>>>> libavformat/nutenc.c: In function ?write_packet?:
>>>> libavformat/nutenc.c:680: warning: passing argument 3 of 
>>>> ?av_tree_find? from incompatible pointer type
>>>> ./libavutil/tree.h:44: note: expected ?int (*)(void *, const void *)? 
>>>> but argument is of type ?int (*)(struct Syncpoint *, struct Syncpoint 
>>>> *)?
>>>>
>>>> Patch 2:
>>>> libavformat/nutdec.c: In function ?read_seek?:
>>>> libavformat/nutdec.c:862: warning: passing argument 4 of 
>>>> ?av_tree_find? from incompatible pointer type
>>>> ./libavutil/tree.h:44: note: expected ?void **? but argument is of 
>>>> type ?struct Syncpoint **?
>>>> libavformat/nutdec.c:871: warning: passing argument 4 of 
>>>> ?av_tree_find? from incompatible pointer type
>>>> ./libavutil/tree.h:44: note: expected ?void **? but argument is of 
>>>> type ?struct Syncpoint **?
>>>>
>>>> -Vitor
>>>>  nut.c |   11 ++++++++---
>>>>  nut.h |    4 ++--
>>>>  2 files changed, 10 insertions(+), 5 deletions(-)
>>>> 4fb6aa0edd5e782f70ef9b755e04262c98ece7cf  nut_warnings.diff
>>>> Index: libavformat/nut.c
>>>> ===================================================================
>>>> --- libavformat/nut.c	(revision 22644)
>>>> +++ libavformat/nut.c	(working copy)
>>>> @@ -47,11 +47,15 @@
>>>>      return  ((lsb - delta)&mask) + delta;
>>>>  }
>>>>  -int ff_nut_sp_pos_cmp(Syncpoint *a, Syncpoint *b){
>>>> +int ff_nut_sp_pos_cmp(void *ap, const void *bp){
>>>> +    Syncpoint *a = ap;
>>>> +    const Syncpoint *b = bp;
>>>>      return ((a->pos - b->pos) >> 32) - ((b->pos - a->pos) >> 32);
>>>>  }
>>>>  -int ff_nut_sp_pts_cmp(Syncpoint *a, Syncpoint *b){
>>>> +int ff_nut_sp_pts_cmp(void *ap, const void *bp){
>>>> +    Syncpoint *a = ap;
>>>> +    const Syncpoint *b = bp;
>>>>      return ((a->ts - b->ts) >> 32) - ((b->ts - a->ts) >> 32);
>>>>  }
>>>>  
>>> fix gcc instead or just cast the function pointer to void*
>> Used the cast, but added "const" to the type to make it more correct 
>> (attached).
> 
> both args should be const

Like attached?

BTW, why don't libavutil/tree.h functions do not get as params

  int (*cmp)(const void *key, const void *b)

intead of

  int (*cmp)(void *key, const void *b)

? But in any way this is unrelated to the attached patch.

-Vitor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nut_warnings4.diff
Type: text/x-patch
Size: 3936 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100326/83b6a819/attachment.bin>



More information about the ffmpeg-devel mailing list