[FFmpeg-devel] [PATCH 5/5] all: fix enum definition for large values
gajjanag at mit.edu
Sat Oct 24 20:41:59 CEST 2015
On Sat, Oct 24, 2015 at 2:33 PM, Michael Niedermayer
<michael at niedermayer.cc> wrote:
> On Sat, Oct 24, 2015 at 09:29:23AM -0400, Ganesh Ajjanagadde wrote:
>> ISO C restricts enumerator values to the range of int. Thus (for instance) 0x80000000
>> unfortunately does not work, and throws a warning with -Wpedantic on
>> clang 3.7.
>> This fixes such errors by explicitly casting as an int, doing the
>> desired unsigned to signed conversion. This method works on all current
>> architectures. Tested with FATE.
>> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
> Simply changing the values to signed is not correct / not sufficient
> the code assumes that they are unsigned
enums are ints (and hence signed). I doubt code assumed that they are
unsigned. If code depended on these being unsigned constants, then
there is no way of placing them in an enum. Are you fine with a macro,
or do you prefer a static const style? Generally, it seems like FFmpeg
prefers the macro method for defining such constants/flags.
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> Many things microsoft did are stupid, but not doing something just because
> microsoft did it is even more stupid. If everything ms did were stupid they
> would be bankrupt already.
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
More information about the ffmpeg-devel