diff options
23 files changed, 136 insertions, 220 deletions
diff --git a/desktop/source/deployment/manager/dp_commandenvironments.cxx b/desktop/source/deployment/manager/dp_commandenvironments.cxx index 2b98ff971908..4a0a88f42432 100644 --- a/desktop/source/deployment/manager/dp_commandenvironments.cxx +++ b/desktop/source/deployment/manager/dp_commandenvironments.cxx @@ -82,21 +82,14 @@ void BaseCommandEnv::handle_(bool approve, else { // select: - uno::Sequence< Reference< task::XInteractionContinuation > > conts( - xRequest->getContinuations() ); - Reference< task::XInteractionContinuation > const * pConts = - conts.getConstArray(); - sal_Int32 len = conts.getLength(); - for ( sal_Int32 pos = 0; pos < len; ++pos ) + for (auto& xContinuation : xRequest->getContinuations()) { - if (approve) { - Reference< task::XInteractionApprove > xInteractionApprove( - pConts[ pos ], uno::UNO_QUERY ); - if (xInteractionApprove.is()) { - xInteractionApprove->select(); - // don't query again for ongoing continuations: - approve = false; - } + Reference<task::XInteractionApprove> xInteractionApprove(xContinuation, uno::UNO_QUERY); + if (xInteractionApprove.is()) + { + xInteractionApprove->select(); + // don't query again for ongoing continuations: + break; } } } diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx index 7a692ec8c6c5..7efa1ba854e6 100644 --- a/desktop/source/deployment/registry/component/dp_component.cxx +++ b/desktop/source/deployment/registry/component/dp_component.cxx @@ -1279,13 +1279,11 @@ BackendImpl::ComponentPackageImpl::isRegistered_( Sequence<OUString> implNames; if (xImplKey.is() && xImplKey->isValid()) implNames = xImplKey->getKeyNames(); - OUString const * pImplNames = implNames.getConstArray(); sal_Int32 pos = implNames.getLength(); for ( ; pos--; ) { checkAborted( abortChannel ); - const OUString key( - pImplNames[ pos ] + "/UNO/LOCATION" ); + const OUString key(implNames[pos] + "/UNO/LOCATION"); const Reference<registry::XRegistryKey> xKey( xRootKey->openKey(key) ); if (xKey.is() && xKey->isValid()) diff --git a/extensions/source/abpilot/datasourcehandling.cxx b/extensions/source/abpilot/datasourcehandling.cxx index fd5820fce1ee..c26066b8daaa 100644 --- a/extensions/source/abpilot/datasourcehandling.cxx +++ b/extensions/source/abpilot/datasourcehandling.cxx @@ -199,12 +199,8 @@ namespace abp m_pImpl->xContext.set( lcl_getDataSourceContext( _rxORB ), UNO_QUERY_THROW ); // collect the data source names - Sequence< OUString > aDSNames = m_pImpl->xContext->getElementNames(); - const OUString* pDSNames = aDSNames.getConstArray(); - const OUString* pDSNamesEnd = pDSNames + aDSNames.getLength(); - - for ( ;pDSNames != pDSNamesEnd; ++pDSNames ) - m_pImpl->aDataSourceNames.insert( *pDSNames ); + for (auto& rDSName : m_pImpl->xContext->getElementNames()) + m_pImpl->aDataSourceNames.insert(rDSName); } catch( const Exception& ) { @@ -487,10 +483,8 @@ namespace abp aTableNames = xTables->getElementNames( ); // copy the names - const OUString* pTableNames = aTableNames.getConstArray(); - const OUString* pTableNamesEnd = pTableNames + aTableNames.getLength(); - for (;pTableNames < pTableNamesEnd; ++pTableNames) - m_pImpl->aTables.insert( *pTableNames ); + for (auto& rTableName : aTableNames) + m_pImpl->aTables.insert(rTableName); } catch(const Exception&) { diff --git a/extensions/source/abpilot/fieldmappingimpl.cxx b/extensions/source/abpilot/fieldmappingimpl.cxx index b8e8ac56686c..3b54e7504f1d 100644 --- a/extensions/source/abpilot/fieldmappingimpl.cxx +++ b/extensions/source/abpilot/fieldmappingimpl.cxx @@ -90,10 +90,8 @@ namespace abp DBG_ASSERT( bSuccess, "fieldmapping::invokeDialog: invalid property type for FieldMapping!" ); // and copy it into the map - const AliasProgrammaticPair* pMapping = aMapping.getConstArray(); - const AliasProgrammaticPair* pMappingEnd = pMapping + aMapping.getLength(); - for (;pMapping != pMappingEnd; ++pMapping) - _rSettings.aFieldMapping[ pMapping->ProgrammaticName ] = pMapping->Alias; + for (auto& rMapping : aMapping) + _rSettings.aFieldMapping[rMapping.ProgrammaticName] = rMapping.Alias; return true; } @@ -214,37 +212,33 @@ namespace abp OConfigurationNode aFields = aAddressBookSettings.openNode( OUString( "Fields" ) ); // loop through all existent fields - Sequence< OUString > aExistentFields = aFields.getNodeNames(); - const OUString* pExistentFields = aExistentFields.getConstArray(); - const OUString* pExistentFieldsEnd = pExistentFields + aExistentFields.getLength(); - static constexpr OUString sProgrammaticNodeName( u"ProgrammaticFieldName"_ustr ); static constexpr OUString sAssignedNodeName( u"AssignedFieldName"_ustr ); - for ( ; pExistentFields != pExistentFieldsEnd; ++pExistentFields ) + for (auto& rExistentField : aFields.getNodeNames()) { SAL_WARN_IF( - ((aFields.openNode(*pExistentFields) + ((aFields.openNode(rExistentField) .getNodeValue(sProgrammaticNodeName).get<OUString>()) - != *pExistentFields), + != rExistentField), "extensions.abpilot", "fieldmapping::writeTemplateAddressFieldMapping: inconsistent config data!"); // there should be a redundancy in the config data... if this asserts, there isn't anymore! // do we have a new alias for the programmatic? - MapString2String::iterator aPos = aFieldAssignment.find( *pExistentFields ); + MapString2String::iterator aPos = aFieldAssignment.find(rExistentField); if ( aFieldAssignment.end() != aPos ) { // yes // -> set a new value - OConfigurationNode aExistentField = aFields.openNode( *pExistentFields ); + OConfigurationNode aExistentField = aFields.openNode(rExistentField); aExistentField.setNodeValue( sAssignedNodeName, Any( aPos->second ) ); // and remove the mapping entry - aFieldAssignment.erase( *pExistentFields ); + aFieldAssignment.erase(rExistentField); } else { // no // -> remove it - aFields.removeNode( *pExistentFields ); + aFields.removeNode(rExistentField); } } diff --git a/extensions/source/bibliography/bibconfig.cxx b/extensions/source/bibliography/bibconfig.cxx index 11ba8999a62c..746e136c25f3 100644 --- a/extensions/source/bibliography/bibconfig.cxx +++ b/extensions/source/bibliography/bibconfig.cxx @@ -95,24 +95,23 @@ BibConfig::BibConfig() const Sequence< OUString > aPropertyNames = GetPropertyNames(); const Sequence<Any> aPropertyValues = GetProperties( aPropertyNames ); - const Any* pValues = aPropertyValues.getConstArray(); if(aPropertyValues.getLength() == aPropertyNames.getLength()) { for(int nProp = 0; nProp < aPropertyNames.getLength(); nProp++) { - if(pValues[nProp].hasValue()) + if (aPropertyValues[nProp].hasValue()) { switch(nProp) { - case 0: pValues[nProp] >>= sDataSource; break; - case 1: pValues[nProp] >>= sTableOrQuery; break; - case 2: pValues[nProp] >>= nTblOrQuery; break; - case 3: pValues[nProp] >>= nBeamerSize; break; - case 4: pValues[nProp] >>= nViewSize ; break; - case 5: pValues[nProp] >>= sQueryText ; break; - case 6: pValues[nProp] >>= sQueryField; break; + case 0: aPropertyValues[nProp] >>= sDataSource; break; + case 1: aPropertyValues[nProp] >>= sTableOrQuery; break; + case 2: aPropertyValues[nProp] >>= nTblOrQuery; break; + case 3: aPropertyValues[nProp] >>= nBeamerSize; break; + case 4: aPropertyValues[nProp] >>= nViewSize ; break; + case 5: aPropertyValues[nProp] >>= sQueryText ; break; + case 6: aPropertyValues[nProp] >>= sQueryField; break; case 7: - bShowColumnAssignmentWarning = *o3tl::doAccess<bool>(pValues[nProp]); + bShowColumnAssignmentWarning = *o3tl::doAccess<bool>(aPropertyValues[nProp]); break; } } @@ -130,14 +129,13 @@ BibConfig::BibConfig() pHistoryNames[2] = sPrefix + "CommandType"; Sequence<Any> aHistoryValues = GetProperties( aHistoryNames ); - const Any* pHistoryValues = aHistoryValues.getConstArray(); if(aHistoryValues.getLength() == aHistoryNames.getLength()) { Mapping* pMapping = new Mapping; - pHistoryValues[0] >>= pMapping->sURL; - pHistoryValues[1] >>= pMapping->sTableName; - pHistoryValues[2] >>= pMapping->nCommandType; + aHistoryValues[0] >>= pMapping->sURL; + aHistoryValues[1] >>= pMapping->sTableName; + aHistoryValues[2] >>= pMapping->nCommandType; //field assignment is contained in another set sPrefix += "Fields"; const Sequence< OUString > aAssignmentNodeNames = GetNodeNames(sPrefix); @@ -153,15 +151,14 @@ BibConfig::BibConfig() pAssignmentPropertyNames[nFieldIdx++] += "/AssignedFieldName"; } Sequence<Any> aAssignmentValues = GetProperties(aAssignmentPropertyNames); - const Any* pAssignmentValues = aAssignmentValues.getConstArray(); OUString sTempLogical; OUString sTempReal; sal_Int16 nSetMapping = 0; nFieldIdx = 0; for(sal_Int32 nFieldVal = 0; nFieldVal < aAssignmentValues.getLength() / 2; nFieldVal++) { - pAssignmentValues[nFieldIdx++] >>= sTempLogical; - pAssignmentValues[nFieldIdx++] >>= sTempReal; + aAssignmentValues[nFieldIdx++] >>= sTempLogical; + aAssignmentValues[nFieldIdx++] >>= sTempReal; if(!(sTempLogical.isEmpty() || sTempReal.isEmpty())) { pMapping->aColumnPairs[nSetMapping].sLogicalColumnName = sTempLogical; diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx index c8d88d8d0160..755b43d8defa 100644 --- a/extensions/source/bibliography/bibload.cxx +++ b/extensions/source/bibliography/bibload.cxx @@ -207,7 +207,7 @@ void BibliographyLoader::loadView(const Reference< XFrame > & rFrame, DBChangeDialogConfig_Impl aConfig; const Sequence<OUString> aSources = aConfig.GetDataSourceNames(); if(aSources.hasElements()) - aBibDesc.sDataSource = aSources.getConstArray()[0]; + aBibDesc.sDataSource = aSources[0]; } m_xDatMan->createDatabaseForm( aBibDesc ); diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx index a15a3e889c18..407645c1df89 100644 --- a/extensions/source/bibliography/datman.cxx +++ b/extensions/source/bibliography/datman.cxx @@ -948,48 +948,42 @@ void BibDataManager::setActiveDataTable(const OUString& rTable) Reference< XConnection > xConnection = getConnection( m_xForm ); Reference< XTablesSupplier > xSupplyTables(xConnection, UNO_QUERY); Reference< XNameAccess > xAccess = xSupplyTables->getTables(); - Sequence< OUString > aTableNameSeq = xAccess->getElementNames(); - sal_uInt32 nCount = aTableNameSeq.getLength(); - const OUString* pTableNames = aTableNameSeq.getConstArray(); - const OUString* pTableNamesEnd = pTableNames + nCount; - - for ( ; pTableNames != pTableNamesEnd; ++pTableNames ) + for (auto& rTableName: xAccess->getElementNames()) { - if ( rTable == *pTableNames ) + if (rTable == rTableName) { aActiveDataTable = rTable; Any aVal; aVal <<= rTable; aPropertySet->setPropertyValue( "Command", aVal ); - break; - } - } - if (pTableNames != pTableNamesEnd) - { - Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData(); - aQuoteChar = xMetaData->getIdentifierQuoteString(); - Reference< XMultiServiceFactory > xFactory(xConnection, UNO_QUERY); - if ( xFactory.is() ) - m_xParser.set( xFactory->createInstance("com.sun.star.sdb.SingleSelectQueryComposer"), UNO_QUERY ); + Reference<XDatabaseMetaData> xMetaData = xConnection->getMetaData(); + aQuoteChar = xMetaData->getIdentifierQuoteString(); - OUString aString("SELECT * FROM "); + Reference<XMultiServiceFactory> xFactory(xConnection, UNO_QUERY); + if (xFactory.is()) + m_xParser.set( xFactory->createInstance("com.sun.star.sdb.SingleSelectQueryComposer"), UNO_QUERY ); - OUString sCatalog, sSchema, sName; - ::dbtools::qualifiedNameComponents( xMetaData, aActiveDataTable, sCatalog, sSchema, sName, ::dbtools::EComposeRule::InDataManipulation ); - aString += ::dbtools::composeTableNameForSelect( xConnection, sCatalog, sSchema, sName ); + OUString aString("SELECT * FROM "); - m_xParser->setElementaryQuery(aString); + OUString sCatalog, sSchema, sName; + ::dbtools::qualifiedNameComponents( xMetaData, aActiveDataTable, sCatalog, sSchema, sName, ::dbtools::EComposeRule::InDataManipulation ); + aString += ::dbtools::composeTableNameForSelect( xConnection, sCatalog, sSchema, sName ); - BibConfig* pConfig = BibModul::GetConfig(); - pConfig->setQueryField(getQueryField()); - startQueryWith(pConfig->getQueryText()); + m_xParser->setElementaryQuery(aString); + + BibConfig* pConfig = BibModul::GetConfig(); + pConfig->setQueryField(getQueryField()); + startQueryWith(pConfig->getQueryText()); + + BibDBDescriptor aDesc; + aDesc.sDataSource = aDataSourceURL; + aDesc.sTableOrQuery = aActiveDataTable; + aDesc.nCommandType = CommandType::TABLE; + BibModul::GetConfig()->SetBibliographyURL(aDesc); - BibDBDescriptor aDesc; - aDesc.sDataSource = aDataSourceURL; - aDesc.sTableOrQuery = aActiveDataTable; - aDesc.nCommandType = CommandType::TABLE; - BibModul::GetConfig()->SetBibliographyURL(aDesc); + break; + } } } } diff --git a/extensions/source/bibliography/framectr.cxx b/extensions/source/bibliography/framectr.cxx index 758c8b3484c2..7e0ec6e93938 100644 --- a/extensions/source/bibliography/framectr.cxx +++ b/extensions/source/bibliography/framectr.cxx @@ -431,14 +431,11 @@ void BibFrameController_Impl::dispatch(const util::URL& _rURL, const uno::Sequen } } - const beans::PropertyValue* pPropertyValue = aArgs.getConstArray(); - uno::Any aValue=pPropertyValue[0].Value; OUString aQuery; - aValue >>= aQuery; + aArgs[0].Value >>= aQuery; - aValue=pPropertyValue[1].Value; OUString aQueryField; - aValue >>= aQueryField; + aArgs[1].Value >>= aQueryField; BibConfig* pConfig = BibModul::GetConfig(); pConfig->setQueryField(aQueryField); m_xDatMan->startQueryWith(aQuery); @@ -806,15 +803,14 @@ void BibFrameController_Impl::RemoveFilter() void BibFrameController_Impl::ChangeDataSource(const uno::Sequence< beans::PropertyValue >& aArgs) { - const beans::PropertyValue* pPropertyValue = aArgs.getConstArray(); - uno::Any aValue=pPropertyValue[0].Value; + uno::Any aValue = aArgs[0].Value; OUString aDBTableName; aValue >>= aDBTableName; if(aArgs.getLength() > 1) { - uno::Any aDB = pPropertyValue[1].Value; + uno::Any aDB = aArgs[1].Value; OUString aURL; aDB >>= aURL; m_xDatMan->setActiveDataSource(aURL); diff --git a/extensions/source/bibliography/toolbar.cxx b/extensions/source/bibliography/toolbar.cxx index e4041c5a80f1..35bd6b2320fb 100644 --- a/extensions/source/bibliography/toolbar.cxx +++ b/extensions/source/bibliography/toolbar.cxx @@ -100,13 +100,8 @@ void BibTBListBoxListener::statusChanged(const css::frame::FeatureStateEvent& rE pToolBar->UpdateSourceList(false); pToolBar->ClearSourceList(); - const OUString* pStringArray = pStringSeq->getConstArray(); - - sal_uInt32 nCount = pStringSeq->getLength(); - OUString aEntry; - for( sal_uInt32 i=0; i<nCount; i++ ) + for (auto& aEntry : *pStringSeq) { - aEntry = pStringArray[i]; pToolBar->InsertSourceEntry(aEntry); } pToolBar->UpdateSourceList(true); @@ -139,13 +134,10 @@ void BibTBQueryMenuListener::statusChanged(const frame::FeatureStateEvent& rEvt) pToolBar->ClearFilterMenu(); - const OUString* pStringArray = pStringSeq->getConstArray(); - - sal_uInt32 nCount = pStringSeq->getLength(); - for( sal_uInt32 i=0; i<nCount; i++ ) + for (auto& string : *pStringSeq) { - sal_uInt16 nID = pToolBar->InsertFilterItem(pStringArray[i]); - if(pStringArray[i]==rEvt.FeatureDescriptor) + sal_uInt16 nID = pToolBar->InsertFilterItem(string); + if (string == rEvt.FeatureDescriptor) { pToolBar->SelectFilterItem(nID); } diff --git a/extensions/source/dbpilots/controlwizard.cxx b/extensions/source/dbpilots/controlwizard.cxx index 1b0d3ceaf77c..5a3eca35b539 100644 --- a/extensions/source/dbpilots/controlwizard.cxx +++ b/extensions/source/dbpilots/controlwizard.cxx @@ -116,23 +116,18 @@ namespace dbp void OControlWizardPage::fillListBox(weld::TreeView& _rList, const Sequence< OUString >& _rItems) { _rList.clear(); - const OUString* pItems = _rItems.getConstArray(); - const OUString* pEnd = pItems + _rItems.getLength(); - sal_Int32 nIndex = 0; - for (;pItems < pEnd; ++pItems, ++nIndex) + for (sal_Int32 nIndex = 0; nIndex < _rItems.getLength(); ++nIndex) { - _rList.append(OUString::number(nIndex), *pItems); + _rList.append(OUString::number(nIndex), _rItems[nIndex]); } } void OControlWizardPage::fillListBox(weld::ComboBox& _rList, const Sequence< OUString >& _rItems) { _rList.clear(); - const OUString* pItems = _rItems.getConstArray(); - const OUString* pEnd = pItems + _rItems.getLength(); - for (;pItems < pEnd; ++pItems) + for (auto& item : _rItems) { - _rList.append_text(*pItems); + _rList.append_text(item); } } @@ -539,15 +534,13 @@ namespace dbp if (xColumns.is()) { m_aContext.aFieldNames = xColumns->getElementNames(); - const OUString* pBegin = m_aContext.aFieldNames.getConstArray(); - const OUString* pEnd = pBegin + m_aContext.aFieldNames.getLength(); - for(;pBegin != pEnd;++pBegin) + for (auto& name : m_aContext.aFieldNames) { sal_Int32 nFieldType = DataType::OTHER; try { Reference< XPropertySet > xColumn; - xColumns->getByName(*pBegin) >>= xColumn; + xColumns->getByName(name) >>= xColumn; xColumn->getPropertyValue("Type") >>= nFieldType; } catch(const Exception&) @@ -556,7 +549,7 @@ namespace dbp "extensions.dbpilots", "unexpected exception while gathering column information!"); } - m_aContext.aTypes.emplace(*pBegin,nFieldType); + m_aContext.aTypes.emplace(name, nFieldType); } } } diff --git a/extensions/source/dbpilots/gridwizard.cxx b/extensions/source/dbpilots/gridwizard.cxx index 4b382e228264..ec61df855503 100644 --- a/extensions/source/dbpilots/gridwizard.cxx +++ b/extensions/source/dbpilots/gridwizard.cxx @@ -105,17 +105,15 @@ namespace dbp aFormFieldNames.reserve(getSettings().aSelectedFields.getLength()); // loop through the selected field names - const OUString* pSelectedFields = getSettings().aSelectedFields.getConstArray(); - const OUString* pEnd = pSelectedFields + getSettings().aSelectedFields.getLength(); - for (;pSelectedFields < pEnd; ++pSelectedFields) + for (auto& selectedField : getSettings().aSelectedFields) { // get the information for the selected column sal_Int32 nFieldType = DataType::OTHER; - OControlWizardContext::TNameTypeMap::const_iterator aFind = rContext.aTypes.find(*pSelectedFields); + OControlWizardContext::TNameTypeMap::const_iterator aFind = rContext.aTypes.find(selectedField); if ( aFind != rContext.aTypes.end() ) nFieldType = aFind->second; - aFormFieldNames.push_back(*pSelectedFields); + aFormFieldNames.push_back(selectedField); switch (nFieldType) { case DataType::BIT: @@ -154,7 +152,7 @@ namespace dbp aColumnServiceNames.emplace_back("DateField"); aColumnLabelPostfixes.push_back(compmodule::ModuleRes(RID_STR_DATEPOSTFIX)); - aFormFieldNames.push_back(*pSelectedFields); + aFormFieldNames.push_back(selectedField); aColumnServiceNames.emplace_back("TimeField"); aColumnLabelPostfixes.push_back(compmodule::ModuleRes(RID_STR_TIMEPOSTFIX)); break; @@ -324,13 +322,10 @@ namespace dbp fillListBox(*m_xExistFields, rContext.aFieldNames); m_xSelFields->clear(); - const OGridSettings& rSettings = getSettings(); - const OUString* pSelected = rSettings.aSelectedFields.getConstArray(); - const OUString* pEnd = pSelected + rSettings.aSelectedFields.getLength(); - for (; pSelected < pEnd; ++pSelected) + for (auto& field : getSettings().aSelectedFields) { - m_xSelFields->append_text(*pSelected); - m_xExistFields->remove_text(*pSelected); + m_xSelFields->append_text(field); + m_xExistFields->remove_text(field); } implCheckButtons(); diff --git a/i18npool/source/localedata/saxparser.cxx b/i18npool/source/localedata/saxparser.cxx index eb95c7973fa5..4f6051445f6a 100644 --- a/i18npool/source/localedata/saxparser.cxx +++ b/i18npool/source/localedata/saxparser.cxx @@ -63,7 +63,7 @@ public: virtual sal_Int32 SAL_CALL readBytes( Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) override { nBytesToRead = std::min(nBytesToRead, m_seq.getLength() - nPos); - aData = Sequence< sal_Int8 > ( &(m_seq.getConstArray()[nPos]) , nBytesToRead ); + aData = Sequence<sal_Int8>(m_seq.getConstArray() + nPos, nBytesToRead); nPos += nBytesToRead; return nBytesToRead; } diff --git a/include/comphelper/namedvaluecollection.hxx b/include/comphelper/namedvaluecollection.hxx index b92646e40a11..aa30df9932b4 100644 --- a/include/comphelper/namedvaluecollection.hxx +++ b/include/comphelper/namedvaluecollection.hxx @@ -302,12 +302,8 @@ namespace comphelper css::uno::Sequence< VALUE_TYPE > aValues; *this >>= aValues; css::uno::Sequence< css::uno::Any > aWrappedValues( aValues.getLength() ); - - css::uno::Any* pO = aWrappedValues.getArray(); - const VALUE_TYPE* pV = aValues.getConstArray(); - const sal_Int32 nLen = aValues.getLength(); - for( sal_Int32 i = 0; i < nLen; ++i ) - *(pO++) = css::uno::Any( *(pV++) ); + std::transform(aValues.begin(), aValues.end(), aWrappedValues.getArray(), + [](const auto& val) { return css::uno::Any(val); }); return aWrappedValues; } diff --git a/scripting/source/basprov/baslibnode.cxx b/scripting/source/basprov/baslibnode.cxx index 72d464f5caf0..dd63585bddab 100644 --- a/scripting/source/basprov/baslibnode.cxx +++ b/scripting/source/basprov/baslibnode.cxx @@ -87,12 +87,11 @@ namespace basprov { Sequence< OUString > aNames = m_xLibrary->getElementNames(); sal_Int32 nCount = aNames.getLength(); - const OUString* pNames = aNames.getConstArray(); aChildNodes.resize( nCount ); for ( sal_Int32 i = 0 ; i < nCount ; ++i ) { - SbModule* pModule = pBasic->FindModule( pNames[i] ); + SbModule* pModule = pBasic->FindModule(aNames[i]); if ( pModule ) aChildNodes[i] = new BasicModuleNodeImpl(m_xContext, m_sScriptingContext, pModule, m_bIsAppScript); diff --git a/scripting/source/basprov/basscript.cxx b/scripting/source/basprov/basscript.cxx index fdb6c5d02d44..35eb04f8d29f 100644 --- a/scripting/source/basprov/basscript.cxx +++ b/scripting/source/basprov/basscript.cxx @@ -207,11 +207,10 @@ constexpr OUString BASSCRIPT_PROPERTY_CALLER = u"Caller"_ustr; if ( nParamsCount > 0 ) { xSbxParams = new SbxArray; - const Any* pParams = aParams.getConstArray(); for ( sal_Int32 i = 0; i < nParamsCount; ++i ) { SbxVariableRef xSbxVar = new SbxVariable( SbxVARIANT ); - unoToSbxValue( xSbxVar.get(), pParams[i] ); + unoToSbxValue(xSbxVar.get(), aParams[i]); xSbxParams->Put(xSbxVar.get(), static_cast<sal_uInt32>(i) + 1); if (pInfo) diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index a1353eadcecf..aff553944f9b 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -1276,7 +1276,7 @@ CPPUNIT_TEST_FIXTURE(SdImportTest, testFdo71075) uno::Reference<chart2::data::XNumericalDataSequence> xNumSeq(xValueSeq, uno::UNO_QUERY); uno::Sequence<double> aValues(xNumSeq->getNumericalData()); for (sal_Int32 i = 0; i < xValueSeq->getData().getLength(); i++) - CPPUNIT_ASSERT_EQUAL_MESSAGE("Invalid Series count", values[i], aValues.getConstArray()[i]); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Invalid Series count", values[i], aValues[i]); } CPPUNIT_TEST_FIXTURE(SdImportTest, testStrictOOXML) diff --git a/slideshow/source/engine/opengl/TransitionerImpl.cxx b/slideshow/source/engine/opengl/TransitionerImpl.cxx index 224d8cdcd808..1f39faf95227 100644 --- a/slideshow/source/engine/opengl/TransitionerImpl.cxx +++ b/slideshow/source/engine/opengl/TransitionerImpl.cxx @@ -506,7 +506,6 @@ private: } virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertToRGB( const uno::Sequence< double >& deviceColor ) override { - const double* pIn( deviceColor.getConstArray() ); const std::size_t nLen( deviceColor.getLength() ); ENSURE_ARG_OR_THROW2(nLen%4==0, "number of channels no multiple of 4", @@ -516,14 +515,12 @@ private: rendering::RGBColor* pOut( aRes.getArray() ); for( std::size_t i=0; i<nLen; i+=4 ) { - *pOut++ = rendering::RGBColor(pIn[0],pIn[1],pIn[2]); - pIn += 4; + *pOut++ = rendering::RGBColor(deviceColor[i], deviceColor[i + 1], deviceColor[i + 2]); } return aRes; } virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToARGB( const uno::Sequence< double >& deviceColor ) override { - const double* pIn( deviceColor.getConstArray() ); const std::size_t nLen( deviceColor.getLength() ); ENSURE_ARG_OR_THROW2(nLen%4==0, "number of channels no multiple of 4", @@ -533,14 +530,12 @@ private: rendering::ARGBColor* pOut( aRes.getArray() ); for( std::size_t i=0; i<nLen; i+=4 ) { - *pOut++ = rendering::ARGBColor(pIn[3],pIn[0],pIn[1],pIn[2]); - pIn += 4; + *pOut++ = rendering::ARGBColor(deviceColor[i+3], deviceColor[i], deviceColor[i+1], deviceColor[i+2]); } return aRes; } virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToPARGB( const uno::Sequence< double >& deviceColor ) override { - const double* pIn( deviceColor.getConstArray() ); const std::size_t nLen( deviceColor.getLength() ); ENSURE_ARG_OR_THROW2(nLen%4==0, "number of channels no multiple of 4", @@ -550,8 +545,10 @@ private: rendering::ARGBColor* pOut( aRes.getArray() ); for( std::size_t i=0; i<nLen; i+=4 ) { - *pOut++ = rendering::ARGBColor(pIn[3],pIn[3]*pIn[0],pIn[3]*pIn[1],pIn[3]*pIn[2]); - pIn += 4; + *pOut++ = rendering::ARGBColor(deviceColor[i+3], + deviceColor[i+3] * deviceColor[i], + deviceColor[i+3] * deviceColor[i+1], + deviceColor[i+3] * deviceColor[i+2]); } return aRes; } @@ -657,7 +654,6 @@ private: } virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertIntegerToRGB( const uno::Sequence< sal_Int8 >& deviceColor ) override { - const sal_Int8* pIn( deviceColor.getConstArray() ); const std::size_t nLen( deviceColor.getLength() ); ENSURE_ARG_OR_THROW2(nLen%4==0, "number of channels no multiple of 4", @@ -668,17 +664,15 @@ private: for( std::size_t i=0; i<nLen; i+=4 ) { *pOut++ = rendering::RGBColor( - vcl::unotools::toDoubleColor(pIn[0]), - vcl::unotools::toDoubleColor(pIn[1]), - vcl::unotools::toDoubleColor(pIn[2])); - pIn += 4; + vcl::unotools::toDoubleColor(deviceColor[i + 0]), + vcl::unotools::toDoubleColor(deviceColor[i + 1]), + vcl::unotools::toDoubleColor(deviceColor[i + 2])); } return aRes; } virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToARGB( const uno::Sequence< sal_Int8 >& deviceColor ) override { - const sal_Int8* pIn( deviceColor.getConstArray() ); const std::size_t nLen( deviceColor.getLength() ); ENSURE_ARG_OR_THROW2(nLen%4==0, "number of channels no multiple of 4", @@ -689,18 +683,16 @@ private: for( std::size_t i=0; i<nLen; i+=4 ) { *pOut++ = rendering::ARGBColor( - vcl::unotools::toDoubleColor(pIn[3]), - vcl::unotools::toDoubleColor(pIn[0]), - vcl::unotools::toDoubleColor(pIn[1]), - vcl::unotools::toDoubleColor(pIn[2])); - pIn += 4; + vcl::unotools::toDoubleColor(deviceColor[i + 3]), + vcl::unotools::toDoubleColor(deviceColor[i + 0]), + vcl::unotools::toDoubleColor(deviceColor[i + 1]), + vcl::unotools::toDoubleColor(deviceColor[i + 2])); } return aRes; } virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToPARGB( const uno::Sequence< sal_Int8 >& deviceColor ) override { - const sal_Int8* pIn( deviceColor.getConstArray() ); const std::size_t nLen( deviceColor.getLength() ); ENSURE_ARG_OR_THROW2(nLen%4==0, "number of channels no multiple of 4", @@ -710,13 +702,12 @@ private: rendering::ARGBColor* pOut( aRes.getArray() ); for( std::size_t i=0; i<nLen; i+=4 ) { - const sal_Int8 nAlpha( pIn[3] ); + const sal_Int8 nAlpha(deviceColor[i + 3]); *pOut++ = rendering::ARGBColor( vcl::unotools::toDoubleColor(nAlpha), - vcl::unotools::toDoubleColor(nAlpha*pIn[0]), - vcl::unotools::toDoubleColor(nAlpha*pIn[1]), - vcl::unotools::toDoubleColor(nAlpha*pIn[2])); - pIn += 4; + vcl::unotools::toDoubleColor(nAlpha * deviceColor[i + 0]), + vcl::unotools::toDoubleColor(nAlpha * deviceColor[i + 1]), + vcl::unotools::toDoubleColor(nAlpha * deviceColor[i + 2])); } return aRes; } diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx index 14c5c8e65a51..98df49d93338 100644 --- a/stoc/source/implementationregistration/implreg.cxx +++ b/stoc/source/implementationregistration/implreg.cxx @@ -508,7 +508,7 @@ void prepareUserKeys(const Reference < XSimpleRegistry >& xDest, OUString relativKey; if (keyNames.hasElements()) - relativKey = keyNames.getConstArray()[0].copy(xKey->getKeyName().getLength()+1); + relativKey = keyNames[0].copy(xKey->getKeyName().getLength()+1); if (keyNames.getLength() == 1 && xKey->getKeyType(relativKey) == RegistryKeyType_LINK) @@ -656,10 +656,9 @@ void delete_all_singleton_entries( // throw (InvalidRegistryException, RuntimeException) { Sequence< Reference< registry::XRegistryKey > > singletons( xSingletons_section->openKeys() ); - Reference< registry::XRegistryKey > const * subkeys = singletons.getConstArray(); for ( sal_Int32 nPos = singletons.getLength(); nPos--; ) { - Reference< registry::XRegistryKey > const & xSingleton = subkeys[ nPos ]; + Reference<registry::XRegistryKey> const& xSingleton = singletons[nPos]; Reference< registry::XRegistryKey > xRegisteredImplNames( xSingleton->openKey( "REGISTERED_BY" ) ); if (xRegisteredImplNames.is() && xRegisteredImplNames->isValid()) @@ -801,10 +800,9 @@ void insert_singletons( OUString implname( xImplKey->getKeyName().copy( sizeof ("/IMPLEMENTATIONS/") -1 ) ); // singleton entries Sequence< Reference< registry::XRegistryKey > > xSingletons_section( xKey->openKeys() ); - Reference< registry::XRegistryKey > const * p = xSingletons_section.getConstArray(); for ( sal_Int32 nPos = xSingletons_section.getLength(); nPos--; ) { - Reference< registry::XRegistryKey > const & xSingleton = p[ nPos ]; + Reference<registry::XRegistryKey> const& xSingleton = xSingletons_section[nPos]; OUString singleton_name( xSingleton->getKeyName().copy( implname.getLength() + sizeof ("/IMPLEMENTATIONS//UNO/SINGLETONS/") -1 ) ); @@ -1175,42 +1173,42 @@ void ImplementationRegistration::initialize( Reference< XSimpleRegistry > rReg; // 1st argument : An instance of an implementation loader - if( aArgs.getConstArray()[0].getValueType().getTypeClass() == TypeClass_INTERFACE ) { - aArgs.getConstArray()[0] >>= rLoader; + if( aArgs[0].getValueType().getTypeClass() == TypeClass_INTERFACE ) { + aArgs[0] >>= rLoader; } if( !rLoader.is()) { throw IllegalArgumentException( "ImplementationRegistration::initialize() invalid first parameter," "expected " + cppu::UnoType<decltype(rLoader)>::get().getTypeName() + - ", got " + aArgs.getConstArray()[0].getValueTypeName(), + ", got " + aArgs[0].getValueTypeName(), Reference< XInterface > (), 0 ); } // 2nd argument : The service name of the loader. This name is written into the registry - if( aArgs.getConstArray()[1].getValueType().getTypeClass() == TypeClass_STRING ) { - aArgs.getConstArray()[1] >>= loaderServiceName; + if( aArgs[1].getValueType().getTypeClass() == TypeClass_STRING ) { + aArgs[1] >>= loaderServiceName; } if( loaderServiceName.isEmpty() ) { throw IllegalArgumentException( "ImplementationRegistration::initialize() invalid second parameter," - "expected string, got " + aArgs.getConstArray()[1].getValueTypeName(), + "expected string, got " + aArgs[1].getValueTypeName(), Reference< XInterface > (), 0 ); } // 3rd argument : The file name of the dll, that contains the loader - if( aArgs.getConstArray()[2].getValueType().getTypeClass() == TypeClass_STRING ) { - aArgs.getConstArray()[2] >>= locationUrl; + if( aArgs[2].getValueType().getTypeClass() == TypeClass_STRING ) { + aArgs[2] >>= locationUrl; } if( locationUrl.isEmpty() ) { throw IllegalArgumentException( "ImplementationRegistration::initialize() invalid third parameter," - "expected string, got " + aArgs.getConstArray()[2].getValueTypeName(), + "expected string, got " + aArgs[2].getValueTypeName(), Reference< XInterface > (), 0 ); } // 4th argument : The registry, the service should be written to - if( aArgs.getConstArray()[3].getValueType().getTypeClass() == TypeClass_INTERFACE ) { - aArgs.getConstArray()[3] >>= rReg; + if( aArgs[3].getValueType().getTypeClass() == TypeClass_INTERFACE ) { + aArgs[3] >>= rReg; } if( !rReg.is() ) { @@ -1219,7 +1217,7 @@ void ImplementationRegistration::initialize( throw IllegalArgumentException( "ImplementationRegistration::initialize() invalid fourth parameter," "expected " + cppu::UnoType<decltype(rReg)>::get().getTypeName() + - ", got " + aArgs.getConstArray()[3].getValueTypeName(), + ", got " + aArgs[3].getValueTypeName(), Reference< XInterface > (), 0 ); } } diff --git a/stoc/source/implementationregistration/mergekeys.cxx b/stoc/source/implementationregistration/mergekeys.cxx index fe052bb1f7f8..fe979540d839 100644 --- a/stoc/source/implementationregistration/mergekeys.cxx +++ b/stoc/source/implementationregistration/mergekeys.cxx @@ -99,11 +99,10 @@ static void mergeKeys( // sub keys Sequence< OUString > sourceKeys( xSource->getKeyNames() ); - OUString const * pSourceKeys = sourceKeys.getConstArray(); for ( sal_Int32 nPos = sourceKeys.getLength(); nPos--; ) { // key name - OUString name( pSourceKeys[ nPos ] ); + OUString name( sourceKeys[ nPos ] ); sal_Int32 nSlash = name.lastIndexOf( '/' ); if (nSlash >= 0) { @@ -137,7 +136,7 @@ static void mergeKeys( } links.push_back( Link( - pSourceKeys[ nPos ], // abs path + sourceKeys[ nPos ], // abs path xSource->getResolvedName( name ) // abs resolved name ) ); } diff --git a/stoc/source/security/permissions.cxx b/stoc/source/security/permissions.cxx index 48a1f907f01c..033d608e90b0 100644 --- a/stoc/source/security/permissions.cxx +++ b/stoc/source/security/permissions.cxx @@ -452,10 +452,9 @@ PermissionCollection::PermissionCollection( Sequence< Any > const & permissions, PermissionCollection const & addition ) : m_head( addition.m_head ) { - Any const * perms = permissions.getConstArray(); for ( sal_Int32 nPos = permissions.getLength(); nPos--; ) { - Any const & perm = perms[ nPos ]; + Any const& perm = permissions[nPos]; Type const & perm_type = perm.getValueType(); // supported permission types diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx index 96fa0a988518..a17b9c1d9f43 100644 --- a/stoc/source/servicemanager/servicemanager.cxx +++ b/stoc/source/servicemanager/servicemanager.cxx @@ -157,7 +157,7 @@ Any ServiceEnumeration_Impl::nextElement() if( nIt == aFactories.getLength() ) throw NoSuchElementException("no more elements"); - return Any( &aFactories.getConstArray()[nIt++], cppu::UnoType<XInterface>::get()); + return Any( &aFactories[nIt++], cppu::UnoType<XInterface>::get()); } @@ -183,11 +183,10 @@ Sequence< beans::Property > PropertySetInfo_Impl::getProperties() beans::Property PropertySetInfo_Impl::getPropertyByName( OUString const & name ) { - beans::Property const * p = m_properties.getConstArray(); for ( sal_Int32 nPos = m_properties.getLength(); nPos--; ) { - if (p[ nPos ].Name == name) - return p[ nPos ]; + if (m_properties[nPos].Name == name) + return m_properties[nPos]; } throw beans::UnknownPropertyException( "unknown property: " + name ); diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 3b5249efa8f8..2f076694a09c 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -2992,7 +2992,9 @@ static rtl::Reference<SwXHeadFootText> lcl_makeHeaderFooter(const sal_uInt16 nRe uno::Sequence<uno::Any> SwXPageStyle::GetPropertyValues_Impl(const uno::Sequence<OUString>& rPropertyNames) { - if(!GetDoc()) + SolarMutexGuard aGuard; + + if (!GetDoc()) throw uno::RuntimeException(); sal_Int32 nLength = rPropertyNames.getLength(); @@ -3183,13 +3185,10 @@ uno::Sequence<uno::Any> SwXPageStyle::GetPropertyValues_Impl(const uno::Sequence uno::Sequence<uno::Any> SwXPageStyle::getPropertyValues(const uno::Sequence<OUString>& rPropertyNames) { - SolarMutexGuard aGuard; - uno::Sequence<uno::Any> aValues; - // workaround for bad designed API try { - aValues = GetPropertyValues_Impl(rPropertyNames); + return GetPropertyValues_Impl(rPropertyNames); } catch(beans::UnknownPropertyException &) { @@ -3203,13 +3202,10 @@ uno::Sequence<uno::Any> SwXPageStyle::getPropertyValues(const uno::Sequence<OUSt throw lang::WrappedTargetRuntimeException("WrappedTargetException caught", getXWeak(), anyEx ); } - - return aValues; } uno::Any SwXPageStyle::getPropertyValue(const OUString& rPropertyName) { - SolarMutexGuard aGuard; const uno::Sequence<OUString> aProperties(&rPropertyName, 1); return GetPropertyValues_Impl(aProperties)[0]; } @@ -3838,9 +3834,8 @@ void SwXAutoStyle::setPropertyValue( const OUString& /*rPropertyName*/, const un uno::Any SwXAutoStyle::getPropertyValue( const OUString& rPropertyName ) { - SolarMutexGuard aGuard; const uno::Sequence<OUString> aProperties(&rPropertyName, 1); - return GetPropertyValues_Impl(aProperties).getConstArray()[0]; + return GetPropertyValues_Impl(aProperties)[0]; } void SwXAutoStyle::addPropertyChangeListener( const OUString& /*aPropertyName*/, @@ -3872,7 +3867,9 @@ void SwXAutoStyle::setPropertyValues( uno::Sequence< uno::Any > SwXAutoStyle::GetPropertyValues_Impl( const uno::Sequence< OUString > & rPropertyNames ) { - if( !mpSet ) + SolarMutexGuard aGuard; + + if (!mpSet) { throw uno::RuntimeException(); } @@ -4009,13 +4006,10 @@ uno::Sequence< uno::Any > SwXAutoStyle::GetPropertyValues_Impl( uno::Sequence< uno::Any > SwXAutoStyle::getPropertyValues ( const uno::Sequence< OUString >& rPropertyNames ) { - SolarMutexGuard aGuard; - uno::Sequence< uno::Any > aValues; - // workaround for bad designed API try { - aValues = GetPropertyValues_Impl( rPropertyNames ); + return GetPropertyValues_Impl( rPropertyNames ); } catch (beans::UnknownPropertyException &) { @@ -4027,8 +4021,6 @@ uno::Sequence< uno::Any > SwXAutoStyle::getPropertyValues ( css::uno::Any exc = cppu::getCaughtException(); throw lang::WrappedTargetRuntimeException("WrappedTargetException caught", getXWeak(), exc ); } - - return aValues; } void SwXAutoStyle::addPropertiesChangeListener( diff --git a/testtools/source/bridgetest/bridgetest.cxx b/testtools/source/bridgetest/bridgetest.cxx index f0b5e9de557b..c438459b5406 100644 --- a/testtools/source/bridgetest/bridgetest.cxx +++ b/testtools/source/bridgetest/bridgetest.cxx @@ -174,11 +174,9 @@ static bool equals( const TestData & rData1, const TestData & rData2 ) if (nLen == rData2.Sequence.getLength()) { // once again by hand sequence == - const TestElement * pElements1 = rData1.Sequence.getConstArray(); - const TestElement * pElements2 = rData2.Sequence.getConstArray(); for ( ; nLen--; ) { - if (! equals( pElements1[nLen], pElements2[nLen] )) + if (!equals(rData1.Sequence[nLen], rData2.Sequence[nLen])) { check( false, "### sequence element did not match!" ); return false; |