Fix Coverity warnings

This commit is contained in:
jean-pierre charras 2017-05-29 20:47:21 +02:00
parent e9577a1025
commit b8183a1aa5
6 changed files with 28 additions and 12 deletions

View File

@ -124,6 +124,7 @@ double AM_PARAM::GetValue( const D_CODE* aDcode ) const
case PUSHVALUE: // a value is on the stack:
curr_value = item.GetValue();
ops.push_back( AM_PARAM_EVAL( curr_value ) );
break;
default:
wxLogDebug( "AM_PARAM::GetValue(): unexpected type\n" );

View File

@ -508,7 +508,9 @@ bool GERBVIEW_FRAME::unarchiveFiles( const wxString& aFullFileName, REPORTER* aR
else
{
GERBER_FILE_IMAGE* gerber_image = GetGbrImage( layer );
gerber_image->m_FileName = fname;
if( gerber_image )
gerber_image->m_FileName = fname;
layer = getNextAvailableLayer( layer );
setActiveLayer( layer, false );

View File

@ -39,6 +39,7 @@ public:
m_ctrlPts.emplace_back( x1, y1 );
m_ctrlPts.emplace_back( x2, y2 );
m_ctrlPts.emplace_back( x3, y3 );
m_output = nullptr;
}
BEZIER_POLY( int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4 )
@ -47,11 +48,13 @@ public:
m_ctrlPts.emplace_back( x2, y2 );
m_ctrlPts.emplace_back( x3, y3 );
m_ctrlPts.emplace_back( x4, y4 );
m_output = nullptr;
}
BEZIER_POLY( const std::vector<wxPoint>& aControlPoints )
: m_ctrlPts( aControlPoints )
{
m_output = nullptr;
}
/**

View File

@ -1054,7 +1054,9 @@ bool DIALOG_PAD_PROPERTIES::TransferDataFromWindow()
m_currentPad->SetShape( PAD_SHAPE_RECT );
}
footprint->CalculateBoundingBox();
if( footprint )
footprint->CalculateBoundingBox();
m_parent->SetMsgPanel( m_currentPad );
// redraw the area where the pad was

View File

@ -160,6 +160,7 @@ protected:
m_mapFileFmt = PLOT_FORMAT_PDF;
m_pageInfo = NULL;
m_merge_PTH_NPTH = false;
m_zeroFormat = DECIMAL_FORMAT;
}
public:

View File

@ -171,6 +171,12 @@ MICROWAVE_TOOL_INFO getMicrowaveItemCreator( PCB_EDIT_FRAME& frame, int aParam )
return std::unique_ptr<MODULE>( frame.Create_MuWavePolygonShape() );
};
break;
default:
// Avoid uninitilized value:
info.toolId = 0;
// info.name is already set to empty string
break;
};
return info;
@ -195,18 +201,19 @@ int MICROWAVE_TOOL::addMicrowaveFootprint( const TOOL_EVENT& aEvent )
frame.SetToolID( info.toolId, wxCURSOR_PENCIL, info.name );
ITEM_CREATOR moduleCreator = [this, &info] ( const TOOL_EVENT& aAddingEvent ) {
auto module = info.creatorFunc();
ITEM_CREATOR moduleCreator = [this, &info] ( const TOOL_EVENT& aAddingEvent )
{
auto module = info.creatorFunc();
// Module has been added in the legacy backend,
// so we have to remove it before committing the change
// @todo LEGACY
if( module )
{
board()->Remove( module.get() );
}
// Module has been added in the legacy backend,
// so we have to remove it before committing the change
// @todo LEGACY
if( module )
{
board()->Remove( module.get() );
}
return module;
return module;
};
doInteractiveItemPlacement( moduleCreator, _( "Place microwave feature" ) );