Initialize QTextBoundaryFinder::pos to zero

One constructor neglected to do so. Use NSDMI to make sure all
constructors do, if they don't override this with something else. Also
remove fatuous setting, by constructors, of member attributes to its
default.

Task-number: QTBUG-122619
Change-Id: I9b726898b85e21d841b9af5b4dc72ee322829d50
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 35205ef1654f2ee0aca80010acdbb469cf1cf8e7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Edward Welbourne 2024-04-05 16:20:29 +02:00 committed by Qt Cherry-pick Bot
parent 644eca89ed
commit db7b707d81
2 changed files with 1 additions and 5 deletions

View File

@ -173,9 +173,7 @@ QTextBoundaryFinder::QTextBoundaryFinder(BoundaryType type, const QString &strin
: t(type)
, s(string)
, sv(s)
, pos(0)
, freeBuffer(true)
, attributes(nullptr)
{
if (sv.size() > 0) {
attributes = (QCharAttributes *) malloc((sv.size() + 1) * sizeof(QCharAttributes));
@ -208,9 +206,7 @@ QTextBoundaryFinder::QTextBoundaryFinder(BoundaryType type, const QString &strin
QTextBoundaryFinder::QTextBoundaryFinder(BoundaryType type, QStringView string, unsigned char *buffer, qsizetype bufferSize)
: t(type)
, sv(string)
, pos(0)
, freeBuffer(true)
, attributes(nullptr)
{
if (!sv.isEmpty()) {
if (buffer && bufferSize / int(sizeof(QCharAttributes)) >= sv.size() + 1) {

View File

@ -63,7 +63,7 @@ private:
BoundaryType t = Grapheme;
QString s;
QStringView sv;
qsizetype pos;
qsizetype pos = 0;
uint freeBuffer : 1;
uint unused : 31;
QCharAttributes *attributes = nullptr;