diff options
Diffstat (limited to 'cppuhelper')
-rw-r--r-- | cppuhelper/source/implbase_ex.cxx | 9 | ||||
-rw-r--r-- | cppuhelper/source/implementationentry.cxx | 6 | ||||
-rw-r--r-- | cppuhelper/source/propertysetmixin.cxx | 7 | ||||
-rw-r--r-- | cppuhelper/source/propshlp.cxx | 31 | ||||
-rw-r--r-- | cppuhelper/source/tdmgr.cxx | 30 |
5 files changed, 29 insertions, 54 deletions
diff --git a/cppuhelper/source/implbase_ex.cxx b/cppuhelper/source/implbase_ex.cxx index 731299d9cf06..3f88feb97dd1 100644 --- a/cppuhelper/source/implbase_ex.cxx +++ b/cppuhelper/source/implbase_ex.cxx @@ -255,16 +255,11 @@ Sequence< Type > SAL_CALL ImplInhHelper_getTypes( class_data * cd, Sequence< Type > const & rAddTypes ) { sal_Int32 nImplTypes = cd->m_nTypes; - sal_Int32 nAddTypes = rAddTypes.getLength(); - Sequence< Type > types( nImplTypes + nAddTypes ); + Sequence<Type> types(nImplTypes + rAddTypes.getLength()); Type * pTypes = types.getArray(); fillTypes( pTypes, cd ); // append base types - Type const * pAddTypes = rAddTypes.getConstArray(); - while (nAddTypes--) - { - pTypes[ nImplTypes + nAddTypes ] = pAddTypes[ nAddTypes ]; - } + std::copy(rAddTypes.begin(), rAddTypes.end(), pTypes + nImplTypes); return types; } diff --git a/cppuhelper/source/implementationentry.cxx b/cppuhelper/source/implementationentry.cxx index f28547dfacc2..9ec1e5f558e8 100644 --- a/cppuhelper/source/implementationentry.cxx +++ b/cppuhelper/source/implementationentry.cxx @@ -44,10 +44,8 @@ sal_Bool component_writeInfoHelper( Reference< XRegistryKey > xNewKey( static_cast< XRegistryKey * >( pRegistryKey )->createKey( sKey ) ); - Sequence< OUString > seq = entries[i].getSupportedServiceNames(); - const OUString *pArray = seq.getConstArray(); - for ( sal_Int32 nPos = 0 ; nPos < seq.getLength(); nPos ++ ) - xNewKey->createKey( pArray[nPos] ); + for (auto& serviceName : entries[i].getSupportedServiceNames()) + xNewKey->createKey(serviceName); } bRet = true; } diff --git a/cppuhelper/source/propertysetmixin.cxx b/cppuhelper/source/propertysetmixin.cxx index b2c23dc2b507..78b1c2204a28 100644 --- a/cppuhelper/source/propertysetmixin.cxx +++ b/cppuhelper/source/propertysetmixin.cxx @@ -149,9 +149,6 @@ void Data::initProperties( css::uno::Reference< css::reflection::XInterfaceMemberTypeDescription > > members( ifc->getMembers()); - OUString const * absentBegin = absentOptional.getConstArray(); - OUString const * absentEnd = - absentBegin + absentOptional.getLength(); for (const auto & m : members) { if (m->getTypeClass() == css::uno::TypeClass_INTERFACE_ATTRIBUTE) @@ -250,8 +247,8 @@ void Data::initProperties( css::uno::Type( t->getTypeClass(), t->getName()), attrAttribs), - (std::find(absentBegin, absentEnd, name) - == absentEnd))). + (std::find(absentOptional.begin(), absentOptional.end(), name) + == absentOptional.end()))). second) { throw css::uno::RuntimeException( diff --git a/cppuhelper/source/propshlp.cxx b/cppuhelper/source/propshlp.cxx index 1dfca5e2a6ec..fd4e4808da35 100644 --- a/cppuhelper/source/propshlp.cxx +++ b/cppuhelper/source/propshlp.cxx @@ -926,7 +926,6 @@ void OPropertySetHelper::firePropertiesChangeEvent( std::unique_ptr<sal_Int32[]> pHandles(new sal_Int32[nLen]); IPropertyArrayHelper & rPH = getInfoHelper(); rPH.fillHandles( pHandles.get(), rPropertyNames ); - const OUString* pNames = rPropertyNames.getConstArray(); // get the count of matching properties sal_Int32 nFireLen = 0; @@ -948,7 +947,7 @@ void OPropertySetHelper::firePropertiesChangeEvent( if( pHandles[i] != -1 ) { pChanges[nFirePos].Source = xSource; - pChanges[nFirePos].PropertyName = pNames[i]; + pChanges[nFirePos].PropertyName = rPropertyNames[i]; pChanges[nFirePos].PropertyHandle = pHandles[i]; getFastPropertyValue( pChanges[nFirePos].OldValue, pHandles[i] ); pChanges[nFirePos].NewValue = pChanges[nFirePos].OldValue; @@ -979,11 +978,10 @@ static int compare_Property_Impl( const void *arg1, const void *arg2 ) void OPropertyArrayHelper::init( sal_Bool bSorted ) { sal_Int32 i, nElements = aInfos.getLength(); - const Property* pProperties = aInfos.getConstArray(); for( i = 1; i < nElements; i++ ) { - if( pProperties[i-1].Name > pProperties[i].Name ) + if (aInfos[i - 1].Name > aInfos[i].Name) { if (bSorted) { OSL_FAIL( "Property array is not sorted" ); @@ -991,12 +989,11 @@ void OPropertyArrayHelper::init( sal_Bool bSorted ) // not sorted qsort( aInfos.getArray(), nElements, sizeof( Property ), compare_Property_Impl ); - pProperties = aInfos.getConstArray(); break; } } for( i = 0; i < nElements; i++ ) - if( pProperties[i].Handle != i ) + if (aInfos[i].Handle != i) return; // The handle is the index bRightOrdered = true; @@ -1037,7 +1034,6 @@ sal_Bool OPropertyArrayHelper::fillPropertyMembersByHandle sal_Int32 nHandle ) { - const Property* pProperties = aInfos.getConstArray(); sal_Int32 nElements = aInfos.getLength(); if( bRightOrdered ) @@ -1045,20 +1041,20 @@ sal_Bool OPropertyArrayHelper::fillPropertyMembersByHandle if( nHandle < 0 || nHandle >= nElements ) return false; if( pPropName ) - *pPropName = pProperties[ nHandle ].Name; + *pPropName = aInfos[nHandle].Name; if( pAttributes ) - *pAttributes = pProperties[ nHandle ].Attributes; + *pAttributes = aInfos[nHandle].Attributes; return true; } // normally the array is sorted for( sal_Int32 i = 0; i < nElements; i++ ) { - if( pProperties[i].Handle == nHandle ) + if (aInfos[i].Handle == nHandle) { if( pPropName ) - *pPropName = pProperties[ i ].Name; + *pPropName = aInfos[i].Name; if( pAttributes ) - *pAttributes = pProperties[ i ].Attributes; + *pAttributes = aInfos[i].Attributes; return true; } } @@ -1108,10 +1104,9 @@ sal_Int32 OPropertyArrayHelper::getHandleByName( const OUString & rPropName ) sal_Int32 OPropertyArrayHelper::fillHandles( sal_Int32 * pHandles, const Sequence< OUString > & rPropNames ) { sal_Int32 nHitCount = 0; - const OUString * pReqProps = rPropNames.getConstArray(); sal_Int32 nReqLen = rPropNames.getLength(); - const Property * pCur = aInfos.getConstArray(); - const Property * pEnd = pCur + aInfos.getLength(); + const Property * pCur = aInfos.begin(); + const Property * pEnd = aInfos.end(); for( sal_Int32 i = 0; i < nReqLen; i++ ) { @@ -1129,11 +1124,11 @@ sal_Int32 OPropertyArrayHelper::fillHandles( sal_Int32 * pHandles, const Sequenc if( (nReqLen - i) * nLog >= pEnd - pCur ) { // linear search is better - while( pCur < pEnd && pReqProps[i] > pCur->Name ) + while (pCur < pEnd && rPropNames[i] > pCur->Name) { pCur++; } - if( pCur < pEnd && pReqProps[i] == pCur->Name ) + if (pCur < pEnd && rPropNames[i] == pCur->Name) { pHandles[i] = pCur->Handle; nHitCount++; @@ -1152,7 +1147,7 @@ sal_Int32 OPropertyArrayHelper::fillHandles( sal_Int32 * pHandles, const Sequenc { pMid = (pEnd - pCur) / 2 + pCur; - nCompVal = pReqProps[i].compareTo( pMid->Name ); + nCompVal = rPropNames[i].compareTo(pMid->Name); if( nCompVal > 0 ) pCur = pMid + 1; diff --git a/cppuhelper/source/tdmgr.cxx b/cppuhelper/source/tdmgr.cxx index 821e4871204a..a5f368f3a45f 100644 --- a/cppuhelper/source/tdmgr.cxx +++ b/cppuhelper/source/tdmgr.cxx @@ -75,9 +75,6 @@ static typelib_TypeDescription * createCTD( const Sequence<Reference< XTypeDescription > > & rMemberTypes = xType->getMemberTypes(); const Sequence< OUString > & rMemberNames = xType->getMemberNames(); - const Reference< XTypeDescription > * pMemberTypes = rMemberTypes.getConstArray(); - const OUString * pMemberNames = rMemberNames.getConstArray(); - sal_Int32 nMembers = rMemberTypes.getLength(); OSL_ENSURE( nMembers == rMemberNames.getLength(), "### lens differ!" ); @@ -90,14 +87,14 @@ static typelib_TypeDescription * createCTD( for ( nPos = nMembers; nPos--; ) { typelib_CompoundMember_Init & rInit = pMemberInits[nPos]; - rInit.eTypeClass = static_cast<typelib_TypeClass>(pMemberTypes[nPos]->getTypeClass()); + rInit.eTypeClass = static_cast<typelib_TypeClass>(rMemberTypes[nPos]->getTypeClass()); - OUString aMemberTypeName( pMemberTypes[nPos]->getName() ); + OUString aMemberTypeName(rMemberTypes[nPos]->getName()); rInit.pTypeName = aMemberTypeName.pData; rtl_uString_acquire( rInit.pTypeName ); // string is held by rMemberNames - rInit.pMemberName = pMemberNames[nPos].pData; + rInit.pMemberName = rMemberNames[nPos].pData; } typelib_typedescription_new( @@ -134,9 +131,6 @@ static typelib_TypeDescription * createCTD( const Sequence<Reference< XTypeDescription > > & rMemberTypes = xType->getMemberTypes(); const Sequence< OUString > & rMemberNames = xType->getMemberNames(); - const Reference< XTypeDescription > * pMemberTypes = rMemberTypes.getConstArray(); - const OUString * pMemberNames = rMemberNames.getConstArray(); - sal_Int32 nMembers = rMemberTypes.getLength(); OSL_ENSURE( nMembers == rMemberNames.getLength(), "### lens differ!" ); @@ -163,14 +157,14 @@ static typelib_TypeDescription * createCTD( { typelib_StructMember_Init & rInit = pMemberInits[nPos]; rInit.aBase.eTypeClass - = static_cast<typelib_TypeClass>(pMemberTypes[nPos]->getTypeClass()); + = static_cast<typelib_TypeClass>(rMemberTypes[nPos]->getTypeClass()); - OUString aMemberTypeName( pMemberTypes[nPos]->getName() ); + OUString aMemberTypeName(rMemberTypes[nPos]->getName()); rInit.aBase.pTypeName = aMemberTypeName.pData; rtl_uString_acquire( rInit.aBase.pTypeName ); // string is held by rMemberNames - rInit.aBase.pMemberName = pMemberNames[nPos].pData; + rInit.aBase.pMemberName = rMemberNames[nPos].pData; rInit.bParameterizedType = templateMemberTypes.hasElements() && (templateMemberTypes[nPos]->getTypeClass() @@ -242,7 +236,6 @@ static typelib_TypeDescription * createCTD( // init all params const Sequence<Reference< XMethodParameter > > & rParams = xMethod->getParameters(); - const Reference< XMethodParameter > * pParams = rParams.getConstArray(); sal_Int32 nParams = rParams.getLength(); typelib_Parameter_Init * pParamInit = static_cast<typelib_Parameter_Init *>(alloca( @@ -251,7 +244,7 @@ static typelib_TypeDescription * createCTD( sal_Int32 nPos; for ( nPos = nParams; nPos--; ) { - const Reference< XMethodParameter > & xParam = pParams[nPos]; + const Reference<XMethodParameter>& xParam = rParams[nPos]; const Reference< XTypeDescription > & xType = xParam->getType(); typelib_Parameter_Init & rInit = pParamInit[xParam->getPosition()]; @@ -268,14 +261,13 @@ static typelib_TypeDescription * createCTD( // init all exception strings const Sequence<Reference< XTypeDescription > > & rExceptions = xMethod->getExceptions(); - const Reference< XTypeDescription > * pExceptions = rExceptions.getConstArray(); sal_Int32 nExceptions = rExceptions.getLength(); rtl_uString ** ppExceptionNames = static_cast<rtl_uString **>(alloca( sizeof(rtl_uString *) * nExceptions )); for ( nPos = nExceptions; nPos--; ) { - OUString aExceptionTypeName( pExceptions[nPos]->getName() ); + OUString aExceptionTypeName(rExceptions[nPos]->getName()); ppExceptionNames[nPos] = aExceptionTypeName.pData; rtl_uString_acquire( ppExceptionNames[nPos] ); } @@ -337,18 +329,16 @@ static typelib_TypeDescription * createCTD( typelib_TypeDescriptionReference ** ppMemberRefs = static_cast<typelib_TypeDescriptionReference **>(alloca( sizeof(typelib_TypeDescriptionReference *) * nMembers )); - const Reference< XInterfaceMemberTypeDescription > * pMembers = rMembers.getConstArray(); - OUString aTypeName( xType->getName() ); sal_Int32 nPos; for ( nPos = nMembers; nPos--; ) { - OUString aMemberTypeName( pMembers[nPos]->getName() ); + OUString aMemberTypeName(rMembers[nPos]->getName()); ppMemberRefs[nPos] = nullptr; typelib_typedescriptionreference_new( ppMemberRefs + nPos, - static_cast<typelib_TypeClass>(pMembers[nPos]->getTypeClass()), + static_cast<typelib_TypeClass>(rMembers[nPos]->getTypeClass()), aMemberTypeName.pData ); } |