summaryrefslogtreecommitdiff
path: root/ucb
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 /ucb
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 'ucb')
-rw-r--r--ucb/source/cacher/cachedcontentresultset.cxx2
-rw-r--r--ucb/source/cacher/dynamicresultsetwrapper.cxx2
-rw-r--r--ucb/source/ucp/cmis/cmis_content.cxx10
-rw-r--r--ucb/source/ucp/ext/ucpext_content.cxx2
-rw-r--r--ucb/source/ucp/file/filnot.cxx2
-rw-r--r--ucb/source/ucp/file/filtask.cxx4
6 files changed, 11 insertions, 11 deletions
diff --git a/ucb/source/cacher/cachedcontentresultset.cxx b/ucb/source/cacher/cachedcontentresultset.cxx
index 8fbda792c435..3adfcc45a225 100644
--- a/ucb/source/cacher/cachedcontentresultset.cxx
+++ b/ucb/source/cacher/cachedcontentresultset.cxx
@@ -249,7 +249,7 @@ Sequence< sal_Bool >& CachedContentResultSet::CCRS_Cache
{
sal_Int32 nCount = m_pResult->Rows.getLength();
m_pMappedReminder.emplace( nCount );
- std::fill_n(m_pMappedReminder->begin(), m_pMappedReminder->getLength(), false);
+ std::fill_n(m_pMappedReminder->getArray(), m_pMappedReminder->getLength(), false);
}
return *m_pMappedReminder;
}
diff --git a/ucb/source/cacher/dynamicresultsetwrapper.cxx b/ucb/source/cacher/dynamicresultsetwrapper.cxx
index 12bac33b5f57..e465bbe6da0c 100644
--- a/ucb/source/cacher/dynamicresultsetwrapper.cxx
+++ b/ucb/source/cacher/dynamicresultsetwrapper.cxx
@@ -220,7 +220,7 @@ void DynamicResultSetWrapper::impl_notify( const ListEvent& Changes )
{
osl::Guard< osl::Mutex > aGuard( m_aMutex );
- for( ListAction& rAction : aNewEvent.Changes )
+ for( ListAction& rAction : asNonConstRange(aNewEvent.Changes) )
{
if (m_bGotWelcome)
break;
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index 57dd60f998cb..202e0a07b169 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -182,7 +182,7 @@ namespace
{
uno::Sequence< OUString > seqValue;
value >>= seqValue;
- std::transform(seqValue.begin(), seqValue.end(), std::back_inserter(values),
+ std::transform(std::cbegin(seqValue), std::cend(seqValue), std::back_inserter(values),
[](const OUString& rValue) -> std::string { return OUSTR_TO_STDSTR( rValue ); });
type = libcmis::PropertyType::String;
}
@@ -190,7 +190,7 @@ namespace
{
uno::Sequence< sal_Bool > seqValue;
value >>= seqValue;
- std::transform(seqValue.begin(), seqValue.end(), std::back_inserter(values),
+ std::transform(std::cbegin(seqValue), std::cend(seqValue), std::back_inserter(values),
[](const bool nValue) -> std::string { return OUSTR_TO_STDSTR( OUString::boolean( nValue ) ); });
type = libcmis::PropertyType::Bool;
}
@@ -198,7 +198,7 @@ namespace
{
uno::Sequence< sal_Int64 > seqValue;
value >>= seqValue;
- std::transform(seqValue.begin(), seqValue.end(), std::back_inserter(values),
+ std::transform(std::cbegin(seqValue), std::cend(seqValue), std::back_inserter(values),
[](const sal_Int64 nValue) -> std::string { return OUSTR_TO_STDSTR( OUString::number( nValue ) ); });
type = libcmis::PropertyType::Integer;
}
@@ -206,7 +206,7 @@ namespace
{
uno::Sequence< double > seqValue;
value >>= seqValue;
- std::transform(seqValue.begin(), seqValue.end(), std::back_inserter(values),
+ std::transform(std::cbegin(seqValue), std::cend(seqValue), std::back_inserter(values),
[](const double fValue) -> std::string { return OUSTR_TO_STDSTR( OUString::number( fValue ) ); });
type = libcmis::PropertyType::Decimal;
}
@@ -214,7 +214,7 @@ namespace
{
uno::Sequence< util::DateTime > seqValue;
value >>= seqValue;
- std::transform(seqValue.begin(), seqValue.end(), std::back_inserter(values),
+ std::transform(std::cbegin(seqValue), std::cend(seqValue), std::back_inserter(values),
[](const util::DateTime& rValue) -> std::string {
OUStringBuffer aBuffer;
::sax::Converter::convertDateTime( aBuffer, rValue, nullptr );
diff --git a/ucb/source/ucp/ext/ucpext_content.cxx b/ucb/source/ucp/ext/ucpext_content.cxx
index f1b50e46b009..fabbfda3129a 100644
--- a/ucb/source/ucp/ext/ucpext_content.cxx
+++ b/ucb/source/ucp/ext/ucpext_content.cxx
@@ -494,7 +494,7 @@ namespace ucb::ucp::ext
aEvent.Further = false;
aEvent.PropertyHandle = -1;
- for ( auto& rRet : aRet )
+ for ( auto& rRet : asNonConstRange(aRet) )
{
// all our properties are read-only ...
rRet <<= IllegalAccessException("property is read-only.", *this );
diff --git a/ucb/source/ucp/file/filnot.cxx b/ucb/source/ucp/file/filnot.cxx
index 728d48eea6ec..dadeffdb9cde 100644
--- a/ucb/source/ucp/file/filnot.cxx
+++ b/ucb/source/ucp/file/filnot.cxx
@@ -204,7 +204,7 @@ void PropertyChangeNotifier::notifyPropertyChanged(
{
uno::Sequence< beans::PropertyChangeEvent > Changes = seqChanged;
- for( auto& rChange : Changes )
+ for( auto& rChange : asNonConstRange(Changes) )
rChange.Source = m_xCreatorContent;
// notify listeners for all Events
diff --git a/ucb/source/ucp/file/filtask.cxx b/ucb/source/ucp/file/filtask.cxx
index 6f465dab57ba..b17092d2c2f8 100644
--- a/ucb/source/ucp/file/filtask.cxx
+++ b/ucb/source/ucp/file/filtask.cxx
@@ -1096,7 +1096,7 @@ TaskManager::getv( sal_Int32 CommandId,
PropertySet& propset = it->second.properties;
- std::transform(properties.begin(), properties.end(), seq.begin(),
+ std::transform(properties.begin(), properties.end(), seq.getArray(),
[&propset](const beans::Property& rProp) -> uno::Any {
MyProperty readProp( rProp.Name );
auto it1 = propset.find( readProp );
@@ -2518,7 +2518,7 @@ TaskManager::getv(
PropertySet& propset = it->second.properties;
- std::transform(properties.begin(), properties.end(), seq.begin(),
+ std::transform(properties.begin(), properties.end(), seq.getArray(),
[&propset](const beans::Property& rProp) -> uno::Any {
MyProperty readProp( rProp.Name );
auto it1 = propset.find( readProp );