diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2020-12-09 10:39:18 -0800 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2020-12-12 12:17:19 -0800 |
commit | 08f1d6f3df4d85727e783e3393ef63694d357b83 (patch) | |
tree | 1da27f3007c332886421a92f27eb031b7e2739d8 /src/corelib | |
parent | 4974091699795435c4863ce57e6513312ddb1f1d (diff) |
QUrl: update parseIp6 to use QStringView, as the comment requested
Change-Id: I55083c2909f64a1f8868fffd164f2058f226fa61
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/io/qurl.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index ba16be7424..67f549036c 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -1239,20 +1239,18 @@ static const QChar *parseIpFuture(QString &host, const QChar *begin, const QChar // ONLY the IPv6 address is parsed here, WITHOUT the brackets static const QChar *parseIp6(QString &host, const QChar *begin, const QChar *end, QUrl::ParsingMode mode) { - // ### Update to use QStringView once QStringView::indexOf and QStringView::lastIndexOf exists - QString decoded; + QStringView decoded(begin, end); + QString decodedBuffer; if (mode == QUrl::TolerantMode) { // this struct is kept in automatic storage because it's only 4 bytes const ushort decodeColon[] = { decode(':'), 0 }; - if (qt_urlRecode(decoded, QStringView{begin, end}, QUrl::ComponentFormattingOption::PrettyDecoded, decodeColon) == 0) - decoded = QString(begin, end-begin); - } else { - decoded = QString(begin, end-begin); + if (qt_urlRecode(decodedBuffer, decoded, QUrl::ComponentFormattingOption::PrettyDecoded, decodeColon)) + decoded = decodedBuffer; } - const QLatin1String zoneIdIdentifier("%25"); + const QStringView zoneIdIdentifier(u"%25"); QIPAddressUtils::IPv6Address address; - QString zoneId; + QStringView zoneId; const QChar *endBeforeZoneId = decoded.constEnd(); |