1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-01-30 19:03:04 +00:00

fix: update Torrent::ratio() to match #2770 (#5193)

This commit is contained in:
Charles Kerr 2023-03-10 14:32:12 -06:00 committed by GitHub
parent 86fd89fff4
commit be77226d6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -300,10 +300,9 @@ public:
[[nodiscard]] constexpr auto ratio() const noexcept
{
auto const u = uploadedEver();
auto const d = downloadedEver();
auto const t = totalSize();
return double(u) / (d ? d : t);
auto const numerator = static_cast<double>(uploadedEver());
auto const denominator = sizeWhenDone();
return denominator > 0U ? numerator / denominator : double{};
}
[[nodiscard]] constexpr double percentComplete() const noexcept