diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-14 14:27:57 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-15 14:33:57 +0200 |
commit | f13c6ad5f020a196a0e3aa6f28bda3dc185d465b (patch) | |
tree | f9aaab122974d36c134fb1723ec3c1c8df51eeef /sal | |
parent | 9270f74466d0eb841babaa24997f608631c70341 (diff) |
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sal')
-rw-r--r-- | sal/qa/osl/security/osl_Security.cxx | 13 | ||||
-rw-r--r-- | sal/qa/rtl/uri/rtl_testuri.cxx | 28 |
2 files changed, 18 insertions, 23 deletions
diff --git a/sal/qa/osl/security/osl_Security.cxx b/sal/qa/osl/security/osl_Security.cxx index 40eef7a6b940..3bce893731cc 100644 --- a/sal/qa/osl/security/osl_Security.cxx +++ b/sal/qa/osl/security/osl_Security.cxx @@ -129,13 +129,12 @@ namespace osl_Security OUString strID; bRes = aSec.getUserIdent( strID ); - OStringBuffer aMessage; - aMessage.append("strUserID: "); - aMessage.append(OUStringToOString(strUserID, osl_getThreadTextEncoding())); - aMessage.append(", strID: "); - aMessage.append(OUStringToOString(strID, osl_getThreadTextEncoding())); - aMessage.append(", bRes: "); - aMessage.append(bRes); + OString aMessage = "strUserID: " + + OUStringToOString(strUserID, osl_getThreadTextEncoding()) + + ", strID: " + + OUStringToOString(strID, osl_getThreadTextEncoding()) + + ", bRes: " + + OString::boolean(bRes); CPPUNIT_ASSERT_EQUAL_MESSAGE( aMessage.getStr(), strUserID, strID ); CPPUNIT_ASSERT_MESSAGE( aMessage.getStr(), bRes ); 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, |