A few Coverity fixes.

This commit is contained in:
jean-pierre charras 2020-03-30 09:24:56 +02:00
parent 34aee50ae1
commit 6e47f147aa
11 changed files with 36 additions and 7 deletions

View File

@ -32,6 +32,10 @@ const int cvpcbSchemaVersion = 0;
CVPCB_SETTINGS::CVPCB_SETTINGS() : CVPCB_SETTINGS::CVPCB_SETTINGS() :
APP_SETTINGS_BASE( "cvpcb", cvpcbSchemaVersion ) APP_SETTINGS_BASE( "cvpcb", cvpcbSchemaVersion )
{ {
// Make Coverity happy:
m_FilterFootprint = 0;
// Init settings:
m_params.emplace_back( new PARAM<int>( "filter_footprint", &m_FilterFootprint, 0 ) ); m_params.emplace_back( new PARAM<int>( "filter_footprint", &m_FilterFootprint, 0 ) );
addParamsForWindow( &m_FootprintViewer, "footprint_viewer" ); addParamsForWindow( &m_FootprintViewer, "footprint_viewer" );

View File

@ -134,9 +134,6 @@ public:
m_allow_rejustify = false; m_allow_rejustify = false;
m_align_to_grid = true; m_align_to_grid = true;
m_allow_rejustify = false;
m_align_to_grid = true;
if( cfg ) if( cfg )
{ {
m_allow_rejustify = cfg->m_AutoplaceFields.allow_rejustify; m_allow_rejustify = cfg->m_AutoplaceFields.allow_rejustify;

View File

@ -35,6 +35,10 @@ LIBEDIT_SETTINGS::LIBEDIT_SETTINGS() : APP_SETTINGS_BASE( "libedit", libeditSche
m_Defaults(), m_Repeat(), m_ShowPinElectricalType( true ), m_LibWidth(), m_Defaults(), m_Repeat(), m_ShowPinElectricalType( true ), m_LibWidth(),
m_EditComponentVisibleColumns() m_EditComponentVisibleColumns()
{ {
// Make Coverity happy
m_UseEeschemaColorSettings = true;;
// Init settings:
SetLegacyFilename( "eeschema" ); SetLegacyFilename( "eeschema" );
m_params.emplace_back( new PARAM<int>( "defaults.line_width", &m_Defaults.line_width, 6 ) ); m_params.emplace_back( new PARAM<int>( "defaults.line_width", &m_Defaults.line_width, 6 ) );

View File

@ -36,6 +36,10 @@ const int gerbviewSchemaVersion = 0;
GERBVIEW_SETTINGS::GERBVIEW_SETTINGS() : APP_SETTINGS_BASE( "gerbview", gerbviewSchemaVersion ) GERBVIEW_SETTINGS::GERBVIEW_SETTINGS() : APP_SETTINGS_BASE( "gerbview", gerbviewSchemaVersion )
{ {
// Make Coverity happy
m_BoardLayersCount = 2;
// Init settings:
m_params.emplace_back( new PARAM<bool>( "appearance.show_border_and_titleblock", m_params.emplace_back( new PARAM<bool>( "appearance.show_border_and_titleblock",
&m_Appearance.show_border_and_titleblock, false ) ); &m_Appearance.show_border_and_titleblock, false ) );

View File

@ -33,6 +33,15 @@ const int plEditorSchemaVersion = 0;
PL_EDITOR_SETTINGS::PL_EDITOR_SETTINGS() : PL_EDITOR_SETTINGS::PL_EDITOR_SETTINGS() :
APP_SETTINGS_BASE( "pl_editor", plEditorSchemaVersion ) APP_SETTINGS_BASE( "pl_editor", plEditorSchemaVersion )
{ {
// Make Coverity happy:
m_CornerOrigin = 0;
m_PropertiesFrameWidth = 150;
m_LastCustomWidth = 17000;
m_LastCustomHeight = 11000;
m_LastWasPortrait = false;
m_BlackBackground = false;
// Build settings:
m_params.emplace_back( m_params.emplace_back(
new PARAM<int>( "properties_frame_width", &m_PropertiesFrameWidth, 150 ) ); new PARAM<int>( "properties_frame_width", &m_PropertiesFrameWidth, 150 ) );

View File

@ -35,6 +35,12 @@ const int pcbCalculatorSchemaVersion = 0;
PCB_CALCULATOR_SETTINGS::PCB_CALCULATOR_SETTINGS() : PCB_CALCULATOR_SETTINGS::PCB_CALCULATOR_SETTINGS() :
APP_SETTINGS_BASE( "pcb_calculator", pcbCalculatorSchemaVersion ) APP_SETTINGS_BASE( "pcb_calculator", pcbCalculatorSchemaVersion )
{ {
// Make Coverity happy:
m_BoardClassUnits = 0;
m_ColorCodeTolerance = 0;
m_LastPage = 0;
// Build settings:
m_params.emplace_back( new PARAM<int>( "board_class_units", &m_BoardClassUnits, 0 ) ); m_params.emplace_back( new PARAM<int>( "board_class_units", &m_BoardClassUnits, 0 ) );
m_params.emplace_back( new PARAM<int>( "color_code_tolerance", &m_ColorCodeTolerance, 0 ) ); m_params.emplace_back( new PARAM<int>( "color_code_tolerance", &m_ColorCodeTolerance, 0 ) );

View File

@ -714,7 +714,7 @@ void FOOTPRINT_VIEWER_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
void FOOTPRINT_VIEWER_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg ) void FOOTPRINT_VIEWER_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
{ {
auto cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg ); auto cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
wxASSERT( cfg ); wxCHECK( cfg, /*void*/ );
// We don't want to store anything other than the window settings // We don't want to store anything other than the window settings
EDA_BASE_FRAME::SaveSettings( cfg ); EDA_BASE_FRAME::SaveSettings( cfg );
@ -727,7 +727,7 @@ void FOOTPRINT_VIEWER_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
WINDOW_SETTINGS* FOOTPRINT_VIEWER_FRAME::GetWindowSettings( APP_SETTINGS_BASE* aCfg ) WINDOW_SETTINGS* FOOTPRINT_VIEWER_FRAME::GetWindowSettings( APP_SETTINGS_BASE* aCfg )
{ {
auto cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg ); auto cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
wxASSERT( cfg ); wxCHECK_MSG( cfg, nullptr, "config not existing" );
return &cfg->m_FootprintViewer; return &cfg->m_FootprintViewer;
} }

View File

@ -33,6 +33,9 @@ namespace PNS
COMPONENT_DRAGGER::COMPONENT_DRAGGER( ROUTER* aRouter ) : DRAG_ALGO( aRouter ) COMPONENT_DRAGGER::COMPONENT_DRAGGER( ROUTER* aRouter ) : DRAG_ALGO( aRouter )
{ {
// ensure all variables are initialized
m_dragStatus = false;
m_currentNode = nullptr;
} }

View File

@ -43,7 +43,7 @@ class DRAG_ALGO : public ALGO_BASE
{ {
public: public:
DRAG_ALGO( ROUTER* aRouter ) : DRAG_ALGO( ROUTER* aRouter ) :
ALGO_BASE( aRouter ) ALGO_BASE( aRouter ), m_world( nullptr )
{ {
} }

View File

@ -91,6 +91,7 @@ SHOVE::SHOVE( NODE* aWorld, ROUTER* aRouter ) :
m_draggedVia = NULL; m_draggedVia = NULL;
m_iter = 0; m_iter = 0;
m_multiLineMode = false; m_multiLineMode = false;
m_restrictSpringbackTagId = 0;
} }
@ -672,7 +673,7 @@ bool SHOVE::pushSpringback( NODE* aNode, const OPT_BOX2I& aAffectedArea, VIA* aD
st.m_seq = (m_nodeStack.empty() ? 1 : m_nodeStack.back().m_seq + 1); st.m_seq = (m_nodeStack.empty() ? 1 : m_nodeStack.back().m_seq + 1);
st.m_locked = false; st.m_locked = false;
m_nodeStack.push_back( st ); m_nodeStack.push_back( st );
return true; return true;

View File

@ -53,6 +53,7 @@ public:
m_recursiveCollision[0] = m_recursiveCollision[1] = false; m_recursiveCollision[0] = m_recursiveCollision[1] = false;
m_iteration = 0; m_iteration = 0;
m_forceCw = false; m_forceCw = false;
m_forceUniqueWindingDirection = false;
} }
~WALKAROUND() {}; ~WALKAROUND() {};