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.gran...@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 <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@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 _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits