diff options
author | Max Lohrmann <dmoagx@users.noreply.github.com> | 2017-03-12 09:46:59 +0100 |
---|---|---|
committer | Max Lohrmann <dmoagx@users.noreply.github.com> | 2017-03-12 09:46:59 +0100 |
commit | 95250e0f0c5780ac113a9a4c948c452038b4c02a (patch) | |
tree | 18d41b1a2bae49b38e58d986e5d3934aac8b3227 /Source/SPContentFilterManager.m | |
parent | f5e022b6667815a05c0b2478db07f50af2e52d0b (diff) | |
download | sequelpro-95250e0f0c5780ac113a9a4c948c452038b4c02a.tar.gz sequelpro-95250e0f0c5780ac113a9a4c948c452038b4c02a.tar.bz2 sequelpro-95250e0f0c5780ac113a9a4c948c452038b4c02a.zip |
Replace some legacy NSIndexSet enumeration with 10.6+ style -enumerateIndexesUsingBlock:
Diffstat (limited to 'Source/SPContentFilterManager.m')
-rw-r--r-- | Source/SPContentFilterManager.m | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/Source/SPContentFilterManager.m b/Source/SPContentFilterManager.m index fe20bcf1..6356f416 100644 --- a/Source/SPContentFilterManager.m +++ b/Source/SPContentFilterManager.m @@ -609,11 +609,9 @@ static NSString *SPExportFilterAction = @"SPExportFilter"; // TODO: still rely on a NSArray but in the future rewrite it to use the NSIndexSet directly NSMutableArray *draggedRows = [[NSMutableArray alloc] initWithCapacity:1]; - NSUInteger rowIndex = [draggedIndexes firstIndex]; - while ( rowIndex != NSNotFound ) { + [draggedIndexes enumerateIndexesUsingBlock:^(NSUInteger rowIndex, BOOL * _Nonnull stop) { [draggedRows addObject:[NSNumber numberWithInteger:rowIndex]]; - rowIndex = [draggedIndexes indexGreaterThanIndex: rowIndex]; - } + }]; NSInteger destinationRow = row; @@ -805,16 +803,9 @@ static NSString *SPExportFilterAction = @"SPExportFilter"; if (returnCode == NSAlertDefaultReturn) { NSIndexSet *indexes = [contentFilterTableView selectedRowIndexes]; - // Get last index - NSUInteger currentIndex = [indexes lastIndex]; - - while (currentIndex != NSNotFound) - { + [indexes enumerateIndexesWithOptions:NSEnumerationReverse usingBlock:^(NSUInteger currentIndex, BOOL * _Nonnull stop) { [contentFilters removeObjectAtIndex:currentIndex]; - - // Get next index (beginning from the end) - currentIndex = [indexes indexLessThanIndex:currentIndex]; - } + }]; if ([contentFilters count] == 2) { [contentFilterNameTextField setStringValue:@""]; |