extensions/source/update/check/download.cxx | 9 +++++---- extensions/source/update/check/download.hxx | 6 +++++- 2 files changed, 10 insertions(+), 5 deletions(-)
New commits: commit 310d43b9a27efc36f2c9e6737a0b5ac3f211bda0 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Wed Sep 22 23:25:49 2021 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Thu Sep 23 07:26:38 2021 +0200 Extend loplugin:stringviewparam to starts/endsWith: extensions Change-Id: I29c3a09628f213d8b229a981d62421390385c54e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122499 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/extensions/source/update/check/download.cxx b/extensions/source/update/check/download.cxx index 1f98b7717be2..905d16e99a7f 100644 --- a/extensions/source/update/check/download.cxx +++ b/extensions/source/update/check/download.cxx @@ -23,6 +23,7 @@ #include <curl/curl.h> +#include <o3tl/string_view.hxx> #include <osl/diagnose.h> #include <osl/file.h> #include <com/sun/star/beans/PropertyValue.hpp> @@ -168,7 +169,7 @@ progress_callback( void *clientp, double dltotal, double dlnow, SAL_UNUSED_PARAM void -Download::getProxyForURL(const OUString& rURL, OString& rHost, sal_Int32& rPort) const +Download::getProxyForURL(std::u16string_view rURL, OString& rHost, sal_Int32& rPort) const { uno::Reference< lang::XMultiServiceFactory > xConfigProvider( css::configuration::theDefaultProvider::get( m_xContext ) ); @@ -191,17 +192,17 @@ Download::getProxyForURL(const OUString& rURL, OString& rHost, sal_Int32& rPort) sal_Int32 nProxyType = aValue.get< sal_Int32 >(); if( 0 != nProxyType ) // type 0 means "direct connection to the internet { - if( rURL.startsWith("http:") ) + if( o3tl::starts_with(rURL, u"http:") ) { rHost = getStringValue(xNameAccess, "ooInetHTTPProxyName"); rPort = getInt32Value(xNameAccess, "ooInetHTTPProxyPort"); } - else if( rURL.startsWith("https:") ) + else if( o3tl::starts_with(rURL, u"https:") ) { rHost = getStringValue(xNameAccess, "ooInetHTTPSProxyName"); rPort = getInt32Value(xNameAccess, "ooInetHTTPSProxyPort"); } - else if( rURL.startsWith("ftp:") ) + else if( o3tl::starts_with(rURL, u"ftp:") ) { rHost = getStringValue(xNameAccess, "ooInetFTPProxyName"); rPort = getInt32Value(xNameAccess, "ooInetFTPProxyPort"); diff --git a/extensions/source/update/check/download.hxx b/extensions/source/update/check/download.hxx index 2440ce4cec85..12a11ddde091 100644 --- a/extensions/source/update/check/download.hxx +++ b/extensions/source/update/check/download.hxx @@ -19,6 +19,10 @@ #pragma once +#include <sal/config.h> + +#include <string_view> + #include <com/sun/star/uno/XComponentContext.hpp> #include <rtl/ref.hxx> @@ -65,7 +69,7 @@ public: protected: // Determines the appropriate proxy settings for the given URL. Returns true if a proxy should be used - void getProxyForURL(const OUString& rURL, OString& rHost, sal_Int32& rPort) const; + void getProxyForURL(std::u16string_view rURL, OString& rHost, sal_Int32& rPort) const; private: osl::Condition m_aCondition;