[Libreoffice-commits] core.git: ucbhelper/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Mon Aug 3 19:55:18 UTC 2020


 ucbhelper/source/client/content.cxx            |   24 -
 ucbhelper/source/client/proxydecider.cxx       |  156 ++++++------
 ucbhelper/source/provider/contenthelper.cxx    |  312 ++++++++++++-------------
 ucbhelper/source/provider/propertyvalueset.cxx |   80 +++---
 ucbhelper/source/provider/providerhelper.cxx   |   22 -
 ucbhelper/source/provider/resultset.cxx        |   26 +-
 ucbhelper/source/provider/resultsethelper.cxx  |   42 +--
 7 files changed, 331 insertions(+), 331 deletions(-)

New commits:
commit c82dae439e8081fdcbfe68b2f2bc04190077a111
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Aug 3 15:56:20 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Aug 3 21:54:34 2020 +0200

    loplugin:flatten in ucbhelper
    
    Change-Id: Ic5a8ce908671bd492395bff01aa211b8bdd74ca7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100008
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/ucbhelper/source/client/content.cxx b/ucbhelper/source/client/content.cxx
index 69e92b134ae6..8d01366d3ffc 100644
--- a/ucbhelper/source/client/content.cxx
+++ b/ucbhelper/source/client/content.cxx
@@ -1314,21 +1314,21 @@ css::uno::Any SAL_CALL ContentEventListener_Impl::queryInterface( const css::uno
 // virtual
 void SAL_CALL ContentEventListener_Impl::contentEvent( const ContentEvent& evt )
 {
-    if ( evt.Source == m_rContent.m_xContent )
+    if ( evt.Source != m_rContent.m_xContent )
+        return;
+
+    switch ( evt.Action )
     {
-        switch ( evt.Action )
-        {
-            case ContentAction::DELETED:
-                m_rContent.reinit( Reference< XContent >() );
-                break;
+        case ContentAction::DELETED:
+            m_rContent.reinit( Reference< XContent >() );
+            break;
 
-            case ContentAction::EXCHANGED:
-                m_rContent.reinit( evt.Content );
-                break;
+        case ContentAction::EXCHANGED:
+            m_rContent.reinit( evt.Content );
+            break;
 
-            default:
-                break;
-        }
+        default:
+            break;
     }
 }
 
diff --git a/ucbhelper/source/client/proxydecider.cxx b/ucbhelper/source/client/proxydecider.cxx
index a8ffd9599f34..fa1befd4be0c 100644
--- a/ucbhelper/source/client/proxydecider.cxx
+++ b/ucbhelper/source/client/proxydecider.cxx
@@ -819,104 +819,104 @@ void InternetProxyDecider_Impl::setNoProxyList(
 
     m_aNoProxyList.clear();
 
-    if ( !rNoProxyList.isEmpty() )
+    if ( rNoProxyList.isEmpty() )
+        return;
+
+    // List of connection endpoints hostname[:port],
+    // separated by semicolon. Wildcards allowed.
+
+    sal_Int32 nPos = 0;
+    sal_Int32 nEnd = rNoProxyList.indexOf( ';' );
+    sal_Int32 nLen = rNoProxyList.getLength();
+
+    do
     {
-        // List of connection endpoints hostname[:port],
-        // separated by semicolon. Wildcards allowed.
+        if ( nEnd == -1 )
+            nEnd = nLen;
 
-        sal_Int32 nPos = 0;
-        sal_Int32 nEnd = rNoProxyList.indexOf( ';' );
-        sal_Int32 nLen = rNoProxyList.getLength();
+        OUString aToken = rNoProxyList.copy( nPos, nEnd - nPos );
 
-        do
+        if ( !aToken.isEmpty() )
         {
-            if ( nEnd == -1 )
-                nEnd = nLen;
-
-            OUString aToken = rNoProxyList.copy( nPos, nEnd - nPos );
+            OUString aServer;
+            OUString aPort;
+
+            // numerical IPv6 address?
+            bool bIPv6Address = false;
+            sal_Int32 nClosedBracketPos = aToken.indexOf( ']' );
+            if ( nClosedBracketPos == -1 )
+                nClosedBracketPos = 0;
+            else
+                bIPv6Address = true;
 
-            if ( !aToken.isEmpty() )
+            sal_Int32 nColonPos = aToken.indexOf( ':', nClosedBracketPos );
+            if ( nColonPos == -1 )
             {
-                OUString aServer;
-                OUString aPort;
-
-                // numerical IPv6 address?
-                bool bIPv6Address = false;
-                sal_Int32 nClosedBracketPos = aToken.indexOf( ']' );
-                if ( nClosedBracketPos == -1 )
-                    nClosedBracketPos = 0;
-                else
-                    bIPv6Address = true;
-
-                sal_Int32 nColonPos = aToken.indexOf( ':', nClosedBracketPos );
-                if ( nColonPos == -1 )
+                // No port given, server pattern equals current token
+                aPort = "*";
+                if ( aToken.indexOf( '*' ) == -1 )
                 {
-                    // No port given, server pattern equals current token
-                    aPort = "*";
-                    if ( aToken.indexOf( '*' ) == -1 )
-                    {
-                        // pattern describes exactly one server
-                        aServer = aToken;
-                    }
-
-                    aToken += ":*";
+                    // pattern describes exactly one server
+                    aServer = aToken;
                 }
-                else
+
+                aToken += ":*";
+            }
+            else
+            {
+                // Port given, extract server pattern
+                sal_Int32 nAsteriskPos = aToken.indexOf( '*' );
+                aPort = aToken.copy( nColonPos + 1 );
+                if ( nAsteriskPos < nColonPos )
                 {
-                    // Port given, extract server pattern
-                    sal_Int32 nAsteriskPos = aToken.indexOf( '*' );
-                    aPort = aToken.copy( nColonPos + 1 );
-                    if ( nAsteriskPos < nColonPos )
-                    {
-                        // pattern describes exactly one server
-                        aServer = aToken.copy( 0, nColonPos );
-                    }
+                    // pattern describes exactly one server
+                    aServer = aToken.copy( 0, nColonPos );
                 }
+            }
 
-                OUStringBuffer aFullyQualifiedHost;
-                if ( !aServer.isEmpty() )
+            OUStringBuffer aFullyQualifiedHost;
+            if ( !aServer.isEmpty() )
+            {
+                // Remember fully qualified server name if current list
+                // entry specifies exactly one non-fully qualified server
+                // name.
+
+                // remove square brackets from host name in case it's
+                // a numerical IPv6 address.
+                if ( bIPv6Address )
+                    aServer = aServer.copy( 1, aServer.getLength() - 2 );
+
+                // This might be quite expensive (DNS lookup).
+                const osl::SocketAddr aAddr( aServer, 0 );
+                OUString aTmp = aAddr.getHostname().toAsciiLowerCase();
+                if ( aTmp != aServer.toAsciiLowerCase() )
                 {
-                    // Remember fully qualified server name if current list
-                    // entry specifies exactly one non-fully qualified server
-                    // name.
-
-                    // remove square brackets from host name in case it's
-                    // a numerical IPv6 address.
                     if ( bIPv6Address )
-                        aServer = aServer.copy( 1, aServer.getLength() - 2 );
-
-                    // This might be quite expensive (DNS lookup).
-                    const osl::SocketAddr aAddr( aServer, 0 );
-                    OUString aTmp = aAddr.getHostname().toAsciiLowerCase();
-                    if ( aTmp != aServer.toAsciiLowerCase() )
                     {
-                        if ( bIPv6Address )
-                        {
-                            aFullyQualifiedHost.append( "[" );
-                            aFullyQualifiedHost.append( aTmp );
-                            aFullyQualifiedHost.append( "]" );
-                        }
-                        else
-                        {
-                            aFullyQualifiedHost.append( aTmp );
-                        }
-                        aFullyQualifiedHost.append( ":" );
-                        aFullyQualifiedHost.append( aPort );
+                        aFullyQualifiedHost.append( "[" );
+                        aFullyQualifiedHost.append( aTmp );
+                        aFullyQualifiedHost.append( "]" );
                     }
+                    else
+                    {
+                        aFullyQualifiedHost.append( aTmp );
+                    }
+                    aFullyQualifiedHost.append( ":" );
+                    aFullyQualifiedHost.append( aPort );
                 }
-
-                m_aNoProxyList.emplace_back( WildCard( aToken ),
-                                      WildCard( aFullyQualifiedHost.makeStringAndClear() ) );
             }
 
-            if ( nEnd != nLen )
-            {
-                nPos = nEnd + 1;
-                nEnd = rNoProxyList.indexOf( ';', nPos );
-            }
+            m_aNoProxyList.emplace_back( WildCard( aToken ),
+                                  WildCard( aFullyQualifiedHost.makeStringAndClear() ) );
+        }
+
+        if ( nEnd != nLen )
+        {
+            nPos = nEnd + 1;
+            nEnd = rNoProxyList.indexOf( ';', nPos );
         }
-        while ( nEnd != nLen );
     }
+    while ( nEnd != nLen );
 }
 
 } // namespace proxydecider_impl
diff --git a/ucbhelper/source/provider/contenthelper.cxx b/ucbhelper/source/provider/contenthelper.cxx
index c29442978af8..32dff58783e6 100644
--- a/ucbhelper/source/provider/contenthelper.cxx
+++ b/ucbhelper/source/provider/contenthelper.cxx
@@ -402,60 +402,60 @@ void SAL_CALL ContentImplHelper::addProperty(
     OSL_ENSURE( xSet.is(),
                 "ContentImplHelper::addProperty - No property set!" );
 
-    if ( xSet.is() )
-    {
-        uno::Reference< beans::XPropertyContainer > xContainer(
-            xSet, uno::UNO_QUERY );
+    if ( !xSet.is() )
+        return;
 
-        OSL_ENSURE(
-            xContainer.is(),
-            "ContentImplHelper::addProperty - No property container!" );
+    uno::Reference< beans::XPropertyContainer > xContainer(
+        xSet, uno::UNO_QUERY );
 
-        if ( xContainer.is() )
-        {
-            // Property is always removable.
-            Attributes |= beans::PropertyAttribute::REMOVABLE;
+    OSL_ENSURE(
+        xContainer.is(),
+        "ContentImplHelper::addProperty - No property container!" );
 
-            try
-            {
-                xContainer->addProperty( Name, Attributes, DefaultValue );
-            }
-            catch ( beans::PropertyExistException const & )
-            {
-                OSL_FAIL( "ContentImplHelper::addProperty - Exists!" );
-                throw;
-            }
-            catch ( beans::IllegalTypeException const & )
-            {
-                OSL_FAIL( "ContentImplHelper::addProperty - Wrong Type!" );
-                throw;
-            }
-            catch ( lang::IllegalArgumentException const & )
-            {
-                OSL_FAIL( "ContentImplHelper::addProperty - Illegal Arg!" );
-                throw;
-            }
+    if ( !xContainer.is() )
+        return;
 
-            // Success!
+    // Property is always removable.
+    Attributes |= beans::PropertyAttribute::REMOVABLE;
 
-            if ( m_pImpl->m_xPropSetInfo.is() )
-            {
-                // Info cached in propertyset info is invalid now!
-                m_pImpl->m_xPropSetInfo->reset();
-            }
+    try
+    {
+        xContainer->addProperty( Name, Attributes, DefaultValue );
+    }
+    catch ( beans::PropertyExistException const & )
+    {
+        OSL_FAIL( "ContentImplHelper::addProperty - Exists!" );
+        throw;
+    }
+    catch ( beans::IllegalTypeException const & )
+    {
+        OSL_FAIL( "ContentImplHelper::addProperty - Wrong Type!" );
+        throw;
+    }
+    catch ( lang::IllegalArgumentException const & )
+    {
+        OSL_FAIL( "ContentImplHelper::addProperty - Illegal Arg!" );
+        throw;
+    }
 
-            // Notify propertyset info change listeners.
-            if ( m_pImpl->m_pPropSetChangeListeners &&
-                 m_pImpl->m_pPropSetChangeListeners->getLength() )
-            {
-                beans::PropertySetInfoChangeEvent evt(
-                            static_cast< cppu::OWeakObject * >( this ),
-                            Name,
-                            -1, // No handle available
-                            beans::PropertySetInfoChange::PROPERTY_INSERTED );
-                notifyPropertySetInfoChange( evt );
-            }
-        }
+    // Success!
+
+    if ( m_pImpl->m_xPropSetInfo.is() )
+    {
+        // Info cached in propertyset info is invalid now!
+        m_pImpl->m_xPropSetInfo->reset();
+    }
+
+    // Notify propertyset info change listeners.
+    if ( m_pImpl->m_pPropSetChangeListeners &&
+         m_pImpl->m_pPropSetChangeListeners->getLength() )
+    {
+        beans::PropertySetInfoChangeEvent evt(
+                    static_cast< cppu::OWeakObject * >( this ),
+                    Name,
+                    -1, // No handle available
+                    beans::PropertySetInfoChange::PROPERTY_INSERTED );
+        notifyPropertySetInfoChange( evt );
     }
 }
 
@@ -490,69 +490,69 @@ void SAL_CALL ContentImplHelper::removeProperty( const OUString& Name )
     // Open persistent property set, if exists.
     uno::Reference< css::ucb::XPersistentPropertySet > xSet(
         getAdditionalPropertySet( false ) );
-    if ( xSet.is() )
-    {
-        uno::Reference< beans::XPropertyContainer > xContainer(
-            xSet, uno::UNO_QUERY );
+    if ( !xSet.is() )
+        return;
 
-        OSL_ENSURE(
-            xContainer.is(),
-            "ContentImplHelper::removeProperty - No property container!" );
+    uno::Reference< beans::XPropertyContainer > xContainer(
+        xSet, uno::UNO_QUERY );
 
-        if ( xContainer.is() )
-        {
-            try
-            {
-                xContainer->removeProperty( Name );
-            }
-            catch ( beans::UnknownPropertyException const & )
-            {
-                OSL_FAIL( "ContentImplHelper::removeProperty - Unknown!" );
-                throw;
-            }
-            catch ( beans::NotRemoveableException const & )
-            {
-                OSL_FAIL(
-                    "ContentImplHelper::removeProperty - Unremovable!" );
-                throw;
-            }
+    OSL_ENSURE(
+        xContainer.is(),
+        "ContentImplHelper::removeProperty - No property container!" );
 
-            xContainer = nullptr;
+    if ( !xContainer.is() )
+        return;
 
-            // Success!
+    try
+    {
+        xContainer->removeProperty( Name );
+    }
+    catch ( beans::UnknownPropertyException const & )
+    {
+        OSL_FAIL( "ContentImplHelper::removeProperty - Unknown!" );
+        throw;
+    }
+    catch ( beans::NotRemoveableException const & )
+    {
+        OSL_FAIL(
+            "ContentImplHelper::removeProperty - Unremovable!" );
+        throw;
+    }
 
-            if ( !xSet->getPropertySetInfo()->getProperties().hasElements() )
-            {
-                // Remove empty propertyset from registry.
-                uno::Reference< css::ucb::XPropertySetRegistry >
-                    xReg = xSet->getRegistry();
-                if ( xReg.is() )
-                {
-                    OUString aKey( xSet->getKey() );
-                    xSet = nullptr;
-                    xReg->removePropertySet( aKey );
-                }
-            }
+    xContainer = nullptr;
 
-            if ( m_pImpl->m_xPropSetInfo.is() )
-            {
-                // Info cached in propertyset info is invalid now!
-                m_pImpl->m_xPropSetInfo->reset();
-            }
+    // Success!
 
-            // Notify propertyset info change listeners.
-            if ( m_pImpl->m_pPropSetChangeListeners &&
-                 m_pImpl->m_pPropSetChangeListeners->getLength() )
-            {
-                beans::PropertySetInfoChangeEvent evt(
-                            static_cast< cppu::OWeakObject * >( this ),
-                            Name,
-                            -1, // No handle available
-                            beans::PropertySetInfoChange::PROPERTY_REMOVED );
-                notifyPropertySetInfoChange( evt );
-            }
+    if ( !xSet->getPropertySetInfo()->getProperties().hasElements() )
+    {
+        // Remove empty propertyset from registry.
+        uno::Reference< css::ucb::XPropertySetRegistry >
+            xReg = xSet->getRegistry();
+        if ( xReg.is() )
+        {
+            OUString aKey( xSet->getKey() );
+            xSet = nullptr;
+            xReg->removePropertySet( aKey );
         }
     }
+
+    if ( m_pImpl->m_xPropSetInfo.is() )
+    {
+        // Info cached in propertyset info is invalid now!
+        m_pImpl->m_xPropSetInfo->reset();
+    }
+
+    // Notify propertyset info change listeners.
+    if ( m_pImpl->m_pPropSetChangeListeners &&
+         m_pImpl->m_pPropSetChangeListeners->getLength() )
+    {
+        beans::PropertySetInfoChangeEvent evt(
+                    static_cast< cppu::OWeakObject * >( this ),
+                    Name,
+                    -1, // No handle available
+                    beans::PropertySetInfoChange::PROPERTY_REMOVED );
+        notifyPropertySetInfoChange( evt );
+    }
 }
 
 // virtual
@@ -644,75 +644,75 @@ void ContentImplHelper::notifyPropertiesChange(
         return;
 
     sal_Int32 nCount = evt.getLength();
-    if ( nCount )
+    if ( !nCount )
+        return;
+
+    // First, notify listeners interested in changes of every property.
+    cppu::OInterfaceContainerHelper* pAllPropsContainer
+        = m_pImpl->m_pPropertyChangeListeners->getContainer(
+            OUString() );
+    if ( pAllPropsContainer )
     {
-        // First, notify listeners interested in changes of every property.
-        cppu::OInterfaceContainerHelper* pAllPropsContainer
-            = m_pImpl->m_pPropertyChangeListeners->getContainer(
-                OUString() );
-        if ( pAllPropsContainer )
+        cppu::OInterfaceIteratorHelper aIter( *pAllPropsContainer );
+        while ( aIter.hasMoreElements() )
         {
-            cppu::OInterfaceIteratorHelper aIter( *pAllPropsContainer );
-            while ( aIter.hasMoreElements() )
-            {
-                // Propagate event.
-                uno::Reference< beans::XPropertiesChangeListener > xListener(
-                    aIter.next(), uno::UNO_QUERY );
-                if ( xListener.is() )
-                    xListener->propertiesChange( evt );
-            }
+            // Propagate event.
+            uno::Reference< beans::XPropertiesChangeListener > xListener(
+                aIter.next(), uno::UNO_QUERY );
+            if ( xListener.is() )
+                xListener->propertiesChange( evt );
         }
+    }
 
-        PropertiesEventListenerMap aListeners;
+    PropertiesEventListenerMap aListeners;
 
-        for ( const beans::PropertyChangeEvent& rEvent : evt )
-        {
-            const OUString& rName = rEvent.PropertyName;
+    for ( const beans::PropertyChangeEvent& rEvent : evt )
+    {
+        const OUString& rName = rEvent.PropertyName;
 
-            cppu::OInterfaceContainerHelper* pPropsContainer
-                = m_pImpl->m_pPropertyChangeListeners->getContainer( rName );
-            if ( pPropsContainer )
+        cppu::OInterfaceContainerHelper* pPropsContainer
+            = m_pImpl->m_pPropertyChangeListeners->getContainer( rName );
+        if ( pPropsContainer )
+        {
+            cppu::OInterfaceIteratorHelper aIter( *pPropsContainer );
+            while ( aIter.hasMoreElements() )
             {
-                cppu::OInterfaceIteratorHelper aIter( *pPropsContainer );
-                while ( aIter.hasMoreElements() )
+                PropertyEventSequence* p = nullptr;
+
+                beans::XPropertiesChangeListener* pListener =
+                    static_cast< beans::XPropertiesChangeListener * >(
+                                                        aIter.next() );
+                PropertiesEventListenerMap::iterator it =
+                        aListeners.find( pListener );
+                if ( it == aListeners.end() )
                 {
-                    PropertyEventSequence* p = nullptr;
-
-                    beans::XPropertiesChangeListener* pListener =
-                        static_cast< beans::XPropertiesChangeListener * >(
-                                                            aIter.next() );
-                    PropertiesEventListenerMap::iterator it =
-                            aListeners.find( pListener );
-                    if ( it == aListeners.end() )
-                    {
-                        // Not in map - create and insert new entry.
-                        p = &aListeners.emplace( pListener, PropertyEventSequence(nCount)).first->second;
-                    }
-                    else
-                        p = &it->second;
-
-                    if ( p )
-                        p->append( rEvent );
+                    // Not in map - create and insert new entry.
+                    p = &aListeners.emplace( pListener, PropertyEventSequence(nCount)).first->second;
                 }
+                else
+                    p = &it->second;
+
+                if ( p )
+                    p->append( rEvent );
             }
         }
+    }
 
-        // Notify listeners.
-        PropertiesEventListenerMap::iterator it = aListeners.begin();
-        while ( !aListeners.empty() )
-        {
-            beans::XPropertiesChangeListener* pListener =
-                static_cast< beans::XPropertiesChangeListener * >( (*it).first );
-            PropertyEventSequence pSeq = std::move(it->second);
+    // Notify listeners.
+    PropertiesEventListenerMap::iterator it = aListeners.begin();
+    while ( !aListeners.empty() )
+    {
+        beans::XPropertiesChangeListener* pListener =
+            static_cast< beans::XPropertiesChangeListener * >( (*it).first );
+        PropertyEventSequence pSeq = std::move(it->second);
 
-            // Remove current element.
-            aListeners.erase( it );
+        // Remove current element.
+        aListeners.erase( it );
 
-            // Propagate event.
-            pListener->propertiesChange( pSeq.getEvents() );
+        // Propagate event.
+        pListener->propertiesChange( pSeq.getEvents() );
 
-            it = aListeners.begin();
-        }
+        it = aListeners.begin();
     }
 }
 
diff --git a/ucbhelper/source/provider/propertyvalueset.cxx b/ucbhelper/source/provider/propertyvalueset.cxx
index 7c3be538dce8..0255a14337a6 100644
--- a/ucbhelper/source/provider/propertyvalueset.cxx
+++ b/ucbhelper/source/provider/propertyvalueset.cxx
@@ -604,53 +604,53 @@ void PropertyValueSet::appendVoid( const OUString& rPropName )
 void PropertyValueSet::appendPropertySet(
                                 const Reference< XPropertySet >& rxSet )
 {
-    if ( rxSet.is() )
+    if ( !rxSet.is() )
+        return;
+
+    Reference< XPropertySetInfo > xInfo = rxSet->getPropertySetInfo();
+    if ( !xInfo.is() )
+        return;
+
+    const Sequence< Property > aProps = xInfo->getProperties();
+
+    Reference< XPropertyAccess > xPropertyAccess( rxSet, UNO_QUERY );
+    if ( xPropertyAccess.is() )
     {
-        Reference< XPropertySetInfo > xInfo = rxSet->getPropertySetInfo();
-        if ( xInfo.is() )
-        {
-            const Sequence< Property > aProps = xInfo->getProperties();
+        // Efficient: Get all prop values with one ( remote) call.
+
+        const Sequence< css::beans::PropertyValue > aPropValues
+            = xPropertyAccess->getPropertyValues();
 
-            Reference< XPropertyAccess > xPropertyAccess( rxSet, UNO_QUERY );
-            if ( xPropertyAccess.is() )
+        for ( const css::beans::PropertyValue& rPropValue : aPropValues )
+        {
+            // Find info for current property value.
+            auto pProp = std::find_if(aProps.begin(), aProps.end(),
+                [&rPropValue](const Property& rProp) { return rProp.Name == rPropValue.Name; });
+            if (pProp != aProps.end())
             {
-                // Efficient: Get all prop values with one ( remote) call.
+                // Found!
+                appendObject( *pProp, rPropValue.Value );
+            }
+        }
+    }
+    else
+    {
+        // Get every single prop value with one ( remote) call.
 
-                const Sequence< css::beans::PropertyValue > aPropValues
-                    = xPropertyAccess->getPropertyValues();
+        for ( const Property& rProp : aProps )
+        {
+            try
+            {
+                Any aValue = rxSet->getPropertyValue( rProp.Name );
 
-                for ( const css::beans::PropertyValue& rPropValue : aPropValues )
-                {
-                    // Find info for current property value.
-                    auto pProp = std::find_if(aProps.begin(), aProps.end(),
-                        [&rPropValue](const Property& rProp) { return rProp.Name == rPropValue.Name; });
-                    if (pProp != aProps.end())
-                    {
-                        // Found!
-                        appendObject( *pProp, rPropValue.Value );
-                    }
-                }
+                if ( aValue.hasValue() )
+                    appendObject( rProp, aValue );
             }
-            else
+            catch (const UnknownPropertyException&)
+            {
+            }
+            catch (const WrappedTargetException&)
             {
-                // Get every single prop value with one ( remote) call.
-
-                for ( const Property& rProp : aProps )
-                {
-                    try
-                    {
-                        Any aValue = rxSet->getPropertyValue( rProp.Name );
-
-                        if ( aValue.hasValue() )
-                            appendObject( rProp, aValue );
-                    }
-                    catch (const UnknownPropertyException&)
-                    {
-                    }
-                    catch (const WrappedTargetException&)
-                    {
-                    }
-                }
             }
         }
     }
diff --git a/ucbhelper/source/provider/providerhelper.cxx b/ucbhelper/source/provider/providerhelper.cxx
index a2c2f21bdcc4..95fbe6a68453 100644
--- a/ucbhelper/source/provider/providerhelper.cxx
+++ b/ucbhelper/source/provider/providerhelper.cxx
@@ -181,19 +181,19 @@ void ContentProviderImplHelper::queryExistingContents(
 void ContentProviderImplHelper::registerNewContent(
     const uno::Reference< ucb::XContent > & xContent )
 {
-    if ( xContent.is() )
-    {
-        osl::MutexGuard aGuard( m_aMutex );
+    if ( !xContent.is() )
+        return;
 
-        cleanupRegisteredContents();
+    osl::MutexGuard aGuard( m_aMutex );
 
-        const OUString aURL(
-            xContent->getIdentifier()->getContentIdentifier() );
-        ucbhelper_impl::Contents::const_iterator it
-            = m_pImpl->m_aContents.find( aURL );
-        if ( it == m_pImpl->m_aContents.end() )
-            m_pImpl->m_aContents[ aURL ] = xContent;
-    }
+    cleanupRegisteredContents();
+
+    const OUString aURL(
+        xContent->getIdentifier()->getContentIdentifier() );
+    ucbhelper_impl::Contents::const_iterator it
+        = m_pImpl->m_aContents.find( aURL );
+    if ( it == m_pImpl->m_aContents.end() )
+        m_pImpl->m_aContents[ aURL ] = xContent;
 }
 
 uno::Reference< css::ucb::XPropertySetRegistry >
diff --git a/ucbhelper/source/provider/resultset.cxx b/ucbhelper/source/provider/resultset.cxx
index c8a8ba51bfd5..6d6fd5ee09b3 100644
--- a/ucbhelper/source/provider/resultset.cxx
+++ b/ucbhelper/source/provider/resultset.cxx
@@ -1404,22 +1404,22 @@ PropertySetInfo::PropertySetInfo(
     : m_pProps( new uno::Sequence< beans::Property >( nProps ) )
 {
 
-    if ( nProps )
-    {
-        const PropertyInfo* pEntry = pProps;
-        beans::Property* pProperties = m_pProps->getArray();
+    if ( !nProps )
+        return;
 
-        for ( sal_Int32 n = 0; n < nProps; ++n )
-        {
-            beans::Property& rProp = pProperties[ n ];
+    const PropertyInfo* pEntry = pProps;
+    beans::Property* pProperties = m_pProps->getArray();
 
-            rProp.Name       = OUString::createFromAscii( pEntry->pName );
-            rProp.Handle     = pEntry->nHandle;
-            rProp.Type       = pEntry->pGetCppuType();
-            rProp.Attributes = pEntry->nAttributes;
+    for ( sal_Int32 n = 0; n < nProps; ++n )
+    {
+        beans::Property& rProp = pProperties[ n ];
 
-            pEntry++;
-        }
+        rProp.Name       = OUString::createFromAscii( pEntry->pName );
+        rProp.Handle     = pEntry->nHandle;
+        rProp.Type       = pEntry->pGetCppuType();
+        rProp.Attributes = pEntry->nAttributes;
+
+        pEntry++;
     }
 }
 
diff --git a/ucbhelper/source/provider/resultsethelper.cxx b/ucbhelper/source/provider/resultsethelper.cxx
index e9c97dff46e7..5ff9e6c27483 100644
--- a/ucbhelper/source/provider/resultsethelper.cxx
+++ b/ucbhelper/source/provider/resultsethelper.cxx
@@ -231,30 +231,30 @@ void ResultSetImplHelper::init( bool bStatic )
 {
     osl::MutexGuard aGuard( m_aMutex );
 
-    if ( !m_bInitDone )
+    if ( m_bInitDone )
+        return;
+
+    if ( bStatic )
     {
-        if ( bStatic )
-        {
-            // virtual... derived class fills m_xResultSet1
-            initStatic();
+        // virtual... derived class fills m_xResultSet1
+        initStatic();
 
-            OSL_ENSURE( m_xResultSet1.is(),
-                        "ResultSetImplHelper::init - No 1st result set!" );
-            m_bStatic = true;
-        }
-        else
-        {
-            // virtual... derived class fills m_xResultSet1 and m_xResultSet2
-            initDynamic();
-
-            OSL_ENSURE( m_xResultSet1.is(),
-                        "ResultSetImplHelper::init - No 1st result set!" );
-            OSL_ENSURE( m_xResultSet2.is(),
-                        "ResultSetImplHelper::init - No 2nd result set!" );
-            m_bStatic = false;
-        }
-        m_bInitDone = true;
+        OSL_ENSURE( m_xResultSet1.is(),
+                    "ResultSetImplHelper::init - No 1st result set!" );
+        m_bStatic = true;
+    }
+    else
+    {
+        // virtual... derived class fills m_xResultSet1 and m_xResultSet2
+        initDynamic();
+
+        OSL_ENSURE( m_xResultSet1.is(),
+                    "ResultSetImplHelper::init - No 1st result set!" );
+        OSL_ENSURE( m_xResultSet2.is(),
+                    "ResultSetImplHelper::init - No 2nd result set!" );
+        m_bStatic = false;
     }
+    m_bInitDone = true;
 }
 
 } // namespace ucbhelper


More information about the Libreoffice-commits mailing list