summaryrefslogtreecommitdiffstats
path: root/src/network/kernel
diff options
context:
space:
mode:
authorMårten Nordheim <marten.nordheim@qt.io>2017-10-23 15:18:01 +0200
committerMårten Nordheim <marten.nordheim@qt.io>2017-10-26 12:03:30 +0000
commitea284937eaf27709e7a10a0a7b43e0bc91d4aa36 (patch)
tree0a036d71b46c6a5fb164880902d53776c84ca4de /src/network/kernel
parent760e80feb2425ae08d6c67671c9922119e57cf83 (diff)
QNetworkInterface: Use ranged-for in postProcess
Use ranged-for loops instead of a normal for-loop with iterators. Change-Id: I13ba2001b7eb0fff1a0d9474f615a81d02af62f0 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/network/kernel')
-rw-r--r--src/network/kernel/qnetworkinterface.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/network/kernel/qnetworkinterface.cpp b/src/network/kernel/qnetworkinterface.cpp
index 47e0956302..2b83dc2a74 100644
--- a/src/network/kernel/qnetworkinterface.cpp
+++ b/src/network/kernel/qnetworkinterface.cpp
@@ -59,19 +59,15 @@ static QList<QNetworkInterfacePrivate *> postProcess(QList<QNetworkInterfacePriv
// The math is:
// broadcast = IP | ~netmask
- QList<QNetworkInterfacePrivate *>::Iterator it = list.begin();
- const QList<QNetworkInterfacePrivate *>::Iterator end = list.end();
- for ( ; it != end; ++it) {
- QList<QNetworkAddressEntry>::Iterator addr_it = (*it)->addressEntries.begin();
- const QList<QNetworkAddressEntry>::Iterator addr_end = (*it)->addressEntries.end();
- for ( ; addr_it != addr_end; ++addr_it) {
- if (addr_it->ip().protocol() != QAbstractSocket::IPv4Protocol)
+ for (QNetworkInterfacePrivate *interface : list) {
+ for (QNetworkAddressEntry &address : interface->addressEntries) {
+ if (address.ip().protocol() != QAbstractSocket::IPv4Protocol)
continue;
- if (!addr_it->netmask().isNull() && addr_it->broadcast().isNull()) {
- QHostAddress bcast = addr_it->ip();
- bcast = QHostAddress(bcast.toIPv4Address() | ~addr_it->netmask().toIPv4Address());
- addr_it->setBroadcast(bcast);
+ if (!address.netmask().isNull() && address.broadcast().isNull()) {
+ QHostAddress bcast = address.ip();
+ bcast = QHostAddress(bcast.toIPv4Address() | ~address.netmask().toIPv4Address());
+ address.setBroadcast(bcast);
}
}
}