Changeset 275


Ignore:
Timestamp:
Jun 7, 2006, 1:39:57 AM (16 years ago)
Author:
livings124
Message:

Use the built-in method if on Tiger for making subarrays.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r272 r275  
    404404- (NSArray *) torrentsAtIndexes: (NSIndexSet *) indexSet
    405405{
    406     NSMutableArray * torrents = [NSMutableArray arrayWithCapacity: [indexSet count]];
    407     unsigned int i;
    408     for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
    409         [torrents addObject: [fTorrents objectAtIndex: i]];
    410 
    411     return torrents;
     406    if ([fTorrents respondsToSelector: @selector(objectsAtIndexes:)])
     407        return [fTorrents objectsAtIndexes: indexSet];
     408    else
     409    {
     410        NSMutableArray * torrents = [NSMutableArray arrayWithCapacity: [indexSet count]];
     411        unsigned int i;
     412        for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
     413            [torrents addObject: [fTorrents objectAtIndex: i]];
     414
     415        return torrents;
     416    }
    412417}
    413418
Note: See TracChangeset for help on using the changeset viewer.