From d50d728d1953f595b5d7a5858872d6ab54c8c6e0 Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Wed, 25 Nov 2020 00:08:09 +0000 Subject: [PATCH] Cleanup compiler warnings --- common/kiway.cpp | 2 +- eeschema/tools/sch_edit_tool.cpp | 5 +++-- pcbnew/dialogs/dialog_footprint_checker.cpp | 8 ++++---- pcbnew/microwave/microwave_polygon.cpp | 16 +++++++++------- pcbnew/tools/drawing_tool.cpp | 4 ++-- pcbnew/tools/grid_helper.cpp | 2 +- 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/common/kiway.cpp b/common/kiway.cpp index 2a9b7cf19f..22d7f02c68 100644 --- a/common/kiway.cpp +++ b/common/kiway.cpp @@ -165,7 +165,7 @@ const wxString KIWAY::dso_search_path( FACE_T aFaceId ) // Here a "suffix" == an extension with a preceding '.', // so skip the preceding '.' to get an extension - fn.SetExt( KIFACE_SUFFIX + 1 ); // + 1 => &KIFACE_SUFFIX[1] + fn.SetExt( &KIFACE_SUFFIX[1] ); return fn.GetFullPath(); } diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index 7ba8119ab9..fa0e209921 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -207,10 +207,11 @@ bool SCH_EDIT_TOOL::Init() if( aSel.GetSize() == 0 ) return true; // Show worksheet properties - SCH_ITEM* firstItem = dynamic_cast( aSel.Front() ); + SCH_ITEM* firstItem = dynamic_cast( aSel.Front() ); const EE_SELECTION* eeSelection = dynamic_cast( &aSel ); - wxCHECK( firstItem, false ); + if( !firstItem || !eeSelection ) + return false; switch( firstItem->Type() ) { diff --git a/pcbnew/dialogs/dialog_footprint_checker.cpp b/pcbnew/dialogs/dialog_footprint_checker.cpp index 5b1da10c39..3cd510d1a7 100644 --- a/pcbnew/dialogs/dialog_footprint_checker.cpp +++ b/pcbnew/dialogs/dialog_footprint_checker.cpp @@ -87,14 +87,14 @@ void DIALOG_FOOTPRINT_CHECKER::runChecks() } OUTLINE_ERROR_HANDLER errorHandler = - [&]( const wxString& msg, BOARD_ITEM* itemA, BOARD_ITEM* itemB, const wxPoint& pt ) + [&]( const wxString& aMsg, BOARD_ITEM* aItemA, BOARD_ITEM* aItemB, const wxPoint& aPt ) { std::shared_ptr drcItem = DRC_ITEM::Create( DRCE_MALFORMED_COURTYARD ); - drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + msg ); - drcItem->SetItems( itemA, itemB ); + drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + aMsg ); + drcItem->SetItems( aItemA, aItemB ); - PCB_MARKER* marker = new PCB_MARKER( drcItem, pt ); + PCB_MARKER* marker = new PCB_MARKER( drcItem, aPt ); board->Add( marker ); m_frame->GetCanvas()->GetView()->Add( marker ); }; diff --git a/pcbnew/microwave/microwave_polygon.cpp b/pcbnew/microwave/microwave_polygon.cpp index 169f6ea0c4..014e160314 100644 --- a/pcbnew/microwave/microwave_polygon.cpp +++ b/pcbnew/microwave/microwave_polygon.cpp @@ -162,19 +162,21 @@ void MWAVE_POLYGONAL_SHAPE_DLG::OnOkClick( wxCommandEvent& event ) void MWAVE_POLYGONAL_SHAPE_DLG::ReadDataShapeDescr( wxCommandEvent& event ) { static wxString lastpath; // To remember the last open path during a session + wxString fullFileName; wxString mask = wxFileSelectorDefaultWildcardStr; - wxString FullFileName = EDA_FILE_SELECTOR( _( "Read descr shape file" ), lastpath, - FullFileName, wxEmptyString, mask, this, - wxFD_OPEN, true ); - if( FullFileName.IsEmpty() ) + fullFileName = EDA_FILE_SELECTOR( _( "Read descr shape file" ), lastpath, + fullFileName, wxEmptyString, mask, this, + wxFD_OPEN, true ); + + if( fullFileName.IsEmpty() ) return; - wxFileName fn( FullFileName ); + wxFileName fn( fullFileName ); lastpath = fn.GetPath(); PolyEdges.clear(); - FILE* File = wxFopen( FullFileName, wxT( "rt" ) ); + FILE* File = wxFopen( fullFileName, wxT( "rt" ) ); if( File == NULL ) { @@ -185,7 +187,7 @@ void MWAVE_POLYGONAL_SHAPE_DLG::ReadDataShapeDescr( wxCommandEvent& event ) double unitconv = IU_PER_MM; ShapeScaleX = ShapeScaleY = 1.0; - FILE_LINE_READER fileReader( File, FullFileName ); + FILE_LINE_READER fileReader( File, fullFileName ); FILTER_READER reader( fileReader ); LOCALE_IO toggle; diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index 83d0e53d45..06229d5199 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -2032,14 +2032,14 @@ int DRAWING_TOOL::DrawZone( const TOOL_EVENT& aEvent ) evt->SetPassEvent(); } } - else if( evt->IsAction( &ACTIONS::updateUnits ) ) + /*else if( evt->IsAction( &ACTIONS::updateUnits ) ) { // If we ever have an assistant here that reports dimensions, we'll want to // update its units here.... // zoneAsst.SetUnits( frame()->GetUserUnits() ); // m_view->Update( &zoneAsst ); evt->SetPassEvent(); - } + }*/ else { evt->SetPassEvent(); diff --git a/pcbnew/tools/grid_helper.cpp b/pcbnew/tools/grid_helper.cpp index ef9599ffee..e472b068f2 100644 --- a/pcbnew/tools/grid_helper.cpp +++ b/pcbnew/tools/grid_helper.cpp @@ -609,7 +609,7 @@ void GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos, bo break; case S_POLYGON: - for( const VECTOR2I& p : shape->BuildPolyPointsList() ) + for( const wxPoint& p : shape->BuildPolyPointsList() ) addAnchor( p, CORNER | SNAPPABLE, shape ); break;