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

Noel Grandin noel.grandin at collabora.co.uk
Wed Jun 20 07:46:46 UTC 2018


 cui/source/dialogs/iconcdlg.cxx |   11 +++++------
 cui/source/inc/iconcdlg.hxx     |    2 +-
 2 files changed, 6 insertions(+), 7 deletions(-)

New commits:
commit c116f3c5b3dc30650d9109d34187e439d2489654
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Jun 11 15:07:10 2018 +0200

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

diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx
index 32800dab81d3..eccfd85a2fc2 100644
--- a/cui/source/dialogs/iconcdlg.cxx
+++ b/cui/source/dialogs/iconcdlg.cxx
@@ -205,8 +205,7 @@ void IconChoiceDialog::dispose()
     }
     maPageList.clear();
 
-    delete pRanges;
-    pRanges = nullptr;
+    pRanges.reset();
     pOutSet.reset();
 
     m_pIconCtrl.clear();
@@ -467,7 +466,7 @@ const sal_uInt16* IconChoiceDialog::GetInputRanges( const SfxItemPool& rPool )
     }
 
     if ( pRanges )
-        return pRanges;
+        return pRanges.get();
     std::vector<sal_uInt16> aUS;
 
     size_t nCount = maPageList.size();
@@ -484,11 +483,11 @@ const sal_uInt16* IconChoiceDialog::GetInputRanges( const SfxItemPool& rPool )
         std::sort( aUS.begin(), aUS.end() );
     }
 
-    pRanges = new sal_uInt16[aUS.size() + 1];
-    std::copy( aUS.begin(), aUS.end(), pRanges );
+    pRanges.reset(new sal_uInt16[aUS.size() + 1]);
+    std::copy( aUS.begin(), aUS.end(), pRanges.get() );
     pRanges[aUS.size()] = 0;
 
-    return pRanges;
+    return pRanges.get();
 }
 
 
diff --git a/cui/source/inc/iconcdlg.hxx b/cui/source/inc/iconcdlg.hxx
index f65ebc645c34..d72edc06b5a0 100644
--- a/cui/source/inc/iconcdlg.hxx
+++ b/cui/source/inc/iconcdlg.hxx
@@ -113,7 +113,7 @@ private:
     const SfxItemSet*       pSet;
     std::unique_ptr<SfxItemSet>     pOutSet;
     SfxItemSet*             pExampleSet;
-    sal_uInt16*                 pRanges;
+    std::unique_ptr<sal_uInt16[]>   pRanges;
 
     DECL_LINK( ChosePageHdl_Impl, SvtIconChoiceCtrl*, void );
     DECL_LINK( OkHdl, Button*, void );


More information about the Libreoffice-commits mailing list