cui/source/dialogs/hldoctp.cxx            |   13 ++++++-------
 cui/source/dialogs/hlinettp.cxx           |    4 ++--
 extensions/source/bibliography/datman.cxx |    2 +-
 forms/source/helper/urltransformer.cxx    |    4 ++--
 forms/source/inc/urltransformer.hxx       |    2 +-
 include/tools/urlobj.hxx                  |   12 ++++++------
 6 files changed, 18 insertions(+), 19 deletions(-)

New commits:
commit 4bc44490f51f7cc4a36cc7131137018da986c293
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Nov 19 10:54:03 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Nov 19 12:56:36 2021 +0100

    loplugin:stringliteraldefine in tools
    
    Change-Id: I348b9a844c009f9c19301baa76d31b12f67c6130
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125535
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/cui/source/dialogs/hldoctp.cxx b/cui/source/dialogs/hldoctp.cxx
index 8bfe89465962..152a7ec7fbc1 100644
--- a/cui/source/dialogs/hldoctp.cxx
+++ b/cui/source/dialogs/hldoctp.cxx
@@ -26,7 +26,6 @@
 #include <hlmarkwn_def.hxx>
 
 char const sHash[]          = "#";
-char const sFileScheme[]    = INET_FILE_SCHEME;
 
 /*************************************************************************
 |*
@@ -135,7 +134,7 @@ void SvxHyperlinkDocTp::GetCurentItemData ( OUString& 
rStrURL, OUString& aStrNam
     // get data from standard-fields
     rStrURL = GetCurrentURL();
 
-    if( rStrURL.equalsIgnoreAsciiCase( sFileScheme ) )
+    if( rStrURL.equalsIgnoreAsciiCase( INET_FILE_SCHEME ) )
          rStrURL.clear();
 
     GetDataFromCommonFields( aStrName, aStrIntName, aStrFrame, eMode );
@@ -174,7 +173,7 @@ IMPL_LINK_NOARG(SvxHyperlinkDocTp, ClickFileopenHdl_Impl, 
weld::Button&, void)
         css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 
FileDialogFlags::NONE,
         mpDialog->getDialog() );
     OUString aOldURL( GetCurrentURL() );
-    if( aOldURL.startsWithIgnoreAsciiCase( sFileScheme ) )
+    if( aOldURL.startsWithIgnoreAsciiCase( INET_FILE_SCHEME ) )
     {
         OUString aPath;
         osl::FileBase::getSystemPathFromFileURL(aOldURL, aPath);
@@ -210,14 +209,14 @@ IMPL_LINK_NOARG(SvxHyperlinkDocTp, ClickTargetHdl_Impl, 
weld::Button&, void)
 
     if ( GetPathType ( maStrURL ) == EPathType::ExistsFile  ||
          maStrURL.isEmpty() ||
-         maStrURL.equalsIgnoreAsciiCase( sFileScheme ) ||
+         maStrURL.equalsIgnoreAsciiCase( INET_FILE_SCHEME ) ||
          maStrURL.startsWith( sHash ) )
     {
         mxMarkWnd->SetError( LERR_NOERROR );
 
         weld::WaitObject aWait(mpDialog->getDialog());
 
-        if ( maStrURL.equalsIgnoreAsciiCase( sFileScheme ) )
+        if ( maStrURL.equalsIgnoreAsciiCase( INET_FILE_SCHEME ) )
             mxMarkWnd->RefreshTree ( "" );
         else
             mxMarkWnd->RefreshTree ( maStrURL );
@@ -250,11 +249,11 @@ IMPL_LINK_NOARG(SvxHyperlinkDocTp, TimeoutHdl_Impl, Timer 
*, void)
 {
     if ( IsMarkWndVisible() && ( GetPathType( maStrURL )== 
EPathType::ExistsFile ||
                                   maStrURL.isEmpty() ||
-                                  maStrURL.equalsIgnoreAsciiCase( sFileScheme 
) ) )
+                                  maStrURL.equalsIgnoreAsciiCase( 
INET_FILE_SCHEME ) ) )
     {
         weld::WaitObject aWait(mpDialog->getDialog());
 
-        if ( maStrURL.equalsIgnoreAsciiCase( sFileScheme ) )
+        if ( maStrURL.equalsIgnoreAsciiCase( INET_FILE_SCHEME ) )
             mxMarkWnd->RefreshTree ( "" );
         else
             mxMarkWnd->RefreshTree ( maStrURL );
diff --git a/cui/source/dialogs/hlinettp.cxx b/cui/source/dialogs/hlinettp.cxx
index 19153270a600..c26420d5703a 100644
--- a/cui/source/dialogs/hlinettp.cxx
+++ b/cui/source/dialogs/hlinettp.cxx
@@ -241,7 +241,7 @@ IMPL_LINK_NOARG(SvxHyperlinkInternetTp, 
ModifiedLoginHdl_Impl, weld::Entry&, voi
 void SvxHyperlinkInternetTp::SetScheme(std::u16string_view rScheme)
 {
     //if rScheme is empty or unknown the default behaviour is like it where 
HTTP
-    bool bFTP = o3tl::starts_with(rScheme, u"" INET_FTP_SCHEME);
+    bool bFTP = o3tl::starts_with(rScheme, INET_FTP_SCHEME);
     bool bInternet = !bFTP;
 
     //update protocol button selection:
@@ -260,7 +260,7 @@ void SvxHyperlinkInternetTp::SetScheme(std::u16string_view 
rScheme)
     m_xCbAnonymous->set_visible( bFTP );
 
     //update 'link target in document'-window and opening-button
-    if (o3tl::starts_with(rScheme, u"" INET_HTTP_SCHEME) || rScheme.empty())
+    if (o3tl::starts_with(rScheme, INET_HTTP_SCHEME) || rScheme.empty())
     {
         if ( m_bMarkWndOpen )
             ShowMarkWnd ();
diff --git a/extensions/source/bibliography/datman.cxx 
b/extensions/source/bibliography/datman.cxx
index e53d2b0392b9..24dd48de477e 100644
--- a/extensions/source/bibliography/datman.cxx
+++ b/extensions/source/bibliography/datman.cxx
@@ -1119,7 +1119,7 @@ Reference< awt::XControlModel > 
BibDataManager::createGridModel(const OUString&
         if (xPropInfo->hasPropertyByName(uProp))
         {
             xPropSet->setPropertyValue(
-                uProp, makeAny<OUString>(INET_HID_SCHEME HID_BIB_DB_GRIDCTRL));
+                uProp, makeAny<OUString>(INET_HID_SCHEME + 
HID_BIB_DB_GRIDCTRL));
         }
     }
     catch (const Exception&)
diff --git a/forms/source/helper/urltransformer.cxx 
b/forms/source/helper/urltransformer.cxx
index 10f664705e61..d166a85f6c39 100644
--- a/forms/source/helper/urltransformer.cxx
+++ b/forms/source/helper/urltransformer.cxx
@@ -71,10 +71,10 @@ namespace frm
     }
 
 
-    void UrlTransformer::parseSmartWithAsciiProtocol( css::util::URL& _rURL, 
const char* _pAsciiURL ) const
+    void UrlTransformer::parseSmartWithAsciiProtocol( css::util::URL& _rURL, 
const OUString& _rAsciiURL ) const
     {
         if ( implEnsureTransformer() )
-            m_xTransformer->parseSmart( _rURL, OUString::createFromAscii( 
_pAsciiURL ) );
+            m_xTransformer->parseSmart( _rURL, _rAsciiURL );
     }
 
 
diff --git a/forms/source/inc/urltransformer.hxx 
b/forms/source/inc/urltransformer.hxx
index e11661176b92..191313c431b5 100644
--- a/forms/source/inc/urltransformer.hxx
+++ b/forms/source/inc/urltransformer.hxx
@@ -52,7 +52,7 @@ namespace frm
         /** parses a given URL smartly, with a protocol given by ASCII string
         */
         void
-            parseSmartWithAsciiProtocol( css::util::URL& _rURL, const char* 
_pAsciiURL ) const;
+            parseSmartWithAsciiProtocol( css::util::URL& _rURL, const 
OUString& _rAsciiURL ) const;
 
     private:
         /** ensures that we have a URLTransformer instance in 
<member>m_xTransformer</member>
diff --git a/include/tools/urlobj.hxx b/include/tools/urlobj.hxx
index 7bb85917f952..6b9dece8bdf3 100644
--- a/include/tools/urlobj.hxx
+++ b/include/tools/urlobj.hxx
@@ -37,12 +37,12 @@ namespace com::sun::star::util {
 namespace com::sun::star::uno { template <typename > class Reference; }
 
 // Common URL prefixes for various schemes:
-#define INET_FTP_SCHEME "ftp://";
-#define INET_HTTP_SCHEME "http://";
-#define INET_HTTPS_SCHEME "https://";
-#define INET_FILE_SCHEME "file://"
-#define INET_MAILTO_SCHEME "mailto:";
-#define INET_HID_SCHEME "hid:"
+inline constexpr OUStringLiteral INET_FTP_SCHEME = u"ftp://";;
+inline constexpr OUStringLiteral INET_HTTP_SCHEME = u"http://";;
+inline constexpr OUStringLiteral INET_HTTPS_SCHEME = u"https://";;
+inline constexpr OUStringLiteral INET_FILE_SCHEME = u"file://";
+inline constexpr OUStringLiteral INET_MAILTO_SCHEME = u"mailto:";;
+inline constexpr OUStringLiteral INET_HID_SCHEME = u"hid:";
 
 #define URL_PREFIX_PRIV_SOFFICE "private:"
 

Reply via email to