From 84e15f662e7135e700ae9fa47cfbf59067c53d47 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 18 Jul 2022 08:45:00 +0200 Subject: [PATCH] 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 Reviewed-by: Thiago Macieira Reviewed-by: Edward Welbourne --- src/corelib/text/qbytearray.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp index bb517e3a53c..243ad4fdfa4 100644 --- a/src/corelib/text/qbytearray.cpp +++ b/src/corelib/text/qbytearray.cpp @@ -2625,7 +2625,7 @@ qsizetype QtPrivate::count(QByteArrayView haystack, QByteArrayView needle) noexc qsizetype QByteArray::count(char ch) const { - return static_cast(countCharHelper(*this, ch)); + return countCharHelper(*this, ch); } #if QT_DEPRECATED_SINCE(6, 4)