From 16a534c61752aadbcb83bf876f752f444f471d2a Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Mon, 9 Dec 2024 00:12:34 +0500 Subject: [PATCH] Simplify OInputSeekStream Change-Id: Ie8da09ad8f3e4425aaeb87f907e47a4e2148f164 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178118 Reviewed-by: Mike Kaganski Tested-by: Jenkins --- package/source/xstor/oseekinstream.cxx | 40 ++------------------------ package/source/xstor/oseekinstream.hxx | 12 ++------ 2 files changed, 4 insertions(+), 48 deletions(-) diff --git a/package/source/xstor/oseekinstream.cxx b/package/source/xstor/oseekinstream.cxx index f5e3d644d673..c791b96fe5e2 100644 --- a/package/source/xstor/oseekinstream.cxx +++ b/package/source/xstor/oseekinstream.cxx @@ -32,7 +32,7 @@ OInputSeekStream::OInputSeekStream( OWriteStream_Impl& pImpl, uno::Reference < io::XInputStream > const & xStream, const uno::Sequence< beans::PropertyValue >& aProps, sal_Int32 nStorageType ) -: OInputCompStream( pImpl, xStream, aProps, nStorageType ) + : OInputSeekStream_BASE(pImpl, xStream, aProps, nStorageType) { m_xSeekable.set( m_xStream, uno::UNO_QUERY ); OSL_ENSURE( m_xSeekable.is(), "No seeking support!" ); @@ -41,7 +41,7 @@ OInputSeekStream::OInputSeekStream( OWriteStream_Impl& pImpl, OInputSeekStream::OInputSeekStream( uno::Reference < io::XInputStream > const & xStream, const uno::Sequence< beans::PropertyValue >& aProps, sal_Int32 nStorageType ) -: OInputCompStream( xStream, aProps, nStorageType ) + : OInputSeekStream_BASE(xStream, aProps, nStorageType) { m_xSeekable.set( m_xStream, uno::UNO_QUERY ); OSL_ENSURE( m_xSeekable.is(), "No seeking support!" ); @@ -51,42 +51,6 @@ OInputSeekStream::~OInputSeekStream() { } -uno::Sequence< uno::Type > SAL_CALL OInputSeekStream::getTypes() -{ - static cppu::OTypeCollection aTypeCollection(cppu::UnoType::get(), - OInputCompStream::getTypes()); - - return aTypeCollection.getTypes(); -} - -uno::Any SAL_CALL OInputSeekStream::queryInterface( const uno::Type& rType ) -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - - uno::Any aReturn( ::cppu::queryInterface( rType, - static_cast< io::XSeekable* >( this ) ) ); - - if ( aReturn.hasValue() ) - { - return aReturn ; - } - - return OInputCompStream::queryInterface( rType ) ; -} - -void SAL_CALL OInputSeekStream::acquire() - noexcept -{ - OInputCompStream::acquire(); -} - -void SAL_CALL OInputSeekStream::release() - noexcept -{ - OInputCompStream::release(); -} - void SAL_CALL OInputSeekStream::seek( sal_Int64 location ) { ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); diff --git a/package/source/xstor/oseekinstream.hxx b/package/source/xstor/oseekinstream.hxx index a77289e9a3ed..8ecc55964c45 100644 --- a/package/source/xstor/oseekinstream.hxx +++ b/package/source/xstor/oseekinstream.hxx @@ -24,8 +24,8 @@ #include "ocompinstream.hxx" -class OInputSeekStream final : public OInputCompStream - , public css::io::XSeekable +using OInputSeekStream_BASE = cppu::ImplInheritanceHelper; +class OInputSeekStream final : public OInputSeekStream_BASE { css::uno::Reference < css::io::XSeekable > m_xSeekable; @@ -41,18 +41,10 @@ public: virtual ~OInputSeekStream() override; - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; - - // XInterface - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - //XSeekable virtual void SAL_CALL seek( sal_Int64 location ) override; virtual sal_Int64 SAL_CALL getPosition() override; virtual sal_Int64 SAL_CALL getLength() override; - }; #endif