filter/source/config/cache/basecontainer.cxx | 6 +++--- filter/source/config/cache/typedetection.cxx | 2 +- filter/source/xsltfilter/XSLTFilter.cxx | 4 ++-- unotools/source/streaming/streamhelper.cxx | 14 +++++++------- unotools/source/streaming/streamwrap.cxx | 18 +++++++++--------- unotools/source/ucbhelper/tempfile.cxx | 26 +++++++++++++------------- unotools/source/ucbhelper/ucblockbytes.cxx | 4 ++-- unotools/source/ucbhelper/xtempfile.cxx | 26 +++++++++++++------------- 8 files changed, 50 insertions(+), 50 deletions(-)
New commits: commit 4129fca3739090651a9ffb11b35245e09816556f Author: Mike Kaganski <[email protected]> AuthorDate: Sun Apr 23 20:13:47 2023 +0300 Commit: Mike Kaganski <[email protected]> CommitDate: Sun Jun 4 20:58:22 2023 +0200 Use getXWeak in filter Change-Id: I9854e28a4c577fae71bfc7e4bbaaadbdbce08684 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150850 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/filter/source/config/cache/basecontainer.cxx b/filter/source/config/cache/basecontainer.cxx index 7937eb19ab6b..86b6677ffa1d 100644 --- a/filter/source/config/cache/basecontainer.cxx +++ b/filter/source/config/cache/basecontainer.cxx @@ -91,7 +91,7 @@ void BaseContainer::impl_initFlushMode(std::unique_lock<std::mutex>& /*rGuard*/) m_pFlushCache = GetTheFilterCache().clone(); if (!m_pFlushCache) throw css::uno::RuntimeException( "Can not create write copy of internal used cache on demand.", - static_cast< OWeakObject* >(this)); + getXWeak()); } @@ -380,7 +380,7 @@ void SAL_CALL BaseContainer::flush() if (!m_pFlushCache) throw css::lang::WrappedTargetRuntimeException( "Can not guarantee cache consistency. Special flush container does not exists!", - static_cast< OWeakObject* >(this), + getXWeak(), css::uno::Any()); try @@ -402,7 +402,7 @@ void SAL_CALL BaseContainer::flush() // later again ... throw css::lang::WrappedTargetRuntimeException( "Flush rejected by internal container.", - static_cast< OWeakObject* >(this), + getXWeak(), css::uno::Any(ex)); } diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx index c05f30af7649..18d13a8f7796 100644 --- a/filter/source/config/cache/typedetection.cxx +++ b/filter/source/config/cache/typedetection.cxx @@ -1097,7 +1097,7 @@ void TypeDetection::impl_openStream(utl::MediaDescriptor& rDescriptor) if ( !bSuccess ) throw css::uno::Exception( "Could not open stream for <" + sURL + ">", - static_cast<OWeakObject *>(this)); + getXWeak()); if ( !bRequestedReadOnly ) { diff --git a/filter/source/xsltfilter/XSLTFilter.cxx b/filter/source/xsltfilter/XSLTFilter.cxx index 44f9ce4d8172..771b5a37f8fc 100644 --- a/filter/source/xsltfilter/XSLTFilter.cxx +++ b/filter/source/xsltfilter/XSLTFilter.cxx @@ -374,7 +374,7 @@ namespace XSLT Sequence<Any> excArgs(0); css::ucb::InteractiveAugmentedIOException exc( "Timeout!", - static_cast< OWeakObject * >( this ), + getXWeak(), InteractionClassification_ERROR, css::ucb::IOErrorCode_GENERAL, excArgs); @@ -501,7 +501,7 @@ namespace XSLT Sequence<Any> excArgs(0); css::ucb::InteractiveAugmentedIOException exc( "Timeout!", - static_cast< OWeakObject * >( this ), + getXWeak(), InteractionClassification_ERROR, css::ucb::IOErrorCode_GENERAL, excArgs); commit b00c351f0466c65ba51e980d8554e09efe0b7bd8 Author: Mike Kaganski <[email protected]> AuthorDate: Sun Apr 23 20:15:30 2023 +0300 Commit: Mike Kaganski <[email protected]> CommitDate: Sun Jun 4 20:58:12 2023 +0200 Use getXWeak in unotools Change-Id: I61ae9f11c3017442ac7461ca57f5625d1687fc68 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150882 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/unotools/source/streaming/streamhelper.cxx b/unotools/source/streaming/streamhelper.cxx index b5f07e6a6a7f..12f6ad7afd5a 100644 --- a/unotools/source/streaming/streamhelper.cxx +++ b/unotools/source/streaming/streamhelper.cxx @@ -31,10 +31,10 @@ namespace utl sal_Int32 SAL_CALL OInputStreamHelper::readBytes(css::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead) { if (!m_xLockBytes.is()) - throw css::io::NotConnectedException(OUString(), static_cast<css::uno::XWeak*>(this)); + throw css::io::NotConnectedException(OUString(), getXWeak()); if (nBytesToRead < 0) - throw css::io::BufferSizeExceededException(OUString(), static_cast<css::uno::XWeak*>(this)); + throw css::io::BufferSizeExceededException(OUString(), getXWeak()); std::scoped_lock aGuard( m_aMutex ); if (aData.getLength() < nBytesToRead) @@ -45,7 +45,7 @@ sal_Int32 SAL_CALL OInputStreamHelper::readBytes(css::uno::Sequence< sal_Int8 >& m_nActPos += nRead; if (nError != ERRCODE_NONE) - throw css::io::IOException(OUString(), static_cast<css::uno::XWeak*>(this)); + throw css::io::IOException(OUString(), getXWeak()); // adjust sequence if data read is lower than the desired data if (nRead < o3tl::make_unsigned(aData.getLength())) @@ -87,10 +87,10 @@ void SAL_CALL OInputStreamHelper::skipBytes(sal_Int32 nBytesToSkip) { std::scoped_lock aGuard( m_aMutex ); if (!m_xLockBytes.is()) - throw css::io::NotConnectedException(OUString(), static_cast<css::uno::XWeak*>(this)); + throw css::io::NotConnectedException(OUString(), getXWeak()); if (nBytesToSkip < 0) - throw css::io::BufferSizeExceededException(OUString(), static_cast<css::uno::XWeak*>(this)); + throw css::io::BufferSizeExceededException(OUString(), getXWeak()); m_nActPos += nBytesToSkip; } @@ -99,7 +99,7 @@ sal_Int32 SAL_CALL OInputStreamHelper::available() { std::scoped_lock aGuard( m_aMutex ); if (!m_xLockBytes.is()) - throw css::io::NotConnectedException(OUString(), static_cast<css::uno::XWeak*>(this)); + throw css::io::NotConnectedException(OUString(), getXWeak()); return m_nAvailable; } @@ -108,7 +108,7 @@ void SAL_CALL OInputStreamHelper::closeInput() { std::scoped_lock aGuard( m_aMutex ); if (!m_xLockBytes.is()) - throw css::io::NotConnectedException(OUString(), static_cast<css::uno::XWeak*>(this)); + throw css::io::NotConnectedException(OUString(), getXWeak()); m_xLockBytes = nullptr; } diff --git a/unotools/source/streaming/streamwrap.cxx b/unotools/source/streaming/streamwrap.cxx index 593f7a1f0b28..2f8a86981194 100644 --- a/unotools/source/streaming/streamwrap.cxx +++ b/unotools/source/streaming/streamwrap.cxx @@ -61,7 +61,7 @@ sal_Int32 SAL_CALL OInputStreamWrapper::readBytes(css::uno::Sequence< sal_Int8 > checkConnected(); if (nBytesToRead < 0) - throw css::io::BufferSizeExceededException(OUString(),static_cast<css::uno::XWeak*>(this)); + throw css::io::BufferSizeExceededException(OUString(), getXWeak()); std::scoped_lock aGuard( m_aMutex ); @@ -83,7 +83,7 @@ sal_Int32 OInputStreamWrapper::readSomeBytes(sal_Int8* pData, sal_Int32 nBytesTo checkConnected(); if (nBytesToRead < 0) - throw css::io::BufferSizeExceededException(OUString(),static_cast<css::uno::XWeak*>(this)); + throw css::io::BufferSizeExceededException(OUString(), getXWeak()); std::scoped_lock aGuard( m_aMutex ); @@ -98,7 +98,7 @@ sal_Int32 SAL_CALL OInputStreamWrapper::readSomeBytes(css::uno::Sequence< sal_In checkError(); if (nMaxBytesToRead < 0) - throw css::io::BufferSizeExceededException(OUString(),static_cast<css::uno::XWeak*>(this)); + throw css::io::BufferSizeExceededException(OUString(), getXWeak()); if (m_pSvStream->eof()) { @@ -144,7 +144,7 @@ void SAL_CALL OInputStreamWrapper::closeInput() void OInputStreamWrapper::checkConnected() const { if (!m_pSvStream) - throw css::io::NotConnectedException(OUString(), const_cast<css::uno::XWeak*>(static_cast<const css::uno::XWeak*>(this))); + throw css::io::NotConnectedException(OUString(), const_cast<OInputStreamWrapper*>(this)->getXWeak()); } void OInputStreamWrapper::checkError() const @@ -154,7 +154,7 @@ void OInputStreamWrapper::checkError() const auto const e = m_pSvStream->SvStream::GetError(); if (e != ERRCODE_NONE) // TODO: really evaluate the error - throw css::io::NotConnectedException("utl::OInputStreamWrapper error " + e.toString(), const_cast<css::uno::XWeak*>(static_cast<const css::uno::XWeak*>(this))); + throw css::io::NotConnectedException("utl::OInputStreamWrapper error " + e.toString(), const_cast<OInputStreamWrapper*>(this)->getXWeak()); } //= OSeekableInputStreamWrapper @@ -218,7 +218,7 @@ void SAL_CALL OOutputStreamWrapper::writeBytes(const css::uno::Sequence< sal_Int || (nWritten != static_cast<sal_uInt32>(aData.getLength())) ) { - throw css::io::BufferSizeExceededException(OUString(),static_cast<css::uno::XWeak*>(this)); + throw css::io::BufferSizeExceededException(OUString(), getXWeak()); } } @@ -236,7 +236,7 @@ void OOutputStreamWrapper::checkError() const { if (rStream.GetError() != ERRCODE_NONE) // TODO: really evaluate the error - throw css::io::NotConnectedException(OUString(), const_cast<css::uno::XWeak*>(static_cast<const css::uno::XWeak*>(this))); + throw css::io::NotConnectedException(OUString(), const_cast<OOutputStreamWrapper*>(this)->getXWeak()); } //= OSeekableOutputStreamWrapper @@ -313,7 +313,7 @@ void SAL_CALL OStreamWrapper::writeBytes(const css::uno::Sequence< sal_Int8 >& a || (nWritten != static_cast<sal_uInt32>(aData.getLength())) ) { - throw css::io::BufferSizeExceededException(OUString(),static_cast<css::uno::XWeak*>(this)); + throw css::io::BufferSizeExceededException(OUString(), getXWeak()); } } @@ -321,7 +321,7 @@ void SAL_CALL OStreamWrapper::flush() { m_pSvStream->FlushBuffer(); if (m_pSvStream->GetError() != ERRCODE_NONE) - throw css::io::NotConnectedException(OUString(),static_cast<css::uno::XWeak*>(this)); + throw css::io::NotConnectedException(OUString(), getXWeak()); } void SAL_CALL OStreamWrapper::closeOutput() diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx index 2cf7a94ec5ed..4c6749226d77 100644 --- a/unotools/source/ucbhelper/tempfile.cxx +++ b/unotools/source/ucbhelper/tempfile.cxx @@ -597,11 +597,11 @@ sal_Int32 SAL_CALL TempFileFastService::readBytes( css::uno::Sequence< sal_Int8 { std::unique_lock aGuard( maMutex ); if ( mbInClosed ) - throw css::io::NotConnectedException ( OUString(), static_cast < css::uno::XWeak * > (this ) ); + throw css::io::NotConnectedException ( OUString(), getXWeak() ); checkConnected(); if (nBytesToRead < 0) - throw css::io::BufferSizeExceededException( OUString(), static_cast< css::uno::XWeak * >(this)); + throw css::io::BufferSizeExceededException( OUString(), getXWeak()); if (aData.getLength() < nBytesToRead) aData.realloc(nBytesToRead); @@ -620,13 +620,13 @@ sal_Int32 SAL_CALL TempFileFastService::readSomeBytes( css::uno::Sequence< sal_I { std::unique_lock aGuard( maMutex ); if ( mbInClosed ) - throw css::io::NotConnectedException ( OUString(), static_cast < css::uno::XWeak * > (this ) ); + throw css::io::NotConnectedException ( OUString(), getXWeak() ); checkConnected(); checkError(); if (nMaxBytesToRead < 0) - throw css::io::BufferSizeExceededException( OUString(), static_cast < css::uno::XWeak * >( this ) ); + throw css::io::BufferSizeExceededException( OUString(), getXWeak() ); if (mpStream->eof()) { @@ -641,7 +641,7 @@ void SAL_CALL TempFileFastService::skipBytes( sal_Int32 nBytesToSkip ) { std::unique_lock aGuard( maMutex ); if ( mbInClosed ) - throw css::io::NotConnectedException ( OUString(), static_cast < css::uno::XWeak * > (this ) ); + throw css::io::NotConnectedException ( OUString(), getXWeak() ); checkConnected(); checkError(); @@ -653,7 +653,7 @@ sal_Int32 SAL_CALL TempFileFastService::available() { std::unique_lock aGuard( maMutex ); if ( mbInClosed ) - throw css::io::NotConnectedException ( OUString(), static_cast < css::uno::XWeak * > (this ) ); + throw css::io::NotConnectedException ( OUString(), getXWeak() ); checkConnected(); @@ -667,7 +667,7 @@ void SAL_CALL TempFileFastService::closeInput() { std::unique_lock aGuard( maMutex ); if ( mbInClosed ) - throw css::io::NotConnectedException ( OUString(), static_cast < css::uno::XWeak * > (this ) ); + throw css::io::NotConnectedException ( OUString(), getXWeak() ); mbInClosed = true; @@ -685,20 +685,20 @@ void SAL_CALL TempFileFastService::writeBytes( const css::uno::Sequence< sal_Int { std::unique_lock aGuard( maMutex ); if ( mbOutClosed ) - throw css::io::NotConnectedException ( OUString(), static_cast < css::uno::XWeak * > (this ) ); + throw css::io::NotConnectedException ( OUString(), getXWeak() ); checkConnected(); sal_uInt32 nWritten = mpStream->WriteBytes(aData.getConstArray(), aData.getLength()); checkError(); if ( nWritten != static_cast<sal_uInt32>(aData.getLength())) - throw css::io::BufferSizeExceededException( OUString(),static_cast < css::uno::XWeak * > ( this ) ); + throw css::io::BufferSizeExceededException( OUString(), getXWeak() ); } void SAL_CALL TempFileFastService::flush() { std::unique_lock aGuard( maMutex ); if ( mbOutClosed ) - throw css::io::NotConnectedException ( OUString(), static_cast < css::uno::XWeak * > (this ) ); + throw css::io::NotConnectedException ( OUString(), getXWeak() ); checkConnected(); mpStream->Flush(); @@ -709,7 +709,7 @@ void SAL_CALL TempFileFastService::closeOutput() { std::unique_lock aGuard( maMutex ); if ( mbOutClosed ) - throw css::io::NotConnectedException ( OUString(), static_cast < css::uno::XWeak * > (this ) ); + throw css::io::NotConnectedException ( OUString(), getXWeak() ); mbOutClosed = true; if (mpStream) @@ -730,13 +730,13 @@ void SAL_CALL TempFileFastService::closeOutput() void TempFileFastService::checkError() const { if (!mpStream || mpStream->SvStream::GetError () != ERRCODE_NONE ) - throw css::io::NotConnectedException ( OUString(), const_cast < css::uno::XWeak * > ( static_cast < const css::uno::XWeak * > (this ) ) ); + throw css::io::NotConnectedException ( OUString(), const_cast < TempFileFastService * > (this)->getXWeak() ); } void TempFileFastService::checkConnected() { if (!mpStream) - throw css::io::NotConnectedException ( OUString(), static_cast < css::uno::XWeak * > (this ) ); + throw css::io::NotConnectedException ( OUString(), getXWeak() ); } // XSeekable diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx b/unotools/source/ucbhelper/ucblockbytes.cxx index ad5289f9310f..0a46323b57eb 100644 --- a/unotools/source/ucbhelper/ucblockbytes.cxx +++ b/unotools/source/ucbhelper/ucblockbytes.cxx @@ -459,11 +459,11 @@ Moderator::Moderator( Reference < XActiveDataSink > xActiveSink(*pxSink,UNO_QUERY); if(xActiveSink.is()) - pxSink->set( static_cast<cppu::OWeakObject*>(new ModeratorsActiveDataSink(*this))); + pxSink->set(getXWeak(new ModeratorsActiveDataSink(*this))); Reference<XActiveDataStreamer> xStreamer( *pxSink, UNO_QUERY ); if ( xStreamer.is() ) - pxSink->set( static_cast<cppu::OWeakObject*>(new ModeratorsActiveDataStreamer(*this))); + pxSink->set(getXWeak(new ModeratorsActiveDataStreamer(*this))); if(dec == 0) m_aArg.Argument <<= aPostArg; diff --git a/unotools/source/ucbhelper/xtempfile.cxx b/unotools/source/ucbhelper/xtempfile.cxx index 1515bc05f3e9..8c1da6c98504 100644 --- a/unotools/source/ucbhelper/xtempfile.cxx +++ b/unotools/source/ucbhelper/xtempfile.cxx @@ -109,11 +109,11 @@ sal_Int32 SAL_CALL OTempFileService::readBytes( css::uno::Sequence< sal_Int8 >& { std::unique_lock aGuard( maMutex ); if ( mbInClosed ) - throw css::io::NotConnectedException ( OUString(), static_cast < css::uno::XWeak * > (this ) ); + throw css::io::NotConnectedException ( OUString(), getXWeak() ); checkConnected(); if (nBytesToRead < 0) - throw css::io::BufferSizeExceededException( OUString(), static_cast< css::uno::XWeak * >(this)); + throw css::io::BufferSizeExceededException( OUString(), getXWeak()); if (aData.getLength() < nBytesToRead) aData.realloc(nBytesToRead); @@ -131,13 +131,13 @@ sal_Int32 SAL_CALL OTempFileService::readSomeBytes( css::uno::Sequence< sal_Int8 { std::unique_lock aGuard( maMutex ); if ( mbInClosed ) - throw css::io::NotConnectedException ( OUString(), static_cast < css::uno::XWeak * > (this ) ); + throw css::io::NotConnectedException ( OUString(), getXWeak() ); checkConnected(); checkError(); if (nMaxBytesToRead < 0) - throw css::io::BufferSizeExceededException( OUString(), static_cast < css::uno::XWeak * >( this ) ); + throw css::io::BufferSizeExceededException( OUString(), getXWeak() ); if (mpStream->eof()) { @@ -151,7 +151,7 @@ void SAL_CALL OTempFileService::skipBytes( sal_Int32 nBytesToSkip ) { std::unique_lock aGuard( maMutex ); if ( mbInClosed ) - throw css::io::NotConnectedException ( OUString(), static_cast < css::uno::XWeak * > (this ) ); + throw css::io::NotConnectedException ( OUString(), getXWeak() ); checkConnected(); checkError(); @@ -162,7 +162,7 @@ sal_Int32 SAL_CALL OTempFileService::available( ) { std::unique_lock aGuard( maMutex ); if ( mbInClosed ) - throw css::io::NotConnectedException ( OUString(), static_cast < css::uno::XWeak * > (this ) ); + throw css::io::NotConnectedException ( OUString(), getXWeak() ); checkConnected(); @@ -175,7 +175,7 @@ void SAL_CALL OTempFileService::closeInput( ) { std::unique_lock aGuard( maMutex ); if ( mbInClosed ) - throw css::io::NotConnectedException ( OUString(), static_cast < css::uno::XWeak * > (this ) ); + throw css::io::NotConnectedException ( OUString(), getXWeak() ); mbInClosed = true; @@ -193,19 +193,19 @@ void SAL_CALL OTempFileService::writeBytes( const css::uno::Sequence< sal_Int8 > { std::unique_lock aGuard( maMutex ); if ( mbOutClosed ) - throw css::io::NotConnectedException ( OUString(), static_cast < css::uno::XWeak * > (this ) ); + throw css::io::NotConnectedException ( OUString(), getXWeak() ); checkConnected(); sal_uInt32 nWritten = mpStream->WriteBytes(aData.getConstArray(), aData.getLength()); checkError(); if ( nWritten != static_cast<sal_uInt32>(aData.getLength())) - throw css::io::BufferSizeExceededException( OUString(),static_cast < css::uno::XWeak * > ( this ) ); + throw css::io::BufferSizeExceededException( OUString(), getXWeak() ); } void SAL_CALL OTempFileService::flush( ) { std::unique_lock aGuard( maMutex ); if ( mbOutClosed ) - throw css::io::NotConnectedException ( OUString(), static_cast < css::uno::XWeak * > (this ) ); + throw css::io::NotConnectedException ( OUString(), getXWeak() ); checkConnected(); mpStream->Flush(); @@ -215,7 +215,7 @@ void SAL_CALL OTempFileService::closeOutput( ) { std::unique_lock aGuard( maMutex ); if ( mbOutClosed ) - throw css::io::NotConnectedException ( OUString(), static_cast < css::uno::XWeak * > (this ) ); + throw css::io::NotConnectedException ( OUString(), getXWeak() ); mbOutClosed = true; if (mpStream) @@ -236,7 +236,7 @@ void SAL_CALL OTempFileService::closeOutput( ) void OTempFileService::checkError () const { if (!mpStream || mpStream->SvStream::GetError () != ERRCODE_NONE ) - throw css::io::NotConnectedException ( OUString(), const_cast < css::uno::XWeak * > ( static_cast < const css::uno::XWeak * > (this ) ) ); + throw css::io::NotConnectedException ( OUString(), const_cast < OTempFileService * > (this)->getXWeak() ); } void OTempFileService::checkConnected () { @@ -249,7 +249,7 @@ void OTempFileService::checkConnected () } if (!mpStream) - throw css::io::NotConnectedException ( OUString(), static_cast < css::uno::XWeak * > (this ) ); + throw css::io::NotConnectedException ( OUString(), getXWeak() ); } // XSeekable
