diff --git a/src/tools/iostool/iosdevicemanager.cpp b/src/tools/iostool/iosdevicemanager.cpp index 0f24d58868f..2e6aa4ccf36 100644 --- a/src/tools/iostool/iosdevicemanager.cpp +++ b/src/tools/iostool/iosdevicemanager.cpp @@ -560,7 +560,7 @@ void IosDeviceManagerPrivate::addDevice(AMDeviceRef device) m_pendingLookups.remove(devId); devices << m_pendingLookups.values(QString()); m_pendingLookups.remove(QString()); - foreach (PendingDeviceLookup *devLookup, devices) { + for (PendingDeviceLookup *devLookup : qAsConst(devices)) { if (debugAll) qDebug() << "found pending op"; devLookup->timer.stop(); devLookup->callback(devId, device, devLookup->userData); @@ -589,8 +589,10 @@ void IosDeviceManagerPrivate::removeDevice(AMDeviceRef device) void IosDeviceManagerPrivate::checkPendingLookups() { - foreach (const QString &deviceId, m_pendingLookups.keys()) { - foreach (PendingDeviceLookup *deviceLookup, m_pendingLookups.values(deviceId)) { + const QStringList keys = m_pendingLookups.keys(); + for (const QString &deviceId : keys) { + const QList values = m_pendingLookups.values(deviceId); + for (PendingDeviceLookup *deviceLookup : values) { if (!deviceLookup->timer.isActive()) { m_pendingLookups.remove(deviceId, deviceLookup); deviceLookup->callback(deviceId, 0, deviceLookup->userData); diff --git a/src/tools/iostool/mobiledevicelib.cpp b/src/tools/iostool/mobiledevicelib.cpp index 79c4054a0d4..025248262f1 100644 --- a/src/tools/iostool/mobiledevicelib.cpp +++ b/src/tools/iostool/mobiledevicelib.cpp @@ -44,7 +44,8 @@ MobileDeviceLib::MobileDeviceLib() if (!load()) addError(QLatin1String("Error loading MobileDevice.framework")); if (!errors().isEmpty()) { - foreach (const QString &msg, errors()) + const QStringList errs = errors(); + for (const QString &msg : errs) addError(msg); } setLogLevel(5); diff --git a/src/tools/iostool/relayserver.cpp b/src/tools/iostool/relayserver.cpp index 03181a10ac4..312b3bd66d4 100644 --- a/src/tools/iostool/relayserver.cpp +++ b/src/tools/iostool/relayserver.cpp @@ -284,8 +284,7 @@ bool RelayServer::startServer() void RelayServer::stopServer() { - foreach (Relayer *connection, m_connections) - delete connection; + qDeleteAll(m_connections); if (m_ipv4Server.isListening()) m_ipv4Server.close(); if (m_ipv6Server.isListening())