QUrl: optimize fromAce()

Change-Id: I255b8c806e1386f654c372e8a327ca7aef1b610a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2020-04-23 18:04:50 +02:00
parent 84aad0ab7b
commit 8fea227f30

View File

@ -422,6 +422,9 @@
QT_BEGIN_NAMESPACE
// in qstring.cpp:
void qt_from_latin1(ushort *dst, const char *str, size_t size) noexcept;
inline static bool isHex(char c)
{
c |= 0x20;
@ -3509,7 +3512,11 @@ QString QUrl::fromEncodedComponent_helper(const QByteArray &ba)
*/
QString QUrl::fromAce(const QByteArray &domain)
{
return qt_ACE_do(QString::fromLatin1(domain), NormalizeAce, ForbidLeadingDot /*FIXME: make configurable*/);
QVarLengthArray<ushort> buffer;
buffer.resize(domain.size());
qt_from_latin1(buffer.data(), domain.data(), domain.size());
return qt_ACE_do(QStringView{buffer.data(), buffer.size()},
NormalizeAce, ForbidLeadingDot /*FIXME: make configurable*/);
}
/*!