From c95221f151fbaab5f181bb5f8a5428a380d4d1bf Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Mon, 9 Oct 2017 21:19:43 +0200 Subject: Replace list by vector InputStreamsList_Impl (package) Change-Id: I4f03ddff09b8b7bb92dd1a9d2aeec279835c81b4 Reviewed-on: https://gerrit.libreoffice.org/43294 Tested-by: Jenkins Reviewed-by: Noel Grandin --- package/source/xstor/owriteablestream.cxx | 16 ++++++++-------- package/source/xstor/owriteablestream.hxx | 6 +++--- package/source/xstor/xstorage.cxx | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'package') diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index 8f03c20ff990..2f49e497dd47 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -478,10 +478,10 @@ void OWriteStream_Impl::DisposeWrappers() } m_pParent = nullptr; - if ( !m_aInputStreamsList.empty() ) + if ( !m_aInputStreamsVector.empty() ) { - for ( InputStreamsList_Impl::iterator pStreamIter = m_aInputStreamsList.begin(); - pStreamIter != m_aInputStreamsList.end(); ++pStreamIter ) + for ( InputStreamsVector_Impl::iterator pStreamIter = m_aInputStreamsVector.begin(); + pStreamIter != m_aInputStreamsVector.end(); ++pStreamIter ) { if ( *pStreamIter ) { @@ -490,7 +490,7 @@ void OWriteStream_Impl::DisposeWrappers() } } - m_aInputStreamsList.clear(); + m_aInputStreamsVector.clear(); } } @@ -1255,7 +1255,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre uno::UNO_QUERY ); SAL_WARN_IF( !xCompStream.is(), "package.xstor", "OInputCompStream MUST provide XStream interfaces!" ); - m_aInputStreamsList.push_back( pStream ); + m_aInputStreamsVector.push_back( pStream ); return xCompStream; } else if ( ( nStreamMode & embed::ElementModes::READWRITE ) == embed::ElementModes::SEEKABLEREAD ) @@ -1279,12 +1279,12 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre uno::UNO_QUERY ); SAL_WARN_IF( !xSeekStream.is(), "package.xstor", "OInputSeekStream MUST provide XStream interfaces!" ); - m_aInputStreamsList.push_back( pStream ); + m_aInputStreamsVector.push_back( pStream ); return xSeekStream; } else if ( ( nStreamMode & embed::ElementModes::WRITE ) == embed::ElementModes::WRITE ) { - if ( !m_aInputStreamsList.empty() ) + if ( !m_aInputStreamsVector.empty() ) throw io::IOException(); // TODO: uno::Reference< io::XStream > xStream; @@ -1384,7 +1384,7 @@ uno::Reference< io::XInputStream > OWriteStream_Impl::GetRawInStream() void OWriteStream_Impl::InputStreamDisposed( OInputCompStream* pStream ) { ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); - m_aInputStreamsList.remove( pStream ); + m_aInputStreamsVector.erase(std::remove(m_aInputStreamsVector.begin(), m_aInputStreamsVector.end(), pStream )); } void OWriteStream_Impl::CreateReadonlyCopyBasedOnData( const uno::Reference< io::XInputStream >& xDataToCopy, const uno::Sequence< beans::PropertyValue >& aProps, uno::Reference< io::XStream >& xTargetStream ) diff --git a/package/source/xstor/owriteablestream.hxx b/package/source/xstor/owriteablestream.hxx index a5c92fe6c3fa..e3eeaf09d4fd 100644 --- a/package/source/xstor/owriteablestream.hxx +++ b/package/source/xstor/owriteablestream.hxx @@ -45,7 +45,7 @@ #include #include -#include +#include #include #include "ocompinstream.hxx" @@ -60,7 +60,7 @@ namespace package { struct WSInternalData_Impl; -typedef ::std::list< OInputCompStream* > InputStreamsList_Impl; +typedef ::std::vector< OInputCompStream* > InputStreamsVector_Impl; struct OStorage_Impl; class OWriteStream; @@ -79,7 +79,7 @@ struct OWriteStream_Impl css::uno::Reference< css::io::XStream > m_xCacheStream; css::uno::Reference< css::io::XSeekable > m_xCacheSeek; - InputStreamsList_Impl m_aInputStreamsList; + InputStreamsVector_Impl m_aInputStreamsVector; bool m_bHasDataToFlush; // only modified elements will be sent to the original content bool m_bFlushed; // sending the streams is coordinated by the root storage of the package diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 5a58339077bd..9291eb53cbc7 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -1516,7 +1516,7 @@ void OStorage_Impl::RemoveElement( SotElement_Impl* pElement ) return; if ( (pElement->m_xStorage && ( pElement->m_xStorage->m_pAntiImpl || !pElement->m_xStorage->m_aReadOnlyWrapVector.empty() )) - || (pElement->m_xStream && ( pElement->m_xStream->m_pAntiImpl || !pElement->m_xStream->m_aInputStreamsList.empty() )) ) + || (pElement->m_xStream && ( pElement->m_xStream->m_pAntiImpl || !pElement->m_xStream->m_aInputStreamsVector.empty() )) ) throw io::IOException( THROW_WHERE ); // TODO: Access denied if ( pElement->m_bIsInserted ) @@ -3630,7 +3630,7 @@ void SAL_CALL OStorage::revert() if ( ((*pElementIter)->m_xStorage && ( (*pElementIter)->m_xStorage->m_pAntiImpl || !(*pElementIter)->m_xStorage->m_aReadOnlyWrapVector.empty() )) || ((*pElementIter)->m_xStream - && ( (*pElementIter)->m_xStream->m_pAntiImpl || !(*pElementIter)->m_xStream->m_aInputStreamsList.empty()) ) ) + && ( (*pElementIter)->m_xStream->m_pAntiImpl || !(*pElementIter)->m_xStream->m_aInputStreamsVector.empty()) ) ) throw io::IOException( THROW_WHERE ); // TODO: access denied } -- cgit