summaryrefslogtreecommitdiffstats
path: root/src/corelib/text
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2024-04-05 16:20:29 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2024-04-09 16:41:27 +0200
commit35205ef1654f2ee0aca80010acdbb469cf1cf8e7 (patch)
tree909776e3d66be8e59a26eb05b61c0bcdb54cad87 /src/corelib/text
parentb68f1009187fee473f4c6477ec64300650e29904 (diff)
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>
Diffstat (limited to 'src/corelib/text')
-rw-r--r--src/corelib/text/qtextboundaryfinder.cpp4
-rw-r--r--src/corelib/text/qtextboundaryfinder.h2
2 files changed, 1 insertions, 5 deletions
diff --git a/src/corelib/text/qtextboundaryfinder.cpp b/src/corelib/text/qtextboundaryfinder.cpp
index 8f20967a1d..21d4c5153e 100644
--- a/src/corelib/text/qtextboundaryfinder.cpp
+++ b/src/corelib/text/qtextboundaryfinder.cpp
@@ -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) {
diff --git a/src/corelib/text/qtextboundaryfinder.h b/src/corelib/text/qtextboundaryfinder.h
index 336096d2d0..04e64fd69b 100644
--- a/src/corelib/text/qtextboundaryfinder.h
+++ b/src/corelib/text/qtextboundaryfinder.h
@@ -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;