jvmfwk/inc/fwkutil.hxx                     |    2 +-
 jvmfwk/plugins/sunmajor/pluginlib/util.cxx |    6 +++---
 jvmfwk/plugins/sunmajor/pluginlib/util.hxx |    2 +-
 jvmfwk/source/fwkutil.cxx                  |    6 +++---
 4 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 65e846d73c023cb8ed8a8393a91032d4a816f2a0
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Apr 15 16:47:26 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Apr 15 21:33:17 2022 +0200

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

diff --git a/jvmfwk/inc/fwkutil.hxx b/jvmfwk/inc/fwkutil.hxx
index 825355f42a47..76d437ae76b9 100644
--- a/jvmfwk/inc/fwkutil.hxx
+++ b/jvmfwk/inc/fwkutil.hxx
@@ -46,7 +46,7 @@ osl::Mutex& FwkMutex();
 rtl::ByteSequence encodeBase16(const rtl::ByteSequence& rawData);
 rtl::ByteSequence decodeBase16(const rtl::ByteSequence& data);
 
-OUString getDirFromFile(const OUString& usFilePath);
+OUString getDirFromFile(std::u16string_view usFilePath);
 
 enum FileStatus
 {
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx 
b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
index f7d786007544..b596e18cf480 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
@@ -1023,10 +1023,10 @@ Reference<VendorBase> 
createInstance(createInstance_func pFunc,
     return aBase;
 }
 
-inline OUString getDirFromFile(const OUString& usFilePath)
+inline OUString getDirFromFile(std::u16string_view usFilePath)
 {
-    sal_Int32 index = usFilePath.lastIndexOf('/');
-    return usFilePath.copy(0, index);
+    size_t index = usFilePath.rfind('/');
+    return OUString(usFilePath.substr(0, index));
 }
 
 void addJavaInfosFromPath(
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.hxx 
b/jvmfwk/plugins/sunmajor/pluginlib/util.hxx
index 78df074f9de3..9ba0055832ed 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/util.hxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/util.hxx
@@ -37,7 +37,7 @@ void addJREInfoFromBinPath(
     const OUString& path,
     std::vector<rtl::Reference<VendorBase>> & allInfos,
     std::vector<rtl::Reference<VendorBase>> & addedInfos);
-inline OUString getDirFromFile(const OUString& usFilePath);
+inline OUString getDirFromFile(std::u16string_view usFilePath);
 void addJavaInfosFromPath(
     std::vector<rtl::Reference<VendorBase>> & allInfos,
     std::vector<rtl::Reference<VendorBase>> & addedInfos);
diff --git a/jvmfwk/source/fwkutil.cxx b/jvmfwk/source/fwkutil.cxx
index ee083f064926..89cb2e5415cb 100644
--- a/jvmfwk/source/fwkutil.cxx
+++ b/jvmfwk/source/fwkutil.cxx
@@ -136,10 +136,10 @@ rtl::ByteSequence decodeBase16(const rtl::ByteSequence& 
data)
     return ret;
 }
 
-OUString getDirFromFile(const OUString& usFilePath)
+OUString getDirFromFile(std::u16string_view usFilePath)
 {
-    sal_Int32 index = usFilePath.lastIndexOf('/');
-    return usFilePath.copy(0, index);
+    size_t index = usFilePath.rfind('/');
+    return OUString(usFilePath.substr(0, index));
 }
 
 OUString getLibraryLocation()

Reply via email to