diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2021-09-16 23:15:45 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2021-09-17 08:50:35 +0200 |
commit | e92fc5ec08563f3fdd0941008a2c97cef302afa0 (patch) | |
tree | 609b51b910b066b98cf052c3e7df37048fc4e665 | |
parent | 8930b1f69e4b1c8c02902eb447c00b1d2b420e81 (diff) |
ensure that some basic geometry classes are trivially copyable
They in practice are, since they are just integers, but SwRect
had explicit implementations of some functions that technically
prevented SwRect from being considered trivially copyable, even
though they were identical to default implementations.
Change-Id: Ib5086dcd5279f3b4c0c530535c91524671cc6656
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122213
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
-rw-r--r-- | sw/inc/swrect.hxx | 16 | ||||
-rw-r--r-- | sw/source/core/bastyp/swrect.cxx | 2 | ||||
-rw-r--r-- | tools/source/generic/gen.cxx | 7 |
3 files changed, 11 insertions, 14 deletions
diff --git a/sw/inc/swrect.hxx b/sw/inc/swrect.hxx index 1374295d26c5..9467b728f2e7 100644 --- a/sw/inc/swrect.hxx +++ b/sw/inc/swrect.hxx @@ -38,7 +38,7 @@ class SAL_WARN_UNUSED SW_DLLPUBLIC SwRect public: inline SwRect(); - inline SwRect( const SwRect &rRect ); + inline SwRect( const SwRect &rRect ) = default; inline SwRect( const Point& rLT, const Size& rSize ); inline SwRect( const Point& rLT, const Point& rRB ); inline SwRect( tools::Long X, tools::Long Y, tools::Long Width, tools::Long Height ); @@ -90,7 +90,7 @@ public: inline bool IsEmpty() const; inline void Clear(); - inline SwRect &operator = ( const SwRect &rRect ); + SwRect &operator = ( const SwRect &rRect ) = default; inline bool operator == ( const SwRect& rRect ) const; inline bool operator != ( const SwRect& rRect ) const; @@ -248,13 +248,6 @@ inline tools::Long SwRect::Bottom() const return m_Size.getHeight() ? m_Point.getY() + m_Size.getHeight() - 1 : m_Point.getY(); } -// operators -inline SwRect &SwRect::operator = ( const SwRect &rRect ) -{ - m_Point = rRect.m_Point; - m_Size = rRect.m_Size; - return *this; -} inline bool SwRect::operator == ( const SwRect& rRect ) const { return (m_Point == rRect.m_Point && m_Size == rRect.m_Size); @@ -306,11 +299,6 @@ inline SwRect::SwRect() : m_Size( 0, 0 ) { } -inline SwRect::SwRect( const SwRect &rRect ) : - m_Point( rRect.m_Point ), - m_Size( rRect.m_Size ) -{ -} inline SwRect::SwRect( const Point& rLT, const Size& rSize ) : m_Point( rLT ), m_Size( rSize ) diff --git a/sw/source/core/bastyp/swrect.cxx b/sw/source/core/bastyp/swrect.cxx index a12b4aa92c34..62984819175a 100644 --- a/sw/source/core/bastyp/swrect.cxx +++ b/sw/source/core/bastyp/swrect.cxx @@ -240,4 +240,6 @@ SvStream& WriteSwRect(SvStream &rStream, const SwRect &rRect) } #endif +static_assert( std::is_trivially_copyable< SwRect >::value ); + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx index 29e7da9b98fa..9c9c04903f19 100644 --- a/tools/source/generic/gen.cxx +++ b/tools/source/generic/gen.cxx @@ -223,4 +223,11 @@ tools::Long tools::Rectangle::AdjustBottom( tools::Long nVertMoveDelta ) return nBottom; } +static_assert( std::is_trivially_copyable< Pair >::value ); +static_assert( std::is_trivially_copyable< Point >::value ); +static_assert( std::is_trivially_copyable< Size >::value ); +static_assert( std::is_trivially_copyable< Range >::value ); +static_assert( std::is_trivially_copyable< Selection >::value ); +static_assert( std::is_trivially_copyable< tools::Rectangle >::value ); + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |