[Libreoffice-commits] core.git: sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Jul 17 09:54:17 UTC 2018


 sc/source/filter/inc/xcl97esc.hxx   |    6 +++---
 sc/source/filter/xcl97/xcl97esc.cxx |   19 +++++++++----------
 2 files changed, 12 insertions(+), 13 deletions(-)

New commits:
commit 8a304fe8b1282efa2d40bdf337728e64b7532a35
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jul 16 16:57:25 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jul 17 11:53:54 2018 +0200

    loplugin:useuniqueptr in XclEscherEx
    
    Change-Id: I8f56bad91c7128a1907e72cd457d43b5937d743a
    Reviewed-on: https://gerrit.libreoffice.org/57527
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

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();
     }
 }
 


More information about the Libreoffice-commits mailing list