[FFmpeg-devel] [PATCH] avformat/format: silence -Wdiscarded-qualifiers

Michael Niedermayer michaelni at gmx.at
Thu Sep 17 03:08:43 CEST 2015


On Wed, Sep 16, 2015 at 06:50:54PM -0400, Ganesh Ajjanagadde wrote:
> lpd.buf is non-const and discards the const qualifier of zerobuffer.
> This fixes -Wdiscarded-qualifiers observed with GCC 5.2.
> 
> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
> ---
>  libavformat/format.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/format.c b/libavformat/format.c
> index fd81d7a..9c40512 100644
> --- a/libavformat/format.c
> +++ b/libavformat/format.c
> @@ -172,7 +172,7 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened,
>      AVProbeData lpd = *pd;
>      AVInputFormat *fmt1 = NULL, *fmt;
>      int score, nodat = 0, score_max = 0;
> -    const static uint8_t zerobuffer[AVPROBE_PADDING_SIZE];
> +    static uint8_t zerobuffer[AVPROBE_PADDING_SIZE];

this is wrong, the buffer is constant
if the content of the buffer would change that would be a serious
bug.
Before this change the compiler would detect direct changes done to
the buffer

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

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf
-------------- 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/20150917/5774ee24/attachment.sig>


More information about the ffmpeg-devel mailing list