From 1d43c71138b6bbc83a7ea592bbeff416002902a5 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Mon, 17 Oct 2011 22:20:43 +0200 Subject: cppcheck fix : 'operator=' should check for assignment to selfw --- lotuswordpro/source/filter/xfilter/xfrowstyle.cxx | 23 +++++++++++++---------- lotuswordpro/source/filter/xfilter/xfrowstyle.hxx | 2 +- 2 files changed, 14 insertions(+), 11 deletions(-) (limited to 'lotuswordpro/source') diff --git a/lotuswordpro/source/filter/xfilter/xfrowstyle.cxx b/lotuswordpro/source/filter/xfilter/xfrowstyle.cxx index d522a0c04db8..5027c7a63645 100644 --- a/lotuswordpro/source/filter/xfilter/xfrowstyle.cxx +++ b/lotuswordpro/source/filter/xfilter/xfrowstyle.cxx @@ -100,19 +100,22 @@ void XFRowStyle::ToXml(IXFStream *pStrm) pStrm->EndElement( A2OUSTR("style:style") ); } -XFRowStyle& XFRowStyle::operator=(XFRowStyle& other) +XFRowStyle& XFRowStyle::operator=(XFRowStyle const &other) { - m_fHeight = other.m_fHeight; - m_fMinHeight = other.m_fMinHeight; - m_aBackColor = other.m_aBackColor; + if (this != &other) + { + m_fHeight = other.m_fHeight; + m_fMinHeight = other.m_fMinHeight; + m_aBackColor = other.m_aBackColor; - if( m_pBGImage ) - delete m_pBGImage; + if( m_pBGImage ) + delete m_pBGImage; - if( other.m_pBGImage ) - m_pBGImage = new XFBGImage(*other.m_pBGImage); - else - m_pBGImage = NULL; + if( other.m_pBGImage ) + m_pBGImage = new XFBGImage(*other.m_pBGImage); + else + m_pBGImage = NULL; + } return *this; } diff --git a/lotuswordpro/source/filter/xfilter/xfrowstyle.hxx b/lotuswordpro/source/filter/xfilter/xfrowstyle.hxx index f97aca90fe41..38aa6491a6f5 100644 --- a/lotuswordpro/source/filter/xfilter/xfrowstyle.hxx +++ b/lotuswordpro/source/filter/xfilter/xfrowstyle.hxx @@ -69,7 +69,7 @@ class XFRowStyle : public XFStyle { public: XFRowStyle(); - XFRowStyle& operator=(XFRowStyle& other); + XFRowStyle& operator=(XFRowStyle const &other); public: void SetRowHeight(double height); -- cgit