diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2021-09-22 22:06:37 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2021-09-23 07:26:09 +0200 |
commit | 047a983314b560e0f64280ae2ac7d696d90d539b (patch) | |
tree | 332511030aa03bd18f84799295c123fad6c05976 /l10ntools | |
parent | cb3058aa4e3155d97d47d1444b808da7297b5794 (diff) |
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@redhat.com>
Diffstat (limited to 'l10ntools')
-rw-r--r-- | l10ntools/source/localize.cxx | 9 |
1 files changed, 5 insertions, 4 deletions
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" }; |