cui/source/dialogs/hlinettp.cxx |   10 +++++-----
 cui/source/inc/hlinettp.hxx     |    6 +++++-
 2 files changed, 10 insertions(+), 6 deletions(-)

New commits:
commit 7c2c5400cb1726112165482cc6074a88351edfae
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Thu Sep 23 07:29:55 2021 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Thu Sep 23 08:51:16 2021 +0200

    Extend loplugin:stringviewparam to starts/endsWith: cui
    
    Change-Id: I96bbf66fa62784f0a4de61b627d6e21b665a4edc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122505
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/cui/source/dialogs/hlinettp.cxx b/cui/source/dialogs/hlinettp.cxx
index afa7b3e4e602..19153270a600 100644
--- a/cui/source/dialogs/hlinettp.cxx
+++ b/cui/source/dialogs/hlinettp.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <o3tl/string_view.hxx>
 #include <unotools/useroptions.hxx>
 #include <svl/adrparse.hxx>
 
@@ -24,7 +25,6 @@
 #include <hlmarkwn_def.hxx>
 
 constexpr OUStringLiteral sAnonymous = u"anonymous";
-char const sFTPScheme[]    = INET_FTP_SCHEME;
 
 /*************************************************************************
 |*
@@ -92,7 +92,7 @@ void SvxHyperlinkInternetTp::FillDlgFields(const OUString& 
rStrURL)
     OUString aStrScheme(GetSchemeFromURL(rStrURL));
 
     // set additional controls for FTP: Username / Password
-    if (aStrScheme.startsWith(sFTPScheme))
+    if (aStrScheme.startsWith(INET_FTP_SCHEME))
     {
         if ( aURL.GetUser().toAsciiLowerCase().startsWith( sAnonymous ) )
             setAnonymousFTPUser();
@@ -238,10 +238,10 @@ IMPL_LINK_NOARG(SvxHyperlinkInternetTp, 
ModifiedLoginHdl_Impl, weld::Entry&, voi
     }
 }
 
-void SvxHyperlinkInternetTp::SetScheme(const OUString& rScheme)
+void SvxHyperlinkInternetTp::SetScheme(std::u16string_view rScheme)
 {
     //if rScheme is empty or unknown the default behaviour is like it where 
HTTP
-    bool bFTP = rScheme.startsWith(sFTPScheme);
+    bool bFTP = o3tl::starts_with(rScheme, u"" INET_FTP_SCHEME);
     bool bInternet = !bFTP;
 
     //update protocol button selection:
@@ -260,7 +260,7 @@ void SvxHyperlinkInternetTp::SetScheme(const OUString& 
rScheme)
     m_xCbAnonymous->set_visible( bFTP );
 
     //update 'link target in document'-window and opening-button
-    if (rScheme.startsWith(INET_HTTP_SCHEME) || rScheme.isEmpty())
+    if (o3tl::starts_with(rScheme, u"" INET_HTTP_SCHEME) || rScheme.empty())
     {
         if ( m_bMarkWndOpen )
             ShowMarkWnd ();
diff --git a/cui/source/inc/hlinettp.hxx b/cui/source/inc/hlinettp.hxx
index e8eb96e6883d..c2340fdde2f7 100644
--- a/cui/source/inc/hlinettp.hxx
+++ b/cui/source/inc/hlinettp.hxx
@@ -18,6 +18,10 @@
  */
 #pragma once
 
+#include <sal/config.h>
+
+#include <string_view>
+
 #include "cuihyperdlg.hxx"
 #include "hltpbase.hxx"
 
@@ -54,7 +58,7 @@ private:
     DECL_LINK( TimeoutHdl_Impl,             Timer *, void); ///< Handler for 
timer -timeout
 
 
-    void    SetScheme(const OUString& rScheme);
+    void    SetScheme(std::u16string_view rScheme);
     void    RemoveImproperProtocol(std::u16string_view rProperScheme);
     OUString  GetSchemeFromButtons() const;
     INetProtocol GetSmartProtocolFromButtons() const;

Reply via email to