From ad3c4b37ab422ed422474fe3e686a999330b66cf Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 1 Feb 2020 15:15:51 +0100 Subject: [PATCH] Fix a few coverity warnings --- common/gal/cairo/cairo_gal.cpp | 6 +++++- common/gal/opengl/opengl_gal.cpp | 5 +++++ utils/kicad2step/pcb/oce_utils.cpp | 7 ++++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/common/gal/cairo/cairo_gal.cpp b/common/gal/cairo/cairo_gal.cpp index 7e003937e4..c371f07129 100644 --- a/common/gal/cairo/cairo_gal.cpp +++ b/common/gal/cairo/cairo_gal.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KICAD, a free EDA CAD application. * * Copyright (C) 2012 Torsten Hueter, torstenhtr 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 * @@ -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( ¤tXform ); + cairo_matrix_init_identity( ¤tWorld2Screen ); } diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index 1178728b29..4176d1e984 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -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; } diff --git a/utils/kicad2step/pcb/oce_utils.cpp b/utils/kicad2step/pcb/oce_utils.cpp index d23edca779..29871ce261 100644 --- a/utils/kicad2step/pcb/oce_utils.cpp +++ b/utils/kicad2step/pcb/oce_utils.cpp @@ -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