From 2484de6728bd11bb7949003d112f1ece2223c7a1 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Thu, 14 Oct 2021 09:25:24 +0200 Subject: 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 Reviewed-by: Mike Kaganski --- cui/source/customize/cfg.cxx | 2 +- cui/source/dialogs/AdditionsDialog.cxx | 2 +- cui/source/options/optaboutconfig.cxx | 4 ++-- cui/source/options/optgenrl.cxx | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'cui/source') 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>> xAllPackages + const uno::Sequence>> 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 seq = aNode.get< uno::Sequence >(); + const uno::Sequence seq = aNode.get< uno::Sequence >(); 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 > seq = aNode.get< uno::Sequence< uno::Sequence > >(); + const uno::Sequence< uno::Sequence > seq = aNode.get< uno::Sequence< uno::Sequence > >(); 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()); -- cgit