From 122d66f69fa44e11202fccdab076fe1ec368f971 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 25 May 2020 13:12:51 +0200 Subject: Port QtNetwork from QStringRef to QStringView MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-84319 Change-Id: I0f4e83c282b58ab4cc5e397b21981978f79d92cf Reviewed-by: Alex Blasche Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Timur Pocheptsov --- src/network/kernel/qhostaddress.cpp | 8 ++++---- src/network/kernel/qnetworkproxy_win.cpp | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/network/kernel') diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp index 0783c0751f..c318766796 100644 --- a/src/network/kernel/qhostaddress.cpp +++ b/src/network/kernel/qhostaddress.cpp @@ -136,7 +136,7 @@ void QHostAddressPrivate::setAddress(const Q_IPV6ADDR &a_) static bool parseIp6(const QString &address, QIPAddressUtils::IPv6Address &addr, QString *scopeId) { - QStringRef tmp(&address); + QStringView tmp(address); int scopeIdPos = tmp.lastIndexOf(QLatin1Char('%')); if (scopeIdPos != -1) { *scopeId = tmp.mid(scopeIdPos + 1).toString(); @@ -144,7 +144,7 @@ static bool parseIp6(const QString &address, QIPAddressUtils::IPv6Address &addr, } else { scopeId->clear(); } - return QIPAddressUtils::parseIp6(addr, tmp.constBegin(), tmp.constEnd()) == nullptr; + return QIPAddressUtils::parseIp6(addr, tmp.begin(), tmp.end()) == nullptr; } bool QHostAddressPrivate::parse(const QString &ipString) @@ -1103,7 +1103,7 @@ QPair QHostAddress::parseSubnet(const QString &subnet) return invalid; int slash = subnet.indexOf(QLatin1Char('/')); - QStringRef netStr(&subnet); + QStringView netStr(subnet); if (slash != -1) netStr.truncate(slash); @@ -1123,7 +1123,7 @@ QPair QHostAddress::parseSubnet(const QString &subnet) netmask = parser.prefixLength(); } else { bool ok; - netmask = subnet.midRef(slash + 1).toUInt(&ok); + netmask = QStringView{subnet}.mid(slash + 1).toUInt(&ok); if (!ok) return invalid; // failed to parse the subnet } diff --git a/src/network/kernel/qnetworkproxy_win.cpp b/src/network/kernel/qnetworkproxy_win.cpp index c4dc33f66f..713db7d5b9 100644 --- a/src/network/kernel/qnetworkproxy_win.cpp +++ b/src/network/kernel/qnetworkproxy_win.cpp @@ -298,15 +298,15 @@ static QList parseServerList(const QNetworkProxyQuery &query, con quint16 port = 8080; int pos = entry.indexOf(QLatin1Char('=')); - QStringRef scheme; - QStringRef protocolTag; + QStringView scheme; + QStringView protocolTag; if (pos != -1) { - scheme = protocolTag = entry.leftRef(pos); + scheme = protocolTag = QStringView{entry}.left(pos); server = pos + 1; } pos = entry.indexOf(QLatin1String("://"), server); if (pos != -1) { - scheme = entry.midRef(server, pos - server); + scheme = QStringView{entry}.mid(server, pos - server); server = pos + 3; } @@ -329,7 +329,7 @@ static QList parseServerList(const QNetworkProxyQuery &query, con pos = entry.indexOf(QLatin1Char(':'), server); if (pos != -1) { bool ok; - uint value = entry.midRef(pos + 1).toUInt(&ok); + uint value = QStringView{entry}.mid(pos + 1).toUInt(&ok); if (!ok || value > 65535) continue; // invalid port number -- cgit v1.2.3