mirror of https://github.com/qt/qtgrpc.git
Use case insensitive QByteArray::compare where applicable
Case insensitive 'QByteArray::compare' should be faster than 'QByteArray::toLower' + 'QByteArray::operator =='. Pick-to: 6.8 6.9 Task-number: QTBUG-128812 Change-Id: I718ff0bbbcc0f0ebaccd0998227bfbc4c6cd69fe Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
6e32b408a3
commit
e34d99af32
|
@ -209,13 +209,13 @@ T deserialize(const QJsonValue &value, bool &ok)
|
|||
{
|
||||
ok = true;
|
||||
QByteArray data = value.toVariant().toByteArray();
|
||||
if (data.toLower() == NegInfinityLower)
|
||||
if (data.compare(NegInfinityLower, Qt::CaseInsensitive) == 0)
|
||||
return -std::numeric_limits<T>::infinity();
|
||||
|
||||
if (data.toLower() == InfinityLower)
|
||||
if (data.compare(InfinityLower, Qt::CaseInsensitive) == 0)
|
||||
return std::numeric_limits<T>::infinity();
|
||||
|
||||
if (data.toLower() == NaNLower)
|
||||
if (data.compare(NaNLower, Qt::CaseInsensitive) == 0)
|
||||
return T(NAN);
|
||||
|
||||
if constexpr (std::is_same_v<T, float>)
|
||||
|
|
Loading…
Reference in New Issue