mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
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:
parent
6bf97cbac3
commit
2e9ca621e3
5 changed files with 45 additions and 6 deletions
|
@ -214,7 +214,7 @@ static Class NSMutableArray_concrete_class;
|
|||
for (i = 0; i < c; i++)
|
||||
if (anObject == [self objectAtIndex:i])
|
||||
return i;
|
||||
return UINT_MAX;
|
||||
return NSNotFound;
|
||||
}
|
||||
|
||||
/* Inefficient, should be overridden. */
|
||||
|
@ -224,12 +224,12 @@ static Class NSMutableArray_concrete_class;
|
|||
for (i = 0; i < c; i++)
|
||||
if ([[self objectAtIndex:i] isEqual: anObject])
|
||||
return i;
|
||||
return UINT_MAX;
|
||||
return NSNotFound;
|
||||
}
|
||||
|
||||
- (BOOL) containsObject: anObject
|
||||
{
|
||||
return ([self indexOfObject:anObject] != UINT_MAX);
|
||||
return ([self indexOfObject:anObject] != NSNotFound);
|
||||
}
|
||||
|
||||
- (BOOL) isEqual: anObject
|
||||
|
@ -434,14 +434,14 @@ static Class NSMutableArray_concrete_class;
|
|||
- (void) removeObjectIdenticalTo: 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];
|
||||
}
|
||||
|
||||
- (void) removeObject: 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];
|
||||
}
|
||||
|
||||
|
|
|
@ -281,6 +281,17 @@ _bundle_load_callback(Class theClass, Category *theCategory)
|
|||
/* 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) {
|
||||
[NSException raise:NSGenericException
|
||||
format:@"Could not find path %s", [path cString]];
|
||||
|
|
|
@ -68,6 +68,12 @@
|
|||
return _count;
|
||||
}
|
||||
|
||||
/* Force message to go to super class rather than the behavior class */
|
||||
- (unsigned) indexOfObject: anObject
|
||||
{
|
||||
return [super indexOfObject: anObject];
|
||||
}
|
||||
|
||||
- objectAtIndex: (unsigned)index
|
||||
{
|
||||
assert(index < _count); /* xxx should raise NSException instead */
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
/* Empty copy must empty an allocCopy'ed version of self */
|
||||
- emptyCopy
|
||||
{
|
||||
NSGCString *copy = [super emptyCopy];
|
||||
NSGCString *copy = [super allocCopy];
|
||||
OBJC_MALLOC(copy->_contents_chars, char, _count+1);
|
||||
copy->_count = 0;
|
||||
copy->_contents_chars[0] = '\0';
|
||||
|
|
|
@ -93,6 +93,22 @@
|
|||
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
|
||||
|
||||
|
||||
|
@ -141,4 +157,10 @@
|
|||
[self writeBytes:bytes length:length];
|
||||
}
|
||||
|
||||
- copyWithZone: (NSZone *)zone
|
||||
{
|
||||
return [[NSData allocWithZone:zone]
|
||||
initWithBytes:[self bytes] length:[self length]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue