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 /ucbhelper | |
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 'ucbhelper')
-rw-r--r-- | ucbhelper/source/provider/contentinfo.cxx | 2 | ||||
-rw-r--r-- | ucbhelper/source/provider/resultsetmetadata.cxx | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/ucbhelper/source/provider/contentinfo.cxx b/ucbhelper/source/provider/contentinfo.cxx index c8f5da5aaa79..28be385ea215 100644 --- a/ucbhelper/source/provider/contentinfo.cxx +++ b/ucbhelper/source/provider/contentinfo.cxx @@ -107,7 +107,7 @@ uno::Sequence< beans::Property > SAL_CALL PropertySetInfo::getProperties() m_xProps->realloc( nPos + nAddProps ); std::copy(rAddProps.begin(), rAddProps.end(), - std::next(m_xProps->begin(), nPos)); + std::next(m_xProps->getArray(), nPos)); } } } diff --git a/ucbhelper/source/provider/resultsetmetadata.cxx b/ucbhelper/source/provider/resultsetmetadata.cxx index ee3196d85426..ccd8a27587ce 100644 --- a/ucbhelper/source/provider/resultsetmetadata.cxx +++ b/ucbhelper/source/provider/resultsetmetadata.cxx @@ -286,7 +286,7 @@ sal_Int32 SAL_CALL ResultSetMetaData::getColumnType( sal_Int32 column ) const Sequence< Property > aProps = xInfo->getProperties(); - for ( Property& rProp : m_aProps ) + for ( Property& rProp : asNonConstRange(m_aProps) ) { auto pProp = std::find_if(aProps.begin(), aProps.end(), [&rProp](const Property& rProp1) { return rProp.Name == rProp1.Name; }); |