Temporary rollback of fix to NSUnarchiver.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@19073 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
gcasa 2004-04-11 05:02:45 +00:00
parent 03a934e274
commit 52548106c3
2 changed files with 9 additions and 29 deletions

View file

@ -1,3 +1,7 @@
2004-04-09 Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSUnarchiver.m: Temporary rollback of previous fix.
2004-04-09 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSUnarchiver.m: Retain objects while they are being

View file

@ -395,14 +395,8 @@ static Class NSDataMallocClass;
if (clsMap)
{
NSZone *z = clsMap->zone;
unsigned i;
GSIArrayClear(clsMap);
i = GSIArrayCount(objMap);
while (i-- > 0)
{
RELEASE(GSIArrayItemAtIndex(objMap, i).obj);
}
GSIArrayClear(objMap);
GSIArrayClear(ptrMap);
NSZoneFree(z, (void*)clsMap);
@ -410,17 +404,10 @@ static Class NSDataMallocClass;
[super dealloc];
}
- (id) init
{
self = [self initForReadingWithData: nil];
return self;
}
- (id) initForReadingWithData: (NSData*)anObject
{
if (anObject == nil)
{
DESTROY(self);
[NSException raise: NSInvalidArgumentException
format: @"nil data passed to initForReadingWithData:"];
}
@ -607,25 +594,19 @@ static Class NSDataMallocClass;
format: @"decoded nil class"];
}
obj = [c allocWithZone: zone];
/*
* The objMap array does not retain its contents directly,
* so we perform explicit retain/release as we add objects
* to and remove objects from the array.
*/
RETAIN(obj);
GSIArrayAddItem(objMap, (GSIArrayItem)obj);
rep = [obj initWithCoder: self];
if (rep != obj)
{
ASSIGN(obj, rep);
obj = rep;
GSIArraySetItemAtIndex(objMap, (GSIArrayItem)obj, xref);
}
rep = [obj awakeAfterUsingCoder: self];
if (rep != obj)
{
ASSIGN(obj, rep);
obj = rep;
GSIArraySetItemAtIndex(objMap, (GSIArrayItem)obj, xref);
}
}
@ -1180,16 +1161,11 @@ static Class NSDataMallocClass;
if (replacement == anObject)
return;
i = GSIArrayCount(objMap);
while (i-- > 0)
for (i = GSIArrayCount(objMap) - 1; i > 0; i--)
{
id old = GSIArrayItemAtIndex(objMap, i).obj;
if (old == anObject)
if (GSIArrayItemAtIndex(objMap, i).obj == anObject)
{
GSIArraySetItemAtIndex(objMap, (GSIArrayItem)replacement, i);
RETAIN(replacement);
RELEASE(old);
return;
}
}
@ -1279,7 +1255,7 @@ static Class NSDataMallocClass;
objMap = &clsMap[1];
GSIArrayInitWithZoneAndCapacity(objMap, zone, sizeO);
GSIArrayAddItem(objMap, (GSIArrayItem)(void*)nil);
GSIArrayAddItem(objMap, (GSIArrayItem)(void*)0);
ptrMap = &clsMap[2];
GSIArrayInitWithZoneAndCapacity(ptrMap, zone, sizeP);