diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-05-31 15:40:25 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-12 08:43:48 +0200 |
commit | e4e4d5713e248f02faf7aa6199b11e152973de8e (patch) | |
tree | 836dffa89d0a966e41b1af8270db74b9590def22 /lotuswordpro/source | |
parent | d4eabd5da8ea3b5ac40659c22cde19b26b3c002b (diff) |
clang-tidy readability-delete-null-pointer
which in turn triggered some loplugin:useuniqueptr
Change-Id: I0c38561fc9b68dac44e8cf58c8aa1f582196cc64
Reviewed-on: https://gerrit.libreoffice.org/38281
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'lotuswordpro/source')
-rw-r--r-- | lotuswordpro/source/filter/lwpcharborderoverride.cxx | 10 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpdlvlist.cxx | 6 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpdlvlist.hxx | 5 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpdoc.cxx | 10 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpfont.cxx | 4 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpfont.hxx | 3 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpgrfobj.cxx | 8 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpoverride.cxx | 28 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpoverride.hxx | 3 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwppara.cxx | 5 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwptablelayout.cxx | 6 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwptablelayout.hxx | 6 |
12 files changed, 26 insertions, 68 deletions
diff --git a/lotuswordpro/source/filter/lwpcharborderoverride.cxx b/lotuswordpro/source/filter/lwpcharborderoverride.cxx index d7cb9bc281cd..e8dabf5c0d64 100644 --- a/lotuswordpro/source/filter/lwpcharborderoverride.cxx +++ b/lotuswordpro/source/filter/lwpcharborderoverride.cxx @@ -88,14 +88,8 @@ LwpCharacterBorderOverride::LwpCharacterBorderOverride(LwpCharacterBorderOverrid LwpCharacterBorderOverride::~LwpCharacterBorderOverride() { - if (m_pBorderStuff) - { - delete m_pBorderStuff; - } - if (m_pMargins) - { - delete m_pMargins; - } + delete m_pBorderStuff; + delete m_pMargins; } LwpCharacterBorderOverride* LwpCharacterBorderOverride::clone() const diff --git a/lotuswordpro/source/filter/lwpdlvlist.cxx b/lotuswordpro/source/filter/lwpdlvlist.cxx index 22781f15eb8b..2e2ea5886d1c 100644 --- a/lotuswordpro/source/filter/lwpdlvlist.cxx +++ b/lotuswordpro/source/filter/lwpdlvlist.cxx @@ -142,7 +142,7 @@ void LwpDLNFPVList::ReadPropertyList(LwpObjectStream* pObjStrm) m_bHasProperties = pObjStrm->QuickReaduInt8() != 0; if (m_bHasProperties) { - m_pPropList = new LwpPropList; + m_pPropList.reset( new LwpPropList ); m_pPropList->Read(pObjStrm); } } @@ -152,10 +152,6 @@ void LwpDLNFPVList::ReadPropertyList(LwpObjectStream* pObjStrm) **/ LwpDLNFPVList::~LwpDLNFPVList() { - if(m_pPropList) - { - delete m_pPropList; - } } /** diff --git a/lotuswordpro/source/filter/lwpdlvlist.hxx b/lotuswordpro/source/filter/lwpdlvlist.hxx index bf9063c0b150..54a5b5d24030 100644 --- a/lotuswordpro/source/filter/lwpdlvlist.hxx +++ b/lotuswordpro/source/filter/lwpdlvlist.hxx @@ -63,6 +63,7 @@ #include "lwpatomholder.hxx" #include "lwpobj.hxx" +#include <memory> /** * @brief Double Linked Virtual List @@ -119,12 +120,12 @@ public: virtual ~LwpDLNFPVList() override; protected: bool m_bHasProperties; - LwpPropList* m_pPropList; + std::unique_ptr<LwpPropList> m_pPropList; protected: void Read() override; void ReadPropertyList(LwpObjectStream* pObjStrm); public: - LwpPropList* GetPropList() { return m_pPropList; } + LwpPropList* GetPropList() { return m_pPropList.get(); } }; /** diff --git a/lotuswordpro/source/filter/lwpdoc.cxx b/lotuswordpro/source/filter/lwpdoc.cxx index 65eb22784ec7..9455c6b91854 100644 --- a/lotuswordpro/source/filter/lwpdoc.cxx +++ b/lotuswordpro/source/filter/lwpdoc.cxx @@ -81,14 +81,8 @@ LwpDocument::LwpDocument(LwpObjectHeader& objHdr, LwpSvStream* pStrm) LwpDocument::~LwpDocument() { - if(m_pLnOpts) - { - delete m_pLnOpts; - } - if(m_pOwnedFoundry) - { - delete m_pOwnedFoundry; - } + delete m_pLnOpts; + delete m_pOwnedFoundry; } /** * @descr Read VO_Document from object stream diff --git a/lotuswordpro/source/filter/lwpfont.cxx b/lotuswordpro/source/filter/lwpfont.cxx index 98772071362a..8b430866a3b8 100644 --- a/lotuswordpro/source/filter/lwpfont.cxx +++ b/lotuswordpro/source/filter/lwpfont.cxx @@ -415,7 +415,7 @@ OUString LwpFontNameManager::GetNameByIndex(sal_uInt16 index) void LwpFontAttrManager::Read(LwpObjectStream *pStrm) { m_nCount = pStrm->QuickReaduInt16(); - m_pFontAttrs = new LwpFontAttrEntry[m_nCount]; + m_pFontAttrs.reset( new LwpFontAttrEntry[m_nCount] ); for(sal_uInt16 i=0; i<m_nCount; i++) { @@ -435,8 +435,6 @@ void LwpFontAttrManager::Override(sal_uInt16 index, rtl::Reference<XFFont> co LwpFontAttrManager::~LwpFontAttrManager() { - if(m_pFontAttrs) - delete []m_pFontAttrs; } void LwpFontManager::Read(LwpObjectStream *pStrm) diff --git a/lotuswordpro/source/filter/lwpfont.hxx b/lotuswordpro/source/filter/lwpfont.hxx index b0297fbbade7..1f6987fdea3a 100644 --- a/lotuswordpro/source/filter/lwpfont.hxx +++ b/lotuswordpro/source/filter/lwpfont.hxx @@ -72,6 +72,7 @@ #include "lwpobj.hxx" #include "xfilter/xffont.hxx" #include "xfilter/xftextstyle.hxx" +#include <memory> class LwpFontTableEntry { @@ -253,7 +254,7 @@ public: void Override(sal_uInt16 index, rtl::Reference<XFFont> const & pFont); private: sal_uInt16 m_nCount; - LwpFontAttrEntry* m_pFontAttrs; + std::unique_ptr<LwpFontAttrEntry[]> m_pFontAttrs; }; class LwpFontManager diff --git a/lotuswordpro/source/filter/lwpgrfobj.cxx b/lotuswordpro/source/filter/lwpgrfobj.cxx index 64f855ce9ce0..19df22f7481b 100644 --- a/lotuswordpro/source/filter/lwpgrfobj.cxx +++ b/lotuswordpro/source/filter/lwpgrfobj.cxx @@ -199,12 +199,8 @@ void LwpGraphicObject::Read() m_WatermarkName = m_pObjStrm->QuickReadStringPtr(); } - if (pServerContext != nullptr) - delete[] pServerContext; - - if (pFilterContext != nullptr) - delete[] pFilterContext; - + delete[] pServerContext; + delete[] pFilterContext; } void LwpGraphicObject::XFConvert (XFContentContainer* pCont) diff --git a/lotuswordpro/source/filter/lwpoverride.cxx b/lotuswordpro/source/filter/lwpoverride.cxx index 5856a4c8db42..f943bf728155 100644 --- a/lotuswordpro/source/filter/lwpoverride.cxx +++ b/lotuswordpro/source/filter/lwpoverride.cxx @@ -359,22 +359,10 @@ m_pParaSpacingBelow(new LwpSpacingCommonOverride) LwpSpacingOverride::~LwpSpacingOverride() { - if (m_pSpacing) - { - delete m_pSpacing; - } - if (m_pAboveLineSpacing) - { - delete m_pAboveLineSpacing; - } - if (m_pParaSpacingAbove) - { - delete m_pParaSpacingAbove; - } - if (m_pParaSpacingBelow) - { - delete m_pParaSpacingBelow; - } + delete m_pSpacing; + delete m_pAboveLineSpacing; + delete m_pParaSpacingAbove; + delete m_pParaSpacingBelow; } LwpSpacingOverride::LwpSpacingOverride(LwpSpacingOverride const& rOther) @@ -454,19 +442,13 @@ m_pBackgroundStuff(new LwpBackgroundStuff), m_nType(AMIKAKE_NONE) LwpAmikakeOverride::~LwpAmikakeOverride() { - if (m_pBackgroundStuff) - { - delete m_pBackgroundStuff; - } } LwpAmikakeOverride::LwpAmikakeOverride(LwpAmikakeOverride const& rOther) : LwpOverride(rOther) - , m_pBackgroundStuff(nullptr) + , m_pBackgroundStuff(::clone(rOther.m_pBackgroundStuff.get())) , m_nType(rOther.m_nType) { - std::unique_ptr<LwpBackgroundStuff> pBackgroundStuff(::clone(rOther.m_pBackgroundStuff)); - m_pBackgroundStuff = pBackgroundStuff.release(); } LwpAmikakeOverride* LwpAmikakeOverride::clone() const diff --git a/lotuswordpro/source/filter/lwpoverride.hxx b/lotuswordpro/source/filter/lwpoverride.hxx index c88ed65ea937..935fd0f7bbbe 100644 --- a/lotuswordpro/source/filter/lwpoverride.hxx +++ b/lotuswordpro/source/filter/lwpoverride.hxx @@ -63,6 +63,7 @@ #include "lwpobjid.hxx" #include "lwptools.hxx" +#include <memory> class LwpObjectStream; @@ -493,7 +494,7 @@ private: LwpAmikakeOverride& operator=(LwpAmikakeOverride const& rOther) = delete; private: - LwpBackgroundStuff* m_pBackgroundStuff; + std::unique_ptr<LwpBackgroundStuff> m_pBackgroundStuff; sal_uInt16 m_nType; }; diff --git a/lotuswordpro/source/filter/lwppara.cxx b/lotuswordpro/source/filter/lwppara.cxx index 10acd0ab88a3..eabeb993cb57 100644 --- a/lotuswordpro/source/filter/lwppara.cxx +++ b/lotuswordpro/source/filter/lwppara.cxx @@ -134,10 +134,7 @@ LwpPara::~LwpPara() delete m_pBullOver; m_pBullOver = nullptr; } - if(m_pIndentOverride) - { - delete m_pIndentOverride; - } + delete m_pIndentOverride; LwpParaProperty* pNextProp; while(m_pProps) diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx index f25104985339..5b63e64cac59 100644 --- a/lotuswordpro/source/filter/lwptablelayout.cxx +++ b/lotuswordpro/source/filter/lwptablelayout.cxx @@ -87,15 +87,11 @@ LwpSuperTableLayout::LwpSuperTableLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm) : LwpPlacableLayout(objHdr, pStrm) { - m_pFrame = new LwpFrame(this); + m_pFrame.reset(new LwpFrame(this) ); } LwpSuperTableLayout::~LwpSuperTableLayout() { - if(m_pFrame) - { - delete m_pFrame; - } } /** * @short Read super table layout record diff --git a/lotuswordpro/source/filter/lwptablelayout.hxx b/lotuswordpro/source/filter/lwptablelayout.hxx index 11ffd63b2938..7237df9591fc 100644 --- a/lotuswordpro/source/filter/lwptablelayout.hxx +++ b/lotuswordpro/source/filter/lwptablelayout.hxx @@ -61,9 +61,11 @@ #ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPTABLELAYOUT_HXX #define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPTABLELAYOUT_HXX +#include "lwplayout.hxx" + #include <vector> #include <map> -#include "lwplayout.hxx" +#include <memory> class XFTableStyle; class XFTable; @@ -181,7 +183,7 @@ protected: LwpTableLayout* GetTableLayout(); bool IsSizeRightToContent(); bool IsJustifiable(); - LwpFrame* m_pFrame; + std::unique_ptr<LwpFrame> m_pFrame; }; /** |