Kaydet (Commit) c95221f1 authored tarafından Julien Nabet's avatar Julien Nabet Kaydeden (comit) Noel Grandin

Replace list by vector InputStreamsList_Impl (package)

Change-Id: I4f03ddff09b8b7bb92dd1a9d2aeec279835c81b4
Reviewed-on: https://gerrit.libreoffice.org/43294Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 295cf49b
......@@ -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 )
......
......@@ -45,7 +45,7 @@
#include <comphelper/refcountedmutex.hxx>
#include <comphelper/sequenceashashmap.hxx>
#include <list>
#include <vector>
#include <memory>
#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
......
......@@ -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
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment