Fix -Wclass-memaccess warning

Replace C-style memset with C++ value-initialization/assignment (smarter and safer: see https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#slcon3-avoid-bounds-errors)
This commit is contained in:
howetuft
2019-11-03 15:34:40 +01:00
committed by wmayer
parent 6300e09dd8
commit 5807ee2022
3 changed files with 23 additions and 24 deletions

View File

@@ -64,24 +64,24 @@ static int const Skip = -2; //edge that would otherwise close a path
#define NEAR_ZERO(val) (((val) > -TOLERANCE) && ((val) < TOLERANCE))
struct TEdge {
IntPoint Bot;
IntPoint Curr;
IntPoint Top;
IntPoint Delta;
double Dx;
PolyType PolyTyp;
EdgeSide Side;
int WindDelta; //1 or -1 depending on winding direction
int WindCnt;
int WindCnt2; //winding count of the opposite polytype
int OutIdx;
TEdge *Next;
TEdge *Prev;
TEdge *NextInLML;
TEdge *NextInAEL;
TEdge *PrevInAEL;
TEdge *NextInSEL;
TEdge *PrevInSEL;
IntPoint Bot{0,0};
IntPoint Curr{0,0};
IntPoint Top{0,0};
IntPoint Delta{0,0};
double Dx = 0.0;
PolyType PolyTyp = ptSubject;
EdgeSide Side = esLeft;
int WindDelta = 0; //1 or -1 depending on winding direction
int WindCnt = 0;
int WindCnt2 = 0; //winding count of the opposite polytype
int OutIdx = 0;
TEdge *Next = nullptr;
TEdge *Prev = nullptr;
TEdge *NextInLML = nullptr;
TEdge *NextInAEL = nullptr;
TEdge *PrevInAEL = nullptr;
TEdge *NextInSEL = nullptr;
TEdge *PrevInSEL = nullptr;
};
struct IntersectNode {
@@ -715,7 +715,6 @@ void DisposeOutPts(OutPt*& pp)
inline void InitEdge(TEdge* e, TEdge* eNext, TEdge* ePrev, const IntPoint& Pt)
{
std::memset(e, 0, sizeof(TEdge));
e->Next = eNext;
e->Prev = ePrev;
e->Curr = Pt;