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 /starmath | |
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 'starmath')
-rw-r--r-- | starmath/source/cfgitem.cxx | 4 | ||||
-rw-r--r-- | starmath/source/mathml/mathmlexport.cxx | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx index 814e4101ed29..233b5fb7f351 100644 --- a/starmath/source/cfgitem.cxx +++ b/starmath/source/cfgitem.cxx @@ -372,7 +372,7 @@ void SmMathConfig::ReadSymbol( SmSym &rSymbol, sal_Int32 nProps = aNames.getLength(); OUString aDelim( "/" ); - for (auto& rName : aNames) + for (auto& rName : asNonConstRange(aNames)) rName = rBaseNode + aDelim + rSymbolName + aDelim + rName; const Sequence< Any > aValues = const_cast<SmMathConfig*>(this)->GetProperties(aNames); @@ -578,7 +578,7 @@ void SmMathConfig::ReadFontFormat( SmFontFormat &rFontFormat, sal_Int32 nProps = aNames.getLength(); OUString aDelim( "/" ); - for (auto& rName : aNames) + for (auto& rName : asNonConstRange(aNames)) rName = rBaseNode + aDelim + rSymbolName + aDelim + rName; const Sequence< Any > aValues = const_cast<SmMathConfig*>(this)->GetProperties(aNames); diff --git a/starmath/source/mathml/mathmlexport.cxx b/starmath/source/mathml/mathmlexport.cxx index 476d384f897c..a6efe93ec69a 100644 --- a/starmath/source/mathml/mathmlexport.cxx +++ b/starmath/source/mathml/mathmlexport.cxx @@ -532,7 +532,7 @@ void SmXMLExport::GetConfigurationSettings(Sequence<PropertyValue>& rProps) SmMathConfig* pConfig = SM_MOD()->GetConfig(); const bool bUsedSymbolsOnly = pConfig && pConfig->IsSaveOnlyUsedSymbols(); - std::transform(aProps.begin(), aProps.end(), rProps.begin(), + std::transform(aProps.begin(), aProps.end(), rProps.getArray(), [bUsedSymbolsOnly, &xProps](const Property& prop) { PropertyValue aRet; if (prop.Name != "Formula" && prop.Name != "BasicLibraries" |