summaryrefslogtreecommitdiff
path: root/test/source/sheet
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-04-12 10:50:46 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-04-14 07:54:28 +0200
commitbc2101646bc6e63944c42500af5a15134b9b2d17 (patch)
treeca1da50da2e3e76eef650a1ae3956c16e0a19f33 /test/source/sheet
parentad97694737c99889bc0eb21efccb83768d510361 (diff)
loplugin:stringviewparam improvements
improve the check by checking for methods that exclude using string_view, rather than checking for methods that __can__ use string_view, which leads to exposing some holes in our o3tl/string_view.hxx coverage. Change-Id: Ic9dd60441c671f502692f9cd2a1bb67301c4b960 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150277 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'test/source/sheet')
-rw-r--r--test/source/sheet/xspreadsheets2.cxx11
1 files changed, 7 insertions, 4 deletions
diff --git a/test/source/sheet/xspreadsheets2.cxx b/test/source/sheet/xspreadsheets2.cxx
index 780e806b4deb..3bd539710480 100644
--- a/test/source/sheet/xspreadsheets2.cxx
+++ b/test/source/sheet/xspreadsheets2.cxx
@@ -26,6 +26,7 @@
#include <rtl/ustring.hxx>
#include <cppunit/TestAssert.h>
+#include <o3tl/string_view.hxx>
using namespace css;
using namespace css::uno;
@@ -350,12 +351,14 @@ void XSpreadsheets2::importSheetToCopy()
xDestSheet.set( xDestSheetIndexAccess->getByIndex(nDestPosEffective), UNO_QUERY_THROW);
}
-bool XSpreadsheets2::isExternalReference(const OUString& aDestContent, std::u16string_view aSrcContent )
+bool XSpreadsheets2::isExternalReference(std::u16string_view aDestContent, std::u16string_view aSrcContent )
{
- CPPUNIT_ASSERT(aDestContent.startsWith("'file://"));
+ CPPUNIT_ASSERT(o3tl::starts_with(aDestContent, u"'file://"));
- return (aDestContent.endsWithIgnoreAsciiCase(aSrcContent) // same cell address
- && aDestContent.indexOf(gaSrcFileName)>0); // contains source file name
+ if (!o3tl::endsWithIgnoreAsciiCase(aDestContent, aSrcContent)) // same cell address
+ return false;
+ size_t nPos = aDestContent.find(gaSrcFileName);
+ return nPos != std::u16string_view::npos && nPos > 0; // contains source file name
}
}