mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-06 23:52:31 -06:00
Make use of std algorithms
This commit is contained in:
@@ -3460,18 +3460,18 @@ void Session::handleTorrentTrackerWarning(TorrentHandle *const torrent, const QS
|
||||
|
||||
bool Session::hasPerTorrentRatioLimit() const
|
||||
{
|
||||
for (TorrentHandle *const torrent : asConst(m_torrents))
|
||||
if (torrent->ratioLimit() >= 0) return true;
|
||||
|
||||
return false;
|
||||
return std::any_of(m_torrents.cbegin(), m_torrents.cend(), [](const TorrentHandle *torrent)
|
||||
{
|
||||
return (torrent->ratioLimit() >= 0);
|
||||
});
|
||||
}
|
||||
|
||||
bool Session::hasPerTorrentSeedingTimeLimit() const
|
||||
{
|
||||
for (TorrentHandle *const torrent : asConst(m_torrents))
|
||||
if (torrent->seedingTimeLimit() >= 0) return true;
|
||||
|
||||
return false;
|
||||
return std::any_of(m_torrents.cbegin(), m_torrents.cend(), [](const TorrentHandle *torrent)
|
||||
{
|
||||
return (torrent->seedingTimeLimit() >= 0);
|
||||
});
|
||||
}
|
||||
|
||||
void Session::initResumeFolder()
|
||||
|
||||
@@ -841,11 +841,10 @@ bool TorrentHandle::hasError() const
|
||||
bool TorrentHandle::hasFilteredPieces() const
|
||||
{
|
||||
const std::vector<int> pp = m_nativeHandle.piece_priorities();
|
||||
|
||||
for (const int priority : pp)
|
||||
if (priority == 0) return true;
|
||||
|
||||
return false;
|
||||
return std::any_of(pp.cbegin(), pp.cend(), [](const int priority)
|
||||
{
|
||||
return (priority == 0);
|
||||
});
|
||||
}
|
||||
|
||||
int TorrentHandle::queuePosition() const
|
||||
|
||||
Reference in New Issue
Block a user