diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-18 11:35:04 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-18 21:46:33 +0200 |
commit | 8d4fd3418322f3f6852054c44be2cd74b0db76ee (patch) | |
tree | 683729e0d4beabca34ac017c9d291ab2b21e3f7e /comphelper/source/property/MasterPropertySet.cxx | |
parent | ed0097845a07b6129f4e56cd28b90ce9b9368cf5 (diff) |
loplugin:flatten in comphelper
Change-Id: I1a8db4dbd744b87406d1db5609585495f01f4403
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92478
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'comphelper/source/property/MasterPropertySet.cxx')
-rw-r--r-- | comphelper/source/property/MasterPropertySet.cxx | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/comphelper/source/property/MasterPropertySet.cxx b/comphelper/source/property/MasterPropertySet.cxx index 82f9d85d7525..e5e94b5ad46f 100644 --- a/comphelper/source/property/MasterPropertySet.cxx +++ b/comphelper/source/property/MasterPropertySet.cxx @@ -189,53 +189,53 @@ void SAL_CALL MasterPropertySet::setPropertyValues( const Sequence< OUString >& if( nCount != aValues.getLength() ) throw IllegalArgumentException(); - if( nCount ) - { - _preSetValues(); + if( !nCount ) + return; - const Any * pAny = aValues.getConstArray(); - const OUString * pString = aPropertyNames.getConstArray(); - PropertyDataHash::const_iterator aEnd = mxInfo->maMap.end(), aIter; + _preSetValues(); - //!! have a unique_ptr to an array of OGuards in order to have the - //!! allocated memory properly freed (exception safe!). - //!! Since the array itself has unique_ptrs as members we have to use a - //!! helper class 'AutoOGuardArray' in order to have - //!! the acquired locks properly released. - AutoOGuardArray aOGuardArray( nCount ); + const Any * pAny = aValues.getConstArray(); + const OUString * pString = aPropertyNames.getConstArray(); + PropertyDataHash::const_iterator aEnd = mxInfo->maMap.end(), aIter; - for ( sal_Int32 i = 0; i < nCount; ++i, ++pString, ++pAny ) - { - aIter = mxInfo->maMap.find ( *pString ); - if ( aIter == aEnd ) - throw RuntimeException( *pString, static_cast< XPropertySet* >( this ) ); + //!! have a unique_ptr to an array of OGuards in order to have the + //!! allocated memory properly freed (exception safe!). + //!! Since the array itself has unique_ptrs as members we have to use a + //!! helper class 'AutoOGuardArray' in order to have + //!! the acquired locks properly released. + AutoOGuardArray aOGuardArray( nCount ); - if ( (*aIter).second->mnMapId == 0 ) // 0 means it's one of ours ! - _setSingleValue( *((*aIter).second->mpInfo), *pAny ); - else + for ( sal_Int32 i = 0; i < nCount; ++i, ++pString, ++pAny ) + { + aIter = mxInfo->maMap.find ( *pString ); + if ( aIter == aEnd ) + throw RuntimeException( *pString, static_cast< XPropertySet* >( this ) ); + + if ( (*aIter).second->mnMapId == 0 ) // 0 means it's one of ours ! + _setSingleValue( *((*aIter).second->mpInfo), *pAny ); + else + { + SlaveData * pSlave = maSlaveMap [ (*aIter).second->mnMapId ]; + if (!pSlave->IsInit()) { - SlaveData * pSlave = maSlaveMap [ (*aIter).second->mnMapId ]; - if (!pSlave->IsInit()) - { - // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - if (pSlave->mxSlave->mpMutex) - aOGuardArray[i].reset( new osl::Guard< comphelper::SolarMutex >(pSlave->mxSlave->mpMutex) ); + // acquire mutex in c-tor and releases it in the d-tor (exception safe!). + if (pSlave->mxSlave->mpMutex) + aOGuardArray[i].reset( new osl::Guard< comphelper::SolarMutex >(pSlave->mxSlave->mpMutex) ); - pSlave->mxSlave->_preSetValues(); - pSlave->SetInit ( true ); - } - pSlave->mxSlave->_setSingleValue( *((*aIter).second->mpInfo), *pAny ); + pSlave->mxSlave->_preSetValues(); + pSlave->SetInit ( true ); } + pSlave->mxSlave->_setSingleValue( *((*aIter).second->mpInfo), *pAny ); } + } - _postSetValues(); - for( const auto& rSlave : maSlaveMap ) + _postSetValues(); + for( const auto& rSlave : maSlaveMap ) + { + if( rSlave.second->IsInit() ) { - if( rSlave.second->IsInit() ) - { - rSlave.second->mxSlave->_postSetValues(); - rSlave.second->SetInit( false ); - } + rSlave.second->mxSlave->_postSetValues(); + rSlave.second->SetInit( false ); } } } |