mirror of
https://github.com/transmission/transmission
synced 2024-12-25 09:13:06 +00:00
while loops instead of for loops
This commit is contained in:
parent
4471ce12c5
commit
82863e13b8
1 changed files with 11 additions and 25 deletions
|
@ -2258,13 +2258,10 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
||||||
//enable pause item
|
//enable pause item
|
||||||
if ([ident isEqualToString: TOOLBAR_PAUSE_SELECTED])
|
if ([ident isEqualToString: TOOLBAR_PAUSE_SELECTED])
|
||||||
{
|
{
|
||||||
|
NSEnumerator * enumerator = [[fDisplayedTorrents objectsAtIndexes: [fTableView selectedRowIndexes]] objectEnumerator];
|
||||||
Torrent * torrent;
|
Torrent * torrent;
|
||||||
NSIndexSet * indexSet = [fTableView selectedRowIndexes];
|
while ((torrent = [enumerator nextObject]))
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
|
|
||||||
{
|
{
|
||||||
torrent = [fDisplayedTorrents objectAtIndex: i];
|
|
||||||
if ([torrent isActive] || [torrent waitingToStart])
|
if ([torrent isActive] || [torrent waitingToStart])
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
@ -2274,13 +2271,10 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
||||||
//enable resume item
|
//enable resume item
|
||||||
if ([ident isEqualToString: TOOLBAR_RESUME_SELECTED])
|
if ([ident isEqualToString: TOOLBAR_RESUME_SELECTED])
|
||||||
{
|
{
|
||||||
|
NSEnumerator * enumerator = [[fDisplayedTorrents objectsAtIndexes: [fTableView selectedRowIndexes]] objectEnumerator];
|
||||||
Torrent * torrent;
|
Torrent * torrent;
|
||||||
NSIndexSet * indexSet = [fTableView selectedRowIndexes];
|
while ((torrent = [enumerator nextObject]))
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
|
|
||||||
{
|
{
|
||||||
torrent = [fDisplayedTorrents objectAtIndex: i];
|
|
||||||
if ([torrent isPaused] && ![torrent waitingToStart])
|
if ([torrent isPaused] && ![torrent waitingToStart])
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
@ -2357,13 +2351,11 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
||||||
BOOL warning = NO,
|
BOOL warning = NO,
|
||||||
onlyDownloading = [fDefaults boolForKey: @"CheckRemoveDownloading"],
|
onlyDownloading = [fDefaults boolForKey: @"CheckRemoveDownloading"],
|
||||||
canDelete = action != @selector(removeDeleteTorrent:) && action != @selector(removeDeleteDataAndTorrent:);
|
canDelete = action != @selector(removeDeleteTorrent:) && action != @selector(removeDeleteDataAndTorrent:);
|
||||||
Torrent * torrent;
|
|
||||||
NSIndexSet * indexSet = [fTableView selectedRowIndexes];
|
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
|
NSEnumerator * enumerator = [[fDisplayedTorrents objectsAtIndexes: [fTableView selectedRowIndexes]] objectEnumerator];
|
||||||
|
Torrent * torrent;
|
||||||
|
while ((torrent = [enumerator nextObject]))
|
||||||
{
|
{
|
||||||
torrent = [fDisplayedTorrents objectAtIndex: i];
|
|
||||||
if (!warning && [torrent isActive])
|
if (!warning && [torrent isActive])
|
||||||
{
|
{
|
||||||
warning = onlyDownloading ? ![torrent isSeeding] : YES;
|
warning = onlyDownloading ? ![torrent isSeeding] : YES;
|
||||||
|
@ -2436,13 +2428,10 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
||||||
if (![fDefaults boolForKey: @"Queue"])
|
if (![fDefaults boolForKey: @"Queue"])
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
|
NSEnumerator * enumerator = [[fDisplayedTorrents objectsAtIndexes: [fTableView selectedRowIndexes]] objectEnumerator];
|
||||||
Torrent * torrent;
|
Torrent * torrent;
|
||||||
NSIndexSet * indexSet = [fTableView selectedRowIndexes];
|
while ((torrent = [enumerator nextObject]))
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
|
|
||||||
{
|
{
|
||||||
torrent = [fDisplayedTorrents objectAtIndex: i];
|
|
||||||
if ([torrent isPaused] && [torrent progress] < 1.0)
|
if ([torrent isPaused] && [torrent progress] < 1.0)
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
@ -2455,13 +2444,10 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
||||||
if (!canUseTable)
|
if (!canUseTable)
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
|
NSEnumerator * enumerator = [[fDisplayedTorrents objectsAtIndexes: [fTableView selectedRowIndexes]] objectEnumerator];
|
||||||
Torrent * torrent;
|
Torrent * torrent;
|
||||||
NSIndexSet * indexSet = [fTableView selectedRowIndexes];
|
while ((torrent = [enumerator nextObject]))
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
|
|
||||||
{
|
{
|
||||||
torrent = [fDisplayedTorrents objectAtIndex: i];
|
|
||||||
if ([torrent isActive] || [torrent waitingToStart])
|
if ([torrent isActive] || [torrent waitingToStart])
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue