From f13c6ad5f020a196a0e3aa6f28bda3dc185d465b Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 14 Oct 2019 14:27:57 +0200 Subject: new loplugin:bufferadd look for OUStringBuffer append sequences that can be turned into creating an OUString with + operations Change-Id: Ica840dc096000307b4a105fb4d9ec7588a15ade6 Reviewed-on: https://gerrit.libreoffice.org/80809 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sal/qa/rtl/uri/rtl_testuri.cxx | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'sal/qa/rtl') diff --git a/sal/qa/rtl/uri/rtl_testuri.cxx b/sal/qa/rtl/uri/rtl_testuri.cxx index 3310ec25bba6..aea0d50c6c54 100644 --- a/sal/qa/rtl/uri/rtl_testuri.cxx +++ b/sal/qa/rtl/uri/rtl_testuri.cxx @@ -44,7 +44,6 @@ void Test::test_Uri() { rtl_UriCharClass const eFirstCharClass = rtl_UriCharClassNone; rtl_UriCharClass const eLastCharClass = rtl_UriCharClassUnoParamValue; - OUStringBuffer aBuffer; OUString aText1; OUString aText2; @@ -182,12 +181,11 @@ void Test::test_Uri() { // Check surrogate handling: - aBuffer.append(u'\xD800'); // %ED%A0%80 - aBuffer.append(u'\xD800'); // %F0%90%8F%BF - aBuffer.append(u'\xDFFF'); - aBuffer.append(u'\xDFFF'); // %ED%BF%BF - aBuffer.append('A'); // A - aText1 = aBuffer.makeStringAndClear(); + aText1 = OUStringLiteral1(u'\xD800') + // %ED%A0%80 + OUStringLiteral1(u'\xD800') + // %F0%90%8F%BF + OUStringLiteral1(u'\xDFFF') + + OUStringLiteral1(u'\xDFFF') + // %ED%BF%BF + "A"; // A aText2 = "%ED%A0%80" "%F0%90%8F%BF" "%ED%BF%BF" "A"; CPPUNIT_ASSERT_EQUAL_MESSAGE( "failure 11", @@ -209,12 +207,11 @@ void Test::test_Uri() { RTL_TEXTENCODING_UTF8)); aText1 = "%ed%a0%80" "%f0%90%8f%bf" "%ed%bf%bf" "A"; - aBuffer.append("%ED%A0%80"); - aBuffer.append(u'\xD800'); - aBuffer.append(u'\xDFFF'); - aBuffer.append("%ED%BF%BF"); - aBuffer.append('A'); - aText2 = aBuffer.makeStringAndClear(); + aText2 = "%ED%A0%80" + + OUStringLiteral1(u'\xD800') + + OUStringLiteral1(u'\xDFFF') + + "%ED%BF%BF" + "A"; CPPUNIT_ASSERT_EQUAL_MESSAGE( "failure 14", aText2, @@ -250,9 +247,8 @@ void Test::test_Uri() { // Check IURI handling: aText1 = "%30%C3%BF"; - aBuffer.append("%30"); - aBuffer.append(u'\x00FF'); - aText2 = aBuffer.makeStringAndClear(); + aText2 = "%30" + + OUStringLiteral1(u'\x00FF'); CPPUNIT_ASSERT_EQUAL_MESSAGE( "failure 18", aText2, -- cgit