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.

Pick-to: 6.7
Task-number: QTBUG-122619
Change-Id: I9b726898b85e21d841b9af5b4dc72ee322829d50
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Edward Welbourne 2024-04-05 16:20:29 +02:00
parent b68f100918
commit 35205ef165
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;