[Libreoffice-commits] core.git: sc/source

Noel Grandin noel.grandin at collabora.co.uk
Fri Mar 23 07:18:21 UTC 2018


 sc/source/core/data/poolhelp.cxx |   10 +++++-----
 sc/source/core/inc/poolhelp.hxx  |    4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 503c93275ecfab8ad80606cd43e094382a2c38f0
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Mar 22 13:24:17 2018 +0200

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

diff --git a/sc/source/core/data/poolhelp.cxx b/sc/source/core/data/poolhelp.cxx
index 28a25b363a88..a6e1ba765933 100644
--- a/sc/source/core/data/poolhelp.cxx
+++ b/sc/source/core/data/poolhelp.cxx
@@ -42,7 +42,7 @@ ScPoolHelper::~ScPoolHelper()
 {
     SfxItemPool::Free(pEnginePool);
     SfxItemPool::Free(pEditPool);
-    delete pFormTable;
+    pFormTable.reset();
     mxStylePool.clear();
     SfxItemPool::Free(pDocPool);
 }
@@ -70,7 +70,7 @@ SvNumberFormatter*  ScPoolHelper::GetFormTable() const
 {
     if (!pFormTable)
         pFormTable = CreateNumberFormatter();
-    return pFormTable;
+    return pFormTable.get();
 }
 
 void ScPoolHelper::SetFormTableOpt(const ScDocOptions& rOpt)
@@ -88,12 +88,12 @@ void ScPoolHelper::SetFormTableOpt(const ScDocOptions& rOpt)
     }
 }
 
-SvNumberFormatter* ScPoolHelper::CreateNumberFormatter() const
+std::unique_ptr<SvNumberFormatter> ScPoolHelper::CreateNumberFormatter() const
 {
-    SvNumberFormatter* p = nullptr;
+    std::unique_ptr<SvNumberFormatter> p;
     {
         osl::MutexGuard aGuard(&maMtxCreateNumFormatter);
-        p = new SvNumberFormatter(comphelper::getProcessComponentContext(), LANGUAGE_SYSTEM);
+        p.reset(new SvNumberFormatter(comphelper::getProcessComponentContext(), LANGUAGE_SYSTEM));
     }
     p->SetColorLink( LINK(m_pSourceDoc, ScDocument, GetUserDefinedColor) );
     p->SetEvalDateFormat(NF_EVALDATEFORMAT_INTL_FORMAT);
diff --git a/sc/source/core/inc/poolhelp.hxx b/sc/source/core/inc/poolhelp.hxx
index dfe615821413..914b760022b3 100644
--- a/sc/source/core/inc/poolhelp.hxx
+++ b/sc/source/core/inc/poolhelp.hxx
@@ -38,7 +38,7 @@ private:
     ScDocOptions        aOpt;
     ScDocumentPool*     pDocPool;
     rtl::Reference< ScStyleSheetPool > mxStylePool;
-    mutable SvNumberFormatter*  pFormTable;
+    mutable std::unique_ptr<SvNumberFormatter> pFormTable;
     mutable SfxItemPool*        pEditPool;                      // EditTextObjectPool
     mutable SfxItemPool*        pEnginePool;                    // EditEnginePool
     ScDocument*         m_pSourceDoc;
@@ -59,7 +59,7 @@ public:
 
     void                SetFormTableOpt(const ScDocOptions& rOpt);
 
-    SvNumberFormatter* CreateNumberFormatter() const;
+    std::unique_ptr<SvNumberFormatter> CreateNumberFormatter() const;
 };
 
 #endif


More information about the Libreoffice-commits mailing list