summaryrefslogtreecommitdiff
path: root/chart2
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 /chart2
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 'chart2')
-rw-r--r--chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx2
-rw-r--r--chart2/source/model/template/ColumnLineDataInterpreter.cxx4
-rw-r--r--chart2/source/tools/ReferenceSizeProvider.cxx4
-rw-r--r--chart2/source/view/axes/VCoordinateSystem.cxx4
-rw-r--r--chart2/source/view/main/VDataSeries.cxx2
5 files changed, 8 insertions, 8 deletions
diff --git a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
index adaa328e636d..e48ba0b3f443 100644
--- a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
@@ -219,7 +219,7 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const Sf
if(!bGroupBarsPerAxis)
{
//set the same value for all axes
- for( auto & pos : aBarPositionSequence )
+ for( auto & pos : asNonConstRange(aBarPositionSequence) )
pos = rBarPosition;
}
else if( nAxisIndex >= 0 && nAxisIndex < aBarPositionSequence.getLength() )
diff --git a/chart2/source/model/template/ColumnLineDataInterpreter.cxx b/chart2/source/model/template/ColumnLineDataInterpreter.cxx
index f59c98c489b6..6069255d3f1d 100644
--- a/chart2/source/model/template/ColumnLineDataInterpreter.cxx
+++ b/chart2/source/model/template/ColumnLineDataInterpreter.cxx
@@ -64,8 +64,8 @@ InterpretedData SAL_CALL ColumnLineDataInterpreter::interpretDataSource(
Sequence< Reference< XDataSeries > > & rColumnDataSeries = aResult.Series[0];
Sequence< Reference< XDataSeries > > & rLineDataSeries = aResult.Series[1];
rLineDataSeries.realloc( nNumOfLines );
- std::copy( rColumnDataSeries.begin() + nNumberOfSeries - nNumOfLines,
- rColumnDataSeries.begin() + nNumberOfSeries,
+ std::copy( std::cbegin(rColumnDataSeries) + nNumberOfSeries - nNumOfLines,
+ std::cbegin(rColumnDataSeries) + nNumberOfSeries,
rLineDataSeries.getArray() );
rColumnDataSeries.realloc( nNumberOfSeries - nNumOfLines );
}
diff --git a/chart2/source/tools/ReferenceSizeProvider.cxx b/chart2/source/tools/ReferenceSizeProvider.cxx
index b5b928e9e843..b409c1730e39 100644
--- a/chart2/source/tools/ReferenceSizeProvider.cxx
+++ b/chart2/source/tools/ReferenceSizeProvider.cxx
@@ -108,7 +108,7 @@ void ReferenceSizeProvider::setValuesAtAllDataSeries()
{
if( xSeriesProp->getPropertyValue( "AttributedDataPoints") >>= aPointIndexes )
{
- for( sal_Int32 idx : aPointIndexes )
+ for( sal_Int32 idx : std::as_const(aPointIndexes) )
setValuesAtPropertySet(
elem->getDataPointByIndex( idx ) );
}
@@ -282,7 +282,7 @@ ReferenceSizeProvider::AutoResizeState ReferenceSizeProvider::getAutoResizeState
{
if( xSeriesProp->getPropertyValue( "AttributedDataPoints") >>= aPointIndexes )
{
- for( sal_Int32 idx : aPointIndexes )
+ for( sal_Int32 idx : std::as_const(aPointIndexes) )
{
getAutoResizeFromPropSet(
elem->getDataPointByIndex( idx ), eResult );
diff --git a/chart2/source/view/axes/VCoordinateSystem.cxx b/chart2/source/view/axes/VCoordinateSystem.cxx
index 7259f3e92043..a320c85cb497 100644
--- a/chart2/source/view/axes/VCoordinateSystem.cxx
+++ b/chart2/source/view/axes/VCoordinateSystem.cxx
@@ -141,7 +141,7 @@ uno::Sequence< sal_Int32 > VCoordinateSystem::getCoordinateSystemResolution(
uno::Sequence<sal_Int32> aResolution(
std::max<sal_Int32>(m_xCooSysModel->getDimension(), 2));
- for( auto& i : aResolution )
+ for( auto& i : asNonConstRange(aResolution) )
i = 1000;
::basegfx::B3DTuple aScale( BaseGFXHelper::GetScaleFromMatrix(
@@ -177,7 +177,7 @@ uno::Sequence< sal_Int32 > VCoordinateSystem::getCoordinateSystemResolution(
//this maybe can be optimized further ...
sal_Int32 nMaxResolution = std::max( nXResolution, nYResolution );
nMaxResolution*=2;
- for( auto& i : aResolution )
+ for( auto& i : asNonConstRange(aResolution) )
i = nMaxResolution;
}
diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx
index b3047d4126b3..0d3123a8cb13 100644
--- a/chart2/source/view/main/VDataSeries.cxx
+++ b/chart2/source/view/main/VDataSeries.cxx
@@ -582,7 +582,7 @@ sal_Int32 VDataSeries::getLabelPlacement( sal_Int32 nPointIndex, const uno::Refe
if( xPointProps.is() )
xPointProps->getPropertyValue("LabelPlacement") >>= nLabelPlacement;
- uno::Sequence < sal_Int32 > aAvailablePlacements( ChartTypeHelper::getSupportedLabelPlacements(
+ const uno::Sequence < sal_Int32 > aAvailablePlacements( ChartTypeHelper::getSupportedLabelPlacements(
xChartType, bSwapXAndY, m_xDataSeries ) );
for( sal_Int32 n : aAvailablePlacements )