Patched from mail. See ChangeLog

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@612 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
mccallum 1995-09-21 17:42:46 +00:00
parent 5832757bc4
commit 43da69d1ae
5 changed files with 45 additions and 6 deletions

View file

@ -214,7 +214,7 @@ static Class NSMutableArray_concrete_class;
for (i = 0; i < c; i++) for (i = 0; i < c; i++)
if (anObject == [self objectAtIndex:i]) if (anObject == [self objectAtIndex:i])
return i; return i;
return UINT_MAX; return NSNotFound;
} }
/* Inefficient, should be overridden. */ /* Inefficient, should be overridden. */
@ -224,12 +224,12 @@ static Class NSMutableArray_concrete_class;
for (i = 0; i < c; i++) for (i = 0; i < c; i++)
if ([[self objectAtIndex:i] isEqual: anObject]) if ([[self objectAtIndex:i] isEqual: anObject])
return i; return i;
return UINT_MAX; return NSNotFound;
} }
- (BOOL) containsObject: anObject - (BOOL) containsObject: anObject
{ {
return ([self indexOfObject:anObject] != UINT_MAX); return ([self indexOfObject:anObject] != NSNotFound);
} }
- (BOOL) isEqual: anObject - (BOOL) isEqual: anObject
@ -434,14 +434,14 @@ static Class NSMutableArray_concrete_class;
- (void) removeObjectIdenticalTo: anObject - (void) removeObjectIdenticalTo: anObject
{ {
int i = [self indexOfObjectIdenticalTo:anObject]; int i = [self indexOfObjectIdenticalTo:anObject];
assert (i != UINT_MAX); /* xxx should raise an NSException instead */ assert (i != NSNotFound); /* xxx should raise an NSException instead */
[self removeObjectAtIndex:i]; [self removeObjectAtIndex:i];
} }
- (void) removeObject: anObject - (void) removeObject: anObject
{ {
int i = [self indexOfObject:anObject]; int i = [self indexOfObject:anObject];
assert (i != UINT_MAX); /* xxx should raise an NSException instead */ assert (i != NSNotFound); /* xxx should raise an NSException instead */
[self removeObjectAtIndex:i]; [self removeObjectAtIndex:i];
} }

View file

@ -281,6 +281,17 @@ _bundle_load_callback(Class theClass, Category *theCategory)
/* NOT REACHED */ /* NOT REACHED */
} }
/* Check if we were already initialized for this directory */
if (_bundles) {
int i;
int count;
count = [_bundles count];
for (i=0; i < count; i++) {
if ([path isEqual:[[_bundles objectAtIndex:i] bundlePath]])
return [_bundles objectAtIndex:i];
}
}
if (stat([path cString], &statbuf) != 0) { if (stat([path cString], &statbuf) != 0) {
[NSException raise:NSGenericException [NSException raise:NSGenericException
format:@"Could not find path %s", [path cString]]; format:@"Could not find path %s", [path cString]];

View file

@ -68,6 +68,12 @@
return _count; return _count;
} }
/* Force message to go to super class rather than the behavior class */
- (unsigned) indexOfObject: anObject
{
return [super indexOfObject: anObject];
}
- objectAtIndex: (unsigned)index - objectAtIndex: (unsigned)index
{ {
assert(index < _count); /* xxx should raise NSException instead */ assert(index < _count); /* xxx should raise NSException instead */

View file

@ -67,7 +67,7 @@
/* Empty copy must empty an allocCopy'ed version of self */ /* Empty copy must empty an allocCopy'ed version of self */
- emptyCopy - emptyCopy
{ {
NSGCString *copy = [super emptyCopy]; NSGCString *copy = [super allocCopy];
OBJC_MALLOC(copy->_contents_chars, char, _count+1); OBJC_MALLOC(copy->_contents_chars, char, _count+1);
copy->_count = 0; copy->_count = 0;
copy->_contents_chars[0] = '\0'; copy->_contents_chars[0] = '\0';

View file

@ -93,6 +93,22 @@
return YES; return YES;
} }
- copyWithZone: (NSZone *)zone
{
if (NSShouldRetainWithZone(self, zone))
return [self retain];
else {
return [[NSData allocWithZone:zone]
initWithBytes:[self bytes] length:[self length]];
}
}
- mutableCopyWithZone: (NSZone *)zone
{
return [[NSMutableData allocWithZone:zone]
initWithBytes:[self bytes] length:[self length]];
}
@end @end
@ -141,4 +157,10 @@
[self writeBytes:bytes length:length]; [self writeBytes:bytes length:length];
} }
- copyWithZone: (NSZone *)zone
{
return [[NSData allocWithZone:zone]
initWithBytes:[self bytes] length:[self length]];
}
@end @end