sc/source/filter/inc/lotattr.hxx   |    6 +++---
 sc/source/filter/lotus/lotattr.cxx |   22 ++++++++--------------
 2 files changed, 11 insertions(+), 17 deletions(-)

New commits:
commit 65c5a18e2708ba28f225bf98e4d2972e4e549ea5
Author: Noel Grandin <noel.gran...@collabora.co.uk>
Date:   Wed Jul 11 12:24:32 2018 +0200

    loplugin:useuniqueptr in LotAttrCache
    
    Change-Id: Ic28b2aa9488b4a85e18d3777798bc1106cfb7c5f
    Reviewed-on: https://gerrit.libreoffice.org/57299
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sc/source/filter/inc/lotattr.hxx b/sc/source/filter/inc/lotattr.hxx
index 676f5f308744..8439c8f89c40 100644
--- a/sc/source/filter/inc/lotattr.hxx
+++ b/sc/source/filter/inc/lotattr.hxx
@@ -93,9 +93,9 @@ private:
     const Color& GetColor( const sal_uInt8 nLotIndex ) const;
 
     ScDocumentPool*     pDocPool;
-    SvxColorItem*       ppColorItems[6];        // 0 and 7 are missing!
-    SvxColorItem*       pWhite;
-    Color*              pColTab;
+    std::unique_ptr<SvxColorItem> ppColorItems[6];        // 0 and 7 are 
missing!
+    std::unique_ptr<SvxColorItem> pWhite;
+    std::unique_ptr<Color[]>      pColTab;
     std::vector< std::unique_ptr<ENTRY> > aEntries;
 
     LOTUS_ROOT* mpLotusRoot;
diff --git a/sc/source/filter/lotus/lotattr.cxx 
b/sc/source/filter/lotus/lotattr.cxx
index 6883178e43eb..ba673aca6cef 100644
--- a/sc/source/filter/lotus/lotattr.cxx
+++ b/sc/source/filter/lotus/lotattr.cxx
@@ -50,7 +50,7 @@ LotAttrCache::LotAttrCache (LOTUS_ROOT* pLotRoot)
 {
     pDocPool = mpLotusRoot->pDoc->GetPool();
 
-    pColTab = new Color [ 8 ];
+    pColTab.reset( new Color [ 8 ] );
     pColTab[ 0 ] = COL_WHITE;
     pColTab[ 1 ] = COL_LIGHTBLUE;
     pColTab[ 2 ] = COL_LIGHTGREEN;
@@ -60,24 +60,18 @@ LotAttrCache::LotAttrCache (LOTUS_ROOT* pLotRoot)
     pColTab[ 6 ] = COL_YELLOW;
     pColTab[ 7 ] = COL_BLACK;
 
-    ppColorItems[ 0 ] = new SvxColorItem( GetColor( 1 ), ATTR_FONT_COLOR );    
 // 1
-    ppColorItems[ 1 ] = new SvxColorItem( GetColor( 2 ), ATTR_FONT_COLOR );
-    ppColorItems[ 2 ] = new SvxColorItem( GetColor( 3 ), ATTR_FONT_COLOR );
-    ppColorItems[ 3 ] = new SvxColorItem( GetColor( 4 ), ATTR_FONT_COLOR );
-    ppColorItems[ 4 ] = new SvxColorItem( GetColor( 5 ), ATTR_FONT_COLOR );
-    ppColorItems[ 5 ] = new SvxColorItem( GetColor( 6 ), ATTR_FONT_COLOR );    
 // 6
+    ppColorItems[ 0 ].reset( new SvxColorItem( GetColor( 1 ), ATTR_FONT_COLOR 
) );     // 1
+    ppColorItems[ 1 ].reset( new SvxColorItem( GetColor( 2 ), ATTR_FONT_COLOR 
) );
+    ppColorItems[ 2 ].reset( new SvxColorItem( GetColor( 3 ), ATTR_FONT_COLOR 
) );
+    ppColorItems[ 3 ].reset( new SvxColorItem( GetColor( 4 ), ATTR_FONT_COLOR 
) );
+    ppColorItems[ 4 ].reset( new SvxColorItem( GetColor( 5 ), ATTR_FONT_COLOR 
) );
+    ppColorItems[ 5 ].reset( new SvxColorItem( GetColor( 6 ), ATTR_FONT_COLOR 
) );     // 6
 
-    pWhite = new SvxColorItem( COL_WHITE, ATTR_FONT_COLOR );
+    pWhite.reset( new SvxColorItem( COL_WHITE, ATTR_FONT_COLOR ) );
 }
 
 LotAttrCache::~LotAttrCache()
 {
-    for(SvxColorItem* p : ppColorItems)
-        delete p;
-
-    delete pWhite;
-
-    delete[] pColTab;
 }
 
 const ScPatternAttr& LotAttrCache::GetPattAttr( const LotAttrWK3& rAttr )
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to