include/o3tl/string_view.hxx           |    3 ++-
 unotools/source/config/bootstrap.cxx   |    6 +++---
 unotools/source/ucbhelper/tempfile.cxx |    8 ++++----
 3 files changed, 9 insertions(+), 8 deletions(-)

New commits:
commit af4407649d2c8a2ea59487d5fc1f8cc742ddd0b2
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Apr 14 13:46:06 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Apr 14 19:26:04 2022 +0200

    use more string_view in unotools
    
    Change-Id: I5fc3753475c3c6a45f86910eeb49055f96a2e925
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133013
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/unotools/source/config/bootstrap.cxx 
b/unotools/source/config/bootstrap.cxx
index 09c52157024b..ef7ba57000c1 100644
--- a/unotools/source/config/bootstrap.cxx
+++ b/unotools/source/config/bootstrap.cxx
@@ -413,12 +413,12 @@ char const IS_MISSING[] = "is missing";
 char const IS_INVALID[] = "is corrupt";
 char const PERIOD[] = ". ";
 
-static void addFileError(OUStringBuffer& _rBuf, OUString const& _aPath, 
AsciiString _sWhat)
+static void addFileError(OUStringBuffer& _rBuf, std::u16string_view _aPath, 
AsciiString _sWhat)
 {
-    OUString sSimpleFileName = _aPath.copy(1 
+_aPath.lastIndexOf(cURLSeparator));
+    std::u16string_view sSimpleFileName = _aPath.substr(1 
+_aPath.rfind(cURLSeparator));
 
     _rBuf.append("The configuration file");
-    _rBuf.append(" '" + sSimpleFileName + "' ");
+    _rBuf.append(OUString::Concat(" '") + sSimpleFileName + "' ");
     _rBuf.appendAscii(_sWhat).append(PERIOD);
 }
 
diff --git a/unotools/source/ucbhelper/tempfile.cxx 
b/unotools/source/ucbhelper/tempfile.cxx
index 4fac0bacd782..e912c609337b 100644
--- a/unotools/source/ucbhelper/tempfile.cxx
+++ b/unotools/source/ucbhelper/tempfile.cxx
@@ -47,14 +47,14 @@ namespace
 namespace utl
 {
 
-static OUString getParentName( const OUString& aFileName )
+static OUString getParentName( std::u16string_view aFileName )
 {
-    sal_Int32 lastIndex = aFileName.lastIndexOf( '/' );
+    size_t lastIndex = aFileName.rfind( '/' );
     OUString aParent;
 
-    if (lastIndex > -1)
+    if (lastIndex != std::u16string_view::npos)
     {
-        aParent = aFileName.copy(0, lastIndex);
+        aParent = aFileName.substr(0, lastIndex);
 
         if (aParent.endsWith(":") && aParent.getLength() == 6)
             aParent += "/";
commit 2a5b28eaaaf8ff56778fcdfb28f0a660592c7866
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Apr 14 13:16:58 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Apr 14 19:25:52 2022 +0200

    address review comments
    
    (*) fix parameter type of getToken()
    
    Change-Id: Ib6fcfc6b217e98f57e600dc44c888366b432c19e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133011
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/o3tl/string_view.hxx b/include/o3tl/string_view.hxx
index eb98e243c8b1..bf72c0b2b976 100644
--- a/include/o3tl/string_view.hxx
+++ b/include/o3tl/string_view.hxx
@@ -74,7 +74,8 @@ inline std::string_view getToken(std::string_view sv, char 
delimiter, std::size_
 {
     return getToken<char>(sv, delimiter, position);
 }
-inline std::u16string_view getToken(std::u16string_view sv, char delimiter, 
std::size_t& position)
+inline std::u16string_view getToken(std::u16string_view sv, char16_t delimiter,
+                                    std::size_t& position)
 {
     return getToken<char16_t>(sv, delimiter, position);
 }

Reply via email to