summaryrefslogtreecommitdiff
path: root/linguistic
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 /linguistic
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 'linguistic')
-rw-r--r--linguistic/source/dicimp.cxx8
-rw-r--r--linguistic/source/dlistimp.cxx6
2 files changed, 7 insertions, 7 deletions
diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index 20fe8bbadac1..ea4718ff8bce 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -92,14 +92,14 @@ static uno::Reference< XLinguServiceManager2 > GetLngSvcMgr_Impl()
return xRes;
}
-static bool getTag(const OString &rLine, const char *pTagName,
+static bool getTag(std::string_view rLine, const char *pTagName,
OString &rTagValue)
{
- sal_Int32 nPos = rLine.indexOf(pTagName);
- if (nPos == -1)
+ size_t nPos = rLine.find(pTagName);
+ if (nPos == std::string_view::npos)
return false;
- rTagValue = comphelper::string::strip(rLine.subView(nPos + strlen(pTagName)),
+ rTagValue = comphelper::string::strip(rLine.substr(nPos + strlen(pTagName)),
' ');
return true;
}
diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx
index 53be03d9d20a..2901273c3e30 100644
--- a/linguistic/source/dlistimp.cxx
+++ b/linguistic/source/dlistimp.cxx
@@ -673,13 +673,13 @@ uno::Sequence< OUString > SAL_CALL DicList::getSupportedServiceNames( )
static sal_Int32 lcl_GetToken( OUString &rToken,
- const OUString &rText, sal_Int32 nPos, const OUString &rDelim )
+ const OUString &rText, sal_Int32 nPos, std::u16string_view rDelim )
{
sal_Int32 nRes = -1;
if (rText.isEmpty() || nPos >= rText.getLength())
rToken.clear();
- else if (rDelim.isEmpty())
+ else if (rDelim.empty())
{
rToken = rText;
if (!rToken.isEmpty())
@@ -690,7 +690,7 @@ static sal_Int32 lcl_GetToken( OUString &rToken,
sal_Int32 i;
for (i = nPos; i < rText.getLength(); ++i)
{
- if (-1 != rDelim.indexOf( rText[i] ))
+ if (std::string_view::npos != rDelim.find( rText[i] ))
break;
}