mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-12 05:44:14 +03:00
Convert to range-based for loop
This commit is contained in:
parent
8a3f942385
commit
947c7e1d64
2 changed files with 4 additions and 9 deletions
|
@ -466,8 +466,7 @@ void TrackerListWidget::editSelectedTracker()
|
|||
|
||||
QList<BitTorrent::TrackerEntry> trackers = torrent->trackers();
|
||||
bool match = false;
|
||||
for (int i = 0; i < trackers.size(); ++i) {
|
||||
BitTorrent::TrackerEntry &entry = trackers[i];
|
||||
for (auto &entry : trackers) {
|
||||
if (newTrackerURL == QUrl(entry.url())) {
|
||||
QMessageBox::warning(this, tr("Tracker editing failed"), tr("The tracker URL already exists."));
|
||||
return;
|
||||
|
|
|
@ -509,13 +509,9 @@ QString WebApplication::generateSid() const
|
|||
QString sid;
|
||||
|
||||
do {
|
||||
const size_t size = 6;
|
||||
quint32 tmp[size];
|
||||
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
tmp[i] = Utils::Random::rand();
|
||||
|
||||
sid = QByteArray::fromRawData(reinterpret_cast<const char *>(tmp), sizeof(quint32) * size).toBase64();
|
||||
const quint32 tmp[] = {Utils::Random::rand(), Utils::Random::rand(), Utils::Random::rand()
|
||||
, Utils::Random::rand(), Utils::Random::rand(), Utils::Random::rand()};
|
||||
sid = QByteArray::fromRawData(reinterpret_cast<const char *>(tmp), sizeof(tmp)).toBase64();
|
||||
}
|
||||
while (m_sessions.contains(sid));
|
||||
|
||||
|
|
Loading…
Reference in a new issue