[Libreoffice-commits] core.git: lotuswordpro/inc lotuswordpro/source

Noel Grandin noel.grandin at collabora.co.uk
Mon Mar 5 06:33:12 UTC 2018


 lotuswordpro/inc/lwpoverride.hxx           |   16 ++++++++--------
 lotuswordpro/source/filter/lwpoverride.cxx |   16 ++++------------
 2 files changed, 12 insertions(+), 20 deletions(-)

New commits:
commit 7d782a4b8b70a8846f78d71632f679f80f9208a5
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Mar 1 10:52:31 2018 +0200

    loplugin:useuniqueptr in LwpSpacingOverride
    
    Change-Id: I1f71c1e35c49b99c9fde1fe43fc9f5717158355e
    Reviewed-on: https://gerrit.libreoffice.org/50737
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/lotuswordpro/inc/lwpoverride.hxx b/lotuswordpro/inc/lwpoverride.hxx
index c5f616a15dad..19d059616b87 100644
--- a/lotuswordpro/inc/lwpoverride.hxx
+++ b/lotuswordpro/inc/lwpoverride.hxx
@@ -356,19 +356,19 @@ public:
 
     void Override(LwpSpacingOverride* other);
 
-    LwpSpacingCommonOverride* GetSpacing(){return m_pSpacing;}
-    LwpSpacingCommonOverride* GetAboveLineSpacing(){return m_pAboveLineSpacing;}
-    LwpSpacingCommonOverride* GetAboveSpacing(){return m_pParaSpacingAbove;}
-    LwpSpacingCommonOverride* GetBelowSpacing(){return m_pParaSpacingBelow;}
+    LwpSpacingCommonOverride* GetSpacing(){return m_pSpacing.get();}
+    LwpSpacingCommonOverride* GetAboveLineSpacing(){return m_pAboveLineSpacing.get();}
+    LwpSpacingCommonOverride* GetAboveSpacing(){return m_pParaSpacingAbove.get();}
+    LwpSpacingCommonOverride* GetBelowSpacing(){return m_pParaSpacingBelow.get();}
 
 private:
     LwpSpacingOverride(LwpSpacingOverride const& rOther);
     LwpSpacingOverride& operator=(LwpSpacingOverride const& rOther) = delete;
 
-    LwpSpacingCommonOverride*   m_pSpacing;
-    LwpSpacingCommonOverride*   m_pAboveLineSpacing;
-    LwpSpacingCommonOverride*   m_pParaSpacingAbove;
-    LwpSpacingCommonOverride*   m_pParaSpacingBelow;
+    std::unique_ptr<LwpSpacingCommonOverride>   m_pSpacing;
+    std::unique_ptr<LwpSpacingCommonOverride>   m_pAboveLineSpacing;
+    std::unique_ptr<LwpSpacingCommonOverride>   m_pParaSpacingAbove;
+    std::unique_ptr<LwpSpacingCommonOverride>   m_pParaSpacingBelow;
 };
 
 class LwpIndentOverride final : public LwpOverride
diff --git a/lotuswordpro/source/filter/lwpoverride.cxx b/lotuswordpro/source/filter/lwpoverride.cxx
index 5c4a1002aebc..fff586d6f4f9 100644
--- a/lotuswordpro/source/filter/lwpoverride.cxx
+++ b/lotuswordpro/source/filter/lwpoverride.cxx
@@ -359,10 +359,6 @@ m_pParaSpacingBelow(new LwpSpacingCommonOverride)
 
 LwpSpacingOverride::~LwpSpacingOverride()
 {
-    delete m_pSpacing;
-    delete m_pAboveLineSpacing;
-    delete m_pParaSpacingAbove;
-    delete m_pParaSpacingBelow;
 }
 
 LwpSpacingOverride::LwpSpacingOverride(LwpSpacingOverride const& rOther)
@@ -372,14 +368,10 @@ LwpSpacingOverride::LwpSpacingOverride(LwpSpacingOverride const& rOther)
     , m_pParaSpacingAbove(nullptr)
     , m_pParaSpacingBelow(nullptr)
 {
-    std::unique_ptr<LwpSpacingCommonOverride> pSpacing(::clone(rOther.m_pSpacing));
-    std::unique_ptr<LwpSpacingCommonOverride> pAboveLineSpacing(::clone(rOther.m_pAboveLineSpacing));
-    std::unique_ptr<LwpSpacingCommonOverride> pParaSpacingAbove(::clone(rOther.m_pParaSpacingAbove));
-    std::unique_ptr<LwpSpacingCommonOverride> pParaSpacingBelow(::clone(rOther.m_pParaSpacingBelow));
-    m_pSpacing = pSpacing.release();
-    m_pAboveLineSpacing = pAboveLineSpacing.release();
-    m_pParaSpacingAbove = pParaSpacingAbove.release();
-    m_pParaSpacingBelow = pParaSpacingBelow.release();
+    m_pSpacing.reset( ::clone(rOther.m_pSpacing.get()) );
+    m_pAboveLineSpacing.reset( ::clone(rOther.m_pAboveLineSpacing.get()) );
+    m_pParaSpacingAbove.reset( ::clone(rOther.m_pParaSpacingAbove.get()) );
+    m_pParaSpacingBelow.reset( ::clone(rOther.m_pParaSpacingBelow.get()) );
 }
 
 LwpSpacingOverride* LwpSpacingOverride::clone() const


More information about the Libreoffice-commits mailing list