From 638198251a3e51a08d09b666ed5f7259ad8ef23e Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 22 Aug 2022 17:52:42 +0100 Subject: [PATCH] Coverity fixes. --- eeschema/bus_alias.h | 3 ++- eeschema/dialogs/panel_setup_buses.cpp | 4 +++- eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp | 2 +- eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp | 2 +- eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp | 4 ++-- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/eeschema/bus_alias.h b/eeschema/bus_alias.h index d7efc26923..29b47a68b5 100644 --- a/eeschema/bus_alias.h +++ b/eeschema/bus_alias.h @@ -33,7 +33,8 @@ class SCH_SCREEN; class BUS_ALIAS { public: - BUS_ALIAS( SCH_SCREEN* aParent = nullptr ) + BUS_ALIAS( SCH_SCREEN* aParent = nullptr ) : + m_parent( aParent ) { } ~BUS_ALIAS() diff --git a/eeschema/dialogs/panel_setup_buses.cpp b/eeschema/dialogs/panel_setup_buses.cpp index 6885e2c638..616450e237 100644 --- a/eeschema/dialogs/panel_setup_buses.cpp +++ b/eeschema/dialogs/panel_setup_buses.cpp @@ -27,7 +27,9 @@ PANEL_SETUP_BUSES::PANEL_SETUP_BUSES( wxWindow* aWindow, SCH_EDIT_FRAME* aFrame ) : PANEL_SETUP_BUSES_BASE( aWindow ), - m_frame( aFrame ) + m_frame( aFrame ), + m_errorGrid( nullptr ), + m_errorRow( -1 ) { m_membersLabelTemplate = m_membersLabel->GetLabel(); diff --git a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp index 6323d95f5a..a379fc1c83 100644 --- a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp +++ b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp @@ -917,7 +917,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets() BUS bus = Schematic.Buses.at( busTerm.BusID ); if( !alg::contains( m_busesMap.at( bus.ID )->Members(), netName ) ) - m_busesMap.at( bus.ID )->Members().push_back( netName ); + m_busesMap.at( bus.ID )->Members().emplace_back( netName ); SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( getKiCadPoint( busTerm.FirstPoint ), false ); diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp b/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp index c2038f48f3..ae3f98a7eb 100644 --- a/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp +++ b/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp @@ -3716,7 +3716,7 @@ void SCH_SEXPR_PARSER::parseBusAlias( SCH_SCREEN* aScreen ) if( m_requiredVersion < 20210621 ) member = ConvertToNewOverbarNotation( member ); - busAlias->Members().push_back( member ); + busAlias->Members().emplace_back( member ); token = NextTok(); } diff --git a/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp b/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp index 9b5b271b63..b31ce409e4 100644 --- a/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp +++ b/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp @@ -1375,8 +1375,8 @@ std::shared_ptr SCH_LEGACY_PLUGIN::loadBusAlias( LINE_READER& aReader buf.clear(); parseUnquotedString( buf, aReader, line, &line, true ); - if( buf.Len() > 0 ) - busAlias->Members().push_back( buf ); + if( !buf.IsEmpty() ) + busAlias->Members().emplace_back( buf ); } return busAlias;