[Libreoffice-commits] core.git: xmloff/inc xmloff/source

Noel Grandin noel.grandin at collabora.co.uk
Wed Jul 12 13:53:51 UTC 2017


 xmloff/inc/MultiPropertySetHelper.hxx          |    3 ++-
 xmloff/source/style/MultiPropertySetHelper.cxx |    5 ++---
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 57ffece4297f51bb1abd5093c58fc56be8aea2b8
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Jul 12 09:35:20 2017 +0200

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

diff --git a/xmloff/inc/MultiPropertySetHelper.hxx b/xmloff/inc/MultiPropertySetHelper.hxx
index 661266883661..7218c89a9617 100644
--- a/xmloff/inc/MultiPropertySetHelper.hxx
+++ b/xmloff/inc/MultiPropertySetHelper.hxx
@@ -21,6 +21,7 @@
 
 #include <rtl/ustring.hxx>
 #include <com/sun/star/uno/Sequence.hxx>
+#include <memory>
 
 
 namespace com { namespace sun { namespace star {
@@ -65,7 +66,7 @@ class MultiPropertySetHelper
 
     /// an array of indices that maps from pPropertyNames indices to
     /// aPropertySequence indices
-    sal_Int16* pSequenceIndex;
+    std::unique_ptr<sal_Int16[]> pSequenceIndex;
 
     /// the last set of values retrieved by getValues
     css::uno::Sequence< css::uno::Any > aValues;
diff --git a/xmloff/source/style/MultiPropertySetHelper.cxx b/xmloff/source/style/MultiPropertySetHelper.cxx
index a7f3d597b292..498491199c8a 100644
--- a/xmloff/source/style/MultiPropertySetHelper.cxx
+++ b/xmloff/source/style/MultiPropertySetHelper.cxx
@@ -56,7 +56,6 @@ MultiPropertySetHelper::~MultiPropertySetHelper()
 {
     pValues = nullptr; // memory 'owned' by aValues
 
-    delete[] pSequenceIndex;
     delete[] pPropertyNames;
 }
 
@@ -67,8 +66,8 @@ void MultiPropertySetHelper::hasProperties(
     SAL_WARN_IF( !rInfo.is(), "xmloff", "I'd really like an XPropertySetInfo here." );
 
     // allocate sequence index
-    if ( nullptr == pSequenceIndex )
-        pSequenceIndex = new sal_Int16[nLength] ;
+    if ( !pSequenceIndex )
+        pSequenceIndex.reset( new sal_Int16[nLength] );
 
     // construct pSequenceIndex
     sal_Int16 nNumberOfProperties = 0;


More information about the Libreoffice-commits mailing list