From a7e74bf4bce58cf21a33eb235c30982c5317ed1c Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 17 Aug 2023 17:32:11 +0200 Subject: [PATCH] Fix a few minor compil and Coverity warnings. --- eeschema/dialogs/dialog_erc.cpp | 1 - pcbnew/footprint_libraries_utils.cpp | 4 +--- pcbnew/plugin.cpp | 12 ++++++------ pcbnew/plugins/legacy/legacy_plugin.cpp | 1 - 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp index eb61366d43..aeabed6881 100644 --- a/eeschema/dialogs/dialog_erc.cpp +++ b/eeschema/dialogs/dialog_erc.cpp @@ -476,7 +476,6 @@ void DIALOG_ERC::testErc() SCHEMATIC* sch = &m_parent->Schematic(); SCH_SCREENS screens( sch->Root() ); - ERC_SETTINGS& settings = sch->ErcSettings(); ERC_TESTER tester( sch ); { diff --git a/pcbnew/footprint_libraries_utils.cpp b/pcbnew/footprint_libraries_utils.cpp index deecb5d537..95482453b4 100644 --- a/pcbnew/footprint_libraries_utils.cpp +++ b/pcbnew/footprint_libraries_utils.cpp @@ -133,9 +133,7 @@ FOOTPRINT* FOOTPRINT_EDIT_FRAME::ImportFootprint( const wxString& aName ) if( !fn.IsOk() ) return nullptr; - FILE* fp = wxFopen( fn.GetFullPath(), wxT( "rt" ) ); - - if( !fp ) + if( !wxFileExists( fn.GetFullPath() ) ) { wxString msg = wxString::Format( _( "File '%s' not found." ), fn.GetFullPath() ); DisplayError( this, msg ); diff --git a/pcbnew/plugin.cpp b/pcbnew/plugin.cpp index ddd539099d..dd9002d801 100644 --- a/pcbnew/plugin.cpp +++ b/pcbnew/plugin.cpp @@ -67,9 +67,9 @@ bool PLUGIN::CanReadBoard( const wxString& aFileName ) const wxString fileExt = wxFileName( aFileName ).GetExt().MakeLower(); - for( const wxString& ext : exts ) + for( const std::string& ext : exts ) { - if( fileExt == ext.Lower() ) + if( fileExt == wxString( ext ).Lower() ) return true; } @@ -83,9 +83,9 @@ bool PLUGIN::CanReadFootprint( const wxString& aFileName ) const wxString fileExt = wxFileName( aFileName ).GetExt().MakeLower(); - for( const wxString& ext : exts ) + for( const std::string& ext : exts ) { - if( fileExt == ext.Lower() ) + if( fileExt == wxString( ext ).Lower() ) return true; } @@ -103,9 +103,9 @@ bool PLUGIN::CanReadFootprintLib( const wxString& aFileName ) const wxString fileExt = wxFileName( aFileName ).GetExt().MakeLower(); - for( const wxString& ext : exts ) + for( const std::string& ext : exts ) { - if( fileExt == ext.Lower() ) + if( fileExt == wxString( ext ).Lower() ) return true; } } diff --git a/pcbnew/plugins/legacy/legacy_plugin.cpp b/pcbnew/plugins/legacy/legacy_plugin.cpp index 0ca2658719..eea6dfbc36 100644 --- a/pcbnew/plugins/legacy/legacy_plugin.cpp +++ b/pcbnew/plugins/legacy/legacy_plugin.cpp @@ -437,7 +437,6 @@ bool LEGACY_PLUGIN::CanReadFootprint( const wxString& aFileName ) const FILE_LINE_READER freader( aFileName ); WHITESPACE_FILTER_READER reader( freader ); - IO_MGR::PCB_FILE_T file_type; reader.ReadLine(); char* line = reader.Line();