diff options
Diffstat (limited to 'comphelper/source/streaming/seekableinput.cxx')
-rw-r--r-- | comphelper/source/streaming/seekableinput.cxx | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/comphelper/source/streaming/seekableinput.cxx b/comphelper/source/streaming/seekableinput.cxx index e4f654043dc7..264feaeb3071 100644 --- a/comphelper/source/streaming/seekableinput.cxx +++ b/comphelper/source/streaming/seekableinput.cxx @@ -24,8 +24,10 @@ #include <com/sun/star/io/TempFile.hpp> #include <com/sun/star/io/XOutputStream.hpp> +#include <com/sun/star/lang/IllegalArgumentException.hpp> #include <comphelper/seekableinput.hxx> +#include <utility> using namespace ::com::sun::star; @@ -57,13 +59,13 @@ static void copyInputToOutput_Impl( const uno::Reference< io::XInputStream >& xI OSeekableInputWrapper::OSeekableInputWrapper( - const uno::Reference< io::XInputStream >& xInStream, - const uno::Reference< uno::XComponentContext >& rxContext ) -: m_xContext( rxContext ) -, m_xOriginalStream( xInStream ) + uno::Reference< io::XInputStream > xInStream, + uno::Reference< uno::XComponentContext > xContext ) +: m_xContext(std::move( xContext )) +, m_xOriginalStream(std::move( xInStream )) { if ( !m_xContext.is() ) - throw uno::RuntimeException(); + throw lang::IllegalArgumentException("no component context", *this, 1); } @@ -90,7 +92,7 @@ void OSeekableInputWrapper::PrepareCopy_Impl() if ( !m_xCopyInput.is() ) { if ( !m_xContext.is() ) - throw uno::RuntimeException(); + throw uno::RuntimeException("no component context"); uno::Reference< io::XOutputStream > xTempOut( io::TempFile::create(m_xContext), @@ -110,14 +112,14 @@ void OSeekableInputWrapper::PrepareCopy_Impl() } if ( !m_xCopyInput.is() ) - throw io::IOException(); + throw io::IOException("no m_xCopyInput"); } // XInputStream sal_Int32 SAL_CALL OSeekableInputWrapper::readBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) { - ::osl::MutexGuard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if ( !m_xOriginalStream.is() ) throw io::NotConnectedException(); @@ -130,7 +132,7 @@ sal_Int32 SAL_CALL OSeekableInputWrapper::readBytes( uno::Sequence< sal_Int8 >& sal_Int32 SAL_CALL OSeekableInputWrapper::readSomeBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) { - ::osl::MutexGuard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if ( !m_xOriginalStream.is() ) throw io::NotConnectedException(); @@ -143,7 +145,7 @@ sal_Int32 SAL_CALL OSeekableInputWrapper::readSomeBytes( uno::Sequence< sal_Int8 void SAL_CALL OSeekableInputWrapper::skipBytes( sal_Int32 nBytesToSkip ) { - ::osl::MutexGuard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if ( !m_xOriginalStream.is() ) throw io::NotConnectedException(); @@ -156,7 +158,7 @@ void SAL_CALL OSeekableInputWrapper::skipBytes( sal_Int32 nBytesToSkip ) sal_Int32 SAL_CALL OSeekableInputWrapper::available() { - ::osl::MutexGuard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if ( !m_xOriginalStream.is() ) throw io::NotConnectedException(); @@ -169,7 +171,7 @@ sal_Int32 SAL_CALL OSeekableInputWrapper::available() void SAL_CALL OSeekableInputWrapper::closeInput() { - ::osl::MutexGuard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if ( !m_xOriginalStream.is() ) throw io::NotConnectedException(); @@ -191,7 +193,7 @@ void SAL_CALL OSeekableInputWrapper::closeInput() void SAL_CALL OSeekableInputWrapper::seek( sal_Int64 location ) { - ::osl::MutexGuard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if ( !m_xOriginalStream.is() ) throw io::NotConnectedException(); @@ -204,7 +206,7 @@ void SAL_CALL OSeekableInputWrapper::seek( sal_Int64 location ) sal_Int64 SAL_CALL OSeekableInputWrapper::getPosition() { - ::osl::MutexGuard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if ( !m_xOriginalStream.is() ) throw io::NotConnectedException(); @@ -217,7 +219,7 @@ sal_Int64 SAL_CALL OSeekableInputWrapper::getPosition() sal_Int64 SAL_CALL OSeekableInputWrapper::getLength() { - ::osl::MutexGuard aGuard( m_aMutex ); + std::scoped_lock aGuard( m_aMutex ); if ( !m_xOriginalStream.is() ) throw io::NotConnectedException(); |