mirror of
https://github.com/transmission/transmission
synced 2024-12-24 08:43:27 +00:00
simplify code a tiny bit more
This commit is contained in:
parent
c08050a074
commit
841e7dbf64
1 changed files with 1 additions and 5 deletions
|
@ -1342,12 +1342,9 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
|
|||
}
|
||||
|
||||
//determine percentage finished and available
|
||||
int have, avail;
|
||||
int have = rintf((float)MAX_PIECES * [self progress]), avail;
|
||||
if ([self progress] >= 1.0 || ![self isActive] || [self totalPeers] <= 0)
|
||||
{
|
||||
have = rintf((float)MAX_PIECES * [self progress]);
|
||||
avail = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
float * piecesFinished = malloc(pieceCount * sizeof(float));
|
||||
|
@ -1358,7 +1355,6 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
|
|||
if (piecesAvailablity[i] > 0)
|
||||
available += 1.0 - piecesFinished[i];
|
||||
|
||||
have = rintf((float)MAX_PIECES * [self progress]);
|
||||
avail = rintf((float)MAX_PIECES * available / (float)pieceCount);
|
||||
if (have + avail > MAX_PIECES) //case if both end in .5 and all pieces are available
|
||||
avail--;
|
||||
|
|
Loading…
Reference in a new issue