[FFmpeg-devel] [PATCH] avcodec/put_bits: Fix LZW warning
Andreas Rheinhardt
andreas.rheinhardt at gmail.com
Sun Jul 19 20:48:47 EEST 2020
Hendrik Leppkes:
> On Sun, Jul 19, 2020 at 6:15 PM Steinar H. Gunderson
> <steinar+ffmpeg at gunderson.no> wrote:
>>
>> lzwenc stores a function pointer to either put_bits or put_bits_le.
>> Update the function pointer's prototype after the recent change.
>> ---
>> libavcodec/lzw.h | 4 +++-
>> libavcodec/lzwenc.c | 4 ++--
>> 2 files changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/libavcodec/lzw.h b/libavcodec/lzw.h
>> index 6af8a6b83a..400a479809 100644
>> --- a/libavcodec/lzw.h
>> +++ b/libavcodec/lzw.h
>> @@ -32,6 +32,8 @@
>>
>> #include <stdint.h>
>>
>> +#include "put_bits.h"
>> +
>> struct PutBitContext;
>
> This forward declaration is probably not needed anymore once you
> include put_bits.h.
>
> I do wonder if there was a concern with including the file before that
> caused the original author to use the forward declaration though...
>
The reason is probably that gif and tiff (the two users of this) use
different endianness (gif uses LE). A scenario like
#include "lzw.h"
#define BITSTREAM_WRITER_LE
#include "put_bits.h"
would be silently broken by this patch (the bitstream writer would be
big-endian).
Notice that gif.c defines BITSTREAM_WRITER_LE before including anything.
- Andreas
More information about the ffmpeg-devel
mailing list