diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-01 17:42:34 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-02 13:31:19 +0200 |
commit | 1927b51993fb68907a75765676179b08ab195196 (patch) | |
tree | 1b7d09c1b5e7ea945fb6ea618a4c100e8630ebb4 /xmloff | |
parent | 0dfa444f393a5766d36fe7d2480d0c8ec832e329 (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 'xmloff')
-rw-r--r-- | xmloff/source/chart/SchXMLTableContext.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/core/xmlmultiimagehelper.cxx | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx index ac8a9f3e3f51..a59a28b2546b 100644 --- a/xmloff/source/chart/SchXMLTableContext.cxx +++ b/xmloff/source/chart/SchXMLTableContext.cxx @@ -181,13 +181,13 @@ bool lcl_mapContainsRange( } bool lcl_tableOfRangeMatches( - const OUString & rRange, + std::u16string_view rRange, std::u16string_view rTableName ) { // both strings are non-empty and the table name is part of the range - return ( !rRange.isEmpty() && + return ( !rRange.empty() && !rTableName.empty() && - (rRange.indexOf( rTableName ) != -1 )); + (rRange.find( rTableName ) != std::u16string_view::npos )); } } // anonymous namespace diff --git a/xmloff/source/core/xmlmultiimagehelper.cxx b/xmloff/source/core/xmlmultiimagehelper.cxx index b3529acc586e..000c6151ee81 100644 --- a/xmloff/source/core/xmlmultiimagehelper.cxx +++ b/xmloff/source/core/xmlmultiimagehelper.cxx @@ -19,19 +19,19 @@ #include <rtl/ustring.hxx> #include <xmlmultiimagehelper.hxx> - +#include <o3tl/string_view.hxx> #include <comphelper/graphicmimetype.hxx> using namespace ::com::sun::star; namespace { - OUString getMimeTypeForURL(const OUString& rString) + OUString getMimeTypeForURL(std::u16string_view rString) { OUString sMimeType; - if (rString.startsWith("vnd.sun.star.Package")) + if (o3tl::starts_with(rString, u"vnd.sun.star.Package")) { - OString aExtension = OUStringToOString(rString.subView(rString.lastIndexOf(".") + 1), RTL_TEXTENCODING_ASCII_US); + OString aExtension = OUStringToOString(rString.substr(rString.rfind('.') + 1), RTL_TEXTENCODING_ASCII_US); sMimeType = comphelper::GraphicMimeTypeHelper::GetMimeTypeForExtension(aExtension); } return sMimeType; |