• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Serious problem with XCode 2.2 treating unsigned long differently ?!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Serious problem with XCode 2.2 treating unsigned long differently ?!


  • Subject: Re: Serious problem with XCode 2.2 treating unsigned long differently ?!
  • From: Eric Albert <email@hidden>
  • Date: Sun, 13 Nov 2005 14:01:50 -0800

On Nov 13, 2005, at 1:47 PM, Eyal Redler wrote:

I thought that the fact that the application compiled using XCode 2.1 could open previous archives while the one produced with XCode 2.2 could not read the archives produced by 2.1 meant that getting an 'I' while expecting 'L' would produce an error while getting an 'L' while expecting an 'I' would be OK but it seems as if this is not the case.
Using Xcode 2.2 the following code will give either:


*** Uncaught exception: <NSArchiverArchiveInconsistency> *** file inconsistency: read 'I', expecting 'L'
or
*** Uncaught exception: <NSArchiverArchiveInconsistency> *** file inconsistency: read 'L', expecting 'I'


Depending on how you combine the unsigned int/long in the initWithCoder/encodeWithCoder.

I'm not following that. Are you saying that running the sample code below should print out an exception? It doesn't for me, with either gcc 3.3 or 4.0.1, whether I define TestTypeLong as an unsigned int or as an unsigned long.


@interface ERTestEncoding : NSObject
{
  TestTypeLong instanceVar;
}
@end
@implementation ERTestEncoding
- (id)initWithCoder:(NSCoder*)coder{
	self= [super init];
	if (self)
		[coder decodeValueOfObjCType:@encode(unsigned int) at:&instanceVar];
	return self;
}

- (void)encodeWithCoder:(NSCoder *)coder{
[coder encodeValueOfObjCType:@encode(unsigned int) at:&instanceVar];
}
@end


int main (int argc, const char * argv[]){
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
ERTestEncoding* object=[[ERTestEncoding alloc] init];
[NSUnarchiver unarchiveObjectWithData:[NSArchiver archivedDataWithRootObject:object]];
[object release];
[pool release];
}

As I hinted at above, this is missing a typedef for TestTypeLong. Do you have a complete example here that we can just drop into a file and compile? That'd be a big help.


-Eric

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Serious problem with XCode 2.2 treating unsigned long differently ?!
      • From: Eyal Redler <email@hidden>
References: 
 >Serious problem with XCode 2.2 treating unsigned long differently ?! (From: Eyal Redler <email@hidden>)
 >Re: Serious problem with XCode 2.2 treating unsigned long differently ?! (From: Eric Albert <email@hidden>)
 >Re: Serious problem with XCode 2.2 treating unsigned long differently ?! (From: Eric Albert <email@hidden>)
 >Re: Serious problem with XCode 2.2 treating unsigned long differently ?! (From: Eyal Redler <email@hidden>)
 >Re: Serious problem with XCode 2.2 treating unsigned long differently ?! (From: Eyal Redler <email@hidden>)
 >Re: Serious problem with XCode 2.2 treating unsigned long differently ?! (From: Eyal Redler <email@hidden>)

  • Prev by Date: Re: Serious problem with XCode 2.2 treating unsigned long differently ?!
  • Next by Date: Re: 2.1->2.2 created link error: std::__ioinit
  • Previous by thread: Re: Serious problem with XCode 2.2 treating unsigned long differently ?!
  • Next by thread: Re: Serious problem with XCode 2.2 treating unsigned long differently ?!
  • Index(es):
    • Date
    • Thread