mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-12 00:51:08 +00:00
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:
parent
7285b3e9a6
commit
a0993c655f
17 changed files with 11155 additions and 10927 deletions
10865
ChangeLog.1
Normal file
10865
ChangeLog.1
Normal file
File diff suppressed because it is too large
Load diff
|
@ -42,6 +42,7 @@
|
||||||
|
|
||||||
#ifndef STRICT_OPENSTEP
|
#ifndef STRICT_OPENSTEP
|
||||||
+ valueFromString: (NSString *)string;
|
+ valueFromString: (NSString *)string;
|
||||||
|
- (BOOL) isEqualToValue: (NSValue*)other;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Accessing Data
|
// Accessing Data
|
||||||
|
@ -56,7 +57,7 @@
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface NSNumber : NSValue <NSCoding>
|
@interface NSNumber : NSValue <NSCopying,NSCoding>
|
||||||
|
|
||||||
// Allocating and Initializing
|
// Allocating and Initializing
|
||||||
|
|
||||||
|
|
|
@ -85,30 +85,6 @@ static Class NSMutableArray_concrete_class;
|
||||||
return NSAllocateObject ([self _concreteClass], 0, z);
|
return NSAllocateObject ([self _concreteClass], 0, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is the designated initializer for NSArray. */
|
|
||||||
- initWithObjects: (id*)objects count: (unsigned)count
|
|
||||||
{
|
|
||||||
[self subclassResponsibility:_cmd];
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (unsigned) count
|
|
||||||
{
|
|
||||||
[self subclassResponsibility:_cmd];
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
- objectAtIndex: (unsigned)index
|
|
||||||
{
|
|
||||||
[self subclassResponsibility:_cmd];
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
|
|
||||||
@implementation NSArrayNonCore
|
|
||||||
|
|
||||||
+ array
|
+ array
|
||||||
{
|
{
|
||||||
return [[[self alloc] init]
|
return [[[self alloc] init]
|
||||||
|
@ -134,6 +110,30 @@ static Class NSMutableArray_concrete_class;
|
||||||
autorelease];
|
autorelease];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This is the designated initializer for NSArray. */
|
||||||
|
- initWithObjects: (id*)objects count: (unsigned)count
|
||||||
|
{
|
||||||
|
[self subclassResponsibility:_cmd];
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (unsigned) count
|
||||||
|
{
|
||||||
|
[self subclassResponsibility:_cmd];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
- objectAtIndex: (unsigned)index
|
||||||
|
{
|
||||||
|
[self subclassResponsibility:_cmd];
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
@implementation NSArrayNonCore
|
||||||
|
|
||||||
- (NSArray*) arrayByAddingObject: anObject
|
- (NSArray*) arrayByAddingObject: anObject
|
||||||
{
|
{
|
||||||
id na;
|
id na;
|
||||||
|
@ -622,12 +622,29 @@ static Class NSMutableArray_concrete_class;
|
||||||
{
|
{
|
||||||
/* a deep copy */
|
/* a deep copy */
|
||||||
unsigned count = [self count];
|
unsigned count = [self count];
|
||||||
id objects[count];
|
id oldObjects[count];
|
||||||
|
id newObjects[count];
|
||||||
|
id newArray;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
BOOL needCopy = [self isKindOfClass: [NSMutableArray class]];
|
||||||
|
|
||||||
|
if (NSShouldRetainWithZone(self, zone) == NO)
|
||||||
|
needCopy = YES;
|
||||||
|
[self getObjects: oldObjects];
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
objects[i] = [[self objectAtIndex:i] copyWithZone:zone];
|
{
|
||||||
return [[[[self class] _concreteClass] allocWithZone:zone]
|
newObjects[i] = [oldObjects[i] copyWithZone:zone];
|
||||||
initWithObjects:objects count:count];
|
if (newObjects[i] != oldObjects[i])
|
||||||
|
needCopy = YES;
|
||||||
|
}
|
||||||
|
if (needCopy)
|
||||||
|
newArray = [[[[self class] _concreteClass] allocWithZone:zone]
|
||||||
|
initWithObjects:newObjects count:count];
|
||||||
|
else
|
||||||
|
newArray = [self retain];
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
[newObjects[i] release];
|
||||||
|
return newArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The NSMutableCopying Protocol */
|
/* The NSMutableCopying Protocol */
|
||||||
|
|
|
@ -77,6 +77,49 @@
|
||||||
memcpy( value, &data, objc_sizeof_type([self objCType]) );
|
memcpy( value, &data, objc_sizeof_type([self objCType]) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL) isEqual: (id)other
|
||||||
|
{
|
||||||
|
if ([other isKindOfClass: [self class]]) {
|
||||||
|
return [self isEqualToValue: other];
|
||||||
|
}
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL) isEqualToValue: (NSValue*)aValue
|
||||||
|
{
|
||||||
|
typedef _dt = data;
|
||||||
|
if ([aValue isKindOfClass: [self class]]) {
|
||||||
|
_dt val = [aValue TYPE_METHOD];
|
||||||
|
#if TYPE_ORDER == 0
|
||||||
|
return [data isEqual: val];
|
||||||
|
#elif TYPE_ORDER == 1
|
||||||
|
if (data.x == val.x && data.y == val.y)
|
||||||
|
return YES;
|
||||||
|
else
|
||||||
|
return NO;
|
||||||
|
#elif TYPE_ORDER == 2
|
||||||
|
if (data == val)
|
||||||
|
return YES;
|
||||||
|
else
|
||||||
|
return NO;
|
||||||
|
#elif TYPE_ORDER == 3
|
||||||
|
if (data.origin.x == val.origin.x &&
|
||||||
|
data.origin.y == val.origin.y &&
|
||||||
|
data.size.width == val.size.width &&
|
||||||
|
data.size.height == val.size.height)
|
||||||
|
return YES;
|
||||||
|
else
|
||||||
|
return NO;
|
||||||
|
#elif TYPE_ORDER == 4
|
||||||
|
if (data.width == val.width && data.height == val.height)
|
||||||
|
return YES;
|
||||||
|
else
|
||||||
|
return NO;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
- (const char *)objCType
|
- (const char *)objCType
|
||||||
{
|
{
|
||||||
typedef _dt = data;
|
typedef _dt = data;
|
||||||
|
|
|
@ -24,9 +24,10 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <objc/objc-api.h>
|
#include <objc/objc-api.h>
|
||||||
#include <gnustep/base/NSDate.h>
|
#include <Foundation/NSDate.h>
|
||||||
#include <gnustep/base/NSString.h>
|
#include <Foundation/NSString.h>
|
||||||
#include <gnustep/base/NSException.h>
|
#include <Foundation/NSCoder.h>
|
||||||
|
#include <Foundation/NSException.h>
|
||||||
|
|
||||||
#ifndef __WIN32__
|
#ifndef __WIN32__
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
@ -145,6 +146,27 @@ static id long_day[7] = {@"Sunday",
|
||||||
return [d autorelease];
|
return [d autorelease];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||||
|
{
|
||||||
|
[super encodeWithCoder: aCoder];
|
||||||
|
[aCoder encodeObject: calendar_format];
|
||||||
|
[aCoder encodeObject: time_zone];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id) initWithCoder: (NSCoder*)aCoder
|
||||||
|
{
|
||||||
|
self = [super initWithCoder: aCoder];
|
||||||
|
calendar_format = [aCoder decodeObject];
|
||||||
|
time_zone = [aCoder decodeObject];
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) dealloc
|
||||||
|
{
|
||||||
|
[calendar_format release];
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
// Initializing an NSCalendar Date
|
// Initializing an NSCalendar Date
|
||||||
- (id)initWithString:(NSString *)description
|
- (id)initWithString:(NSString *)description
|
||||||
{
|
{
|
||||||
|
@ -972,7 +994,7 @@ static id long_day[7] = {@"Sunday",
|
||||||
|
|
||||||
- (void)setCalendarFormat:(NSString *)format
|
- (void)setCalendarFormat:(NSString *)format
|
||||||
{
|
{
|
||||||
calendar_format = format;
|
calendar_format = [format copyWithZone: [self zone]];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getting and Setting Time Zones
|
// Getting and Setting Time Zones
|
||||||
|
|
|
@ -304,6 +304,21 @@
|
||||||
return [super isEqual: o];
|
return [super isEqual: o];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (id) copy
|
||||||
|
{
|
||||||
|
return [self copyWithZone: NSDefaultMallocZone()];
|
||||||
|
}
|
||||||
|
|
||||||
|
- copyWithZone: (NSZone*)zone
|
||||||
|
{
|
||||||
|
if (NSShouldRetainWithZone(self, zone)) {
|
||||||
|
return [self retain];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return NSCopyObject(self, 0, zone);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (NSString *)descriptionWithLocale: (NSDictionary*)locale
|
- (NSString *)descriptionWithLocale: (NSDictionary*)locale
|
||||||
{
|
{
|
||||||
return [NSString stringWithFormat:TYPE_FORMAT, data];
|
return [NSString stringWithFormat:TYPE_FORMAT, data];
|
||||||
|
|
|
@ -113,6 +113,11 @@
|
||||||
memcpy( value, data, objc_sizeof_type([objctype cString]) );
|
memcpy( value, data, objc_sizeof_type([objctype cString]) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-(BOOL) isEqualToValue: (NSValue*)aValue
|
||||||
|
{
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
- (const char *)objCType
|
- (const char *)objCType
|
||||||
{
|
{
|
||||||
return [objctype cString];
|
return [objctype cString];
|
||||||
|
|
|
@ -744,8 +744,12 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
|
||||||
|
|
||||||
- (id) copyWithZone: (NSZone*)zone
|
- (id) copyWithZone: (NSZone*)zone
|
||||||
{
|
{
|
||||||
[self subclassResponsibility:_cmd];
|
if (NSShouldRetainWithZone(self, zone) &&
|
||||||
return nil;
|
[self isKindOfClass: [NSMutableData class]] == NO)
|
||||||
|
return [self retain];
|
||||||
|
else
|
||||||
|
return [[NSDataMalloc allocWithZone: zone]
|
||||||
|
initWithBytes: [self bytes] length: [self length]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) mutableCopy
|
- (id) mutableCopy
|
||||||
|
@ -755,8 +759,8 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
|
||||||
|
|
||||||
- (id) mutableCopyWithZone: (NSZone*)zone
|
- (id) mutableCopyWithZone: (NSZone*)zone
|
||||||
{
|
{
|
||||||
[self subclassResponsibility:_cmd];
|
return [[NSMutableDataMalloc allocWithZone: zone]
|
||||||
return nil;
|
initWithBytes: [self bytes] length: [self length]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) encodeWithCoder:(NSCoder*)coder
|
- (void) encodeWithCoder:(NSCoder*)coder
|
||||||
|
@ -1183,11 +1187,6 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
|
||||||
return [NSDataMalloc class];
|
return [NSDataMalloc class];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) copyWithZone: (NSZone*)zone
|
|
||||||
{
|
|
||||||
return [self retain];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
if (bytes)
|
if (bytes)
|
||||||
|
@ -1311,12 +1310,6 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) mutableCopyWithZone: (NSZone*)zone
|
|
||||||
{
|
|
||||||
return [[NSMutableDataMalloc allocWithZone:zone] initWithBytes: bytes
|
|
||||||
length: length];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void*) relinquishAllocatedBytes
|
- (void*) relinquishAllocatedBytes
|
||||||
{
|
{
|
||||||
void *buf = bytes;
|
void *buf = bytes;
|
||||||
|
@ -1552,11 +1545,6 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
|
||||||
return [NSMutableDataMalloc class];
|
return [NSMutableDataMalloc class];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) copyWithZone: (NSZone*)zone
|
|
||||||
{
|
|
||||||
return [[NSDataMalloc allocWithZone:zone] initWithBytes:bytes length:length];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
if (bytes)
|
if (bytes)
|
||||||
|
@ -1706,12 +1694,6 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len)
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) mutableCopyWithZone: (NSZone*)zone
|
|
||||||
{
|
|
||||||
return [[NSMutableDataMalloc allocWithZone:zone] initWithBytes: bytes
|
|
||||||
length: length];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) setCapacity: (unsigned int)size
|
- (id) setCapacity: (unsigned int)size
|
||||||
{
|
{
|
||||||
if (size != capacity)
|
if (size != capacity)
|
||||||
|
|
|
@ -367,22 +367,41 @@ compareIt(id o1, id o2, void* context)
|
||||||
- copyWithZone: (NSZone*)z
|
- copyWithZone: (NSZone*)z
|
||||||
{
|
{
|
||||||
/* a deep copy */
|
/* a deep copy */
|
||||||
int count = [self count];
|
unsigned count = [self count];
|
||||||
id objects[count];
|
id oldKeys[count];
|
||||||
NSObject *keys[count];
|
id newKeys[count];
|
||||||
id enumerator = [self keyEnumerator];
|
id oldObjects[count];
|
||||||
|
id newObjects[count];
|
||||||
|
id newDictionary;
|
||||||
|
unsigned i;
|
||||||
id key;
|
id key;
|
||||||
int i;
|
NSEnumerator *enumerator = [self keyEnumerator];
|
||||||
|
BOOL needCopy = [self isKindOfClass: [NSMutableDictionary class]];
|
||||||
|
|
||||||
|
if (NSShouldRetainWithZone(self, z) == NO)
|
||||||
|
needCopy = YES;
|
||||||
for (i = 0; (key = [enumerator nextObject]); i++)
|
for (i = 0; (key = [enumerator nextObject]); i++)
|
||||||
{
|
{
|
||||||
keys[i] = [key copyWithZone:z];
|
oldKeys[i] = key;
|
||||||
objects[i] = [[self objectForKey:key] copyWithZone:z];
|
oldObjects[i] = [self objectForKey:key];
|
||||||
|
newKeys[i] = [oldKeys[i] copyWithZone:z];
|
||||||
|
newObjects[i] = [oldObjects[i] copyWithZone:z];
|
||||||
|
if (oldKeys[i] != newKeys[i] || oldObjects[i] != newObjects[i])
|
||||||
|
needCopy = YES;
|
||||||
}
|
}
|
||||||
return [[[[self class] _concreteClass] alloc]
|
if (needCopy)
|
||||||
initWithObjects:objects
|
newDictionary = [[[[self class] _concreteClass] alloc]
|
||||||
forKeys:keys
|
initWithObjects:newObjects
|
||||||
|
forKeys:newKeys
|
||||||
count:count];
|
count:count];
|
||||||
|
else
|
||||||
|
newDictionary = [self retain];
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
[newKeys[i] release];
|
||||||
|
[newObjects[i] release];
|
||||||
|
}
|
||||||
|
return newDictionary;
|
||||||
}
|
}
|
||||||
|
|
||||||
- mutableCopyWithZone: (NSZone*)z
|
- mutableCopyWithZone: (NSZone*)z
|
||||||
|
|
|
@ -145,7 +145,8 @@
|
||||||
char *r;
|
char *r;
|
||||||
|
|
||||||
OBJC_MALLOC(r, char, _count+1);
|
OBJC_MALLOC(r, char, _count+1);
|
||||||
ustrtostr(r,_contents_chars, _count);
|
if (_count > 0)
|
||||||
|
ustrtostr(r,_contents_chars, _count);
|
||||||
r[_count] = '\0';
|
r[_count] = '\0';
|
||||||
[[[MallocAddress alloc] initWithAddress:r] autorelease];
|
[[[MallocAddress alloc] initWithAddress:r] autorelease];
|
||||||
return r;
|
return r;
|
||||||
|
|
|
@ -224,22 +224,32 @@ static NSMutableDictionary *_hostCache = nil;
|
||||||
[super encodeWithCoder: aCoder];
|
[super encodeWithCoder: aCoder];
|
||||||
[aCoder encodeObject: [self address]];
|
[aCoder encodeObject: [self address]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 1
|
||||||
/* GNUstep specific method for more efficient decoding. */
|
/* GNUstep specific method for more efficient decoding. */
|
||||||
+ (id) newWithCoder: (NSCoder*)aCoder
|
+ (id) newWithCoder: (NSCoder*)aCoder
|
||||||
{
|
{
|
||||||
NSString *address = [aCoder decodeObject];
|
NSString *address = [aCoder decodeObject];
|
||||||
return [NSHost hostWithAddress: address];
|
return [NSHost hostWithAddress: address];
|
||||||
}
|
}
|
||||||
/* OpenStep method for decoding (not used) */
|
#else
|
||||||
|
/* OpenStep methods for decoding (not used) */
|
||||||
|
- (id) awakeAfterUsingCoder: (NSCoder*)aCoder
|
||||||
|
{
|
||||||
|
return [NSHost hostWithAddress: [addresses objectAtIndex: 0]];
|
||||||
|
}
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aCoder
|
- (id) initWithCoder: (NSCoder*)aCoder
|
||||||
{
|
{
|
||||||
NSString *address;
|
NSString *address;
|
||||||
|
|
||||||
[super initWithCoder: aCoder];
|
[super initWithCoder: aCoder];
|
||||||
address = [aCoder decodeObject];
|
address = [aCoder decodeObject];
|
||||||
[self dealloc];
|
addresses = [NSArray arrayWithObject: address];
|
||||||
return [NSHost hostWithAddress: address];
|
[address release];
|
||||||
|
return self;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
- (BOOL)isEqualToHost:(NSHost *)aHost
|
- (BOOL)isEqualToHost:(NSHost *)aHost
|
||||||
{
|
{
|
||||||
|
|
|
@ -260,6 +260,18 @@
|
||||||
return self=[[NSUShortNumber alloc] initValue:&value withObjCType:NULL];
|
return self=[[NSUShortNumber alloc] initValue:&value withObjCType:NULL];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (id) copy
|
||||||
|
{
|
||||||
|
[self subclassResponsibility:_cmd];
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
- copyWithZone: (NSZone*)zone
|
||||||
|
{
|
||||||
|
[self subclassResponsibility:_cmd];
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
- (NSString*) description
|
- (NSString*) description
|
||||||
{
|
{
|
||||||
return [self descriptionWithLocale: nil];
|
return [self descriptionWithLocale: nil];
|
||||||
|
|
|
@ -557,7 +557,7 @@ handle_printf_atsign (FILE *stream,
|
||||||
|
|
||||||
- (id) init
|
- (id) init
|
||||||
{
|
{
|
||||||
[super init];
|
self = [super init];
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1325,7 +1325,7 @@ if (mask & NSLiteralSearch)
|
||||||
[aString getCharacters:s2];
|
[aString getCharacters:s2];
|
||||||
s2[s2len] = (unichar)0;
|
s2[s2len] = (unichar)0;
|
||||||
end = s1len+1;
|
end = s1len+1;
|
||||||
if (s2len > s1len)
|
if (s2len < s1len)
|
||||||
end = s2len+1;
|
end = s2len+1;
|
||||||
|
|
||||||
if (mask & NSCaseInsensitiveSearch)
|
if (mask & NSCaseInsensitiveSearch)
|
||||||
|
@ -1346,7 +1346,12 @@ if (mask & NSLiteralSearch)
|
||||||
if (s1[i] > s2[i]) return NSOrderedDescending;
|
if (s1[i] > s2[i]) return NSOrderedDescending;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NSOrderedSame;
|
if (s1len > s2len)
|
||||||
|
return NSOrderedDescending;
|
||||||
|
else if (s1len < s2len)
|
||||||
|
return NSOrderedAscending;
|
||||||
|
else
|
||||||
|
return NSOrderedSame;
|
||||||
} /* if NSLiteralSearch */
|
} /* if NSLiteralSearch */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1362,9 +1367,9 @@ else
|
||||||
while(myCount < end)
|
while(myCount < end)
|
||||||
{
|
{
|
||||||
if(strCount>=[aString length])
|
if(strCount>=[aString length])
|
||||||
return NSOrderedAscending;
|
|
||||||
if(myCount>=[self length])
|
|
||||||
return NSOrderedDescending;
|
return NSOrderedDescending;
|
||||||
|
if(myCount>=[self length])
|
||||||
|
return NSOrderedAscending;
|
||||||
myRange = [self rangeOfComposedCharacterSequenceAtIndex: myCount];
|
myRange = [self rangeOfComposedCharacterSequenceAtIndex: myCount];
|
||||||
myCount += myRange.length;
|
myCount += myRange.length;
|
||||||
strRange = [aString rangeOfComposedCharacterSequenceAtIndex: strCount];
|
strRange = [aString rangeOfComposedCharacterSequenceAtIndex: strCount];
|
||||||
|
@ -1379,7 +1384,7 @@ else
|
||||||
return result;
|
return result;
|
||||||
} /* while */
|
} /* while */
|
||||||
if(strCount<[aString length])
|
if(strCount<[aString length])
|
||||||
return NSOrderedDescending;
|
return NSOrderedAscending;
|
||||||
return NSOrderedSame;
|
return NSOrderedSame;
|
||||||
} /* else */
|
} /* else */
|
||||||
}
|
}
|
||||||
|
@ -2590,7 +2595,12 @@ else
|
||||||
|
|
||||||
- copyWithZone: (NSZone*)zone
|
- copyWithZone: (NSZone*)zone
|
||||||
{
|
{
|
||||||
return [[[self class] allocWithZone:zone] initWithString:self];
|
if ([self isKindOfClass: [NSMutableString class]] ||
|
||||||
|
NSShouldRetainWithZone(self, zone) == NO)
|
||||||
|
return [[[[self class] _concreteClass] allocWithZone:zone]
|
||||||
|
initWithString:self];
|
||||||
|
else
|
||||||
|
return [self retain];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* xxx Temporarily put this NSObject-like implementation here, so
|
/* xxx Temporarily put this NSObject-like implementation here, so
|
||||||
|
|
|
@ -327,14 +327,25 @@ decode (const void *ptr)
|
||||||
- (void)encodeWithCoder: aCoder
|
- (void)encodeWithCoder: aCoder
|
||||||
{
|
{
|
||||||
[super encodeWithCoder: aCoder];
|
[super encodeWithCoder: aCoder];
|
||||||
[aCoder encodeObject: name];
|
if (self == localTimeZone)
|
||||||
|
[aCoder encodeObject: @"NSLocalTimeZone"];
|
||||||
|
else
|
||||||
|
[aCoder encodeObject: name];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id) awakeAfterUsingCoder: aCoder
|
||||||
|
{
|
||||||
|
if ([name isEqual: @"NSLocalTimeZone"]) {
|
||||||
|
return localTimeZone;
|
||||||
|
}
|
||||||
|
return [NSTimeZone timeZoneWithName: name];
|
||||||
}
|
}
|
||||||
|
|
||||||
- initWithDecoder: aDecoder
|
- initWithDecoder: aDecoder
|
||||||
{
|
{
|
||||||
/* FIXME?: is this right? */
|
|
||||||
self = [super initWithCoder: aDecoder];
|
self = [super initWithCoder: aDecoder];
|
||||||
return (self = (id)[NSTimeZone timeZoneWithName: [aDecoder decodeObject]]);
|
name = [aDecoder decodeObject];
|
||||||
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSTimeZoneDetail*)timeZoneDetailForDate: (NSDate*)date
|
- (NSTimeZoneDetail*)timeZoneDetailForDate: (NSDate*)date
|
||||||
|
|
|
@ -88,6 +88,11 @@
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (id)copy
|
||||||
|
{
|
||||||
|
return [self copyWithZone: NSDefaultMallocZone()];
|
||||||
|
}
|
||||||
|
|
||||||
- (id)copyWithZone:(NSZone *)zone
|
- (id)copyWithZone:(NSZone *)zone
|
||||||
{
|
{
|
||||||
if (NSShouldRetainWithZone(self, zone))
|
if (NSShouldRetainWithZone(self, zone))
|
||||||
|
@ -203,6 +208,20 @@
|
||||||
[self subclassResponsibility:_cmd];
|
[self subclassResponsibility:_cmd];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL)isEqual: (id)other
|
||||||
|
{
|
||||||
|
if ([other isKindOfClass: [self class]]) {
|
||||||
|
return [self isEqualToValue: other];
|
||||||
|
}
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)isEqualToValue: (NSValue*)other
|
||||||
|
{
|
||||||
|
[self subclassResponsibility:_cmd];
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
- (const char *)objCType
|
- (const char *)objCType
|
||||||
{
|
{
|
||||||
[self subclassResponsibility:_cmd];
|
[self subclassResponsibility:_cmd];
|
||||||
|
|
|
@ -1439,8 +1439,10 @@ static NSMapTable *out_port_bag = NULL;
|
||||||
sockaddr,
|
sockaddr,
|
||||||
sizeof (p->_remote_in_port_address));
|
sizeof (p->_remote_in_port_address));
|
||||||
NSMapInsert (out_port_bag, (void*)p, (void*)p);
|
NSMapInsert (out_port_bag, (void*)p, (void*)p);
|
||||||
|
/*
|
||||||
NSLog(@"Out port changed from %@ to %@\n", od,
|
NSLog(@"Out port changed from %@ to %@\n", od,
|
||||||
[p description]);
|
[p description]);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue