From 1978bfa69a3210de285843c1e977f1068e94ca42 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 23 Apr 2020 18:05:49 +0200 Subject: [PATCH] QUrlIdna: simplify a loop using QStringView::mid() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I0f33a29b3104ceac4c5dfb9db2bfdcd896bb95d1 Reviewed-by: Lars Knoll Reviewed-by: MÃ¥rten Nordheim --- src/corelib/io/qurlidna.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/corelib/io/qurlidna.cpp b/src/corelib/io/qurlidna.cpp index 4aa16aaa71..f5ba691d72 100644 --- a/src/corelib/io/qurlidna.cpp +++ b/src/corelib/io/qurlidna.cpp @@ -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; } }