[FFmpeg-devel] [PATCH] avcodec/snowenc: fix discarded const warning

Michael Niedermayer michaelni at gmx.at
Sun Sep 20 23:41:07 CEST 2015


On Sun, Sep 20, 2015 at 03:19:40PM -0400, Ganesh Ajjanagadde wrote:
> On Sun, Sep 20, 2015 at 2:14 PM, Nicolas George <george at nsup.org> wrote:
> > Le jour du Labour, an CCXXIII, Ganesh Ajjanagadde a écrit :
> >> This fixes a -Wdiscarded-qualifiers in e.g
> >> http://fate.ffmpeg.org/log.cgi?time=20150919093218&log=compile&slot=x86_64-archlinux-gcc-ddebug.
> >> It is quite clear from the code that the discard of constness was deliberate,
> >> so the cast should be fine.
> >
> > It may have been deliberate, but is it right? Unless I am missing somewhere
> > like last time, the codec is modifying a memory location that could be
> > read-only, according to the const flag on the function parameter. It will
> > probably never happen because of how we manage AVFrame allocation, but it is
> > not satisfactory.
> >
> > If codecs are authorized to modify basic properties of the input frame, then
> > const should be removed on the declaration of the encode_frame() method. If
> > not, then snowenc should be changed to avoid doing it; that last solution
> > seems not very complicated at a quick glance, just use a separate variable
> > for quality.
> 
> Perhaps I am being pessimistic, but there is also pic->pict_type in
> addition to pic->quality. I think it is best to wait to see if Michael
> has anything to say on this topic; snow is his brainchild after all.

fixed

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

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150920/854b47ca/attachment.sig>


More information about the ffmpeg-devel mailing list