Fix a few Coverity warnings

This commit is contained in:
jean-pierre charras 2017-12-04 10:20:05 +01:00
parent 36a54aef21
commit c0a539959e
7 changed files with 35 additions and 4 deletions

View File

@ -164,7 +164,7 @@ CMP_TREE_NODE_LIB_ID::CMP_TREE_NODE_LIB_ID( CMP_TREE_NODE* aParent, LIB_ALIAS* a
SearchText += footprint.Lower();
}
if( part->IsMulti() )
if( part && part->IsMulti() )
{
for( int u = 1; u <= part->GetUnitCount(); ++u )
{

View File

@ -58,6 +58,7 @@ public:
m_InitialLibId = m_Component->GetLibId().Format();
m_Row = -1;
m_IsOrphan = false;
m_Screen = nullptr;
}
// Returns a string like mylib:symbol_name from the LIB_ID of the component

View File

@ -243,7 +243,9 @@ void HIERARCHY_NAVIG_DLG::BuildTree( SCH_SHEET_PATH* list, wxTreeItemId* previo
m_TreeSize.x = std::max( m_TreeSize.x, ll );
m_TreeSize.y += 1;
if( *list == dynamic_cast< SCH_EDIT_FRAME* >( GetParent() )->GetCurrentSheet() )
SCH_EDIT_FRAME* parent = dynamic_cast< SCH_EDIT_FRAME* >( GetParent() );
if( parent && *list == parent->GetCurrentSheet() )
{
m_Tree->EnsureVisible( menu );
m_Tree->SelectItem( menu );

View File

@ -144,6 +144,8 @@ GERBVIEW_SELECTION_TOOL::GERBVIEW_SELECTION_TOOL() :
m_multiple( false ),
m_menu( *this )
{
// these members are initialized to avoid warnings about non initialized vars
m_preliminary = true;
}

View File

@ -66,6 +66,8 @@ DIALOG_DXF_IMPORT::DIALOG_DXF_IMPORT( PCB_BASE_FRAME* aParent, bool aImportAsFoo
m_PcbImportUnits = 0;
m_PcbImportOffsetX = 0.0; // always in mm
m_PcbImportOffsetY = 0.0; // always in mm
m_PCBdefaultLineWidth = 0.2; // in mm
m_PCBLineWidthUnits = 0;
if( m_config )
{

View File

@ -308,7 +308,7 @@ BOARD* CLIPBOARD_IO::Load( const wxString& aFileName,
}
// Give the filename to the board if it's new
if( !aAppendToMe )
if( board && !aAppendToMe )
board->SetFileName( aFileName );
return board;

View File

@ -198,9 +198,12 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC, GR_DRAWMODE aDrawMode, const
wxString DIALOG_FIND::prevSearchString;
bool DIALOG_FIND::warpMouse = true;
DIALOG_FIND::DIALOG_FIND( PCB_BASE_FRAME* aParent ) : DIALOG_FIND_BASE( aParent )
{
// these members are initialized to avoid warnings about non initialized vars
parent = aParent;
itemCount = markerCount = 0;
foundItem = nullptr;
}
@ -241,6 +244,13 @@ DIALOG_FIND_BASE::DIALOG_FIND_BASE( wxWindow* parent,
const wxSize& size,
long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
// these members are initialized only to avoid warnings about non initialized vars
m_staticText1 = nullptr;
m_SearchTextCtrl = nullptr;
m_NoMouseWarpCheckBox = nullptr;
m_button1 = nullptr;
m_button2 = nullptr;
m_button3 = nullptr;
}
@ -280,6 +290,20 @@ DIALOG_BLOCK_OPTIONS_BASE::DIALOG_BLOCK_OPTIONS_BASE( wxWindow* parent,
const wxSize& size,
long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
// these members are initialized only to avoid warnings about non initialized vars
m_Include_Modules = nullptr;
m_Include_PcbTextes = nullptr;
m_IncludeLockedModules = nullptr;
m_Include_Draw_Items = nullptr;
m_Include_Tracks = nullptr;
m_Include_Edges_Items = nullptr;
m_Include_Zones = nullptr;
m_DrawBlockItems = nullptr;
m_staticline1 = nullptr;
m_checkBoxIncludeInvisible = nullptr;
m_sdbSizer1 = nullptr;
m_sdbSizer1OK = nullptr;
m_sdbSizer1Cancel = nullptr;
}