From 1927b51993fb68907a75765676179b08ab195196 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 1 Apr 2022 17:42:34 +0200 Subject: 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 --- xmloff/source/chart/SchXMLTableContext.cxx | 6 +++--- xmloff/source/core/xmlmultiimagehelper.cxx | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'xmloff') 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 #include - +#include #include 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; -- cgit