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

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Thu Sep 23 05:26:43 UTC 2021


 l10ntools/source/localize.cxx |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 047a983314b560e0f64280ae2ac7d696d90d539b
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Sep 22 22:06:37 2021 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu Sep 23 07:26:09 2021 +0200

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

diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx
index 38e9c21f3cac..cede7837bdd3 100644
--- a/l10ntools/source/localize.cxx
+++ b/l10ntools/source/localize.cxx
@@ -29,6 +29,7 @@
 #include <vector>
 #include <algorithm>
 
+#include <o3tl/string_view.hxx>
 #include <osl/file.h>
 #include <osl/file.hxx>
 #include <osl/thread.h>
@@ -49,17 +50,17 @@ using namespace std;
 namespace {
 
 bool matchList(
-    const OUString& rUrl, const std::u16string_view* pList, size_t nLength)
+    std::u16string_view rUrl, const std::u16string_view* pList, size_t nLength)
 {
     for (size_t i = 0; i != nLength; ++i) {
-        if (rUrl.endsWith(pList[i])) {
+        if (o3tl::ends_with(rUrl, pList[i])) {
             return true;
         }
     }
     return false;
 }
 
-bool passesNegativeList(const OUString& rUrl) {
+bool passesNegativeList(std::u16string_view rUrl) {
     static const std::u16string_view list[] = {
         u"/desktop/test/deployment/passive/help/en/help.tree",
         u"/desktop/test/deployment/passive/help/en/main.xhp",
@@ -77,7 +78,7 @@ bool passesNegativeList(const OUString& rUrl) {
     return !matchList(rUrl, list, SAL_N_ELEMENTS(list));
 }
 
-bool passesPositiveList(const OUString& rUrl) {
+bool passesPositiveList(std::u16string_view rUrl) {
     static const std::u16string_view list[] = {
         u"/description.xml"
     };


More information about the Libreoffice-commits mailing list