diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-02-22 12:59:26 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-03-08 07:06:13 +0100 |
commit | 7840effb1d5efd1fd7f6798c7c504b05292a7793 (patch) | |
tree | 845e03d4c2cfad1d5bbcaaf9dc3ec1aeece7c864 /configmgr | |
parent | bf35f2b36fc00f9b37397422b2ee425c6a697540 (diff) |
use more string_view
found by tweaking the stringview loplugin
Change-Id: I92203ba99642bef7951ffa146184c5562cb31d09
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163744
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'configmgr')
-rw-r--r-- | configmgr/source/access.cxx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx index 1e2d73dafe9c..c25cf73aaef0 100644 --- a/configmgr/source/access.cxx +++ b/configmgr/source/access.cxx @@ -84,6 +84,7 @@ #include <rtl/ustring.hxx> #include <sal/log.hxx> #include <sal/types.h> +#include <o3tl/string_view.hxx> #include "access.hxx" #include "broadcaster.hxx" @@ -109,9 +110,9 @@ namespace { // Conservatively forbid what is either not an XML Char (including lone // surrogates, even though they should not appear in well-formed UNO OUString // instances anyway), or is a slash (as it causes problems in path syntax): -bool isValidName(OUString const & name, bool setMember) { - for (sal_Int32 i = 0; i != name.getLength();) { - sal_uInt32 c = name.iterateCodePoints(&i); +bool isValidName(std::u16string_view name, bool setMember) { + for (sal_Int32 i = 0; i != static_cast<sal_Int32>(name.size());) { + sal_uInt32 c = o3tl::iterateCodePoints(name, &i); if ((c < 0x20 && !(c == 0x09 || c == 0x0A || c == 0x0D)) || rtl::isSurrogate(c) || c == 0xFFFE || c == 0xFFFF || (!setMember && c == '/')) @@ -119,7 +120,7 @@ bool isValidName(OUString const & name, bool setMember) { return false; } } - return !name.isEmpty(); + return !name.empty(); } } |