From: Claudio Cambra Date: Mon, 15 May 2023 12:05:30 +0000 (+0800) Subject: Modernise BandwidthManager::absoluteLimitTimerExpired X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~10^2~51^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=49bb5a005c1411bc118ed5dd949b85ebe1c29c96;p=nextcloud-desktop.git Modernise BandwidthManager::absoluteLimitTimerExpired Signed-off-by: Claudio Cambra --- diff --git a/src/libsync/bandwidthmanager.cpp b/src/libsync/bandwidthmanager.cpp index a313fe5e0..f5fc3582b 100644 --- a/src/libsync/bandwidthmanager.cpp +++ b/src/libsync/bandwidthmanager.cpp @@ -389,19 +389,24 @@ void BandwidthManager::switchingTimerExpired() void BandwidthManager::absoluteLimitTimerExpired() { if (usingAbsoluteUploadLimit() && !_absoluteUploadDeviceList.empty()) { - qint64 quotaPerDevice = _currentUploadLimit / qMax((std::list::size_type)1, _absoluteUploadDeviceList.size()); + const auto quotaPerDevice = _currentUploadLimit / qMax((std::list::size_type)1, _absoluteUploadDeviceList.size()); + qCDebug(lcBandwidthManager) << quotaPerDevice << _absoluteUploadDeviceList.size() << _currentUploadLimit; - Q_FOREACH (UploadDevice *device, _absoluteUploadDeviceList) { + + for (const auto device : _absoluteUploadDeviceList) { device->giveBandwidthQuota(quotaPerDevice); qCDebug(lcBandwidthManager) << "Gave " << quotaPerDevice / 1024.0 << " kB to" << device; } } + if (usingAbsoluteDownloadLimit() && !_downloadJobList.empty()) { - qint64 quotaPerJob = _currentDownloadLimit / qMax((std::list::size_type)1, _downloadJobList.size()); + const auto quotaPerJob = _currentDownloadLimit / qMax((std::list::size_type)1, _downloadJobList.size()); + qCDebug(lcBandwidthManager) << quotaPerJob << _downloadJobList.size() << _currentDownloadLimit; - Q_FOREACH (GETFileJob *j, _downloadJobList) { - j->giveBandwidthQuota(quotaPerJob); - qCDebug(lcBandwidthManager) << "Gave " << quotaPerJob / 1024.0 << " kB to" << j; + + for (const auto job : _downloadJobList) { + job->giveBandwidthQuota(quotaPerJob); + qCDebug(lcBandwidthManager) << "Gave " << quotaPerJob / 1024.0 << " kB to" << job; } } }