Coverity issue fixes.

CIDs 462497, 462496, 462495, 462494
This commit is contained in:
Wayne Stambaugh 2023-07-10 17:48:06 -04:00
parent 12be115c78
commit 415dcf82c4
3 changed files with 15 additions and 10 deletions

View File

@ -421,7 +421,7 @@ void NETLIST_EXPORTER_ALLEGRO::toAllegroPackages()
wxArrayString footprintAlt; wxArrayString footprintAlt;
wxArrayString footprintArray = sym->GetLibSymbolRef()->GetFPFilters(); wxArrayString footprintArray = sym->GetLibSymbolRef()->GetFPFilters();
for( auto fp : footprintArray ) for( const wxString& fp : footprintArray )
{ {
if( ( fp.Find( '*' ) != wxNOT_FOUND ) || ( fp.Find( '?' ) != wxNOT_FOUND ) ) if( ( fp.Find( '*' ) != wxNOT_FOUND ) || ( fp.Find( '?' ) != wxNOT_FOUND ) )
{ {
@ -491,10 +491,12 @@ void NETLIST_EXPORTER_ALLEGRO::toAllegroPackages()
fprintf( d, "PACKAGEPROP ALT_SYMBOLS '(" ); fprintf( d, "PACKAGEPROP ALT_SYMBOLS '(" );
wxString footprintAltSymbolsText; wxString footprintAltSymbolsText;
for( auto fp : footprintAlt )
for( const wxString& fp : footprintAlt )
{ {
footprintAltSymbolsText += fp + wxString( "," ); footprintAltSymbolsText += fp + wxString( "," );
} }
footprintAltSymbolsText.Truncate( footprintAltSymbolsText.Length() - 1 ); footprintAltSymbolsText.Truncate( footprintAltSymbolsText.Length() - 1 );
fprintf( d, "%s)'\n", TO_UTF8( footprintAltSymbolsText ) ); fprintf( d, "%s)'\n", TO_UTF8( footprintAltSymbolsText ) );
} }
@ -609,7 +611,7 @@ wxString NETLIST_EXPORTER_ALLEGRO::formatFunction( wxString aName, LIB_PINS aPin
out_str.Printf( wxT( "PINORDER %s " ), TO_UTF8( aName ) ); out_str.Printf( wxT( "PINORDER %s " ), TO_UTF8( aName ) );
for( wxString& pinName : pinNameList ) for( const wxString& pinName : pinNameList )
{ {
str.Printf( ",\n\t%s", TO_UTF8( pinName ) ); str.Printf( ",\n\t%s", TO_UTF8( pinName ) );
out_str += str; out_str += str;
@ -640,7 +642,7 @@ wxString NETLIST_EXPORTER_ALLEGRO::getGroupField( int aGroupIndex, const wxArray
SCH_SYMBOL* sym = ( iter->second ).first; SCH_SYMBOL* sym = ( iter->second ).first;
SCH_SHEET_PATH sheetPath = ( iter->second ).second; SCH_SHEET_PATH sheetPath = ( iter->second ).second;
for( auto field : aFieldArray ) for( const wxString& field : aFieldArray )
{ {
SCH_FIELD* fld = sym->FindField( field, true, true ); SCH_FIELD* fld = sym->FindField( field, true, true );
@ -666,7 +668,7 @@ wxString NETLIST_EXPORTER_ALLEGRO::getGroupField( int aGroupIndex, const wxArray
{ {
SCH_SYMBOL* sym = ( iter->second ).first; SCH_SYMBOL* sym = ( iter->second ).first;
for( auto field : aFieldArray ) for( const wxString& field : aFieldArray )
{ {
LIB_FIELD* fld = sym->GetLibSymbolRef()->FindField( field, true ); LIB_FIELD* fld = sym->GetLibSymbolRef()->FindField( field, true );

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 1992-2013 jp.charras at wanadoo.fr * Copyright (C) 1992-2013 jp.charras at wanadoo.fr
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -35,7 +35,8 @@ class NETLIST_EXPORTER_ALLEGRO : public NETLIST_EXPORTER_BASE
{ {
public: public:
NETLIST_EXPORTER_ALLEGRO( SCHEMATIC* aSchematic ) : NETLIST_EXPORTER_ALLEGRO( SCHEMATIC* aSchematic ) :
NETLIST_EXPORTER_BASE( aSchematic ) NETLIST_EXPORTER_BASE( aSchematic ),
m_f( nullptr )
{ {
} }

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -242,7 +242,9 @@ void PROJECT_TREE_PANE::onCreateNewDirectory( wxCommandEvent& event )
wxString full_dirname = curr_dir + wxFileName::GetPathSeparator() + new_dir; wxString full_dirname = curr_dir + wxFileName::GetPathSeparator() + new_dir;
wxMkdir( full_dirname ); if( !wxMkdir( full_dirname ) )
return;
addItemToProjectTree( full_dirname, item_data->GetId(), nullptr, false ); addItemToProjectTree( full_dirname, item_data->GetId(), nullptr, false );
} }
} }