mirror of
https://github.com/transmission/transmission
synced 2025-03-04 02:28:03 +00:00
more changes in counter scope
This commit is contained in:
parent
4e388c95aa
commit
2c0a39d7c6
6 changed files with 25 additions and 41 deletions
|
@ -125,8 +125,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
//remove potentially invalid addresses
|
//remove potentially invalid addresses
|
||||||
NSInteger i;
|
for (NSInteger i = [fTrackers count]-1; i >= 0; i--)
|
||||||
for (i = [fTrackers count]-1; i >= 0; i--)
|
|
||||||
{
|
{
|
||||||
if (!tr_httpIsValidURL([[fTrackers objectAtIndex: i] UTF8String]))
|
if (!tr_httpIsValidURL([[fTrackers objectAtIndex: i] UTF8String]))
|
||||||
[fTrackers removeObjectAtIndex: i];
|
[fTrackers removeObjectAtIndex: i];
|
||||||
|
@ -413,8 +412,7 @@
|
||||||
//parse non-empty tracker strings
|
//parse non-empty tracker strings
|
||||||
tr_tracker_info * trackerInfo = tr_new0(tr_tracker_info, [fTrackers count]);
|
tr_tracker_info * trackerInfo = tr_new0(tr_tracker_info, [fTrackers count]);
|
||||||
|
|
||||||
NSUInteger i;
|
for (NSUInteger i = 0; i < [fTrackers count]; i++)
|
||||||
for (i = 0; i < [fTrackers count]; i++)
|
|
||||||
trackerInfo[i].announce = (char *)[[fTrackers objectAtIndex: i] UTF8String];
|
trackerInfo[i].announce = (char *)[[fTrackers objectAtIndex: i] UTF8String];
|
||||||
|
|
||||||
//store values
|
//store values
|
||||||
|
|
|
@ -115,8 +115,7 @@ GroupsController * fGroupsInstance = nil;
|
||||||
{
|
{
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
int i;
|
for (NSInteger i = 0; i < [fGroups count]; i++)
|
||||||
for (i = 0; i < [fGroups count]; i++)
|
|
||||||
if (index == [[[fGroups objectAtIndex: i] objectForKey: @"Index"] intValue])
|
if (index == [[[fGroups objectAtIndex: i] objectForKey: @"Index"] intValue])
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -170,7 +169,7 @@ GroupsController * fGroupsInstance = nil;
|
||||||
- (void) addNewGroup
|
- (void) addNewGroup
|
||||||
{
|
{
|
||||||
//find the lowest index
|
//find the lowest index
|
||||||
int index;
|
NSInteger index;
|
||||||
for (index = 0; index < [fGroups count]; index++)
|
for (index = 0; index < [fGroups count]; index++)
|
||||||
{
|
{
|
||||||
BOOL found = NO;
|
BOOL found = NO;
|
||||||
|
@ -197,8 +196,7 @@ GroupsController * fGroupsInstance = nil;
|
||||||
- (void) removeGroupWithRowIndexes: (NSIndexSet *) rowIndexes
|
- (void) removeGroupWithRowIndexes: (NSIndexSet *) rowIndexes
|
||||||
{
|
{
|
||||||
NSMutableIndexSet * indexes = [NSMutableIndexSet indexSet];
|
NSMutableIndexSet * indexes = [NSMutableIndexSet indexSet];
|
||||||
int index;
|
for (NSInteger index = [rowIndexes firstIndex]; index != NSNotFound; index = [rowIndexes indexGreaterThanIndex: index])
|
||||||
for (index = [rowIndexes firstIndex]; index != NSNotFound; index = [rowIndexes indexGreaterThanIndex: index])
|
|
||||||
[indexes addIndex: [[[fGroups objectAtIndex: index] objectForKey: @"Index"] intValue]];
|
[indexes addIndex: [[[fGroups objectAtIndex: index] objectForKey: @"Index"] intValue]];
|
||||||
|
|
||||||
[fGroups removeObjectsAtIndexes: rowIndexes];
|
[fGroups removeObjectsAtIndexes: rowIndexes];
|
||||||
|
@ -218,8 +216,7 @@ GroupsController * fGroupsInstance = nil;
|
||||||
NSArray * selectedGroups = [fGroups objectsAtIndexes: selectedIndexes];
|
NSArray * selectedGroups = [fGroups objectsAtIndexes: selectedIndexes];
|
||||||
|
|
||||||
//determine where to move them
|
//determine where to move them
|
||||||
int i, originalRow = newRow;
|
for (NSInteger i = [indexes firstIndex], startRow = newRow; i < startRow && i != NSNotFound; i = [indexes indexGreaterThanIndex: i])
|
||||||
for (i = [indexes firstIndex]; i < originalRow && i != NSNotFound; i = [indexes indexGreaterThanIndex: i])
|
|
||||||
newRow--;
|
newRow--;
|
||||||
|
|
||||||
//remove objects to reinsert
|
//remove objects to reinsert
|
||||||
|
@ -227,7 +224,7 @@ GroupsController * fGroupsInstance = nil;
|
||||||
[fGroups removeObjectsAtIndexes: indexes];
|
[fGroups removeObjectsAtIndexes: indexes];
|
||||||
|
|
||||||
//insert objects at new location
|
//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];
|
[fGroups insertObject: [movingGroups objectAtIndex: i] atIndex: newRow + i];
|
||||||
|
|
||||||
[movingGroups release];
|
[movingGroups release];
|
||||||
|
|
|
@ -31,8 +31,7 @@
|
||||||
int bottomIndex = bottom ? [self numberOfItems] : 0;
|
int bottomIndex = bottom ? [self numberOfItems] : 0;
|
||||||
|
|
||||||
NSMenuItem * item;
|
NSMenuItem * item;
|
||||||
unsigned int i;
|
for (NSUInteger i = [indexes lastIndex]; i != NSNotFound; i = [indexes indexLessThanIndex: i])
|
||||||
for (i = [indexes lastIndex]; i != NSNotFound; i = [indexes indexLessThanIndex: i])
|
|
||||||
{
|
{
|
||||||
item = [[menu itemAtIndex: i] retain];
|
item = [[menu itemAtIndex: i] retain];
|
||||||
[menu removeItemAtIndex: i];
|
[menu removeItemAtIndex: i];
|
||||||
|
|
|
@ -683,8 +683,7 @@
|
||||||
NSIndexSet * previousFinishedIndexes = [torrent previousFinishedPieces];
|
NSIndexSet * previousFinishedIndexes = [torrent previousFinishedPieces];
|
||||||
NSMutableIndexSet * finishedIndexes = [NSMutableIndexSet indexSet];
|
NSMutableIndexSet * finishedIndexes = [NSMutableIndexSet indexSet];
|
||||||
|
|
||||||
int i;
|
for (NSInteger i = 0; i < pieceCount; i++)
|
||||||
for (i = 0; i < pieceCount; i++)
|
|
||||||
{
|
{
|
||||||
NSColor * pieceColor;
|
NSColor * pieceColor;
|
||||||
if (piecesPercent[i] == 1.0)
|
if (piecesPercent[i] == 1.0)
|
||||||
|
|
|
@ -71,8 +71,7 @@
|
||||||
[self setOutlineTableColumn: groupColumn];
|
[self setOutlineTableColumn: groupColumn];
|
||||||
|
|
||||||
//remove all unnecessary columns
|
//remove all unnecessary columns
|
||||||
int i;
|
for (NSInteger i = [[self tableColumns] count]-1; i >= 0; i--)
|
||||||
for (i = [[self tableColumns] count]-1; i >= 0; i--)
|
|
||||||
{
|
{
|
||||||
NSTableColumn * column = [[self tableColumns] objectAtIndex: i];
|
NSTableColumn * column = [[self tableColumns] objectAtIndex: i];
|
||||||
if (column != groupColumn)
|
if (column != groupColumn)
|
||||||
|
@ -255,9 +254,7 @@
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NSPoint mouseLocation = [self convertPoint: [[self window] convertScreenToBase: [NSEvent mouseLocation]] fromView: nil];
|
NSPoint mouseLocation = [self convertPoint: [[self window] convertScreenToBase: [NSEvent mouseLocation]] fromView: nil];
|
||||||
|
for (NSUInteger row = rows.location; row < NSMaxRange(rows); row++)
|
||||||
NSUInteger row;
|
|
||||||
for (row = rows.location; row < NSMaxRange(rows); row++)
|
|
||||||
{
|
{
|
||||||
if (![[self itemAtRow: row] isKindOfClass: [Torrent class]])
|
if (![[self itemAtRow: row] isKindOfClass: [Torrent class]])
|
||||||
continue;
|
continue;
|
||||||
|
@ -449,8 +446,8 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int i, group = [item groupIndex];
|
int group = [item groupIndex];
|
||||||
for (i = 0; i < [self numberOfRows]; i++)
|
for (NSInteger i = 0; i < [self numberOfRows]; i++)
|
||||||
{
|
{
|
||||||
if ([indexSet containsIndex: i])
|
if ([indexSet containsIndex: i])
|
||||||
continue;
|
continue;
|
||||||
|
@ -473,8 +470,7 @@
|
||||||
NSIndexSet * selectedIndexes = [self selectedRowIndexes];
|
NSIndexSet * selectedIndexes = [self selectedRowIndexes];
|
||||||
NSMutableArray * values = [NSMutableArray arrayWithCapacity: [selectedIndexes count]];
|
NSMutableArray * values = [NSMutableArray arrayWithCapacity: [selectedIndexes count]];
|
||||||
|
|
||||||
NSUInteger i;
|
for (NSUInteger i = [selectedIndexes firstIndex]; i != NSNotFound; i = [selectedIndexes indexGreaterThanIndex: i])
|
||||||
for (i = [selectedIndexes firstIndex]; i != NSNotFound; i = [selectedIndexes indexGreaterThanIndex: i])
|
|
||||||
[values addObject: [self itemAtRow: i]];
|
[values addObject: [self itemAtRow: i]];
|
||||||
|
|
||||||
return values;
|
return values;
|
||||||
|
@ -485,8 +481,7 @@
|
||||||
NSIndexSet * selectedIndexes = [self selectedRowIndexes];
|
NSIndexSet * selectedIndexes = [self selectedRowIndexes];
|
||||||
NSMutableArray * torrents = [NSMutableArray arrayWithCapacity: [selectedIndexes count]]; //take a shot at guessing capacity
|
NSMutableArray * torrents = [NSMutableArray arrayWithCapacity: [selectedIndexes count]]; //take a shot at guessing capacity
|
||||||
|
|
||||||
NSUInteger i;
|
for (NSUInteger i = [selectedIndexes firstIndex]; i != NSNotFound; i = [selectedIndexes indexGreaterThanIndex: i])
|
||||||
for (i = [selectedIndexes firstIndex]; i != NSNotFound; i = [selectedIndexes indexGreaterThanIndex: i])
|
|
||||||
{
|
{
|
||||||
id item = [self itemAtRow: i];
|
id item = [self itemAtRow: i];
|
||||||
if ([item isKindOfClass: [Torrent class]])
|
if ([item isKindOfClass: [Torrent class]])
|
||||||
|
@ -608,8 +603,7 @@
|
||||||
|
|
||||||
[NSMenu popUpContextMenu: fActionMenu withEvent: newEvent forView: self];
|
[NSMenu popUpContextMenu: fActionMenu withEvent: newEvent forView: self];
|
||||||
|
|
||||||
NSInteger i;
|
for (NSInteger i = [fActionMenu numberOfItems]-1; i >= numberOfNonFileItems; i--)
|
||||||
for (i = [fActionMenu numberOfItems]-1; i >= numberOfNonFileItems; i--)
|
|
||||||
[fActionMenu removeItemAtIndex: i];
|
[fActionMenu removeItemAtIndex: i];
|
||||||
|
|
||||||
[fMenuTorrent release];
|
[fMenuTorrent release];
|
||||||
|
@ -629,8 +623,7 @@
|
||||||
{
|
{
|
||||||
const int speedLimitActionValue[] = { 0, 5, 10, 20, 30, 40, 50, 75, 100, 150, 200, 250, 500, 750, -1 };
|
const int speedLimitActionValue[] = { 0, 5, 10, 20, 30, 40, 50, 75, 100, 150, 200, 250, 500, 750, -1 };
|
||||||
|
|
||||||
int i;
|
for (NSInteger i = 0; speedLimitActionValue[i] != -1; i++)
|
||||||
for (i = 0; speedLimitActionValue[i] != -1; i++)
|
|
||||||
{
|
{
|
||||||
item = [[NSMenuItem alloc] initWithTitle: [NSString stringWithFormat: NSLocalizedString(@"%d KB/s",
|
item = [[NSMenuItem alloc] initWithTitle: [NSString stringWithFormat: NSLocalizedString(@"%d KB/s",
|
||||||
"Action menu -> upload/download limit"), speedLimitActionValue[i]] action: @selector(setQuickLimit:)
|
"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 };
|
const float ratioLimitActionValue[] = { 0.25, 0.5, 0.75, 1.0, 1.5, 2.0, 3.0, -1.0 };
|
||||||
|
|
||||||
int i;
|
for (NSInteger i = 0; ratioLimitActionValue[i] != -1.0; i++)
|
||||||
for (i = 0; ratioLimitActionValue[i] != -1.0; i++)
|
|
||||||
{
|
{
|
||||||
item = [[NSMenuItem alloc] initWithTitle: [NSString localizedStringWithFormat: @"%.2f", ratioLimitActionValue[i]]
|
item = [[NSMenuItem alloc] initWithTitle: [NSString localizedStringWithFormat: @"%.2f", ratioLimitActionValue[i]]
|
||||||
action: @selector(setQuickRatio:) keyEquivalent: @""];
|
action: @selector(setQuickRatio:) keyEquivalent: @""];
|
||||||
|
@ -708,14 +700,13 @@
|
||||||
NSRect visibleRect = clipRect;
|
NSRect visibleRect = clipRect;
|
||||||
NSRange rows = [self rowsInRect: visibleRect];
|
NSRange rows = [self rowsInRect: visibleRect];
|
||||||
BOOL start = YES;
|
BOOL start = YES;
|
||||||
int i;
|
|
||||||
|
|
||||||
if (rows.length > 0)
|
if (rows.length > 0)
|
||||||
{
|
{
|
||||||
//determine what the first row color should be
|
//determine what the first row color should be
|
||||||
if ([[self itemAtRow: rows.location] isKindOfClass: [Torrent class]])
|
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]])
|
if (![[self itemAtRow: i] isKindOfClass: [Torrent class]])
|
||||||
break;
|
break;
|
||||||
|
@ -728,6 +719,7 @@
|
||||||
rows.length--;
|
rows.length--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSInteger i;
|
||||||
for (i = rows.location; i < NSMaxRange(rows); i++)
|
for (i = rows.location; i < NSMaxRange(rows); i++)
|
||||||
{
|
{
|
||||||
if (![[self itemAtRow: i] isKindOfClass: [Torrent class]])
|
if (![[self itemAtRow: i] isKindOfClass: [Torrent class]])
|
||||||
|
@ -752,7 +744,7 @@
|
||||||
int numberOfRects = ceil(visibleRect.size.height / height);
|
int numberOfRects = ceil(visibleRect.size.height / height);
|
||||||
visibleRect.size.height = height;
|
visibleRect.size.height = height;
|
||||||
|
|
||||||
for (i=0; i<numberOfRects; i++)
|
for (NSInteger i=0; i<numberOfRects; i++)
|
||||||
{
|
{
|
||||||
if (!start)
|
if (!start)
|
||||||
NSRectFill(visibleRect);
|
NSRectFill(visibleRect);
|
||||||
|
@ -847,8 +839,7 @@
|
||||||
[fPiecesBarAnimation release];
|
[fPiecesBarAnimation release];
|
||||||
|
|
||||||
NSMutableArray * progressMarks = [NSMutableArray arrayWithCapacity: 16];
|
NSMutableArray * progressMarks = [NSMutableArray arrayWithCapacity: 16];
|
||||||
NSAnimationProgress i;
|
for (NSAnimationProgress i = 0.0625; i <= 1.0; i += 0.0625)
|
||||||
for (i = 0.0625; i <= 1.0; i += 0.0625)
|
|
||||||
[progressMarks addObject: [NSNumber numberWithFloat: i]];
|
[progressMarks addObject: [NSNumber numberWithFloat: i]];
|
||||||
|
|
||||||
fPiecesBarAnimation = [[NSAnimation alloc] initWithDuration: TOGGLE_PROGRESS_SECONDS animationCurve: NSAnimationEaseIn];
|
fPiecesBarAnimation = [[NSAnimation alloc] initWithDuration: TOGGLE_PROGRESS_SECONDS animationCurve: NSAnimationEaseIn];
|
||||||
|
|
|
@ -47,7 +47,6 @@
|
||||||
NSRect visibleRect = clipRect;
|
NSRect visibleRect = clipRect;
|
||||||
NSRange rows = [self rowsInRect: visibleRect];
|
NSRange rows = [self rowsInRect: visibleRect];
|
||||||
BOOL start = YES;
|
BOOL start = YES;
|
||||||
int i;
|
|
||||||
|
|
||||||
if (rows.length > 0)
|
if (rows.length > 0)
|
||||||
{
|
{
|
||||||
|
@ -58,7 +57,7 @@
|
||||||
{
|
{
|
||||||
if (![[fTrackers objectAtIndex: rows.location] isKindOfClass: [NSNumber class]])
|
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]])
|
if ([[fTrackers objectAtIndex: i] isKindOfClass: [NSNumber class]])
|
||||||
break;
|
break;
|
||||||
|
@ -72,6 +71,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSInteger i;
|
||||||
for (i = rows.location; i < NSMaxRange(rows); i++)
|
for (i = rows.location; i < NSMaxRange(rows); i++)
|
||||||
{
|
{
|
||||||
if ([[fTrackers objectAtIndex: i] isKindOfClass: [NSNumber class]] && onLeopard)
|
if ([[fTrackers objectAtIndex: i] isKindOfClass: [NSNumber class]] && onLeopard)
|
||||||
|
@ -96,7 +96,7 @@
|
||||||
int numberOfRects = ceil(visibleRect.size.height / height);
|
int numberOfRects = ceil(visibleRect.size.height / height);
|
||||||
visibleRect.size.height = height;
|
visibleRect.size.height = height;
|
||||||
|
|
||||||
for (i=0; i<numberOfRects; i++)
|
for (NSInteger i=0; i<numberOfRects; i++)
|
||||||
{
|
{
|
||||||
if (!start)
|
if (!start)
|
||||||
NSRectFill(visibleRect);
|
NSRectFill(visibleRect);
|
||||||
|
|
Loading…
Add table
Reference in a new issue