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 /comphelper | |
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 'comphelper')
-rw-r--r-- | comphelper/source/misc/storagehelper.cxx | 11 | ||||
-rw-r--r-- | comphelper/source/streaming/basicio.cxx | 13 | ||||
-rw-r--r-- | comphelper/source/streaming/memorystream.cxx | 12 | ||||
-rw-r--r-- | comphelper/source/streaming/seqstream.cxx | 7 |
4 files changed, 3 insertions, 40 deletions
diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx index 934261b0c500..7b41eafbf9f1 100644 --- a/comphelper/source/misc/storagehelper.cxx +++ b/comphelper/source/misc/storagehelper.cxx @@ -175,17 +175,10 @@ void OStorageHelper::CopyInputToOutput( { static const sal_Int32 nConstBufferSize = 32000; - uno::Reference< css::lang::XUnoTunnel > xInputTunnel( xInput, uno::UNO_QUERY ); - comphelper::ByteReader* pByteReader = nullptr; + comphelper::ByteReader* pByteReader = dynamic_cast< comphelper::ByteReader* >( xInput.get() ); comphelper::ByteWriter* pByteWriter = nullptr; - if (xInputTunnel) - pByteReader = reinterpret_cast< comphelper::ByteReader* >( xInputTunnel->getSomething( comphelper::ByteReader::getUnoTunnelId() ) ); if (pByteReader) - { - uno::Reference< css::lang::XUnoTunnel > xOutputTunnel( xOutput, uno::UNO_QUERY ); - if (xOutputTunnel) - pByteWriter = reinterpret_cast< comphelper::ByteWriter* >( xOutputTunnel->getSomething( comphelper::ByteWriter::getUnoTunnelId() ) ); - } + pByteWriter = dynamic_cast< comphelper::ByteWriter* >( xOutput.get() ); if (pByteWriter) { diff --git a/comphelper/source/streaming/basicio.cxx b/comphelper/source/streaming/basicio.cxx index b8c0c96e2cfa..534d8b4cd0a1 100644 --- a/comphelper/source/streaming/basicio.cxx +++ b/comphelper/source/streaming/basicio.cxx @@ -161,21 +161,8 @@ const css::uno::Reference<css::io::XObjectOutputStream>& operator << (const css: ByteReader::~ByteReader() {} -const css::uno::Sequence< sal_Int8 > & ByteReader::getUnoTunnelId() -{ - static const comphelper::UnoIdInit implId; - return implId.getSeq(); -} - ByteWriter::~ByteWriter() {} -const css::uno::Sequence< sal_Int8 > & ByteWriter::getUnoTunnelId() -{ - static const comphelper::UnoIdInit implId; - return implId.getSeq(); -} - - } // namespace comphelper diff --git a/comphelper/source/streaming/memorystream.cxx b/comphelper/source/streaming/memorystream.cxx index 97480a3aad64..dc2a39d9e5b1 100644 --- a/comphelper/source/streaming/memorystream.cxx +++ b/comphelper/source/streaming/memorystream.cxx @@ -55,7 +55,7 @@ namespace comphelper namespace { class UNOMemoryStream : - public WeakImplHelper<XServiceInfo, XStream, XSeekableInputStream, XOutputStream, XTruncate, XUnoTunnel>, + public WeakImplHelper<XServiceInfo, XStream, XSeekableInputStream, XOutputStream, XTruncate>, public comphelper::ByteWriter { public: @@ -90,9 +90,6 @@ public: // XTruncate virtual void SAL_CALL truncate() 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; @@ -248,13 +245,6 @@ void SAL_CALL UNOMemoryStream::truncate() mnCursor = 0; } -sal_Int64 SAL_CALL UNOMemoryStream::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; -} - } // namespace comphelper extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * diff --git a/comphelper/source/streaming/seqstream.cxx b/comphelper/source/streaming/seqstream.cxx index 1f37a7967b04..9626484f62d4 100644 --- a/comphelper/source/streaming/seqstream.cxx +++ b/comphelper/source/streaming/seqstream.cxx @@ -92,13 +92,6 @@ sal_Int32 SequenceInputStream::readSomeBytes( sal_Int8* pData, sal_Int32 nBytesT return nBytesToRead; } -sal_Int64 SAL_CALL SequenceInputStream::getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier ) -{ - if (rIdentifier == comphelper::ByteReader::getUnoTunnelId()) - return reinterpret_cast<sal_Int64>(static_cast<comphelper::ByteReader*>(this)); - return 0; -} - sal_Int32 SAL_CALL SequenceInputStream::readSomeBytes( Sequence<sal_Int8>& aData, sal_Int32 nMaxBytesToRead ) { // all data is available at once |