iostool: Remove foreach / Q_FOREACH usage

Task-number: QTCREATORBUG-27464
Change-Id: I26decce7cc8748c9707fb5aae9566bab89e73e25
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Artem Sokolovskii
2022-05-30 12:09:11 +02:00
parent 2af3b41ad6
commit 675bff46da
3 changed files with 8 additions and 6 deletions

View File

@@ -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<PendingDeviceLookup *> values = m_pendingLookups.values(deviceId);
for (PendingDeviceLookup *deviceLookup : values) {
if (!deviceLookup->timer.isActive()) {
m_pendingLookups.remove(deviceId, deviceLookup);
deviceLookup->callback(deviceId, 0, deviceLookup->userData);

View File

@@ -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);

View File

@@ -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())