Cppcheck warnings.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-03-30 13:59:10 +03:00
parent 66d4d1cd7b
commit dc9ded6600
3 changed files with 23 additions and 23 deletions

View File

@ -151,6 +151,26 @@ QVector<QLineF> CreateThreePassmarkLines(const QLineF &line)
lines.append(QLineF(l2p1, l2p2));
return lines;
}
//---------------------------------------------------------------------------------------------------------------------
bool IsPassmarksPossible(const QVector<VPieceNode> &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<CustomSARecord> VPiece::FilterRecords(QVector<CustomSARecord> 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<VPieceNode> &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<VPieceNode> &path, int passmarkIndex) const
{

View File

@ -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<VPieceNode> &path) const;
bool IsPassmarkVisible(const QVector<VPieceNode> &path, int passmarkIndex) const;
QVector<QLineF> CreatePassmark(const QVector<VPieceNode> &path, int previousIndex, int passmarkIndex, int nextIndex,

View File

@ -389,7 +389,7 @@ VSAPoint VPiecePath::StartSegment(const VContainer *data, const QVector<VPieceNo
int index = 0;
i == 0 ? index = FindInLoopNotExcludedUp(nodes.size()-1, nodes) : index = FindInLoopNotExcludedUp(i-1, nodes);
if (index != -1 && index != i)
if (index != i && index != -1)
{
begin = CurveStartPoint(begin, data, nodes.at(index), points);
}
@ -421,7 +421,7 @@ VSAPoint VPiecePath::EndSegment(const VContainer *data, const QVector<VPieceNode
int index = 0;
i == nodes.size()-1 ? index=FindInLoopNotExcludedDown(0, nodes) : index=FindInLoopNotExcludedDown(i+1, nodes);
if (index != -1 && index != i)
if (index != i && index != -1)
{
end = CurveEndPoint(end, data, nodes.at(index), points);
}