summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-09-19 20:14:16 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-09-19 20:14:16 (GMT)
commit900d04b18bebe32efca88f481d22b760aa3383a5 (patch)
tree9f6d506fbff1b7b9c74b6ba17cb9fabd207fdd0e
parent89a0e9010523f48d4ebebd289e1c9fef9140e079 (diff)
Apply suggestions from cppcheck --enable=performance
-rw-r--r--tools/vectorosm-tilecreator/clipper/clipper.cpp30
-rw-r--r--tools/vectorosm-tilecreator/clipper/clipper.hpp6
2 files changed, 18 insertions, 18 deletions
diff --git a/tools/vectorosm-tilecreator/clipper/clipper.cpp b/tools/vectorosm-tilecreator/clipper/clipper.cpp
index 4a6c53d..331ff11 100644
--- a/tools/vectorosm-tilecreator/clipper/clipper.cpp
+++ b/tools/vectorosm-tilecreator/clipper/clipper.cpp
@@ -551,8 +551,8 @@ bool SlopesEqual(const TEdge &e1, const TEdge &e2, bool UseFullInt64Range)
}
//------------------------------------------------------------------------------
-bool SlopesEqual(const IntPoint pt1, const IntPoint pt2,
- const IntPoint pt3, bool UseFullInt64Range)
+bool SlopesEqual(const IntPoint &pt1, const IntPoint &pt2,
+ const IntPoint &pt3, bool UseFullInt64Range)
{
#ifndef use_int32
if (UseFullInt64Range)
@@ -563,8 +563,8 @@ bool SlopesEqual(const IntPoint pt1, const IntPoint pt2,
}
//------------------------------------------------------------------------------
-bool SlopesEqual(const IntPoint pt1, const IntPoint pt2,
- const IntPoint pt3, const IntPoint pt4, bool UseFullInt64Range)
+bool SlopesEqual(const IntPoint &pt1, const IntPoint &pt2,
+ const IntPoint &pt3, const IntPoint &pt4, bool UseFullInt64Range)
{
#ifndef use_int32
if (UseFullInt64Range)
@@ -581,7 +581,7 @@ inline bool IsHorizontal(TEdge &e)
}
//------------------------------------------------------------------------------
-inline double GetDx(const IntPoint pt1, const IntPoint pt2)
+inline double GetDx(const IntPoint &pt1, const IntPoint &pt2)
{
return (pt1.Y == pt2.Y) ?
HORIZONTAL : (double)(pt2.X - pt1.X) / (pt2.Y - pt1.Y);
@@ -857,8 +857,8 @@ OutPt* GetBottomPt(OutPt *pp)
}
//------------------------------------------------------------------------------
-bool Pt2IsBetweenPt1AndPt3(const IntPoint pt1,
- const IntPoint pt2, const IntPoint pt3)
+bool Pt2IsBetweenPt1AndPt3(const IntPoint &pt1,
+ const IntPoint &pt2, const IntPoint &pt3)
{
if ((pt1 == pt3) || (pt1 == pt2) || (pt3 == pt2))
return false;
@@ -1939,7 +1939,7 @@ void Clipper::CopyAELToSEL()
}
//------------------------------------------------------------------------------
-void Clipper::AddJoin(OutPt *op1, OutPt *op2, const IntPoint OffPt)
+void Clipper::AddJoin(OutPt *op1, OutPt *op2, const IntPoint &OffPt)
{
Join* j = new Join;
j->OutPt1 = op1;
@@ -1965,7 +1965,7 @@ void Clipper::ClearGhostJoins()
}
//------------------------------------------------------------------------------
-void Clipper::AddGhostJoin(OutPt *op, const IntPoint OffPt)
+void Clipper::AddGhostJoin(OutPt *op, const IntPoint &OffPt)
{
Join* j = new Join;
j->OutPt1 = op;
@@ -2655,14 +2655,14 @@ void Clipper::ProcessHorizontal(TEdge *horzEdge)
if (dir == dLeftToRight)
{
maxIt = m_Maxima.begin();
- while (maxIt != m_Maxima.end() && *maxIt <= horzEdge->Bot.X) maxIt++;
+ while (maxIt != m_Maxima.end() && *maxIt <= horzEdge->Bot.X) ++maxIt;
if (maxIt != m_Maxima.end() && *maxIt >= eLastHorz->Top.X)
maxIt = m_Maxima.end();
}
else
{
maxRit = m_Maxima.rbegin();
- while (maxRit != m_Maxima.rend() && *maxRit > horzEdge->Bot.X) maxRit++;
+ while (maxRit != m_Maxima.rend() && *maxRit > horzEdge->Bot.X) ++maxRit;
if (maxRit != m_Maxima.rend() && *maxRit <= eLastHorz->Top.X)
maxRit = m_Maxima.rend();
}
@@ -2689,7 +2689,7 @@ void Clipper::ProcessHorizontal(TEdge *horzEdge)
{
if (horzEdge->OutIdx >= 0 && !IsOpen)
AddOutPt(horzEdge, IntPoint(*maxIt, horzEdge->Bot.Y));
- maxIt++;
+ ++maxIt;
}
}
else
@@ -2698,7 +2698,7 @@ void Clipper::ProcessHorizontal(TEdge *horzEdge)
{
if (horzEdge->OutIdx >= 0 && !IsOpen)
AddOutPt(horzEdge, IntPoint(*maxRit, horzEdge->Bot.Y));
- maxRit++;
+ ++maxRit;
}
}
};
@@ -3362,7 +3362,7 @@ OutPt* DupOutPt(OutPt* outPt, bool InsertAfter)
//------------------------------------------------------------------------------
bool JoinHorz(OutPt* op1, OutPt* op1b, OutPt* op2, OutPt* op2b,
- const IntPoint Pt, bool DiscardLeft)
+ const IntPoint &Pt, bool DiscardLeft)
{
Direction Dir1 = (op1->Pt.X > op1b->Pt.X ? dRightToLeft : dLeftToRight);
Direction Dir2 = (op2->Pt.X > op2b->Pt.X ? dRightToLeft : dLeftToRight);
@@ -4513,7 +4513,7 @@ void MinkowskiSum(const Path& pattern, const Path& path, Paths& solution, bool p
}
//------------------------------------------------------------------------------
-void TranslatePath(const Path& input, Path& output, const IntPoint delta)
+void TranslatePath(const Path& input, Path& output, const IntPoint &delta)
{
//precondition: input != output
output.resize(input.size());
diff --git a/tools/vectorosm-tilecreator/clipper/clipper.hpp b/tools/vectorosm-tilecreator/clipper/clipper.hpp
index 2472ac7..1b732ba 100644
--- a/tools/vectorosm-tilecreator/clipper/clipper.hpp
+++ b/tools/vectorosm-tilecreator/clipper/clipper.hpp
@@ -118,7 +118,7 @@ struct DoublePoint
double X;
double Y;
DoublePoint(double x = 0, double y = 0) : X(x), Y(y) {}
- DoublePoint(IntPoint ip) : X((double)ip.X), Y((double)ip.Y) {}
+ DoublePoint(const IntPoint &ip) : X((double)ip.X), Y((double)ip.Y) {}
};
//------------------------------------------------------------------------------
@@ -339,10 +339,10 @@ private:
bool IsHole(TEdge *e);
bool FindOwnerFromSplitRecs(OutRec &outRec, OutRec *&currOrfl);
void FixHoleLinkage(OutRec &outrec);
- void AddJoin(OutPt *op1, OutPt *op2, const IntPoint offPt);
+ void AddJoin(OutPt *op1, OutPt *op2, const IntPoint &offPt);
void ClearJoins();
void ClearGhostJoins();
- void AddGhostJoin(OutPt *op, const IntPoint offPt);
+ void AddGhostJoin(OutPt *op, const IntPoint &offPt);
bool JoinPoints(Join *j, OutRec* outRec1, OutRec* outRec2);
void JoinCommonEdges();
void DoSimplePolygons();