summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-10-14 09:25:24 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2021-10-15 10:36:36 +0200
commit2484de6728bd11bb7949003d112f1ece2223c7a1 (patch)
tree1296534e396da284b38d2c478dcd2b31c4714179 /cui
parent88375fd36899d21d3309cf8333712e02a87d3a91 (diff)
Remove non-const Sequence::begin()/end() in internal code
... to avoid hidden cost of multiple COW checks, because they call getArray() internally. This obsoletes [loplugin:sequenceloop]. Also rename toNonConstRange to asNonConstRange, to reflect that the result is a view of the sequence, not an independent object. TODO: also drop non-const operator[], but introduce operator[] in SequenceRange. Change-Id: Idd5fd7a3400fe65274d2a6343025e2ef8911635d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123518 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/customize/cfg.cxx2
-rw-r--r--cui/source/dialogs/AdditionsDialog.cxx2
-rw-r--r--cui/source/options/optaboutconfig.cxx4
-rw-r--r--cui/source/options/optgenrl.cxx2
4 files changed, 5 insertions, 5 deletions
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index eb7f4ce17c62..dbf17c120e4d 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -2057,7 +2057,7 @@ void ToolbarSaveInData::SetSystemStyle(
if ( a >>= aProps )
{
- for ( beans::PropertyValue& prop : aProps )
+ for ( beans::PropertyValue& prop : asNonConstRange(aProps) )
{
if ( prop.Name == ITEM_DESCRIPTOR_STYLE )
{
diff --git a/cui/source/dialogs/AdditionsDialog.cxx b/cui/source/dialogs/AdditionsDialog.cxx
index 8fcea1b99f0e..ac633177ef36 100644
--- a/cui/source/dialogs/AdditionsDialog.cxx
+++ b/cui/source/dialogs/AdditionsDialog.cxx
@@ -374,7 +374,7 @@ void SearchAndParseThread::Search()
void SearchAndParseThread::CheckInstalledExtensions()
{
- uno::Sequence<uno::Sequence<uno::Reference<deployment::XPackage>>> xAllPackages
+ const uno::Sequence<uno::Sequence<uno::Reference<deployment::XPackage>>> xAllPackages
= m_pAdditionsDialog->getInstalledExtensions();
if (!xAllPackages.hasElements())
diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx
index 39abfbedbadb..8a976277ca7c 100644
--- a/cui/source/options/optaboutconfig.cxx
+++ b/cui/source/options/optaboutconfig.cxx
@@ -352,7 +352,7 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
}
else if( sType == "[]byte" )
{
- uno::Sequence<sal_Int8> seq = aNode.get< uno::Sequence<sal_Int8> >();
+ const uno::Sequence<sal_Int8> seq = aNode.get< uno::Sequence<sal_Int8> >();
for( sal_Int8 j : seq )
{
OUString s = OUString::number(
@@ -366,7 +366,7 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
}
else if( sType == "[][]byte" )
{
- uno::Sequence< uno::Sequence<sal_Int8> > seq = aNode.get< uno::Sequence< uno::Sequence<sal_Int8> > >();
+ const uno::Sequence< uno::Sequence<sal_Int8> > seq = aNode.get< uno::Sequence< uno::Sequence<sal_Int8> > >();
for( sal_Int32 j = 0; j != seq.getLength(); ++j )
{
if( j != 0 )
diff --git a/cui/source/options/optgenrl.cxx b/cui/source/options/optgenrl.cxx
index df31ee10522d..9c657176527f 100644
--- a/cui/source/options/optgenrl.cxx
+++ b/cui/source/options/optgenrl.cxx
@@ -302,7 +302,7 @@ void SvxGeneralTabPage::InitCryptography()
if (xCertificates.hasElements())
{
- for (auto& xCert : xCertificates)
+ for (auto& xCert : asNonConstRange(xCertificates))
{
m_xSigningKeyLB->append_text( xCert->getIssuerName());
m_xEncryptionKeyLB->append_text( xCert->getIssuerName());