Browse Source

Convert to range-based for loop

adaptive-webui-19844
thalieht 6 years ago
parent
commit
947c7e1d64
  1. 3
      src/gui/properties/trackerlistwidget.cpp
  2. 10
      src/webui/webapplication.cpp

3
src/gui/properties/trackerlistwidget.cpp

@ -466,8 +466,7 @@ void TrackerListWidget::editSelectedTracker()
QList<BitTorrent::TrackerEntry> trackers = torrent->trackers(); QList<BitTorrent::TrackerEntry> trackers = torrent->trackers();
bool match = false; bool match = false;
for (int i = 0; i < trackers.size(); ++i) { for (auto &entry : trackers) {
BitTorrent::TrackerEntry &entry = trackers[i];
if (newTrackerURL == QUrl(entry.url())) { if (newTrackerURL == QUrl(entry.url())) {
QMessageBox::warning(this, tr("Tracker editing failed"), tr("The tracker URL already exists.")); QMessageBox::warning(this, tr("Tracker editing failed"), tr("The tracker URL already exists."));
return; return;

10
src/webui/webapplication.cpp

@ -509,13 +509,9 @@ QString WebApplication::generateSid() const
QString sid; QString sid;
do { do {
const size_t size = 6; const quint32 tmp[] = {Utils::Random::rand(), Utils::Random::rand(), Utils::Random::rand()
quint32 tmp[size]; , Utils::Random::rand(), Utils::Random::rand(), Utils::Random::rand()};
sid = QByteArray::fromRawData(reinterpret_cast<const char *>(tmp), sizeof(tmp)).toBase64();
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();
} }
while (m_sessions.contains(sid)); while (m_sessions.contains(sid));

Loading…
Cancel
Save