diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2024-04-05 16:20:29 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2024-04-09 16:41:27 +0200 |
commit | 35205ef1654f2ee0aca80010acdbb469cf1cf8e7 (patch) | |
tree | 909776e3d66be8e59a26eb05b61c0bcdb54cad87 /src/corelib/text | |
parent | b68f1009187fee473f4c6477ec64300650e29904 (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.cpp | 4 | ||||
-rw-r--r-- | src/corelib/text/qtextboundaryfinder.h | 2 |
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; |