QUrlIdna: port qt_is_idn_enabed() to QStringView

Change-Id: I3cd8a1da47f660f79760bbde88560693ab505823
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Marc Mutz 2020-04-23 17:09:49 +02:00
parent 70ad404203
commit 26a38db8a2

View File

@ -2434,14 +2434,14 @@ static bool equal(const QChar *a, int l, const char *b)
return l == 0;
}
static bool qt_is_idn_enabled(const QString &domain)
static bool qt_is_idn_enabled(QStringView domain)
{
int idx = domain.lastIndexOf(QLatin1Char('.'));
const auto idx = domain.lastIndexOf(QLatin1Char('.'));
if (idx == -1)
return false;
int len = domain.size() - idx - 1;
QString tldString = qt_ACE_do(QString::fromRawData(domain.constData() + idx + 1, len), ToAceOnly, ForbidLeadingDot);
QString tldString = qt_ACE_do(QString::fromRawData(domain.data() + idx + 1, len), ToAceOnly, ForbidLeadingDot);
len = tldString.size();
const QChar *tld = tldString.constData();