Drop some uses of css::uno::Sequence::getConstArray ...

where it was obsoleted by commits 2484de6728bd11bb7949003d112f1ece2223c7a1
(Remove non-const Sequence::begin()/end() in internal code, 2021-10-15) and
fb3c04bd1930eedacd406874e1a285d62bbf27d9 (Drop non-const Sequence::operator[]
in internal code 2021-11-05).

Change-Id: I4ccc647bb794515c8c11f8dfd9a26563f4aa094b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166819
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Mike Kaganski 2024-04-29 01:31:19 +05:00
parent e82c9633e4
commit ea93670372
23 changed files with 140 additions and 224 deletions

View File

@ -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;
}
}
}

View File

@ -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())

View File

@ -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&)
{

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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 );

View File

@ -948,49 +948,43 @@ 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 );
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 );
OUString aString("SELECT * FROM ");
OUString sCatalog, sSchema, sName;
::dbtools::qualifiedNameComponents( xMetaData, aActiveDataTable, sCatalog, sSchema, sName, ::dbtools::EComposeRule::InDataManipulation );
aString += ::dbtools::composeTableNameForSelect( xConnection, sCatalog, sSchema, sName );
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);
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 );
OUString aString("SELECT * FROM ");
OUString sCatalog, sSchema, sName;
::dbtools::qualifiedNameComponents( xMetaData, aActiveDataTable, sCatalog, sSchema, sName, ::dbtools::EComposeRule::InDataManipulation );
aString += ::dbtools::composeTableNameForSelect( xConnection, sCatalog, sSchema, sName );
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);
}
}
}
catch (const Exception&)

View File

@ -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);

View File

@ -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);
}

View File

@ -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);
}
}
}

View File

@ -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();

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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)

View File

@ -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)

View File

@ -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;
}

View File

@ -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 );
}
}

View File

@ -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
) );
}

View File

@ -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

View File

@ -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 );

View File

@ -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(

View File

@ -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;