From dc9ded6600a046b5ff525b3f3f02f4491e06e665 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 30 Mar 2017 13:59:10 +0300 Subject: [PATCH] Cppcheck warnings. --HG-- branch : develop --- src/libs/vpatterndb/vpiece.cpp | 41 +++++++++++++++--------------- src/libs/vpatterndb/vpiece.h | 1 - src/libs/vpatterndb/vpiecepath.cpp | 4 +-- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/libs/vpatterndb/vpiece.cpp b/src/libs/vpatterndb/vpiece.cpp index b049a5543..46d279e6d 100644 --- a/src/libs/vpatterndb/vpiece.cpp +++ b/src/libs/vpatterndb/vpiece.cpp @@ -151,6 +151,26 @@ QVector CreateThreePassmarkLines(const QLineF &line) lines.append(QLineF(l2p1, l2p2)); return lines; } + +//--------------------------------------------------------------------------------------------------------------------- +bool IsPassmarksPossible(const QVector &path) +{ + int countPointNodes = 0; + int countOthers = 0; + + for (int i = 0; i< path.size(); ++i) + { + const VPieceNode &node = path.at(i); + if (node.IsExcluded()) + { + continue;// skip node + } + + node.GetTypeTool() == Tool::NodePoint ? ++countPointNodes : ++countOthers; + } + + return countPointNodes >= 3 || (countPointNodes >= 1 && countOthers >= 1); +} } //--------------------------------------------------------------------------------------------------------------------- @@ -717,6 +737,7 @@ QVector VPiece::FilterRecords(QVector records) c return records; } + // cppcheck-suppress variableScope bool foundFilter = false;// Need in case "filter" will stay empty. CustomSARecord filter; int startIndex = d->m_path.CountNodes()-1; @@ -894,26 +915,6 @@ bool VPiece::GetSeamPassmarkSAPoint(const VSAPoint &previousSAPoint, const VSAPo return true; } -//--------------------------------------------------------------------------------------------------------------------- -bool VPiece::IsPassmarksPossible(const QVector &path) const -{ - int countPointNodes = 0; - int countOthers = 0; - - for (int i = 0; i< path.size(); ++i) - { - const VPieceNode &node = path.at(i); - if (node.IsExcluded()) - { - continue;// skip node - } - - node.GetTypeTool() == Tool::NodePoint ? ++countPointNodes : ++countOthers; - } - - return countPointNodes >= 3 || (countPointNodes >= 1 && countOthers >= 1); -} - //--------------------------------------------------------------------------------------------------------------------- bool VPiece::IsPassmarkVisible(const QVector &path, int passmarkIndex) const { diff --git a/src/libs/vpatterndb/vpiece.h b/src/libs/vpatterndb/vpiece.h index a2ec5971f..b8ae28025 100644 --- a/src/libs/vpatterndb/vpiece.h +++ b/src/libs/vpatterndb/vpiece.h @@ -128,7 +128,6 @@ private: bool GetSeamPassmarkSAPoint(const VSAPoint &previousSAPoint, const VSAPoint &passmarkSAPoint, const VSAPoint &nextSAPoint, const VContainer *data, QPointF &point) const; - bool IsPassmarksPossible(const QVector &path) const; bool IsPassmarkVisible(const QVector &path, int passmarkIndex) const; QVector CreatePassmark(const QVector &path, int previousIndex, int passmarkIndex, int nextIndex, diff --git a/src/libs/vpatterndb/vpiecepath.cpp b/src/libs/vpatterndb/vpiecepath.cpp index 3e569a8b7..8010af7bc 100644 --- a/src/libs/vpatterndb/vpiecepath.cpp +++ b/src/libs/vpatterndb/vpiecepath.cpp @@ -389,7 +389,7 @@ VSAPoint VPiecePath::StartSegment(const VContainer *data, const QVector