Fix some warnings detected by PVS-STUDIO (most are not used vars)

This commit is contained in:
jean-pierre charras 2022-07-25 13:07:57 +02:00
parent 032708860b
commit 993c446fdf
34 changed files with 5 additions and 65 deletions

View File

@ -1051,7 +1051,7 @@ void RENDER_3D_OPENGL::freeAllLists()
m_triangles.clear();
for( const std::pair<const wxString&, MODEL_3D*>& entry : m_3dModelMap )
for( const std::pair<const wxString, MODEL_3D*>& entry : m_3dModelMap )
delete entry.second;
m_3dModelMap.clear();

View File

@ -423,7 +423,7 @@ void PARAM_CFG_WXSTRING_SET::SaveParam( wxConfigBase* aConfig ) const
for( const wxString& str : *m_Pt_param )
{
wxString key, data;
wxString key;
key = m_Ident;
key << i++;

View File

@ -126,8 +126,6 @@ DIALOG_PAGES_SETTINGS::~DIALOG_PAGES_SETTINGS()
bool DIALOG_PAGES_SETTINGS::TransferDataToWindow()
{
wxString msg;
// initialize page format choice box and page format list.
// The first shows translated strings, the second contains not translated strings
m_paperSizeComboBox->Clear();

View File

@ -709,13 +709,9 @@ void EDA_BASE_FRAME::LoadWindowSettings( const WINDOW_SETTINGS* aCfg )
void EDA_BASE_FRAME::SaveWindowSettings( WINDOW_SETTINGS* aCfg )
{
wxString text;
if( IsIconized() )
return;
wxString baseCfgName = ConfigBaseName();
// If the window is maximized, we use the saved window size from before it was maximized
if( IsMaximized() )
{

View File

@ -161,8 +161,6 @@ bool FILENAME_RESOLVER::createPathList()
if( !m_paths.empty() )
return true;
wxString kmod;
// add an entry for the default search path; at this point
// we cannot set a sensible default so we use an empty string.
// the user may change this later with a call to SetProjectDir()

View File

@ -373,7 +373,6 @@ void wordbreakMarkup( std::vector<std::pair<wxString, int>>* aWords,
}
else
{
wxString space( wxS( " " ) );
wxString textRun = aNode->asWxString();
wxArrayString words;

View File

@ -317,7 +317,6 @@ bool GERBER_PLOTTER::StartPlot()
bool GERBER_PLOTTER::EndPlot()
{
char line[1024];
wxString msg;
wxASSERT( m_outputFile );

View File

@ -765,7 +765,6 @@ void PS_PLOTTER::PenTo( const VECTOR2I& pos, char plume )
bool PS_PLOTTER::StartPlot()
{
wxASSERT( m_outputFile );
wxString msg;
static const char* PSMacro[] =
{

View File

@ -714,7 +714,6 @@ void SVG_PLOTTER::PenTo( const VECTOR2I& pos, char plume )
bool SVG_PLOTTER::StartPlot()
{
wxASSERT( m_outputFile );
wxString msg;
static const char* header[] =
{

View File

@ -455,7 +455,6 @@ bool NET_SETTINGS::ParseBusGroup( const wxString& aGroup, wxString* aName,
size_t groupLen = aGroup.length();
size_t i = 0;
wxString prefix;
wxString suffix;
wxString tmp;
int braceNesting = 0;

View File

@ -1120,8 +1120,6 @@ bool SETTINGS_MANAGER::BackupProject( REPORTER& aReporter ) const
target.SetName( fileName );
target.SetExt( ArchiveFileExtension );
wxDir dir( target.GetPath() );
if( !target.DirExists() && !wxMkdir( target.GetPath() ) )
{
wxLogTrace( traceSettings, wxT( "Could not create project backup path %s" ), target.GetPath() );

View File

@ -823,8 +823,6 @@ bool TOOL_MANAGER::dispatchActivation( const TOOL_EVENT& aEvent )
if( aEvent.IsActivate() )
{
wxString cmdStr( *aEvent.GetCommandStr() );
auto tool = m_toolNameIndex.find( *aEvent.GetCommandStr() );
if( tool != m_toolNameIndex.end() )

View File

@ -201,7 +201,6 @@ public:
wxString escapedNetName;
wxString remainingName;
int selection = m_listBox->GetSelection();
wxString prefix = CREATE_NET;
if( selection >= 0 )
selectedNetName = m_listBox->GetString( (unsigned) selection );

View File

@ -188,14 +188,13 @@ void UNIT_BINDER::onKillFocus( wxFocusEvent& aEvent )
if( m_eval.Process( textEntry->GetValue() ) )
{
textEntry->GetSelection( &m_selStart, &m_selEnd );
wxString sel = textEntry->GetStringSelection();
textEntry->ChangeValue( m_eval.Result() );
#ifdef __WXGTK__
// Manually copy the selected text to the primary selection clipboard
if( wxTheClipboard->Open() )
{
wxString sel = textEntry->GetStringSelection();
bool clipTarget = wxTheClipboard->IsUsingPrimarySelection();
wxTheClipboard->UsePrimarySelection( true );
wxTheClipboard->SetData( new wxTextDataObject( sel ) );

View File

@ -2419,7 +2419,6 @@ bool CONNECTION_GRAPH::ercCheckBusToNetConflicts( const CONNECTION_SUBGRAPH* aSu
bool CONNECTION_GRAPH::ercCheckBusToBusConflicts( const CONNECTION_SUBGRAPH* aSubgraph )
{
wxString msg;
const SCH_SHEET_PATH& sheet = aSubgraph->m_sheet;
SCH_SCREEN* screen = sheet.LastScreen();
@ -2587,7 +2586,6 @@ bool CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts( const CONNECTION_SUBGRAPH
bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph )
{
ERC_SETTINGS& settings = m_schematic->ErcSettings();
wxString msg;
const SCH_SHEET_PATH& sheet = aSubgraph->m_sheet;
SCH_SCREEN* screen = sheet.LastScreen();
bool ok = true;

View File

@ -613,7 +613,6 @@ void DIALOG_ERC::OnERCItemRClick( wxDataViewEvent& aEvent )
std::shared_ptr<RC_ITEM> rcItem = node->m_RcItem;
wxString listName;
wxMenu menu;
wxString msg;
switch( settings.GetSeverity( rcItem->GetErrorCode() ) )
{

View File

@ -552,8 +552,6 @@ bool NETLIST_DIALOG::FilenamePrms( NETLIST_TYPE_ID aType, wxString * aExt, wxStr
void NETLIST_DIALOG::WriteCurrentNetlistSetup()
{
wxString msg;
NetlistUpdateOpt();
EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );

View File

@ -183,7 +183,6 @@ bool DIALOG_SHEET_PROPERTIES::TransferDataToWindow()
bool DIALOG_SHEET_PROPERTIES::Validate()
{
wxString msg;
LIB_ID id;
if( !m_grid->CommitPendingChanges() || !m_grid->Validate() )

View File

@ -275,8 +275,6 @@ bool DIALOG_SIM_SETTINGS::TransferDataFromWindow()
}
else
{
wxString extendedMsg;
if( m_simCommand.IsEmpty() )
{
KIDIALOG dlg( this, _( "No valid simulation is configured." ), _( "Warning" ),

View File

@ -578,7 +578,6 @@ void DIALOG_SYMBOL_PROPERTIES::OnCancelButtonClick( wxCommandEvent& event )
bool DIALOG_SYMBOL_PROPERTIES::Validate()
{
wxString msg;
LIB_ID id;
if( !m_fieldsGrid->CommitPendingChanges() || !m_fieldsGrid->Validate() )
@ -635,8 +634,6 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
// the schematic file.
currentScreen->Remove( m_symbol );
wxString msg;
// save old cmp in undo list if not already in edit, or moving ...
if( m_symbol->GetEditFlags() == 0 )
GetParent()->SaveCopyInUndoList( currentScreen, m_symbol, UNDO_REDO::CHANGED, false );

View File

@ -339,7 +339,6 @@ int ERC_TESTER::TestMultiunitFootprints()
SCH_SHEET_LIST sheets = m_schematic->GetSheets();
int errors = 0;
std::map<wxString, LIB_ID> footprints;
SCH_MULTI_UNIT_REFERENCE_MAP refMap;
sheets.GetMultiUnitSymbols( refMap, true );
@ -589,7 +588,6 @@ int ERC_TESTER::TestMultUnitPinConflicts()
for( const std::pair<NET_NAME_CODE, std::vector<CONNECTION_SUBGRAPH*>> net : nets )
{
const wxString& netName = net.first.first;
std::vector<SCH_PIN*> pins;
for( CONNECTION_SUBGRAPH* subgraph : net.second )
{
@ -647,8 +645,6 @@ int ERC_TESTER::TestSimilarLabels()
for( const std::pair<NET_NAME_CODE, std::vector<CONNECTION_SUBGRAPH*>> net : nets )
{
std::vector<SCH_PIN*> pins;
for( CONNECTION_SUBGRAPH* subgraph : net.second )
{
for( EDA_ITEM* item : subgraph->m_items )

View File

@ -1832,7 +1832,6 @@ void SCH_EDIT_FRAME::onSize( wxSizeEvent& aEvent )
void SCH_EDIT_FRAME::SaveSymbolToSchematic( const LIB_SYMBOL& aSymbol,
const KIID& aSchematicSymbolUUID )
{
wxString msg;
bool appendToUndo = false;
SCH_SHEET_PATH sheetPath;

View File

@ -736,7 +736,7 @@ void SCH_LINE::GetSelectedPoints( std::vector<VECTOR2I>& aPoints ) const
wxString SCH_LINE::GetSelectMenuText( EDA_UNITS aUnits ) const
{
wxString txtfmt, orient;
wxString txtfmt;
if( m_start.x == m_end.x )
{

View File

@ -701,8 +701,6 @@ void SCH_SEXPR_PARSER::parsePinNames( std::unique_ptr<LIB_SYMBOL>& aSymbol )
wxCHECK_RET( CurTok() == T_pin_names,
"Cannot parse " + GetTokenString( CurTok() ) + " as a pin_name token." );
wxString error;
T token = NextTok();
if( token == T_LEFT )
@ -736,7 +734,6 @@ LIB_FIELD* SCH_SEXPR_PARSER::parseProperty( std::unique_ptr<LIB_SYMBOL>& aSymbol
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a property." ) );
wxCHECK( aSymbol, nullptr );
wxString error;
wxString name;
wxString value;
std::unique_ptr<LIB_FIELD> field = std::make_unique<LIB_FIELD>( aSymbol.get(),
@ -1567,7 +1564,6 @@ LIB_TEXT* SCH_SEXPR_PARSER::parseText()
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a text token." ) );
T token;
wxString tmp;
std::unique_ptr<LIB_TEXT> text = std::make_unique<LIB_TEXT>( nullptr );
text->SetUnit( m_unit );
@ -2423,7 +2419,6 @@ SCH_SYMBOL* SCH_SEXPR_PARSER::parseSchematicSymbol()
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a symbol." ) );
T token;
wxString tmp;
wxString libName;
SCH_FIELD* field;
std::unique_ptr<SCH_SYMBOL> symbol = std::make_unique<SCH_SYMBOL>();

View File

@ -628,9 +628,6 @@ void SCH_SEXPR_PLUGIN::saveSymbol( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH* aSheetPa
wxCHECK_RET( aSymbol != nullptr && m_out != nullptr, "" );
std::string libName;
wxArrayString reference_fields;
static wxString delimiters( wxT( " " ) );
wxString symbol_name = aSymbol->GetLibId().Format();
@ -988,8 +985,6 @@ void SCH_SEXPR_PLUGIN::saveShape( SCH_SHAPE* aShape, int aNestLevel )
{
wxCHECK_RET( aShape != nullptr && m_out != nullptr, "" );
wxString lineType;
switch( aShape->GetShape() )
{
case SHAPE_T::ARC:

View File

@ -1034,7 +1034,6 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter, bool aBackground ) const
if( aBackground && !aPlotter->GetColorMode() )
return;
wxString msg;
VECTOR2I pos;
auto* settings = dynamic_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
bool override = settings ? settings->m_OverrideItemColors : false;

View File

@ -812,7 +812,6 @@ void SCH_SYMBOL::UpdateFields( const SCH_SHEET_PATH* aPath, bool aUpdateStyle, b
{
if( m_part )
{
wxString symbolName;
std::vector<LIB_FIELD*> fields;
m_part->GetFields( fields );
@ -1125,8 +1124,6 @@ bool SCH_SYMBOL::AddSheetPathReferenceEntryIfMissing( const KIID_PATH& aSheetPat
// a empty sheet path is illegal:
wxCHECK( aSheetPath.size() > 0, false );
wxString reference_path;
for( const SYMBOL_INSTANCE_REFERENCE& instance : m_instanceReferences )
{
// if aSheetPath is found, nothing to do:

View File

@ -426,8 +426,6 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter, bool aBackground ) const
if( aBackground )
return;
static std::vector<VECTOR2I> s_poly;
RENDER_SETTINGS* settings = aPlotter->RenderSettings();
SCH_CONNECTION* connection = Connection();
int layer = ( connection && connection->IsBus() ) ? LAYER_BUS : m_layer;

View File

@ -58,7 +58,6 @@ SYMBOL_SAVEAS_TYPE SYMBOL_LEGACYFILEDLG_SAVE_AS::m_option = SYMBOL_SAVEAS_TYPE::
void SYMBOL_EDIT_FRAME::updateTitle()
{
wxString lib = GetCurLib();
wxString title;
if( GetCurSymbol() && IsSymbolFromSchematic() )
@ -299,7 +298,6 @@ bool SYMBOL_EDIT_FRAME::LoadSymbolFromCurrentLib( const wxString& aAliasName, in
bool SYMBOL_EDIT_FRAME::LoadOneLibrarySymbolAux( LIB_SYMBOL* aEntry, const wxString& aLibrary,
int aUnit, int aConvert )
{
wxString msg, rootName;
bool rebuildMenuAndToolbar = false;
if( !aEntry || aLibrary.empty() )

View File

@ -113,7 +113,7 @@ void SYMBOL_EDIT_FRAME::ImportSymbol()
void SYMBOL_EDIT_FRAME::ExportSymbol()
{
wxString msg, title;
wxString msg;
LIB_SYMBOL* symbol = getTargetSymbol();
if( !symbol )

View File

@ -477,8 +477,6 @@ void SYMBOL_LIBS::LoadAllLibraries( PROJECT* aProject, bool aShowProgress )
lib_dialog.Show();
}
wxString progress_message;
for( unsigned i = 0; i < lib_names.GetCount(); ++i )
{
if( aShowProgress )

View File

@ -66,7 +66,6 @@ bool BACK_ANNOTATE::BackAnnotateSymbols( const std::string& aNetlist )
{
m_changesCount = 0;
m_appendUndo = false;
wxString msg;
if( !m_matchByReference && !m_processValues && !m_processFootprints && !m_processReferences
&& !m_processNetNames )

View File

@ -1477,7 +1477,6 @@ int EE_SELECTION_TOOL::SelectConnection( const TOOL_EVENT& aEvent )
return 0;
SCH_LINE* line = (SCH_LINE*) m_selection.Front();
EDA_ITEMS items;
unsigned done = false;
m_frame->GetScreen()->ClearDrawingState();

View File

@ -518,8 +518,6 @@ int SYMBOL_EDITOR_CONTROL::ExportView( const TOOL_EVENT& aEvent )
return 0;
}
wxString file_ext = wxT( "png" );
wxString mask = wxT( "*." ) + file_ext;
wxFileName fn( symbol->GetName() );
fn.SetExt( "png" );
@ -558,7 +556,6 @@ int SYMBOL_EDITOR_CONTROL::ExportSymbolAsSVG( const TOOL_EVENT& aEvent )
return 0;
}
wxString file_ext = SVGFileExtension;
wxFileName fn( symbol->GetName() );
fn.SetExt( SVGFileExtension );