Memory leak and other fixes from Frith-MacDonald.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@2775 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fedor 1998-03-12 14:21:20 +00:00
parent 7285b3e9a6
commit a0993c655f
17 changed files with 11155 additions and 10927 deletions

View file

@ -744,8 +744,12 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
- (id) copyWithZone: (NSZone*)zone
{
[self subclassResponsibility:_cmd];
return nil;
if (NSShouldRetainWithZone(self, zone) &&
[self isKindOfClass: [NSMutableData class]] == NO)
return [self retain];
else
return [[NSDataMalloc allocWithZone: zone]
initWithBytes: [self bytes] length: [self length]];
}
- (id) mutableCopy
@ -755,8 +759,8 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
- (id) mutableCopyWithZone: (NSZone*)zone
{
[self subclassResponsibility:_cmd];
return nil;
return [[NSMutableDataMalloc allocWithZone: zone]
initWithBytes: [self bytes] length: [self length]];
}
- (void) encodeWithCoder:(NSCoder*)coder
@ -1183,11 +1187,6 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
return [NSDataMalloc class];
}
- (id) copyWithZone: (NSZone*)zone
{
return [self retain];
}
- (void) dealloc
{
if (bytes)
@ -1311,12 +1310,6 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
return length;
}
- (id) mutableCopyWithZone: (NSZone*)zone
{
return [[NSMutableDataMalloc allocWithZone:zone] initWithBytes: bytes
length: length];
}
- (void*) relinquishAllocatedBytes
{
void *buf = bytes;
@ -1552,11 +1545,6 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
return [NSMutableDataMalloc class];
}
- (id) copyWithZone: (NSZone*)zone
{
return [[NSDataMalloc allocWithZone:zone] initWithBytes:bytes length:length];
}
- (void) dealloc
{
if (bytes)
@ -1706,12 +1694,6 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
return bytes;
}
- (id) mutableCopyWithZone: (NSZone*)zone
{
return [[NSMutableDataMalloc allocWithZone:zone] initWithBytes: bytes
length: length];
}
- (id) setCapacity: (unsigned int)size
{
if (size != capacity)