[FFmpeg-devel] Patch to reduce compiler warnings in libavcodec/aac_adtstoasc_bsf.c

Michael Niedermayer michaelni
Mon Jul 19 13:21:18 CEST 2010


On Sun, Jul 18, 2010 at 08:27:49PM -0700, Paul Sterne wrote:
> On Sun, Jul 18, 2010 at 5:45 PM, Michael Niedermayer <michaelni at gmx.at>wrote:
> 
> > On Sun, Jul 18, 2010 at 04:26:24PM -0700, Paul Sterne wrote:
> > > What is supposed to be const about buf?  Not the pointer buf itself, but
> > the
> > > contents of what buf is pointed to?
> > > If buf was to be copied to poutbuff, shouldn't it remain const?  If yes,
> > > then poutbuf also needs to be const, and the routine should never need to
> > > modify the contents of what is pointed to, whether by buf or by poutbuf.
> >
> > poutbuf must be av_free()ed in some cases, thus it cannot be const even if
> > it
> > sometimes is pointing to a const array
> >
> > Can you tell me the source file where the av_free is performed on a
> variable also passed for poutbuf to aac_adtsasc_bsf ?

i cannot parse this sentance.


> 
> My version built OK and with fewer warnings and passed all regression tests.

The regression tests dont even test the bitstream filters IIRC thats besides
that wrong code is wrong code even if it happens to work


> 
> There may be cases where a variable that is not const will need to be cast
> as const in the call to aac_adtsasc_bsf to eliminate a compiler warning, but
> it would remain non-const in the calling function.

what you do is change const to non const and then modify the array, that is
after your patch


> 
> Question... what is the purpose of using the -Wcast-qual compiler flag to
> generate so many of those warning messages, but apparently not responding to
> those messages over time?

The purpose of warnings is to point to possible bugs.
Some warnings are wrong and all related code is correct.
Some wrong warnings cannot be removed cleanly&easily except by disabling
the whole class of warnings.

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100719/bf3fc6e9/attachment.pgp>



More information about the ffmpeg-devel mailing list