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

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Wed Sep 22 16:55:33 UTC 2021


 unotools/source/config/dynamicmenuoptions.cxx |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 8d65f68f98950efe7cb117d7ad228bab79ad0ddb
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Sep 22 17:15:46 2021 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed Sep 22 18:54:52 2021 +0200

    Extend loplugin:stringviewparam to starts/endsWith: unotools
    
    Change-Id: Ie8c73d187045d9def8f462ab7d37830331eabd4d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122470
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/unotools/source/config/dynamicmenuoptions.cxx b/unotools/source/config/dynamicmenuoptions.cxx
index 14ce7bb87aa5..38138797f149 100644
--- a/unotools/source/config/dynamicmenuoptions.cxx
+++ b/unotools/source/config/dynamicmenuoptions.cxx
@@ -19,6 +19,7 @@
 
 #include <sal/config.h>
 
+#include <o3tl/string_view.hxx>
 #include <sal/log.hxx>
 #include <unotools/dynamicmenuoptions.hxx>
 #include <tools/debug.hxx>
@@ -30,6 +31,7 @@
 
 #include <vector>
 #include <algorithm>
+#include <string_view>
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::beans;
@@ -51,7 +53,7 @@ constexpr OUStringLiteral SETNODE_WIZARDMENU = u"Wizard";
 
 #define PROPERTYCOUNT                                   4
 
-constexpr OUStringLiteral PATHPREFIX_SETUP = u"m";
+constexpr std::u16string_view PATHPREFIX_SETUP = u"m";
 
 namespace
 {
@@ -300,10 +302,10 @@ static void lcl_SortAndExpandPropertyNames( const Sequence< OUString >& lSource
     };
     struct SelectByPrefix
     {
-        bool operator() ( const OUString& s ) const
+        bool operator() ( std::u16string_view s ) const
         {
             // Prefer setup written entries by check first letter of given string. It must be a "s".
-            return s.startsWith( PATHPREFIX_SETUP );
+            return o3tl::starts_with( s, PATHPREFIX_SETUP );
         }
     };
 


More information about the Libreoffice-commits mailing list