Simplify and fix SvGlobalName comparison
Its operator< (required for stl containers) was not comparing Data4. The defaulted comparison uses a different order, but that shouldn't matter. Change-Id: Id9b9d782b393866100c3e994a3902e7ce9a2676f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160607 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
parent
380081381f
commit
fbefacef9e
2 changed files with 6 additions and 26 deletions
|
@ -22,12 +22,16 @@
|
|||
#include <tools/toolsdllapi.h>
|
||||
#include <com/sun/star/uno/Sequence.hxx>
|
||||
|
||||
#include <compare>
|
||||
|
||||
struct SAL_WARN_UNUSED SvGUID
|
||||
{
|
||||
sal_uInt32 Data1;
|
||||
sal_uInt16 Data2;
|
||||
sal_uInt16 Data3;
|
||||
sal_uInt8 Data4[8];
|
||||
friend constexpr auto operator<=>(const SvGUID&, const SvGUID&) = default;
|
||||
friend constexpr bool operator==(const SvGUID&, const SvGUID&) = default;
|
||||
};
|
||||
|
||||
class SvStream;
|
||||
|
@ -52,11 +56,8 @@ public:
|
|||
TOOLS_DLLPUBLIC friend SvStream & operator >> ( SvStream &, SvGlobalName & );
|
||||
TOOLS_DLLPUBLIC friend SvStream & WriteSvGlobalName( SvStream &, const SvGlobalName & );
|
||||
|
||||
bool operator < ( const SvGlobalName & rObj ) const;
|
||||
|
||||
bool operator == ( const SvGlobalName & rObj ) const;
|
||||
bool operator != ( const SvGlobalName & rObj ) const
|
||||
{ return !(*this == rObj); }
|
||||
friend constexpr auto operator<=>(const SvGlobalName&, const SvGlobalName&) = default;
|
||||
friend constexpr bool operator==(const SvGlobalName&, const SvGlobalName&) = default;
|
||||
|
||||
void MakeFromMemory( void const * pData );
|
||||
bool MakeId( std::u16string_view rId );
|
||||
|
|
|
@ -59,27 +59,6 @@ SvStream& operator >> ( SvStream& rStr, SvGlobalName & rObj )
|
|||
return rStr;
|
||||
}
|
||||
|
||||
|
||||
bool SvGlobalName::operator < ( const SvGlobalName & rObj ) const
|
||||
{
|
||||
if( m_aData.Data3 < rObj.m_aData.Data3 )
|
||||
return true;
|
||||
else if( m_aData.Data3 > rObj.m_aData.Data3 )
|
||||
return false;
|
||||
|
||||
if( m_aData.Data2 < rObj.m_aData.Data2 )
|
||||
return true;
|
||||
else if( m_aData.Data2 > rObj.m_aData.Data2 )
|
||||
return false;
|
||||
|
||||
return m_aData.Data1 < rObj.m_aData.Data1;
|
||||
}
|
||||
|
||||
bool SvGlobalName::operator == ( const SvGlobalName & rObj ) const
|
||||
{
|
||||
return memcmp(&m_aData, &rObj.m_aData, sizeof(m_aData)) == 0;
|
||||
}
|
||||
|
||||
void SvGlobalName::MakeFromMemory( void const * pData )
|
||||
{
|
||||
memcpy( &m_aData, pData, sizeof( m_aData ) );
|
||||
|
|
Loading…
Reference in a new issue