Fix a few coverity warnings

This commit is contained in:
jean-pierre charras 2020-02-01 15:15:51 +01:00
parent b8108d294f
commit ad3c4b37ab
3 changed files with 14 additions and 4 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2012 Torsten Hueter, torstenhtr <at> gmx.de
* Copyright (C) 2012-2019 Kicad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2012-2020 Kicad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017-2018 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
@ -67,6 +67,10 @@ CAIRO_GAL_BASE::CAIRO_GAL_BASE( GAL_DISPLAY_OPTIONS& aDisplayOptions ) :
// Grid color settings are different in Cairo and OpenGL
SetGridColor( COLOR4D( 0.1, 0.1, 0.1, 0.8 ) );
SetAxesColor( COLOR4D( BLUE ) );
// Avoid unitialized variables:
cairo_matrix_init_identity( &currentXform );
cairo_matrix_init_identity( &currentWorld2Screen );
}

View File

@ -285,6 +285,11 @@ OPENGL_GAL::OPENGL_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent,
gluTessProperty( tesselator, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_POSITIVE );
SetTarget( TARGET_NONCACHED );
// Avoid unitialized variables:
ufm_worldPixelSize = 1;
ufm_screenPixelSize = 1;
ufm_pixelSizeMultiplier = 1;
}

View File

@ -735,12 +735,13 @@ bool PCBMODEL::CreatePCB()
}
std::list< KICADCURVE >::iterator sC = m_curves.begin();
std::list< KICADCURVE >::iterator eC = m_curves.end();
bool added = false;
while( sC != eC )
while( sC != m_curves.end() )
{
if( oln.AddSegment( *sC ) )
{
added = true;
m_curves.erase( sC );
break;
}
@ -748,7 +749,7 @@ bool PCBMODEL::CreatePCB()
++sC;
}
if( sC == eC && !oln.m_curves.empty() )
if( !added && !oln.m_curves.empty() )
{
std::ostringstream ostr;
#ifdef DEBUG