diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-01-12 11:49:29 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-01-13 06:15:21 +0000 |
commit | 14df26ac57696c11fd344bb16ec22738e42377fc (patch) | |
tree | 38d06a93a5f01e014be6b93cbc420d016bd4405e /package/source/xstor | |
parent | 20adf4683c7d38ad41edac586b897757393c8029 (diff) |
XUnoTunnel->dynamic_cast in comphelper::ByteReader and comphelper::ByteWriter
Change-Id: I1f8c864a939dff1252ba15f517f63b62d1a1e1fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145393
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'package/source/xstor')
-rw-r--r-- | package/source/xstor/owriteablestream.cxx | 19 | ||||
-rw-r--r-- | package/source/xstor/owriteablestream.hxx | 4 |
2 files changed, 3 insertions, 20 deletions
diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index 2d6bda378d34..88d85c9fc5d2 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -90,10 +90,7 @@ static void CopyInputToOutput( { static const sal_Int32 nConstBufferSize = 32000; - uno::Reference< css::lang::XUnoTunnel > xInputTunnel( xInput, uno::UNO_QUERY ); - comphelper::ByteReader* pByteReader = nullptr; - if (xInputTunnel) - pByteReader = reinterpret_cast< comphelper::ByteReader* >( xInputTunnel->getSomething( comphelper::ByteReader::getUnoTunnelId() ) ); + comphelper::ByteReader* pByteReader = dynamic_cast< comphelper::ByteReader* >( xInput.get() ); if (pByteReader) { @@ -1734,8 +1731,7 @@ uno::Any SAL_CALL OWriteStream::queryInterface( const uno::Type& rType ) , static_cast<io::XSeekable*> ( this ) , static_cast<io::XTruncate*> ( this ) , static_cast<lang::XComponent*> ( this ) - , static_cast<beans::XPropertySet*> ( this ) - , static_cast<lang::XUnoTunnel*> ( this ) ); + , static_cast<beans::XPropertySet*> ( this ) ); if ( aReturn.hasValue() ) return aReturn ; @@ -2160,9 +2156,7 @@ void OWriteStream::writeBytes( const sal_Int8* pData, sal_Int32 nBytesToWrite ) throw io::NotConnectedException(); uno::Reference< css::lang::XUnoTunnel > xOutputTunnel( m_xOutStream, uno::UNO_QUERY ); - comphelper::ByteWriter* pByteWriter = nullptr; - if (xOutputTunnel) - pByteWriter = reinterpret_cast< comphelper::ByteWriter* >( xOutputTunnel->getSomething( comphelper::ByteWriter::getUnoTunnelId() ) ); + comphelper::ByteWriter* pByteWriter = dynamic_cast< comphelper::ByteWriter* >( m_xOutStream.get() ); if (pByteWriter) pByteWriter->writeBytes(pData, nBytesToWrite); else @@ -2175,13 +2169,6 @@ void OWriteStream::writeBytes( const sal_Int8* pData, sal_Int32 nBytesToWrite ) ModifyParentUnlockMutex_Impl( aGuard ); } -sal_Int64 SAL_CALL OWriteStream::getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier ) -{ - if (rIdentifier == comphelper::ByteWriter::getUnoTunnelId()) - return reinterpret_cast<sal_Int64>(static_cast<comphelper::ByteWriter*>(this)); - return 0; -} - void SAL_CALL OWriteStream::flush() { // In case stream is flushed its current version becomes visible diff --git a/package/source/xstor/owriteablestream.hxx b/package/source/xstor/owriteablestream.hxx index 140257641576..16f5291eccfc 100644 --- a/package/source/xstor/owriteablestream.hxx +++ b/package/source/xstor/owriteablestream.hxx @@ -232,7 +232,6 @@ class OWriteStream : public css::lang::XTypeProvider , public css::embed::XTransactedObject , public css::embed::XTransactionBroadcaster , public css::beans::XPropertySet - , public css::lang::XUnoTunnel , public ::cppu::OWeakObject , public comphelper::ByteWriter { @@ -347,9 +346,6 @@ public: virtual void SAL_CALL removeTransactionListener( const css::uno::Reference< css::embed::XTransactionListener >& aListener ) override; - // XUnoTunnel - virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; - // comphelper::ByteWriter virtual void writeBytes(const sal_Int8* aData, sal_Int32 nBytesToWrite) override; |