QNetworkAccessManager: fixed foreach copy of host address

Change-Id: I50cb113fb3c803fc5b13c74b3f7ad1fc4283065b
Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
This commit is contained in:
Martin Petersson 2011-12-22 10:53:19 +01:00 committed by Qt by Nokia
parent 755fe9da1d
commit 08845d3531
2 changed files with 2 additions and 2 deletions

View File

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

View File

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