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 /sd/source/filter | |
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 'sd/source/filter')
-rw-r--r-- | sd/source/filter/eppt/pptx-epptooxml.cxx | 2 | ||||
-rw-r--r-- | sd/source/filter/grf/sdgrffilter.cxx | 2 | ||||
-rw-r--r-- | sd/source/filter/ppt/pptinanimations.cxx | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx index 9070b6135259..c06c109cd0d4 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -2069,7 +2069,7 @@ bool PowerPointExport::WriteColorSchemes(const FSHelperPtr& pFS, const OUString& OUString sName = PredefinedClrNames[static_cast<PredefinedClrSchemeId>(nId)]; sal_Int32 nColor = 0; - for (auto aIt = aCurrentTheme.begin(); aIt != aCurrentTheme.end(); aIt++) + for (auto aIt = std::cbegin(aCurrentTheme); aIt != std::cend(aCurrentTheme); aIt++) { if (aIt->Name == sName) { diff --git a/sd/source/filter/grf/sdgrffilter.cxx b/sd/source/filter/grf/sdgrffilter.cxx index edf39df51513..4e3fefb797ea 100644 --- a/sd/source/filter/grf/sdgrffilter.cxx +++ b/sd/source/filter/grf/sdgrffilter.cxx @@ -246,7 +246,7 @@ bool SdGRFFilter::Export() OUString sShortName( rGraphicFilter.GetExportFormatShortName( nFilter ) ); bool bFilterNameFound = false; - for ( auto& rArg : aArgs ) + for ( auto& rArg : asNonConstRange(aArgs) ) { OUString& rStr = rArg.Name; if ( rStr == sFilterName ) diff --git a/sd/source/filter/ppt/pptinanimations.cxx b/sd/source/filter/ppt/pptinanimations.cxx index b6f40b20356e..2d8a5ef17103 100644 --- a/sd/source/filter/ppt/pptinanimations.cxx +++ b/sd/source/filter/ppt/pptinanimations.cxx @@ -535,7 +535,7 @@ bool AnimationImporter::convertAnimationNode( const Reference< XAnimationNode >& Sequence< Any > aValues( xAnimate->getValues() ); if( aValues.hasElements() ) { - for( Any& rValue : aValues ) + for( Any& rValue : asNonConstRange(aValues) ) oox::ppt::convertAnimationValue(eAttribute, rValue); xAnimate->setValues( aValues ); |