Use getXWeak in unotools
Change-Id: I61ae9f11c3017442ac7461ca57f5625d1687fc68 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150882 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
@@ -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()
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user