summaryrefslogtreecommitdiff
path: root/package/source/xstor/owriteablestream.cxx
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 /package/source/xstor/owriteablestream.cxx
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 'package/source/xstor/owriteablestream.cxx')
-rw-r--r--package/source/xstor/owriteablestream.cxx18
1 files changed, 9 insertions, 9 deletions
diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx
index f821fd2494c8..c91996d0756c 100644
--- a/package/source/xstor/owriteablestream.cxx
+++ b/package/source/xstor/owriteablestream.cxx
@@ -423,7 +423,7 @@ void OWriteStream_Impl::SetDecrypted()
m_bHasCachedEncryptionData = false;
m_aEncryptionData.clear();
- for ( auto& rProp : m_aProps )
+ for ( auto& rProp : asNonConstRange(m_aProps) )
{
if ( rProp.Name == "Encrypted" )
rProp.Value <<= false;
@@ -446,7 +446,7 @@ void OWriteStream_Impl::SetEncrypted( const ::comphelper::SequenceAsHashMap& aEn
m_bHasDataToFlush = true;
// introduce encryption info
- for ( auto& rProp : m_aProps )
+ for ( auto& rProp : asNonConstRange(m_aProps) )
{
if ( rProp.Name == "Encrypted" )
rProp.Value <<= true;
@@ -735,7 +735,7 @@ void OWriteStream_Impl::InsertStreamDirectly( const uno::Reference< io::XInputSt
// if there are cached properties update them
if ( rProp.Name == aMedTypePropName || rProp.Name == aComprPropName )
- for ( auto& rMemProp : m_aProps )
+ for ( auto& rMemProp : asNonConstRange(m_aProps) )
{
if ( rProp.Name == rMemProp.Name )
rMemProp.Value = rProp.Value;
@@ -825,7 +825,7 @@ void OWriteStream_Impl::Commit()
// copy properties to the package stream
uno::Reference< beans::XPropertySet > xPropertySet( xNewPackageStream, uno::UNO_QUERY_THROW );
- for ( auto& rProp : m_aProps )
+ for ( auto& rProp : asNonConstRange(m_aProps) )
{
if ( rProp.Name == "Size" )
{
@@ -1053,7 +1053,7 @@ uno::Sequence< beans::PropertyValue > OWriteStream_Impl::ReadPackageStreamProper
// TODO: may be also raw stream should be marked
uno::Reference< beans::XPropertySet > xPropSet( m_xPackageStream, uno::UNO_QUERY_THROW );
- for ( auto& rProp : aResult )
+ for ( auto& rProp : asNonConstRange(aResult) )
{
try {
rProp.Value = xPropSet->getPropertyValue( rProp.Name );
@@ -2177,7 +2177,7 @@ void OWriteStream::CloseOutput_Impl()
if ( !m_xSeekable.is() )
throw uno::RuntimeException();
- for ( auto& rProp : m_pImpl->m_aProps )
+ for ( auto& rProp : asNonConstRange(m_pImpl->m_aProps) )
{
if ( rProp.Name == "Size" )
rProp.Value <<= m_xSeekable->getLength();
@@ -2785,7 +2785,7 @@ void SAL_CALL OWriteStream::setPropertyValue( const OUString& aPropertyName, con
bCompressedValueFromType = false;
}
- for ( auto& rProp : m_pImpl->m_aProps )
+ for ( auto& rProp : asNonConstRange(m_pImpl->m_aProps) )
{
if ( aPropertyName == rProp.Name )
rProp.Value = aValue;
@@ -2797,7 +2797,7 @@ void SAL_CALL OWriteStream::setPropertyValue( const OUString& aPropertyName, con
{
// if the "Compressed" property is not set explicitly, the MediaType can change the default value
m_pImpl->m_bCompressedSetExplicit = true;
- for ( auto& rProp : m_pImpl->m_aProps )
+ for ( auto& rProp : asNonConstRange(m_pImpl->m_aProps) )
{
if ( aPropertyName == rProp.Name )
rProp.Value = aValue;
@@ -2828,7 +2828,7 @@ void SAL_CALL OWriteStream::setPropertyValue( const OUString& aPropertyName, con
}
else if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML && aPropertyName == aMediaTypeString )
{
- for ( auto& rProp : m_pImpl->m_aProps )
+ for ( auto& rProp : asNonConstRange(m_pImpl->m_aProps) )
{
if ( aPropertyName == rProp.Name )
rProp.Value = aValue;