From 08845d3531319e4a537f31f7ef13233c8d1222be Mon Sep 17 00:00:00 2001 From: Martin Petersson Date: Thu, 22 Dec 2011 10:53:19 +0100 Subject: [PATCH] QNetworkAccessManager: fixed foreach copy of host address Change-Id: I50cb113fb3c803fc5b13c74b3f7ad1fc4283065b Reviewed-by: Peter Hartmann --- src/network/access/qhttpnetworkconnection.cpp | 2 +- src/network/socket/qabstractsocket.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index b4004eae14..90cde6654f 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -976,7 +976,7 @@ void QHttpNetworkConnectionPrivate::_q_hostLookupFinished(QHostInfo info) bool bIpv6 = false; bool foundAddress = false; - foreach (QHostAddress address, info.addresses()) { + foreach (const QHostAddress &address, info.addresses()) { if (address.protocol() == QAbstractSocket::IPv4Protocol) { if (!foundAddress) { foundAddress = true; diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 91f10a0127..f84153a7bd 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -952,7 +952,7 @@ void QAbstractSocketPrivate::_q_startConnecting(const QHostInfo &hostInfo) if (preferredNetworkLayerProtocol == QAbstractSocket::UnknownNetworkLayerProtocol || preferredNetworkLayerProtocol == QAbstractSocket::AnyIPProtocol) { addresses = hostInfo.addresses(); } else { - foreach (QHostAddress address, hostInfo.addresses()) + foreach (const QHostAddress &address, hostInfo.addresses()) if (address.protocol() == preferredNetworkLayerProtocol) addresses += address; }