diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2021-02-09 20:48:37 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2021-02-10 10:33:25 +0100 |
commit | 4cae353cae28f6530544ad5864d4ce3075ac5bcc (patch) | |
tree | 6d5adffbaa05ac9d1cd320ac393040490d3c289f /sal | |
parent | 4b92707c19ef47cdb9474224e83e5153c54b661d (diff) |
Fix loplugin:stringliteralvar
...detection of
OUString( const sal_Unicode * value, sal_Int32 length )
ctor. (On platforms where sal_Int32 is a typedef for int, an argument that
already is of type int will not be wrapped in an ImplicitCastExpr to the
sal_Int32 typedef.)
Change-Id: Ifc5456a62d42c1acad76ea949549dc24bd67201a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110654
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sal')
-rw-r--r-- | sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx index 2a4f35e2e793..764b03d8c220 100644 --- a/sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx +++ b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx @@ -81,45 +81,41 @@ void createMessage( void test::oustringbuffer::Utf32::appendUtf32() { int const str1Len = 3; sal_Unicode const str1[str1Len] = { 'a', 'b', 'c' }; - int const str2Len = 4; - sal_Unicode const str2[str2Len] = { 'a', 'b', 'c', 'd' }; - int const str3Len = 6; - sal_Unicode const str3[str3Len] = { 'a', 'b', 'c', 'd', 0xD800, 0xDC00 }; + static constexpr OUStringLiteral str2 = u"abcd"; + static constexpr OUStringLiteral str3 = u"abcd\U00010000"; OStringBuffer message; OUStringBuffer buf1(std::u16string_view(str1, str1Len)); buf1.appendUtf32('d'); OUString res1(buf1.makeStringAndClear()); - createMessage(message, res1, OUString(str2, str2Len)); + createMessage(message, res1, str2); CPPUNIT_ASSERT_EQUAL_MESSAGE( - message.getStr(), OUString(str2, str2Len), res1); - OUStringBuffer buf2(std::u16string_view(str2, str2Len)); + message.getStr(), OUString(str2), res1); + OUStringBuffer buf2(str2); buf2.appendUtf32(0x10000); OUString res2(buf2.makeStringAndClear()); - createMessage(message, res2, OUString(str3, str3Len)); + createMessage(message, res2, str3); CPPUNIT_ASSERT_EQUAL_MESSAGE( - message.getStr(), OUString(str3, str3Len), res2); + message.getStr(), OUString(str3), res2); } void test::oustringbuffer::Utf32::insertUtf32() { int const str1Len = 3; sal_Unicode const str1[str1Len] = { 'a', 'b', 'c' }; - int const str2Len = 4; - sal_Unicode const str2[str2Len] = { 'a', 'b', 'd', 'c' }; - int const str3Len = 6; - sal_Unicode const str3[str3Len] = { 'a', 'b', 0xDBFF, 0xDFFF, 'd', 'c' }; + static constexpr OUStringLiteral str2 = u"abdc"; + static constexpr OUStringLiteral str3 = u"ab\U0010FFFFdc"; OStringBuffer message; OUStringBuffer buf1(std::u16string_view(str1, str1Len)); buf1.insertUtf32(2, 'd'); OUString res1(buf1.makeStringAndClear()); - createMessage(message, res1, OUString(str2, str2Len)); + createMessage(message, res1, str2); CPPUNIT_ASSERT_EQUAL_MESSAGE( - message.getStr(), OUString(str2, str2Len), res1); - OUStringBuffer buf2(std::u16string_view(str2, str2Len)); + message.getStr(), OUString(str2), res1); + OUStringBuffer buf2(str2); buf2.insertUtf32(2, 0x10FFFF); OUString res2(buf2.makeStringAndClear()); - createMessage(message, res2, OUString(str3, str3Len)); + createMessage(message, res2, str3); CPPUNIT_ASSERT_EQUAL_MESSAGE( - message.getStr(), OUString(str3, str3Len), res2); + message.getStr(), OUString(str3), res2); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |