[FFmpeg-devel] [PATCH] Fix warning in av_rescale_rnd (in libavutil/mathematics.c)

Måns Rullgård mans
Sat Jul 3 16:23:48 CEST 2010


Reimar D?ffinger <Reimar.Doeffinger at gmx.de> writes:

> On Sat, Jul 03, 2010 at 12:17:25PM +0200, Michael Niedermayer wrote:
>> On Sat, Jul 03, 2010 at 12:42:08AM -0700, Eli Friedman wrote:
>> > Patch attached.  Fixes warning "comparison of unsigned expression >= 0
>> > is always true".
>> 
>> god damn, its a assert(), what is wrong with asserting that a variable
>> is unsigned or if signed is positive. Why is gcc so retarded
>
> Umm, gcc just can't know your intention. I have seen this kind of
> thing quite a few times where it was an actual bug because someone
> forgot to make a variable signed.
> That said, casting the value to int before the comparison should
> avoid the warning...

Or cast it to unsigned and check only the upper limit.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list