1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-03 18:25:35 +00:00

more changes in counter scope

This commit is contained in:
Mitchell Livingston 2008-10-12 22:17:27 +00:00
parent 4e388c95aa
commit 2c0a39d7c6
6 changed files with 25 additions and 41 deletions

View file

@ -125,8 +125,7 @@
}
//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];
@ -413,8 +412,7 @@
//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

View 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];

View 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];

View file

@ -683,8 +683,7 @@
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)

View 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)
@ -255,9 +254,7 @@
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;
@ -449,8 +446,8 @@
}
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;
@ -473,8 +470,7 @@
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;
@ -485,8 +481,7 @@
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]])
@ -608,8 +603,7 @@
[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];
@ -629,8 +623,7 @@
{
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:)
@ -663,8 +656,7 @@
{
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: @""];
@ -708,14 +700,13 @@
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;
@ -728,6 +719,7 @@
rows.length--;
}
NSInteger i;
for (i = rows.location; i < NSMaxRange(rows); i++)
{
if (![[self itemAtRow: i] isKindOfClass: [Torrent class]])
@ -752,7 +744,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);
@ -847,8 +839,7 @@
[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];

View 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);