summaryrefslogtreecommitdiffstats
path: root/src/network/kernel/qhostaddress.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-05-25 13:12:51 +0200
committerLars Knoll <lars.knoll@qt.io>2020-06-10 09:09:36 +0200
commit122d66f69fa44e11202fccdab076fe1ec368f971 (patch)
tree07d6c3bca6a3be5f246fef74c9efd61e2fe18d8e /src/network/kernel/qhostaddress.cpp
parent4ab3089a2cbcc3b0656a36e9c22ca2d72e150c7e (diff)
Port QtNetwork from QStringRef to QStringView
Task-number: QTBUG-84319 Change-Id: I0f4e83c282b58ab4cc5e397b21981978f79d92cf Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/network/kernel/qhostaddress.cpp')
-rw-r--r--src/network/kernel/qhostaddress.cpp8
1 files changed, 4 insertions, 4 deletions
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, int> 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, int> 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
}