diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-29 08:14:44 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-29 13:22:00 +0200 |
commit | 3412c0f091c54da74ea6964062b9be302e126fe9 (patch) | |
tree | 08c54f59688726f54b235d8f3d818beb462634f5 /dbaccess/source/core | |
parent | 4b2ad350213ececdbb1002b3ada87791dc126b20 (diff) |
Prepare for removal of non-const operator[] from Sequence in dbaccess
Change-Id: Iddb96d39a512ef68827ecf89f3b5650950f88096
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124357
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'dbaccess/source/core')
-rw-r--r-- | dbaccess/source/core/api/FilteredContainer.cxx | 15 | ||||
-rw-r--r-- | dbaccess/source/core/api/KeySet.cxx | 3 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/ContentHelper.cxx | 25 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/ModelImpl.cxx | 9 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/connection.cxx | 5 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/databasedocument.cxx | 23 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/datasource.cxx | 34 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/documentcontainer.cxx | 7 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/documentdefinition.cxx | 16 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/intercept.cxx | 25 | ||||
-rw-r--r-- | dbaccess/source/core/misc/DatabaseDataProvider.cxx | 5 |
11 files changed, 76 insertions, 91 deletions
diff --git a/dbaccess/source/core/api/FilteredContainer.cxx b/dbaccess/source/core/api/FilteredContainer.cxx index 2e383596f12f..70eb85210a80 100644 --- a/dbaccess/source/core/api/FilteredContainer.cxx +++ b/dbaccess/source/core/api/FilteredContainer.cxx @@ -326,8 +326,7 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std:: return; } } - aTableTypeFilter.realloc( 1 ); - aTableTypeFilter[0] = sInherentTableTypeRestriction; + aTableTypeFilter = { sInherentTableTypeRestriction }; } else { @@ -441,19 +440,13 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std:: SAL_WARN("dbaccess", "OTableContainer::getAllTableTypeFilter: unknown TableTypeFilterMode!" ); [[fallthrough]]; case FILTER_MODE_MIX_ALL: - _rFilter.realloc( 3 ); - _rFilter[0] = sView; - _rFilter[1] = sTable; - _rFilter[2] = sAll; + _rFilter = { sView, sTable, sAll }; break; case FILTER_MODE_FIXED: - _rFilter.realloc( 2 ); - _rFilter[0] = sView; - _rFilter[1] = sTable; + _rFilter = { sView, sTable }; break; case FILTER_MODE_WILDCARD: - _rFilter.realloc( 1 ); - _rFilter[0] = sAll; + _rFilter = { sAll }; break; case FILTER_MODE_STANDARD: _rFilter.realloc( 0 ); diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index ffca2cb08662..86b397cbbff2 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -161,10 +161,11 @@ void OKeySet::findTableColumnsMatching_throw( const Any& i_aTable, Reference<XIndexAccess> xQueryParameters = xParaSup->getParameters(); const sal_Int32 nParaCount = xQueryParameters->getCount(); Sequence< OUString> aParameterColumns(nParaCount); + auto aParameterColumnsRange = asNonConstRange(aParameterColumns); for(sal_Int32 i = 0; i< nParaCount;++i) { Reference<XPropertySet> xPara(xQueryParameters->getByIndex(i),UNO_QUERY_THROW); - xPara->getPropertyValue(PROPERTY_REALNAME) >>= aParameterColumns[i]; + xPara->getPropertyValue(PROPERTY_REALNAME) >>= aParameterColumnsRange[i]; } OUString sUpdateTableName( i_rUpdateTableName ); diff --git a/dbaccess/source/core/dataaccess/ContentHelper.cxx b/dbaccess/source/core/dataaccess/ContentHelper.cxx index 1035a2e6260a..32c89c877f39 100644 --- a/dbaccess/source/core/dataaccess/ContentHelper.cxx +++ b/dbaccess/source/core/dataaccess/ContentHelper.cxx @@ -332,6 +332,7 @@ Sequence< Any > OContentHelper::setPropertyValues(const Sequence< PropertyValue osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex ); Sequence< Any > aRet( rValues.getLength() ); + auto aRetRange = asNonConstRange(aRet); Sequence< PropertyChangeEvent > aChanges( rValues.getLength() ); sal_Int32 nChanged = 0; @@ -350,7 +351,7 @@ Sequence< Any > OContentHelper::setPropertyValues(const Sequence< PropertyValue if ( rValue.Name == "ContentType" || rValue.Name == "IsDocument" || rValue.Name == "IsFolder" ) { // Read-only property! - aRet[ n ] <<= IllegalAccessException("Property is read-only!", + aRetRange[ n ] <<= IllegalAccessException("Property is read-only!", static_cast< cppu::OWeakObject * >( this ) ); } else if ( rValue.Name == "Title" ) @@ -384,14 +385,14 @@ Sequence< Any > OContentHelper::setPropertyValues(const Sequence< PropertyValue } else { - aRet[ n ] <<= IllegalTypeException("Property value has wrong type!", + aRetRange[ n ] <<= IllegalTypeException("Property value has wrong type!", static_cast< cppu::OWeakObject * >( this ) ); } } else { - aRet[ n ] <<= Exception("No property set for storing the value!", + aRetRange[ n ] <<= Exception("No property set for storing the value!", static_cast< cppu::OWeakObject * >( this ) ); } } @@ -525,7 +526,7 @@ void OContentHelper::notifyPropertiesChange( const Sequence< PropertyChangeEvent else propertyEvents = &(*it).second; - (*propertyEvents)[n] = rEvent; + propertyEvents->getArray()[n] = rEvent; } } } @@ -566,14 +567,14 @@ void OContentHelper::impl_rename_throw(const OUString& _sNewName,bool _bNotify ) return; try { - Sequence< PropertyChangeEvent > aChanges( 1 ); - - aChanges[0].Source = static_cast< cppu::OWeakObject * >( this ); - aChanges[0].Further = false; - aChanges[0].PropertyName = PROPERTY_NAME; - aChanges[0].PropertyHandle = PROPERTY_ID_NAME; - aChanges[0].OldValue <<= m_pImpl->m_aProps.aTitle; - aChanges[0].NewValue <<= _sNewName; + Sequence<PropertyChangeEvent> aChanges{ + { /* Source */ static_cast<cppu::OWeakObject*>(this), + /* PropertyName */ PROPERTY_NAME, + /* Further */ false, + /* PropertyHandle */ PROPERTY_ID_NAME, + /* OldValue */ Any(m_pImpl->m_aProps.aTitle), + /* NewValue */ Any(_sNewName) } + }; aGuard.clear(); diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx index c7a7238f3f97..49a74717e559 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.cxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx @@ -374,8 +374,7 @@ ODatabaseModelImpl::ODatabaseModelImpl( const Reference< XComponentContext >& _r { // some kind of default m_sConnectURL = "jdbc:"; - m_aTableFilter.realloc(1); - m_aTableFilter[0] = "%"; + m_aTableFilter = { "%" }; impl_construct_nothrow(); } @@ -766,9 +765,7 @@ Reference< XStorage > const & ODatabaseModelImpl::getOrCreateRootStorage() if ( aSource.hasValue() ) { - Sequence< Any > aStorageCreationArgs(2); - aStorageCreationArgs[0] = aSource; - aStorageCreationArgs[1] <<= ElementModes::READWRITE; + Sequence< Any > aStorageCreationArgs{ aSource, Any(ElementModes::READWRITE) }; Reference< XStorage > xDocumentStorage; OUString sURL; @@ -783,7 +780,7 @@ Reference< XStorage > const & ODatabaseModelImpl::getOrCreateRootStorage() catch( const Exception& ) { m_bDocumentReadOnly = true; - aStorageCreationArgs[1] <<= ElementModes::READ; + aStorageCreationArgs.getArray()[1] <<= ElementModes::READ; try { xDocumentStorage.set( xStorageFactory->createInstanceWithArguments( aStorageCreationArgs ), UNO_QUERY_THROW ); diff --git a/dbaccess/source/core/dataaccess/connection.cxx b/dbaccess/source/core/dataaccess/connection.cxx index 15054023170e..0da533536a9d 100644 --- a/dbaccess/source/core/dataaccess/connection.cxx +++ b/dbaccess/source/core/dataaccess/connection.cxx @@ -86,7 +86,7 @@ Sequence< OUString > OConnection::getSupportedServiceNames( ) { sal_Int32 nLen = aSupported.getLength(); aSupported.realloc( nLen + 1 ); - aSupported[ nLen ] = SERVICE_SDB_CONNECTION; + aSupported.getArray()[ nLen ] = SERVICE_SDB_CONNECTION; } return aSupported; @@ -628,9 +628,8 @@ Reference< XInterface > SAL_CALL OConnection::createInstance( const OUString& _s TSupportServices::const_iterator aFind = m_aSupportServices.find(_sServiceSpecifier); if ( aFind == m_aSupportServices.end() ) { - Sequence<Any> aArgs(1); Reference<XConnection> xMy(this); - aArgs[0] <<= NamedValue("ActiveConnection",makeAny(xMy)); + Sequence<Any> aArgs{ Any(NamedValue("ActiveConnection",makeAny(xMy))) }; aFind = m_aSupportServices.emplace( _sServiceSpecifier, m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext(_sServiceSpecifier, aArgs, m_aContext) diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index c38dc9429cfc..45867c0e3bac 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -278,7 +278,7 @@ namespace sal_Int32 nLength = _rCallArgs.getLength(); _rCallArgs.realloc( nLength + 1 ); - _rCallArgs[ nLength ] <<= xStatusIndicator; + _rCallArgs.getArray()[ nLength ] <<= xStatusIndicator; } void lcl_extractAndStartStatusIndicator( const ::comphelper::NamedValueCollection& _rArguments, Reference< XStatusIndicator >& _rxStatusIndicator, @@ -294,7 +294,7 @@ namespace sal_Int32 nLength = _rCallArgs.getLength(); _rCallArgs.realloc( nLength + 1 ); - _rCallArgs[ nLength ] <<= _rxStatusIndicator; + _rCallArgs.getArray()[ nLength ] <<= _rxStatusIndicator; } catch( const Exception& ) { @@ -455,7 +455,7 @@ void ODatabaseDocument::impl_import_nolck_throw( const Reference< XComponentCont const sal_Int32 nCount = aFilterCreationArgs.getLength(); aFilterCreationArgs.realloc(nCount + 1); - aFilterCreationArgs[nCount] <<= xInfoSet; + aFilterCreationArgs.getArray()[nCount] <<= xInfoSet; Reference< XImporter > xImporter( _rContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.comp.sdb.DBFilter", aFilterCreationArgs, _rContext), @@ -1121,9 +1121,7 @@ Reference< XStorage > ODatabaseDocument::impl_createStorageFor_throw( const OUSt { xTruncate->truncate(); } - Sequence<Any> aParam(2); - aParam[0] <<= xStream; - aParam[1] <<= ElementModes::READWRITE | ElementModes::TRUNCATE; + Sequence<Any> aParam{ Any(xStream), Any(ElementModes::READWRITE | ElementModes::TRUNCATE) }; Reference< XSingleServiceFactory > xStorageFactory( m_pImpl->createStorageFactory(), UNO_SET_THROW ); return Reference< XStorage >( xStorageFactory->createInstanceWithArguments( aParam ), UNO_QUERY_THROW ); @@ -1422,8 +1420,7 @@ Reference< XNameAccess > ODatabaseDocument::impl_getDocumentContainer_throw( ODa aValue >>= sSupportService; if ( !sSupportService.isEmpty() ) { - Sequence<Any> aArgs(1); - aArgs[0] <<= NamedValue("DatabaseDocument",makeAny(xMy)); + Sequence<Any> aArgs{ Any(NamedValue("DatabaseDocument",makeAny(xMy))) }; xContainer.set( m_pImpl->m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext(sSupportService, aArgs, m_pImpl->m_aContext), UNO_QUERY); @@ -1597,9 +1594,10 @@ void ODatabaseDocument::WriteThroughComponent( const Reference< XOutputStream >& // prepare arguments (prepend doc handler to given arguments) Sequence<Any> aArgs( 1 + _rArguments.getLength() ); - aArgs[0] <<= xSaxWriter; + auto pArgs = aArgs.getArray(); + pArgs[0] <<= xSaxWriter; for ( sal_Int32 i = 0; i < _rArguments.getLength(); ++i ) - aArgs[ i+1 ] = _rArguments[i]; + pArgs[ i+1 ] = _rArguments[i]; // get filter component Reference< XExporter > xExporter( m_pImpl->m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext(OUString::createFromAscii(pServiceName), aArgs, m_pImpl->m_aContext), UNO_QUERY_THROW ); @@ -1648,7 +1646,7 @@ void ODatabaseDocument::impl_writeStorage_throw( const Reference< XStorage >& _r sal_Int32 nArgsLen = aDelegatorArguments.getLength(); aDelegatorArguments.realloc(nArgsLen+1); - aDelegatorArguments[nArgsLen++] <<= xInfoSet; + aDelegatorArguments.getArray()[nArgsLen++] <<= xInfoSet; Reference< XPropertySet > xProp( _rxTargetStorage, UNO_QUERY_THROW ); xProp->setPropertyValue( INFO_MEDIATYPE, makeAny( OUString(MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII) ) ); @@ -1917,8 +1915,7 @@ void SAL_CALL ODatabaseDocument::loadFromStorage(const Reference<XStorage>& xSto xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("content.xml"))); xInfoSet->setPropertyValue("SourceStorage", uno::makeAny(xStorage)); - uno::Sequence<uno::Any> aFilterCreationArgs(1); - aFilterCreationArgs[0] <<= xInfoSet; + uno::Sequence<uno::Any> aFilterCreationArgs{ Any(xInfoSet) }; uno::Reference<document::XImporter> xImporter(m_pImpl->m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.comp.sdb.DBFilter", aFilterCreationArgs, m_pImpl->m_aContext), uno::UNO_QUERY_THROW); diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx index b36ac6ea67b6..5239e19b8bc4 100644 --- a/dbaccess/source/core/dataaccess/datasource.cxx +++ b/dbaccess/source/core/dataaccess/datasource.cxx @@ -349,10 +349,11 @@ Reference<XConnection> OSharedConnectionManager::getConnection( const OUString& Sequence< PropertyValue > aInfoCopy(_aInfo); sal_Int32 nPos = aInfoCopy.getLength(); aInfoCopy.realloc( nPos + 2 ); - aInfoCopy[nPos].Name = "TableFilter"; - aInfoCopy[nPos++].Value <<= _pDataSource->m_pImpl->m_aTableFilter; - aInfoCopy[nPos].Name = "TableTypeFilter"; - aInfoCopy[nPos++].Value <<= _pDataSource->m_pImpl->m_aTableTypeFilter; + auto pInfoCopy = aInfoCopy.getArray(); + pInfoCopy[nPos].Name = "TableFilter"; + pInfoCopy[nPos++].Value <<= _pDataSource->m_pImpl->m_aTableFilter; + pInfoCopy[nPos].Name = "TableTypeFilter"; + pInfoCopy[nPos++].Value <<= _pDataSource->m_pImpl->m_aTableTypeFilter; OUString sUser = user; OUString sPassword = password; @@ -684,17 +685,18 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString if (!sPwd.isEmpty()) ++nAdditionalArgs; Sequence< PropertyValue > aUserPwd(nAdditionalArgs); + auto aUserPwdRange = asNonConstRange(aUserPwd); sal_Int32 nArgPos = 0; if (!sUser.isEmpty()) { - aUserPwd[ nArgPos ].Name = "user"; - aUserPwd[ nArgPos ].Value <<= sUser; + aUserPwdRange[ nArgPos ].Name = "user"; + aUserPwdRange[ nArgPos ].Value <<= sUser; ++nArgPos; } if (!sPwd.isEmpty()) { - aUserPwd[ nArgPos ].Name = "password"; - aUserPwd[ nArgPos ].Value <<= sPwd; + aUserPwdRange[ nArgPos ].Name = "password"; + aUserPwdRange[ nArgPos ].Value <<= sPwd; } Reference< XDriver > xDriver; try @@ -729,16 +731,17 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString { sal_Int32 nCount = aDriverInfo.getLength(); aDriverInfo.realloc(nCount + 3 ); + auto pDriverInfo = aDriverInfo.getArray(); - aDriverInfo[nCount].Name = "URL"; - aDriverInfo[nCount++].Value <<= m_pImpl->getURL(); + pDriverInfo[nCount].Name = "URL"; + pDriverInfo[nCount++].Value <<= m_pImpl->getURL(); - aDriverInfo[nCount].Name = "Storage"; + pDriverInfo[nCount].Name = "Storage"; Reference< css::document::XDocumentSubStorageSupplier> xDocSup( m_pImpl->getDocumentSubStorageSupplier() ); - aDriverInfo[nCount++].Value <<= xDocSup->getDocumentSubStorage("database",ElementModes::READWRITE); + pDriverInfo[nCount++].Value <<= xDocSup->getDocumentSubStorage("database",ElementModes::READWRITE); - aDriverInfo[nCount].Name = "Document"; - aDriverInfo[nCount++].Value <<= getDatabaseDocument(); + pDriverInfo[nCount].Name = "Document"; + pDriverInfo[nCount++].Value <<= getDatabaseDocument(); } if (nAdditionalArgs) xReturn = xManager->getConnectionWithInfo(m_pImpl->m_sConnectURL, ::comphelper::concatSequences(aUserPwd,aDriverInfo)); @@ -1271,8 +1274,7 @@ Reference< XNameAccess > SAL_CALL ODatabaseSource::getQueryDefinitions( ) aValue >>= sSupportService; if ( !sSupportService.isEmpty() ) { - Sequence<Any> aArgs(1); - aArgs[0] <<= NamedValue("DataSource",makeAny(xMy)); + Sequence<Any> aArgs{ Any(NamedValue("DataSource",makeAny(xMy))) }; xContainer.set( m_pImpl->m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext(sSupportService, aArgs, m_pImpl->m_aContext), UNO_QUERY); } } diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx index cfd552b36d7e..07c669e70fd9 100644 --- a/dbaccess/source/core/dataaccess/documentcontainer.cxx +++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx @@ -218,9 +218,7 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments const bool bNeedClassID = !aClassID.hasElements() && sURL.isEmpty() ; if ( xCopyFrom.is() ) { - Sequence<Any> aIni(2); - aIni[0] <<= getContainerStorage(); - aIni[1] <<= sPersistentName; + Sequence<Any> aIni{ Any(getContainerStorage()), Any(sPersistentName) }; Command aCommand; aCommand.Name = "copyTo"; aCommand.Argument <<= aIni; @@ -279,8 +277,7 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments if ( !sURL.isEmpty() ) { - Sequence<Any> aIni(2); - aIni[0] <<= sURL; + Sequence<Any> aIni{ Any(sURL) }; Command aCommand; aCommand.Name = "insert"; aCommand.Argument <<= aIni; diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index ad20bb0bb616..9a2944bb338d 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -27,6 +27,7 @@ #include <comphelper/namedvaluecollection.hxx> #include <comphelper/classids.hxx> #include <comphelper/propertysequence.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/types.hxx> #include <com/sun/star/frame/XUntitledNumbers.hpp> #include <com/sun/star/awt/Size.hpp> @@ -526,11 +527,10 @@ IPropertyArrayHelper* ODocumentDefinition::createArrayHelper( ) const describeProperties( aProps ); // properties not maintained by our base class - Sequence< Property > aManualProps( 1 ); - aManualProps[0].Name = PROPERTY_PERSISTENT_PATH; - aManualProps[0].Handle = PROPERTY_ID_PERSISTENT_PATH; - aManualProps[0].Type = ::cppu::UnoType<OUString>::get(); - aManualProps[0].Attributes = PropertyAttribute::READONLY; + Sequence< Property > aManualProps{ { /* Name */ PROPERTY_PERSISTENT_PATH, + /* Handle */ PROPERTY_ID_PERSISTENT_PATH, + /* Type */ ::cppu::UnoType<OUString>::get(), + /* Attributes */ PropertyAttribute::READONLY } }; return new OPropertyArrayHelper( ::comphelper::concatSequences( aProps, aManualProps ) ); } @@ -1165,9 +1165,9 @@ void ODocumentDefinition::onCommandInsert( const OUString& _sURL, const Referenc if ( xStorage.is() ) { Reference< XEmbeddedObjectCreator> xEmbedFactory = EmbeddedObjectCreator::create(m_aContext); - Sequence<PropertyValue> aEmpty,aMediaDesc(1); - aMediaDesc[0].Name = PROPERTY_URL; - aMediaDesc[0].Value <<= _sURL; + Sequence<PropertyValue> aEmpty; + Sequence<PropertyValue> aMediaDesc{ comphelper::makePropertyValue(PROPERTY_URL, + _sURL) }; m_xEmbeddedObject.set(xEmbedFactory->createInstanceInitFromMediaDescriptor( xStorage ,m_pImpl->m_aProps.sPersistentName ,aMediaDesc diff --git a/dbaccess/source/core/dataaccess/intercept.cxx b/dbaccess/source/core/dataaccess/intercept.cxx index 3b42df4ed6a1..3e7f309976f9 100644 --- a/dbaccess/source/core/dataaccess/intercept.cxx +++ b/dbaccess/source/core/dataaccess/intercept.cxx @@ -65,17 +65,14 @@ void OInterceptor::dispose() OInterceptor::OInterceptor( ODocumentDefinition* _pContentHolder ) :m_pContentHolder( _pContentHolder ) - ,m_aInterceptedURL(7) + ,m_aInterceptedURL{ /* DISPATCH_SAVEAS */ ".uno:SaveAs", + /* DISPATCH_SAVE */ ".uno:Save", + /* DISPATCH_CLOSEDOC */ ".uno:CloseDoc", + /* DISPATCH_CLOSEWIN */ ".uno:CloseWin", + /* DISPATCH_CLOSEFRAME */ ".uno:CloseFrame", + /* DISPATCH_RELOAD */ ".uno:Reload" } { - OSL_ENSURE(DISPATCH_RELOAD < m_aInterceptedURL.getLength(),"Illegal size."); - - m_aInterceptedURL[DISPATCH_SAVEAS] = ".uno:SaveAs"; - m_aInterceptedURL[DISPATCH_SAVE] = ".uno:Save"; - m_aInterceptedURL[DISPATCH_CLOSEDOC] = ".uno:CloseDoc"; - m_aInterceptedURL[DISPATCH_CLOSEWIN] = ".uno:CloseWin"; - m_aInterceptedURL[DISPATCH_CLOSEFRAME] = ".uno:CloseFrame"; - m_aInterceptedURL[DISPATCH_RELOAD] = ".uno:Reload"; } @@ -131,7 +128,7 @@ void SAL_CALL OInterceptor::dispatch( const URL& URL,const Sequence<PropertyValu { if ( aNewArgs[nInd].Name == "SaveTo" ) { - aNewArgs[nInd].Value <<= true; + aNewArgs.getArray()[nInd].Value <<= true; break; } nInd++; @@ -140,8 +137,9 @@ void SAL_CALL OInterceptor::dispatch( const URL& URL,const Sequence<PropertyValu if ( nInd == aNewArgs.getLength() ) { aNewArgs.realloc( nInd + 1 ); - aNewArgs[nInd].Name = "SaveTo"; - aNewArgs[nInd].Value <<= true; + auto pNewArgs = aNewArgs.getArray(); + pNewArgs[nInd].Name = "SaveTo"; + pNewArgs[nInd].Value <<= true; } Reference< XDispatch > xDispatch = m_xSlaveDispatchProvider->queryDispatch(URL, "_self", 0 ); @@ -311,6 +309,7 @@ Sequence< Reference< XDispatch > > SAL_CALL OInterceptor::queryDispatches( cons aRet = m_xSlaveDispatchProvider->queryDispatches(Requests); else aRet.realloc(Requests.getLength()); + auto aRetRange = asNonConstRange(aRet); for(sal_Int32 i = 0; i < Requests.getLength(); ++i) { @@ -320,7 +319,7 @@ Sequence< Reference< XDispatch > > SAL_CALL OInterceptor::queryDispatches( cons { if ( Requests[i].FeatureURL.Complete == *pIter ) { - aRet[i] = static_cast<XDispatch*>(this); + aRetRange[i] = static_cast<XDispatch*>(this); break; } } diff --git a/dbaccess/source/core/misc/DatabaseDataProvider.cxx b/dbaccess/source/core/misc/DatabaseDataProvider.cxx index 3517a437e10a..9b455c5ae452 100644 --- a/dbaccess/source/core/misc/DatabaseDataProvider.cxx +++ b/dbaccess/source/core/misc/DatabaseDataProvider.cxx @@ -202,9 +202,8 @@ uno::Reference< chart2::data::XDataSource > SAL_CALL DatabaseDataProvider::creat uno::Reference< lang::XInitialization> xIni(m_xInternal,uno::UNO_QUERY); if ( xIni.is() ) { - uno::Sequence< uno::Any > aInitArgs(1); beans::NamedValue aParam("CreateDefaultData",uno::makeAny(true)); - aInitArgs[0] <<= aParam; + uno::Sequence< uno::Any > aInitArgs{ uno::Any(aParam) }; xIni->initialize(aInitArgs); } } @@ -660,7 +659,7 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(bool _bHasCategor { const sal_Int32 nAssumedRowSetColumnIndex = _bHasCategories ? 1 : 0; if ( nAssumedRowSetColumnIndex < aRowSetColumnNames.getLength() ) - aImposedColumnNames[0] = aRowSetColumnNames[ nAssumedRowSetColumnIndex ]; + aImposedColumnNames.getArray()[0] = aRowSetColumnNames[ nAssumedRowSetColumnIndex ]; } const sal_Int32 nCount = aImposedColumnNames.getLength(); |