diff options
author | Noel Grandin <noel@peralex.com> | 2015-11-04 14:38:56 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-11-04 14:42:23 +0200 |
commit | 5ced1a6e42ff7e2425a9e1c374eb25295091b26d (patch) | |
tree | b7649b7942cd494bbbbeaa6cdbee93ed492d8e7b /package | |
parent | 8f93d4a159e599fe7191e7f7b8e52e2775fefdf5 (diff) |
use uno::Reference::set method instead of assignment
Change-Id: I1c7240fe2e2b5eb825f028ca7502e5ba8793046b
Diffstat (limited to 'package')
-rw-r--r-- | package/source/xstor/ohierarchyholder.cxx | 2 | ||||
-rw-r--r-- | package/source/xstor/oseekinstream.cxx | 4 | ||||
-rw-r--r-- | package/source/xstor/owriteablestream.cxx | 62 | ||||
-rw-r--r-- | package/source/xstor/switchpersistencestream.cxx | 9 | ||||
-rw-r--r-- | package/source/xstor/xstorage.cxx | 56 | ||||
-rw-r--r-- | package/source/zipapi/ByteGrabber.cxx | 2 | ||||
-rw-r--r-- | package/source/zipapi/ZipFile.cxx | 2 | ||||
-rw-r--r-- | package/source/zippackage/ZipPackage.cxx | 8 | ||||
-rw-r--r-- | package/source/zippackage/ZipPackageStream.cxx | 14 | ||||
-rw-r--r-- | package/source/zippackage/wrapstreamforshare.cxx | 6 | ||||
-rw-r--r-- | package/source/zippackage/zipfileaccess.cxx | 6 |
11 files changed, 79 insertions, 92 deletions
diff --git a/package/source/xstor/ohierarchyholder.cxx b/package/source/xstor/ohierarchyholder.cxx index 32e09ed719d7..73c50b0ad781 100644 --- a/package/source/xstor/ohierarchyholder.cxx +++ b/package/source/xstor/ohierarchyholder.cxx @@ -253,7 +253,7 @@ void OHierarchyElement_Impl::TestForClosing() m_rParent->RemoveElement( this ); } - m_xOwnStorage = uno::Reference< embed::XStorage >(); + m_xOwnStorage.clear(); } } } diff --git a/package/source/xstor/oseekinstream.cxx b/package/source/xstor/oseekinstream.cxx index 53bf7a3db989..4d6521aecbfc 100644 --- a/package/source/xstor/oseekinstream.cxx +++ b/package/source/xstor/oseekinstream.cxx @@ -33,7 +33,7 @@ OInputSeekStream::OInputSeekStream( OWriteStream_Impl& pImpl, sal_Int32 nStorageType ) : OInputCompStream( pImpl, xStream, aProps, nStorageType ) { - m_xSeekable = uno::Reference< io::XSeekable >( m_xStream, uno::UNO_QUERY ); + m_xSeekable.set( m_xStream, uno::UNO_QUERY ); OSL_ENSURE( m_xSeekable.is(), "No seeking support!\n" ); } @@ -42,7 +42,7 @@ OInputSeekStream::OInputSeekStream( uno::Reference < io::XInputStream > xStream, sal_Int32 nStorageType ) : OInputCompStream( xStream, aProps, nStorageType ) { - m_xSeekable = uno::Reference< io::XSeekable >( m_xStream, uno::UNO_QUERY ); + m_xSeekable.set( m_xStream, uno::UNO_QUERY ); OSL_ENSURE( m_xSeekable.is(), "No seeking support!\n" ); } diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index 1b8fac8c904e..4967e23a96f5 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -323,8 +323,8 @@ void OWriteStream_Impl::CleanCacheStream() catch( const uno::Exception& ) {} - m_xCacheStream = uno::Reference< io::XStream >(); - m_xCacheSeek = uno::Reference< io::XSeekable >(); + m_xCacheStream.clear(); + m_xCacheSeek.clear(); } } @@ -528,7 +528,7 @@ OUString OWriteStream_Impl::GetFilledTempFileIfNo( const uno::Reference< io::XIn // the current position of the original stream should be still OK, copy further ::comphelper::OStorageHelper::CopyInputToOutput( xStream, xTempOutStream ); xTempOutStream->closeOutput(); - xTempOutStream = uno::Reference< io::XOutputStream >(); + xTempOutStream.clear(); } else throw io::IOException(); // TODO: @@ -614,7 +614,7 @@ OUString OWriteStream_Impl::FillTempGetFileName() // the current position of the original stream should be still OK, copy further ::comphelper::OStorageHelper::CopyInputToOutput( xOrigStream, xTempOutStream ); xTempOutStream->closeOutput(); - xTempOutStream = uno::Reference< io::XOutputStream >(); + xTempOutStream.clear(); } else throw io::IOException(); // TODO: @@ -819,14 +819,12 @@ void OWriteStream_Impl::Commit() uno::Reference< io::XInputStream > xInStream( m_xCacheStream->getInputStream(), uno::UNO_SET_THROW ); - xNewPackageStream = uno::Reference< packages::XDataSinkEncrSupport >( - m_xPackage->createInstanceWithArguments( aSeq ), - uno::UNO_QUERY_THROW ); + xNewPackageStream.set( m_xPackage->createInstanceWithArguments( aSeq ), uno::UNO_QUERY_THROW ); xNewPackageStream->setDataStream( xInStream ); - m_xCacheStream = uno::Reference< io::XStream >(); - m_xCacheSeek = uno::Reference< io::XSeekable >(); + m_xCacheStream.clear(); + m_xCacheSeek.clear(); } else if ( !m_aTempURL.isEmpty() ) @@ -846,9 +844,7 @@ void OWriteStream_Impl::Commit() if ( !xInStream.is() ) throw io::IOException(); - xNewPackageStream = uno::Reference< packages::XDataSinkEncrSupport >( - m_xPackage->createInstanceWithArguments( aSeq ), - uno::UNO_QUERY_THROW ); + xNewPackageStream.set( m_xPackage->createInstanceWithArguments( aSeq ), uno::UNO_QUERY_THROW ); // TODO/NEW: Let the temporary file be removed after commit xNewPackageStream->setDataStream( xInStream ); @@ -919,8 +915,8 @@ void OWriteStream_Impl::Revert() if ( m_xCacheStream.is() ) { - m_xCacheStream = uno::Reference< io::XStream >(); - m_xCacheSeek = uno::Reference< io::XSeekable >(); + m_xCacheStream.clear(); + m_xCacheSeek.clear(); } if ( !m_aTempURL.isEmpty() ) @@ -940,7 +936,7 @@ void OWriteStream_Impl::Revert() if ( m_nStorageType == embed::StorageFormats::OFOPXML ) { // currently the relations storage is changed only on commit - m_xNewRelInfoStream = uno::Reference< io::XInputStream >(); + m_xNewRelInfoStream.clear(); m_aNewRelInfo = uno::Sequence< uno::Sequence< beans::StringPair > >(); if ( m_xOrigRelInfoStream.is() ) { @@ -1039,7 +1035,7 @@ void OWriteStream_Impl::ReadRelInfoIfNecessary() // in case of success the stream must be thrown away, that means that the OrigRelInfo is initialized // the reason for this is that the original stream might not be seekable ( at the same time the new // provided stream must be seekable ), so it must be read only once - m_xOrigRelInfoStream = uno::Reference< io::XInputStream >(); + m_xOrigRelInfoStream.clear(); m_nRelInfoStatus = RELINFO_READ; } catch( const uno::Exception& rException ) @@ -1446,9 +1442,7 @@ void OWriteStream_Impl::CreateReadonlyCopyBasedOnData( const uno::Reference< io: { uno::Reference < io::XStream > xTempFile; if ( !xTargetStream.is() ) - xTempFile = uno::Reference < io::XStream >( - io::TempFile::create(m_xContext), - uno::UNO_QUERY ); + xTempFile.set( io::TempFile::create(m_xContext), uno::UNO_QUERY ); else xTempFile = xTargetStream; @@ -1472,7 +1466,7 @@ void OWriteStream_Impl::CreateReadonlyCopyBasedOnData( const uno::Reference< io: // TODO: remember last state of m_bUseCommonEncryption if ( !xTargetStream.is() ) - xTargetStream = uno::Reference< io::XStream > ( + xTargetStream.set( static_cast< ::cppu::OWeakObject* >( new OInputSeekStream( xInStream, InsertOwnProps( aProps, m_bUseCommonEncryption ), m_nStorageType ) ), uno::UNO_QUERY_THROW ); @@ -1663,7 +1657,7 @@ void OWriteStream_Impl::CommitStreamRelInfo( const uno::Reference< embed::XStora else { // the information is already parsed and the stream is stored, no need in temporary stream any more - m_xNewRelInfoStream = uno::Reference< io::XInputStream >(); + m_xNewRelInfoStream.clear(); m_nRelInfoStatus = RELINFO_READ; } } @@ -1673,7 +1667,7 @@ void OWriteStream_Impl::CommitStreamRelInfo( const uno::Reference< embed::XStora m_aOrigRelInfo = m_aNewRelInfo; m_bOrigRelInfoBroken = false; m_aNewRelInfo = uno::Sequence< uno::Sequence< beans::StringPair > >(); - m_xNewRelInfoStream = uno::Reference< io::XInputStream >(); + m_xNewRelInfoStream.clear(); } else { @@ -1721,7 +1715,7 @@ OWriteStream::OWriteStream( OWriteStream_Impl* pImpl, uno::Reference< io::XStrea { m_xInStream = xStream->getInputStream(); m_xOutStream = xStream->getOutputStream(); - m_xSeekable = uno::Reference< io::XSeekable >( xStream, uno::UNO_QUERY ); + m_xSeekable.set( xStream, uno::UNO_QUERY ); OSL_ENSURE( m_xInStream.is() && m_xOutStream.is() && m_xSeekable.is(), "Stream implementation is incomplete!\n" ); } } @@ -1751,9 +1745,9 @@ void OWriteStream::DeInit() if ( m_xSeekable.is() ) m_nInitPosition = m_xSeekable->getPosition(); - m_xInStream = uno::Reference< io::XInputStream >(); - m_xOutStream = uno::Reference< io::XOutputStream >(); - m_xSeekable = uno::Reference< io::XSeekable >(); + m_xInStream.clear(); + m_xOutStream.clear(); + m_xSeekable.clear(); m_bInitOnDemand = true; } @@ -2155,7 +2149,7 @@ void SAL_CALL OWriteStream::closeInput( ) // since it can not be reopened until output part is closed, it will be closed with output part. m_bInStreamDisconnected = true; // m_xInStream->closeInput(); - // m_xInStream = uno::Reference< io::XInputStream >(); + // m_xInStream.clear(); if ( !m_xOutStream.is() ) dispose(); @@ -2306,7 +2300,7 @@ void OWriteStream::CloseOutput_Impl() // all the checks must be done in calling method m_xOutStream->closeOutput(); - m_xOutStream = uno::Reference< io::XOutputStream >(); + m_xOutStream.clear(); if ( !m_bInitOnDemand ) { @@ -2460,10 +2454,10 @@ void SAL_CALL OWriteStream::dispose() if ( m_xInStream.is() ) { m_xInStream->closeInput(); - m_xInStream = uno::Reference< io::XInputStream >(); + m_xInStream.clear(); } - m_xSeekable = uno::Reference< io::XSeekable >(); + m_xSeekable.clear(); m_pImpl->m_pAntiImpl = NULL; @@ -2853,7 +2847,7 @@ void SAL_CALL OWriteStream::insertRelationshipByID( const OUString& sID, const throw container::ElementExistException(); // TODO m_pImpl->m_aNewRelInfo = aSeq; - m_pImpl->m_xNewRelInfoStream = uno::Reference< io::XInputStream >(); + m_pImpl->m_xNewRelInfoStream.clear(); m_pImpl->m_nRelInfoStatus = RELINFO_CHANGED; } @@ -2885,7 +2879,7 @@ void SAL_CALL OWriteStream::removeRelationshipByID( const OUString& sID ) aSeq.realloc( nLength - 1 ); m_pImpl->m_aNewRelInfo = aSeq; - m_pImpl->m_xNewRelInfoStream = uno::Reference< io::XInputStream >(); + m_pImpl->m_xNewRelInfoStream.clear(); m_pImpl->m_nRelInfoStatus = RELINFO_CHANGED; // TODO/LATER: in future the unification of the ID could be checked @@ -2976,7 +2970,7 @@ void SAL_CALL OWriteStream::insertRelationships( const uno::Sequence< uno::Sequ aResultSeq.realloc( nResultInd ); m_pImpl->m_aNewRelInfo = aResultSeq; - m_pImpl->m_xNewRelInfoStream = uno::Reference< io::XInputStream >(); + m_pImpl->m_xNewRelInfoStream.clear(); m_pImpl->m_nRelInfoStatus = RELINFO_CHANGED; } @@ -2996,7 +2990,7 @@ void SAL_CALL OWriteStream::clearRelationships() throw uno::RuntimeException(); m_pImpl->m_aNewRelInfo.realloc( 0 ); - m_pImpl->m_xNewRelInfoStream = uno::Reference< io::XInputStream >(); + m_pImpl->m_xNewRelInfoStream.clear(); m_pImpl->m_nRelInfoStatus = RELINFO_CHANGED; } diff --git a/package/source/xstor/switchpersistencestream.cxx b/package/source/xstor/switchpersistencestream.cxx index 9e241f2694a0..1eca85ff62ef 100644 --- a/package/source/xstor/switchpersistencestream.cxx +++ b/package/source/xstor/switchpersistencestream.cxx @@ -162,16 +162,13 @@ void SwitchablePersistenceStream::CopyAndSwitchPersistenceTo( const uno::Referen if ( !xTargetStream.is() ) { - xTargetStream = uno::Reference < io::XStream >( - io::TempFile::create(m_xContext), - uno::UNO_QUERY_THROW ); - - xTargetSeek = uno::Reference< io::XSeekable >( xTargetStream, uno::UNO_QUERY_THROW ); + xTargetStream.set( io::TempFile::create(m_xContext), uno::UNO_QUERY_THROW ); + xTargetSeek.set( xTargetStream, uno::UNO_QUERY_THROW ); } else { // the provided stream must be empty - xTargetSeek = uno::Reference< io::XSeekable >( xTargetStream, uno::UNO_QUERY_THROW ); + xTargetSeek.set( xTargetStream, uno::UNO_QUERY_THROW ); if ( xTargetSeek->getLength() ) throw io::IOException(); } diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index db24890076f0..3c37bba00551 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -344,8 +344,8 @@ OStorage_Impl::~OStorage_Impl() m_pRelStorElement = NULL; } - m_xPackageFolder = uno::Reference< container::XNameContainer >(); - m_xPackage = uno::Reference< lang::XSingleServiceFactory >(); + m_xPackageFolder.clear(); + m_xPackage.clear(); OUString aPropertyName = "URL"; for ( sal_Int32 aInd = 0; aInd < m_xProperties.getLength(); ++aInd ) @@ -358,7 +358,7 @@ OStorage_Impl::~OStorage_Impl() if ( m_xInputStream.is() ) { m_xInputStream->closeInput(); - m_xInputStream = uno::Reference< io::XInputStream >(); + m_xInputStream.clear(); } if ( m_xStream.is() ) @@ -371,7 +371,7 @@ OStorage_Impl::~OStorage_Impl() if ( xOutStr.is() ) xOutStr->closeOutput(); - m_xStream = uno::Reference< io::XStream >(); + m_xStream.clear(); } } catch( const uno::Exception& rException ) @@ -496,10 +496,9 @@ void OStorage_Impl::OpenOwnPackage() aArguments[nArgNum-1] <<= aNamedValue; } - m_xPackage = uno::Reference< lang::XSingleServiceFactory > ( - GetComponentContext()->getServiceManager()->createInstanceWithArgumentsAndContext( - "com.sun.star.packages.comp.ZipPackage", aArguments, GetComponentContext()), - uno::UNO_QUERY ); + m_xPackage.set( GetComponentContext()->getServiceManager()->createInstanceWithArgumentsAndContext( + "com.sun.star.packages.comp.ZipPackage", aArguments, GetComponentContext()), + uno::UNO_QUERY ); } uno::Reference< container::XHierarchicalNameAccess > xHNameAccess( m_xPackage, uno::UNO_QUERY ); @@ -670,7 +669,7 @@ void OStorage_Impl::ReadContents() if ( ( m_nStorageMode & embed::ElementModes::TRUNCATE ) == embed::ElementModes::TRUNCATE ) { // if a storage is truncated the relations information should be cleaned - m_xNewRelInfoStream = uno::Reference< io::XInputStream >(); + m_xNewRelInfoStream.clear(); m_aRelInfo = uno::Sequence< uno::Sequence< beans::StringPair > >(); m_nRelInfoStatus = RELINFO_CHANGED; } @@ -1054,9 +1053,8 @@ void OStorage_Impl::Commit() uno::Sequence< uno::Any > aSeq( 1 ); aSeq[0] <<= sal_True; - xNewPackageFolder = uno::Reference< container::XNameContainer >( - m_xPackage->createInstanceWithArguments( aSeq ), - uno::UNO_QUERY ); + xNewPackageFolder.set( m_xPackage->createInstanceWithArguments( aSeq ), + uno::UNO_QUERY ); } else xNewPackageFolder = m_xPackageFolder; @@ -1255,8 +1253,8 @@ void OStorage_Impl::Commit() embed::UseBackupException aException; if ( r.TargetException >>= aException ) { - m_xStream = uno::Reference< io::XStream >(); - m_xInputStream = uno::Reference< io::XInputStream >(); + m_xStream.clear(); + m_xInputStream.clear(); throw aException; } @@ -1330,7 +1328,7 @@ void OStorage_Impl::Revert() if ( m_nStorageType == embed::StorageFormats::OFOPXML ) { // currently the relations storage is changed only on commit - m_xNewRelInfoStream = uno::Reference< io::XInputStream >(); + m_xNewRelInfoStream.clear(); m_aRelInfo = uno::Sequence< uno::Sequence< beans::StringPair > >(); m_nRelInfoStatus = RELINFO_NO_INIT; } @@ -1724,7 +1722,7 @@ void OStorage_Impl::CreateRelStorage() throw uno::RuntimeException( THROW_WHERE ); OStorage* pResultStorage = new OStorage( m_pRelStorElement->m_pStorage, false ); - m_xRelStorage = uno::Reference< embed::XStorage >( static_cast<embed::XStorage*>(pResultStorage) ); + m_xRelStorage.set( static_cast<embed::XStorage*>(pResultStorage) ); } } @@ -1838,7 +1836,7 @@ void OStorage_Impl::CommitRelInfo( const uno::Reference< container::XNameContain "MediaType", uno::makeAny( OUString( "application/vnd.openxmlformats-package.relationships+xml" ) ) ); - m_xNewRelInfoStream = uno::Reference< io::XInputStream >(); + m_xNewRelInfoStream.clear(); if ( m_nRelInfoStatus == RELINFO_CHANGED_STREAM ) { m_aRelInfo = uno::Sequence< uno::Sequence< beans::StringPair > >(); @@ -1866,7 +1864,7 @@ void OStorage_Impl::CommitRelInfo( const uno::Reference< container::XNameContain // the empty relations storage should not be created delete m_pRelStorElement; m_pRelStorElement = NULL; - m_xRelStorage = uno::Reference< embed::XStorage >(); + m_xRelStorage.clear(); } else if ( m_pRelStorElement && m_pRelStorElement->m_pStorage && xNewPackageFolder.is() ) m_pRelStorElement->m_pStorage->InsertIntoPackageFolder( aRelsStorName, xNewPackageFolder ); @@ -2578,7 +2576,7 @@ uno::Reference< embed::XStorage > SAL_CALL OStorage::openStorageElement( bool bReadOnlyWrap = ( ( nStorageMode & embed::ElementModes::WRITE ) != embed::ElementModes::WRITE ); OStorage* pResultStorage = new OStorage( pElement->m_pStorage, bReadOnlyWrap ); - xResult = uno::Reference< embed::XStorage >( static_cast<embed::XStorage*>(pResultStorage) ); + xResult.set( static_cast<embed::XStorage*>(pResultStorage) ); if ( bReadOnlyWrap ) { @@ -4807,7 +4805,7 @@ void SAL_CALL OStorage::setPropertyValue( const OUString& aPropertyName, const u { if ( aValue >>= m_pImpl->m_aRelInfo ) { - m_pImpl->m_xNewRelInfoStream = uno::Reference< io::XInputStream >(); + m_pImpl->m_xNewRelInfoStream.clear(); m_pImpl->m_nRelInfoStatus = RELINFO_CHANGED; m_pImpl->m_bBroadcastModified = true; m_pImpl->m_bIsModified = true; @@ -5247,7 +5245,7 @@ void SAL_CALL OStorage::insertRelationshipByID( const OUString& sID, const uno: throw container::ElementExistException( THROW_WHERE ); m_pImpl->m_aRelInfo = aSeq; - m_pImpl->m_xNewRelInfoStream = uno::Reference< io::XInputStream >(); + m_pImpl->m_xNewRelInfoStream.clear(); m_pImpl->m_nRelInfoStatus = RELINFO_CHANGED; } @@ -5279,7 +5277,7 @@ void SAL_CALL OStorage::removeRelationshipByID( const OUString& sID ) aSeq.realloc( nLength - 1 ); m_pImpl->m_aRelInfo = aSeq; - m_pImpl->m_xNewRelInfoStream = uno::Reference< io::XInputStream >(); + m_pImpl->m_xNewRelInfoStream.clear(); m_pImpl->m_nRelInfoStatus = RELINFO_CHANGED; // TODO/LATER: in future the unification of the ID could be checked @@ -5370,7 +5368,7 @@ void SAL_CALL OStorage::insertRelationships( const uno::Sequence< uno::Sequence aResultSeq.realloc( nResultInd ); m_pImpl->m_aRelInfo = aResultSeq; - m_pImpl->m_xNewRelInfoStream = uno::Reference< io::XInputStream >(); + m_pImpl->m_xNewRelInfoStream.clear(); m_pImpl->m_nRelInfoStatus = RELINFO_CHANGED; } @@ -5390,7 +5388,7 @@ void SAL_CALL OStorage::clearRelationships() throw uno::RuntimeException( THROW_WHERE ); m_pImpl->m_aRelInfo.realloc( 0 ); - m_pImpl->m_xNewRelInfoStream = uno::Reference< io::XInputStream >(); + m_pImpl->m_xNewRelInfoStream.clear(); m_pImpl->m_nRelInfoStatus = RELINFO_CHANGED; } @@ -5972,9 +5970,8 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openStreamEle SotElement_Impl *pElement = OpenStreamElement_Impl( aStreamPath, nOpenMode, false ); assert(pElement && pElement->m_pStream && "In case element can not be created an exception must be thrown!"); - xResult = uno::Reference< embed::XExtendedStorageStream >( - pElement->m_pStream->GetStream( nOpenMode, true ), - uno::UNO_QUERY_THROW ); + xResult.set( pElement->m_pStream->GetStream( nOpenMode, true ), + uno::UNO_QUERY_THROW ); } catch ( const container::NoSuchElementException & ) { @@ -6088,9 +6085,8 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openEncrypted SotElement_Impl *pElement = OpenStreamElement_Impl( aStreamPath, nOpenMode, true ); OSL_ENSURE( pElement && pElement->m_pStream, "In case element can not be created an exception must be thrown!" ); - xResult = uno::Reference< embed::XExtendedStorageStream >( - pElement->m_pStream->GetStream( nOpenMode, aEncryptionData, true ), - uno::UNO_QUERY_THROW ); + xResult.set( pElement->m_pStream->GetStream( nOpenMode, aEncryptionData, true ), + uno::UNO_QUERY_THROW ); } else { diff --git a/package/source/zipapi/ByteGrabber.cxx b/package/source/zipapi/ByteGrabber.cxx index 65643bee865d..4fb1f029e1b4 100644 --- a/package/source/zipapi/ByteGrabber.cxx +++ b/package/source/zipapi/ByteGrabber.cxx @@ -49,7 +49,7 @@ void ByteGrabber::setInputStream (uno::Reference < io::XInputStream > xNewStream { ::osl::MutexGuard aGuard( m_aMutex ); xStream = xNewStream; - xSeek = uno::Reference < io::XSeekable > (xNewStream, uno::UNO_QUERY); + xSeek.set(xNewStream, uno::UNO_QUERY); } // XInputStream chained diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index 7d4b9987a82d..9fa0cbb1d47c 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -120,7 +120,7 @@ void ZipFile::setInputStream ( uno::Reference < XInputStream > xNewStream ) ::osl::MutexGuard aGuard( m_aMutex ); xStream = xNewStream; - xSeek = uno::Reference < XSeekable > ( xStream, UNO_QUERY ); + xSeek.set( xStream, UNO_QUERY ); aGrabber.setInputStream ( xStream ); } diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 435d83a79725..931e00a4834f 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -716,7 +716,7 @@ void SAL_CALL ZipPackage::initialize( const uno::Sequence< Any >& aArguments ) { // the stream must be seekable, if it is not it will be wrapped m_xContentStream = ::comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( m_xContentStream, m_xContext ); - m_xContentSeek = uno::Reference < XSeekable > ( m_xContentStream, UNO_QUERY ); + m_xContentSeek.set( m_xContentStream, UNO_QUERY ); if ( ! m_xContentSeek.is() ) throw css::uno::Exception (THROW_WHERE "The package component _requires_ an XSeekable interface!", static_cast < ::cppu::OWeakObject * > ( this ) ); @@ -1473,7 +1473,7 @@ void SAL_CALL ZipPackage::commitChanges() try { aOrigFileStream = xSimpleAccess->openFileWrite( m_aURL ); - xOrigTruncate = uno::Reference< io::XTruncate >( aOrigFileStream, uno::UNO_QUERY_THROW ); + xOrigTruncate.set( aOrigFileStream, uno::UNO_QUERY_THROW ); // after successful truncation the file is already corrupted xOrigTruncate->truncate(); } @@ -1494,7 +1494,7 @@ void SAL_CALL ZipPackage::commitChanges() aOrigFileStream->closeOutput(); } catch ( uno::Exception& ) {} - aOrigFileStream = uno::Reference< XOutputStream >(); + aOrigFileStream.clear(); // the original file can already be corrupted bCanBeCorrupted = true; } @@ -1551,7 +1551,7 @@ void SAL_CALL ZipPackage::commitChanges() void ZipPackage::DisconnectFromTargetAndThrowException_Impl( const uno::Reference< io::XInputStream >& xTempStream ) { - m_xStream = uno::Reference< io::XStream >( xTempStream, uno::UNO_QUERY ); + m_xStream.set( xTempStream, uno::UNO_QUERY ); if ( m_xStream.is() ) m_eMode = e_IMode_XStream; else diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index e5ec367be724..f99fbda5bbc3 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -141,7 +141,7 @@ void ZipPackageStream::CloseOwnStreamIfAny() if ( m_xStream.is() ) { m_xStream->closeInput(); - m_xStream = uno::Reference< io::XInputStream >(); + m_xStream.clear(); m_bHasSeekable = false; } } @@ -349,12 +349,12 @@ uno::Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( xTempSeek->seek( 0 ); // close raw stream, package stream and folder - xInRaw = uno::Reference< io::XInputStream >(); - xNewPSProps = uno::Reference< XPropertySet >(); - xNPSTunnel = uno::Reference< XUnoTunnel >(); - xNewPackStream = uno::Reference< XDataSinkEncrSupport >(); - xTunnel = uno::Reference< XUnoTunnel >(); - xRootNameContainer = uno::Reference< container::XNameContainer >(); + xInRaw.clear(); + xNewPSProps.clear(); + xNPSTunnel.clear(); + xNewPackStream.clear(); + xTunnel.clear(); + xRootNameContainer.clear(); // return the stream representing the first temporary file return xTempIn; diff --git a/package/source/zippackage/wrapstreamforshare.cxx b/package/source/zippackage/wrapstreamforshare.cxx index 50f160132e5e..f97c213b4709 100644 --- a/package/source/zippackage/wrapstreamforshare.cxx +++ b/package/source/zippackage/wrapstreamforshare.cxx @@ -35,7 +35,7 @@ WrapStreamForShare::WrapStreamForShare( const uno::Reference< io::XInputStream > , m_xInStream( xInStream ) , m_nCurPos( 0 ) { - m_xSeekable = uno::Reference< io::XSeekable >( m_xInStream, uno::UNO_QUERY ); + m_xSeekable.set( m_xInStream, uno::UNO_QUERY ); if ( !m_rMutexRef.is() || !m_xInStream.is() || !m_xSeekable.is() ) { OSL_FAIL( "Wrong initialization of wrapping stream!\n" ); @@ -124,8 +124,8 @@ void SAL_CALL WrapStreamForShare::closeInput() // the package is the owner so it will close the stream // m_xInStream->closeInput(); - m_xInStream = uno::Reference< io::XInputStream >(); - m_xSeekable = uno::Reference< io::XSeekable >(); + m_xInStream.clear(); + m_xSeekable.clear(); } // XSeekable diff --git a/package/source/zippackage/zipfileaccess.cxx b/package/source/zippackage/zipfileaccess.cxx index 6e865470c60f..f05bdce6d321 100644 --- a/package/source/zippackage/zipfileaccess.cxx +++ b/package/source/zippackage/zipfileaccess.cxx @@ -194,18 +194,18 @@ void SAL_CALL OZipFileAccess::initialize( const uno::Sequence< uno::Any >& aArgu { m_xContentStream = xSink->getInputStream(); m_bOwnContent = true; - xSeekable = uno::Reference< io::XSeekable >( m_xContentStream, uno::UNO_QUERY ); + xSeekable.set( m_xContentStream, uno::UNO_QUERY ); } } else if ( (aArguments[0] >>= xStream ) ) { // a writable stream can implement both XStream & XInputStream m_xContentStream = xStream->getInputStream(); - xSeekable = uno::Reference< io::XSeekable >( xStream, uno::UNO_QUERY ); + xSeekable.set( xStream, uno::UNO_QUERY ); } else if ( aArguments[0] >>= m_xContentStream ) { - xSeekable = uno::Reference< io::XSeekable >( m_xContentStream, uno::UNO_QUERY ); + xSeekable.set( m_xContentStream, uno::UNO_QUERY ); } else throw lang::IllegalArgumentException(THROW_WHERE, uno::Reference< uno::XInterface >(), 1 ); |