From 06bf7943b7b68c89380016b6e20c9a3046dc6462 Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Wed, 21 Oct 2020 00:28:56 +0100 Subject: [PATCH] Minor warning fixes --- eeschema/dialogs/dialog_change_symbols.cpp | 3 +++ eeschema/dialogs/dialog_symbol_properties.cpp | 4 ++-- eeschema/sch_sheet.cpp | 2 +- pcbnew/dialogs/dialog_drc.cpp | 7 ++++--- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/eeschema/dialogs/dialog_change_symbols.cpp b/eeschema/dialogs/dialog_change_symbols.cpp index 60fc2f0a78..173263f87c 100644 --- a/eeschema/dialogs/dialog_change_symbols.cpp +++ b/eeschema/dialogs/dialog_change_symbols.cpp @@ -236,6 +236,9 @@ void DIALOG_CHANGE_SYMBOLS::launchNewIdSymbolBrowser( wxCommandEvent& aEvent ) void DIALOG_CHANGE_SYMBOLS::updateFieldsList() { SCH_EDIT_FRAME* frame = dynamic_cast( GetParent() ); + + wxCHECK( frame, /* void */ ); + LIB_ID newId; SCH_SHEET_LIST hierarchy = frame->Schematic().GetSheets(); diff --git a/eeschema/dialogs/dialog_symbol_properties.cpp b/eeschema/dialogs/dialog_symbol_properties.cpp index d1c109b080..437f0e9192 100644 --- a/eeschema/dialogs/dialog_symbol_properties.cpp +++ b/eeschema/dialogs/dialog_symbol_properties.cpp @@ -1010,8 +1010,8 @@ void DIALOG_SYMBOL_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& event ) { wxGridCellEditor* cellEditor = m_fieldsGrid->GetCellEditor( REFERENCE, FDC_VALUE ); - if( cellEditor->GetControl() ) - SelectReferenceNumber( dynamic_cast( cellEditor->GetControl() ) ); + if( wxTextEntry* txt = dynamic_cast( cellEditor->GetControl() ) ) + SelectReferenceNumber( txt ); cellEditor->DecRef(); // we're done; must release diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index 62a78b7244..fbdf8827ad 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -1016,7 +1016,7 @@ SCH_SHEET& SCH_SHEET::operator=( const SCH_ITEM& aItem ) m_pins.back()->SetParent( this ); } - for( const SCH_SHEET_INSTANCE instance : sheet->m_instances ) + for( const SCH_SHEET_INSTANCE& instance : sheet->m_instances ) m_instances.emplace_back( instance ); } diff --git a/pcbnew/dialogs/dialog_drc.cpp b/pcbnew/dialogs/dialog_drc.cpp index 2c1a6af40d..89ab655089 100644 --- a/pcbnew/dialogs/dialog_drc.cpp +++ b/pcbnew/dialogs/dialog_drc.cpp @@ -307,10 +307,11 @@ void DIALOG_DRC::OnDRCItemSelected( wxDataViewEvent& aEvent ) const KIID& itemID = node ? RC_TREE_MODEL::ToUUID( aEvent.GetItem() ) : niluuid; BOARD_ITEM* item = board->GetItem( itemID ); - if( item ) + if( item && node ) { - PCB_LAYER_ID principalLayer = item->GetLayer(); - std::shared_ptr rc_item = node->m_RcItem; + PCB_LAYER_ID principalLayer = item->GetLayer(); + std::shared_ptr rc_item = node->m_RcItem; + BOARD_ITEM* a = board->GetItem( rc_item->GetMainItemID() ); BOARD_ITEM* b = board->GetItem( rc_item->GetAuxItemID() ); BOARD_ITEM* c = board->GetItem( rc_item->GetAuxItem2ID() );