bugfixes and preparation for gc

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4302 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1999-05-27 09:41:31 +00:00
parent d88abdb775
commit cf99b38913
3 changed files with 46 additions and 26 deletions

View file

@ -1,3 +1,12 @@
Thu May 27 11:00:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSArchiver.m: Fix memory leak reported by
frederic.chauvin@lemel.fr and ready for garbage collection.
* Source/NSUnarchiver.m: Ready for garbage collection.
* Source/NSCalendarDate.m: Fix memory leak reported by
frederic.chauvin@lemel.fr. Fix bug in decrementing date past start
of month. Ready for garbage collection.
Wed May 26 18:35:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/include/NSSerialization.h: include NSObject.h

View file

@ -39,7 +39,6 @@
#include <Foundation/NSArchiver.h>
#undef _IN_NSARCHIVER_M
#include <Foundation/NSAutoreleasePool.h>
#include <Foundation/NSCoder.h>
#include <Foundation/NSData.h>
#include <Foundation/NSException.h>
@ -64,7 +63,7 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
- (id) init
{
return [self initForWritingWithMutableData:
[[_fastCls._NSMutableDataMalloc allocWithZone: [self zone]] init]];
[[_fastCls._NSMutableDataMalloc allocWithZone: [self zone]] init]];
}
- (id) initForWritingWithMutableData: (NSMutableData*)anObject
@ -74,7 +73,7 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
{
NSZone *zone = [self zone];
data = [anObject retain];
data = RETAIN(anObject);
if ([self directDataAccess] == YES)
{
dst = data;
@ -112,7 +111,7 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
- (void) dealloc
{
[data release];
RELEASE(data);
if (clsMap)
{
FastMapEmptyMap(clsMap);
@ -152,28 +151,26 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
{
return nil;
}
archiver = [[self allocWithZone: z] initForWritingWithMutableData: d];
if (archiver)
{
NS_DURING
{
[archiver encodeRootObject: rootObject];
d = [[archiver->data copy] autorelease];
}
NS_HANDLER
{
[archiver release];
[localException raise];
}
NS_ENDHANDLER
[archiver release];
}
else
{
d = nil;
}
archiver = [[self allocWithZone: z] initForWritingWithMutableData: d];
RELEASE(d);
d = nil;
if (archiver)
{
NS_DURING
{
[archiver encodeRootObject: rootObject];
d = AUTORELEASE([archiver->data copy]);
}
NS_HANDLER
{
RELEASE(archiver);
[localException raise];
}
NS_ENDHANDLER
RELEASE(archiver);
}
return d;
return d;
}
+ (BOOL) archiveRootObject: (id)rootObject

View file

@ -1182,7 +1182,7 @@
}
}
else
while (day < 0)
while (day < 1)
{
if (month == 1)
{
@ -1208,6 +1208,20 @@
year += years;
/*
* Special case - we adjusted to the correct day for the month in the
* starting date - but our month and year adjustment may have made that
* invalid for the final month and year - in which case we may have to
* advance to the next month.
*/
if (day > 28 && day > [self lastDayOfGregorianMonth: month year: year])
{
day -= [self lastDayOfGregorianMonth: month year: year];
month++;
if (month > 12)
year++;
}
return [NSCalendarDate dateWithYear: year
month: month
day: day