From 365554d064701a6aabac3de8dad29b15140e5355 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Tue, 29 Jun 2021 14:57:29 +0800 Subject: [PATCH] Use proper signed number type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This also suppress the compiler warning: src/base/bittorrent/torrentimpl.cpp:228:36: warning: comparison of integer expressions of different signedness: ‘int’ and ‘const size_t’ {aka ‘const long unsigned int’} [-Wsign-compare] --- src/base/bittorrent/torrentimpl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/base/bittorrent/torrentimpl.cpp b/src/base/bittorrent/torrentimpl.cpp index dca4ce8cc..02c8b1d27 100644 --- a/src/base/bittorrent/torrentimpl.cpp +++ b/src/base/bittorrent/torrentimpl.cpp @@ -112,7 +112,7 @@ namespace QString firstTrackerMessage; QString firstErrorMessage; #if (LIBTORRENT_VERSION_NUM >= 20000) - const size_t numEndpoints = nativeEntry.endpoints.size() * ((hashes.has_v1() && hashes.has_v2()) ? 2 : 1); + const auto numEndpoints = static_cast(nativeEntry.endpoints.size() * ((hashes.has_v1() && hashes.has_v2()) ? 2 : 1)); trackerEntry.endpoints.reserve(static_cast(numEndpoints)); for (const lt::announce_endpoint &endpoint : nativeEntry.endpoints) { @@ -167,8 +167,8 @@ namespace } } #else - const int numEndpoints = nativeEntry.endpoints.size(); - trackerEntry.endpoints.reserve(numEndpoints); + const auto numEndpoints = static_cast(nativeEntry.endpoints.size()); + trackerEntry.endpoints.reserve(static_cast(numEndpoints)); for (const lt::announce_endpoint &endpoint : nativeEntry.endpoints) { TrackerEntry::EndpointStats trackerEndpoint;