ifix for issue #500

This commit is contained in:
rfm 2025-04-01 19:42:50 +01:00
parent 0057f3f4e9
commit b39853e21a
3 changed files with 18 additions and 3 deletions

View file

@ -1,3 +1,7 @@
2025-04-01 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSOrderedSet.m: Fix for git issue #500
2025-03-21 Earl Robsham <earl.robsham@savant.com> 2025-03-21 Earl Robsham <earl.robsham@savant.com>
* Headers/Foundation/NSURLHandle.h: * Headers/Foundation/NSURLHandle.h:
* Sources/externs.m: * Sources/externs.m:

View file

@ -1415,12 +1415,12 @@ static SEL remSel;
if (count > 0) if (count > 0)
{ {
NSUInteger i;
IMP rem = [self methodForSelector: remSel]; IMP rem = [self methodForSelector: remSel];
for (i = 0; i < count; i++) while (count-- > 0)
{ {
NSUInteger idx = indexArray[i]; NSUInteger idx = indexArray[count];
(*rem)(self, remSel, idx); (*rem)(self, remSel, idx);
} }
} }

View file

@ -361,6 +361,17 @@ int main()
[uobj containsObject: @"Now"]), [uobj containsObject: @"Now"]),
"Object unarchives correctly from macOS archive") "Object unarchives correctly from macOS archive")
[array removeAllObjects];
[array addObject: @"1"];
[array addObject: @"2"];
[array addObject: @"3"];
[array addObject: @"4"];
[array addObject: @"5"];
NSMutableOrderedSet *ms = [NSMutableOrderedSet orderedSetWithArray: array];
[ms removeObjectsAtIndexes:
[NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [array count])]];
test_NSObject(@"NSOrderedSet", testObjs); test_NSObject(@"NSOrderedSet", testObjs);
test_NSCoding(testObjs); test_NSCoding(testObjs);
test_NSCopying(@"NSOrderedSet", @"NSMutableOrderedSet", testObjs, YES, NO); test_NSCopying(@"NSOrderedSet", @"NSMutableOrderedSet", testObjs, YES, NO);