summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-10-29 10:10:33 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-10-31 11:49:22 +0100
commit2d43223403aca309a051275159fdde2a084a8e51 (patch)
tree93fd4d4c3150d044434ba87ebefb12059751bdf7
parentc981ac598ab46eb3ab7d244bf07fdcbb691438b2 (diff)
Prepare for removal of non-const operator[] from Sequence in svl
Change-Id: I6b71a075de5d5ac002dc48cd2bb21ff5bf5dd072 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124395 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--svl/source/crypto/cryptosign.cxx8
-rw-r--r--svl/source/fsstor/fsstorage.cxx2
-rw-r--r--svl/source/items/imageitm.cxx10
-rw-r--r--svl/source/items/slstitm.cxx3
-rw-r--r--svl/source/items/srchitem.cxx48
-rw-r--r--svl/source/misc/msodocumentlockfile.cxx25
-rw-r--r--svl/source/misc/ownlist.cxx9
-rw-r--r--svl/source/misc/sharecontrolfile.cxx3
-rw-r--r--svl/source/numbers/supservs.cxx5
-rw-r--r--svl/source/numbers/zforlist.cxx49
-rw-r--r--svl/source/passwordcontainer/passwordcontainer.cxx32
-rw-r--r--svl/source/passwordcontainer/syscreds.cxx12
12 files changed, 95 insertions, 111 deletions
diff --git a/svl/source/crypto/cryptosign.cxx b/svl/source/crypto/cryptosign.cxx
index 25ac21b695c4..06080d221364 100644
--- a/svl/source/crypto/cryptosign.cxx
+++ b/svl/source/crypto/cryptosign.cxx
@@ -9,6 +9,7 @@
#include <sal/config.h>
+#include <algorithm>
#include <string_view>
#include <svl/cryptosign.hxx>
@@ -1998,8 +1999,9 @@ bool Signing::Verify(const std::vector<unsigned char>& aData,
else
{
uno::Sequence<sal_Int8> aDerCert(pCertificate->derCert.len);
+ auto aDerCertRange = asNonConstRange(aDerCert);
for (size_t i = 0; i < pCertificate->derCert.len; ++i)
- aDerCert[i] = pCertificate->derCert.data[i];
+ aDerCertRange[i] = pCertificate->derCert.data[i];
OUStringBuffer aBuffer;
comphelper::Base64::encode(aBuffer, aDerCert);
SignatureInformation::X509Data temp;
@@ -2184,8 +2186,8 @@ bool Signing::Verify(const std::vector<unsigned char>& aData,
{
// Write rInformation.ouX509Certificate.
uno::Sequence<sal_Int8> aDerCert(pSignerCertContext->cbCertEncoded);
- for (size_t i = 0; i < pSignerCertContext->cbCertEncoded; ++i)
- aDerCert[i] = pSignerCertContext->pbCertEncoded[i];
+ std::copy_n(pSignerCertContext->pbCertEncoded, pSignerCertContext->cbCertEncoded,
+ aDerCert.getArray());
OUStringBuffer aBuffer;
comphelper::Base64::encode(aBuffer, aDerCert);
SignatureInformation::X509Data temp;
diff --git a/svl/source/fsstor/fsstorage.cxx b/svl/source/fsstor/fsstorage.cxx
index 5f4d5e2541bf..91e2e4c49ba2 100644
--- a/svl/source/fsstor/fsstorage.cxx
+++ b/svl/source/fsstor/fsstorage.cxx
@@ -794,7 +794,7 @@ uno::Sequence< OUString > SAL_CALL FSStorage::getElementNames()
{
OUString aName( xRow->getString( 1 ) );
aResult.realloc( ++nSize );
- aResult[nSize-1] = aName;
+ aResult.getArray()[nSize-1] = aName;
}
}
}
diff --git a/svl/source/items/imageitm.cxx b/svl/source/items/imageitm.cxx
index 2c2a88600cc9..cba4b7103b82 100644
--- a/svl/source/items/imageitm.cxx
+++ b/svl/source/items/imageitm.cxx
@@ -54,12 +54,10 @@ bool SfxImageItem::operator==( const SfxPoolItem& rItem ) const
bool SfxImageItem::QueryValue( css::uno::Any& rVal, sal_uInt8 ) const
{
- css::uno::Sequence< css::uno::Any > aSeq( 4 );
- aSeq[0] <<= GetValue();
- aSeq[1] <<= sal_Int16(mnAngle);
- aSeq[2] <<= mbMirrored;
- aSeq[3] <<= maURL;
-
+ css::uno::Sequence< css::uno::Any > aSeq{ css::uno::Any(GetValue()),
+ css::uno::Any(sal_Int16(mnAngle)),
+ css::uno::Any(mbMirrored),
+ css::uno::Any(maURL) };
rVal <<= aSeq;
return true;
}
diff --git a/svl/source/items/slstitm.cxx b/svl/source/items/slstitm.cxx
index 54af346254d6..bf0e37684ba7 100644
--- a/svl/source/items/slstitm.cxx
+++ b/svl/source/items/slstitm.cxx
@@ -153,8 +153,9 @@ void SfxStringListItem::GetStringList( css::uno::Sequence< OUString >& rList ) c
size_t nCount = mpList->size();
rList.realloc( nCount );
+ auto pList = rList.getArray();
for( size_t i=0; i < nCount; i++ )
- rList[i] = (*mpList)[i];
+ pList[i] = (*mpList)[i];
}
// virtual
diff --git a/svl/source/items/srchitem.cxx b/svl/source/items/srchitem.cxx
index fb2c0e83047c..24a46e28bd0b 100644
--- a/svl/source/items/srchitem.cxx
+++ b/svl/source/items/srchitem.cxx
@@ -24,6 +24,7 @@
#include <sal/macros.h>
#include <osl/diagnose.h>
+#include <comphelper/propertyvalue.hxx>
#include <unotools/searchopt.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/lang/Locale.hpp>
@@ -402,33 +403,26 @@ bool SvxSearchItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const
{
case 0 :
{
- Sequence< PropertyValue > aSeq( SRCH_PARAMS );
- aSeq[0].Name = SRCH_PARA_OPTIONS;
- aSeq[0].Value <<= m_aSearchOpt.toUnoSearchOptions2();
- aSeq[1].Name = SRCH_PARA_FAMILY;
- aSeq[1].Value <<= sal_Int16( m_eFamily );
- aSeq[2].Name = SRCH_PARA_COMMAND;
- aSeq[2].Value <<= static_cast<sal_uInt16>(m_nCommand);
- aSeq[3].Name = SRCH_PARA_CELLTYPE;
- aSeq[3].Value <<= static_cast<sal_uInt16>(m_nCellType);
- aSeq[4].Name = SRCH_PARA_APPFLAG;
- aSeq[4].Value <<= static_cast<sal_uInt16>(m_nAppFlag);
- aSeq[5].Name = SRCH_PARA_ROWDIR;
- aSeq[5].Value <<= m_bRowDirection;
- aSeq[6].Name = SRCH_PARA_ALLTABLES;
- aSeq[6].Value <<= m_bAllTables;
- aSeq[7].Name = SRCH_PARA_SEARCHFILTERED;
- aSeq[7].Value <<= m_bSearchFiltered;
- aSeq[8].Name = SRCH_PARA_SEARCHFORMATTED;
- aSeq[8].Value <<= m_bSearchFormatted;
- aSeq[9].Name = SRCH_PARA_BACKWARD;
- aSeq[9].Value <<= m_bBackward;
- aSeq[10].Name = SRCH_PARA_PATTERN;
- aSeq[10].Value <<= m_bPattern;
- aSeq[11].Name = SRCH_PARA_CONTENT;
- aSeq[11].Value <<= m_bContent;
- aSeq[12].Name = SRCH_PARA_ASIANOPT;
- aSeq[12].Value <<= m_bAsianOptions;
+ Sequence<PropertyValue> aSeq{
+ comphelper::makePropertyValue(SRCH_PARA_OPTIONS,
+ m_aSearchOpt.toUnoSearchOptions2()),
+ comphelper::makePropertyValue(SRCH_PARA_FAMILY, sal_Int16(m_eFamily)),
+ comphelper::makePropertyValue(SRCH_PARA_COMMAND,
+ static_cast<sal_uInt16>(m_nCommand)),
+ comphelper::makePropertyValue(SRCH_PARA_CELLTYPE,
+ static_cast<sal_uInt16>(m_nCellType)),
+ comphelper::makePropertyValue(SRCH_PARA_APPFLAG,
+ static_cast<sal_uInt16>(m_nAppFlag)),
+ comphelper::makePropertyValue(SRCH_PARA_ROWDIR, m_bRowDirection),
+ comphelper::makePropertyValue(SRCH_PARA_ALLTABLES, m_bAllTables),
+ comphelper::makePropertyValue(SRCH_PARA_SEARCHFILTERED, m_bSearchFiltered),
+ comphelper::makePropertyValue(SRCH_PARA_SEARCHFORMATTED, m_bSearchFormatted),
+ comphelper::makePropertyValue(SRCH_PARA_BACKWARD, m_bBackward),
+ comphelper::makePropertyValue(SRCH_PARA_PATTERN, m_bPattern),
+ comphelper::makePropertyValue(SRCH_PARA_CONTENT, m_bContent),
+ comphelper::makePropertyValue(SRCH_PARA_ASIANOPT, m_bAsianOptions)
+ };
+ assert(aSeq.getLength() == SRCH_PARAMS);
rVal <<= aSeq;
}
break;
diff --git a/svl/source/misc/msodocumentlockfile.cxx b/svl/source/misc/msodocumentlockfile.cxx
index e8b24e8cbe33..c4709840102f 100644
--- a/svl/source/misc/msodocumentlockfile.cxx
+++ b/svl/source/misc/msodocumentlockfile.cxx
@@ -92,12 +92,13 @@ void MSODocumentLockFile::WriteEntryToStream(
int nLockFileSize = m_eAppType == AppType::Word ? MSO_WORD_LOCKFILE_SIZE
: MSO_EXCEL_AND_POWERPOINT_LOCKFILE_SIZE;
css::uno::Sequence<sal_Int8> aData(nLockFileSize);
+ auto pData = aData.getArray();
// Write out the user name's length as a single byte integer
// The maximum length is 52 in MSO, so we'll need to truncate the user name if it's longer
OUString aUserName = aEntry[LockFileComponent::OOOUSERNAME];
int nIndex = 0;
- aData[nIndex] = static_cast<sal_Int8>(
+ pData[nIndex] = static_cast<sal_Int8>(
std::min(aUserName.getLength(), sal_Int32(MSO_USERNAME_MAX_LENGTH)));
if (aUserName.getLength() > MSO_USERNAME_MAX_LENGTH)
@@ -107,7 +108,7 @@ void MSODocumentLockFile::WriteEntryToStream(
nIndex = 1;
for (int nChar = 0; nChar < aUserName.getLength(); ++nChar)
{
- aData[nIndex] = static_cast<sal_Int8>(aUserName[nChar]);
+ pData[nIndex] = static_cast<sal_Int8>(aUserName[nChar]);
++nIndex;
}
@@ -117,36 +118,36 @@ void MSODocumentLockFile::WriteEntryToStream(
case AppType::Word:
while (nIndex < MSO_USERNAME_MAX_LENGTH + 2)
{
- aData[nIndex] = static_cast<sal_Int8>(0);
+ pData[nIndex] = static_cast<sal_Int8>(0);
++nIndex;
}
break;
case AppType::PowerPoint:
- aData[nIndex] = static_cast<sal_Int8>(0);
+ pData[nIndex] = static_cast<sal_Int8>(0);
++nIndex;
[[fallthrough]];
case AppType::Excel:
while (nIndex < MSO_USERNAME_MAX_LENGTH + 3)
{
- aData[nIndex] = static_cast<sal_Int8>(0x20);
+ pData[nIndex] = static_cast<sal_Int8>(0x20);
++nIndex;
}
break;
}
// At the next position we have the user name's length again, but now as a 2 byte integer
- aData[nIndex] = static_cast<sal_Int8>(
+ pData[nIndex] = static_cast<sal_Int8>(
std::min(aUserName.getLength(), sal_Int32(MSO_USERNAME_MAX_LENGTH)));
++nIndex;
- aData[nIndex] = 0;
+ pData[nIndex] = 0;
++nIndex;
// And the user name again with unicode characters
for (int nChar = 0; nChar < aUserName.getLength(); ++nChar)
{
- aData[nIndex] = static_cast<sal_Int8>(aUserName[nChar] & 0xff);
+ pData[nIndex] = static_cast<sal_Int8>(aUserName[nChar] & 0xff);
++nIndex;
- aData[nIndex] = static_cast<sal_Int8>(aUserName[nChar] >> 8);
+ pData[nIndex] = static_cast<sal_Int8>(aUserName[nChar] >> 8);
++nIndex;
}
@@ -156,7 +157,7 @@ void MSODocumentLockFile::WriteEntryToStream(
case AppType::Word:
while (nIndex < nLockFileSize)
{
- aData[nIndex] = static_cast<sal_Int8>(0);
+ pData[nIndex] = static_cast<sal_Int8>(0);
++nIndex;
}
break;
@@ -164,11 +165,11 @@ void MSODocumentLockFile::WriteEntryToStream(
case AppType::PowerPoint:
while (nIndex < nLockFileSize)
{
- aData[nIndex] = static_cast<sal_Int8>(0x20);
+ pData[nIndex] = static_cast<sal_Int8>(0x20);
++nIndex;
if (nIndex < nLockFileSize)
{
- aData[nIndex] = static_cast<sal_Int8>(0);
+ pData[nIndex] = static_cast<sal_Int8>(0);
++nIndex;
}
}
diff --git a/svl/source/misc/ownlist.cxx b/svl/source/misc/ownlist.cxx
index 162d3e235b3a..22b9d21fcc16 100644
--- a/svl/source/misc/ownlist.cxx
+++ b/svl/source/misc/ownlist.cxx
@@ -57,12 +57,13 @@ void SvCommandList::FillSequence( css::uno::Sequence < css::beans::PropertyValue
{
const sal_Int32 nCount = aCommandList.size();
aCommandSequence.realloc( nCount );
+ auto pCommandSequence = aCommandSequence.getArray();
for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
{
- aCommandSequence[nIndex].Name = aCommandList[ nIndex ].GetCommand();
- aCommandSequence[nIndex].Handle = -1;
- aCommandSequence[nIndex].Value <<= aCommandList[ nIndex ].GetArgument();
- aCommandSequence[nIndex].State = beans::PropertyState_DIRECT_VALUE;
+ pCommandSequence[nIndex].Name = aCommandList[ nIndex ].GetCommand();
+ pCommandSequence[nIndex].Handle = -1;
+ pCommandSequence[nIndex].Value <<= aCommandList[ nIndex ].GetArgument();
+ pCommandSequence[nIndex].State = beans::PropertyState_DIRECT_VALUE;
}
}
diff --git a/svl/source/misc/sharecontrolfile.cxx b/svl/source/misc/sharecontrolfile.cxx
index a7bdf7af85f6..cf474fe459af 100644
--- a/svl/source/misc/sharecontrolfile.cxx
+++ b/svl/source/misc/sharecontrolfile.cxx
@@ -154,6 +154,7 @@ std::vector< o3tl::enumarray< LockFileComponent, OUString > > ShareControlFile::
m_xSeekable->seek( 0 );
sal_Int32 nRead = m_xInputStream->readBytes( aBuffer, static_cast<sal_Int32>(nLength) );
+ auto aBufferRange = asNonConstRange(aBuffer);
nLength -= nRead;
while ( nLength > 0 )
{
@@ -163,7 +164,7 @@ std::vector< o3tl::enumarray< LockFileComponent, OUString > > ShareControlFile::
throw uno::RuntimeException();
for ( sal_Int32 nInd = 0; nInd < nRead; nInd++ )
- aBuffer[aBuffer.getLength() - static_cast<sal_Int32>(nLength) + nInd] = aTmpBuf[nInd];
+ aBufferRange[aBuffer.getLength() - static_cast<sal_Int32>(nLength) + nInd] = aTmpBuf[nInd];
nLength -= nRead;
}
diff --git a/svl/source/numbers/supservs.cxx b/svl/source/numbers/supservs.cxx
index 5ba51f69c746..165e67829feb 100644
--- a/svl/source/numbers/supservs.cxx
+++ b/svl/source/numbers/supservs.cxx
@@ -144,10 +144,7 @@ void SvNumberFormatsSupplierServiceObject::implEnsureFormatter()
css::lang::Locale aOfficeLocale = aSysLocale.GetLocaleData().getLanguageTag().getLocale();
// initialize with this locale
- Sequence< Any > aFakedInitProps( 1 );
- aFakedInitProps[0] <<= aOfficeLocale;
-
- initialize( aFakedInitProps );
+ initialize({ Any(aOfficeLocale) });
}
}
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 3969f1885199..8e90067a47b8 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -2389,9 +2389,8 @@ sal_Int32 SvNumberFormatter::ImpGetFormatCodeIndex(
}
else
{ // we need at least _some_ format
- rSeq.realloc(1);
- rSeq[0] = css::i18n::NumberFormatCode();
- rSeq[0].Code = "0" + GetNumDecimalSep() + "############";
+ rSeq = { css::i18n::NumberFormatCode() };
+ rSeq.getArray()[0].Code = "0" + GetNumDecimalSep() + "############";
}
return 0;
}
@@ -2567,7 +2566,6 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio
css::lang::Locale aLocale = GetLanguageTag().getLocale();
css::uno::Reference< css::i18n::XNumberFormatCode > xNFC = i18n::NumberFormatMapper::create( m_xContext );
sal_Int32 nIdx;
- bool bDefault;
// Number
uno::Sequence< i18n::NumberFormatCode > aFormatSeq = xNFC->getAllFormatCode( i18n::KNumberFormatUsage::FIXED_NUMBER, aLocale );
@@ -2678,51 +2676,46 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio
// #,##0
nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_CURRENCY_1000INT );
- bDefault = aFormatSeq[nIdx].Default;
- aFormatSeq[nIdx].Default = false;
- ImpInsertFormat( aFormatSeq[nIdx],
+ // Just copy the format, to avoid COW on sequence after each possible reallocation
+ auto aFormat = aFormatSeq[nIdx];
+ aFormat.Default = false;
+ ImpInsertFormat( aFormat,
CLOffset + ZF_STANDARD_CURRENCY /* NF_CURRENCY_1000INT */ );
- aFormatSeq[nIdx].Default = bDefault;
// #,##0.00
nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_CURRENCY_1000DEC2 );
- bDefault = aFormatSeq[nIdx].Default;
- aFormatSeq[nIdx].Default = false;
- ImpInsertFormat( aFormatSeq[nIdx],
+ aFormat = aFormatSeq[nIdx];
+ aFormat.Default = false;
+ ImpInsertFormat( aFormat,
CLOffset + ZF_STANDARD_CURRENCY+1 /* NF_CURRENCY_1000DEC2 */ );
- aFormatSeq[nIdx].Default = bDefault;
// #,##0 negative red
nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_CURRENCY_1000INT_RED );
- bDefault = aFormatSeq[nIdx].Default;
- aFormatSeq[nIdx].Default = false;
- ImpInsertFormat( aFormatSeq[nIdx],
+ aFormat = aFormatSeq[nIdx];
+ aFormat.Default = false;
+ ImpInsertFormat(aFormat,
CLOffset + ZF_STANDARD_CURRENCY+2 /* NF_CURRENCY_1000INT_RED */ );
- aFormatSeq[nIdx].Default = bDefault;
// #,##0.00 negative red
nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_CURRENCY_1000DEC2_RED );
- bDefault = aFormatSeq[nIdx].Default;
- aFormatSeq[nIdx].Default = false;
- ImpInsertFormat( aFormatSeq[nIdx],
+ aFormat = aFormatSeq[nIdx];
+ aFormat.Default = false;
+ ImpInsertFormat(aFormat,
CLOffset + ZF_STANDARD_CURRENCY+3 /* NF_CURRENCY_1000DEC2_RED */ );
- aFormatSeq[nIdx].Default = bDefault;
// #,##0.00 USD
nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_CURRENCY_1000DEC2_CCC );
- bDefault = aFormatSeq[nIdx].Default;
- aFormatSeq[nIdx].Default = false;
- ImpInsertFormat( aFormatSeq[nIdx],
+ aFormat = aFormatSeq[nIdx];
+ aFormat.Default = false;
+ ImpInsertFormat( aFormat,
CLOffset + ZF_STANDARD_CURRENCY+4 /* NF_CURRENCY_1000DEC2_CCC */ );
- aFormatSeq[nIdx].Default = bDefault;
// #.##0,--
nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_CURRENCY_1000DEC2_DASHED );
- bDefault = aFormatSeq[nIdx].Default;
- aFormatSeq[nIdx].Default = false;
- ImpInsertFormat( aFormatSeq[nIdx],
+ aFormat = aFormatSeq[nIdx];
+ aFormat.Default = false;
+ ImpInsertFormat(aFormat,
CLOffset + ZF_STANDARD_CURRENCY+5 /* NF_CURRENCY_1000DEC2_DASHED */ );
- aFormatSeq[nIdx].Default = bDefault;
// Date
diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx
index a5621e0ee4b2..54fa34ce93f0 100644
--- a/svl/source/passwordcontainer/passwordcontainer.cxx
+++ b/svl/source/passwordcontainer/passwordcontainer.cxx
@@ -26,6 +26,7 @@
#include <cppuhelper/factory.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/propertyvalue.hxx>
#include <comphelper/sequence.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/task/InteractionHandler.hpp>
@@ -263,9 +264,7 @@ bool StorageItem::getEncodedMasterPassword( OUString& aResult )
return true;
}
- Sequence< OUString > aNodeNames( 2 );
- aNodeNames[0] = "HasMaster";
- aNodeNames[1] = "Master";
+ Sequence< OUString > aNodeNames{ "HasMaster", "Master" };
Sequence< Any > aPropertyValues = ConfigItem::GetProperties( aNodeNames );
@@ -318,11 +317,9 @@ void StorageItem::update( const OUString& aURL, const NamePasswordRecord& aRecor
return;
}
- Sequence< beans::PropertyValue > sendSeq(1);
-
- sendSeq[0].Name = "Store/Passwordstorage['" + createIndex( { aURL, aRecord.GetUserName() } ) + "']/Password";
-
- sendSeq[0].Value <<= aRecord.GetPersistentPasswords();
+ Sequence< beans::PropertyValue > sendSeq{ comphelper::makePropertyValue(
+ "Store/Passwordstorage['" + createIndex( { aURL, aRecord.GetUserName() } ) + "']/Password",
+ aRecord.GetPersistentPasswords()) };
ConfigItem::SetModified();
ConfigItem::SetSetProperties( "Store", sendSeq );
@@ -570,12 +567,13 @@ UserRecord PasswordContainer::CopyToUserRecord( const NamePasswordRecord& aRecor
Sequence< UserRecord > PasswordContainer::CopyToUserRecordSequence( const std::vector< NamePasswordRecord >& original, const Reference< XInteractionHandler >& aHandler )
{
Sequence< UserRecord > aResult( original.size() );
+ auto aResultRange = asNonConstRange(aResult);
sal_uInt32 nInd = 0;
bool bTryToDecode = true;
for (auto const& aNPIter : original)
{
- aResult[nInd] = CopyToUserRecord( aNPIter, bTryToDecode, aHandler );
+ aResultRange[nInd] = CopyToUserRecord( aNPIter, bTryToDecode, aHandler );
++nInd;
}
@@ -969,14 +967,14 @@ Sequence< UrlRecord > SAL_CALL PasswordContainer::getAllPersistent( const Refere
{
sal_Int32 oldLen = aUsers.getLength();
aUsers.realloc( oldLen + 1 );
- aUsers[ oldLen ] = UserRecord( aNP.GetUserName(), comphelper::containerToSequence( DecodePasswords( aNP.GetPersistentPasswords(), GetMasterPassword( xHandler ), css::task::PasswordRequestMode_PASSWORD_ENTER ) ) );
+ aUsers.getArray()[ oldLen ] = UserRecord( aNP.GetUserName(), comphelper::containerToSequence( DecodePasswords( aNP.GetPersistentPasswords(), GetMasterPassword( xHandler ), css::task::PasswordRequestMode_PASSWORD_ENTER ) ) );
}
if( aUsers.hasElements() )
{
sal_Int32 oldLen = aResult.getLength();
aResult.realloc( oldLen + 1 );
- aResult[ oldLen ] = UrlRecord( rEntry.first, aUsers );
+ aResult.getArray()[ oldLen ] = UrlRecord( rEntry.first, aUsers );
}
}
@@ -1299,8 +1297,7 @@ MasterPasswordRequest_Impl::MasterPasswordRequest_Impl( PasswordRequestMode Mode
setRequest( makeAny( aRequest ) );
// Fill continuations...
- Sequence< RememberAuthentication > aRememberModes( 1 );
- aRememberModes[ 0 ] = RememberAuthentication_NO;
+ Sequence< RememberAuthentication > aRememberModes{ RememberAuthentication_NO };
m_xAuthSupplier
= new ::ucbhelper::InteractionSupplyAuthentication(
@@ -1317,10 +1314,11 @@ MasterPasswordRequest_Impl::MasterPasswordRequest_Impl( PasswordRequestMode Mode
);
Sequence<
- Reference< XInteractionContinuation > > aContinuations( 3 );
- aContinuations[ 0 ] = new ::ucbhelper::InteractionAbort( this );
- aContinuations[ 1 ] = new ::ucbhelper::InteractionRetry( this );
- aContinuations[ 2 ] = m_xAuthSupplier.get();
+ Reference< XInteractionContinuation > > aContinuations{
+ new ::ucbhelper::InteractionAbort( this ),
+ new ::ucbhelper::InteractionRetry( this ),
+ m_xAuthSupplier
+ };
setContinuations( aContinuations );
}
diff --git a/svl/source/passwordcontainer/syscreds.cxx b/svl/source/passwordcontainer/syscreds.cxx
index c4fb701ae8bc..a3354b853a82 100644
--- a/svl/source/passwordcontainer/syscreds.cxx
+++ b/svl/source/passwordcontainer/syscreds.cxx
@@ -84,10 +84,8 @@ void SysCredentialsConfigItem::setSystemCredentialsURLs(
::osl::MutexGuard aGuard( m_aMutex );
// write config item.
- uno::Sequence< OUString > aPropNames( 1 );
- uno::Sequence< uno::Any > aPropValues( 1 );
- aPropNames[ 0 ] = "AuthenticateUsingSystemCredentials";
- aPropValues[ 0 ] <<= seqURLList;
+ uno::Sequence< OUString > aPropNames{ "AuthenticateUsingSystemCredentials" };
+ uno::Sequence< uno::Any > aPropValues{ uno::Any(seqURLList) };
utl::ConfigItem::SetModified();
utl::ConfigItem::PutProperties( aPropNames, aPropValues );
@@ -236,12 +234,12 @@ uno::Sequence< OUString > SysCredentialsConfig::list( bool bOnlyPersistent )
sal_Int32 nCount = m_aCfgContainer.size()
+ ( bOnlyPersistent ? 0 : m_aMemContainer.size() );
uno::Sequence< OUString > aResult( nCount );
-
+ auto aResultRange = asNonConstRange(aResult);
sal_Int32 n = 0;
for ( const auto& rItem : m_aCfgContainer )
{
- aResult[ n ] = rItem;
+ aResultRange[ n ] = rItem;
++n;
}
@@ -249,7 +247,7 @@ uno::Sequence< OUString > SysCredentialsConfig::list( bool bOnlyPersistent )
{
for ( const auto& rItem : m_aMemContainer )
{
- aResult[ n ] = rItem;
+ aResultRange[ n ] = rItem;
++n;
}
}