QUrlIdna: replace manual pointer handling with std::begin()/end()

This is more readable, because it follows usual iterator patterns.

Change-Id: I56900286ddbca57a86aa499020f175e8add17fd9
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
bb10
Marc Mutz 2020-05-12 10:11:09 +02:00
parent a504f63f2e
commit 1f7eb3332e
1 changed files with 4 additions and 6 deletions

View File

@ -1442,8 +1442,6 @@ static const NameprepCaseFoldingEntry NameprepCaseFolding[] = {
static void mapToLowerCase(QString *str, int from)
{
int N = sizeof(NameprepCaseFolding) / sizeof(NameprepCaseFolding[0]);
ushort *d = nullptr;
for (int i = from; i < str->size(); ++i) {
uint uc = str->at(i).unicode();
@ -1461,10 +1459,10 @@ static void mapToLowerCase(QString *str, int from)
++i;
}
}
const NameprepCaseFoldingEntry *entry = std::lower_bound(NameprepCaseFolding,
NameprepCaseFolding + N,
uc);
if ((entry != NameprepCaseFolding + N) && !(uc < *entry)) {
const auto entry = std::lower_bound(std::begin(NameprepCaseFolding),
std::end(NameprepCaseFolding),
uc);
if ((entry != std::end(NameprepCaseFolding)) && !(uc < *entry)) {
int l = 1;
while (l < 4 && entry->mapping[l])
++l;