From 382dca4e6fa1e2326cc4daeccea269bccc05362a Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Sun, 30 May 2021 19:47:57 -0400 Subject: [PATCH] Fix uninitialized member warnings Based on PVS Studio report --- .../cadstar/cadstar_sch_archive_parser.h | 2 +- gerbview/gerbview_settings.cpp | 8 ++++---- include/basic_gal.h | 16 +++++++++------- include/tool/conditional_menu.h | 1 + include/widgets/mathplot.h | 9 ++++++++- pcbnew/drc/drc_rule.h | 1 + pcbnew/pcb_expr_evaluator.cpp | 8 ++++++-- pcbnew/pcb_expr_evaluator.h | 2 +- pcbnew/router/pns_joint.h | 2 +- pcbnew/router/pns_shove.h | 1 + 10 files changed, 33 insertions(+), 17 deletions(-) diff --git a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_parser.h b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_parser.h index d08d037413..adb0ea8304 100644 --- a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_parser.h +++ b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_parser.h @@ -36,7 +36,7 @@ class CADSTAR_SCH_ARCHIVE_PARSER : public CADSTAR_ARCHIVE_PARSER { public: explicit CADSTAR_SCH_ARCHIVE_PARSER( wxString aFilename ) - : CADSTAR_ARCHIVE_PARSER(), Filename( aFilename ), KiCadUnitDivider( 10 ) + : CADSTAR_ARCHIVE_PARSER(), Filename( aFilename ), Header(), Assignments(), KiCadUnitDivider( 10 ) { } diff --git a/gerbview/gerbview_settings.cpp b/gerbview/gerbview_settings.cpp index 76cf9a7e44..1a29019705 100644 --- a/gerbview/gerbview_settings.cpp +++ b/gerbview/gerbview_settings.cpp @@ -34,11 +34,11 @@ const int gerbviewSchemaVersion = 0; -GERBVIEW_SETTINGS::GERBVIEW_SETTINGS() : APP_SETTINGS_BASE( "gerbview", gerbviewSchemaVersion ) +GERBVIEW_SETTINGS::GERBVIEW_SETTINGS() : + APP_SETTINGS_BASE( "gerbview", gerbviewSchemaVersion ), + m_BoardLayersCount( 2 ), + m_Appearance() { - // Make Coverity happy - m_BoardLayersCount = 2; - // Init settings: m_params.emplace_back( new PARAM( "appearance.show_border_and_titleblock", &m_Appearance.show_border_and_titleblock, false ) ); diff --git a/include/basic_gal.h b/include/basic_gal.h index 287856c400..eb2413a346 100644 --- a/include/basic_gal.h +++ b/include/basic_gal.h @@ -61,14 +61,16 @@ class BASIC_GAL: public KIGFX::GAL { public: BASIC_GAL( KIGFX::GAL_DISPLAY_OPTIONS& aDisplayOptions ) : - GAL( aDisplayOptions ) + GAL( aDisplayOptions ), + m_DC( nullptr ), + m_Color( RED ), + m_transform(), + m_clipBox(), + m_isClipped( false ), + m_callback( nullptr ), + m_callbackData( nullptr ), + m_plotter( nullptr ) { - m_DC = nullptr; - m_Color = RED; - m_plotter = nullptr; - m_callback = nullptr; - m_callbackData = nullptr; - m_isClipped = false; } void SetPlotter( PLOTTER* aPlotter ) diff --git a/include/tool/conditional_menu.h b/include/tool/conditional_menu.h index 4074850dc3..aea49c4dfa 100644 --- a/include/tool/conditional_menu.h +++ b/include/tool/conditional_menu.h @@ -153,6 +153,7 @@ private: // Separator ENTRY( SELECTION_CONDITION aCondition, int aOrder ) : m_type( SEPARATOR ), m_icon( static_cast( 0 ) ), + m_data(), m_condition( aCondition ), m_order( aOrder ), m_isCheckmarkEntry( false ) diff --git a/include/widgets/mathplot.h b/include/widgets/mathplot.h index 2853324ff3..b3cbfaa5ae 100644 --- a/include/widgets/mathplot.h +++ b/include/widgets/mathplot.h @@ -1731,11 +1731,16 @@ public: /** Default constructor (sets location and rotation to (0,0,0)) */ mpMovableObject() : + m_flags( 0 ), m_reference_x( 0 ), m_reference_y( 0 ), m_reference_phi( 0 ), m_shape_xs( 0 ), - m_shape_ys( 0 ) + m_shape_ys( 0 ), + m_bbox_min_x( 0 ), + m_bbox_max_x( 0 ), + m_bbox_min_y( 0 ), + m_bbox_max_y( 0 ) { m_type = mpLAYER_PLOT; } @@ -1957,6 +1962,8 @@ public: { m_min_x = m_max_x = m_min_y = m_max_y = 0; + m_scaledBitmap_offset_x = 0; + m_scaledBitmap_offset_y = 0; m_validImg = false; m_type = mpLAYER_BITMAP; } diff --git a/pcbnew/drc/drc_rule.h b/pcbnew/drc/drc_rule.h index 019b79a3c6..615879f3da 100644 --- a/pcbnew/drc/drc_rule.h +++ b/pcbnew/drc/drc_rule.h @@ -107,6 +107,7 @@ class DRC_CONSTRAINT DRC_CONSTRAINT( DRC_CONSTRAINT_T aType = NULL_CONSTRAINT, const wxString& aName = wxEmptyString ) : m_Type( aType ), + m_Value(), m_DisallowFlags( 0 ), m_name( aName ), m_parentRule( nullptr ) diff --git a/pcbnew/pcb_expr_evaluator.cpp b/pcbnew/pcb_expr_evaluator.cpp index 670e41b18c..b20c698276 100644 --- a/pcbnew/pcb_expr_evaluator.cpp +++ b/pcbnew/pcb_expr_evaluator.cpp @@ -1073,11 +1073,15 @@ PCB_EXPR_COMPILER::PCB_EXPR_COMPILER() } -PCB_EXPR_EVALUATOR::PCB_EXPR_EVALUATOR() +PCB_EXPR_EVALUATOR::PCB_EXPR_EVALUATOR() : + m_result( 0 ), + m_compiler(), + m_ucode(), + m_errorStatus() { - m_result = 0; } + PCB_EXPR_EVALUATOR::~PCB_EXPR_EVALUATOR() { } diff --git a/pcbnew/pcb_expr_evaluator.h b/pcbnew/pcb_expr_evaluator.h index 9e5d568684..0540ccc72f 100644 --- a/pcbnew/pcb_expr_evaluator.h +++ b/pcbnew/pcb_expr_evaluator.h @@ -83,7 +83,7 @@ private: class PCB_EXPR_VAR_REF : public LIBEVAL::VAR_REF { public: - PCB_EXPR_VAR_REF( int aItemIndex ) : + PCB_EXPR_VAR_REF( int aItemIndex ) : m_itemIndex( aItemIndex ), m_type( LIBEVAL::VT_UNDEFINED ), m_isEnum( false ) diff --git a/pcbnew/router/pns_joint.h b/pcbnew/router/pns_joint.h index 7dd350999a..4826939c34 100644 --- a/pcbnew/router/pns_joint.h +++ b/pcbnew/router/pns_joint.h @@ -67,7 +67,7 @@ public: }; JOINT() : - ITEM( JOINT_T ), m_locked( false ) {} + ITEM( JOINT_T ), m_tag(), m_locked( false ) {} JOINT( const VECTOR2I& aPos, const LAYER_RANGE& aLayers, int aNet = -1 ) : ITEM( JOINT_T ) diff --git a/pcbnew/router/pns_shove.h b/pcbnew/router/pns_shove.h index 7ce8fb8be9..036f4db92b 100644 --- a/pcbnew/router/pns_shove.h +++ b/pcbnew/router/pns_shove.h @@ -100,6 +100,7 @@ private: { SPRINGBACK_TAG() : m_length( 0 ), + m_draggedVia(), m_node( nullptr ), m_seq( 0 ), m_locked( false )