summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-03-22 13:24:17 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-03-23 08:17:58 +0100
commit503c93275ecfab8ad80606cd43e094382a2c38f0 (patch)
tree8485f06825eb28057b3e9e9627179551a17cfdef
parentf9099cecf94cf4dd981158067152b7be12b462eb (diff)
loplugin:useuniqueptr in ScPoolHelper
Change-Id: I12bb470b3c0af78aa713e7b28d59235b55507d24 Reviewed-on: https://gerrit.libreoffice.org/51737 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sc/source/core/data/poolhelp.cxx10
-rw-r--r--sc/source/core/inc/poolhelp.hxx4
2 files changed, 7 insertions, 7 deletions
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