Fix some Coverity warnings.

This commit is contained in:
jean-pierre charras 2022-03-06 09:48:33 +01:00
parent 3cb1a689a7
commit dbfdd3fb56
6 changed files with 9 additions and 5 deletions

View File

@ -1031,11 +1031,12 @@ int SCH_LINE_WIRE_BUS_TOOL::TrimOverLappingWires( const TOOL_EVENT& aEvent )
for( unsigned ii = 0; ii < aSelection->GetSize(); ii++ )
{
SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( aSelection->GetItem( ii ) );
std::vector<VECTOR2I> pts = item->GetConnectionPoints();
if( !item || !item->IsConnectable() || ( item->Type() == SCH_LINE_T ) )
continue;
std::vector<VECTOR2I> pts = item->GetConnectionPoints();
/// If the line intersects with an item in the selection at only two points,
/// then we can remove the line between the two points.
for( SCH_LINE* line : lines )

View File

@ -214,6 +214,7 @@ void MD5_HASH::md5_transform( MD5_CTX* ctx, uint8_t data[] )
void MD5_HASH::md5_init( MD5_CTX* ctx )
{
memset( ctx->data, 64, 0 );
ctx->datalen = 0;
ctx->bitlen[0] = 0;
ctx->bitlen[1] = 0;

View File

@ -911,10 +911,9 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew )
return false;
}
TOOL_MANAGER* pcb_ToolManager = pcbframe ? pcbframe->GetToolManager() : nullptr;
TOOL_MANAGER* pcb_ToolManager = pcbframe->GetToolManager();
if( aAddNew && pcb_ToolManager
&& pcb_ToolManager->GetTool<BOARD_EDITOR_CONTROL>()->PlacingFootprint() )
if( aAddNew && pcb_ToolManager->GetTool<BOARD_EDITOR_CONTROL>()->PlacingFootprint() )
{
DisplayError( this, _( "Previous footprint placement still in progress." ) );
return false;

View File

@ -39,6 +39,7 @@ GRAPHICS_CLEANER::GRAPHICS_CLEANER( DRAWINGS& aDrawings, FOOTPRINT* aParentFootp
m_parentFootprint( aParentFootprint ),
m_commit( aCommit ),
m_dryRun( true ),
m_epsilon( 0 ),
m_itemsList( nullptr )
{
}

View File

@ -207,7 +207,7 @@ void GRAPHICS_IMPORTER_BUFFER::PostprocessNestedPolygons()
}
}
POLY_FILL_RULE last_rule = curShapeIdx>= 0 && m_shapeFillRules.size()
POLY_FILL_RULE last_rule = ( m_shapeFillRules.size() && curShapeIdx >= 0 )
? m_shapeFillRules[curShapeIdx]
: POLY_FILL_RULE::PF_EVEN_ODD;

View File

@ -86,6 +86,8 @@ ZONE_SETTINGS::ZONE_SETTINGS()
SetDoNotAllowTracks( true );
SetDoNotAllowPads( true );
SetDoNotAllowFootprints( false );
m_TeardropType = TEARDROP_TYPE::TD_NONE;
}