[MPlayer-dev-eng] [PATCH] Yet another batch of warning fixes :->

Dominik Mierzejewski dominik at rangers.eu.org
Fri Dec 13 03:44:26 CET 2002


On Tuesday, 10 December 2002, Arpi wrote:
> Hi,
Hi,
[...]
> > > > -          uqvq = encoded[pixel_ptr++] + (encoded[pixel_ptr++] << 8);
> > > > +          uqvq = encoded[pixel_ptr+1] + (encoded[pixel_ptr+2] << 8);
> > > > +          pixel_ptr += 2;
> > > 
> > > i can't understand nor accept such changes
> > 
> > He's right here too. This is NOT valid C. It's undefined which ++
> > happens first!
> 
> right, but the fix is bad again
> 
> pixel_ptr++ will increase _after_ evaluating its value, so it should be
> 
> +          uqvq = encoded[pixel_ptr] + (encoded[pixel_ptr+1] << 8);

Hmmm, you're right again. I must've been seriously sleep-deprived when
I wrote that...

> but imho the best would be:
> uqvq = encoded[pixel_ptr++]; uqvq += encoded[pixel_ptr++]<<8;
> i do it this way in stream.h

That's fine, too.

How's the merging progressing, hm? :->
 
-- 
MPlayer RPMs maintainer: http://www.piorunek.pl/~dominik/linux/pkgs/mplayer/
"The Universe doesn't give you any points for doing things that are easy."
        -- Sheridan to Garibaldi in Babylon 5:"The Geometry of Shadows"



More information about the MPlayer-dev-eng mailing list