summaryrefslogtreecommitdiff
path: root/xmloff
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 /xmloff
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 'xmloff')
-rw-r--r--xmloff/source/chart/SchXMLExport.cxx4
-rw-r--r--xmloff/source/chart/SchXMLSeries2Context.cxx2
-rw-r--r--xmloff/source/core/PropertySetMerger.cxx2
-rw-r--r--xmloff/source/draw/shapeexport.cxx4
-rw-r--r--xmloff/source/forms/elementimport.cxx2
-rw-r--r--xmloff/source/forms/propertyexport.cxx2
-rw-r--r--xmloff/source/text/txtimp.cxx2
-rw-r--r--xmloff/source/transform/OOo2Oasis.cxx2
8 files changed, 10 insertions, 10 deletions
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index 372cd9cdaf9a..db8c7d6fc06e 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -701,7 +701,7 @@ uno::Sequence< OUString > lcl_DataSequenceToStringSequence(
[](const OUString& rString) { return !rString.isEmpty(); });
if( bHasText )
{
- auto [begin, end] = toNonConstRange(aValuesSequence);
+ auto [begin, end] = asNonConstRange(aValuesSequence);
std::iota(begin, end, 1);
}
}
@@ -3516,7 +3516,7 @@ void SchXMLExportHelper_Impl::exportDataPoints(
}
else
{
- for( sal_Int32 nCurrIndex : aDataPointSeq )
+ for( sal_Int32 nCurrIndex : std::as_const(aDataPointSeq) )
{
aPropertyStates.clear();
aDataLabelPropertyStates.clear();
diff --git a/xmloff/source/chart/SchXMLSeries2Context.cxx b/xmloff/source/chart/SchXMLSeries2Context.cxx
index 6739bab69197..d706bb46c038 100644
--- a/xmloff/source/chart/SchXMLSeries2Context.cxx
+++ b/xmloff/source/chart/SchXMLSeries2Context.cxx
@@ -234,7 +234,7 @@ Reference< chart2::data::XLabeledDataSequence2 > lcl_createAndAddSequenceToSerie
sal_Int32 nOldCount = aOldSeq.getLength();
Sequence< Reference< chart2::data::XLabeledDataSequence > > aNewSeq( nOldCount + 1 );
aNewSeq[0].set(xLabeledSeq, uno::UNO_QUERY_THROW);
- std::copy(aOldSeq.begin(), aOldSeq.end(), std::next(aNewSeq.begin()));
+ std::copy(aOldSeq.begin(), aOldSeq.end(), std::next(aNewSeq.getArray()));
xSeriesSink->setData( aNewSeq );
return xLabeledSeq;
diff --git a/xmloff/source/core/PropertySetMerger.cxx b/xmloff/source/core/PropertySetMerger.cxx
index bef82ea39923..7663aef638d3 100644
--- a/xmloff/source/core/PropertySetMerger.cxx
+++ b/xmloff/source/core/PropertySetMerger.cxx
@@ -157,7 +157,7 @@ Sequence< PropertyState > SAL_CALL PropertySetMergerImpl::getPropertyStates( con
const sal_Int32 nCount = aPropertyName.getLength();
Sequence< PropertyState > aPropStates( nCount );
- std::transform(aPropertyName.begin(), aPropertyName.end(), aPropStates.begin(),
+ std::transform(aPropertyName.begin(), aPropertyName.end(), aPropStates.getArray(),
[this](const OUString& rPropName) -> PropertyState { return getPropertyState(rPropName); });
return aPropStates;
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index 8cf4992340e1..f94fa160afd7 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -1062,7 +1062,7 @@ void FixZOrder(uno::Reference<drawing::XShapes> const& xShapes,
return; // nothing to do
}
uno::Sequence<sal_Int32> aNewOrder(nCount);
- auto iterInsert(aNewOrder.begin());
+ auto iterInsert(aNewOrder.getArray());
for (auto const& rLayer : layers)
{
assert(rLayer.nMin <= rLayer.nMax); // empty layers have been removed
@@ -1283,7 +1283,7 @@ void XMLShapeExport::ImpExportGluePoints( const uno::Reference< drawing::XShape
drawing::GluePoint2 aGluePoint;
- uno::Sequence< sal_Int32 > aIdSequence( xGluePoints->getIdentifiers() );
+ const uno::Sequence< sal_Int32 > aIdSequence( xGluePoints->getIdentifiers() );
for( const sal_Int32 nIdentifier : aIdSequence )
{
diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx
index e4f4f6aed753..0bbc1d51b883 100644
--- a/xmloff/source/forms/elementimport.cxx
+++ b/xmloff/source/forms/elementimport.cxx
@@ -371,7 +371,7 @@ namespace xmloff
"OElementImport::implApplyGenericProperties: conversion to sequences other than 'sequence< short >' not implemented, yet!" );
- std::transform(std::cbegin(aXMLValueList), std::cend(aXMLValueList), aPropertyValueList.begin(),
+ std::transform(std::cbegin(aXMLValueList), std::cend(aXMLValueList), aPropertyValueList.getArray(),
[](const Any& rXMLValue) -> sal_Int16 {
// only value sequences of numeric types implemented so far.
double nVal( 0 );
diff --git a/xmloff/source/forms/propertyexport.cxx b/xmloff/source/forms/propertyexport.cxx
index 91bf65072359..24f35dbed58a 100644
--- a/xmloff/source/forms/propertyexport.cxx
+++ b/xmloff/source/forms/propertyexport.cxx
@@ -93,7 +93,7 @@ namespace xmloff
css::uno::Sequence<T> anySeq;
bool bSuccess = value >>= anySeq;
assert(bSuccess); (void)bSuccess;
- for (T const & i : anySeq)
+ for (T const & i : std::as_const(anySeq))
{
OUString sValue(implConvertAny(makeAny(i)));
AddAttribute(XML_NAMESPACE_OFFICE, eValueAttName, sValue );
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index 8d4a96058f40..01ac94d097f2 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -380,7 +380,7 @@ namespace
if(!vListEntries.empty())
{
Sequence<OUString> vListEntriesSeq(vListEntries.size());
- copy(vListEntries.begin(), vListEntries.end(), vListEntriesSeq.begin());
+ copy(vListEntries.begin(), vListEntries.end(), vListEntriesSeq.getArray());
vOutParams[OUString(ODF_FORMDROPDOWN_LISTENTRY)] <<= vListEntriesSeq;
}
for(const auto& rCurrent : vOutParams)
diff --git a/xmloff/source/transform/OOo2Oasis.cxx b/xmloff/source/transform/OOo2Oasis.cxx
index 2a6111ca6256..2a853c430646 100644
--- a/xmloff/source/transform/OOo2Oasis.cxx
+++ b/xmloff/source/transform/OOo2Oasis.cxx
@@ -1932,7 +1932,7 @@ void OOo2OasisTransformer::Initialize(
{
Sequence<Any> aArgs( 1 + rArguments.getLength() );
aArgs[0] <<= xFilter;
- std::copy(rArguments.begin(), rArguments.end(), std::next(aArgs.begin()));
+ std::copy(rArguments.begin(), rArguments.end(), std::next(aArgs.getArray()));
XMLTransformerBase::initialize( aArgs );
OSL_ENSURE( GetDocHandler() == xFilter,