]> granicus.if.org Git - transmission/commitdiff
more changes in counter scope
authorMitchell Livingston <livings124@transmissionbt.com>
Sun, 12 Oct 2008 22:17:27 +0000 (22:17 +0000)
committerMitchell Livingston <livings124@transmissionbt.com>
Sun, 12 Oct 2008 22:17:27 +0000 (22:17 +0000)
macosx/CreatorWindowController.m
macosx/GroupsController.m
macosx/NSMenuAdditions.m
macosx/TorrentCell.m
macosx/TorrentTableView.m
macosx/TrackerTableView.m

index 3e24a653c1f2d1689e685eedca81ca03340faeb7..41deefb064b680af1360f0e95e8bdb800d7501dc 100644 (file)
         }
         
         //remove potentially invalid addresses
-        NSInteger i;
-        for (i = [fTrackers count]-1; i >= 0; i--)
+        for (NSInteger i = [fTrackers count]-1; i >= 0; i--)
         {
             if (!tr_httpIsValidURL([[fTrackers objectAtIndex: i] UTF8String]))
                 [fTrackers removeObjectAtIndex: i];
     //parse non-empty tracker strings
     tr_tracker_info * trackerInfo = tr_new0(tr_tracker_info, [fTrackers count]);
     
-    NSUInteger i;
-    for (i = 0; i < [fTrackers count]; i++)
+    for (NSUInteger i = 0; i < [fTrackers count]; i++)
         trackerInfo[i].announce = (char *)[[fTrackers objectAtIndex: i] UTF8String];
     
     //store values
index 9fc8d18d98672bb33db20bfc4073ac49b462edd5..d7e1b46585c70a431c18f5866fbebdd61edb92ad 100644 (file)
@@ -115,8 +115,7 @@ GroupsController * fGroupsInstance = nil;
 {
     if (index != -1)
     {
-        int i;
-        for (i = 0; i < [fGroups count]; i++)
+        for (NSInteger i = 0; i < [fGroups count]; i++)
             if (index == [[[fGroups objectAtIndex: i] objectForKey: @"Index"] intValue])
                 return i;
     }
@@ -170,7 +169,7 @@ GroupsController * fGroupsInstance = nil;
 - (void) addNewGroup
 {
     //find the lowest index
-    int index;
+    NSInteger index;
     for (index = 0; index < [fGroups count]; index++)
     {
         BOOL found = NO;
@@ -197,8 +196,7 @@ GroupsController * fGroupsInstance = nil;
 - (void) removeGroupWithRowIndexes: (NSIndexSet *) rowIndexes
 {
     NSMutableIndexSet * indexes = [NSMutableIndexSet indexSet];
-    int index;
-    for (index = [rowIndexes firstIndex]; index != NSNotFound; index = [rowIndexes indexGreaterThanIndex: index])
+    for (NSInteger index = [rowIndexes firstIndex]; index != NSNotFound; index = [rowIndexes indexGreaterThanIndex: index])
         [indexes addIndex: [[[fGroups objectAtIndex: index] objectForKey: @"Index"] intValue]];
     
     [fGroups removeObjectsAtIndexes: rowIndexes];
@@ -218,8 +216,7 @@ GroupsController * fGroupsInstance = nil;
     NSArray * selectedGroups = [fGroups objectsAtIndexes: selectedIndexes];
     
     //determine where to move them
-    int i, originalRow = newRow;
-    for (i = [indexes firstIndex]; i < originalRow && i != NSNotFound; i = [indexes indexGreaterThanIndex: i])
+    for (NSInteger i = [indexes firstIndex], startRow = newRow; i < startRow && i != NSNotFound; i = [indexes indexGreaterThanIndex: i])
         newRow--;
     
     //remove objects to reinsert
@@ -227,7 +224,7 @@ GroupsController * fGroupsInstance = nil;
     [fGroups removeObjectsAtIndexes: indexes];
     
     //insert objects at new location
-    for (i = 0; i < [movingGroups count]; i++)
+    for (NSInteger i = 0; i < [movingGroups count]; i++)
         [fGroups insertObject: [movingGroups objectAtIndex: i] atIndex: newRow + i];
     
     [movingGroups release];
index feee20c1157ed2cdc9ec8791cad114fae2b6b68f..f53e76201636617246d1870cd6113239e6ff6c91 100644 (file)
@@ -31,8 +31,7 @@
     int bottomIndex = bottom ? [self numberOfItems] : 0;
     
     NSMenuItem * item;
-    unsigned int i;
-    for (i = [indexes lastIndex]; i != NSNotFound; i = [indexes indexLessThanIndex: i])
+    for (NSUInteger i = [indexes lastIndex]; i != NSNotFound; i = [indexes indexLessThanIndex: i])
     {
         item = [[menu itemAtIndex: i] retain];
         [menu removeItemAtIndex: i];
index 5b05a4986e65cc0ab31394950a9bbcf050a6e9a0..4e77e56ac4349585602dc08209bc587a9323e9e3 100644 (file)
     NSIndexSet * previousFinishedIndexes = [torrent previousFinishedPieces];
     NSMutableIndexSet * finishedIndexes = [NSMutableIndexSet indexSet];
     
-    int i;
-    for (i = 0; i < pieceCount; i++)
+    for (NSInteger i = 0; i < pieceCount; i++)
     {
         NSColor * pieceColor;
         if (piecesPercent[i] == 1.0)
index 51de3ccc0fe8df703492d20b93a2195ed23f9864..ccc61e87b0cf95bbe026b166bd655d31404e618a 100644 (file)
@@ -71,8 +71,7 @@
             [self setOutlineTableColumn: groupColumn];
             
             //remove all unnecessary columns
-            int i;
-            for (i = [[self tableColumns] count]-1; i >= 0; i--)
+            for (NSInteger i = [[self tableColumns] count]-1; i >= 0; i--)
             {
                 NSTableColumn * column = [[self tableColumns] objectAtIndex: i];
                 if (column != groupColumn)
         return;
     
     NSPoint mouseLocation = [self convertPoint: [[self window] convertScreenToBase: [NSEvent mouseLocation]] fromView: nil];
-    
-    NSUInteger row;
-    for (row = rows.location; row < NSMaxRange(rows); row++)
+    for (NSUInteger row = rows.location; row < NSMaxRange(rows); row++)
     {
         if (![[self itemAtRow: row] isKindOfClass: [Torrent class]])
             continue;
         }
         else
         {
-            int i, group = [item groupIndex];
-            for (i = 0; i < [self numberOfRows]; i++)
+            int group = [item groupIndex];
+            for (NSInteger i = 0; i < [self numberOfRows]; i++)
             {
                 if ([indexSet containsIndex: i])
                     continue;
     NSIndexSet * selectedIndexes = [self selectedRowIndexes];
     NSMutableArray * values = [NSMutableArray arrayWithCapacity: [selectedIndexes count]];
     
-    NSUInteger i;
-    for (i = [selectedIndexes firstIndex]; i != NSNotFound; i = [selectedIndexes indexGreaterThanIndex: i])
+    for (NSUInteger i = [selectedIndexes firstIndex]; i != NSNotFound; i = [selectedIndexes indexGreaterThanIndex: i])
         [values addObject: [self itemAtRow: i]];
     
     return values;
     NSIndexSet * selectedIndexes = [self selectedRowIndexes];
     NSMutableArray * torrents = [NSMutableArray arrayWithCapacity: [selectedIndexes count]]; //take a shot at guessing capacity
     
-    NSUInteger i;
-    for (i = [selectedIndexes firstIndex]; i != NSNotFound; i = [selectedIndexes indexGreaterThanIndex: i])
+    for (NSUInteger i = [selectedIndexes firstIndex]; i != NSNotFound; i = [selectedIndexes indexGreaterThanIndex: i])
     {
         id item = [self itemAtRow: i];
         if ([item isKindOfClass: [Torrent class]])
     
     [NSMenu popUpContextMenu: fActionMenu withEvent: newEvent forView: self];
     
-    NSInteger i;
-    for (i = [fActionMenu numberOfItems]-1; i >= numberOfNonFileItems; i--)
+    for (NSInteger i = [fActionMenu numberOfItems]-1; i >= numberOfNonFileItems; i--)
         [fActionMenu removeItemAtIndex: i];
     
     [fMenuTorrent release];
         {
             const int speedLimitActionValue[] = { 0, 5, 10, 20, 30, 40, 50, 75, 100, 150, 200, 250, 500, 750, -1 };
             
-            int i;
-            for (i = 0; speedLimitActionValue[i] != -1; i++)
+            for (NSInteger i = 0; speedLimitActionValue[i] != -1; i++)
             {
                 item = [[NSMenuItem alloc] initWithTitle: [NSString stringWithFormat: NSLocalizedString(@"%d KB/s",
                         "Action menu -> upload/download limit"), speedLimitActionValue[i]] action: @selector(setQuickLimit:)
         {
             const float ratioLimitActionValue[] = { 0.25, 0.5, 0.75, 1.0, 1.5, 2.0, 3.0, -1.0 };
             
-            int i;
-            for (i = 0; ratioLimitActionValue[i] != -1.0; i++)
+            for (NSInteger i = 0; ratioLimitActionValue[i] != -1.0; i++)
             {
                 item = [[NSMenuItem alloc] initWithTitle: [NSString localizedStringWithFormat: @"%.2f", ratioLimitActionValue[i]]
                         action: @selector(setQuickRatio:) keyEquivalent: @""];
     NSRect visibleRect = clipRect;
     NSRange rows = [self rowsInRect: visibleRect];
     BOOL start = YES;
-    int i;
     
     if (rows.length > 0)
     {
         //determine what the first row color should be
         if ([[self itemAtRow: rows.location] isKindOfClass: [Torrent class]])
         {
-            for (i = rows.location-1; i>=0; i--)
+            for (NSInteger i = rows.location-1; i>=0; i--)
             {
                 if (![[self itemAtRow: i] isKindOfClass: [Torrent class]])
                     break;
             rows.length--;
         }
         
+        NSInteger i;
         for (i = rows.location; i < NSMaxRange(rows); i++)
         {
             if (![[self itemAtRow: i] isKindOfClass: [Torrent class]])
     int numberOfRects = ceil(visibleRect.size.height / height);
     visibleRect.size.height = height;
     
-    for (i=0; i<numberOfRects; i++)
+    for (NSInteger i=0; i<numberOfRects; i++)
     {
         if (!start)
             NSRectFill(visibleRect);
         [fPiecesBarAnimation release];
     
     NSMutableArray * progressMarks = [NSMutableArray arrayWithCapacity: 16];
-    NSAnimationProgress i;
-    for (i = 0.0625; i <= 1.0; i += 0.0625)
+    for (NSAnimationProgress i = 0.0625; i <= 1.0; i += 0.0625)
         [progressMarks addObject: [NSNumber numberWithFloat: i]];
     
     fPiecesBarAnimation = [[NSAnimation alloc] initWithDuration: TOGGLE_PROGRESS_SECONDS animationCurve: NSAnimationEaseIn];
index 234efae7f3d9e00e8f4642a1c321bf84c94fdbe9..c61b5b6b863ebd5cb25c98afd9900d17563eeca4 100644 (file)
@@ -47,7 +47,6 @@
     NSRect visibleRect = clipRect;
     NSRange rows = [self rowsInRect: visibleRect];
     BOOL start = YES;
-    int i;
     
     if (rows.length > 0)
     {
@@ -58,7 +57,7 @@
         {
             if (![[fTrackers objectAtIndex: rows.location] isKindOfClass: [NSNumber class]])
             {
-                for (i = rows.location-1; i>=0; i--)
+                for (NSInteger i = rows.location-1; i>=0; i--)
                 {
                     if ([[fTrackers objectAtIndex: i] isKindOfClass: [NSNumber class]])
                         break;
@@ -72,6 +71,7 @@
             }
         }
         
+        NSInteger i;
         for (i = rows.location; i < NSMaxRange(rows); i++)
         {
             if ([[fTrackers objectAtIndex: i] isKindOfClass: [NSNumber class]] && onLeopard)
@@ -96,7 +96,7 @@
     int numberOfRects = ceil(visibleRect.size.height / height);
     visibleRect.size.height = height;
     
-    for (i=0; i<numberOfRects; i++)
+    for (NSInteger i=0; i<numberOfRects; i++)
     {
         if (!start)
             NSRectFill(visibleRect);