QUrlIdna: simplify a loop using QStringView::mid()

Change-Id: I0f33a29b3104ceac4c5dfb9db2bfdcd896bb95d1
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
bb10
Marc Mutz 2020-04-23 18:05:49 +02:00
parent 636a6aece0
commit 1978bfa69a
1 changed files with 4 additions and 6 deletions

View File

@ -2525,16 +2525,14 @@ QString qt_ACE_do(QStringView domain, AceOperation op, AceLeadingDot dot)
result.resize(prevLen + labelLength);
{
QChar *out = result.data() + prevLen;
const QChar *in = domain.data() + lastIdx;
const QChar *e = in + labelLength;
for (; in < e; ++in, ++out) {
ushort uc = in->unicode();
for (QChar c : domain.mid(lastIdx, labelLength)) {
const auto uc = c.unicode();
if (uc > 0x7f)
simple = false;
if (uc >= 'A' && uc <= 'Z')
*out = QChar(uc | 0x20);
*out++ = QChar(uc | 0x20);
else
*out = *in;
*out++ = c;
}
}