qurlidna: port some internal functions to QSV

Change-Id: If9c0090589cd58738165f2fe71701dba6958575c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Anton Kudryavtsev 2023-10-31 11:21:44 +03:00
parent d0b90663a4
commit ec8e3e535d

View File

@ -777,7 +777,7 @@ bool DomainValidityChecker::checkLabel(const QString &label, QUrl::AceProcessing
return true;
}
static QString convertToAscii(const QString &normalizedDomain, AceLeadingDot dot)
static QString convertToAscii(QStringView normalizedDomain, AceLeadingDot dot)
{
qsizetype lastIdx = 0;
QString aceForm; // this variable is here for caching
@ -795,7 +795,7 @@ static QString convertToAscii(const QString &normalizedDomain, AceLeadingDot dot
if (dot == ForbidLeadingDot || idx > 0)
return {}; // two delimiters in a row -- empty label not allowed
} else {
const auto label = QStringView(normalizedDomain).sliced(lastIdx, labelLength);
const auto label = normalizedDomain.sliced(lastIdx, labelLength);
aceForm.clear();
qt_punycodeEncoder(label, &aceForm);
if (aceForm.isEmpty())
@ -814,7 +814,7 @@ static QString convertToAscii(const QString &normalizedDomain, AceLeadingDot dot
return aceResult;
}
static bool checkAsciiDomainName(const QString &normalizedDomain, AceLeadingDot dot,
static bool checkAsciiDomainName(QStringView normalizedDomain, AceLeadingDot dot,
bool *usesPunycode)
{
qsizetype lastIdx = 0;
@ -833,7 +833,7 @@ static bool checkAsciiDomainName(const QString &normalizedDomain, AceLeadingDot
if (dot == ForbidLeadingDot || idx > 0)
return false; // two delimiters in a row -- empty label not allowed
} else {
const auto label = QStringView(normalizedDomain).sliced(lastIdx, labelLength);
const auto label = normalizedDomain.sliced(lastIdx, labelLength);
if (!validateAsciiLabel(label))
return false;