Changeset 7515


Ignore:
Timestamp:
Dec 26, 2008, 3:11:37 PM (12 years ago)
Author:
livings124
Message:

finish fast enumeration conversion

Location:
trunk/macosx
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/GroupsController.m

    r7508 r7515  
    256256    {
    257257        BOOL found = NO;
    258         NSEnumerator * enumerator = [fGroups objectEnumerator];
    259         NSDictionary * dict;
    260         while ((dict = [enumerator nextObject]))
     258        for (NSDictionary * dict in fGroups)
    261259            if ([[dict objectForKey: @"Index"] intValue] == index)
    262260            {
     
    334332    [item release];
    335333   
    336     NSEnumerator * enumerator = [fGroups objectEnumerator];
    337     NSMutableDictionary * dict;
    338     while ((dict = [enumerator nextObject]))
     334    for (NSMutableDictionary * dict in fGroups)
    339335    {
    340336        item = [[NSMenuItem alloc] initWithTitle: [dict objectForKey: @"Name"] action: action keyEquivalent: @""];
     
    365361- (NSInteger) groupIndexForTorrent: (Torrent *) torrent;
    366362{
    367     NSEnumerator * enumerator = [fGroups objectEnumerator];
    368     NSMutableDictionary * group;
    369     while ((group = [enumerator nextObject]))
     363    for (NSDictionary * group in fGroups)
    370364    {
    371365        NSInteger row = [[group objectForKey: @"Index"] intValue];
     
    384378    //don't archive the icon
    385379    NSMutableArray * groups = [NSMutableArray arrayWithCapacity: [fGroups count]];
    386     NSEnumerator * enumerator = [fGroups objectEnumerator];
    387     NSDictionary * dict;
    388     while ((dict = [enumerator nextObject]))
     380    for (NSDictionary * dict in fGroups)
    389381    {
    390382        NSMutableDictionary * tempDict = [dict mutableCopy];
  • trunk/macosx/InfoWindowController.m

    r7508 r7515  
    246246            uint64_t size = 0;
    247247            NSInteger fileCount = 0;
    248             NSEnumerator * enumerator = [torrents objectEnumerator];
    249             Torrent * torrent;
    250             while ((torrent = [enumerator nextObject]))
     248            for (Torrent * torrent in torrents)
    251249            {
    252250                size += [torrent size];
     
    12031201    }
    12041202   
    1205     Torrent * torrent;
    1206     NSEnumerator * enumerator = [fTorrents objectEnumerator];
    1207     while ((torrent = [enumerator nextObject]))
     1203    for (Torrent * torrent in fTorrents)
    12081204        [torrent setSpeedMode: mode upload: upload];
    12091205   
     
    12271223    NSInteger limit = [sender intValue];
    12281224   
    1229     Torrent * torrent;
    1230     NSEnumerator * enumerator = [fTorrents objectEnumerator];
    1231    
    1232     while ((torrent = [enumerator nextObject]))
     1225    for (Torrent * torrent in fTorrents)
    12331226        [torrent setSpeedLimit: limit upload: upload];
    12341227}
     
    12521245    }
    12531246   
    1254     Torrent * torrent;
    1255     NSEnumerator * enumerator = [fTorrents objectEnumerator];
    1256     while ((torrent = [enumerator nextObject]))
     1247    for (Torrent * torrent in fTorrents)
    12571248        [torrent setRatioSetting: setting];
    12581249   
     
    12721263    CGFloat limit = [sender floatValue];
    12731264   
    1274     Torrent * torrent;
    1275     NSEnumerator * enumerator = [fTorrents objectEnumerator];
    1276     while ((torrent = [enumerator nextObject]))
     1265    for (Torrent * torrent in fTorrents)
    12771266        [torrent setRatioLimit: limit];
    12781267}
     
    12821271    NSInteger limit = [sender intValue];
    12831272   
    1284     Torrent * torrent;
    1285     NSEnumerator * enumerator = [fTorrents objectEnumerator];
    1286     while ((torrent = [enumerator nextObject]))
     1273    for (Torrent * torrent in fTorrents)
    12871274        [torrent setMaxPeerConnect: limit];
    12881275}
     
    13351322    uint64_t have = 0, haveVerified = 0, downloadedTotal = 0, uploadedTotal = 0, failedHash = 0;
    13361323    NSDate * lastActivity = nil;
    1337     Torrent * torrent;
    1338     NSEnumerator * enumerator = [fTorrents objectEnumerator];
    1339     while ((torrent = [enumerator nextObject]))
     1324    for (Torrent * torrent in fTorrents)
    13401325    {
    13411326        have += [torrent haveTotal];
     
    13701355    if (numberSelected == 1)
    13711356    {
    1372         torrent = [fTorrents objectAtIndex: 0];
     1357        Torrent * torrent = [fTorrents objectAtIndex: 0];
    13731358       
    13741359        [fStateField setStringValue: [torrent stateString]];
  • trunk/macosx/Torrent.m

    r7514 r7515  
    17451745            {
    17461746                //determine if folder node already exists
    1747                 FileListNode * node = nil;
     1747                FileListNode * node;
    17481748                for (node in fileList)
    17491749                    if ([[node name] isEqualToString: name] && [node isFolder])
  • trunk/macosx/TorrentTableView.m

    r7508 r7515  
    246246    fMouseActionRow = -1;
    247247   
    248     NSEnumerator * enumerator = [[self trackingAreas] objectEnumerator];
    249     NSTrackingArea * area;
    250     while ((area = [enumerator nextObject]))
     248    for (NSTrackingArea * area in [self trackingAreas])
    251249    {
    252250        if ([area owner] == self && [[area userInfo] objectForKey: @"Row"])
     
    403401    NSMutableIndexSet * indexSet = [NSMutableIndexSet indexSet];
    404402   
    405     NSEnumerator * enumerator = [values objectEnumerator];
    406     id item;
    407     while ((item = [enumerator nextObject]))
     403    for (id item in values)
    408404    {
    409405        if ([item isKindOfClass: [Torrent class]])
     
    882878- (void) createFileMenu: (NSMenu *) menu forFiles: (NSArray *) files
    883879{
    884     NSEnumerator * enumerator = [files objectEnumerator];
    885     FileListNode * node;
    886     while ((node = [enumerator nextObject]))
     880    for (FileListNode * node in files)
    887881    {
    888882        NSString * name = [node name];
Note: See TracChangeset for help on using the changeset viewer.