Simplify OInputSeekStream

Change-Id: Ie8da09ad8f3e4425aaeb87f907e47a4e2148f164
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178118
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Mike Kaganski 2024-12-09 00:12:34 +05:00
parent e512091e89
commit 16a534c617
2 changed files with 4 additions and 48 deletions

View file

@ -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<io::XSeekable>::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() );

View file

@ -24,8 +24,8 @@
#include "ocompinstream.hxx"
class OInputSeekStream final : public OInputCompStream
, public css::io::XSeekable
using OInputSeekStream_BASE = cppu::ImplInheritanceHelper<OInputCompStream, css::io::XSeekable>;
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