Clipper.cpp: fix a few minor Coverity warnings (about not initialized private members)

This commit is contained in:
jean-pierre charras 2015-11-03 17:55:31 +01:00
parent 6e470ece1d
commit 602e38dab5
2 changed files with 21 additions and 2 deletions

View File

@ -277,8 +277,8 @@ bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize,
double distEnd = GetLineLength( *curpos, track->GetEnd() ); double distEnd = GetLineLength( *curpos, track->GetEnd() );
// if track not via, or if its a via dragging but not with its adjacent track // if track not via, or if its a via dragging but not with its adjacent track
if( currTrack->Type() != PCB_VIA_T if( currTrack->Type() != PCB_VIA_T ||
|| ( currTrack->GetStart() != track->GetStart() && currTrack->GetStart() != track->GetEnd() )) ( currTrack->GetStart() != track->GetStart() && currTrack->GetStart() != track->GetEnd() ))
{ {
double max_dist = currTrack->GetWidth() / 2.0f; double max_dist = currTrack->GetWidth() / 2.0f;

View File

@ -181,6 +181,8 @@ int PolyTree::Total() const
PolyNode::PolyNode(): Childs(), Parent(0), Index(0), m_IsOpen(false) PolyNode::PolyNode(): Childs(), Parent(0), Index(0), m_IsOpen(false)
{ {
// Avoid uninitialized vars
m_endtype = etClosedPolygon;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -884,6 +886,11 @@ ClipperBase::ClipperBase() //constructor
{ {
m_CurrentLM = m_MinimaList.begin(); //begin() == end() here m_CurrentLM = m_MinimaList.begin(); //begin() == end() here
m_UseFullRange = false; m_UseFullRange = false;
// Avoid uninitialized vars
m_PreserveCollinear = false;
m_HasOpenPaths = false;
m_ActiveEdges = NULL;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -1482,6 +1489,13 @@ Clipper::Clipper(int initOptions) : ClipperBase() //constructor
#ifdef use_xyz #ifdef use_xyz
m_ZFill = 0; m_ZFill = 0;
#endif #endif
// Avoid uninitialized vars
m_ClipType = ctIntersection;
m_SortedEdges = NULL;
m_ClipFillType = pftEvenOdd;
m_SubjFillType = pftEvenOdd;
m_UsingPolyTree = true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -3781,6 +3795,11 @@ ClipperOffset::ClipperOffset(double miterLimit, double arcTolerance)
this->MiterLimit = miterLimit; this->MiterLimit = miterLimit;
this->ArcTolerance = arcTolerance; this->ArcTolerance = arcTolerance;
m_lowest.X = -1; m_lowest.X = -1;
//Avoid uninitialized vars:
m_delta = m_sinA = m_sin = m_cos = 0;
m_miterLim = m_StepsPerRad = 0;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------