Skip to main content.
home | support | download

Back to List Archive

Re: Bug in swish-2.4.3 on spac64

From: Bill Moseley <moseley(at)not-real.hank.org>
Date: Tue Jul 19 2005 - 14:01:03 GMT
Hi Sorithy,

On Mon, Jul 18, 2005 at 01:46:26AM -0700, SSI wrote:
> > /*******************************************************************
> > *   Convert a propValue to a unsigned long
> > *
> > ********************************************************************/
> > union _conv_ {
> >       char            c[sizeof(unsigned long)];
> >       unsigned long   l;
> > };
> > unsigned long convPropValue2ULong(char *propValue)
> > {
> >       union _conv_ u;
> >       memcpy(u.c, propValue, sizeof(unsigned long));
> >       return u.l;
> > }
> 62a77,79
> >
> >
> >
> 159c176
> <         i = *(unsigned long *) prop->propValue;  /* read binary */
> ---
> >         i = convPropValue2ULong(prop->propValue); /* read binary */


I'm trying to understand why this has worked on other 64 bit platforms
in the past but fails on yours.  Is it the way your compiler is making
the cast compared to other compilers we have used?  Can you (or
any C wizard) explain?

I admit that I'm not 100% clear what the compiler should do when
casting "unsigned char propValue[1]" to "unsigned long" -- always
seems like a bit of magic to me. ;)  I like your patch, as it's clear
what is happening.

-- 
Bill Moseley
moseley@hank.org

Unsubscribe from or help with the swish-e list: 
   http://swish-e.org/Discussion/

Help with Swish-e:
   http://swish-e.org/current/docs
   swish-e@sunsite.berkeley.edu
Received on Tue Jul 19 07:01:16 2005