diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2023-09-13 17:36:59 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2023-09-15 15:32:40 +0200 |
commit | 6e5a342b1030e5df47e13917a8f488ffbce6add0 (patch) | |
tree | c695bc3da29c48553eb1437c8f633bccf4de8c5b /src/qmldom/qqmldomcomments_p.h | |
parent | 27dcc63e00a764b1abe49a4fdf7ee452f2f609f9 (diff) |
qmldom: Fix coverity warnings
- initialize members
- iterate const containers, and use const refs for elements
- pass values by reference
- provide move constructors
Coverity-Id: 417104
Coverity-Id: 417102
Coverity-Id: 417101
Coverity-Id: 417100
Coverity-Id: 417099
Coverity-Id: 417098
Coverity-Id: 417097
Coverity-Id: 417096
Coverity-Id: 417095
Coverity-Id: 417094
Coverity-Id: 417093
Coverity-Id: 417092
Coverity-Id: 417090
Coverity-Id: 417088
Coverity-Id: 417087
Coverity-Id: 417086
Coverity-Id: 417085
Change-Id: I624ed4e71c49c3eebced9483dd73554dbdcb981b
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Diffstat (limited to 'src/qmldom/qqmldomcomments_p.h')
-rw-r--r-- | src/qmldom/qqmldomcomments_p.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/qmldom/qqmldomcomments_p.h b/src/qmldom/qqmldomcomments_p.h index e987644343..7f7d4b9c9d 100644 --- a/src/qmldom/qqmldomcomments_p.h +++ b/src/qmldom/qqmldomcomments_p.h @@ -55,15 +55,15 @@ public: return rawComment.mid(commentEnd, rawComment.size() - commentEnd); } - quint32 commentBegin; - quint32 commentEnd; - quint32 commentContentBegin; - quint32 commentContentEnd; + quint32 commentBegin = 0; + quint32 commentEnd = 0; + quint32 commentContentBegin = 0; + quint32 commentContentEnd = 0; QStringView commentStartStr; QStringView commentEndStr; bool hasStartNewline = false; bool hasEndNewline = false; - int nContentNewlines; + int nContentNewlines = 0; QStringView rawComment; QStringList warnings; }; @@ -186,9 +186,10 @@ public: Path canonicalPath(const DomItem &self) const override { return self.m_ownerPath; } static void collectComments(MutableDomItem &item); - static void collectComments(std::shared_ptr<Engine> engine, AST::Node *n, - std::shared_ptr<AstComments> collectComments, - MutableDomItem rootItem, FileLocations::Tree rootItemLocations); + static void collectComments( + std::shared_ptr<Engine> engine, AST::Node *n, + std::shared_ptr<AstComments> collectComments, const MutableDomItem &rootItem, + FileLocations::Tree rootItemLocations); AstComments(std::shared_ptr<Engine> e) : m_engine(e) { } AstComments(const AstComments &o) : OwningItem(o), m_engine(o.m_engine), m_commentedElements(o.m_commentedElements) |