Compare function should return int
Returning boolean is promoted to int and confuses false with '0' indicating that the elements are identical
This commit is contained in:
parent
f08cacb30f
commit
7727982478
|
@ -417,18 +417,18 @@ int SCH_ITEM::compare( const SCH_ITEM& aOther, int aCompareFlags ) const
|
|||
return m_bodyStyle - aOther.m_bodyStyle;
|
||||
|
||||
if( IsPrivate() != aOther.IsPrivate() )
|
||||
return IsPrivate() < aOther.IsPrivate();
|
||||
return IsPrivate() < aOther.IsPrivate() ? -1 : 1;
|
||||
|
||||
if( GetPosition().x != aOther.GetPosition().x )
|
||||
return GetPosition().x < aOther.GetPosition().x;
|
||||
return GetPosition().x < aOther.GetPosition().x ? -1 : 1;
|
||||
|
||||
if( GetPosition().y != aOther.GetPosition().y )
|
||||
return GetPosition().y < aOther.GetPosition().y;
|
||||
return GetPosition().y < aOther.GetPosition().y ? -1 : 1;
|
||||
|
||||
if( aCompareFlags & SCH_ITEM::COMPARE_FLAGS::EQUALITY )
|
||||
return 0;
|
||||
|
||||
return m_Uuid < aOther.m_Uuid;
|
||||
return m_Uuid < aOther.m_Uuid ? -1 : 1;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue