From 540989b7652395b6898eb57ac8e02a0aefd9eea0 Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Sat, 5 Aug 2006 03:28:57 +0000 Subject: [PATCH] Corrections for archiver issues. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@23203 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 9 +++++++++ Source/NSKeyedArchiver.m | 9 ++++++++- Source/NSKeyedUnarchiver.m | 6 +++--- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index accc80bea..530a0dddd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2006-08-04 23:26-EDT Gregory John Casamento + + * Source/NSKeyedArchiver.m: in _encodeObject:forKey: use replacement + if it exists. + * Source/NSKeyedUnarchiver.m: in unarchiveObjectWithFile: remove + autorelease pool, since the unarchiveObjectWithData: object is + already autoreleased, this was causing a crash when unarchiving the + object. + 2006-07-26 Richard Frith-Macdonald * Source/Additions/GSMime.m: Remove a couple of comments diff --git a/Source/NSKeyedArchiver.m b/Source/NSKeyedArchiver.m index 1d7b1251a..f62f3a22b 100644 --- a/Source/NSKeyedArchiver.m +++ b/Source/NSKeyedArchiver.m @@ -205,6 +205,13 @@ static NSDictionary *makeReference(unsigned ref) } GSIMapAddPair(_repMap, (GSIMapKey)original, (GSIMapVal)anObject); } + else + { + /* + * If the object has a replacement, use it. + */ + anObject = node->value.obj; + } } if (anObject != nil) @@ -237,7 +244,7 @@ static NSDictionary *makeReference(unsigned ref) { Class c = [anObject class]; -// FIXME ... exactly what classes are stored directly??? + // FIXME ... exactly what classes are stored directly??? if ([anObject isKindOfClass: [GSString class]] == YES || c == [@"literal" class]) { diff --git a/Source/NSKeyedUnarchiver.m b/Source/NSKeyedUnarchiver.m index 9b10907c3..58b0e7e25 100644 --- a/Source/NSKeyedUnarchiver.m +++ b/Source/NSKeyedUnarchiver.m @@ -320,14 +320,14 @@ static NSMapTable globalClassMap = 0; + (id) unarchiveObjectWithFile: (NSString*)aPath { - CREATE_AUTORELEASE_POOL(pool); NSData *d; id o; + // CREATE_AUTORELEASE_POOL(pool); d = [NSData dataWithContentsOfFile: aPath]; o = [self unarchiveObjectWithData: d]; - RETAIN(o); - RELEASE(pool); + // RETAIN(o); + // RELEASE(pool); return AUTORELEASE(o); }