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

Ganesh Ajjanagadde gajjanag at mit.edu
Sat Sep 19 23:43:13 CEST 2015


On Wed, Sep 16, 2015 at 9:08 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> 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

see patchv2, this avoids the issue.

>
> [...]
> --
> 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
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


More information about the ffmpeg-devel mailing list