Coverity warning fixes.
This commit is contained in:
parent
5756a7a0af
commit
bdee545841
|
@ -1203,6 +1203,9 @@ void TOOL_MANAGER::setActiveState( TOOL_STATE* aState )
|
||||||
bool TOOL_MANAGER::IsToolActive( TOOL_ID aId ) const
|
bool TOOL_MANAGER::IsToolActive( TOOL_ID aId ) const
|
||||||
{
|
{
|
||||||
auto it = m_toolIdIndex.find( aId );
|
auto it = m_toolIdIndex.find( aId );
|
||||||
|
|
||||||
|
wxCHECK( it != m_toolIdIndex.end(), false );
|
||||||
|
|
||||||
return !it->second->idle;
|
return !it->second->idle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,10 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
NET_NAVIGATOR_ITEM_DATA() {}
|
NET_NAVIGATOR_ITEM_DATA() :
|
||||||
|
m_item( nullptr )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
SCH_SHEET_PATH& GetSheetPath() { return m_sheetPath; }
|
SCH_SHEET_PATH& GetSheetPath() { return m_sheetPath; }
|
||||||
const SCH_ITEM* GetItem() const { return m_item; }
|
const SCH_ITEM* GetItem() const { return m_item; }
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2020 Roberto Fernandez Bautista <roberto.fer.bau@gmail.com>
|
* Copyright (C) 2020 Roberto Fernandez Bautista <roberto.fer.bau@gmail.com>
|
||||||
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
@ -39,7 +39,8 @@ class SCH_SCREEN;
|
||||||
class CADSTAR_SCH_ARCHIVE_PLUGIN : public SCH_PLUGIN
|
class CADSTAR_SCH_ARCHIVE_PLUGIN : public SCH_PLUGIN
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CADSTAR_SCH_ARCHIVE_PLUGIN()
|
CADSTAR_SCH_ARCHIVE_PLUGIN() :
|
||||||
|
m_cacheTimestamp( 0 )
|
||||||
{
|
{
|
||||||
m_reporter = &WXLOG_REPORTER::GetInstance();
|
m_reporter = &WXLOG_REPORTER::GetInstance();
|
||||||
m_progressReporter = nullptr;
|
m_progressReporter = nullptr;
|
||||||
|
|
|
@ -482,6 +482,8 @@ LTSPICE_SCHEMATIC::LT_SYMBOL LTSPICE_SCHEMATIC::SymbolBuilder( const wxString& a
|
||||||
int lineNumber = 1;
|
int lineNumber = 1;
|
||||||
|
|
||||||
lt_symbol.Name = aAscFileName;
|
lt_symbol.Name = aAscFileName;
|
||||||
|
lt_symbol.SymbolType = LTSPICE_SCHEMATIC::SYMBOLTYPE::CELL;
|
||||||
|
lt_symbol.SymbolOrientation = LTSPICE_SCHEMATIC::ORIENTATION::R0;
|
||||||
|
|
||||||
for( wxString line : wxSplit( aAsyFileContent, '\n' ) )
|
for( wxString line : wxSplit( aAsyFileContent, '\n' ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -531,7 +531,9 @@ SIMULATOR_FRAME::SIMULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
NGSPICE_SIMULATOR_SETTINGS* settings =
|
NGSPICE_SIMULATOR_SETTINGS* settings =
|
||||||
dynamic_cast<NGSPICE_SIMULATOR_SETTINGS*>( m_simulator->Settings().get() );
|
dynamic_cast<NGSPICE_SIMULATOR_SETTINGS*>( m_simulator->Settings().get() );
|
||||||
|
|
||||||
if( settings->GetWorkbookFilename().IsEmpty() )
|
wxCHECK2( settings, /* do nothing in release builds*/ );
|
||||||
|
|
||||||
|
if( settings && settings->GetWorkbookFilename().IsEmpty() )
|
||||||
settings->SetModelMode( NGSPICE_MODEL_MODE::LT_PSPICE );
|
settings->SetModelMode( NGSPICE_MODEL_MODE::LT_PSPICE );
|
||||||
|
|
||||||
m_simulator->Init();
|
m_simulator->Init();
|
||||||
|
|
|
@ -656,6 +656,8 @@ bool SYMBOL_LIB_TABLE::LoadGlobalTable( SYMBOL_LIB_TABLE& aTable )
|
||||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||||
KICAD_SETTINGS* settings = mgr.GetAppSettings<KICAD_SETTINGS>();
|
KICAD_SETTINGS* settings = mgr.GetAppSettings<KICAD_SETTINGS>();
|
||||||
|
|
||||||
|
wxCHECK( settings, false );
|
||||||
|
|
||||||
wxString packagesPath = Pgm().GetLocalEnvVariables().at( wxT( "KICAD7_3RD_PARTY" ) ).GetValue();
|
wxString packagesPath = Pgm().GetLocalEnvVariables().at( wxT( "KICAD7_3RD_PARTY" ) ).GetValue();
|
||||||
|
|
||||||
if( settings->m_PcmLibAutoAdd )
|
if( settings->m_PcmLibAutoAdd )
|
||||||
|
@ -688,7 +690,13 @@ bool SYMBOL_LIB_TABLE::LoadGlobalTable( SYMBOL_LIB_TABLE& aTable )
|
||||||
}
|
}
|
||||||
|
|
||||||
for( const wxString& nickName : to_remove )
|
for( const wxString& nickName : to_remove )
|
||||||
aTable.RemoveRow( aTable.FindRow( nickName ) );
|
{
|
||||||
|
SYMBOL_LIB_TABLE_ROW* row = aTable.FindRow( nickName );
|
||||||
|
|
||||||
|
wxCHECK2( row, continue );
|
||||||
|
|
||||||
|
aTable.RemoveRow( row );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return tableExists;
|
return tableExists;
|
||||||
|
|
|
@ -685,6 +685,8 @@ bool SYMBOL_VIEWER_FRAME::ReCreateLibList()
|
||||||
|
|
||||||
SYMBOL_LIB_TABLE_ROW* row = libTable->FindRow( aLib );
|
SYMBOL_LIB_TABLE_ROW* row = libTable->FindRow( aLib );
|
||||||
|
|
||||||
|
wxCHECK( row, /* void */ );
|
||||||
|
|
||||||
if( !row->GetIsVisible() )
|
if( !row->GetIsVisible() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1324,6 +1326,9 @@ void SYMBOL_VIEWER_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
|
||||||
{
|
{
|
||||||
SYMBOL_LIB_TABLE* tbl = Prj().SchSymbolLibTable();
|
SYMBOL_LIB_TABLE* tbl = Prj().SchSymbolLibTable();
|
||||||
LIB_SYMBOL* symbol = GetSelectedSymbol();
|
LIB_SYMBOL* symbol = GetSelectedSymbol();
|
||||||
|
|
||||||
|
wxCHECK2( tbl && symbol, break );
|
||||||
|
|
||||||
const SYMBOL_LIB_TABLE_ROW* row = tbl->FindRow( symbol->GetLibId().GetLibNickname() );
|
const SYMBOL_LIB_TABLE_ROW* row = tbl->FindRow( symbol->GetLibId().GetLibNickname() );
|
||||||
|
|
||||||
if( !row )
|
if( !row )
|
||||||
|
@ -1331,17 +1336,15 @@ void SYMBOL_VIEWER_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
|
||||||
|
|
||||||
wxString libfullname = row->GetFullURI( true );
|
wxString libfullname = row->GetFullURI( true );
|
||||||
|
|
||||||
if( symbol )
|
wxString lib( mail.GetPayload() );
|
||||||
{
|
wxLogTrace( "KICAD_LIB_WATCH", "Received refresh symbol request for %s, current symbols "
|
||||||
wxString lib( mail.GetPayload() );
|
"is %s", lib, libfullname );
|
||||||
wxLogTrace( "KICAD_LIB_WATCH", "Received refresh symbol request for %s, current symbols is %s", lib, libfullname );
|
|
||||||
|
|
||||||
if( lib == libfullname )
|
if( lib == libfullname )
|
||||||
{
|
{
|
||||||
wxLogTrace( "KICAD_LIB_WATCH", "Refreshing symbol %s", symbol->GetName() );
|
wxLogTrace( "KICAD_LIB_WATCH", "Refreshing symbol %s", symbol->GetName() );
|
||||||
updatePreviewSymbol();
|
updatePreviewSymbol();
|
||||||
GetCanvas()->GetView()->UpdateAllItems( KIGFX::ALL);
|
GetCanvas()->GetView()->UpdateAllItems( KIGFX::ALL );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2022-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
@ -211,6 +211,9 @@ int TEXT_SEARCH_HANDLER::Search( const wxString& aQuery )
|
||||||
if( item->Type() == SCH_TEXT_T )
|
if( item->Type() == SCH_TEXT_T )
|
||||||
{
|
{
|
||||||
SCH_TEXT* text = dynamic_cast<SCH_TEXT*>( item );
|
SCH_TEXT* text = dynamic_cast<SCH_TEXT*>( item );
|
||||||
|
|
||||||
|
wxCHECK( text, false );
|
||||||
|
|
||||||
if( text->Matches( frp, sheet ) )
|
if( text->Matches( frp, sheet ) )
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -219,6 +222,9 @@ int TEXT_SEARCH_HANDLER::Search( const wxString& aQuery )
|
||||||
else if( item->Type() == SCH_TEXTBOX_T )
|
else if( item->Type() == SCH_TEXTBOX_T )
|
||||||
{
|
{
|
||||||
SCH_TEXTBOX* text = dynamic_cast<SCH_TEXTBOX*>( item );
|
SCH_TEXTBOX* text = dynamic_cast<SCH_TEXTBOX*>( item );
|
||||||
|
|
||||||
|
wxCHECK( text, false );
|
||||||
|
|
||||||
if( text->Matches( frp, sheet ) )
|
if( text->Matches( frp, sheet ) )
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -306,6 +312,9 @@ int LABEL_SEARCH_HANDLER::Search( const wxString& aQuery )
|
||||||
|| item->Type() == SCH_HIER_LABEL_T )
|
|| item->Type() == SCH_HIER_LABEL_T )
|
||||||
{
|
{
|
||||||
SCH_LABEL_BASE* lbl = dynamic_cast<SCH_LABEL_BASE*>( item );
|
SCH_LABEL_BASE* lbl = dynamic_cast<SCH_LABEL_BASE*>( item );
|
||||||
|
|
||||||
|
wxCHECK( lbl, false );
|
||||||
|
|
||||||
if( lbl->Matches( frp, sheet ) )
|
if( lbl->Matches( frp, sheet ) )
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -371,7 +371,7 @@ void PCB_BASE_FRAME::FocusOnItems( std::vector<BOARD_ITEM*> aItems, PCB_LAYER_ID
|
||||||
{
|
{
|
||||||
viewportPoly.BooleanSubtract( dialogPoly, SHAPE_POLY_SET::PM_FAST );
|
viewportPoly.BooleanSubtract( dialogPoly, SHAPE_POLY_SET::PM_FAST );
|
||||||
}
|
}
|
||||||
catch( const ClipperLib::clipperException& exc )
|
catch( const std::exception& exc )
|
||||||
{
|
{
|
||||||
// This may be overkill and could be an assertion but we are more likely to
|
// This may be overkill and could be an assertion but we are more likely to
|
||||||
// find any clipper errors this way.
|
// find any clipper errors this way.
|
||||||
|
@ -422,7 +422,7 @@ void PCB_BASE_FRAME::FocusOnItems( std::vector<BOARD_ITEM*> aItems, PCB_LAYER_ID
|
||||||
{
|
{
|
||||||
itemPoly = static_cast<FOOTPRINT*>( item )->GetBoundingHull();
|
itemPoly = static_cast<FOOTPRINT*>( item )->GetBoundingHull();
|
||||||
}
|
}
|
||||||
catch( const ClipperLib::clipperException& exc )
|
catch( const std::exception& exc )
|
||||||
{
|
{
|
||||||
// This may be overkill and could be an assertion but we are more likely to
|
// This may be overkill and could be an assertion but we are more likely to
|
||||||
// find any clipper errors this way.
|
// find any clipper errors this way.
|
||||||
|
@ -490,7 +490,7 @@ void PCB_BASE_FRAME::FocusOnItems( std::vector<BOARD_ITEM*> aItems, PCB_LAYER_ID
|
||||||
{
|
{
|
||||||
clippedPoly.BooleanIntersection( itemPoly, viewportPoly, SHAPE_POLY_SET::PM_FAST );
|
clippedPoly.BooleanIntersection( itemPoly, viewportPoly, SHAPE_POLY_SET::PM_FAST );
|
||||||
}
|
}
|
||||||
catch( const ClipperLib::clipperException& exc )
|
catch( const std::exception& exc )
|
||||||
{
|
{
|
||||||
// This may be overkill and could be an assertion but we are more likely to
|
// This may be overkill and could be an assertion but we are more likely to
|
||||||
// find any clipper errors this way.
|
// find any clipper errors this way.
|
||||||
|
@ -517,7 +517,7 @@ void PCB_BASE_FRAME::FocusOnItems( std::vector<BOARD_ITEM*> aItems, PCB_LAYER_ID
|
||||||
{
|
{
|
||||||
itemPoly.Deflate( step, SHAPE_POLY_SET::ALLOW_ACUTE_CORNERS, ARC_LOW_DEF );
|
itemPoly.Deflate( step, SHAPE_POLY_SET::ALLOW_ACUTE_CORNERS, ARC_LOW_DEF );
|
||||||
}
|
}
|
||||||
catch( const ClipperLib::clipperException& exc )
|
catch( const std::exception& exc )
|
||||||
{
|
{
|
||||||
// This may be overkill and could be an assertion but we are more likely to
|
// This may be overkill and could be an assertion but we are more likely to
|
||||||
// find any clipper errors this way.
|
// find any clipper errors this way.
|
||||||
|
@ -1251,4 +1251,4 @@ void PCB_BASE_FRAME::OnFpChangeDebounceTimer( wxTimerEvent& aEvent )
|
||||||
DisplayError( this, ioe.What() );
|
DisplayError( this, ioe.What() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -340,7 +340,7 @@ std::shared_ptr<SHAPE> PCB_SHAPE::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHI
|
||||||
void PCB_SHAPE::swapData( BOARD_ITEM* aImage )
|
void PCB_SHAPE::swapData( BOARD_ITEM* aImage )
|
||||||
{
|
{
|
||||||
PCB_SHAPE* image = dynamic_cast<PCB_SHAPE*>( aImage );
|
PCB_SHAPE* image = dynamic_cast<PCB_SHAPE*>( aImage );
|
||||||
assert( image );
|
wxCHECK( image, /* void */ );
|
||||||
|
|
||||||
SwapShape( image );
|
SwapShape( image );
|
||||||
|
|
||||||
|
|
|
@ -228,6 +228,10 @@ void TEARDROP_MANAGER::computeCurvedForRoundShape( const TEARDROP_PARAMETERS& aP
|
||||||
Vpercent *= (double) aParams.m_TdMaxWidth / td_height;
|
Vpercent *= (double) aParams.m_TdMaxWidth / td_height;
|
||||||
|
|
||||||
int radius = GetWidth( aOther ) / 2;
|
int radius = GetWidth( aOther ) / 2;
|
||||||
|
|
||||||
|
// Don't divide by zero. No good can come of that.
|
||||||
|
wxCHECK2( radius != 0, radius = 1 );
|
||||||
|
|
||||||
double minVpercent = double( aTrackHalfWidth ) / radius;
|
double minVpercent = double( aTrackHalfWidth ) / radius;
|
||||||
double weaken = (Vpercent - minVpercent) / ( 1 - minVpercent ) / radius;
|
double weaken = (Vpercent - minVpercent) / ( 1 - minVpercent ) / radius;
|
||||||
|
|
||||||
|
|
|
@ -755,7 +755,7 @@ bool PCB_SELECTION_TOOL::selectPoint( const VECTOR2I& aWhere, bool aOnDrag,
|
||||||
{
|
{
|
||||||
GuessSelectionCandidates( collector, aWhere );
|
GuessSelectionCandidates( collector, aWhere );
|
||||||
}
|
}
|
||||||
catch( const ClipperLib::clipperException& exc )
|
catch( const std::exception& exc )
|
||||||
{
|
{
|
||||||
wxLogWarning( wxS( "Exception \"%s\" occurred attemption to guess selection "
|
wxLogWarning( wxS( "Exception \"%s\" occurred attemption to guess selection "
|
||||||
"candidates." ), exc.what() );
|
"candidates." ), exc.what() );
|
||||||
|
@ -2795,7 +2795,7 @@ int PCB_SELECTION_TOOL::hitTestDistance( const VECTOR2I& aWhere, BOARD_ITEM* aIt
|
||||||
{
|
{
|
||||||
footprint->GetBoundingHull().Collide( loc, aMaxDistance, &distance );
|
footprint->GetBoundingHull().Collide( loc, aMaxDistance, &distance );
|
||||||
}
|
}
|
||||||
catch( const ClipperLib::clipperException& exc )
|
catch( const std::exception& exc )
|
||||||
{
|
{
|
||||||
// This may be overkill and could be an assertion but we are more likely to find
|
// This may be overkill and could be an assertion but we are more likely to find
|
||||||
// any clipper errors this way.
|
// any clipper errors this way.
|
||||||
|
@ -2964,7 +2964,7 @@ void PCB_SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector
|
||||||
{
|
{
|
||||||
area = FOOTPRINT::GetCoverageArea( item, aCollector );
|
area = FOOTPRINT::GetCoverageArea( item, aCollector );
|
||||||
}
|
}
|
||||||
catch( const ClipperLib::clipperException& e )
|
catch( const std::exception& e )
|
||||||
{
|
{
|
||||||
wxLogError( wxT( "A clipper exception %s was detected." ), e.what() );
|
wxLogError( wxT( "A clipper exception %s was detected." ), e.what() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,7 +243,7 @@ public:
|
||||||
bool IsKeepout( const PNS::ITEM* aA, const PNS::ITEM* aB ) override { return false; }
|
bool IsKeepout( const PNS::ITEM* aA, const PNS::ITEM* aB ) override { return false; }
|
||||||
|
|
||||||
void AddMockRule( PNS::CONSTRAINT_TYPE aType, const PNS::ITEM* aItemA, const PNS::ITEM* aItemB,
|
void AddMockRule( PNS::CONSTRAINT_TYPE aType, const PNS::ITEM* aItemA, const PNS::ITEM* aItemB,
|
||||||
PNS::CONSTRAINT aConstraint )
|
PNS::CONSTRAINT& aConstraint )
|
||||||
{
|
{
|
||||||
ITEM_KEY key;
|
ITEM_KEY key;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue