sc/inc/dptabres.hxx | 10 +++++----- sc/source/core/data/dptabres.cxx | 14 ++++++-------- 2 files changed, 11 insertions(+), 13 deletions(-)
New commits: commit cc2c1d9525baa5746ee58bb4cb6b0b62eca20a51 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Tue Mar 20 09:04:13 2018 +0200 loplugin:useuniqueptr in ScDPResultMember Change-Id: Icf8a52bcf233994bc49a5d9094196154f20602ea Reviewed-on: https://gerrit.libreoffice.org/51663 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sc/inc/dptabres.hxx b/sc/inc/dptabres.hxx index 97274c1d659b..3f2400cc9ed8 100644 --- a/sc/inc/dptabres.hxx +++ b/sc/inc/dptabres.hxx @@ -341,8 +341,8 @@ class ScDPResultMember private: const ScDPResultData* pResultData; ScDPParentDimData aParentDimData; - ScDPResultDimension* pChildDimension; - ScDPDataMember* pDataRoot; + std::unique_ptr<ScDPResultDimension> pChildDimension; + std::unique_ptr<ScDPDataMember> pDataRoot; bool bHasElements:1; bool bForceSubTotal:1; bool bHasHiddenDetails:1; @@ -418,10 +418,10 @@ public: #endif //! this will be removed! - const ScDPResultDimension* GetChildDimension() const { return pChildDimension; } - ScDPResultDimension* GetChildDimension() { return pChildDimension; } + const ScDPResultDimension* GetChildDimension() const { return pChildDimension.get(); } + ScDPResultDimension* GetChildDimension() { return pChildDimension.get(); } - ScDPDataMember* GetDataRoot() const { return pDataRoot; } + ScDPDataMember* GetDataRoot() const { return pDataRoot.get(); } const ScDPDimension* GetParentDim() const { return aParentDimData.mpParentDim; } //! Ref const ScDPLevel* GetParentLevel() const { return aParentDimData.mpParentLevel; } //! Ref diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx index 2ceb4f70f91b..48f3c95f0156 100644 --- a/sc/source/core/data/dptabres.cxx +++ b/sc/source/core/data/dptabres.cxx @@ -968,8 +968,6 @@ ScDPResultMember::ScDPResultMember( } ScDPResultMember::~ScDPResultMember() { - delete pChildDimension; - delete pDataRoot; } OUString ScDPResultMember::GetName() const @@ -1056,7 +1054,7 @@ void ScDPResultMember::InitFrom( const vector<ScDPDimension*>& ppDim, const vect if ( ppDim[nPos]->getIsDataLayoutDimension() ) { if ( !pChildDimension ) - pChildDimension = new ScDPResultDimension( pResultData ); + pChildDimension.reset( new ScDPResultDimension( pResultData ) ); pChildDimension->InitFrom( ppDim, ppLev, nPos, rInitState , false ); return; } @@ -1072,7 +1070,7 @@ void ScDPResultMember::InitFrom( const vector<ScDPDimension*>& ppDim, const vect if ( bInitChild ) { - pChildDimension = new ScDPResultDimension( pResultData ); + pChildDimension.reset( new ScDPResultDimension( pResultData ) ); pChildDimension->InitFrom(ppDim, ppLev, nPos, rInitState); } } @@ -1100,7 +1098,7 @@ void ScDPResultMember::LateInitFrom( if ( rParams.GetDim( nPos )->getIsDataLayoutDimension() ) { if ( !pChildDimension ) - pChildDimension = new ScDPResultDimension( pResultData ); + pChildDimension.reset( new ScDPResultDimension( pResultData ) ); // #i111462# reset InitChild flag only for this child dimension's LateInitFrom call, // not for following members of parent dimensions @@ -1124,7 +1122,7 @@ void ScDPResultMember::LateInitFrom( if ( rParams.GetInitChild() ) { if ( !pChildDimension ) - pChildDimension = new ScDPResultDimension( pResultData ); + pChildDimension.reset( new ScDPResultDimension( pResultData ) ); pChildDimension->LateInitFrom( rParams, pItemData, nPos, rInitState ); } } @@ -1261,7 +1259,7 @@ void ScDPResultMember::ProcessData( const vector< SCROW >& aChildMembers, const if ( !pDataRoot ) { - pDataRoot = new ScDPDataMember( pResultData, nullptr ); + pDataRoot.reset( new ScDPDataMember( pResultData, nullptr ) ); if ( pDataDim ) pDataRoot->InitFrom( pDataDim ); // recursive } @@ -1511,7 +1509,7 @@ void ScDPResultMember::FillMemberResults( uno::Sequence<sheet::MemberResult>* pLayoutSeq = pSequences; if (!bRoot) ++pLayoutSeq; - ScDPResultDimension* pLayoutDim = pChildDimension; + ScDPResultDimension* pLayoutDim = pChildDimension.get(); while ( pLayoutDim && !pLayoutDim->IsDataLayout() ) { pLayoutDim = pLayoutDim->GetFirstChildDimension(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits