summaryrefslogtreecommitdiff
path: root/registry
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-01 17:42:34 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-04-02 13:31:19 +0200
commit1927b51993fb68907a75765676179b08ab195196 (patch)
tree1b7d09c1b5e7ea945fb6ea618a4c100e8630ebb4 /registry
parent0dfa444f393a5766d36fe7d2480d0c8ec832e329 (diff)
loplugin:stringviewparam convert methods using indexOf
.. and lastIndexOf, which convert to find and rfind Change-Id: I6c4156cf904774c0d867f85a4c2785dba7593f62 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132445 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'registry')
-rw-r--r--registry/source/regimpl.cxx14
-rw-r--r--registry/source/regimpl.hxx2
2 files changed, 8 insertions, 8 deletions
diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx
index 7a32772b2f38..0d69c64cd000 100644
--- a/registry/source/regimpl.cxx
+++ b/registry/source/regimpl.cxx
@@ -750,11 +750,11 @@ RegError ORegistry::deleteKey(RegKeyHandle hKey, std::u16string_view keyName)
return eraseKey(m_openKeyTable[ROOT], sFullKeyName);
}
-RegError ORegistry::eraseKey(ORegKey* pKey, const OUString& keyName)
+RegError ORegistry::eraseKey(ORegKey* pKey, std::u16string_view keyName)
{
RegError _ret = RegError::NO_ERROR;
- if (keyName.isEmpty())
+ if (keyName.empty())
{
return RegError::INVALID_KEYNAME;
}
@@ -762,18 +762,18 @@ RegError ORegistry::eraseKey(ORegKey* pKey, const OUString& keyName)
OUString sFullKeyName(pKey->getName());
OUString sFullPath(sFullKeyName);
OUString sRelativKey;
- sal_Int32 lastIndex = keyName.lastIndexOf('/');
+ size_t lastIndex = keyName.rfind('/');
- if (lastIndex >= 0)
+ if (lastIndex != std::u16string_view::npos)
{
- sRelativKey += keyName.subView(lastIndex + 1);
+ sRelativKey += keyName.substr(lastIndex + 1);
if (sFullKeyName.getLength() > 1)
sFullKeyName += keyName;
else
- sFullKeyName += keyName.subView(1);
+ sFullKeyName += keyName.substr(1);
- sFullPath = sFullKeyName.copy(0, keyName.lastIndexOf('/') + 1);
+ sFullPath = sFullKeyName.copy(0, keyName.rfind('/') + 1);
} else
{
if (sFullKeyName.getLength() > 1)
diff --git a/registry/source/regimpl.hxx b/registry/source/regimpl.hxx
index 19fa6b1e3232..973a24986106 100644
--- a/registry/source/regimpl.hxx
+++ b/registry/source/regimpl.hxx
@@ -102,7 +102,7 @@ public:
friend class ORegKey;
private:
- RegError eraseKey(ORegKey* pKey, const OUString& keyName);
+ RegError eraseKey(ORegKey* pKey, std::u16string_view keyName);
RegError deleteSubkeysAndValues(ORegKey* pKey);