Ignore:
Timestamp:
Dec 26, 2006, 9:18:42 PM (16 years ago)
Author:
livings124
Message:

while loops instead of for loops

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r1283 r1284  
    22592259    if ([ident isEqualToString: TOOLBAR_PAUSE_SELECTED])
    22602260    {
     2261        NSEnumerator * enumerator = [[fDisplayedTorrents objectsAtIndexes: [fTableView selectedRowIndexes]] objectEnumerator];
    22612262        Torrent * torrent;
    2262         NSIndexSet * indexSet = [fTableView selectedRowIndexes];
    2263         unsigned int i;
    2264        
    2265         for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
    2266         {
    2267             torrent = [fDisplayedTorrents objectAtIndex: i];
     2263        while ((torrent = [enumerator nextObject]))
     2264        {
    22682265            if ([torrent isActive] || [torrent waitingToStart])
    22692266                return YES;
     
    22752272    if ([ident isEqualToString: TOOLBAR_RESUME_SELECTED])
    22762273    {
     2274        NSEnumerator * enumerator = [[fDisplayedTorrents objectsAtIndexes: [fTableView selectedRowIndexes]] objectEnumerator];
    22772275        Torrent * torrent;
    2278         NSIndexSet * indexSet = [fTableView selectedRowIndexes];
    2279         unsigned int i;
    2280        
    2281         for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
    2282         {
    2283             torrent = [fDisplayedTorrents objectAtIndex: i];
     2276        while ((torrent = [enumerator nextObject]))
     2277        {
    22842278            if ([torrent isPaused] && ![torrent waitingToStart])
    22852279                return YES;
     
    23582352            onlyDownloading = [fDefaults boolForKey: @"CheckRemoveDownloading"],
    23592353            canDelete = action != @selector(removeDeleteTorrent:) && action != @selector(removeDeleteDataAndTorrent:);
     2354       
     2355        NSEnumerator * enumerator = [[fDisplayedTorrents objectsAtIndexes: [fTableView selectedRowIndexes]] objectEnumerator];
    23602356        Torrent * torrent;
    2361         NSIndexSet * indexSet = [fTableView selectedRowIndexes];
    2362         unsigned int i;
    2363        
    2364         for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
    2365         {
    2366             torrent = [fDisplayedTorrents objectAtIndex: i];
     2357        while ((torrent = [enumerator nextObject]))
     2358        {
    23672359            if (!warning && [torrent isActive])
    23682360            {
     
    24372429            return NO;
    24382430   
     2431        NSEnumerator * enumerator = [[fDisplayedTorrents objectsAtIndexes: [fTableView selectedRowIndexes]] objectEnumerator];
    24392432        Torrent * torrent;
    2440         NSIndexSet * indexSet = [fTableView selectedRowIndexes];
    2441         unsigned int i;
    2442        
    2443         for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
    2444         {
    2445             torrent = [fDisplayedTorrents objectAtIndex: i];
     2433        while ((torrent = [enumerator nextObject]))
     2434        {
    24462435            if ([torrent isPaused] && [torrent progress] < 1.0)
    24472436                return YES;
     
    24562445            return NO;
    24572446   
     2447        NSEnumerator * enumerator = [[fDisplayedTorrents objectsAtIndexes: [fTableView selectedRowIndexes]] objectEnumerator];
    24582448        Torrent * torrent;
    2459         NSIndexSet * indexSet = [fTableView selectedRowIndexes];
    2460         unsigned int i;
    2461        
    2462         for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
    2463         {
    2464             torrent = [fDisplayedTorrents objectAtIndex: i];
     2449        while ((torrent = [enumerator nextObject]))
     2450        {
    24652451            if ([torrent isActive] || [torrent waitingToStart])
    24662452                return YES;
Note: See TracChangeset for help on using the changeset viewer.