From a5e0b6e5b25745cc1c4c0caf75b434d72024a5c4 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Sun, 25 Oct 2009 18:45:35 +0000 Subject: [PATCH] since the Mac UI is the only one to use it, move percentRatio calculation into the Mac code --- libtransmission/torrent.c | 7 ------- libtransmission/transmission.h | 5 ----- macosx/Torrent.m | 8 +++++++- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c index cd9191cd2..7ff69d0fb 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.c @@ -1024,13 +1024,6 @@ tr_torrentStat( tr_torrent * tor ) break; } - if( !checkSeedRatio || s->ratio >= seedRatio || s->ratio == TR_RATIO_INF ) - s->percentRatio = 1.0; - else if( s->ratio == TR_RATIO_NA ) - s->percentRatio = 0.0; - else - s->percentRatio = s->ratio / seedRatio; - tr_torrentUnlock( tor ); return s; diff --git a/libtransmission/transmission.h b/libtransmission/transmission.h index 614f73729..4dee8cab9 100644 --- a/libtransmission/transmission.h +++ b/libtransmission/transmission.h @@ -1628,11 +1628,6 @@ typedef struct tr_stat @see tr_stat.leftUntilDone */ float percentDone; - /** The percentage of the actual ratio to the seed ratio. This will be - equal to 1 if the ratio is reached or the torrent is set to seed forever. - Range is [0..1] */ - float percentRatio; - /** Speed all data being sent for this torrent. (KiB/s) This includes piece data, protocol messages, and TCP overhead */ double rawUploadSpeed; diff --git a/macosx/Torrent.m b/macosx/Torrent.m index 7adf2f8f6..ed00e0262 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -343,7 +343,13 @@ int trashDataFile(const char * filename) - (CGFloat) progressStopRatio { - return fStat->percentRatio; + double seedRatio; + if (!tr_torrentGetSeedRatio(fHandle, seedRatio) || [self ratio] >= seedRatio || [self ratio] == TR_RATIO_INF) + return 1.0; + else if ([self ratio] == TR_RATIO_NA) + return 0.0; + else + return [self ratio] / seedRatio; } - (BOOL) usesSpeedLimit: (BOOL) upload -- 2.40.0