diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-05-25 13:12:51 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-06-10 09:09:36 +0200 |
commit | 122d66f69fa44e11202fccdab076fe1ec368f971 (patch) | |
tree | 07d6c3bca6a3be5f246fef74c9efd61e2fe18d8e /src/network/ssl | |
parent | 4ab3089a2cbcc3b0656a36e9c22ca2d72e150c7e (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/ssl')
-rw-r--r-- | src/network/ssl/qsslsocket.cpp | 6 | ||||
-rw-r--r-- | src/network/ssl/qsslsocket_mac.cpp | 2 | ||||
-rw-r--r-- | src/network/ssl/qsslsocket_openssl.cpp | 2 | ||||
-rw-r--r-- | src/network/ssl/qsslsocket_openssl_symbols.cpp | 8 |
4 files changed, 9 insertions, 9 deletions
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 64e556ac3c..e4627eba68 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -3083,13 +3083,13 @@ bool QSslSocketPrivate::isMatchingHostname(const QString &cn, const QString &hos return false; // Check characters preceding * (if any) match - if (wildcard && hostname.leftRef(wildcard).compare(cn.leftRef(wildcard), Qt::CaseInsensitive) != 0) + if (wildcard && QStringView{hostname}.left(wildcard).compare(QStringView{cn}.left(wildcard), Qt::CaseInsensitive) != 0) return false; // Check characters following first . match int hnDot = hostname.indexOf(QLatin1Char('.')); - if (hostname.midRef(hnDot + 1) != cn.midRef(firstCnDot + 1) - && hostname.midRef(hnDot + 1) != QLatin1String(QUrl::toAce(cn.mid(firstCnDot + 1)))) { + if (QStringView{hostname}.mid(hnDot + 1) != QStringView{cn}.mid(firstCnDot + 1) + && QStringView{hostname}.mid(hnDot + 1) != QLatin1String(QUrl::toAce(cn.mid(firstCnDot + 1)))) { return false; } diff --git a/src/network/ssl/qsslsocket_mac.cpp b/src/network/ssl/qsslsocket_mac.cpp index 1ae32b0330..cc822c182c 100644 --- a/src/network/ssl/qsslsocket_mac.cpp +++ b/src/network/ssl/qsslsocket_mac.cpp @@ -804,7 +804,7 @@ QSslCipher QSslSocketBackendPrivate::QSslCipher_from_SSLCipherSuite(SSLCipherSui ciph.d->protocol = QSsl::TlsV1_2; ciph.d->protocolString = QLatin1String("TLSv1.2"); - const auto bits = ciph.d->name.splitRef(QLatin1Char('-')); + const auto bits = QStringView{ciph.d->name}.split(QLatin1Char('-')); if (bits.size() >= 2) { if (bits.size() == 2 || bits.size() == 3) { ciph.d->keyExchangeMethod = QLatin1String("RSA"); diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 9d95a58118..ea59063e72 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -424,7 +424,7 @@ QSslCipher QSslSocketBackendPrivate::QSslCipher_from_SSL_CIPHER(const SSL_CIPHER char buf [256]; QString descriptionOneLine = QString::fromLatin1(q_SSL_CIPHER_description(cipher, buf, sizeof(buf))); - const auto descriptionList = descriptionOneLine.splitRef(QLatin1Char(' '), Qt::SkipEmptyParts); + const auto descriptionList = QStringView{descriptionOneLine}.split(QLatin1Char(' '), Qt::SkipEmptyParts); if (descriptionList.size() > 5) { // ### crude code. ciph.d->isNull = false; diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index 1756333371..c74a65ab37 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -532,7 +532,7 @@ bool q_resolveOpenSslSymbols() struct NumericallyLess { typedef bool result_type; - result_type operator()(const QStringRef &lhs, const QStringRef &rhs) const + result_type operator()(QStringView lhs, QStringView rhs) const { bool ok = false; int b = 0; @@ -552,10 +552,10 @@ struct NumericallyLess struct LibGreaterThan { typedef bool result_type; - result_type operator()(const QString &lhs, const QString &rhs) const + result_type operator()(QStringView lhs, QStringView rhs) const { - const QVector<QStringRef> lhsparts = lhs.splitRef(QLatin1Char('.')); - const QVector<QStringRef> rhsparts = rhs.splitRef(QLatin1Char('.')); + const QVector<QStringView> lhsparts = lhs.split(QLatin1Char('.')); + const QVector<QStringView> rhsparts = rhs.split(QLatin1Char('.')); Q_ASSERT(lhsparts.count() > 1 && rhsparts.count() > 1); // note: checking rhs < lhs, the same as lhs > rhs |