]> granicus.if.org Git - transmission/commitdiff
when getting the list of all trackers, exclude tiers when necessary
authorMitchell Livingston <livings124@transmissionbt.com>
Thu, 24 Apr 2008 14:41:41 +0000 (14:41 +0000)
committerMitchell Livingston <livings124@transmissionbt.com>
Thu, 24 Apr 2008 14:41:41 +0000 (14:41 +0000)
macosx/CreatorWindowController.m
macosx/Torrent.m

index 125f90ab2d593ef6e767ab5cec5e8985126ac629..aa9d53274a35c770f58050c55f1b37fe375e5e04 100644 (file)
         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];
index fcc467fc044031c6b90a7592a3ddbb4a7735cd0f..0ac308a5b809b710bd5273ec8cf89befbe6a7156 100644 (file)
@@ -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]];