Related to a previous posting of mine regarding floats and CGFloats when 
decoding older 32 bit serializations in a 64 bit runtime, I am now also in the 
process of modernizing some old code that used int values encapsulated by 
NSNumber in keyed archives.

The current serializations were performed in a 32 bit environment. I am now 
running in a 64 bit environment and am reading those archives. The archives 
contain NSNumber objects which stored int values. I would like to update the 
code to use NSInteger instead and the corresponding methods on the NSNumber 
objects.

Will I run into a similar decoding problem where the int values will not be 
correctly read as longs in the new environment, or is NSNumber taking care of 
things under the hood for me?

~Phil

On Jul 13, 2011, at 12:47 PM, Philip Dow wrote:

> Brilliant. Thank you Glenn. I compiled the app for 32 bit and it read the 
> archive fine. I've created my own struct with floats for reading the archive 
> in 64 bit and am coercing the data into doubles after the decoding.
> 
> ~Phil
> 
> On Jul 13, 2011, at 12:30 PM, glenn andreas wrote:
> 
>> Are you decoding it from a 64 bit app?  Because CGRect on 64 bits is made of 
>> doubles, while on 32 bits (where it was probably encoded) it was made of 
>> floats....
>> 
>> Also, the exact format for @encode() varies greatly between compiler version 
>> (especially with regards for things like structure names vs ?, etc...).  
>> This, in and of itself, shouldn't make it incompatible, but a structure with 
>> two structures each with two floats doesn't match with the double-based 
>> CGRect.
>> 
>> On Jul 13, 2011, at 12:20 PM, Philip Dow wrote:
>> 
>>> I am trying to decode a 3rd party archive encoded in the old NSArchiver 
>>> (not keyed) format. At a point in the decoding, I expect to find a CGRect, 
>>> but when I call 
>>> 
>>> [coder decodeValueOfObjCType:@encode(CGRect) at:&myRect]
>>> 
>>> an exception is raised with the error:
>>> 
>>> file inconsistency: read '{?={?=ff}{?=ff}}', expecting 
>>> '{CGRect={CGPoint=dd}{CGSize=dd}}'
>>> 
>>> Sure enough, if I open the file in a text editor, I see {?={?=ff}{?=ff}}.
>>> 
>>> According to the docs, the curly braces indicate a structure is encoded, 
>>> which I would expect for CGRect, but the ? indicates an unknown type. I'm 
>>> stumped for a solution and was wondering if anyone might have an insight.
>>> 
>>> ~Phil_______________________________________________
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> 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:
>>> http://lists.apple.com/mailman/options/cocoa-dev/gandreas%40mac.com
>>> 
>>> This email sent to gandr...@mac.com
>> 
>> Glenn Andreas                      gandr...@gandreas.com 
>> The most merciful thing in the world ... is the inability of the human mind 
>> to correlate all its contents - HPL
>> 
> 
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/dev%40getsprouted.com
> 
> This email sent to d...@getsprouted.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to