More fixes suggested by fred

This commit is contained in:
Gregory John Casamento 2019-06-10 15:24:18 -04:00
parent ad5790b9e5
commit 561f63c818
2 changed files with 10 additions and 15 deletions

View file

@ -164,7 +164,7 @@ static Class mutableSetClass;
- (id) init
{
return [self initWithObjects: 0 count: 0];
return [self initWithObjects: NULL count: 0];
}
- (NSEnumerator*) objectEnumerator
@ -218,11 +218,6 @@ static Class mutableSetClass;
return item.obj;
}
- (id) objectAtIndexedSubscript: (NSUInteger)index
{
return[self objectAtIndex: index];
}
- (BOOL) containsObject: (id)anObject
{
NSUInteger i = 0;

View file

@ -699,7 +699,7 @@ static SEL rlSel;
NSUInteger count = [self count];
if (count == 0)
return nil;
return [self objectAtIndex: 0];
return [self objectAtIndex: count - 1];
}
- (id) objectAtIndex: (NSUInteger)index // required override...
@ -708,10 +708,9 @@ static SEL rlSel;
return nil;
}
- (id) objectAtIndexedSubscript: (NSUInteger)index // required override...
- (id) objectAtIndexedSubscript: (NSUInteger)index
{
[self subclassResponsibility: _cmd];
return nil;
return[self objectAtIndex: index];
}
- (NSArray *) objectsAtIndexes: (NSIndexSet *)indexes
@ -1129,9 +1128,9 @@ static SEL rlSel;
id f = nil;
NSUInteger s = 0, l = [self count], i = 0;
// -1. If this set is empty, this method should return NO.
// -1. If this set is empty, this method should return YES.
if (l == 0)
return NO;
return YES;
// If count of set is more than otherSet it's not a subset
if (l > [otherSet count])
@ -1752,7 +1751,7 @@ static SEL rlSel;
- (void) minusOrderedSet:(NSOrderedSet *)other
{
if(other != self)
if(other == self)
{
[self removeAllObjects];
}
@ -1804,8 +1803,9 @@ static SEL rlSel;
}
}
- (instancetype) initWithCoder: (NSCoder *)acoder
// Needed only to satisfy compiler that NSCoding is implemented.
- (instancetype) initWithCoder: (NSCoder)coder
{
return [super initWithCoder: acoder];
return [super initWithCoder: coder];
}
@end