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

Noel Grandin noel.grandin at collabora.co.uk
Mon Mar 5 15:08:38 UTC 2018


 lotuswordpro/inc/xfilter/xfconfigmanager.hxx           |    7 +++--
 lotuswordpro/source/filter/xfilter/xfconfigmanager.cxx |   21 ++++-------------
 2 files changed, 10 insertions(+), 18 deletions(-)

New commits:
commit fe40724421b8c1f197871702a477772d2a633209
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Mar 1 11:17:05 2018 +0200

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

diff --git a/lotuswordpro/inc/xfilter/xfconfigmanager.hxx b/lotuswordpro/inc/xfilter/xfconfigmanager.hxx
index ded25e948ff1..d33779a64007 100644
--- a/lotuswordpro/inc/xfilter/xfconfigmanager.hxx
+++ b/lotuswordpro/inc/xfilter/xfconfigmanager.hxx
@@ -65,6 +65,7 @@
 #include <xfilter/xffootnoteconfig.hxx>
 #include <xfilter/xfendnoteconfig.hxx>
 #include <xfilter/xfdefs.hxx>
+#include <memory>
 
 /**
  * @brief
@@ -100,9 +101,9 @@ public:
     virtual void    ToXml(IXFStream *pStrm) override;
 
 private:
-    XFLineNumberConfig  *m_pLineNumberConfig;
-    XFFootnoteConfig    *m_pFootnoteConfig;
-    XFEndnoteConfig     *m_pEndnoteConfig;
+    std::unique_ptr<XFLineNumberConfig> m_pLineNumberConfig;
+    std::unique_ptr<XFFootnoteConfig>   m_pFootnoteConfig;
+    std::unique_ptr<XFEndnoteConfig>    m_pEndnoteConfig;
 };
 
 #endif
diff --git a/lotuswordpro/source/filter/xfilter/xfconfigmanager.cxx b/lotuswordpro/source/filter/xfilter/xfconfigmanager.cxx
index 00d2b3c12fa7..8592a0604723 100644
--- a/lotuswordpro/source/filter/xfilter/xfconfigmanager.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfconfigmanager.cxx
@@ -69,43 +69,34 @@ XFConfigManager::XFConfigManager()
 
 XFConfigManager::~XFConfigManager()
 {
-    delete m_pEndnoteConfig;
-    delete m_pFootnoteConfig;
-    delete m_pLineNumberConfig;
 }
 
 void XFConfigManager::SetLineNumberConfig(XFLineNumberConfig *pLNConfig)
 {
-    delete m_pLineNumberConfig;
-    m_pLineNumberConfig = pLNConfig;
+    m_pLineNumberConfig.reset( pLNConfig );
 }
 
 void    XFConfigManager::SetFootnoteConfig(XFFootnoteConfig *pFNConfig)
 {
-    delete m_pFootnoteConfig;
-    m_pFootnoteConfig = pFNConfig;
+    m_pFootnoteConfig.reset( pFNConfig );
 }
 
 void    XFConfigManager::SetEndnoteConfig(XFEndnoteConfig *pENConfig)
 {
-    delete m_pEndnoteConfig;
-    m_pEndnoteConfig = pENConfig;
+    m_pEndnoteConfig.reset( pENConfig );
 }
 
 void    XFConfigManager::ToXml(IXFStream *pStrm)
 {
     if( m_pLineNumberConfig )
-        AddStyle(m_pLineNumberConfig);
+        AddStyle(m_pLineNumberConfig.release());
     if( m_pFootnoteConfig )
-        AddStyle(m_pFootnoteConfig);
+        AddStyle(m_pFootnoteConfig.release());
     if( m_pEndnoteConfig )
-        AddStyle(m_pEndnoteConfig);
+        AddStyle(m_pEndnoteConfig.release());
 
     XFStyleContainer::ToXml(pStrm);
     XFStyleContainer::Reset();
-    m_pLineNumberConfig = nullptr;
-    m_pFootnoteConfig = nullptr;
-    m_pEndnoteConfig = nullptr;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list