fix a few Coverity warnings.

This commit is contained in:
jean-pierre charras 2020-04-01 09:34:44 +02:00
parent 00d9e77e7f
commit e811101567
3 changed files with 6 additions and 6 deletions

View File

@ -281,8 +281,8 @@ wxString BACK_ANNOTATE::getTextFromField( const SCH_REFERENCE& aRef, const NumFi
int BACK_ANNOTATE::checkSharedSchematicErrors()
{
std::sort(
m_changelist.begin(), m_changelist.end(), []( CHANGELIST_ITEM a, CHANGELIST_ITEM b ) {
std::sort( m_changelist.begin(), m_changelist.end(),
[]( CHANGELIST_ITEM& a, CHANGELIST_ITEM& b ) {
return a.first.GetComp() > b.first.GetComp();
} );

View File

@ -635,7 +635,7 @@ void SCH_MOVE_TOOL::moveItem( EDA_ITEM* aItem, VECTOR2I aDelta, bool isDrag )
static_cast<SCH_ITEM*>( aItem )->Move( delta );
// If we're moving a field with respect to its parent then it's no longer auto-placed
if( aItem->Type() == SCH_FIELD_T && !parent->IsSelected() )
if( aItem->Type() == SCH_FIELD_T && parent && !parent->IsSelected() )
parent->ClearFieldsAutoplaced();
break;

View File

@ -254,7 +254,7 @@ bool ANGLE_CONSTRAINT_45::Check ( int aVertex1, int aVertex2, LINE* aOriginLine,
return false; // disallowed exit ngle
}
/*auto ang_rep0 = DIRECTION_45( aReplacement.CSegment(0) ).Angle( dir_orig0 );
auto ang_rep1 = DIRECTION_45( aReplacement.CSegment(-1) ).Angle( dir_orig1 );*/
@ -311,7 +311,7 @@ bool PRESERVE_VERTEX_CONSTRAINT::Check ( int aVertex1, int aVertex2, LINE* aOrig
for( int i = 0; i < aReplacement.SegmentCount(); i++ )
{
int dist = aReplacement.CSegment(i).Distance( m_v );
if ( dist <= 1 )
{
return true;
@ -1315,7 +1315,7 @@ static int64_t shovedArea( const SHAPE_LINE_CHAIN& aOld, const SHAPE_LINE_CHAIN&
return std::abs(area / 2);
}
bool tightenSegment( bool dir, NODE *aNode, LINE cur, SHAPE_LINE_CHAIN in, SHAPE_LINE_CHAIN& out )
bool tightenSegment( bool dir, NODE *aNode, LINE cur, const SHAPE_LINE_CHAIN& in, SHAPE_LINE_CHAIN& out )
{
SEG a = in.CSegment(0);
SEG center = in.CSegment(1);