From b5d8fd0eb808f7ca2669001cc39d27970e27e18e Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Thu, 24 Apr 2008 14:41:41 +0000 Subject: [PATCH] when getting the list of all trackers, exclude tiers when necessary --- macosx/CreatorWindowController.m | 1 - macosx/Torrent.m | 9 ++++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/macosx/CreatorWindowController.m b/macosx/CreatorWindowController.m index 125f90ab2..aa9d53274 100644 --- a/macosx/CreatorWindowController.m +++ b/macosx/CreatorWindowController.m @@ -194,7 +194,6 @@ trackerString = [@"http://" stringByAppendingString: trackerString]; //parse tracker string - #warning check if it works with https if (tr_httpParseURL([trackerString UTF8String], -1, NULL, NULL, NULL)) { NSAlert * alert = [[[NSAlert alloc] init] autorelease]; diff --git a/macosx/Torrent.m b/macosx/Torrent.m index fcc467fc0..0ac308a5b 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -770,15 +770,18 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void * return [NSString stringWithUTF8String: fStat->tracker_stat.scrapeResponse]; } +#warning removes separators? - (NSArray *) allTrackers: (BOOL) separators { - int count = fInfo->trackerCount; - NSMutableArray * allTrackers = [NSMutableArray arrayWithCapacity: count + fInfo->trackers[count-1].tier + 1]; + int count = fInfo->trackerCount, capacity = count; + if (separators) + capacity += fInfo->trackers[count-1].tier + 1; + NSMutableArray * allTrackers = [NSMutableArray arrayWithCapacity: capacity]; int i, tier = -1; for (i = 0; i < count; i++) { - if (tier != fInfo->trackers[i].tier) + if (separators && tier != fInfo->trackers[i].tier) { tier = fInfo->trackers[i].tier; [allTrackers addObject: [NSNumber numberWithInt: tier]];