summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2017-12-17 23:00:24 +0300
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-12-18 07:36:32 +0100
commit4e144751f12a06e358e4f7efa7c8f13954e6cfd7 (patch)
treec6df66d58d02ecaf5caa437a944665fe83959402 /comphelper
parent39c618caf5aa19da95285bec6cab7108bee3984c (diff)
loplugin:unusedindex
Change-Id: I256a807dd2a4c81126b5a76f3d472e31b8224146 Reviewed-on: https://gerrit.libreoffice.org/46652 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/source/property/propagg.cxx28
-rw-r--r--comphelper/source/property/property.cxx13
2 files changed, 18 insertions, 23 deletions
diff --git a/comphelper/source/property/propagg.cxx b/comphelper/source/property/propagg.cxx
index 8bda3f26bf1f..8068d4afedb1 100644
--- a/comphelper/source/property/propagg.cxx
+++ b/comphelper/source/property/propagg.cxx
@@ -406,16 +406,15 @@ void SAL_CALL OPropertySetAggregationHelper::propertiesChange(const css::uno::Se
std::unique_ptr< css::uno::Any[]> pNewValues(new css::uno::Any[nLen]);
std::unique_ptr< css::uno::Any[]> pOldValues(new css::uno::Any[nLen]);
- const css::beans::PropertyChangeEvent* pEvents = _rEvents.getConstArray();
sal_Int32 nDest = 0;
- for (sal_Int32 nSource=0; nSource<nLen; ++nSource, ++pEvents)
+ for (const css::beans::PropertyChangeEvent& rEvent : _rEvents)
{
- sal_Int32 nHandle = rPH.getHandleByName(pEvents->PropertyName);
+ sal_Int32 nHandle = rPH.getHandleByName(rEvent.PropertyName);
if ( ( nHandle != -1 ) && !isCurrentlyForwardingProperty( nHandle ) )
{ // same as above : -1 is valid (73247) ...
pHandles[nDest] = nHandle;
- pNewValues[nDest] = pEvents->NewValue;
- pOldValues[nDest] = pEvents->OldValue;
+ pNewValues[nDest] = rEvent.NewValue;
+ pOldValues[nDest] = rEvent.OldValue;
++nDest;
}
}
@@ -607,13 +606,12 @@ void SAL_CALL OPropertySetAggregationHelper::setPropertyValues(
OPropertyArrayAggregationHelper& rPH = static_cast< OPropertyArrayAggregationHelper& >( getInfoHelper() );
// determine which properties belong to the aggregate, and which ones to the delegator
- const OUString* pNames = _rPropertyNames.getConstArray();
sal_Int32 nAggCount(0);
sal_Int32 nLen(_rPropertyNames.getLength());
- for ( sal_Int32 i = 0; i < nLen; ++i, ++pNames )
+ for ( const OUString& rName : _rPropertyNames )
{
- OPropertyArrayAggregationHelper::PropertyOrigin ePropOrg = rPH.classifyProperty( *pNames );
+ OPropertyArrayAggregationHelper::PropertyOrigin ePropOrg = rPH.classifyProperty( rName );
if ( OPropertyArrayAggregationHelper::PropertyOrigin::Unknown == ePropOrg )
throw WrappedTargetException( OUString(), static_cast< XMultiPropertySet* >( this ), Any( UnknownPropertyException( ) ) );
// due to a flaw in the API design, this method is not allowed to throw an UnknownPropertyException
@@ -623,8 +621,6 @@ void SAL_CALL OPropertySetAggregationHelper::setPropertyValues(
++nAggCount;
}
- pNames = _rPropertyNames.getConstArray(); // reset, we'll need it again below ...
-
// all properties belong to the aggregate
if (nAggCount == nLen)
m_xAggregateMultiSet->setPropertyValues(_rPropertyNames, _rValues);
@@ -655,17 +651,17 @@ void SAL_CALL OPropertySetAggregationHelper::setPropertyValues(
Sequence< Any > DelValues( nLen - nAggCount );
Any* pDelValues = DelValues.getArray();
- for ( sal_Int32 i = 0; i < nLen; ++i, ++pNames, ++pValues )
+ for ( const OUString& rName : _rPropertyNames )
{
- if ( OPropertyArrayAggregationHelper::PropertyOrigin::Aggregate == rPH.classifyProperty( *pNames ) )
+ if ( OPropertyArrayAggregationHelper::PropertyOrigin::Aggregate == rPH.classifyProperty( rName ) )
{
- *pAggNames++ = *pNames;
- *pAggValues++ = *pValues;
+ *pAggNames++ = rName;
+ *pAggValues++ = *pValues++;
}
else
{
- *pDelNames++ = *pNames;
- *pDelValues++ = *pValues;
+ *pDelNames++ = rName;
+ *pDelValues++ = *pValues++;
}
}
diff --git a/comphelper/source/property/property.cxx b/comphelper/source/property/property.cxx
index f5e369808d2a..8f222f56f8de 100644
--- a/comphelper/source/property/property.cxx
+++ b/comphelper/source/property/property.cxx
@@ -71,20 +71,19 @@ void copyProperties(const Reference<XPropertySet>& _rxSource,
Reference< XPropertySetInfo > xDestProps = _rxDest->getPropertySetInfo();
Sequence< Property > aSourceProps = xSourceProps->getProperties();
- const Property* pSourceProps = aSourceProps.getConstArray();
Property aDestProp;
- for (sal_Int32 i=0; i<aSourceProps.getLength(); ++i, ++pSourceProps)
+ for (const Property& rSourceProp : aSourceProps)
{
- if ( xDestProps->hasPropertyByName(pSourceProps->Name) )
+ if ( xDestProps->hasPropertyByName(rSourceProp.Name) )
{
try
{
- aDestProp = xDestProps->getPropertyByName(pSourceProps->Name);
+ aDestProp = xDestProps->getPropertyByName(rSourceProp.Name);
if (0 == (aDestProp.Attributes & PropertyAttribute::READONLY) )
{
- const Any aSourceValue = _rxSource->getPropertyValue(pSourceProps->Name);
+ const Any aSourceValue = _rxSource->getPropertyValue(rSourceProp.Name);
if ( 0 != (aDestProp.Attributes & PropertyAttribute::MAYBEVOID) || aSourceValue.hasValue() )
- _rxDest->setPropertyValue(pSourceProps->Name, aSourceValue);
+ _rxDest->setPropertyValue(rSourceProp.Name, aSourceValue);
}
}
catch (Exception&)
@@ -92,7 +91,7 @@ void copyProperties(const Reference<XPropertySet>& _rxSource,
#if OSL_DEBUG_LEVEL > 0
OUStringBuffer aBuffer;
aBuffer.append( "::comphelper::copyProperties: could not copy property '" );
- aBuffer.append( pSourceProps->Name );
+ aBuffer.append(rSourceProp.Name );
aBuffer.append( "' to the destination set (a '" );
Reference< XServiceInfo > xSI( _rxDest, UNO_QUERY );