summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-15 16:47:26 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-04-15 21:33:17 +0200
commit65e846d73c023cb8ed8a8393a91032d4a816f2a0 (patch)
tree39ffe06f469d5d88ce7817338e359fff11f0210c
parent15d8762dd07289447e782a3812dfd4425fe9a82b (diff)
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.grandin@collabora.co.uk>
-rw-r--r--jvmfwk/inc/fwkutil.hxx2
-rw-r--r--jvmfwk/plugins/sunmajor/pluginlib/util.cxx6
-rw-r--r--jvmfwk/plugins/sunmajor/pluginlib/util.hxx2
-rw-r--r--jvmfwk/source/fwkutil.cxx6
4 files changed, 8 insertions, 8 deletions
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()