From 1da69081732c8a429840edaaf10cfb789ea68df8 Mon Sep 17 00:00:00 2001 From: Noel Date: Thu, 28 Jan 2021 11:01:28 +0200 Subject: add string_view variants of methods to O[U]StringBuffer and update the stringview loplugin to detect cases where we can use these new methods. Change-Id: I998efe02e35c8efcb3abfb4d7186165bbe6dfb2c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110046 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sal') diff --git a/sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx index 80643df2eba0..2a4f35e2e793 100644 --- a/sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx +++ b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx @@ -86,13 +86,13 @@ void test::oustringbuffer::Utf32::appendUtf32() { int const str3Len = 6; sal_Unicode const str3[str3Len] = { 'a', 'b', 'c', 'd', 0xD800, 0xDC00 }; OStringBuffer message; - OUStringBuffer buf1(OUString(str1, str1Len)); + OUStringBuffer buf1(std::u16string_view(str1, str1Len)); buf1.appendUtf32('d'); OUString res1(buf1.makeStringAndClear()); createMessage(message, res1, OUString(str2, str2Len)); CPPUNIT_ASSERT_EQUAL_MESSAGE( message.getStr(), OUString(str2, str2Len), res1); - OUStringBuffer buf2(OUString(str2, str2Len)); + OUStringBuffer buf2(std::u16string_view(str2, str2Len)); buf2.appendUtf32(0x10000); OUString res2(buf2.makeStringAndClear()); createMessage(message, res2, OUString(str3, str3Len)); @@ -108,13 +108,13 @@ void test::oustringbuffer::Utf32::insertUtf32() { int const str3Len = 6; sal_Unicode const str3[str3Len] = { 'a', 'b', 0xDBFF, 0xDFFF, 'd', 'c' }; OStringBuffer message; - OUStringBuffer buf1(OUString(str1, str1Len)); + OUStringBuffer buf1(std::u16string_view(str1, str1Len)); buf1.insertUtf32(2, 'd'); OUString res1(buf1.makeStringAndClear()); createMessage(message, res1, OUString(str2, str2Len)); CPPUNIT_ASSERT_EQUAL_MESSAGE( message.getStr(), OUString(str2, str2Len), res1); - OUStringBuffer buf2(OUString(str2, str2Len)); + OUStringBuffer buf2(std::u16string_view(str2, str2Len)); buf2.insertUtf32(2, 0x10FFFF); OUString res2(buf2.makeStringAndClear()); createMessage(message, res2, OUString(str3, str3Len)); -- cgit