From e76736b7bfe0a372366378ce956b01b5ec8811d6 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 3 Oct 2020 12:47:41 +0200 Subject: [PATCH] Fix a few Coverity warnings --- common/plotters/GERBER_plotter.cpp | 14 ++++++++++---- eeschema/sch_iref.cpp | 2 ++ pcbnew/class_dimension.cpp | 1 + pcbnew/drc/drc_test_provider_silk_to_pad.cpp | 10 ++++++---- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/common/plotters/GERBER_plotter.cpp b/common/plotters/GERBER_plotter.cpp index 80805247fb..8ce5895a31 100644 --- a/common/plotters/GERBER_plotter.cpp +++ b/common/plotters/GERBER_plotter.cpp @@ -60,6 +60,11 @@ GERBER_PLOTTER::GERBER_PLOTTER() m_gerberUnitFmt = 6; m_useX2format = true; m_useNetAttributes = true; + + m_hasApertureRoundRect = false; // true is at least one round rect aperture is in use + m_hasApertureRotOval = false; // true is at least one oval rotated aperture is in use + m_hasApertureRotRect = false; // true is at least one rect. rotated aperture is in use + m_hasApertureOutline = false; // true is at least one rotated rect/trapezoid aperture is in use } @@ -71,10 +76,6 @@ void GERBER_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil, plotOffset = aOffset; wxASSERT( aScale == 1 ); // aScale parameter is not used in Gerber plotScale = 1; // Plot scale is *always* 1.0 - m_hasApertureRoundRect = false; // true is at least one round rect aperture is in use - m_hasApertureRotOval = false; // true is at least one oval rotated aperture is in use - m_hasApertureRotRect = false; // true is at least one rect. rotated aperture is in use - m_hasApertureOutline = false; // true is at least one rotated rect/trapezoid aperture is in use m_IUsPerDecimil = aIusPerDecimil; // gives now a default value to iuPerDeviceUnit (because the units of the caller is now known) @@ -184,6 +185,11 @@ void GERBER_PLOTTER::formatNetAttribute( GBR_NETLIST_METADATA* aData ) bool GERBER_PLOTTER::StartPlot() { + m_hasApertureRoundRect = false; // true is at least one round rect aperture is in use + m_hasApertureRotOval = false; // true is at least one oval rotated aperture is in use + m_hasApertureRotRect = false; // true is at least one rect. rotated aperture is in use + m_hasApertureOutline = false; // true is at least one rotated rect/trapezoid aperture is in use + wxASSERT( outputFile ); finalFile = outputFile; // the actual gerber file will be created later diff --git a/eeschema/sch_iref.cpp b/eeschema/sch_iref.cpp index 390b997ddc..b1be8acc54 100644 --- a/eeschema/sch_iref.cpp +++ b/eeschema/sch_iref.cpp @@ -37,6 +37,8 @@ SCH_IREF::SCH_IREF( const wxPoint& pos, const wxString& text, SCH_GLOBALLABEL* a m_Layer = LAYER_GLOBLABEL; m_parent = aParent; SetMultilineAllowed( false ); + m_ownPageNumber = 0; + m_screen = nullptr; } diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp index 6949771b48..a23d2030ff 100644 --- a/pcbnew/class_dimension.cpp +++ b/pcbnew/class_dimension.cpp @@ -692,6 +692,7 @@ ORTHOGONAL_DIMENSION::ORTHOGONAL_DIMENSION( BOARD_ITEM* aParent ) : { // To preserve look of old dimensions, initialize extension height based on default arrow length m_extensionHeight = static_cast( m_arrowLength * std::sin( DEG2RAD( s_arrowAngle ) ) ); + m_orientation = DIR::HORIZONTAL; } diff --git a/pcbnew/drc/drc_test_provider_silk_to_pad.cpp b/pcbnew/drc/drc_test_provider_silk_to_pad.cpp index 196c6e7e48..9b680d7e74 100644 --- a/pcbnew/drc/drc_test_provider_silk_to_pad.cpp +++ b/pcbnew/drc/drc_test_provider_silk_to_pad.cpp @@ -51,19 +51,21 @@ namespace test { class DRC_TEST_PROVIDER_SILK_TO_PAD : public ::DRC_TEST_PROVIDER { public: - DRC_TEST_PROVIDER_SILK_TO_PAD () + DRC_TEST_PROVIDER_SILK_TO_PAD (): + m_board( nullptr ), + m_largestClearance( 0 ) { } - virtual ~DRC_TEST_PROVIDER_SILK_TO_PAD() + virtual ~DRC_TEST_PROVIDER_SILK_TO_PAD() { } virtual bool Run() override; - virtual const wxString GetName() const override + virtual const wxString GetName() const override { - return "silk_to_pad"; + return "silk_to_pad"; }; virtual const wxString GetDescription() const override