[Libreoffice-commits] core.git: sc/source
Noel Grandin
noel.grandin at collabora.co.uk
Thu Jul 12 06:49:50 UTC 2018
sc/source/filter/excel/exctools.cxx | 20 ++++++++------------
sc/source/filter/excel/impop.cxx | 6 +++---
sc/source/filter/excel/xiroot.cxx | 2 +-
sc/source/filter/inc/root.hxx | 14 +++++++-------
4 files changed, 19 insertions(+), 23 deletions(-)
New commits:
commit bf9d2c6f208faa18b17c8962e47de3a26ac40497
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Wed Jul 11 11:30:12 2018 +0200
loplugin:useuniqueptr in RootData
Change-Id: Ibb053d17a1da6e3db74b97b4f66a4ad03147b3bc
Reviewed-on: https://gerrit.libreoffice.org/57297
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sc/source/filter/excel/exctools.cxx b/sc/source/filter/excel/exctools.cxx
index 97c5f97c24df..1475f9b8e8b0 100644
--- a/sc/source/filter/excel/exctools.cxx
+++ b/sc/source/filter/excel/exctools.cxx
@@ -50,14 +50,10 @@
RootData::RootData()
{
eDateiTyp = BiffX;
- pExtSheetBuff = nullptr;
- pShrfmlaBuff = nullptr;
- pExtNameBuff = nullptr;
pFmlaConverter = nullptr;
- pAutoFilterBuffer = nullptr;
- pPrintRanges = new ScRangeListTabs;
- pPrintTitles = new ScRangeListTabs;
+ pPrintRanges.reset( new ScRangeListTabs );
+ pPrintTitles.reset( new ScRangeListTabs );
pTabId = nullptr;
pUserBViewList = nullptr;
@@ -69,12 +65,12 @@ RootData::RootData()
RootData::~RootData()
{
- delete pExtSheetBuff;
- delete pShrfmlaBuff;
- delete pExtNameBuff;
- delete pAutoFilterBuffer;
- delete pPrintRanges;
- delete pPrintTitles;
+ pExtSheetBuff.reset();
+ pShrfmlaBuff.reset();
+ pExtNameBuff.reset();
+ pAutoFilterBuffer.reset();
+ pPrintRanges.reset();
+ pPrintTitles.reset();
}
XclImpOutlineBuffer::XclImpOutlineBuffer( SCSIZE nNewSize ) :
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index 26e6ac10a0b5..f1bf316f6640 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -125,9 +125,9 @@ ImportExcel::ImportExcel( XclImpRootData& rImpData, SvStream& rStrm ):
pExcRoot = &GetOldRoot();
pExcRoot->pIR = this; // ExcRoot -> XclImpRoot
pExcRoot->eDateiTyp = BiffX;
- pExcRoot->pExtSheetBuff = new ExtSheetBuffer( pExcRoot ); //&aExtSheetBuff;
- pExcRoot->pShrfmlaBuff = new SharedFormulaBuffer( pExcRoot ); //&aShrfrmlaBuff;
- pExcRoot->pExtNameBuff = new ExtNameBuff ( *this );
+ pExcRoot->pExtSheetBuff.reset( new ExtSheetBuffer( pExcRoot ) ); //&aExtSheetBuff;
+ pExcRoot->pShrfmlaBuff.reset( new SharedFormulaBuffer( pExcRoot ) ); //&aShrfrmlaBuff;
+ pExcRoot->pExtNameBuff.reset( new ExtNameBuff ( *this ) );
pOutlineListBuffer = new XclImpOutlineListBuffer;
diff --git a/sc/source/filter/excel/xiroot.cxx b/sc/source/filter/excel/xiroot.cxx
index cbe4d4a4c4d9..98e9a3a47c1e 100644
--- a/sc/source/filter/excel/xiroot.cxx
+++ b/sc/source/filter/excel/xiroot.cxx
@@ -74,7 +74,7 @@ XclImpRoot::XclImpRoot( XclImpRootData& rImpRootData ) :
mrImpData.mxCondFmtMgr.reset( new XclImpCondFormatManager( GetRoot() ) );
mrImpData.mxValidMgr.reset( new XclImpValidationManager( GetRoot() ) );
// TODO still in old RootData (deleted by RootData)
- GetOldRoot().pAutoFilterBuffer = new XclImpAutoFilterBuffer;
+ GetOldRoot().pAutoFilterBuffer.reset( new XclImpAutoFilterBuffer );
mrImpData.mxWebQueryBfr.reset( new XclImpWebQueryBuffer( GetRoot() ) );
mrImpData.mxPTableMgr.reset( new XclImpPivotTableManager( GetRoot() ) );
mrImpData.mxTabProtect.reset( new XclImpSheetProtectBuffer( GetRoot() ) );
diff --git a/sc/source/filter/inc/root.hxx b/sc/source/filter/inc/root.hxx
index ec7f53f7b44f..d9998f3e4cc2 100644
--- a/sc/source/filter/inc/root.hxx
+++ b/sc/source/filter/inc/root.hxx
@@ -52,17 +52,17 @@ class XclExpRoot;
struct RootData // -> incarnation in each case in the ImportExcel object!
{
- BiffTyp eDateiTyp; // fine differentiation
- ExtSheetBuffer* pExtSheetBuff;
- SharedFormulaBuffer* pShrfmlaBuff;
- ExtNameBuff* pExtNameBuff;
+ BiffTyp eDateiTyp; // fine differentiation
+ std::unique_ptr<ExtSheetBuffer> pExtSheetBuff;
+ std::unique_ptr<SharedFormulaBuffer> pShrfmlaBuff;
+ std::unique_ptr<ExtNameBuff> pExtNameBuff;
ExcelToSc* pFmlaConverter;
XclImpColRowSettings* pColRowBuff; // col/row settings 1 table
// Biff8
- XclImpAutoFilterBuffer* pAutoFilterBuffer; // ranges for autofilter and advanced filter
- ScRangeListTabs* pPrintRanges;
- ScRangeListTabs* pPrintTitles;
+ std::unique_ptr<XclImpAutoFilterBuffer> pAutoFilterBuffer; // ranges for autofilter and advanced filter
+ std::unique_ptr<ScRangeListTabs> pPrintRanges;
+ std::unique_ptr<ScRangeListTabs> pPrintTitles;
// extensions for export
XclExpChTrTabId* pTabId; // pointer to rec list, do not destroy
More information about the Libreoffice-commits
mailing list