[MPlayer-dev-eng] [PATCH] signed-ness warning fix - x11_common.c
Dominik 'Rathann' Mierzejewski
dominik at rangers.eu.org
Sat May 13 20:33:55 CEST 2006
On Friday, 05 May 2006 at 17:20, Rich Felker wrote:
> On Fri, May 05, 2006 at 10:50:49AM +0200, Pierre Lombard wrote:
> > Hi,
> >
> > The patch attached avoid some signed-ness (unsigned int < 0 = useless)
What is the exact warning? My GCCs don't generate it (4.0.2, 4.1.0).
> > Index: libvo//x11_common.c
> > ===================================================================
> > RCS file: /cvsroot/mplayer/main/libvo/x11_common.c,v
> > retrieving revision 1.210
> > diff -u -r1.210 x11_common.c
> > --- libvo//x11_common.c 25 Apr 2006 21:36:02 -0000 1.210
> > +++ libvo//x11_common.c 5 May 2006 08:49:23 -0000
> > @@ -1598,7 +1598,7 @@
> > XEvent ev;
> >
> > if (mDisplay && xs_windowid &&
> > - ((time - time_last) > 30000 || (time - time_last) < 0))
> > + ((int)(time - time_last) > 30000 || (int) (time - time_last) < 0))
>
> This patch just wastes instructions. The following would do the same
> if the quantity is truly unsigned:
>
> if (mDisplay && xs_windowid && (time - time_last) > 30000)
Actually, both time and time_last are unsigned. And even if time_last is
greater than time, the result is obviously > 30000, so indeed your version
of the condition is correct.
Applied Rich's version.
Regards,
R.
--
MPlayer developer and RPMs maintainer: http://rpm.greysector.net/mplayer/
There should be a science of discontent. People need hard times and
oppression to develop psychic muscles.
-- from "Collected Sayings of Muad'Dib" by the Princess Irulan
More information about the MPlayer-dev-eng
mailing list