From 8342e4a5c7bd436f869e6c1c23d248556087ebdf Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 4 May 2022 07:04:01 +0200 Subject: Just use Any ctor instead of makeAny in package Change-Id: I527024f34b88ec764488a3766872f1941f8dbb4e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133794 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- package/source/xstor/owriteablestream.cxx | 28 +++++++++--------- package/source/xstor/xstorage.cxx | 40 +++++++++++++------------- package/source/zippackage/ZipPackage.cxx | 18 ++++++------ package/source/zippackage/ZipPackageFolder.cxx | 8 +++--- package/source/zippackage/ZipPackageStream.cxx | 10 +++---- package/source/zippackage/zipfileaccess.cxx | 2 +- 6 files changed, 53 insertions(+), 53 deletions(-) (limited to 'package') diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index 7c80a6e86152..9e454e016d5e 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -116,7 +116,7 @@ void SetEncryptionKeyProperty_Impl( const uno::Reference< beans::XPropertySet >& throw uno::RuntimeException(); try { - xPropertySet->setPropertyValue( STORAGE_ENCRYPTION_KEYS_PROPERTY, uno::makeAny( aKey ) ); + xPropertySet->setPropertyValue( STORAGE_ENCRYPTION_KEYS_PROPERTY, uno::Any( aKey ) ); } catch ( const uno::Exception& ex ) { @@ -339,7 +339,7 @@ void OWriteStream_Impl::InsertIntoPackageFolder( const OUString& aName, { SAL_WARN_IF( !m_xPackageStream.is(), "package.xstor", "An inserted stream is incomplete!" ); uno::Reference< lang::XUnoTunnel > xTunnel( m_xPackageStream, uno::UNO_QUERY_THROW ); - xParentPackageFolder->insertByName( aName, uno::makeAny( xTunnel ) ); + xParentPackageFolder->insertByName( aName, uno::Any( xTunnel ) ); m_bFlushed = false; m_bHasInsertedStreamOptimization = false; @@ -742,7 +742,7 @@ void OWriteStream_Impl::InsertStreamDirectly( const uno::Reference< io::XInputSt if ( bCompressedIsSet ) { - xPropertySet->setPropertyValue( aComprPropName, uno::makeAny( bCompressed ) ); + xPropertySet->setPropertyValue( aComprPropName, uno::Any( bCompressed ) ); m_bCompressedSetExplicit = true; } @@ -753,8 +753,8 @@ void OWriteStream_Impl::InsertStreamDirectly( const uno::Reference< io::XInputSt // set to be encrypted but do not use encryption key xPropertySet->setPropertyValue( STORAGE_ENCRYPTION_KEYS_PROPERTY, - uno::makeAny( uno::Sequence< beans::NamedValue >() ) ); - xPropertySet->setPropertyValue( "Encrypted", uno::makeAny( true ) ); + uno::Any( uno::Sequence< beans::NamedValue >() ) ); + xPropertySet->setPropertyValue( "Encrypted", uno::Any( true ) ); } // the stream should be free soon, after package is stored @@ -843,9 +843,9 @@ void OWriteStream_Impl::Commit() // set to be encrypted but do not use encryption key xPropertySet->setPropertyValue( STORAGE_ENCRYPTION_KEYS_PROPERTY, - uno::makeAny( uno::Sequence< beans::NamedValue >() ) ); + uno::Any( uno::Sequence< beans::NamedValue >() ) ); xPropertySet->setPropertyValue( "Encrypted", - uno::makeAny( true ) ); + uno::Any( true ) ); } else if ( m_bHasCachedEncryptionData ) { @@ -853,7 +853,7 @@ void OWriteStream_Impl::Commit() throw uno::RuntimeException(); xPropertySet->setPropertyValue( STORAGE_ENCRYPTION_KEYS_PROPERTY, - uno::makeAny( m_aEncryptionData.getAsConstNamedValueList() ) ); + uno::Any( m_aEncryptionData.getAsConstNamedValueList() ) ); } // the stream should be free soon, after package is stored @@ -1533,7 +1533,7 @@ void OWriteStream_Impl::CommitStreamRelInfo( const uno::Reference< embed::XStora uno::Reference< beans::XPropertySet > xPropSet( xRelsStream, uno::UNO_QUERY_THROW ); xPropSet->setPropertyValue( "MediaType", - uno::makeAny( OUString("application/vnd.openxmlformats-package.relationships+xml" ) ) ); + uno::Any( OUString("application/vnd.openxmlformats-package.relationships+xml" ) ) ); m_nRelInfoStatus = RELINFO_READ; } @@ -1557,7 +1557,7 @@ void OWriteStream_Impl::CommitStreamRelInfo( const uno::Reference< embed::XStora // set the mediatype uno::Reference< beans::XPropertySet > xPropSet( xRelsStream, uno::UNO_QUERY_THROW ); xPropSet->setPropertyValue("MediaType", - uno::makeAny( OUString("application/vnd.openxmlformats-package.relationships+xml" ) ) ); + uno::Any( OUString("application/vnd.openxmlformats-package.relationships+xml" ) ) ); if ( m_nRelInfoStatus == RELINFO_CHANGED_STREAM ) m_nRelInfoStatus = RELINFO_NO_INIT; @@ -2058,7 +2058,7 @@ uno::Reference< io::XOutputStream > SAL_CALL OWriteStream::getOutputStream() catch( const io::IOException& r ) { throw lang::WrappedTargetRuntimeException("OWriteStream::getOutputStream: Could not create backing temp file", - static_cast < OWeakObject * > ( this ), makeAny ( r ) ); + static_cast < OWeakObject * > ( this ), css::uno::Any ( r ) ); } if ( !m_pImpl ) @@ -2886,7 +2886,7 @@ uno::Any SAL_CALL OWriteStream::getPropertyValue( const OUString& aProp ) if ( aProp == "RelId" ) { - return uno::makeAny( m_pImpl->GetNewRelId() ); + return uno::Any( m_pImpl->GetNewRelId() ); } OUString aPropertyName; @@ -2909,7 +2909,7 @@ uno::Any SAL_CALL OWriteStream::getPropertyValue( const OUString& aProp ) } else if ( m_pData->m_nStorageType == embed::StorageFormats::PACKAGE && aPropertyName == "UseCommonStoragePasswordEncryption" ) - return uno::makeAny( m_pImpl->m_bUseCommonEncryption ); + return uno::Any( m_pImpl->m_bUseCommonEncryption ); else if ( aPropertyName == "Size" ) { bool bThrow = false; @@ -2924,7 +2924,7 @@ uno::Any SAL_CALL OWriteStream::getPropertyValue( const OUString& aProp ) if (bThrow || !m_xSeekable.is()) throw uno::RuntimeException(); - return uno::makeAny( m_xSeekable->getLength() ); + return uno::Any( m_xSeekable->getLength() ); } throw beans::UnknownPropertyException(aPropertyName); // TODO diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 9c8a165d023b..0403f2b0f464 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -390,7 +390,7 @@ void OStorage_Impl::OpenOwnPackage() // do not allow elements to remove themself from the old container in case of insertion to another container pArguments[ 1 ] <<= beans::NamedValue( "AllowRemoveOnInsert", - uno::makeAny( false ) ); + uno::Any( false ) ); sal_Int32 nArgNum = 2; for ( const auto& rProp : std::as_const(m_xProperties) ) @@ -631,8 +631,8 @@ void OStorage_Impl::CopyToStorage( const uno::Reference< embed::XStorage >& xDes // move storage properties to the destination one ( means changeable properties ) if ( m_nStorageType == embed::StorageFormats::PACKAGE ) { - xPropSet->setPropertyValue( "MediaType", uno::makeAny( m_aMediaType ) ); - xPropSet->setPropertyValue( "Version", uno::makeAny( m_aVersion ) ); + xPropSet->setPropertyValue( "MediaType", uno::Any( m_aMediaType ) ); + xPropSet->setPropertyValue( "Version", uno::Any( m_aVersion ) ); } if ( m_nStorageType == embed::StorageFormats::PACKAGE ) @@ -932,7 +932,7 @@ void OStorage_Impl::InsertIntoPackageFolder( const OUString& aName, SAL_WARN_IF( !m_xPackageFolder.is(), "package.xstor", "An inserted storage is incomplete!" ); uno::Reference< lang::XUnoTunnel > xTunnel( m_xPackageFolder, uno::UNO_QUERY_THROW ); - xParentPackageFolder->insertByName( aName, uno::makeAny( xTunnel ) ); + xParentPackageFolder->insertByName( aName, uno::Any( xTunnel ) ); m_bCommited = false; } @@ -1138,8 +1138,8 @@ void OStorage_Impl::Commit() { // move properties to the destination package folder uno::Reference< beans::XPropertySet > xProps( xNewPackageFolder, uno::UNO_QUERY_THROW ); - xProps->setPropertyValue( "MediaType", uno::makeAny( m_aMediaType ) ); - xProps->setPropertyValue( "Version", uno::makeAny( m_aVersion ) ); + xProps->setPropertyValue( "MediaType", uno::Any( m_aMediaType ) ); + xProps->setPropertyValue( "Version", uno::Any( m_aVersion ) ); } if ( m_nStorageType == embed::StorageFormats::OFOPXML ) @@ -1661,7 +1661,7 @@ void OStorage_Impl::CommitRelInfo( const uno::Reference< container::XNameContain // set the mediatype uno::Reference xPropSet(xRelsStream, uno::UNO_QUERY_THROW); xPropSet->setPropertyValue( - "MediaType", uno::makeAny(OUString( + "MediaType", uno::Any(OUString( "application/vnd.openxmlformats-package.relationships+xml"))); m_nRelInfoStatus = RELINFO_READ; @@ -1689,7 +1689,7 @@ void OStorage_Impl::CommitRelInfo( const uno::Reference< container::XNameContain uno::Reference xPropSet(xRelsStream, uno::UNO_QUERY_THROW); xPropSet->setPropertyValue( "MediaType", - uno::makeAny(OUString("application/vnd.openxmlformats-package.relationships+xml"))); + uno::Any(OUString("application/vnd.openxmlformats-package.relationships+xml"))); m_xNewRelInfoStream.clear(); if (m_nRelInfoStatus == RELINFO_CHANGED_STREAM) @@ -4032,7 +4032,7 @@ void SAL_CALL OStorage::removeEncryption() try { xPackPropSet->setPropertyValue( STORAGE_ENCRYPTION_KEYS_PROPERTY, - uno::makeAny( uno::Sequence< beans::NamedValue >() ) ); + uno::Any( uno::Sequence< beans::NamedValue >() ) ); m_pImpl->m_bHasCommonEncryptionData = false; m_pImpl->m_aCommonEncryptionData.clear(); @@ -4094,7 +4094,7 @@ void SAL_CALL OStorage::setEncryptionData( const uno::Sequence< beans::NamedValu { ::comphelper::SequenceAsHashMap aEncryptionMap( aEncryptionData ); xPackPropSet->setPropertyValue( STORAGE_ENCRYPTION_KEYS_PROPERTY, - uno::makeAny( aEncryptionMap.getAsConstNamedValueList() ) ); + uno::Any( aEncryptionMap.getAsConstNamedValueList() ) ); m_pImpl->m_bHasCommonEncryptionData = true; m_pImpl->m_aCommonEncryptionData = aEncryptionMap; @@ -4158,7 +4158,7 @@ void SAL_CALL OStorage::setEncryptionAlgorithms( const uno::Sequence< beans::Nam try { xPackPropSet->setPropertyValue( ENCRYPTION_ALGORITHMS_PROPERTY, - uno::makeAny( aAlgorithms ) ); + uno::Any( aAlgorithms ) ); } catch ( const uno::RuntimeException& ) { @@ -4218,7 +4218,7 @@ void SAL_CALL OStorage::setGpgProperties( const uno::Sequence< uno::Sequence< be try { xPackPropSet->setPropertyValue( ENCRYPTION_GPG_PROPERTIES, - uno::makeAny( aProps ) ); + uno::Any( aProps ) ); } catch ( const uno::RuntimeException& aRuntimeException ) { @@ -4444,19 +4444,19 @@ uno::Any SAL_CALL OStorage::getPropertyValue( const OUString& aPropertyName ) } if ( aPropertyName == "MediaType" ) - return uno::makeAny( m_pImpl->m_aMediaType ); + return uno::Any( m_pImpl->m_aMediaType ); else if ( aPropertyName == "Version" ) - return uno::makeAny( m_pImpl->m_aVersion ); + return uno::Any( m_pImpl->m_aVersion ); else - return uno::makeAny( m_pImpl->m_bMTFallbackUsed ); + return uno::Any( m_pImpl->m_bMTFallbackUsed ); } else if ( aPropertyName == "IsRoot" ) { - return uno::makeAny( m_pImpl->m_bIsRoot ); + return uno::Any( m_pImpl->m_bIsRoot ); } else if ( aPropertyName == "OpenMode" ) { - return uno::makeAny( m_pImpl->m_nStorageMode ); + return uno::Any( m_pImpl->m_nStorageMode ); } else if ( m_pImpl->m_bIsRoot ) { @@ -4469,9 +4469,9 @@ uno::Any SAL_CALL OStorage::getPropertyValue( const OUString& aPropertyName ) return pProp->Value; if ( aPropertyName == "URL" ) - return uno::makeAny( OUString() ); + return uno::Any( OUString() ); - return uno::makeAny( false ); // RepairPackage + return uno::Any( false ); // RepairPackage } else if ( m_pImpl->m_nStorageType == embed::StorageFormats::PACKAGE && ( aPropertyName == HAS_ENCRYPTED_ENTRIES_PROPERTY @@ -5220,7 +5220,7 @@ uno::Any SAL_CALL OStorage::getElementPropertyValue( const OUString& aElementNam throw io::IOException( THROW_WHERE ); // TODO: general_error pElement->m_xStorage->ReadContents(); - return uno::makeAny(pElement->m_xStorage->m_aMediaType); + return uno::Any(pElement->m_xStorage->m_aMediaType); } catch( const embed::InvalidStorageException& ) { diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 36dc397ca0cf..9270bb70502e 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -798,7 +798,7 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName ) if (aName == "/") // root directory. - return makeAny ( uno::Reference < XUnoTunnel > ( m_xRootFolder ) ); + return Any ( uno::Reference < XUnoTunnel > ( m_xRootFolder ) ); nStreamIndex = aName.lastIndexOf ( '/' ); bool bFolder = nStreamIndex == nIndex-1; // last character is '/'. @@ -821,7 +821,7 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName ) sTemp = aName.copy ( nDirIndex == -1 ? 0 : nDirIndex+1, nStreamIndex-nDirIndex-1 ); if (pFolder && sTemp == pFolder->getName()) - return makeAny(uno::Reference(pFolder)); + return Any(uno::Reference(pFolder)); } else { @@ -867,7 +867,7 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName ) { if ( nStreamIndex != -1 ) m_aRecent[sDirName] = pPrevious; // cache it. - return makeAny ( uno::Reference < XUnoTunnel > ( pCurrent ) ); + return Any ( uno::Reference < XUnoTunnel > ( pCurrent ) ); } sTemp = aName.copy( nOldIndex ); @@ -1338,7 +1338,7 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile() embed::UseBackupException aException( aErrTxt, uno::Reference< uno::XInterface >(), OUString() ); throw WrappedTargetException( aErrTxt, static_cast < OWeakObject * > ( this ), - makeAny ( aException ) ); + Any ( aException ) ); } } @@ -1362,7 +1362,7 @@ uno::Reference< XActiveDataStreamer > ZipPackage::openOriginalForOutput() try { Exception aDetect; - Any aAny = aOriginalContent.setPropertyValue("Size", makeAny( sal_Int64(0) ) ); + Any aAny = aOriginalContent.setPropertyValue("Size", Any( sal_Int64(0) ) ); if( !( aAny >>= aDetect ) ) bTruncSuccess = true; } @@ -1385,7 +1385,7 @@ uno::Reference< XActiveDataStreamer > ZipPackage::openOriginalForOutput() aArg.Sink = xSink; aArg.Properties = uno::Sequence< Property >( 0 ); // unused - aOriginalContent.executeCommand("open", makeAny( aArg ) ); + aOriginalContent.executeCommand("open", Any( aArg ) ); } catch( Exception& ) { @@ -1406,7 +1406,7 @@ void SAL_CALL ZipPackage::commitChanges() { IOException aException; throw WrappedTargetException(THROW_WHERE "This package is read only!", - static_cast < OWeakObject * > ( this ), makeAny ( aException ) ); + static_cast < OWeakObject * > ( this ), Any ( aException ) ); } // first the writeTempFile is called, if it returns a stream the stream should be written to the target // if no stream was returned, the file was written directly, nothing should be done @@ -1599,7 +1599,7 @@ void ZipPackage::DisconnectFromTargetAndThrowException_Impl( const uno::Referenc uno::Any aUrl = xTempFile->getPropertyValue("Uri"); aUrl >>= aTempURL; xTempFile->setPropertyValue("RemoveFile", - uno::makeAny( false ) ); + uno::Any( false ) ); } catch ( uno::Exception& ) { @@ -1610,7 +1610,7 @@ void ZipPackage::DisconnectFromTargetAndThrowException_Impl( const uno::Referenc embed::UseBackupException aException( aErrTxt, uno::Reference< uno::XInterface >(), aTempURL ); throw WrappedTargetException( aErrTxt, static_cast < OWeakObject * > ( this ), - makeAny ( aException ) ); + Any ( aException ) ); } uno::Sequence< sal_Int8 > ZipPackage::GetEncryptionKey() diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx index 118ec39923c0..7e7168805f72 100644 --- a/package/source/zippackage/ZipPackageFolder.cxx +++ b/package/source/zippackage/ZipPackageFolder.cxx @@ -203,7 +203,7 @@ ZipContentInfo& ZipPackageFolder::doGetByName( const OUString& aName ) uno::Any SAL_CALL ZipPackageFolder::getByName( const OUString& aName ) { - return uno::makeAny ( doGetByName ( aName ).xTunnel ); + return uno::Any ( doGetByName ( aName ).xTunnel ); } uno::Sequence< OUString > SAL_CALL ZipPackageFolder::getElementNames( ) { @@ -358,12 +358,12 @@ uno::Any SAL_CALL ZipPackageFolder::getPropertyValue( const OUString& PropertyNa // if ( m_nFormat != embed::StorageFormats::PACKAGE ) // throw UnknownPropertyException(THROW_WHERE ); - return uno::makeAny ( msMediaType ); + return uno::Any ( msMediaType ); } else if ( PropertyName == "Version" ) - return uno::makeAny( m_sVersion ); + return uno::Any( m_sVersion ); else if ( PropertyName == "Size" ) - return uno::makeAny ( aEntry.nSize ); + return uno::Any ( aEntry.nSize ); else throw UnknownPropertyException(PropertyName); } diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index f2ec696b5cc8..c4f94806b9b8 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -293,12 +293,12 @@ uno::Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( uno::Reference< XPropertySet > xNewPSProps( xNewPackStream, UNO_QUERY_THROW ); // copy all the properties of this stream to the new stream - xNewPSProps->setPropertyValue("MediaType", makeAny( msMediaType ) ); - xNewPSProps->setPropertyValue("Compressed", makeAny( m_bToBeCompressed ) ); + xNewPSProps->setPropertyValue("MediaType", Any( msMediaType ) ); + xNewPSProps->setPropertyValue("Compressed", Any( m_bToBeCompressed ) ); if ( m_bToBeEncrypted ) { - xNewPSProps->setPropertyValue(ENCRYPTION_KEY_PROPERTY, makeAny( aKey ) ); - xNewPSProps->setPropertyValue("Encrypted", makeAny( true ) ); + xNewPSProps->setPropertyValue(ENCRYPTION_KEY_PROPERTY, Any( aKey ) ); + xNewPSProps->setPropertyValue("Encrypted", Any( true ) ); } // insert a new stream in the package @@ -308,7 +308,7 @@ uno::Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( uno::Reference< container::XNameContainer > xRootNameContainer( xTunnel, UNO_QUERY_THROW ); uno::Reference< XUnoTunnel > xNPSTunnel( xNewPackStream, UNO_QUERY ); - xRootNameContainer->insertByName("dummy", makeAny( xNPSTunnel ) ); + xRootNameContainer->insertByName("dummy", Any( xNPSTunnel ) ); // commit the temporary package pPackage->commitChanges(); diff --git a/package/source/zippackage/zipfileaccess.cxx b/package/source/zippackage/zipfileaccess.cxx index 318943b02a42..d9b17fd80b49 100644 --- a/package/source/zippackage/zipfileaccess.cxx +++ b/package/source/zippackage/zipfileaccess.cxx @@ -292,7 +292,7 @@ uno::Any SAL_CALL OZipFileAccess::getByName( const OUString& aName ) if ( !xEntryStream.is() ) throw uno::RuntimeException(THROW_WHERE ); - return uno::makeAny ( xEntryStream ); + return uno::Any ( xEntryStream ); } uno::Sequence< OUString > SAL_CALL OZipFileAccess::getElementNames() -- cgit