diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-16 16:57:25 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-17 11:53:54 +0200 |
commit | 8a304fe8b1282efa2d40bdf337728e64b7532a35 (patch) | |
tree | e014c0df99f99c2ab5af8ba60c587f1d071ddc0d /sc | |
parent | 1aff15fa737f88129b1854d09c01a600d92c8ce0 (diff) |
loplugin:useuniqueptr in XclEscherEx
Change-Id: I8f56bad91c7128a1907e72cd457d43b5937d743a
Reviewed-on: https://gerrit.libreoffice.org/57527
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/inc/xcl97esc.hxx | 6 | ||||
-rw-r--r-- | sc/source/filter/xcl97/xcl97esc.cxx | 19 |
2 files changed, 12 insertions, 13 deletions
diff --git a/sc/source/filter/inc/xcl97esc.hxx b/sc/source/filter/inc/xcl97esc.hxx index 6d60c3d0acd7..f3b5c9f21d0c 100644 --- a/sc/source/filter/inc/xcl97esc.hxx +++ b/sc/source/filter/inc/xcl97esc.hxx @@ -122,10 +122,10 @@ private: private: XclExpObjectManager& mrObjMgr; - std::stack< std::pair< XclObj*, XclEscherHostAppData* > > aStack; + std::stack< std::pair< XclObj*, std::unique_ptr<XclEscherHostAppData> > > aStack; XclObj* pCurrXclObj; - XclEscherHostAppData* pCurrAppData; - XclEscherClientData* pTheClientData; // always the same + std::unique_ptr<XclEscherHostAppData> pCurrAppData; + std::unique_ptr<XclEscherClientData> pTheClientData; // always the same XclEscherClientTextbox* pAdditionalText; sal_uInt16 nAdditionalText; sal_uInt32 mnNextKey; diff --git a/sc/source/filter/xcl97/xcl97esc.cxx b/sc/source/filter/xcl97/xcl97esc.cxx index d81846249a90..329ad5170150 100644 --- a/sc/source/filter/xcl97/xcl97esc.cxx +++ b/sc/source/filter/xcl97/xcl97esc.cxx @@ -110,7 +110,7 @@ XclEscherEx::~XclEscherEx() { OSL_ENSURE( aStack.empty(), "~XclEscherEx: stack not empty" ); DeleteCurrAppData(); - delete pTheClientData; + pTheClientData.reset(); } sal_uInt32 XclEscherEx::InitNextDffFragment() @@ -199,8 +199,8 @@ EscherExHostAppData* XclEscherEx::StartShape( const Reference< XShape >& rxShape UpdateDffFragmentEnd(); } } - aStack.push( std::make_pair( pCurrXclObj, pCurrAppData ) ); - pCurrAppData = new XclEscherHostAppData; + aStack.push( std::make_pair( pCurrXclObj, std::move(pCurrAppData) ) ); + pCurrAppData.reset( new XclEscherHostAppData ); SdrObject* pObj = GetSdrObjectFromXShape( rxShape ); //added for exporting OCX control sal_Int16 nMsCtlType = 0; @@ -272,7 +272,7 @@ EscherExHostAppData* XclEscherEx::StartShape( const Reference< XShape >& rxShape } else { - pCurrAppData->SetClientData( pTheClientData ); + pCurrAppData->SetClientData( pTheClientData.get() ); if ( nAdditionalText == 0 ) { if ( pObj ) @@ -340,7 +340,7 @@ EscherExHostAppData* XclEscherEx::StartShape( const Reference< XShape >& rxShape } if ( !pCurrXclObj ) pCurrAppData->SetDontWriteShape( true ); - return pCurrAppData; + return pCurrAppData.get(); } void XclEscherEx::EndShape( sal_uInt16 nShapeType, sal_uInt32 nShapeID ) @@ -382,8 +382,7 @@ void XclEscherEx::EndShape( sal_uInt16 nShapeType, sal_uInt32 nShapeID ) else { pCurrXclObj = aStack.top().first; - pCurrAppData = aStack.top().second; - aStack.pop(); + pCurrAppData = std::move(aStack.top().second); } if( nAdditionalText == 3 ) nAdditionalText = 0; @@ -394,7 +393,7 @@ EscherExHostAppData* XclEscherEx::EnterAdditionalTextGroup() nAdditionalText = 1; pAdditionalText = static_cast<XclEscherClientTextbox*>( pCurrAppData->GetClientTextbox() ); pCurrAppData->SetClientTextbox( nullptr ); - return pCurrAppData; + return pCurrAppData.get(); } void XclEscherEx::EndDocument() @@ -511,8 +510,8 @@ void XclEscherEx::DeleteCurrAppData() delete pCurrAppData->GetClientAnchor(); // delete pCurrAppData->GetClientData(); delete pCurrAppData->GetClientTextbox(); - delete pCurrAppData->GetInteractionInfo(); - delete pCurrAppData; + delete pCurrAppData->GetInteractionInfo(); + pCurrAppData.reset(); } } |