From 0e9cfd0af213ad42a6f82e9a55347bbe06918205 Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Thu, 30 Dec 2021 23:42:06 +0000 Subject: [PATCH] Add missing initialization values to variables Flagged by Coverity. --- common/render_settings.cpp | 2 ++ common/settings/common_settings.cpp | 4 +++- common/stroke_params.cpp | 4 ++-- eeschema/sch_shape.cpp | 6 +++--- eeschema/sch_text.cpp | 5 ++++- include/eda_angle.h | 4 ++++ include/eda_rect.h | 1 + pcbnew/dialogs/dialog_exchange_footprints.cpp | 2 +- pcbnew/drc/drc_test_provider_solder_mask.cpp | 3 +++ pcbnew/footprint_editor_settings.cpp | 1 + pcbnew/router/pns_line_placer.cpp | 1 + 11 files changed, 25 insertions(+), 8 deletions(-) diff --git a/common/render_settings.cpp b/common/render_settings.cpp index ebff636d6f..5eee1b5664 100644 --- a/common/render_settings.cpp +++ b/common/render_settings.cpp @@ -28,6 +28,8 @@ using namespace KIGFX; RENDER_SETTINGS::RENDER_SETTINGS() : m_highlightNetcodes(), + m_dashLengthRatio( 12 ), // From ISO 128-2 + m_gapLengthRatio( 3 ), // From ISO 128-2 m_printDC( nullptr ) { // Set the default initial values diff --git a/common/settings/common_settings.cpp b/common/settings/common_settings.cpp index 2454f334c0..981ca73be7 100644 --- a/common/settings/common_settings.cpp +++ b/common/settings/common_settings.cpp @@ -53,7 +53,9 @@ COMMON_SETTINGS::COMMON_SETTINGS() : m_Graphics(), m_Session(), m_System(), - m_NetclassPanel() + m_DoNotShowAgain(), + m_NetclassPanel(), + m_PackageManager() { /* * Automatic dark mode detection works fine on Mac. diff --git a/common/stroke_params.cpp b/common/stroke_params.cpp index 1a785fec99..fcd3616e02 100644 --- a/common/stroke_params.cpp +++ b/common/stroke_params.cpp @@ -36,8 +36,8 @@ void STROKE_PARAMS::Stroke( const SHAPE* aShape, PLOT_DASH_TYPE aLineStyle, int const KIGFX::RENDER_SETTINGS* aRenderSettings, std::function aStroker ) { - double strokes[6]; - int wrapAround; + double strokes[6] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; + int wrapAround = 0; switch( aLineStyle ) { diff --git a/eeschema/sch_shape.cpp b/eeschema/sch_shape.cpp index 2a7cfd6c0d..b2c88ffdc8 100644 --- a/eeschema/sch_shape.cpp +++ b/eeschema/sch_shape.cpp @@ -81,9 +81,9 @@ void SCH_SHAPE::Plot( PLOTTER* aPlotter ) const { int pen_size = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetMinPenWidth() ); wxPoint center; - int radius; - int startAngle; - int endAngle; + int radius = 0; + int startAngle = 0; + int endAngle = 0; static std::vector cornerList; diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index f097389887..f1b6d8dbfa 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -612,7 +612,10 @@ void SCH_TEXT::Show( int nestLevel, std::ostream& os ) const SCH_LABEL_BASE::SCH_LABEL_BASE( const wxPoint& aPos, const wxString& aText, KICAD_T aType ) : - SCH_TEXT( aPos, aText, aType ) + SCH_TEXT( aPos, aText, aType ), + m_shape( L_UNSPECIFIED ), + m_connectionType( CONNECTION_TYPE::NONE ), + m_isDangling( true ) { SetMultilineAllowed( false ); SetFieldsAutoplaced(); diff --git a/include/eda_angle.h b/include/eda_angle.h index 8311d39288..979b0db47e 100644 --- a/include/eda_angle.h +++ b/include/eda_angle.h @@ -40,6 +40,8 @@ public: // Angle type must be explicitly specified at creation, because // there is no other way of knowing what an int or a double represents EDA_ANGLE( int aValue, ANGLE_TYPE aAngleType ) : + m_value( 0 ), + m_radians( 0.0 ), m_initial_type( aAngleType ) { switch( aAngleType ) @@ -55,6 +57,8 @@ public: } EDA_ANGLE( double aValue, ANGLE_TYPE aAngleType ) : + m_value( 0 ), + m_radians( 0.0 ), m_initial_type( aAngleType ) { switch( aAngleType ) diff --git a/include/eda_rect.h b/include/eda_rect.h index 775b6e148e..d69b937072 100644 --- a/include/eda_rect.h +++ b/include/eda_rect.h @@ -60,6 +60,7 @@ public: m_pos = (wxPoint) aBox.GetPosition(); m_size.x = aBox.GetWidth(); m_size.y = aBox.GetHeight(); + m_init = true; } virtual ~EDA_RECT() { }; diff --git a/pcbnew/dialogs/dialog_exchange_footprints.cpp b/pcbnew/dialogs/dialog_exchange_footprints.cpp index fc85b79371..5b05a334ca 100644 --- a/pcbnew/dialogs/dialog_exchange_footprints.cpp +++ b/pcbnew/dialogs/dialog_exchange_footprints.cpp @@ -501,7 +501,7 @@ void PCB_EDIT_FRAME::ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew, bool* aUpdated ) { PCB_GROUP* parentGroup = aExisting->GetParentGroup(); - bool dummyBool; + bool dummyBool = false; if( !aUpdated ) aUpdated = &dummyBool; diff --git a/pcbnew/drc/drc_test_provider_solder_mask.cpp b/pcbnew/drc/drc_test_provider_solder_mask.cpp index 85257c12b8..260340d1d3 100644 --- a/pcbnew/drc/drc_test_provider_solder_mask.cpp +++ b/pcbnew/drc/drc_test_provider_solder_mask.cpp @@ -47,6 +47,9 @@ class DRC_TEST_PROVIDER_SOLDER_MASK : public ::DRC_TEST_PROVIDER { public: DRC_TEST_PROVIDER_SOLDER_MASK (): + m_board( nullptr ), + m_webWidth( 0 ), + m_maxError( 0 ), m_largestClearance( 0 ) { m_bridgeRule.m_Name = _( "board setup solder mask min width" ); diff --git a/pcbnew/footprint_editor_settings.cpp b/pcbnew/footprint_editor_settings.cpp index 883e13df98..651302974b 100644 --- a/pcbnew/footprint_editor_settings.cpp +++ b/pcbnew/footprint_editor_settings.cpp @@ -44,6 +44,7 @@ FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() : m_Display(), m_UserGrid(), m_PolarCoords( false ), + m_RotationAngle( 900 ), m_Use45Limit( true ), m_LibWidth( 250 ), m_LastImportExportPath(), diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp index d5023d4448..1d41a807ca 100644 --- a/pcbnew/router/pns_line_placer.cpp +++ b/pcbnew/router/pns_line_placer.cpp @@ -52,6 +52,7 @@ LINE_PLACER::LINE_PLACER( ROUTER* aRouter ) : m_currentNet = 0; m_currentLayer = 0; m_startItem = nullptr; + m_endItem = nullptr; m_chainedPlacement = false; m_orthoMode = false; m_placementCorrect = false;