diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-03 11:36:01 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-03 12:20:53 +0200 |
commit | 05ab38359ae72f2a54dc0b5f1b84ac5f649c507a (patch) | |
tree | 5830c7ee2442984e0bc804def7bd95ddd8a25410 /package | |
parent | 5afdcad4c0e7850b18996c549892b9360cd8973f (diff) |
Consolidate on C++17 std::scoped_lock instead of std::lock_guard
as in commit 9376f65a26240441bf9dd6ae1f69886dc9fa60fa
Change-Id: I3ad9afd4d113582a214a4a4bc7eea55e38cd6ff9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119927
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'package')
-rw-r--r-- | package/source/xstor/disposelistener.cxx | 4 | ||||
-rw-r--r-- | package/source/xstor/switchpersistencestream.cxx | 28 | ||||
-rw-r--r-- | package/source/zipapi/ByteGrabber.cxx | 14 | ||||
-rw-r--r-- | package/source/zipapi/blowfishcontext.cxx | 4 | ||||
-rw-r--r-- | package/source/zipapi/sha1context.cxx | 8 |
5 files changed, 29 insertions, 29 deletions
diff --git a/package/source/xstor/disposelistener.cxx b/package/source/xstor/disposelistener.cxx index ab30f99ca129..b7ee40957465 100644 --- a/package/source/xstor/disposelistener.cxx +++ b/package/source/xstor/disposelistener.cxx @@ -31,13 +31,13 @@ OChildDispListener_Impl::~OChildDispListener_Impl() void OChildDispListener_Impl::OwnerIsDisposed() { - std::lock_guard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); m_pStorage = nullptr; } void SAL_CALL OChildDispListener_Impl::disposing( const lang::EventObject& Source ) { - std::lock_guard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); // ObjectIsDisposed must not contain any locking! if ( m_pStorage && Source.Source.is() ) m_pStorage->ChildIsDisposed( Source.Source ); diff --git a/package/source/xstor/switchpersistencestream.cxx b/package/source/xstor/switchpersistencestream.cxx index e646a3f06245..ff9828a72b91 100644 --- a/package/source/xstor/switchpersistencestream.cxx +++ b/package/source/xstor/switchpersistencestream.cxx @@ -200,7 +200,7 @@ void SwitchablePersistenceStream::CloseAll_Impl() // css::io::XStream uno::Reference< io::XInputStream > SAL_CALL SwitchablePersistenceStream::getInputStream( ) { - std::lock_guard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if ( m_pStreamData ) m_pStreamData->m_bInOpen = true; @@ -209,7 +209,7 @@ uno::Reference< io::XInputStream > SAL_CALL SwitchablePersistenceStream::getInpu uno::Reference< io::XOutputStream > SAL_CALL SwitchablePersistenceStream::getOutputStream( ) { - std::lock_guard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if ( m_pStreamData ) m_pStreamData->m_bOutOpen = true; @@ -219,7 +219,7 @@ uno::Reference< io::XOutputStream > SAL_CALL SwitchablePersistenceStream::getOut // css::io::XInputStream ::sal_Int32 SAL_CALL SwitchablePersistenceStream::readBytes( uno::Sequence< ::sal_Int8 >& aData, ::sal_Int32 nBytesToRead ) { - std::lock_guard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if ( !m_pStreamData ) throw io::NotConnectedException(); @@ -233,7 +233,7 @@ uno::Reference< io::XOutputStream > SAL_CALL SwitchablePersistenceStream::getOut ::sal_Int32 SAL_CALL SwitchablePersistenceStream::readSomeBytes( uno::Sequence< ::sal_Int8 >& aData, ::sal_Int32 nMaxBytesToRead ) { - std::lock_guard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if ( !m_pStreamData ) throw io::NotConnectedException(); @@ -247,7 +247,7 @@ uno::Reference< io::XOutputStream > SAL_CALL SwitchablePersistenceStream::getOut void SAL_CALL SwitchablePersistenceStream::skipBytes( ::sal_Int32 nBytesToSkip ) { - std::lock_guard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if ( !m_pStreamData ) throw io::NotConnectedException(); @@ -261,7 +261,7 @@ void SAL_CALL SwitchablePersistenceStream::skipBytes( ::sal_Int32 nBytesToSkip ) ::sal_Int32 SAL_CALL SwitchablePersistenceStream::available( ) { - std::lock_guard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if ( !m_pStreamData ) throw io::NotConnectedException(); @@ -275,7 +275,7 @@ void SAL_CALL SwitchablePersistenceStream::skipBytes( ::sal_Int32 nBytesToSkip ) void SAL_CALL SwitchablePersistenceStream::closeInput() { - std::lock_guard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if ( !m_pStreamData ) throw io::NotConnectedException(); @@ -288,7 +288,7 @@ void SAL_CALL SwitchablePersistenceStream::closeInput() // css::io::XOutputStream void SAL_CALL SwitchablePersistenceStream::writeBytes( const uno::Sequence< ::sal_Int8 >& aData ) { - std::lock_guard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if ( !m_pStreamData ) throw io::NotConnectedException(); @@ -305,7 +305,7 @@ void SAL_CALL SwitchablePersistenceStream::writeBytes( const uno::Sequence< ::sa void SAL_CALL SwitchablePersistenceStream::flush( ) { - std::lock_guard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if ( !m_pStreamData || m_pStreamData->m_bInStreamBased ) { @@ -325,7 +325,7 @@ void SAL_CALL SwitchablePersistenceStream::flush( ) void SAL_CALL SwitchablePersistenceStream::closeOutput( ) { - std::lock_guard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if ( !m_pStreamData ) throw io::NotConnectedException(); @@ -338,7 +338,7 @@ void SAL_CALL SwitchablePersistenceStream::closeOutput( ) // css::io::XTruncate void SAL_CALL SwitchablePersistenceStream::truncate( ) { - std::lock_guard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if ( !m_pStreamData ) throw io::NotConnectedException(); @@ -356,7 +356,7 @@ void SAL_CALL SwitchablePersistenceStream::truncate( ) // css::io::XSeekable void SAL_CALL SwitchablePersistenceStream::seek( ::sal_Int64 location ) { - std::lock_guard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if ( !m_pStreamData ) throw io::NotConnectedException(); @@ -370,7 +370,7 @@ void SAL_CALL SwitchablePersistenceStream::seek( ::sal_Int64 location ) ::sal_Int64 SAL_CALL SwitchablePersistenceStream::getPosition( ) { - std::lock_guard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if ( !m_pStreamData ) throw io::NotConnectedException(); @@ -384,7 +384,7 @@ void SAL_CALL SwitchablePersistenceStream::seek( ::sal_Int64 location ) ::sal_Int64 SAL_CALL SwitchablePersistenceStream::getLength( ) { - std::lock_guard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if ( !m_pStreamData ) throw io::NotConnectedException(); diff --git a/package/source/zipapi/ByteGrabber.cxx b/package/source/zipapi/ByteGrabber.cxx index 3b039e5000b1..89ce1af5634b 100644 --- a/package/source/zipapi/ByteGrabber.cxx +++ b/package/source/zipapi/ByteGrabber.cxx @@ -48,7 +48,7 @@ ByteGrabber::~ByteGrabber() void ByteGrabber::setInputStream (const uno::Reference < io::XInputStream >& xNewStream) { - std::lock_guard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); xStream = xNewStream; xSeek.set(xNewStream, uno::UNO_QUERY); } @@ -57,14 +57,14 @@ void ByteGrabber::setInputStream (const uno::Reference < io::XInputStream >& xNe sal_Int32 ByteGrabber::readBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) { - std::lock_guard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); return xStream->readBytes(aData, nBytesToRead ); } // XSeekable chained... void ByteGrabber::seek( sal_Int64 location ) { - std::lock_guard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if (!xSeek.is() ) throw io::IOException(THROW_WHERE ); @@ -76,7 +76,7 @@ void ByteGrabber::seek( sal_Int64 location ) sal_Int64 ByteGrabber::getPosition( ) { - std::lock_guard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if (!xSeek.is() ) throw io::IOException(THROW_WHERE ); @@ -85,7 +85,7 @@ sal_Int64 ByteGrabber::getPosition( ) sal_Int64 ByteGrabber::getLength( ) { - std::lock_guard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if (!xSeek.is() ) throw io::IOException(THROW_WHERE ); @@ -94,7 +94,7 @@ sal_Int64 ByteGrabber::getLength( ) sal_uInt16 ByteGrabber::ReadUInt16() { - std::lock_guard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if (xStream->readBytes(aSequence, 2) != 2) return 0; @@ -107,7 +107,7 @@ sal_uInt16 ByteGrabber::ReadUInt16() sal_uInt32 ByteGrabber::ReadUInt32() { - std::lock_guard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if (xStream->readBytes(aSequence, 4) != 4) return 0; diff --git a/package/source/zipapi/blowfishcontext.cxx b/package/source/zipapi/blowfishcontext.cxx index d11a9f0d3c01..1b5ed4a14893 100644 --- a/package/source/zipapi/blowfishcontext.cxx +++ b/package/source/zipapi/blowfishcontext.cxx @@ -62,7 +62,7 @@ BlowfishCFB8CipherContext::~BlowfishCFB8CipherContext() uno::Sequence< sal_Int8 > SAL_CALL BlowfishCFB8CipherContext::convertWithCipherContext( const uno::Sequence< ::sal_Int8 >& aData ) { - std::lock_guard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if ( !m_pCipher ) throw lang::DisposedException(); @@ -96,7 +96,7 @@ uno::Sequence< sal_Int8 > SAL_CALL BlowfishCFB8CipherContext::convertWithCipherC uno::Sequence< ::sal_Int8 > SAL_CALL BlowfishCFB8CipherContext::finalizeCipherContextAndDispose() { - std::lock_guard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if ( !m_pCipher ) throw lang::DisposedException(); diff --git a/package/source/zipapi/sha1context.cxx b/package/source/zipapi/sha1context.cxx index 0da0648ea206..4b6cbd2d339d 100644 --- a/package/source/zipapi/sha1context.cxx +++ b/package/source/zipapi/sha1context.cxx @@ -49,7 +49,7 @@ StarOfficeSHA1DigestContext::~StarOfficeSHA1DigestContext() void SAL_CALL StarOfficeSHA1DigestContext::updateDigest(const uno::Sequence<::sal_Int8>& aData) { - std::lock_guard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if ( !m_pDigest ) throw lang::DisposedException(); @@ -64,7 +64,7 @@ void SAL_CALL StarOfficeSHA1DigestContext::updateDigest(const uno::Sequence<::sa uno::Sequence<::sal_Int8> SAL_CALL StarOfficeSHA1DigestContext::finalizeDigestAndDispose() { - std::lock_guard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if ( !m_pDigest ) throw lang::DisposedException(); @@ -98,7 +98,7 @@ CorrectSHA1DigestContext::~CorrectSHA1DigestContext() void SAL_CALL CorrectSHA1DigestContext::updateDigest(const uno::Sequence<::sal_Int8>& rData) { - std::lock_guard aGuard(m_Mutex); + std::scoped_lock aGuard(m_Mutex); if (m_bDisposed) throw lang::DisposedException(); @@ -107,7 +107,7 @@ void SAL_CALL CorrectSHA1DigestContext::updateDigest(const uno::Sequence<::sal_I uno::Sequence<::sal_Int8> SAL_CALL CorrectSHA1DigestContext::finalizeDigestAndDispose() { - std::lock_guard aGuard(m_Mutex); + std::scoped_lock aGuard(m_Mutex); if (m_bDisposed) throw lang::DisposedException(); |