diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-03 15:56:20 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-03 21:54:34 +0200 |
commit | c82dae439e8081fdcbfe68b2f2bc04190077a111 (patch) | |
tree | 5501175c92156aa20605ca11bbb525ba83c03b55 /ucbhelper/source/client | |
parent | 186c34af5d5758b940cf84471b3464af764d8bb7 (diff) |
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@collabora.co.uk>
Diffstat (limited to 'ucbhelper/source/client')
-rw-r--r-- | ucbhelper/source/client/content.cxx | 24 | ||||
-rw-r--r-- | ucbhelper/source/client/proxydecider.cxx | 156 |
2 files changed, 90 insertions, 90 deletions
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 |