[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Upstream asks: unportable patch for mirrormagic?



On Die, 2002-03-19 at 15:06, Lukas Geyer wrote:
> 
> > On Sun, Mar 17, 2002 at 09:32:18PM +0100, Holger Schemel wrote:
> > > Hello Drew,
> > >
> > > > Also, here is a small patch which fixes support for the powerpc architecture
> > > > (va_arg got mixed up in gadgets.c), and sound handling when no
> > > > sound card is present (sound.c).
> > > >
> > > > =======================================================
> > > > --- mirrormagic-2.0.0.orig/src/libgame/gadgets.c
> > > > +++ mirrormagic-2.0.0/src/libgame/gadgets.c
> > > > @@ -309,7 +309,7 @@
> > > >         break;
> > > >
> > > >        case GDI_CHECKED:
> > > > -       gi->checked = va_arg(ap, boolean);
> > > > +       gi->checked = (boolean) va_arg(ap, int);
> > > >         break;
> > > [...]
> > >
> > > Hm, applying this patch would mess up things for other platforms,
> > > because "boolean" is typedef'ed as "unsigned char". If it simply
> > > gets replaced by "int", va_arg reads a 16 or 32 bit value instead
> > > of a 8 bit value.
> 
> Well, the patch should be correct ANSI C, I wonder how it worked on other
> architectures before.

Two words: little endian.

Thanks for providing the definite explanation.


-- 
Earthling Michel Dänzer (MrCooper)/ Debian GNU/Linux (powerpc) developer
XFree86 and DRI project member   /  CS student, Free Software enthusiast



Reply to: