summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-04-11 10:31:04 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-04-11 17:18:41 +0200
commit8ac1dd864bc535a25caa91c44e7d94b8b8ab9024 (patch)
tree559e733b4c38a795593a458d987ce2ee50136638 /include
parentdde90d1d06ab5f660d8f2cc729587698361e6748 (diff)
use more string_view in o3tl::equalsAscii
Change-Id: I1445a179e0007152b96436da4520c30a6fe6575c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150218 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r--include/o3tl/string_view.hxx8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/o3tl/string_view.hxx b/include/o3tl/string_view.hxx
index bdb554babf27..79d6eba702a1 100644
--- a/include/o3tl/string_view.hxx
+++ b/include/o3tl/string_view.hxx
@@ -22,10 +22,12 @@
namespace o3tl
{
-// Like OUString::equalsIgnoreAsciiCase, but for two std::u16string_view:
-inline bool equalsAscii(std::u16string_view s1, const char* s2)
+// Like OUString::equalsAscii, but for std::u16string_view:
+inline bool equalsAscii(std::u16string_view s1, std::string_view s2)
{
- return rtl_ustr_ascii_compare_WithLength(s1.data(), s1.size(), s2) == 0;
+ return s1.size() == s2.size()
+ && rtl_ustr_ascii_shortenedCompare_WithLength(s1.data(), s1.size(), s2.data(), s2.size())
+ == 0;
}
// Like OUString::equalsAsciiL, but for std::u16string_view: