summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-21 15:39:10 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-04-22 13:29:24 +0200
commit08a72cbb06776e83475e70e0ee5d6c0ca572944e (patch)
treea659cb41c128bce18e4823f886081f9d77f0988d /comphelper
parentfa856bdd2757745f71d2ae1e31e90006a9cdaa4e (diff)
use more string_view in comphelper
Change-Id: Ib186d2c9aa8458ddbdd14dd44e2d3938f0f26ad2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133269 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/source/eventattachermgr/eventattachermgr.cxx8
-rw-r--r--comphelper/source/misc/DirectoryHelper.cxx18
2 files changed, 13 insertions, 13 deletions
diff --git a/comphelper/source/eventattachermgr/eventattachermgr.cxx b/comphelper/source/eventattachermgr/eventattachermgr.cxx
index 4c7be22c2bb1..a08c6cf4777a 100644
--- a/comphelper/source/eventattachermgr/eventattachermgr.cxx
+++ b/comphelper/source/eventattachermgr/eventattachermgr.cxx
@@ -456,10 +456,10 @@ void SAL_CALL ImplEventAttacherManager::revokeScriptEvent
for( const auto& rObj : aList )
detach( nIndex, rObj.xTarget );
- OUString aLstType = ListenerType;
- sal_Int32 nLastDot = aLstType.lastIndexOf('.');
- if (nLastDot != -1)
- aLstType = aLstType.copy(nLastDot+1);
+ std::u16string_view aLstType = ListenerType;
+ size_t nLastDot = aLstType.rfind('.');
+ if (nLastDot != std::u16string_view::npos)
+ aLstType = aLstType.substr(nLastDot+1);
auto aEvtIt = std::find_if(aIt->aEventList.begin(), aIt->aEventList.end(),
[&aLstType, &EventMethod, &ToRemoveListenerParam](const ScriptEventDescriptor& rEvent) {
diff --git a/comphelper/source/misc/DirectoryHelper.cxx b/comphelper/source/misc/DirectoryHelper.cxx
index 248e7af185b7..badfe9b62d80 100644
--- a/comphelper/source/misc/DirectoryHelper.cxx
+++ b/comphelper/source/misc/DirectoryHelper.cxx
@@ -19,24 +19,24 @@ namespace comphelper
{
typedef std::shared_ptr<osl::File> FileSharedPtr;
-OUString DirectoryHelper::splitAtLastToken(const OUString& rSrc, sal_Unicode aToken,
- OUString& rRight)
+std::u16string_view DirectoryHelper::splitAtLastToken(std::u16string_view rSrc, sal_Unicode aToken,
+ OUString& rRight)
{
- const sal_Int32 nIndex(rSrc.lastIndexOf(aToken));
- OUString aRetval;
+ const size_t nIndex(rSrc.rfind(aToken));
+ std::u16string_view aRetval;
- if (-1 == nIndex)
+ if (std::u16string_view::npos == nIndex)
{
aRetval = rSrc;
rRight.clear();
}
else if (nIndex > 0)
{
- aRetval = rSrc.copy(0, nIndex);
+ aRetval = rSrc.substr(0, nIndex);
- if (rSrc.getLength() > nIndex + 1)
+ if (rSrc.size() > nIndex + 1)
{
- rRight = rSrc.copy(nIndex + 1);
+ rRight = rSrc.substr(nIndex + 1);
}
}
@@ -210,4 +210,4 @@ bool DirectoryHelper::moveDirContent(const OUString& rSourceDirURL,
return bError;
}
-} \ No newline at end of file
+}