diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-19 17:06:34 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-20 14:13:35 +0200 |
commit | 809e2d33b45b54b4438a4c55aed93efd73d2aa49 (patch) | |
tree | 27f4995f949f25e7f26b3ac94028cecf0624ecb8 /package/source | |
parent | f6add3f04bd5acc162ada79597a87398236f1320 (diff) |
create comphelper::RefCountedMutex
and merge the two existing implementations of the idea - SotMutexHolder
from package and RefCountedMutex from connectivity
Change-Id: I87f09f359ac798cf934381a2c75225dab71dd43e
Reviewed-on: https://gerrit.libreoffice.org/38972
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'package/source')
-rw-r--r-- | package/source/xstor/ocompinstream.cxx | 66 | ||||
-rw-r--r-- | package/source/xstor/ocompinstream.hxx | 5 | ||||
-rw-r--r-- | package/source/xstor/oseekinstream.cxx | 8 | ||||
-rw-r--r-- | package/source/xstor/owriteablestream.cxx | 145 | ||||
-rw-r--r-- | package/source/xstor/owriteablestream.hxx | 13 | ||||
-rw-r--r-- | package/source/xstor/xstorage.cxx | 186 | ||||
-rw-r--r-- | package/source/xstor/xstorage.hxx | 6 | ||||
-rw-r--r-- | package/source/zipapi/XUnbufferedStream.cxx | 4 | ||||
-rw-r--r-- | package/source/zipapi/XUnbufferedStream.hxx | 8 | ||||
-rw-r--r-- | package/source/zipapi/ZipFile.cxx | 16 | ||||
-rw-r--r-- | package/source/zippackage/ZipPackage.cxx | 2 | ||||
-rw-r--r-- | package/source/zippackage/wrapstreamforshare.cxx | 18 | ||||
-rw-r--r-- | package/source/zippackage/wrapstreamforshare.hxx | 8 | ||||
-rw-r--r-- | package/source/zippackage/zipfileaccess.cxx | 2 |
14 files changed, 242 insertions, 245 deletions
diff --git a/package/source/xstor/ocompinstream.cxx b/package/source/xstor/ocompinstream.cxx index 0f73bdc2f6b6..2fc6927e4f04 100644 --- a/package/source/xstor/ocompinstream.cxx +++ b/package/source/xstor/ocompinstream.cxx @@ -34,15 +34,15 @@ OInputCompStream::OInputCompStream( OWriteStream_Impl& aImpl, const uno::Sequence< beans::PropertyValue >& aProps, sal_Int32 nStorageType ) : m_pImpl( &aImpl ) -, m_rMutexRef( m_pImpl->m_rMutexRef ) +, m_xMutex( m_pImpl->m_xMutex ) , m_xStream( xStream ) , m_pInterfaceContainer( nullptr ) , m_aProperties( aProps ) , m_bDisposed( false ) , m_nStorageType( nStorageType ) { - OSL_ENSURE( m_pImpl->m_rMutexRef.is(), "No mutex is provided!" ); - if ( !m_pImpl->m_rMutexRef.is() ) + OSL_ENSURE( m_pImpl->m_xMutex.is(), "No mutex is provided!" ); + if ( !m_pImpl->m_xMutex.is() ) throw uno::RuntimeException(); // just a disaster assert(m_xStream.is()); @@ -52,7 +52,7 @@ OInputCompStream::OInputCompStream( uno::Reference < io::XInputStream > const & const uno::Sequence< beans::PropertyValue >& aProps, sal_Int32 nStorageType ) : m_pImpl( nullptr ) -, m_rMutexRef( new SotMutexHolder ) +, m_xMutex( new comphelper::RefCountedMutex ) , m_xStream( xStream ) , m_pInterfaceContainer( nullptr ) , m_aProperties( aProps ) @@ -64,7 +64,7 @@ OInputCompStream::OInputCompStream( uno::Reference < io::XInputStream > const & OInputCompStream::~OInputCompStream() { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( !m_bDisposed ) { @@ -106,7 +106,7 @@ uno::Any SAL_CALL OInputCompStream::queryInterface( const uno::Type& rType ) sal_Int32 SAL_CALL OInputCompStream::readBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { SAL_INFO("package.xstor", "Disposed!"); @@ -118,7 +118,7 @@ sal_Int32 SAL_CALL OInputCompStream::readBytes( uno::Sequence< sal_Int8 >& aData sal_Int32 SAL_CALL OInputCompStream::readSomeBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { SAL_INFO("package.xstor", "Disposed!"); @@ -131,7 +131,7 @@ sal_Int32 SAL_CALL OInputCompStream::readSomeBytes( uno::Sequence< sal_Int8 >& a void SAL_CALL OInputCompStream::skipBytes( sal_Int32 nBytesToSkip ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { SAL_INFO("package.xstor", "Disposed!"); @@ -144,7 +144,7 @@ void SAL_CALL OInputCompStream::skipBytes( sal_Int32 nBytesToSkip ) sal_Int32 SAL_CALL OInputCompStream::available( ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { SAL_INFO("package.xstor", "Disposed!"); @@ -162,7 +162,7 @@ void SAL_CALL OInputCompStream::closeInput( ) uno::Reference< io::XInputStream > SAL_CALL OInputCompStream::getInputStream() { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { SAL_INFO("package.xstor", "Disposed!"); @@ -174,7 +174,7 @@ uno::Reference< io::XInputStream > SAL_CALL OInputCompStream::getInputStream() uno::Reference< io::XOutputStream > SAL_CALL OInputCompStream::getOutputStream() { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { SAL_INFO("package.xstor", "Disposed!"); @@ -187,7 +187,7 @@ uno::Reference< io::XOutputStream > SAL_CALL OInputCompStream::getOutputStream() void OInputCompStream::InternalDispose() { // can be called only by OWriteStream_Impl - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { SAL_INFO("package.xstor", "Disposed!"); @@ -214,7 +214,7 @@ void OInputCompStream::InternalDispose() void SAL_CALL OInputCompStream::dispose( ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { SAL_INFO("package.xstor", "Disposed!"); @@ -240,7 +240,7 @@ void SAL_CALL OInputCompStream::dispose( ) void SAL_CALL OInputCompStream::addEventListener( const uno::Reference< lang::XEventListener >& xListener ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { SAL_INFO("package.xstor", "Disposed!"); @@ -248,14 +248,14 @@ void SAL_CALL OInputCompStream::addEventListener( const uno::Reference< lang::XE } if ( !m_pInterfaceContainer ) - m_pInterfaceContainer = new ::comphelper::OInterfaceContainerHelper2( m_rMutexRef->GetMutex() ); + m_pInterfaceContainer = new ::comphelper::OInterfaceContainerHelper2( m_xMutex->GetMutex() ); m_pInterfaceContainer->addInterface( xListener ); } void SAL_CALL OInputCompStream::removeEventListener( const uno::Reference< lang::XEventListener >& xListener ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { SAL_INFO("package.xstor", "Disposed!"); @@ -268,7 +268,7 @@ void SAL_CALL OInputCompStream::removeEventListener( const uno::Reference< lang: sal_Bool SAL_CALL OInputCompStream::hasByID( const OUString& sID ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { @@ -292,7 +292,7 @@ sal_Bool SAL_CALL OInputCompStream::hasByID( const OUString& sID ) OUString SAL_CALL OInputCompStream::getTargetByID( const OUString& sID ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { @@ -313,7 +313,7 @@ OUString SAL_CALL OInputCompStream::getTargetByID( const OUString& sID ) OUString SAL_CALL OInputCompStream::getTypeByID( const OUString& sID ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { @@ -334,7 +334,7 @@ OUString SAL_CALL OInputCompStream::getTypeByID( const OUString& sID ) uno::Sequence< beans::StringPair > SAL_CALL OInputCompStream::getRelationshipByID( const OUString& sID ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { @@ -361,7 +361,7 @@ uno::Sequence< beans::StringPair > SAL_CALL OInputCompStream::getRelationshipByI uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OInputCompStream::getRelationshipsByType( const OUString& sType ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { @@ -394,7 +394,7 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OInputCompStream::g uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OInputCompStream::getAllRelationships() { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { @@ -421,7 +421,7 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OInputCompStream::g void SAL_CALL OInputCompStream::insertRelationshipByID( const OUString& /*sID*/, const uno::Sequence< beans::StringPair >& /*aEntry*/, sal_Bool /*bReplace*/ ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { @@ -437,7 +437,7 @@ void SAL_CALL OInputCompStream::insertRelationshipByID( const OUString& /*sID*/ void SAL_CALL OInputCompStream::removeRelationshipByID( const OUString& /*sID*/ ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { @@ -453,7 +453,7 @@ void SAL_CALL OInputCompStream::removeRelationshipByID( const OUString& /*sID*/ void SAL_CALL OInputCompStream::insertRelationships( const uno::Sequence< uno::Sequence< beans::StringPair > >& /*aEntries*/, sal_Bool /*bReplace*/ ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { @@ -469,7 +469,7 @@ void SAL_CALL OInputCompStream::insertRelationships( const uno::Sequence< uno:: void SAL_CALL OInputCompStream::clearRelationships() { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { @@ -485,7 +485,7 @@ void SAL_CALL OInputCompStream::clearRelationships() uno::Reference< beans::XPropertySetInfo > SAL_CALL OInputCompStream::getPropertySetInfo() { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { @@ -499,7 +499,7 @@ uno::Reference< beans::XPropertySetInfo > SAL_CALL OInputCompStream::getProperty void SAL_CALL OInputCompStream::setPropertyValue( const OUString& aPropertyName, const uno::Any& /*aValue*/ ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { @@ -521,7 +521,7 @@ void SAL_CALL OInputCompStream::setPropertyValue( const OUString& aPropertyName, uno::Any SAL_CALL OInputCompStream::getPropertyValue( const OUString& aProp ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { @@ -554,7 +554,7 @@ void SAL_CALL OInputCompStream::addPropertyChangeListener( const OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { @@ -569,7 +569,7 @@ void SAL_CALL OInputCompStream::removePropertyChangeListener( const OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { @@ -584,7 +584,7 @@ void SAL_CALL OInputCompStream::addVetoableChangeListener( const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { @@ -599,7 +599,7 @@ void SAL_CALL OInputCompStream::removeVetoableChangeListener( const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { diff --git a/package/source/xstor/ocompinstream.hxx b/package/source/xstor/ocompinstream.hxx index 3c37aaf0975e..68c2ce2262ae 100644 --- a/package/source/xstor/ocompinstream.hxx +++ b/package/source/xstor/ocompinstream.hxx @@ -29,8 +29,9 @@ #include <com/sun/star/embed/XRelationshipAccess.hpp> #include <cppuhelper/implbase.hxx> #include <comphelper/interfacecontainer2.hxx> +#include <comphelper/refcountedmutex.hxx> +#include <rtl/ref.hxx> -#include "mutexholder.hxx" struct OWriteStream_Impl; @@ -41,7 +42,7 @@ class OInputCompStream : public cppu::WeakImplHelper < css::io::XInputStream { protected: OWriteStream_Impl* m_pImpl; - rtl::Reference<SotMutexHolder> m_rMutexRef; + rtl::Reference<comphelper::RefCountedMutex> m_xMutex; css::uno::Reference < css::io::XInputStream > m_xStream; ::comphelper::OInterfaceContainerHelper2* m_pInterfaceContainer; css::uno::Sequence < css::beans::PropertyValue > m_aProperties; diff --git a/package/source/xstor/oseekinstream.cxx b/package/source/xstor/oseekinstream.cxx index 444637e90278..2e8527b5fbdf 100644 --- a/package/source/xstor/oseekinstream.cxx +++ b/package/source/xstor/oseekinstream.cxx @@ -56,7 +56,7 @@ uno::Sequence< uno::Type > SAL_CALL OInputSeekStream::getTypes() if ( pTypeCollection == nullptr ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ) ; + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ) ; if ( pTypeCollection == nullptr ) { @@ -101,7 +101,7 @@ void SAL_CALL OInputSeekStream::release() void SAL_CALL OInputSeekStream::seek( sal_Int64 location ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { SAL_INFO("package.xstor", "Disposed!"); @@ -119,7 +119,7 @@ void SAL_CALL OInputSeekStream::seek( sal_Int64 location ) sal_Int64 SAL_CALL OInputSeekStream::getPosition() { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { SAL_INFO("package.xstor", "Disposed!"); @@ -137,7 +137,7 @@ sal_Int64 SAL_CALL OInputSeekStream::getPosition() sal_Int64 SAL_CALL OInputSeekStream::getLength() { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bDisposed ) { SAL_INFO("package.xstor", "Disposed!"); diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index 9c4c6f3cc680..7c5d67400fd4 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -43,12 +43,12 @@ #include <comphelper/processfactory.hxx> #include <comphelper/storagehelper.hxx> #include <comphelper/ofopxmlhelper.hxx> +#include <comphelper/refcountedmutex.hxx> #include <rtl/digest.h> #include <rtl/instance.hxx> #include <PackageConstants.hxx> -#include <mutexholder.hxx> #include "selfterminatefilestream.hxx" #include "owriteablestream.hxx" @@ -62,14 +62,14 @@ using namespace ::com::sun::star; struct WSInternalData_Impl { - rtl::Reference<SotMutexHolder> m_rSharedMutexRef; + rtl::Reference<comphelper::RefCountedMutex> m_xSharedMutex; ::std::unique_ptr< ::cppu::OTypeCollection> m_pTypeCollection; ::cppu::OMultiTypeInterfaceContainerHelper m_aListenersContainer; // list of listeners sal_Int32 m_nStorageType; // the mutex reference MUST NOT be empty - WSInternalData_Impl( const rtl::Reference<SotMutexHolder>& rMutexRef, sal_Int32 nStorageType ) - : m_rSharedMutexRef( rMutexRef ) + WSInternalData_Impl( const rtl::Reference<comphelper::RefCountedMutex>& rMutexRef, sal_Int32 nStorageType ) + : m_xSharedMutex( rMutexRef ) , m_pTypeCollection() , m_aListenersContainer( rMutexRef->GetMutex() ) , m_nStorageType( nStorageType ) @@ -268,7 +268,8 @@ OWriteStream_Impl::OWriteStream_Impl( OStorage_Impl* pParent, sal_Int32 nStorageType, bool bDefaultCompress, const uno::Reference< io::XInputStream >& xRelInfoStream ) -: m_pAntiImpl( nullptr ) +: m_xMutex( new comphelper::RefCountedMutex ) +, m_pAntiImpl( nullptr ) , m_bHasDataToFlush( false ) , m_bFlushed( false ) , m_xPackageStream( xPackageStream ) @@ -336,7 +337,7 @@ void OWriteStream_Impl::CleanCacheStream() void OWriteStream_Impl::InsertIntoPackageFolder( const OUString& aName, const uno::Reference< container::XNameContainer >& xParentPackageFolder ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); SAL_WARN_IF( !m_bFlushed, "package.xstor", "This method must not be called for nonflushed streams!" ); if ( m_bFlushed ) @@ -462,7 +463,7 @@ void OWriteStream_Impl::SetEncrypted( const ::comphelper::SequenceAsHashMap& aEn void OWriteStream_Impl::DisposeWrappers() { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_pAntiImpl ) { try { @@ -694,7 +695,7 @@ uno::Reference< io::XInputStream > OWriteStream_Impl::GetTempFileAsInputStream() void OWriteStream_Impl::InsertStreamDirectly( const uno::Reference< io::XInputStream >& xInStream, const uno::Sequence< beans::PropertyValue >& aProps ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ) ; + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ) ; // this call can be made only during parent storage commit // the parent storage is responsible for the correct handling @@ -775,7 +776,7 @@ void OWriteStream_Impl::InsertStreamDirectly( const uno::Reference< io::XInputSt void OWriteStream_Impl::Commit() { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ) ; + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ) ; SAL_WARN_IF( !m_xPackageStream.is(), "package.xstor", "No package stream is set!" ); @@ -878,7 +879,7 @@ void OWriteStream_Impl::Revert() // can be called only from parent storage // means complete reload of the stream - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ) ; + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ) ; if ( !m_bHasDataToFlush ) return; // nothing to do @@ -984,7 +985,7 @@ uno::Sequence< beans::PropertyValue > OWriteStream_Impl::InsertOwnProps( bool OWriteStream_Impl::IsTransacted() { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ) ; + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ) ; return ( m_pAntiImpl && m_pAntiImpl->m_bTransacted ); } @@ -1088,7 +1089,7 @@ uno::Sequence< beans::PropertyValue > OWriteStream_Impl::ReadPackageStreamProper void OWriteStream_Impl::CopyInternallyTo_Impl( const uno::Reference< io::XStream >& xDestStream, const ::comphelper::SequenceAsHashMap& aEncryptionData ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ) ; + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ) ; SAL_WARN_IF( m_bUseCommonEncryption, "package.xstor", "The stream can not be encrypted!" ); @@ -1130,7 +1131,7 @@ uno::Sequence< uno::Sequence< beans::StringPair > > OWriteStream_Impl::GetAllRel void OWriteStream_Impl::CopyInternallyTo_Impl( const uno::Reference< io::XStream >& xDestStream ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ) ; + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ) ; if ( m_pAntiImpl ) { @@ -1148,7 +1149,7 @@ void OWriteStream_Impl::CopyInternallyTo_Impl( const uno::Reference< io::XStream uno::Reference< io::XStream > OWriteStream_Impl::GetStream( sal_Int32 nStreamMode, const ::comphelper::SequenceAsHashMap& aEncryptionData, bool bHierarchyAccess ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ) ; + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ) ; SAL_WARN_IF( !m_xPackageStream.is(), "package.xstor", "No package stream is set!" ); @@ -1203,7 +1204,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream( sal_Int32 nStreamMod uno::Reference< io::XStream > OWriteStream_Impl::GetStream( sal_Int32 nStreamMode, bool bHierarchyAccess ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ) ; + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ) ; SAL_WARN_IF( !m_xPackageStream.is(), "package.xstor", "No package stream is set!" ); @@ -1348,7 +1349,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre uno::Reference< io::XInputStream > OWriteStream_Impl::GetPlainRawInStream() { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ) ; + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ) ; SAL_WARN_IF( !m_xPackageStream.is(), "package.xstor", "No package stream is set!" ); @@ -1361,7 +1362,7 @@ uno::Reference< io::XInputStream > OWriteStream_Impl::GetPlainRawInStream() uno::Reference< io::XInputStream > OWriteStream_Impl::GetRawInStream() { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ) ; + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ) ; SAL_WARN_IF( !m_xPackageStream.is(), "package.xstor", "No package stream is set!" ); @@ -1377,7 +1378,7 @@ uno::Reference< io::XInputStream > OWriteStream_Impl::GetRawInStream() ::comphelper::SequenceAsHashMap OWriteStream_Impl::GetCommonRootEncryptionData() { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ) ; + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ) ; if ( m_nStorageType != embed::StorageFormats::PACKAGE || !m_pParent ) throw packages::NoEncryptionException(); @@ -1387,7 +1388,7 @@ uno::Reference< io::XInputStream > OWriteStream_Impl::GetRawInStream() void OWriteStream_Impl::InputStreamDisposed( OInputCompStream* pStream ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); m_aInputStreamsList.remove( pStream ); } @@ -1425,7 +1426,7 @@ void OWriteStream_Impl::CreateReadonlyCopyBasedOnData( const uno::Reference< io: void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTargetStream ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); SAL_WARN_IF( !m_xPackageStream.is(), "package.xstor", "The source stream for copying is incomplete!" ); if ( !m_xPackageStream.is() ) @@ -1461,7 +1462,7 @@ void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTar void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTargetStream, const ::comphelper::SequenceAsHashMap& aEncryptionData ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); SAL_WARN_IF( !m_xPackageStream.is(), "package.xstor", "The source stream for copying is incomplete!" ); if ( !m_xPackageStream.is() ) @@ -1634,12 +1635,12 @@ OWriteStream::OWriteStream( OWriteStream_Impl* pImpl, bool bTransacted ) , m_bTransacted( bTransacted ) { OSL_ENSURE( pImpl, "No base implementation!" ); - OSL_ENSURE( m_pImpl->m_rMutexRef.is(), "No mutex!" ); + OSL_ENSURE( m_pImpl->m_xMutex.is(), "No mutex!" ); - if ( !m_pImpl || !m_pImpl->m_rMutexRef.is() ) + if ( !m_pImpl || !m_pImpl->m_xMutex.is() ) throw uno::RuntimeException(); // just a disaster - m_pData.reset(new WSInternalData_Impl(pImpl->m_rMutexRef, m_pImpl->m_nStorageType)); + m_pData.reset(new WSInternalData_Impl(pImpl->m_xMutex, m_pImpl->m_nStorageType)); } OWriteStream::OWriteStream( OWriteStream_Impl* pImpl, uno::Reference< io::XStream > const & xStream, bool bTransacted ) @@ -1650,12 +1651,12 @@ OWriteStream::OWriteStream( OWriteStream_Impl* pImpl, uno::Reference< io::XStrea , m_bTransacted( bTransacted ) { OSL_ENSURE( pImpl && xStream.is(), "No base implementation!" ); - OSL_ENSURE( m_pImpl->m_rMutexRef.is(), "No mutex!" ); + OSL_ENSURE( m_pImpl->m_xMutex.is(), "No mutex!" ); - if ( !m_pImpl || !m_pImpl->m_rMutexRef.is() ) + if ( !m_pImpl || !m_pImpl->m_xMutex.is() ) throw uno::RuntimeException(); // just a disaster - m_pData.reset(new WSInternalData_Impl(pImpl->m_rMutexRef, m_pImpl->m_nStorageType)); + m_pData.reset(new WSInternalData_Impl(pImpl->m_xMutex, m_pImpl->m_nStorageType)); if ( xStream.is() ) { @@ -1668,7 +1669,7 @@ OWriteStream::OWriteStream( OWriteStream_Impl* pImpl, uno::Reference< io::XStrea OWriteStream::~OWriteStream() { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( m_pImpl ) { m_refCount++; @@ -1723,7 +1724,7 @@ void OWriteStream::CheckInitOnDemand() void OWriteStream::CopyToStreamInternally_Impl( const uno::Reference< io::XStream >& xDest ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); CheckInitOnDemand(); @@ -1866,7 +1867,7 @@ uno::Sequence< uno::Type > SAL_CALL OWriteStream::getTypes() { if (! m_pData->m_pTypeCollection) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if (! m_pData->m_pTypeCollection) { @@ -1981,7 +1982,7 @@ uno::Sequence< sal_Int8 > SAL_CALL OWriteStream::getImplementationId() sal_Int32 SAL_CALL OWriteStream::readBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); CheckInitOnDemand(); @@ -1999,7 +2000,7 @@ sal_Int32 SAL_CALL OWriteStream::readBytes( uno::Sequence< sal_Int8 >& aData, sa sal_Int32 SAL_CALL OWriteStream::readSomeBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); CheckInitOnDemand(); @@ -2017,7 +2018,7 @@ sal_Int32 SAL_CALL OWriteStream::readSomeBytes( uno::Sequence< sal_Int8 >& aData void SAL_CALL OWriteStream::skipBytes( sal_Int32 nBytesToSkip ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); CheckInitOnDemand(); @@ -2035,7 +2036,7 @@ void SAL_CALL OWriteStream::skipBytes( sal_Int32 nBytesToSkip ) sal_Int32 SAL_CALL OWriteStream::available( ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); CheckInitOnDemand(); @@ -2054,7 +2055,7 @@ sal_Int32 SAL_CALL OWriteStream::available( ) void SAL_CALL OWriteStream::closeInput( ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -2077,7 +2078,7 @@ void SAL_CALL OWriteStream::closeInput( ) uno::Reference< io::XInputStream > SAL_CALL OWriteStream::getInputStream() { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -2093,7 +2094,7 @@ uno::Reference< io::XInputStream > SAL_CALL OWriteStream::getInputStream() uno::Reference< io::XOutputStream > SAL_CALL OWriteStream::getOutputStream() { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); try { @@ -2119,7 +2120,7 @@ uno::Reference< io::XOutputStream > SAL_CALL OWriteStream::getOutputStream() void SAL_CALL OWriteStream::writeBytes( const uno::Sequence< sal_Int8 >& aData ) { - ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::ResettableMutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); // the write method makes initialization itself, since it depends from the aData length // NO CheckInitOnDemand()! @@ -2187,7 +2188,7 @@ void SAL_CALL OWriteStream::flush() // during own commit but a user can explicitly flush the stream // so the changes will be available through cloning functionality. - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -2229,7 +2230,7 @@ void OWriteStream::CloseOutput_Impl() void SAL_CALL OWriteStream::closeOutput() { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); CheckInitOnDemand(); @@ -2250,7 +2251,7 @@ void SAL_CALL OWriteStream::closeOutput() void SAL_CALL OWriteStream::seek( sal_Int64 location ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); CheckInitOnDemand(); @@ -2268,7 +2269,7 @@ void SAL_CALL OWriteStream::seek( sal_Int64 location ) sal_Int64 SAL_CALL OWriteStream::getPosition() { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); CheckInitOnDemand(); @@ -2286,7 +2287,7 @@ sal_Int64 SAL_CALL OWriteStream::getPosition() sal_Int64 SAL_CALL OWriteStream::getLength() { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); CheckInitOnDemand(); @@ -2304,7 +2305,7 @@ sal_Int64 SAL_CALL OWriteStream::getLength() void SAL_CALL OWriteStream::truncate() { - ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::ResettableMutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); CheckInitOnDemand(); @@ -2329,7 +2330,7 @@ void SAL_CALL OWriteStream::dispose() { // should be an internal method since it can be called only from parent storage { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -2388,7 +2389,7 @@ void SAL_CALL OWriteStream::dispose() void SAL_CALL OWriteStream::addEventListener( const uno::Reference< lang::XEventListener >& xListener ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -2403,7 +2404,7 @@ void SAL_CALL OWriteStream::addEventListener( void SAL_CALL OWriteStream::removeEventListener( const uno::Reference< lang::XEventListener >& xListener ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -2417,7 +2418,7 @@ void SAL_CALL OWriteStream::removeEventListener( void SAL_CALL OWriteStream::setEncryptionPassword( const OUString& aPass ) { - ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::ResettableMutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); CheckInitOnDemand(); @@ -2436,7 +2437,7 @@ void SAL_CALL OWriteStream::setEncryptionPassword( const OUString& aPass ) void SAL_CALL OWriteStream::removeEncryption() { - ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::ResettableMutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); CheckInitOnDemand(); @@ -2455,7 +2456,7 @@ void SAL_CALL OWriteStream::removeEncryption() void SAL_CALL OWriteStream::setEncryptionData( const uno::Sequence< beans::NamedValue >& aEncryptionData ) { - ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::ResettableMutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); CheckInitOnDemand(); @@ -2474,7 +2475,7 @@ void SAL_CALL OWriteStream::setEncryptionData( const uno::Sequence< beans::Named sal_Bool SAL_CALL OWriteStream::hasEncryptionData() { - ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::ResettableMutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if (!m_pImpl) return false; @@ -2507,7 +2508,7 @@ sal_Bool SAL_CALL OWriteStream::hasEncryptionData() sal_Bool SAL_CALL OWriteStream::hasByID( const OUString& sID ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -2533,7 +2534,7 @@ sal_Bool SAL_CALL OWriteStream::hasByID( const OUString& sID ) OUString SAL_CALL OWriteStream::getTargetByID( const OUString& sID ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -2554,7 +2555,7 @@ OUString SAL_CALL OWriteStream::getTargetByID( const OUString& sID ) OUString SAL_CALL OWriteStream::getTypeByID( const OUString& sID ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -2575,7 +2576,7 @@ OUString SAL_CALL OWriteStream::getTypeByID( const OUString& sID ) uno::Sequence< beans::StringPair > SAL_CALL OWriteStream::getRelationshipByID( const OUString& sID ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -2602,7 +2603,7 @@ uno::Sequence< beans::StringPair > SAL_CALL OWriteStream::getRelationshipByID( uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OWriteStream::getRelationshipsByType( const OUString& sType ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -2635,7 +2636,7 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OWriteStream::getRe uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OWriteStream::getAllRelationships() { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -2651,7 +2652,7 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OWriteStream::getAl void SAL_CALL OWriteStream::insertRelationshipByID( const OUString& sID, const uno::Sequence< beans::StringPair >& aEntry, sal_Bool bReplace ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -2711,7 +2712,7 @@ void SAL_CALL OWriteStream::insertRelationshipByID( const OUString& sID, const void SAL_CALL OWriteStream::removeRelationshipByID( const OUString& sID ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -2749,7 +2750,7 @@ void SAL_CALL OWriteStream::removeRelationshipByID( const OUString& sID ) void SAL_CALL OWriteStream::insertRelationships( const uno::Sequence< uno::Sequence< beans::StringPair > >& aEntries, sal_Bool bReplace ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -2828,7 +2829,7 @@ void SAL_CALL OWriteStream::insertRelationships( const uno::Sequence< uno::Sequ void SAL_CALL OWriteStream::clearRelationships() { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -2846,7 +2847,7 @@ void SAL_CALL OWriteStream::clearRelationships() uno::Reference< beans::XPropertySetInfo > SAL_CALL OWriteStream::getPropertySetInfo() { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); //TODO: return uno::Reference< beans::XPropertySetInfo >(); @@ -2854,7 +2855,7 @@ uno::Reference< beans::XPropertySetInfo > SAL_CALL OWriteStream::getPropertySetI void SAL_CALL OWriteStream::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue ) { - ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::ResettableMutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -2976,7 +2977,7 @@ void SAL_CALL OWriteStream::setPropertyValue( const OUString& aPropertyName, con uno::Any SAL_CALL OWriteStream::getPropertyValue( const OUString& aProp ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -3035,7 +3036,7 @@ void SAL_CALL OWriteStream::addPropertyChangeListener( const OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -3050,7 +3051,7 @@ void SAL_CALL OWriteStream::removePropertyChangeListener( const OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -3065,7 +3066,7 @@ void SAL_CALL OWriteStream::addVetoableChangeListener( const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -3080,7 +3081,7 @@ void SAL_CALL OWriteStream::removeVetoableChangeListener( const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -3154,7 +3155,7 @@ void SAL_CALL OWriteStream::commit() try { BroadcastTransaction( STOR_MESS_PRECOMMIT ); - ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::ResettableMutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -3211,7 +3212,7 @@ void SAL_CALL OWriteStream::revert() BroadcastTransaction( STOR_MESS_PREREVERT ); - ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::ResettableMutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -3255,7 +3256,7 @@ void SAL_CALL OWriteStream::revert() void SAL_CALL OWriteStream::addTransactionListener( const uno::Reference< embed::XTransactionListener >& aListener ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -3272,7 +3273,7 @@ void SAL_CALL OWriteStream::addTransactionListener( const uno::Reference< embed: void SAL_CALL OWriteStream::removeTransactionListener( const uno::Reference< embed::XTransactionListener >& aListener ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { diff --git a/package/source/xstor/owriteablestream.hxx b/package/source/xstor/owriteablestream.hxx index dde8375155bd..a5c92fe6c3fa 100644 --- a/package/source/xstor/owriteablestream.hxx +++ b/package/source/xstor/owriteablestream.hxx @@ -42,25 +42,18 @@ #include <cppuhelper/weak.hxx> #include <cppuhelper/interfacecontainer.h> +#include <comphelper/refcountedmutex.hxx> #include <comphelper/sequenceashashmap.hxx> #include <list> #include <memory> #include "ocompinstream.hxx" -#include "mutexholder.hxx" namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; } } } } -struct MutexHolder -{ - const rtl::Reference<SotMutexHolder> m_rMutexRef; - - MutexHolder() : m_rMutexRef( new SotMutexHolder ) {} -}; - namespace package { bool PackageEncryptionDatasEqual( const ::comphelper::SequenceAsHashMap& aHash1, const ::comphelper::SequenceAsHashMap& aHash2 ); } @@ -72,8 +65,10 @@ typedef ::std::list< OInputCompStream* > InputStreamsList_Impl; struct OStorage_Impl; class OWriteStream; -struct OWriteStream_Impl : public MutexHolder +struct OWriteStream_Impl { + rtl::Reference<comphelper::RefCountedMutex> m_xMutex; + friend struct OStorage_Impl; friend class OWriteStream; friend class OInputCompStream; diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 58f30b9d29cf..5a06602448ca 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -73,7 +73,7 @@ typedef ::std::list< uno::WeakReference< lang::XComponent > > WeakComponentList; struct StorInternalData_Impl { - rtl::Reference<SotMutexHolder> m_rSharedMutexRef; + rtl::Reference<comphelper::RefCountedMutex> m_xSharedMutex; ::cppu::OMultiTypeInterfaceContainerHelper m_aListenersContainer; // list of listeners ::std::unique_ptr< ::cppu::OTypeCollection> m_pTypeCollection; bool m_bIsRoot; @@ -87,8 +87,8 @@ struct StorInternalData_Impl ::rtl::Reference< OHierarchyHolder_Impl > m_rHierarchyHolder; // the mutex reference MUST NOT be empty - StorInternalData_Impl( const rtl::Reference<SotMutexHolder>& rMutexRef, bool bRoot, sal_Int32 nStorageType, bool bReadOnlyWrap ) - : m_rSharedMutexRef( rMutexRef ) + StorInternalData_Impl( const rtl::Reference<comphelper::RefCountedMutex>& rMutexRef, bool bRoot, sal_Int32 nStorageType, bool bReadOnlyWrap ) + : m_xSharedMutex( rMutexRef ) , m_aListenersContainer( rMutexRef->GetMutex() ) , m_pTypeCollection() , m_bIsRoot( bRoot ) @@ -173,7 +173,7 @@ OStorage_Impl::OStorage_Impl( uno::Reference< io::XInputStream > const & xInpu const uno::Sequence< beans::PropertyValue >& xProperties, uno::Reference< uno::XComponentContext > const & xContext, sal_Int32 nStorageType ) -: m_rMutexRef( new SotMutexHolder ) +: m_xMutex( new comphelper::RefCountedMutex ) , m_pAntiImpl( nullptr ) , m_nStorageMode( nMode & ~embed::ElementModes::SEEKABLE ) , m_bIsModified( ( nMode & ( embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE ) ) == ( embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE ) ) @@ -214,7 +214,7 @@ OStorage_Impl::OStorage_Impl( uno::Reference< io::XStream > const & xStream, const uno::Sequence< beans::PropertyValue >& xProperties, uno::Reference< uno::XComponentContext > const & xContext, sal_Int32 nStorageType ) -: m_rMutexRef( new SotMutexHolder ) +: m_xMutex( new comphelper::RefCountedMutex ) , m_pAntiImpl( nullptr ) , m_nStorageMode( nMode & ~embed::ElementModes::SEEKABLE ) , m_bIsModified( ( nMode & ( embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE ) ) == ( embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE ) ) @@ -257,7 +257,7 @@ OStorage_Impl::OStorage_Impl( OStorage_Impl* pParent, uno::Reference< lang::XSingleServiceFactory > const & xPackage, uno::Reference< uno::XComponentContext > const & xContext, sal_Int32 nStorageType ) -: m_rMutexRef( new SotMutexHolder ) +: m_xMutex( new comphelper::RefCountedMutex ) , m_pAntiImpl( nullptr ) , m_nStorageMode( nMode & ~embed::ElementModes::SEEKABLE ) , m_bIsModified( ( nMode & ( embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE ) ) == ( embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE ) ) @@ -286,7 +286,7 @@ OStorage_Impl::OStorage_Impl( OStorage_Impl* pParent, OStorage_Impl::~OStorage_Impl() { { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_pAntiImpl ) // root storage wrapper must set this member to NULL before destruction of object { SAL_WARN_IF( m_bIsRoot, "package.xstor", "The root storage wrapper must be disposed already" ); @@ -406,7 +406,7 @@ void OStorage_Impl::OpenOwnPackage() { SAL_WARN_IF( !m_bIsRoot, "package.xstor", "Opening of the package has no sense!" ); - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( !m_xPackageFolder.is() ) { @@ -486,7 +486,7 @@ void OStorage_Impl::OpenOwnPackage() SotElementList_Impl& OStorage_Impl::GetChildrenList() { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); ReadContents(); return m_aChildrenList; @@ -562,7 +562,7 @@ void OStorage_Impl::ReadRelInfoIfNecessary() void OStorage_Impl::ReadContents() { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( m_bListCreated ) return; @@ -634,7 +634,7 @@ void OStorage_Impl::ReadContents() void OStorage_Impl::CopyToStorage( const uno::Reference< embed::XStorage >& xDest, bool bDirect ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); uno::Reference< beans::XPropertySet > xPropSet( xDest, uno::UNO_QUERY ); if ( !xPropSet.is() ) @@ -729,7 +729,7 @@ void OStorage_Impl::CopyStorageElement( SotElement_Impl* pElement, SAL_WARN_IF( !xDest.is(), "package.xstor", "No destination storage!" ); SAL_WARN_IF( aName.isEmpty(), "package.xstor", "Empty element name!" ); - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); uno::Reference< container::XNameAccess > xDestAccess( xDest, uno::UNO_QUERY_THROW ); if ( xDestAccess->hasByName( aName ) @@ -938,7 +938,7 @@ uno::Sequence< uno::Sequence< beans::StringPair > > OStorage_Impl::GetAllRelatio void OStorage_Impl::CopyLastCommitTo( const uno::Reference< embed::XStorage >& xNewStor ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); SAL_WARN_IF( !m_xPackageFolder.is(), "package.xstor", "A committed storage is incomplete!" ); if ( !m_xPackageFolder.is() ) @@ -958,7 +958,7 @@ void OStorage_Impl::CopyLastCommitTo( const uno::Reference< embed::XStorage >& x void OStorage_Impl::InsertIntoPackageFolder( const OUString& aName, const uno::Reference< container::XNameContainer >& xParentPackageFolder ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); SAL_WARN_IF( !m_xPackageFolder.is(), "package.xstor", "An inserted storage is incomplete!" ); uno::Reference< lang::XUnoTunnel > xTunnel( m_xPackageFolder, uno::UNO_QUERY_THROW ); @@ -969,7 +969,7 @@ void OStorage_Impl::InsertIntoPackageFolder( const OUString& aName, void OStorage_Impl::Commit() { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( !m_bIsModified ) return; @@ -1209,7 +1209,7 @@ void OStorage_Impl::Commit() void OStorage_Impl::Revert() { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( !( m_nStorageMode & embed::ElementModes::WRITE ) ) return; // nothing to do @@ -1270,7 +1270,7 @@ void OStorage_Impl::Revert() ::comphelper::SequenceAsHashMap OStorage_Impl::GetCommonRootEncryptionData() { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ) ; + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ) ; if ( m_nStorageType != embed::StorageFormats::PACKAGE ) throw packages::NoEncryptionException( THROW_WHERE ); @@ -1295,7 +1295,7 @@ SotElement_Impl* OStorage_Impl::FindElement( const OUString& rName ) { SAL_WARN_IF( rName.isEmpty(), "package.xstor", "Name is empty!" ); - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); ReadContents(); @@ -1416,7 +1416,7 @@ SotElement_Impl* OStorage_Impl::InsertElement( const OUString& aName, bool bIsSt { OSL_ENSURE( FindElement( aName ) == nullptr, "Should not try to insert existing element" ); - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); SotElement_Impl* pDeletedElm = nullptr; @@ -1455,7 +1455,7 @@ void OStorage_Impl::OpenSubStorage( SotElement_Impl* pElement, sal_Int32 nStorag SAL_WARN_IF( !pElement, "package.xstor", "pElement is not set!" ); SAL_WARN_IF( !pElement->m_bIsStorage, "package.xstor", "Storage flag is not set!" ); - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if (!pElement->m_xStorage) { @@ -1476,7 +1476,7 @@ void OStorage_Impl::OpenSubStream( SotElement_Impl* pElement ) SAL_WARN_IF( !pElement, "package.xstor", "pElement is not set!" ); SAL_WARN_IF( pElement->m_bIsStorage, "package.xstor", "Storage flag is set!" ); - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if (!pElement->m_xStream) { @@ -1496,7 +1496,7 @@ void OStorage_Impl::OpenSubStream( SotElement_Impl* pElement ) uno::Sequence< OUString > OStorage_Impl::GetElementNames() { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); ReadContents(); @@ -1780,7 +1780,7 @@ OStorage::OStorage( uno::Reference< io::XInputStream > const & xInputStream, : m_pImpl( new OStorage_Impl( xInputStream, nMode, xProperties, xContext, nStorageType ) ) { m_pImpl->m_pAntiImpl = this; - m_pData.reset(new StorInternalData_Impl( m_pImpl->m_rMutexRef, m_pImpl->m_bIsRoot, m_pImpl->m_nStorageType, false)); + m_pData.reset(new StorInternalData_Impl( m_pImpl->m_xMutex, m_pImpl->m_bIsRoot, m_pImpl->m_nStorageType, false)); } OStorage::OStorage( uno::Reference< io::XStream > const & xStream, @@ -1791,16 +1791,16 @@ OStorage::OStorage( uno::Reference< io::XStream > const & xStream, : m_pImpl( new OStorage_Impl( xStream, nMode, xProperties, xContext, nStorageType ) ) { m_pImpl->m_pAntiImpl = this; - m_pData.reset(new StorInternalData_Impl( m_pImpl->m_rMutexRef, m_pImpl->m_bIsRoot, m_pImpl->m_nStorageType, false)); + m_pData.reset(new StorInternalData_Impl( m_pImpl->m_xMutex, m_pImpl->m_bIsRoot, m_pImpl->m_nStorageType, false)); } OStorage::OStorage( OStorage_Impl* pImpl, bool bReadOnlyWrap ) : m_pImpl( pImpl ) { // this call can be done only from OStorage_Impl implementation to create child storage - OSL_ENSURE( m_pImpl && m_pImpl->m_rMutexRef.is(), "The provided pointer & mutex MUST NOT be empty!" ); + OSL_ENSURE( m_pImpl && m_pImpl->m_xMutex.is(), "The provided pointer & mutex MUST NOT be empty!" ); - m_pData.reset(new StorInternalData_Impl( m_pImpl->m_rMutexRef, m_pImpl->m_bIsRoot, m_pImpl->m_nStorageType, bReadOnlyWrap)); + m_pData.reset(new StorInternalData_Impl( m_pImpl->m_xMutex, m_pImpl->m_bIsRoot, m_pImpl->m_nStorageType, bReadOnlyWrap)); OSL_ENSURE( ( m_pImpl->m_nStorageMode & embed::ElementModes::WRITE ) == embed::ElementModes::WRITE || m_pData->m_bReadOnlyWrap, @@ -1812,7 +1812,7 @@ OStorage::OStorage( OStorage_Impl* pImpl, bool bReadOnlyWrap ) OStorage::~OStorage() { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( m_pImpl ) { m_refCount++; // to call dispose @@ -2003,7 +2003,7 @@ void OStorage::BroadcastTransaction( sal_Int8 nMessage ) SotElement_Impl* OStorage::OpenStreamElement_Impl( const OUString& aStreamName, sal_Int32 nOpenMode, bool bEncr ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); OSL_ENSURE( !m_pData->m_bReadOnlyWrap || ( nOpenMode & embed::ElementModes::WRITE ) != embed::ElementModes::WRITE, "An element can not be opened for writing in readonly storage!\n" ); @@ -2133,7 +2133,7 @@ uno::Sequence< uno::Type > SAL_CALL OStorage::getTypes() { if (! m_pData->m_pTypeCollection) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if (! m_pData->m_pTypeCollection) { @@ -2204,7 +2204,7 @@ uno::Sequence< sal_Int8 > SAL_CALL OStorage::getImplementationId() // XStorage void SAL_CALL OStorage::copyToStorage( const uno::Reference< embed::XStorage >& xDest ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -2257,7 +2257,7 @@ void SAL_CALL OStorage::copyToStorage( const uno::Reference< embed::XStorage >& uno::Reference< io::XStream > SAL_CALL OStorage::openStreamElement( const OUString& aStreamName, sal_Int32 nOpenMode ) { - ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::ResettableMutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -2346,7 +2346,7 @@ uno::Reference< io::XStream > SAL_CALL OStorage::openEncryptedStreamElement( uno::Reference< embed::XStorage > SAL_CALL OStorage::openStorageElement( const OUString& aStorName, sal_Int32 nStorageMode ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -2482,7 +2482,7 @@ uno::Reference< embed::XStorage > SAL_CALL OStorage::openStorageElement( uno::Reference< io::XStream > SAL_CALL OStorage::cloneStreamElement( const OUString& aStreamName ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -2555,7 +2555,7 @@ uno::Reference< io::XStream > SAL_CALL OStorage::cloneEncryptedStreamElement( void SAL_CALL OStorage::copyLastCommitTo( const uno::Reference< embed::XStorage >& xTargetStorage ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -2608,7 +2608,7 @@ void SAL_CALL OStorage::copyStorageElementLastCommitTo( const OUString& aStorName, const uno::Reference< embed::XStorage >& xTargetStorage ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -2689,7 +2689,7 @@ void SAL_CALL OStorage::copyStorageElementLastCommitTo( sal_Bool SAL_CALL OStorage::isStreamElement( const OUString& aElementName ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -2747,7 +2747,7 @@ sal_Bool SAL_CALL OStorage::isStreamElement( const OUString& aElementName ) sal_Bool SAL_CALL OStorage::isStorageElement( const OUString& aElementName ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -2805,7 +2805,7 @@ sal_Bool SAL_CALL OStorage::isStorageElement( const OUString& aElementName ) void SAL_CALL OStorage::removeElement( const OUString& aElementName ) { - ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::ResettableMutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -2881,7 +2881,7 @@ void SAL_CALL OStorage::removeElement( const OUString& aElementName ) void SAL_CALL OStorage::renameElement( const OUString& aElementName, const OUString& aNewName ) { - ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::ResettableMutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -2968,7 +2968,7 @@ void SAL_CALL OStorage::copyElementTo( const OUString& aElementName, const uno::Reference< embed::XStorage >& xDest, const OUString& aNewName ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -3049,7 +3049,7 @@ void SAL_CALL OStorage::moveElementTo( const OUString& aElementName, const uno::Reference< embed::XStorage >& xDest, const OUString& aNewName ) { - ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::ResettableMutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -3141,7 +3141,7 @@ void SAL_CALL OStorage::moveElementTo( const OUString& aElementName, uno::Reference< io::XStream > SAL_CALL OStorage::openEncryptedStream( const OUString& aStreamName, sal_Int32 nOpenMode, const uno::Sequence< beans::NamedValue >& aEncryptionData ) { - ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::ResettableMutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -3230,7 +3230,7 @@ uno::Reference< io::XStream > SAL_CALL OStorage::cloneEncryptedStream( const OUString& aStreamName, const uno::Sequence< beans::NamedValue >& aEncryptionData ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -3302,7 +3302,7 @@ uno::Reference< io::XStream > SAL_CALL OStorage::cloneEncryptedStream( uno::Reference< io::XInputStream > SAL_CALL OStorage::getPlainRawStreamElement( const OUString& sStreamName ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -3393,7 +3393,7 @@ uno::Reference< io::XInputStream > SAL_CALL OStorage::getPlainRawStreamElement( uno::Reference< io::XInputStream > SAL_CALL OStorage::getRawEncrStreamElement( const OUString& sStreamName ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -3493,7 +3493,7 @@ uno::Reference< io::XInputStream > SAL_CALL OStorage::getRawEncrStreamElement( void SAL_CALL OStorage::insertRawEncrStreamElement( const OUString& aStreamName, const uno::Reference< io::XInputStream >& xInStream ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -3575,7 +3575,7 @@ void SAL_CALL OStorage::commit() try { BroadcastTransaction( STOR_MESS_PRECOMMIT ); - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -3630,7 +3630,7 @@ void SAL_CALL OStorage::revert() BroadcastTransaction( STOR_MESS_PREREVERT ); - ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::ResettableMutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -3690,7 +3690,7 @@ void SAL_CALL OStorage::revert() // XTransactionBroadcaster void SAL_CALL OStorage::addTransactionListener( const uno::Reference< embed::XTransactionListener >& aListener ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -3704,7 +3704,7 @@ void SAL_CALL OStorage::addTransactionListener( const uno::Reference< embed::XTr void SAL_CALL OStorage::removeTransactionListener( const uno::Reference< embed::XTransactionListener >& aListener ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -3723,7 +3723,7 @@ void SAL_CALL OStorage::removeTransactionListener( const uno::Reference< embed:: sal_Bool SAL_CALL OStorage::isModified() { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -3736,7 +3736,7 @@ sal_Bool SAL_CALL OStorage::isModified() void SAL_CALL OStorage::setModified( sal_Bool bModified ) { - ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::ResettableMutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -3761,7 +3761,7 @@ void SAL_CALL OStorage::setModified( sal_Bool bModified ) void SAL_CALL OStorage::addModifyListener( const uno::Reference< util::XModifyListener >& aListener ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -3777,7 +3777,7 @@ void SAL_CALL OStorage::addModifyListener( void SAL_CALL OStorage::removeModifyListener( const uno::Reference< util::XModifyListener >& aListener ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -3794,7 +3794,7 @@ void SAL_CALL OStorage::removeModifyListener( uno::Any SAL_CALL OStorage::getByName( const OUString& aName ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -3850,7 +3850,7 @@ uno::Any SAL_CALL OStorage::getByName( const OUString& aName ) uno::Sequence< OUString > SAL_CALL OStorage::getElementNames() { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -3880,7 +3880,7 @@ uno::Sequence< OUString > SAL_CALL OStorage::getElementNames() sal_Bool SAL_CALL OStorage::hasByName( const OUString& aName ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -3919,7 +3919,7 @@ sal_Bool SAL_CALL OStorage::hasByName( const OUString& aName ) uno::Type SAL_CALL OStorage::getElementType() { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -3933,7 +3933,7 @@ uno::Type SAL_CALL OStorage::getElementType() sal_Bool SAL_CALL OStorage::hasElements() { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -3964,7 +3964,7 @@ sal_Bool SAL_CALL OStorage::hasElements() // XComponent void SAL_CALL OStorage::dispose() { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -3995,7 +3995,7 @@ void SAL_CALL OStorage::dispose() void SAL_CALL OStorage::addEventListener( const uno::Reference< lang::XEventListener >& xListener ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -4010,7 +4010,7 @@ void SAL_CALL OStorage::addEventListener( void SAL_CALL OStorage::removeEventListener( const uno::Reference< lang::XEventListener >& xListener ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -4031,7 +4031,7 @@ void SAL_CALL OStorage::setEncryptionPassword( const OUString& aPass ) void SAL_CALL OStorage::removeEncryption() { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -4096,7 +4096,7 @@ void SAL_CALL OStorage::removeEncryption() void SAL_CALL OStorage::setEncryptionData( const uno::Sequence< beans::NamedValue >& aEncryptionData ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -4152,7 +4152,7 @@ void SAL_CALL OStorage::setEncryptionData( const uno::Sequence< beans::NamedValu sal_Bool SAL_CALL OStorage::hasEncryptionData() { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); return m_pImpl && m_pImpl->m_bHasCommonEncryptionData; } @@ -4161,7 +4161,7 @@ sal_Bool SAL_CALL OStorage::hasEncryptionData() void SAL_CALL OStorage::setEncryptionAlgorithms( const uno::Sequence< beans::NamedValue >& aAlgorithms ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -4221,7 +4221,7 @@ void SAL_CALL OStorage::setEncryptionAlgorithms( const uno::Sequence< beans::Nam uno::Sequence< beans::NamedValue > SAL_CALL OStorage::getEncryptionAlgorithms() { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -4282,7 +4282,7 @@ uno::Sequence< beans::NamedValue > SAL_CALL OStorage::getEncryptionAlgorithms() uno::Reference< beans::XPropertySetInfo > SAL_CALL OStorage::getPropertySetInfo() { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -4296,7 +4296,7 @@ uno::Reference< beans::XPropertySetInfo > SAL_CALL OStorage::getPropertySetInfo( void SAL_CALL OStorage::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -4398,7 +4398,7 @@ void SAL_CALL OStorage::setPropertyValue( const OUString& aPropertyName, const u uno::Any SAL_CALL OStorage::getPropertyValue( const OUString& aPropertyName ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -4494,7 +4494,7 @@ void SAL_CALL OStorage::addPropertyChangeListener( const OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -4509,7 +4509,7 @@ void SAL_CALL OStorage::removePropertyChangeListener( const OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -4524,7 +4524,7 @@ void SAL_CALL OStorage::addVetoableChangeListener( const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -4539,7 +4539,7 @@ void SAL_CALL OStorage::removeVetoableChangeListener( const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -4556,7 +4556,7 @@ void SAL_CALL OStorage::removeVetoableChangeListener( sal_Bool SAL_CALL OStorage::hasByID( const OUString& sID ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -4582,7 +4582,7 @@ sal_Bool SAL_CALL OStorage::hasByID( const OUString& sID ) OUString SAL_CALL OStorage::getTargetByID( const OUString& sID ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -4603,7 +4603,7 @@ OUString SAL_CALL OStorage::getTargetByID( const OUString& sID ) OUString SAL_CALL OStorage::getTypeByID( const OUString& sID ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -4624,7 +4624,7 @@ OUString SAL_CALL OStorage::getTypeByID( const OUString& sID ) uno::Sequence< beans::StringPair > SAL_CALL OStorage::getRelationshipByID( const OUString& sID ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -4651,7 +4651,7 @@ uno::Sequence< beans::StringPair > SAL_CALL OStorage::getRelationshipByID( cons uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OStorage::getRelationshipsByType( const OUString& sType ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -4685,7 +4685,7 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OStorage::getRelati uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OStorage::getAllRelationships() { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -4722,7 +4722,7 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OStorage::getAllRel void SAL_CALL OStorage::insertRelationshipByID( const OUString& sID, const uno::Sequence< beans::StringPair >& aEntry, sal_Bool bReplace ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -4782,7 +4782,7 @@ void SAL_CALL OStorage::insertRelationshipByID( const OUString& sID, const uno: void SAL_CALL OStorage::removeRelationshipByID( const OUString& sID ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -4820,7 +4820,7 @@ void SAL_CALL OStorage::removeRelationshipByID( const OUString& sID ) void SAL_CALL OStorage::insertRelationships( const uno::Sequence< uno::Sequence< beans::StringPair > >& aEntries, sal_Bool bReplace ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -4899,7 +4899,7 @@ void SAL_CALL OStorage::insertRelationships( const uno::Sequence< uno::Sequence void SAL_CALL OStorage::clearRelationships() { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -4930,7 +4930,7 @@ void SAL_CALL OStorage::insertStreamElementDirect( const uno::Reference< io::XInputStream >& xInStream, const uno::Sequence< beans::PropertyValue >& aProps ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -5005,7 +5005,7 @@ void SAL_CALL OStorage::copyElementDirectlyTo( const uno::Reference< embed::XOptimizedStorage >& xDest, const OUString& aNewName ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -5085,7 +5085,7 @@ void SAL_CALL OStorage::copyElementDirectlyTo( void SAL_CALL OStorage::writeAndAttachToStream( const uno::Reference< io::XStream >& xStream ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -5143,7 +5143,7 @@ void SAL_CALL OStorage::writeAndAttachToStream( const uno::Reference< io::XStrea void SAL_CALL OStorage::attachToURL( const OUString& sURL, sal_Bool bReadOnly ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -5211,7 +5211,7 @@ void SAL_CALL OStorage::attachToURL( const OUString& sURL, uno::Any SAL_CALL OStorage::getElementPropertyValue( const OUString& aElementName, const OUString& aPropertyName ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -5297,7 +5297,7 @@ uno::Any SAL_CALL OStorage::getElementPropertyValue( const OUString& aElementNam void SAL_CALL OStorage::copyStreamElementData( const OUString& aStreamName, const uno::Reference< io::XStream >& xTargetStream ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -5368,7 +5368,7 @@ void SAL_CALL OStorage::copyStreamElementData( const OUString& aStreamName, cons // XHierarchicalStorageAccess uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openStreamElementByHierarchicalName( const OUString& aStreamPath, ::sal_Int32 nOpenMode ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -5431,7 +5431,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openEncrypted void SAL_CALL OStorage::removeStreamElementByHierarchicalName( const OUString& aStreamPath ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { @@ -5458,7 +5458,7 @@ void SAL_CALL OStorage::removeStreamElementByHierarchicalName( const OUString& a // XHierarchicalStorageAccess2 uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openEncryptedStreamByHierarchicalName( const OUString& aStreamPath, ::sal_Int32 nOpenMode, const uno::Sequence< beans::NamedValue >& aEncryptionData ) { - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); if ( !m_pImpl ) { diff --git a/package/source/xstor/xstorage.hxx b/package/source/xstor/xstorage.hxx index 4fb4ed0900c6..50d2ac6d1f72 100644 --- a/package/source/xstor/xstorage.hxx +++ b/package/source/xstor/xstorage.hxx @@ -46,9 +46,9 @@ #include <cppuhelper/weak.hxx> #include <cppuhelper/weakref.hxx> #include <cppuhelper/interfacecontainer.h> +#include <comphelper/refcountedmutex.hxx> #include <comphelper/sequenceashashmap.hxx> - -#include "mutexholder.hxx" +#include <rtl/ref.hxx> #include <list> #include <memory> @@ -116,7 +116,7 @@ struct OStorage_Impl { typedef std::list<StorageHolder_Impl> StorageHoldersType; - rtl::Reference<SotMutexHolder> m_rMutexRef; + rtl::Reference<comphelper::RefCountedMutex> m_xMutex; OStorage* m_pAntiImpl; // only valid if external references exists StorageHoldersType m_aReadOnlyWrapList; // only valid if readonly external reference exists diff --git a/package/source/zipapi/XUnbufferedStream.cxx b/package/source/zipapi/XUnbufferedStream.cxx index bc905ddd64c6..e82e720795d3 100644 --- a/package/source/zipapi/XUnbufferedStream.cxx +++ b/package/source/zipapi/XUnbufferedStream.cxx @@ -40,7 +40,7 @@ using com::sun::star::packages::zip::ZipIOException; XUnbufferedStream::XUnbufferedStream( const uno::Reference< uno::XComponentContext >& xContext, - const rtl::Reference<SotMutexHolder>& aMutexHolder, + const rtl::Reference< comphelper::RefCountedMutex >& aMutexHolder, ZipEntry & rEntry, Reference < XInputStream > const & xNewZipStream, const ::rtl::Reference< EncryptionData >& rData, @@ -108,7 +108,7 @@ XUnbufferedStream::XUnbufferedStream( // allows to read package raw stream XUnbufferedStream::XUnbufferedStream( const uno::Reference< uno::XComponentContext >& /*xContext*/, - const rtl::Reference<SotMutexHolder>& aMutexHolder, + const rtl::Reference< comphelper::RefCountedMutex >& aMutexHolder, const Reference < XInputStream >& xRawStream, const ::rtl::Reference< EncryptionData >& rData ) : maMutexHolder( aMutexHolder ) diff --git a/package/source/zipapi/XUnbufferedStream.hxx b/package/source/zipapi/XUnbufferedStream.hxx index d46320eac21d..4c05b9dad3d9 100644 --- a/package/source/zipapi/XUnbufferedStream.hxx +++ b/package/source/zipapi/XUnbufferedStream.hxx @@ -25,12 +25,12 @@ #include <com/sun/star/io/XOutputStream.hpp> #include <com/sun/star/xml/crypto/XCipherContext.hpp> +#include <comphelper/refcountedmutex.hxx> #include <cppuhelper/implbase.hxx> #include <rtl/ref.hxx> #include <package/Inflater.hxx> #include <ZipEntry.hxx> #include <CRC32.hxx> -#include <mutexholder.hxx> namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; @@ -47,7 +47,7 @@ class XUnbufferedStream : public cppu::WeakImplHelper > { protected: - rtl::Reference<SotMutexHolder> maMutexHolder; + rtl::Reference<comphelper::RefCountedMutex> maMutexHolder; css::uno::Reference < css::io::XInputStream > mxZipStream; css::uno::Reference < css::io::XSeekable > mxZipSeek; @@ -65,7 +65,7 @@ protected: public: XUnbufferedStream( const css::uno::Reference< css::uno::XComponentContext >& xContext, - const rtl::Reference<SotMutexHolder>& aMutexHolder, + const rtl::Reference<comphelper::RefCountedMutex>& aMutexHolder, ZipEntry & rEntry, css::uno::Reference < css::io::XInputStream > const & xNewZipStream, const ::rtl::Reference< EncryptionData >& rData, @@ -77,7 +77,7 @@ public: // allows to read package raw stream XUnbufferedStream( const css::uno::Reference< css::uno::XComponentContext >& xContext, - const rtl::Reference<SotMutexHolder>& aMutexHolder, + const rtl::Reference<comphelper::RefCountedMutex>& aMutexHolder, const css::uno::Reference < css::io::XInputStream >& xRawStream, const ::rtl::Reference< EncryptionData >& rData ); diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index 8bb4a06764ff..2a45119f11d2 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -71,7 +71,7 @@ using ZipUtils::Inflater; /** This class is used to read entries from a zip file */ -ZipFile::ZipFile( const rtl::Reference<SotMutexHolder>& aMutexHolder, +ZipFile::ZipFile( const rtl::Reference<comphelper::RefCountedMutex>& aMutexHolder, uno::Reference < XInputStream > &xInput, const uno::Reference < XComponentContext > & rxContext, bool bInitialise ) @@ -92,7 +92,7 @@ ZipFile::ZipFile( const rtl::Reference<SotMutexHolder>& aMutexHolder, } } -ZipFile::ZipFile( const rtl::Reference<SotMutexHolder>& aMutexHolder, +ZipFile::ZipFile( const rtl::Reference< comphelper::RefCountedMutex >& aMutexHolder, uno::Reference < XInputStream > &xInput, const uno::Reference < XComponentContext > & rxContext, bool bInitialise, bool bForceRecovery) @@ -383,7 +383,7 @@ bool ZipFile::StaticFillData ( ::rtl::Reference< BaseEncryptionData > & rData, return bOk; } -uno::Reference< XInputStream > ZipFile::StaticGetDataFromRawStream( const rtl::Reference<SotMutexHolder>& aMutexHolder, +uno::Reference< XInputStream > ZipFile::StaticGetDataFromRawStream( const rtl::Reference< comphelper::RefCountedMutex >& aMutexHolder, const uno::Reference< uno::XComponentContext >& rxContext, const uno::Reference< XInputStream >& xStream, const ::rtl::Reference< EncryptionData > &rData ) @@ -604,7 +604,7 @@ public: } uno::Reference< XInputStream > ZipFile::createStreamForZipEntry( - const rtl::Reference<SotMutexHolder>& aMutexHolder, + const rtl::Reference< comphelper::RefCountedMutex >& aMutexHolder, ZipEntry & rEntry, const ::rtl::Reference< EncryptionData > &rData, sal_Int8 nStreamMode, @@ -635,7 +635,7 @@ std::unique_ptr<ZipEnumeration> ZipFile::entries() uno::Reference< XInputStream > ZipFile::getInputStream( ZipEntry& rEntry, const ::rtl::Reference< EncryptionData > &rData, bool bIsEncrypted, - const rtl::Reference<SotMutexHolder>& aMutexHolder ) + const rtl::Reference<comphelper::RefCountedMutex>& aMutexHolder ) { ::osl::MutexGuard aGuard( m_aMutexHolder->GetMutex() ); @@ -662,7 +662,7 @@ uno::Reference< XInputStream > ZipFile::getInputStream( ZipEntry& rEntry, uno::Reference< XInputStream > ZipFile::getDataStream( ZipEntry& rEntry, const ::rtl::Reference< EncryptionData > &rData, bool bIsEncrypted, - const rtl::Reference<SotMutexHolder>& aMutexHolder ) + const rtl::Reference<comphelper::RefCountedMutex>& aMutexHolder ) { ::osl::MutexGuard aGuard( m_aMutexHolder->GetMutex() ); @@ -698,7 +698,7 @@ uno::Reference< XInputStream > ZipFile::getDataStream( ZipEntry& rEntry, uno::Reference< XInputStream > ZipFile::getRawData( ZipEntry& rEntry, const ::rtl::Reference< EncryptionData >& rData, bool bIsEncrypted, - const rtl::Reference<SotMutexHolder>& aMutexHolder ) + const rtl::Reference<comphelper::RefCountedMutex>& aMutexHolder ) { ::osl::MutexGuard aGuard( m_aMutexHolder->GetMutex() ); @@ -712,7 +712,7 @@ uno::Reference< XInputStream > ZipFile::getWrappedRawStream( ZipEntry& rEntry, const ::rtl::Reference< EncryptionData >& rData, const OUString& aMediaType, - const rtl::Reference<SotMutexHolder>& aMutexHolder ) + const rtl::Reference<comphelper::RefCountedMutex>& aMutexHolder ) { ::osl::MutexGuard aGuard( m_aMutexHolder->GetMutex() ); diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 488e927d80ae..f121a80b1c52 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -136,7 +136,7 @@ class DummyInputStream : public ::cppu::WeakImplHelper< XInputStream > }; ZipPackage::ZipPackage ( const uno::Reference < XComponentContext > &xContext ) -: m_aMutexHolder( new SotMutexHolder ) +: m_aMutexHolder( new comphelper::RefCountedMutex ) , m_nStartKeyGenerationID( xml::crypto::DigestID::SHA1 ) , m_nChecksumDigestID( xml::crypto::DigestID::SHA1_1K ) , m_nCommonEncryptionID( xml::crypto::CipherID::BLOWFISH_CFB_8 ) diff --git a/package/source/zippackage/wrapstreamforshare.cxx b/package/source/zippackage/wrapstreamforshare.cxx index e621455cd224..62734f9240e3 100644 --- a/package/source/zippackage/wrapstreamforshare.cxx +++ b/package/source/zippackage/wrapstreamforshare.cxx @@ -33,12 +33,12 @@ using namespace ::com::sun::star; #endif WrapStreamForShare::WrapStreamForShare( const uno::Reference< io::XInputStream >& xInStream, - const rtl::Reference<SotMutexHolder>& rMutexRef ) -: m_rMutexRef( rMutexRef ) + const rtl::Reference< comphelper::RefCountedMutex >& rMutexRef ) +: m_xMutex( rMutexRef ) , m_xInStream( xInStream ) , m_nCurPos( 0 ) { - if ( !m_rMutexRef.is() || !m_xInStream.is() ) + if ( !m_xMutex.is() || !m_xInStream.is() ) { OSL_FAIL( "Wrong initialization of wrapping stream!" ); throw uno::RuntimeException(THROW_WHERE ); @@ -79,7 +79,7 @@ sal_Int32 SAL_CALL WrapStreamForShare::readSomeBytes( uno::Sequence< sal_Int8 >& void SAL_CALL WrapStreamForShare::skipBytes( sal_Int32 nBytesToSkip ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( !m_xInStream.is() ) throw io::IOException(THROW_WHERE ); @@ -92,7 +92,7 @@ void SAL_CALL WrapStreamForShare::skipBytes( sal_Int32 nBytesToSkip ) sal_Int32 SAL_CALL WrapStreamForShare::available() { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( !m_xInStream.is() ) throw io::IOException(THROW_WHERE ); @@ -102,7 +102,7 @@ sal_Int32 SAL_CALL WrapStreamForShare::available() void SAL_CALL WrapStreamForShare::closeInput() { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( !m_xInStream.is() ) throw io::IOException(THROW_WHERE ); @@ -116,7 +116,7 @@ void SAL_CALL WrapStreamForShare::closeInput() // XSeekable void SAL_CALL WrapStreamForShare::seek( sal_Int64 location ) { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( !m_xInStream.is() ) throw io::IOException(THROW_WHERE ); @@ -129,7 +129,7 @@ void SAL_CALL WrapStreamForShare::seek( sal_Int64 location ) sal_Int64 SAL_CALL WrapStreamForShare::getPosition() { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( !m_xInStream.is() ) throw io::IOException(THROW_WHERE ); @@ -139,7 +139,7 @@ sal_Int64 SAL_CALL WrapStreamForShare::getPosition() sal_Int64 SAL_CALL WrapStreamForShare::getLength() { - ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); + ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); if ( !m_xInStream.is() ) throw io::IOException(THROW_WHERE ); diff --git a/package/source/zippackage/wrapstreamforshare.hxx b/package/source/zippackage/wrapstreamforshare.hxx index d96c6ffeb696..649284a69bc7 100644 --- a/package/source/zippackage/wrapstreamforshare.hxx +++ b/package/source/zippackage/wrapstreamforshare.hxx @@ -22,15 +22,15 @@ #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/io/XSeekable.hpp> +#include <comphelper/refcountedmutex.hxx> #include <cppuhelper/implbase.hxx> - -#include <mutexholder.hxx> +#include <rtl/ref.hxx> class WrapStreamForShare : public cppu::WeakImplHelper < css::io::XInputStream , css::io::XSeekable > { protected: - rtl::Reference<SotMutexHolder> m_rMutexRef; + rtl::Reference< comphelper::RefCountedMutex > m_xMutex; css::uno::Reference < css::io::XInputStream > m_xInStream; css::uno::Reference < css::io::XSeekable > m_xSeekable; @@ -38,7 +38,7 @@ protected: public: WrapStreamForShare( const css::uno::Reference< css::io::XInputStream >& xInStream, - const rtl::Reference<SotMutexHolder>& rMutexRef ); + const rtl::Reference< comphelper::RefCountedMutex >& rMutexRef ); virtual ~WrapStreamForShare() override; // XInputStream diff --git a/package/source/zippackage/zipfileaccess.cxx b/package/source/zippackage/zipfileaccess.cxx index 5c8938cbefe6..1e5cb165af4b 100644 --- a/package/source/zippackage/zipfileaccess.cxx +++ b/package/source/zippackage/zipfileaccess.cxx @@ -44,7 +44,7 @@ using namespace ::com::sun::star; #endif OZipFileAccess::OZipFileAccess( const uno::Reference< uno::XComponentContext >& rxContext ) -: m_aMutexHolder( new SotMutexHolder ) +: m_aMutexHolder( new comphelper::RefCountedMutex ) , m_xContext( rxContext ) , m_pListenersContainer( nullptr ) , m_bDisposed( false ) |