diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-25 13:20:20 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-25 14:45:03 +0200 |
commit | e156cd6610bf8cfe5097498f2223bbfd26819937 (patch) | |
tree | 2c98e700efa677dedda50b7c0a467f3a861b3831 | |
parent | ace2e40a5b89967e247db1ebe9da65d41706d446 (diff) |
use string_view in CompareProtocolScheme
Change-Id: I3584042d0341d5c1b4f4e742e25e9eb0aa26f1da
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133378
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | editeng/source/misc/svxacorr.cxx | 4 | ||||
-rw-r--r-- | include/tools/urlobj.hxx | 3 | ||||
-rw-r--r-- | sc/source/filter/xml/xmltabi.cxx | 2 | ||||
-rw-r--r-- | svl/source/misc/urihelper.cxx | 2 | ||||
-rw-r--r-- | tools/source/fsys/urlobj.cxx | 7 |
5 files changed, 8 insertions, 10 deletions
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 753e79a8126b..d969b09c0015 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -687,7 +687,7 @@ bool SvxAutoCorrect::FnAddNonBrkSpace( sal_Int32 nProtocolLen = nEndPos - nSttWdPos + 1; if (nIndex + nProtocolLen <= rTxt.getLength()) { - if (INetURLObject::CompareProtocolScheme(rTxt.copy(nIndex, nProtocolLen)) != INetProtocol::NotValid) + if (INetURLObject::CompareProtocolScheme(rTxt.subView(nIndex, nProtocolLen)) != INetProtocol::NotValid) return false; } @@ -895,7 +895,7 @@ void SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc, sal_Int32 nProtocolLen = pDelim - pWordStt + 1; if (nIndex + nProtocolLen <= rTxt.getLength()) { - if (INetURLObject::CompareProtocolScheme(rTxt.copy(nIndex, nProtocolLen)) != INetProtocol::NotValid) + if (INetURLObject::CompareProtocolScheme(rTxt.subView(nIndex, nProtocolLen)) != INetProtocol::NotValid) return; // already ok } diff --git a/include/tools/urlobj.hxx b/include/tools/urlobj.hxx index 82b30fe2676b..cb135497bc88 100644 --- a/include/tools/urlobj.hxx +++ b/include/tools/urlobj.hxx @@ -406,8 +406,7 @@ public: */ static const OUString & GetSchemeName(INetProtocol eTheScheme); - static INetProtocol CompareProtocolScheme(OUString const & - rTheAbsURIRef); + static INetProtocol CompareProtocolScheme(std::u16string_view aTheAbsURIRef); // User Info: diff --git a/sc/source/filter/xml/xmltabi.cxx b/sc/source/filter/xml/xmltabi.cxx index 835474537401..217e08bebced 100644 --- a/sc/source/filter/xml/xmltabi.cxx +++ b/sc/source/filter/xml/xmltabi.cxx @@ -75,7 +75,7 @@ static bool lcl_isExternalRefCache(const OUString& rName, OUString& rUrl, OUStri // #i114504# Other schemes besides "file:" are also allowed. // CompareProtocolScheme is quick, only looks at the start of the string. - INetProtocol eProt = INetURLObject::CompareProtocolScheme( rName.copy(1) ); + INetProtocol eProt = INetURLObject::CompareProtocolScheme( rName.subView(1) ); if ( eProt == INetProtocol::NotValid ) return false; diff --git a/svl/source/misc/urihelper.cxx b/svl/source/misc/urihelper.cxx index e5ddbc37a93e..30dfdc87f387 100644 --- a/svl/source/misc/urihelper.cxx +++ b/svl/source/misc/urihelper.cxx @@ -535,7 +535,7 @@ OUString URIHelper::FindFirstURLInText(OUString const & rText, if (rtl::isAsciiAlpha(c)) { sal_Int32 i = nPos; - INetProtocol eScheme = INetURLObject::CompareProtocolScheme(rText.copy(i, rEnd - i)); + INetProtocol eScheme = INetURLObject::CompareProtocolScheme(rText.subView(i, rEnd - i)); if (eScheme == INetProtocol::File) // 2nd { while (rText[i++] != ':') ; diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index 1b171ad2ed8e..a4bc5ab0922d 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -3963,11 +3963,10 @@ const OUString & INetURLObject::GetSchemeName(INetProtocol eTheScheme) } // static -INetProtocol INetURLObject::CompareProtocolScheme(OUString const & - rTheAbsURIRef) +INetProtocol INetURLObject::CompareProtocolScheme(std::u16string_view aTheAbsURIRef) { - sal_Unicode const * p = rTheAbsURIRef.getStr(); - PrefixInfo const * pPrefix = getPrefix(p, p + rTheAbsURIRef.getLength()); + sal_Unicode const * p = aTheAbsURIRef.data(); + PrefixInfo const * pPrefix = getPrefix(p, p + aTheAbsURIRef.size()); return pPrefix ? pPrefix->m_eScheme : INetProtocol::NotValid; } |