From a98030518682042efaf0d3b603366435edb9e633 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 26 Jun 2018 14:53:45 +0200 Subject: loplugin:useuniqueptr in ScConsData Change-Id: I0f9392d95ec2887ee62d1486f63600693a8b4dca Reviewed-on: https://gerrit.libreoffice.org/56497 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sc/inc/consoli.hxx | 12 ++++---- sc/source/core/tool/consoli.cxx | 66 +++++++++++++---------------------------- 2 files changed, 26 insertions(+), 52 deletions(-) (limited to 'sc') diff --git a/sc/inc/consoli.hxx b/sc/inc/consoli.hxx index d16a082ce578..a2023a62a7d0 100644 --- a/sc/inc/consoli.hxx +++ b/sc/inc/consoli.hxx @@ -53,16 +53,16 @@ private: bool bRowByName; SCSIZE nColCount; SCSIZE nRowCount; - bool** ppUsed; - double** ppSum; - double** ppCount; - double** ppSumSqr; - ScReferenceList** ppRefs; + std::unique_ptr[]> ppUsed; + std::unique_ptr[]> ppSum; + std::unique_ptr[]> ppCount; + std::unique_ptr[]> ppSumSqr; + std::unique_ptr[]> ppRefs; ::std::vector maColHeaders; ::std::vector maRowHeaders; ::std::vector maTitles; SCSIZE nDataCount; - SCSIZE** ppTitlePos; + std::unique_ptr[]> ppTitlePos; bool bCornerUsed; OUString aCornerText; // only for bColByName && bRowByName diff --git a/sc/source/core/tool/consoli.cxx b/sc/source/core/tool/consoli.cxx index dc085b19882f..1c76ed39b342 100644 --- a/sc/source/core/tool/consoli.cxx +++ b/sc/source/core/tool/consoli.cxx @@ -61,49 +61,23 @@ ScConsData::ScConsData() : bRowByName(false), nColCount(0), nRowCount(0), - ppUsed(nullptr), - ppSum(nullptr), - ppCount(nullptr), - ppSumSqr(nullptr), - ppRefs(nullptr), nDataCount(0), - ppTitlePos(nullptr), bCornerUsed(false) { } ScConsData::~ScConsData() { - DeleteData(); -} - -#define DELETEARR(ppArray,nCount) \ -{ \ - sal_uLong i; \ - if (ppArray) \ - for(i=0; i().swap( maColHeaders); ::std::vector().swap( maRowHeaders); ::std::vector().swap( maTitles); @@ -123,40 +97,40 @@ void ScConsData::InitData() { if (bReference && nColCount && !ppRefs) { - ppRefs = new ScReferenceList*[nColCount]; + ppRefs.reset(new std::unique_ptr[nColCount]); for (SCSIZE i=0; i[nColCount] ); + ppSum.reset( new std::unique_ptr[nColCount] ); + ppSumSqr.reset( new std::unique_ptr[nColCount] ); for (SCSIZE i=0; i[nColCount] ); for (SCSIZE i=0; i[nRowCount] ); for (SCSIZE i=0; i