Use slice method where applicable

These code segments already have its boundary checked and can thus be faster.

PR #22411.
This commit is contained in:
Chocobo1 2025-03-15 14:58:59 +08:00 committed by GitHub
parent d174bc75e4
commit 5a4b3b25d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 113 additions and 63 deletions

View file

@ -89,8 +89,8 @@ namespace
if (idx < 0)
continue;
const QString name = cookie.left(idx).trimmed().toString();
const QString value = Utils::String::unquote(cookie.mid(idx + 1).trimmed()).toString();
const QString name = cookie.first(idx).trimmed().toString();
const QString value = Utils::String::unquote(cookie.sliced(idx + 1).trimmed()).toString();
ret.insert(name, value);
}
return ret;
@ -469,8 +469,8 @@ void WebApplication::configure()
continue;
}
const QString header = line.left(idx).trimmed().toString();
const QString value = line.mid(idx + 1).trimmed().toString();
const QString header = line.first(idx).trimmed().toString();
const QString value = line.sliced(idx + 1).trimmed().toString();
m_prebuiltHeaders.push_back({header, value});
}
}