diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-22 14:52:24 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-23 09:01:46 +0200 |
commit | 2684aefcf5d2804351bda01a2d2fe7bbbd351451 (patch) | |
tree | 5c19a705883a068a4945d7e49376296e341cb191 /comphelper/source | |
parent | 1fde962b71860d77fb10e9b16c9d5b6c124d9b61 (diff) |
new loplugin unnecessarycatchthrow
Change-Id: Iabab71ee076227bc38447ec109afaea1e53a86a6
Reviewed-on: https://gerrit.libreoffice.org/42643
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'comphelper/source')
-rw-r--r-- | comphelper/source/property/propagg.cxx | 148 |
1 files changed, 70 insertions, 78 deletions
diff --git a/comphelper/source/property/propagg.cxx b/comphelper/source/property/propagg.cxx index 43f461921fac..dd97cee7f4fe 100644 --- a/comphelper/source/property/propagg.cxx +++ b/comphelper/source/property/propagg.cxx @@ -638,109 +638,101 @@ void SAL_CALL OPropertySetAggregationHelper::setPropertyValues( { const css::uno::Any* pValues = _rValues.getConstArray(); - try - { - // dividing the Names and _rValues + // dividing the Names and _rValues - // aggregate's names - Sequence< OUString > AggPropertyNames( nAggCount ); - OUString* pAggNames = AggPropertyNames.getArray(); - // aggregate's values - Sequence< Any > AggValues( nAggCount ); - Any* pAggValues = AggValues.getArray(); + // aggregate's names + Sequence< OUString > AggPropertyNames( nAggCount ); + OUString* pAggNames = AggPropertyNames.getArray(); + // aggregate's values + Sequence< Any > AggValues( nAggCount ); + Any* pAggValues = AggValues.getArray(); - // delegator names - Sequence< OUString > DelPropertyNames( nLen - nAggCount ); - OUString* pDelNames = DelPropertyNames.getArray(); + // delegator names + Sequence< OUString > DelPropertyNames( nLen - nAggCount ); + OUString* pDelNames = DelPropertyNames.getArray(); - // delegator values - Sequence< Any > DelValues( nLen - nAggCount ); - Any* pDelValues = DelValues.getArray(); + // delegator values + Sequence< Any > DelValues( nLen - nAggCount ); + Any* pDelValues = DelValues.getArray(); - for ( sal_Int32 i = 0; i < nLen; ++i, ++pNames, ++pValues ) + for ( sal_Int32 i = 0; i < nLen; ++i, ++pNames, ++pValues ) + { + if ( OPropertyArrayAggregationHelper::PropertyOrigin::Aggregate == rPH.classifyProperty( *pNames ) ) { - if ( OPropertyArrayAggregationHelper::PropertyOrigin::Aggregate == rPH.classifyProperty( *pNames ) ) - { - *pAggNames++ = *pNames; - *pAggValues++ = *pValues; - } - else - { - *pDelNames++ = *pNames; - *pDelValues++ = *pValues; - } + *pAggNames++ = *pNames; + *pAggValues++ = *pValues; } + else + { + *pDelNames++ = *pNames; + *pDelValues++ = *pValues; + } + } - // reset, needed below - pDelValues = DelValues.getArray(); + // reset, needed below + pDelValues = DelValues.getArray(); - std::unique_ptr<sal_Int32[]> pHandles(new sal_Int32[ nLen - nAggCount ]); + std::unique_ptr<sal_Int32[]> pHandles(new sal_Int32[ nLen - nAggCount ]); - // get the map table - cppu::IPropertyArrayHelper& rPH2 = getInfoHelper(); + // get the map table + cppu::IPropertyArrayHelper& rPH2 = getInfoHelper(); - // fill the handle array - sal_Int32 nHitCount = rPH2.fillHandles( pHandles.get(), DelPropertyNames ); - if (nHitCount != 0) - { - std::unique_ptr< css::uno::Any[]> pConvertedValues(new css::uno::Any[ nHitCount ]); - std::unique_ptr< css::uno::Any[]> pOldValues(new css::uno::Any[ nHitCount ]); - nHitCount = 0; - sal_Int32 i; + // fill the handle array + sal_Int32 nHitCount = rPH2.fillHandles( pHandles.get(), DelPropertyNames ); + if (nHitCount != 0) + { + std::unique_ptr< css::uno::Any[]> pConvertedValues(new css::uno::Any[ nHitCount ]); + std::unique_ptr< css::uno::Any[]> pOldValues(new css::uno::Any[ nHitCount ]); + nHitCount = 0; + sal_Int32 i; + { + // must lock the mutex outside the loop. So all values are consistent. + osl::MutexGuard aGuard( rBHelper.rMutex ); + for( i = 0; i < (nLen - nAggCount); ++i ) { - // must lock the mutex outside the loop. So all values are consistent. - osl::MutexGuard aGuard( rBHelper.rMutex ); - for( i = 0; i < (nLen - nAggCount); ++i ) + if( pHandles[i] != -1 ) { - if( pHandles[i] != -1 ) + sal_Int16 nAttributes; + rPH2.fillPropertyMembersByHandle( nullptr, &nAttributes, pHandles[i] ); + if( nAttributes & css::beans::PropertyAttribute::READONLY ) + throw css::beans::PropertyVetoException(); + // Will the property change? + if( convertFastPropertyValue( pConvertedValues[ nHitCount ], pOldValues[nHitCount], + pHandles[i], pDelValues[i] ) ) { - sal_Int16 nAttributes; - rPH2.fillPropertyMembersByHandle( nullptr, &nAttributes, pHandles[i] ); - if( nAttributes & css::beans::PropertyAttribute::READONLY ) - throw css::beans::PropertyVetoException(); - // Will the property change? - if( convertFastPropertyValue( pConvertedValues[ nHitCount ], pOldValues[nHitCount], - pHandles[i], pDelValues[i] ) ) - { - // only increment if the property really change - pHandles[nHitCount] = pHandles[i]; - nHitCount++; - } + // only increment if the property really change + pHandles[nHitCount] = pHandles[i]; + nHitCount++; } } - // release guard to fire events } + // release guard to fire events + } - // fire vetoable events - fire( pHandles.get(), pConvertedValues.get(), pOldValues.get(), nHitCount, true ); + // fire vetoable events + fire( pHandles.get(), pConvertedValues.get(), pOldValues.get(), nHitCount, true ); - // setting the agg Properties - m_xAggregateMultiSet->setPropertyValues(AggPropertyNames, AggValues); + // setting the agg Properties + m_xAggregateMultiSet->setPropertyValues(AggPropertyNames, AggValues); + { + // must lock the mutex outside the loop. + osl::MutexGuard aGuard( rBHelper.rMutex ); + // Loop over all changed properties + for( i = 0; i < nHitCount; i++ ) { - // must lock the mutex outside the loop. - osl::MutexGuard aGuard( rBHelper.rMutex ); - // Loop over all changed properties - for( i = 0; i < nHitCount; i++ ) - { - // Will the property change? - setFastPropertyValue_NoBroadcast( pHandles[i], pConvertedValues[i] ); - } - // release guard to fire events + // Will the property change? + setFastPropertyValue_NoBroadcast( pHandles[i], pConvertedValues[i] ); } - - // fire change events - fire( pHandles.get(), pConvertedValues.get(), pOldValues.get(), nHitCount, false ); + // release guard to fire events } - else - m_xAggregateMultiSet->setPropertyValues(AggPropertyNames, AggValues); + // fire change events + fire( pHandles.get(), pConvertedValues.get(), pOldValues.get(), nHitCount, false ); } - catch(css::uno::Exception&) - { - throw; - } + else + m_xAggregateMultiSet->setPropertyValues(AggPropertyNames, AggValues); } } } |