diff --git a/ChangeLog b/ChangeLog index 60aa076fe..5b0278d5f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Mon Jan 11 16:45:00 1999 Richard Frith-Macdonald + + Fixes for bugs reported by Benhur-de-Oliveira.Stein@imag.fr + * src/NSDictionary.m: ([-initWithObjectsAndKeys:]) fixed test for nil. + * src/NSSet.m: Added makeObjectsPerformSelector methods. + * src/NSString.m: ([-rangeOfComposedCharacterSequenceAtIndex:]) find + range from before the index if necessary. + * Tidied allocation methods in NSArray.m NSDictionary.m + Sat Jan 8 6:00:00 1999 Richard Frith-Macdonald * src/NSPortNameServer.m: Raise exception on failure to register name. diff --git a/Source/NSArray.m b/Source/NSArray.m index 3e029598d..d6b463918 100644 --- a/Source/NSArray.m +++ b/Source/NSArray.m @@ -85,7 +85,9 @@ static Class NSMutableArray_concrete_class; + allocWithZone: (NSZone*)z { - return NSAllocateObject ([self _concreteClass], 0, z); + if ([self class] == [NSArray class]) + return NSAllocateObject ([self _concreteClass], 0, z); + return [super allocWithZone: z]; } + array @@ -707,7 +709,9 @@ static NSString *indentStrings[] = { + allocWithZone: (NSZone*)z { - return NSAllocateObject ([self _mutableConcreteClass], 0, z); + if ([self class] == [NSMutableArray class]) + return NSAllocateObject ([self _mutableConcreteClass], 0, z); + return [super allocWithZone: z]; } /* This is the desgnated initializer for NSMutableArray */ diff --git a/Source/NSDictionary.m b/Source/NSDictionary.m index 50b2828e9..c49799eb3 100644 --- a/Source/NSDictionary.m +++ b/Source/NSDictionary.m @@ -77,7 +77,9 @@ static Class NSMutableDictionary_concrete_class; + allocWithZone: (NSZone*)z { - return NSAllocateObject([self _concreteClass], 0, z); + if ([self class] == [NSDictionary class]) + return NSAllocateObject([self _concreteClass], 0, z); + return [super allocWithZone: z]; } /* This is the designated initializer */ @@ -227,7 +229,7 @@ static Class NSMutableDictionary_concrete_class; int argi = 1; va_start (ap, firstObject); - if (firstObject != nil) + if (firstObject == nil) { return [self init]; } @@ -682,7 +684,9 @@ static NSString *indentStrings[] = { + allocWithZone: (NSZone*)z { - return NSAllocateObject([self _mutableConcreteClass], 0, z); + if ([self class] == [NSMutableDictionary class]) + return NSAllocateObject([self _mutableConcreteClass], 0, z); + return [super allocWithZone: z]; } /* This is the designated initializer */ diff --git a/Source/NSSet.m b/Source/NSSet.m index d9050ba43..7b393dbc1 100644 --- a/Source/NSSet.m +++ b/Source/NSSet.m @@ -338,6 +338,20 @@ static Class NSMutableSet_concrete_class; [o performSelector:aSelector]; } +- (void) makeObjectsPerformSelector: (SEL)aSelector +{ + id o, e = [self objectEnumerator]; + while ((o = [e nextObject])) + [o performSelector:aSelector]; +} + +- (void) makeObjectsPerformSelector: (SEL)aSelector withObject:argument +{ + id o, e = [self objectEnumerator]; + while ((o = [e nextObject])) + [o performSelector:aSelector withObject: argument]; +} + - (void) makeObjectsPerform: (SEL)aSelector withObject:argument { id o, e = [self objectEnumerator]; diff --git a/Source/NSString.m b/Source/NSString.m index 1d1cf293a..e45001df4 100644 --- a/Source/NSString.m +++ b/Source/NSString.m @@ -1287,8 +1287,8 @@ handle_printf_atsign (FILE *stream, unsigned int start, end; start=anIndex; - while(uni_isnonsp([self characterAtIndex: start])) - start++; + while(uni_isnonsp([self characterAtIndex: start]) && start > 0) + start--; end=start+1; if(end < [self length]) while((end < [self length]) && (uni_isnonsp([self characterAtIndex: end])) )