[FFmpeg-cvslog] r8900 - trunk/libavcodec/mpegaudio_parser.c

Aurelien Jacobs aurel
Sun May 6 03:34:36 CEST 2007


On Sat, 05 May 2007 23:54:22 +0100
M?ns Rullg?rd <mans at mansr.com> wrote:

> aurel <subversion at mplayerhq.hu> writes:
> 
> > Author: aurel
> > Date: Sat May  5 20:17:03 2007
> > New Revision: 8900
> >
> > Log:
> > avoid a 'discards qualifiers from pointe' warning
> >
> > Modified:
> >    trunk/libavcodec/mpegaudio_parser.c
> >
> > Modified: trunk/libavcodec/mpegaudio_parser.c
> > ==============================================================================
> > --- trunk/libavcodec/mpegaudio_parser.c	(original)
> > +++ trunk/libavcodec/mpegaudio_parser.c	Sat May  5 20:17:03 2007
> > @@ -186,7 +186,7 @@ static int mpegaudio_parse(AVCodecParser
> >          if(s->frame_size > 0 && buf_ptr - buf == s->inbuf_ptr - s->inbuf
> >             && buf_size + buf_ptr - buf >= s->frame_size){
> >              if(s->header_count > 0){
> > -                *poutbuf = buf;
> > +                *poutbuf = (uint8_t *)buf;
> 
> This is wrong.  Never, *ever* remove a const qualifier.  The data
> pointed to might actually be read-only.  The correct solution is to
> make the assigned to variable also a pointer to const.

Ok. That was my feeling when adding this, but I still did it this way
because that's the way it was already done in most parsers.
Now I think that it's safer the other way (ie. casting a non-const to
a const), but I'm not sure it can't cause trouble ?
If it's safe, then something like the attached patch should be applied ?
(I will look at it a bit deeper tomorrow. It's getting late.)

Aurel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: const-parser.diff
Type: text/x-diff
Size: 15814 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-cvslog/attachments/20070506/df87259d/attachment.diff>



More information about the ffmpeg-cvslog mailing list