Changeset 6242


Ignore:
Timestamp:
Jun 21, 2008, 7:01:46 PM (13 years ago)
Author:
livings124
Message:

assume that fTorrents is always sorted by queue order, and as a result eliminate some unneeded code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r6241 r6242  
    12651265    if (lowestOrderValue < [fTorrents count])
    12661266    {
    1267         NSSortDescriptor * orderDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"orderValue" ascending: YES] autorelease];
    1268         NSArray * tempTorrents = [fTorrents sortedArrayUsingDescriptors: [NSArray arrayWithObject: orderDescriptor]];
    1269 
    12701267        int i;
    1271         for (i = lowestOrderValue; i < [tempTorrents count]; i++)
    1272             [[tempTorrents objectAtIndex: i] setOrderValue: i];
     1268        for (i = lowestOrderValue; i < [fTorrents count]; i++)
     1269            [[fTorrents objectAtIndex: i] setOrderValue: i];
    12731270    }
    12741271   
     
    15821579        desiredSeedActive = [self numToStartFromQueue: NO];
    15831580   
    1584     //sort torrents by order value
    1585     NSArray * sortedTorrents; //can't just resort fTorrents because it might be rearranged while enumerating because of recursion
    1586     if ([fTorrents count] > 1 && (desiredDownloadActive > 0 || desiredSeedActive > 0))
    1587     {
    1588         NSSortDescriptor * orderDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"orderValue" ascending: YES] autorelease];
    1589         sortedTorrents = [fTorrents sortedArrayUsingDescriptors: [NSArray arrayWithObject: orderDescriptor]];
    1590     }
    1591     else
    1592         sortedTorrents = fTorrents;
    1593    
    15941581    Torrent * torrent;
    1595     NSEnumerator * enumerator = [sortedTorrents objectEnumerator];
     1582    NSEnumerator * enumerator = [fTorrents objectEnumerator];
    15961583    while ((torrent = [enumerator nextObject]))
    15971584    {
     
    27752762            [fTorrents removeObjectsInArray: movingTorrents];
    27762763           
    2777             //get all torrents to reorder
    2778             NSSortDescriptor * orderDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"orderValue" ascending: YES] autorelease];
    2779             [fTorrents sortUsingDescriptors: [NSArray arrayWithObject: orderDescriptor]];
    2780            
    27812764            //insert objects at new location
    27822765            int insertIndex = topTorrent ? [fTorrents indexOfObject: topTorrent] + 1 : 0;
Note: See TracChangeset for help on using the changeset viewer.