From e70048ebbf672f508968d50b439cc21e5bdf62b5 Mon Sep 17 00:00:00 2001 From: Jochen Nitschke Date: Wed, 8 Feb 2017 13:35:01 +0100 Subject: [PATCH] use std::unique_ptr<> Change-Id: Iaad3a9784d2ad30f2c04f18e9987446238425c6b Reviewed-on: https://gerrit.libreoffice.org/34043 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sc/source/filter/excel/excdoc.cxx | 14 ++++++-------- sc/source/filter/inc/excdoc.hxx | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx index e12f10712a29..c70603dc5c65 100644 --- a/sc/source/filter/excel/excdoc.cxx +++ b/sc/source/filter/excel/excdoc.cxx @@ -732,15 +732,13 @@ void ExcTable::WriteXml( XclExpXmlStream& rStrm ) ExcDocument::ExcDocument( const XclExpRoot& rRoot ) : XclExpRoot( rRoot ), - aHeader( rRoot ), - pExpChangeTrack( nullptr ) + aHeader( rRoot ) { } ExcDocument::~ExcDocument() { maTableList.RemoveAllRecords(); // for the following assertion! - delete pExpChangeTrack; } void ExcDocument::ReadDoc() @@ -787,7 +785,7 @@ void ExcDocument::ReadDoc() // change tracking if ( GetDoc().GetChangeTrack() ) - pExpChangeTrack = new XclExpChangeTrack( GetRoot() ); + m_xExpChangeTrack.reset(new XclExpChangeTrack( GetRoot() )); } } @@ -818,8 +816,8 @@ void ExcDocument::Write( SvStream& rSvStrm ) for( size_t nBSheet = 0, nBSheetCount = maBoundsheetList.GetSize(); nBSheet < nBSheetCount; ++nBSheet ) maBoundsheetList.GetRecord( nBSheet )->UpdateStreamPos( aXclStrm ); } - if( pExpChangeTrack ) - pExpChangeTrack->Write(); + if( m_xExpChangeTrack ) + m_xExpChangeTrack->Write(); } void ExcDocument::WriteXml( XclExpXmlStream& rStrm ) @@ -858,8 +856,8 @@ void ExcDocument::WriteXml( XclExpXmlStream& rStrm ) } } - if( pExpChangeTrack ) - pExpChangeTrack->WriteXml( rStrm ); + if( m_xExpChangeTrack ) + m_xExpChangeTrack->WriteXml( rStrm ); XclExpXmlPivotCaches& rCaches = GetXmlPivotTableManager().GetCaches(); if (rCaches.HasCaches()) diff --git a/sc/source/filter/inc/excdoc.hxx b/sc/source/filter/inc/excdoc.hxx index f7716668616e..1faf234dea3d 100644 --- a/sc/source/filter/inc/excdoc.hxx +++ b/sc/source/filter/inc/excdoc.hxx @@ -87,7 +87,7 @@ private: ExcTableList maTableList; ExcBoundsheetList maBoundsheetList; - XclExpChangeTrack* pExpChangeTrack; + std::unique_ptr m_xExpChangeTrack; public: explicit ExcDocument( const XclExpRoot& rRoot );