>What you suggested makes a lot of sense and I think it should work. It still doesn't 
>work for me though, am I doing something else wrong as well? Now I get the following 
>error
>
>"application1.0 just read from memory location 0x10024AA7 causing an address error. 
>An address error means that the application accessed a 2 0r 4 byte value at an odd 
>(not even) memory address"
>
>I changed my unpack routine to:
>
>static void UnpackRange(Range* range, const PackedRange *packedRange)
>{
>       const char *s = packedRange->name;
>
>       range->name = s;
>(1)    s += StrLen(s) + 1;
>(2)    range->startRange = *((Int32*)s);
>       s = s + 4;
>       range->endRange = *((Int32*)s);
>}

Suppose that s starts out at 0x20000.
Suppose that the first 7 bytes are "Hello!\0"
After the line marked (1), s will be 0x20007
the line marked (2) will bomb, because you are reading 4 bytes from an odd address.

You have to read the 4 bytes on at a time, and assemble the long yourself.

        range->startRange  = *s++ & 0x000000FF; range->startRange <<= 8;
        range->startRange |= *s++ & 0x000000FF; range->startRange <<= 8;
        range->startRange |= *s++ & 0x000000FF; range->startRange <<= 8;
        range->startRange |= *s++ & 0x000000FF;


-- 
-- Marshall

Marshall Clow     Idio Software   <mailto:[EMAIL PROTECTED]>
Hey! Who messed with my anti-paranoia shot?

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to