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

Michael Niedermayer michaelni
Tue Jan 13 19:24:54 CET 2009


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 ...

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090113/4fa42ccc/attachment.pgp>



More information about the ffmpeg-devel mailing list