diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-14 09:25:24 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-15 10:36:36 +0200 |
commit | 2484de6728bd11bb7949003d112f1ece2223c7a1 (patch) | |
tree | 1296534e396da284b38d2c478dcd2b31c4714179 /cui/source/options | |
parent | 88375fd36899d21d3309cf8333712e02a87d3a91 (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/source/options')
-rw-r--r-- | cui/source/options/optaboutconfig.cxx | 4 | ||||
-rw-r--r-- | cui/source/options/optgenrl.cxx | 2 |
2 files changed, 3 insertions, 3 deletions
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()); |