diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-06 11:26:00 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-09 13:34:59 +0200 |
commit | f2ea65c92330ef0e36725a351f7b39027023f4bf (patch) | |
tree | 5432b4f8816bedaa0798dd11f7e6beec17a0ff9e | |
parent | fcc31cd0e0a6544a13dac0fdc66005d77f6f5cf9 (diff) |
loplugin:useuniqueptr in StringResourcePersistenceImpl
Change-Id: Ie3a516adeed9a2cec7b187368bc047461a33dc87
Reviewed-on: https://gerrit.libreoffice.org/60113
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | scripting/source/stringresource/stringresource.cxx | 10 |
1 files changed, 4 insertions, 6 deletions
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; } |