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

Noel Grandin noel.grandin at collabora.co.uk
Fri Mar 23 10:06:21 UTC 2018


 sd/source/filter/eppt/epptbase.hxx        |    4 ++--
 sd/source/filter/eppt/pptx-stylesheet.cxx |   15 +++++----------
 2 files changed, 7 insertions(+), 12 deletions(-)

New commits:
commit e4a839932a6247e8ddd9b16ae597a705ad71fb43
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Mar 22 13:29:11 2018 +0200

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

diff --git a/sd/source/filter/eppt/epptbase.hxx b/sd/source/filter/eppt/epptbase.hxx
index 2f726f3c6925..463067087503 100644
--- a/sd/source/filter/eppt/epptbase.hxx
+++ b/sd/source/filter/eppt/epptbase.hxx
@@ -292,8 +292,8 @@ class PPTExStyleSheet
 
     public:
 
-                PPTExCharSheet*     mpCharSheet[ PPTEX_STYLESHEETENTRYS ];
-                PPTExParaSheet*     mpParaSheet[ PPTEX_STYLESHEETENTRYS ];
+                std::unique_ptr<PPTExCharSheet>  mpCharSheet[ PPTEX_STYLESHEETENTRYS ];
+                std::unique_ptr<PPTExParaSheet>  mpParaSheet[ PPTEX_STYLESHEETENTRYS ];
 
                 PPTExStyleSheet( sal_uInt16 nDefaultTab, PPTExBulletProvider* pBuProv );
                 ~PPTExStyleSheet();
diff --git a/sd/source/filter/eppt/pptx-stylesheet.cxx b/sd/source/filter/eppt/pptx-stylesheet.cxx
index 1dbd28ee8a11..9fcc3c1f5a45 100644
--- a/sd/source/filter/eppt/pptx-stylesheet.cxx
+++ b/sd/source/filter/eppt/pptx-stylesheet.cxx
@@ -387,21 +387,16 @@ PPTExStyleSheet::PPTExStyleSheet( sal_uInt16 nDefaultTab, PPTExBulletProvider* p
 {
     for ( int nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ )
     {
-        mpParaSheet[ nInstance ] = ( nInstance == EPP_TEXTTYPE_notUsed ) ? nullptr : new PPTExParaSheet( nInstance, nDefaultTab, pBuProv );
-        mpCharSheet[ nInstance ] = ( nInstance == EPP_TEXTTYPE_notUsed ) ? nullptr : new PPTExCharSheet( nInstance );
+        if (nInstance != EPP_TEXTTYPE_notUsed)
+        {
+            mpParaSheet[ nInstance ].reset(new PPTExParaSheet( nInstance, nDefaultTab, pBuProv ));
+            mpCharSheet[ nInstance ].reset(new PPTExCharSheet( nInstance ));
+        }
     }
 }
 
 PPTExStyleSheet::~PPTExStyleSheet()
 {
-    for ( int nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ )
-    {
-        if ( nInstance == EPP_TEXTTYPE_notUsed )
-            continue;
-
-        delete mpParaSheet[ nInstance ];
-        delete mpCharSheet[ nInstance ];
-    }
 }
 
 void PPTExStyleSheet::SetStyleSheet( const css::uno::Reference< css::beans::XPropertySet > & rXPropSet,


More information about the Libreoffice-commits mailing list