QByteArray: fix count(ch) for more than 2Gi occurrences

We truncated the qsizetype result of countCharHelper() to int.

Fix by removing the int cast.

Fixes: QTBUG-105027
Pick-to: 6.4 6.3 6.2
Change-Id: I5ef35a6f36b0957d31036f70b5286db034e89a28
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Marc Mutz 2022-07-18 08:45:00 +02:00
parent ccb2e4dbb1
commit 84e15f662e

View File

@ -2625,7 +2625,7 @@ qsizetype QtPrivate::count(QByteArrayView haystack, QByteArrayView needle) noexc
qsizetype QByteArray::count(char ch) const qsizetype QByteArray::count(char ch) const
{ {
return static_cast<int>(countCharHelper(*this, ch)); return countCharHelper(*this, ch);
} }
#if QT_DEPRECATED_SINCE(6, 4) #if QT_DEPRECATED_SINCE(6, 4)