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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Sep 9 11:35:18 UTC 2018


 scripting/source/stringresource/stringresource.cxx |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

New commits:
commit f2ea65c92330ef0e36725a351f7b39027023f4bf
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Sep 6 11:26:00 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Sep 9 13:34:59 2018 +0200

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

diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx
index 3317fa330fd1..94c7d0ba85f7 100644
--- a/scripting/source/stringresource/stringresource.cxx
+++ b/scripting/source/stringresource/stringresource.cxx
@@ -1241,7 +1241,7 @@ Sequence< sal_Int8 > StringResourcePersistenceImpl::exportBinary(  )
     BinaryOutput aOut( m_xContext );
 
     sal_Int32 nLocaleCount = m_aLocaleItemVector.size();
-    Sequence< sal_Int8 >* pLocaleDataSeq = new Sequence< sal_Int8 >[ nLocaleCount ];
+    std::vector<Sequence< sal_Int8 >> aLocaleDataSeq(nLocaleCount);
 
     sal_Int32 iLocale = 0;
     sal_Int32 iDefault = 0;
@@ -1255,7 +1255,7 @@ Sequence< sal_Int8 > StringResourcePersistenceImpl::exportBinary(  )
             BinaryOutput aLocaleOut( m_xContext );
             implWriteLocaleBinary( pLocaleItem.get(), aLocaleOut );
 
-            pLocaleDataSeq[iLocale] = aLocaleOut.closeAndGetData();
+            aLocaleDataSeq[iLocale] = aLocaleOut.closeAndGetData();
         }
         ++iLocale;
     }
@@ -1273,7 +1273,7 @@ Sequence< sal_Int8 > StringResourcePersistenceImpl::exportBinary(  )
     {
         aOut.writeInt32( nDataPos );
 
-        Sequence< sal_Int8 >& rSeq = pLocaleDataSeq[iLocale];
+        Sequence< sal_Int8 >& rSeq = aLocaleDataSeq[iLocale];
         sal_Int32 nSeqLen = rSeq.getLength();
         nDataPos += nSeqLen;
     }
@@ -1286,13 +1286,11 @@ Sequence< sal_Int8 > StringResourcePersistenceImpl::exportBinary(  )
     {
         for( iLocale = 0; iLocale < nLocaleCount; iLocale++ )
         {
-            Sequence< sal_Int8 >& rSeq = pLocaleDataSeq[iLocale];
+            Sequence< sal_Int8 >& rSeq = aLocaleDataSeq[iLocale];
             xOutputStream->writeBytes( rSeq );
         }
     }
 
-    delete[] pLocaleDataSeq;
-
     Sequence< sal_Int8 > aRetSeq = aOut.closeAndGetData();
     return aRetSeq;
 }


More information about the Libreoffice-commits mailing list