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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Jul 20 07:00:19 UTC 2018


 compilerplugins/clang/useuniqueptr.cxx |    4 ++++
 sc/source/filter/excel/xeescher.cxx    |    4 ++--
 sc/source/filter/inc/xcl97rec.hxx      |    4 ++--
 sc/source/filter/xcl97/xcl97rec.cxx    |   14 ++++++--------
 sc/source/ui/inc/tpview.hxx            |    2 +-
 sc/source/ui/optdlg/tpview.cxx         |   11 +++++------
 6 files changed, 20 insertions(+), 19 deletions(-)

New commits:
commit 82a2a8f29e0f4bade59d26a7733f797188f1d57c
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jul 19 12:11:06 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jul 20 09:00:02 2018 +0200

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

diff --git a/compilerplugins/clang/useuniqueptr.cxx b/compilerplugins/clang/useuniqueptr.cxx
index 3f563699e1f6..88bbec4a9d59 100644
--- a/compilerplugins/clang/useuniqueptr.cxx
+++ b/compilerplugins/clang/useuniqueptr.cxx
@@ -88,6 +88,10 @@ public:
         // SwHTMLParser::m_pPendStack
         if (fn == SRCDIR "/sw/source/filter/html/htmlcss1.cxx")
             return;
+        // Visual Studio 2017 has trouble with these
+        if (fn == SRCDIR "/comphelper/source/property/MasterPropertySet.cxx"
+            || fn == SRCDIR "/comphelper/source/property/MasterPropertySetInfo.cxx")
+            return;
 
 
         TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx
index 855f28cd0433..b3e97ea16422 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -743,7 +743,7 @@ XclExpTbxControlObj::XclExpTbxControlObj( XclExpObjectManager& rRoot, Reference<
         /*  Be sure to construct the MSODRAWING record containing the
             ClientTextbox atom after the base OBJ's MSODRAWING record data is
             completed. */
-        pClientTextbox = new XclExpMsoDrawing( mrEscherEx );
+        pClientTextbox.reset( new XclExpMsoDrawing( mrEscherEx ) );
         mrEscherEx.AddAtom( 0, ESCHER_ClientTextbox );  // TXO record
         mrEscherEx.UpdateDffFragmentEnd();
 
@@ -756,7 +756,7 @@ XclExpTbxControlObj::XclExpTbxControlObj( XclExpObjectManager& rRoot, Reference<
                 nXclFont = GetFontBuffer().Insert( aFontData, EXC_COLOR_CTRLTEXT );
         }
 
-        pTxo = new XclTxo( aString, nXclFont );
+        pTxo.reset( new XclTxo( aString, nXclFont ) );
         pTxo->SetHorAlign( (mnObjType == EXC_OBJTYPE_BUTTON) ? EXC_OBJ_HOR_CENTER : EXC_OBJ_HOR_LEFT );
         pTxo->SetVerAlign( EXC_OBJ_VER_CENTER );
     }
diff --git a/sc/source/filter/inc/xcl97rec.hxx b/sc/source/filter/inc/xcl97rec.hxx
index a8491bc44791..f97c9b72bf9d 100644
--- a/sc/source/filter/inc/xcl97rec.hxx
+++ b/sc/source/filter/inc/xcl97rec.hxx
@@ -87,8 +87,8 @@ class XclObj : public XclExpRecord
 protected:
         XclEscherEx&        mrEscherEx;
         XclExpMsoDrawing*   pMsodrawing;
-        XclExpMsoDrawing*   pClientTextbox;
-        XclTxo*             pTxo;
+        std::unique_ptr<XclExpMsoDrawing> pClientTextbox;
+        std::unique_ptr<XclTxo> pTxo;
         sal_uInt16          mnObjType;
         sal_uInt16          nObjId;
         sal_uInt16          nGrbit;
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index b8a9919ca5dd..2e3041662f1a 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -338,8 +338,6 @@ void XclExpObjList::ResetCounters()
 XclObj::XclObj( XclExpObjectManager& rObjMgr, sal_uInt16 nObjType, bool bOwnEscher ) :
     XclExpRecord( EXC_ID_OBJ, 26 ),
     mrEscherEx( rObjMgr.GetEscherEx() ),
-    pClientTextbox( nullptr ),
-    pTxo( nullptr ),
     mnObjType( nObjType ),
     nObjId(0),
     nGrbit( 0x6011 ),   // AutoLine, AutoFill, Printable, Locked
@@ -358,8 +356,8 @@ XclObj::~XclObj()
 {
     if ( !bFirstOnSheet )
         delete pMsodrawing;
-    delete pClientTextbox;
-    delete pTxo;
+    pClientTextbox.reset();
+    pTxo.reset();
 }
 
 void XclObj::ImplWriteAnchor( const SdrObject* pSdrObj, const tools::Rectangle* pChildAnchor )
@@ -410,10 +408,10 @@ void XclObj::SetText( const XclExpRoot& rRoot, const SdrTextObj& rObj )
     if ( !pClientTextbox )
     {
         mrEscherEx.UpdateDffFragmentEnd();
-        pClientTextbox = new XclExpMsoDrawing( mrEscherEx );
+        pClientTextbox.reset( new XclExpMsoDrawing( mrEscherEx ) );
         mrEscherEx.AddAtom( 0, ESCHER_ClientTextbox );    // TXO record
         mrEscherEx.UpdateDffFragmentEnd();
-        pTxo = new XclTxo( rRoot, rObj );
+        pTxo.reset( new XclTxo( rRoot, rObj ) );
     }
 }
 
@@ -514,7 +512,7 @@ XclObjComment::XclObjComment( XclExpObjectManager& rObjMgr, const tools::Rectang
 {
     ProcessEscherObj( rObjMgr.GetRoot(), rRect, pCaption, bVisible);
     // TXO
-    pTxo = new XclTxo( rObjMgr.GetRoot(), rEditObj, pCaption );
+    pTxo .reset(new XclTxo( rObjMgr.GetRoot(), rEditObj, pCaption ));
 }
 
 static void lcl_FillProps( EscherPropertyContainer& rPropOpt, SdrObject* pCaption, bool bVisible )
@@ -584,7 +582,7 @@ void XclObjComment::ProcessEscherObj( const XclExpRoot& rRoot, const tools::Rect
 
     //! Be sure to construct the MSODRAWING ClientTextbox record _after_ the
     //! base OBJ's MSODRAWING record Escher data is completed.
-    pClientTextbox = new XclExpMsoDrawing( mrEscherEx );
+    pClientTextbox.reset( new XclExpMsoDrawing( mrEscherEx ) );
     mrEscherEx.AddAtom( 0, ESCHER_ClientTextbox );    // TXO record
     mrEscherEx.UpdateDffFragmentEnd();
     mrEscherEx.CloseContainer();   // ESCHER_SpContainer
commit 8c63897b833df95b2e03b72f62fb180bdcf680ba
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jul 19 12:08:47 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jul 20 08:59:44 2018 +0200

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

diff --git a/sc/source/ui/inc/tpview.hxx b/sc/source/ui/inc/tpview.hxx
index 5453fd6d6020..51d0a3a14504 100644
--- a/sc/source/ui/inc/tpview.hxx
+++ b/sc/source/ui/inc/tpview.hxx
@@ -59,7 +59,7 @@ class ScTpContentOptions : public SfxTabPage
     VclPtr<CheckBox>        pTblRegCB;
     VclPtr<CheckBox>        pOutlineCB;
 
-    ScViewOptions*  pLocalOptions;
+    std::unique_ptr<ScViewOptions> pLocalOptions;
 
     void    InitGridOpt();
     DECL_LINK( GridHdl, ListBox&, void );
diff --git a/sc/source/ui/optdlg/tpview.cxx b/sc/source/ui/optdlg/tpview.cxx
index 94d6f9b07a0e..0fca706f38e2 100644
--- a/sc/source/ui/optdlg/tpview.cxx
+++ b/sc/source/ui/optdlg/tpview.cxx
@@ -40,8 +40,7 @@
 
 ScTpContentOptions::ScTpContentOptions( vcl::Window*         pParent,
                              const SfxItemSet&  rArgSet ) :
-    SfxTabPage(pParent, "TpViewPage", "modules/scalc/ui/tpviewpage.ui", &rArgSet),
-    pLocalOptions(nullptr)
+    SfxTabPage(pParent, "TpViewPage", "modules/scalc/ui/tpviewpage.ui", &rArgSet)
 {
     get(pGridLB,"grid");
     get(pColorFT,"color_label");
@@ -103,7 +102,7 @@ ScTpContentOptions::~ScTpContentOptions()
 
 void ScTpContentOptions::dispose()
 {
-    delete pLocalOptions;
+    pLocalOptions.reset();
     pGridLB.clear();
     pColorFT.clear();
     pColorLB.clear();
@@ -184,10 +183,10 @@ void    ScTpContentOptions::Reset( const SfxItemSet* rCoreSet )
 {
     const SfxPoolItem* pItem;
     if(SfxItemState::SET == rCoreSet->GetItemState(SID_SCVIEWOPTIONS, false , &pItem))
-        pLocalOptions  = new ScViewOptions(
-                            static_cast<const ScTpViewItem*>(pItem)->GetViewOptions() );
+        pLocalOptions.reset( new ScViewOptions(
+                            static_cast<const ScTpViewItem*>(pItem)->GetViewOptions() ) );
     else
-        pLocalOptions = new ScViewOptions;
+        pLocalOptions.reset( new ScViewOptions );
     pFormulaCB ->Check(pLocalOptions->GetOption(VOPT_FORMULAS));
     pNilCB     ->Check(pLocalOptions->GetOption(VOPT_NULLVALS));
     pAnnotCB   ->Check(pLocalOptions->GetOption(VOPT_NOTES));


More information about the Libreoffice-commits mailing list