mirror of
https://github.com/transmission/transmission
synced 2024-12-27 01:57:52 +00:00
fix: recent signed-unsigned comparison warnings (#4034)
This commit is contained in:
parent
ab825a4cea
commit
210bb03f2f
7 changed files with 13 additions and 15 deletions
|
@ -1307,7 +1307,7 @@ void DetailsDialog::Impl::refreshPeerList(std::vector<tr_torrent*> const& torren
|
|||
{
|
||||
auto const* tor = torrents.at(i);
|
||||
|
||||
for (int j = 0; j < peerCount[i]; ++j)
|
||||
for (size_t j = 0; j < peerCount[i]; ++j)
|
||||
{
|
||||
auto const* s = &peers.at(i)[j];
|
||||
auto const key = make_key(tor, s);
|
||||
|
|
|
@ -158,7 +158,7 @@ public:
|
|||
Gtk::TreeModelColumn<tr_torrent_activity> activity;
|
||||
Gtk::TreeModelColumn<bool> finished;
|
||||
Gtk::TreeModelColumn<tr_priority_t> priority;
|
||||
Gtk::TreeModelColumn<int> queue_position;
|
||||
Gtk::TreeModelColumn<size_t> queue_position;
|
||||
Gtk::TreeModelColumn<unsigned int> trackers;
|
||||
/* tr_stat.error
|
||||
* Tracked because ACTIVITY_FILTER_ERROR needs the row-changed events */
|
||||
|
|
|
@ -192,7 +192,7 @@ static void event_read_cb(evutil_socket_t fd, short /*event*/, void* vio)
|
|||
io->pendingEvents &= ~EV_READ;
|
||||
|
||||
auto const curlen = io->readBufferSize();
|
||||
unsigned int howmuch = static_cast<unsigned int>(curlen >= max ? 0 : max - curlen);
|
||||
auto howmuch = static_cast<unsigned int>(curlen >= max ? 0 : max - curlen);
|
||||
howmuch = io->bandwidth().clamp(TR_DOWN, howmuch);
|
||||
|
||||
tr_logAddTraceIo(io, "libevent says this peer is ready to read");
|
||||
|
|
|
@ -2332,7 +2332,7 @@ auto constexpr MaxUploadIdleSecs = time_t{ 60 * 5 };
|
|||
/* disconnect if it's been too long since piece data has been transferred.
|
||||
* this is on a sliding scale based on number of available peers... */
|
||||
{
|
||||
auto const relax_strictness_if_fewer_than_n = std::lround(getMaxPeerCount(tor) * 0.9);
|
||||
auto const relax_strictness_if_fewer_than_n = static_cast<size_t>(std::lround(getMaxPeerCount(tor) * 0.9));
|
||||
/* if we have >= relaxIfFewerThan, strictness is 100%.
|
||||
* if we have zero connections, strictness is 0% */
|
||||
float const strictness = peer_count >= relax_strictness_if_fewer_than_n ?
|
||||
|
|
|
@ -1063,12 +1063,11 @@ static char const* setFilePriorities(tr_torrent* tor, tr_priority_t priority, tr
|
|||
{
|
||||
for (size_t i = 0; i < n; ++i)
|
||||
{
|
||||
auto tmp = int64_t{};
|
||||
if (tr_variantGetInt(tr_variantListChild(list, i), &tmp))
|
||||
if (auto val = int64_t{}; tr_variantGetInt(tr_variantListChild(list, i), &val))
|
||||
{
|
||||
if (0 <= tmp && tmp < n_files)
|
||||
if (auto const file_index = static_cast<tr_file_index_t>(val); file_index < n_files)
|
||||
{
|
||||
files.push_back(tr_file_index_t(tmp));
|
||||
files.push_back(file_index);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1093,7 +1092,7 @@ static char const* setFileDLs(tr_torrent* tor, bool wanted, tr_variant* list)
|
|||
char const* errmsg = nullptr;
|
||||
|
||||
auto const n_files = tor->fileCount();
|
||||
size_t const n_items = tr_variantListSize(list);
|
||||
auto const n_items = tr_variantListSize(list);
|
||||
|
||||
auto files = std::vector<tr_file_index_t>{};
|
||||
files.reserve(n_files);
|
||||
|
@ -1102,12 +1101,11 @@ static char const* setFileDLs(tr_torrent* tor, bool wanted, tr_variant* list)
|
|||
{
|
||||
for (size_t i = 0; i < n_items; ++i)
|
||||
{
|
||||
auto file_index = int64_t{};
|
||||
if (tr_variantGetInt(tr_variantListChild(list, i), &file_index))
|
||||
if (auto val = int64_t{}; tr_variantGetInt(tr_variantListChild(list, i), &val))
|
||||
{
|
||||
if (0 <= file_index && file_index < n_files)
|
||||
if (auto const file_index = static_cast<tr_file_index_t>(val); file_index < n_files)
|
||||
{
|
||||
files.push_back(static_cast<tr_file_index_t>(file_index));
|
||||
files.push_back(file_index);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -2606,7 +2606,7 @@ size_t tr_session::countQueueFreeSlots(tr_direction dir) const noexcept
|
|||
auto const activity = dir == TR_UP ? TR_STATUS_SEED : TR_STATUS_DOWNLOAD;
|
||||
|
||||
/* count how many torrents are active */
|
||||
int active_count = 0;
|
||||
auto active_count = size_t{};
|
||||
bool const stalled_enabled = queueStalledEnabled();
|
||||
int const stalled_if_idle_for_n_seconds = queueStalledMinutes() * 60;
|
||||
time_t const now = tr_time();
|
||||
|
|
|
@ -1134,7 +1134,7 @@ tr_stat const* tr_torrentStat(tr_torrent* tor)
|
|||
auto seed_idle_minutes = uint16_t{};
|
||||
s->etaIdle = tor->etaSpeed_Bps < 1 && tr_torrentGetSeedIdle(tor, &seed_idle_minutes) ?
|
||||
seed_idle_minutes * 60 - s->idleSecs :
|
||||
TR_ETA_NOT_AVAIL;
|
||||
static_cast<time_t>(TR_ETA_NOT_AVAIL);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue