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:
Seth Hillbrand 2024-04-12 11:26:54 -07:00
parent f08cacb30f
commit 7727982478
1 changed files with 4 additions and 4 deletions

View File

@ -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;
}