[FFmpeg-devel] [PATCH] fix warning in libavutil/fifo.c

Diego Biurrun diego
Sun Jan 25 15:58:48 CET 2009


On Tue, Jan 13, 2009 at 12:52:01PM -0800, Baptiste Coudurier wrote:
> 
> Michael Niedermayer wrote:
> > On Mon, Jan 12, 2009 at 10:33:12PM +0100, Diego Biurrun wrote:
> >> On Mon, Jan 12, 2009 at 09:13:58PM +0100, Michael Niedermayer wrote:
> >>> On Sun, Jan 11, 2009 at 10:17:18PM +0100, Diego Biurrun wrote:
> >>>> Here is a patch to fix
> >>>>
> >>>> fifo.c:79: warning: cast discards qualifiers from pointer target type
> >>>>
> >>>> --- libavutil/fifo.c	(revision 16549)
> >>>> +++ libavutil/fifo.c	(working copy)
> >>>> @@ -74,7 +74,7 @@
> >>>>  
> >>>> -void av_fifo_write(AVFifoBuffer *f, const uint8_t *buf, int size)
> >>>> +void av_fifo_write(AVFifoBuffer *f, uint8_t *buf, int size)
> >>> I belive av_fifo_write does not change the content of buf thus const
> >>> is correct
> >> Umm, I beg to differ. av_fifo_write is just a wrapper for
> >> av_fifo_generic_write, which does modify buf, hence the warning.
> > 
> > where does it modify the _CONTENT_OF_ buf?
> > 
> > It does not do this anywhere in the case where it is called through
> > av_fifo_write thus the const is correct.
> > av_fifo_write can be used with const arrays, if you remove the cont in the
> > parameter of av_fifo_write() you will have a warning for every use of
> > av_fifo_write() with a const argument, i doubt you prefer this ...
> 
> Would changing the prototype of 'func' to take const void * fix it ?

As in $attached?

Diego
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fifo.diff
Type: text/x-diff
Size: 1448 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090125/fd3a25ef/attachment.diff>



More information about the ffmpeg-devel mailing list