Re: My NSSwappedDouble decoding crashes on iPhone 4
Re: My NSSwappedDouble decoding crashes on iPhone 4
- Subject: Re: My NSSwappedDouble decoding crashes on iPhone 4
- From: Markus Spoettl <email@hidden>
- Date: Wed, 29 Sep 2010 10:53:18 -0400
On Sep 29, 2010, at 2:41 AM, Markus Spoettl wrote:
> The the Mac code is 32bit and runs on Leopard and Snow Leopard.
>
> - (void)encodeDouble:(double)value forKey:(NSString *)key withCoder:(NSCoder *)encoder
> {
> NSSwappedDouble sd = NSSwapHostDoubleToLittle(value);
> [encoder encodeBytes:(const uint8_t *)&sd length:sizeof(NSSwappedDouble) forKey:key];
> }
>
> - (double)decodeDoubleForKey:(NSString *)key withCoder:(NSCoder *)decoder
> {
> double result = 0.0;
> NSUInteger retsize;
> NSSwappedDouble *sd = (NSSwappedDouble *)[decoder decodeBytesForKey:key returnedLength:&retsize];
> if (retsize == sizeof(NSSwappedDouble)) { // <=== crash
> result = NSSwapLittleDoubleToHost(*sd);
> }
> return result;
> }
I just noticed the unfamiliar exception code EXC_ARM_DA_ALIGN. Googling it turns up that I'm not the only one experiencing the issue. I'll post a solution when I have it ready. Sorry for the noise.
Regards
Markus
--
__________________________________________
Markus Spoettl
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden