From 802f2a420859f6787c86a960aa331245423d5820 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 12 Oct 2016 16:00:24 +0200 Subject: Don't allow O[U]StringBuffer in string concatenation ...as OStringBuffer b("foo"); b = "bar" + b; doesn't work as one might expect (see the mail thread starting at "concat of OUStringBuffer". That feature was LIBO_INTERNAL_ONLY, anyway. And of the affected places, MethodDescriptor::getSignature (codemaker/source/javamaker/javatype.cxx) was the only one that would actually have benefitted. Change-Id: Ib84266f43e40c42c2e428f0c0616db8cfa90adff --- sal/qa/rtl/strings/test_ostring_concat.cxx | 5 +---- sal/qa/rtl/strings/test_oustring_concat.cxx | 3 +-- 2 files changed, 2 insertions(+), 6 deletions(-) (limited to 'sal') diff --git a/sal/qa/rtl/strings/test_ostring_concat.cxx b/sal/qa/rtl/strings/test_ostring_concat.cxx index e3bdcc75c456..0326df1aaccd 100644 --- a/sal/qa/rtl/strings/test_ostring_concat.cxx +++ b/sal/qa/rtl/strings/test_ostring_concat.cxx @@ -78,10 +78,6 @@ void test::ostring::StringConcat::checkConcat() CPPUNIT_ASSERT_EQUAL(( typeid( OStringConcat< OString, const char* > )), typeid( OString( "foo" ) + d3 )); CPPUNIT_ASSERT_EQUAL( OString( "fooabc" ), OString( OString( "foo" ) + d4 )); CPPUNIT_ASSERT_EQUAL(( typeid( OStringConcat< OString, char* > )), typeid( OString( "foo" ) + d4 )); -#ifdef __GNUC__ - CPPUNIT_ASSERT_EQUAL( OString( "foobar" ), OString( OStringBuffer( "foo" ) + OString( "bar" ))); - CPPUNIT_ASSERT_EQUAL(( typeid( OStringConcat< OStringBuffer, OString > )), typeid( OStringBuffer( "foo" ) + OString( "bar" ))); -#endif } void test::ostring::StringConcat::checkEnsureCapacity() @@ -141,6 +137,7 @@ void test::ostring::StringConcat::checkAppend() void test::ostring::StringConcat::checkInvalid() { CPPUNIT_ASSERT( !INVALID_CONCAT( OString() + OString())); + CPPUNIT_ASSERT( INVALID_CONCAT( OString( "a" ) + OStringBuffer( "b" ))); CPPUNIT_ASSERT( INVALID_CONCAT( OString( "a" ) + OUString( "b" ))); CPPUNIT_ASSERT( INVALID_CONCAT( OString( "a" ) + OUStringBuffer( "b" ))); CPPUNIT_ASSERT( INVALID_CONCAT( OString( "a" ) + OUStringLiteral( "b" ))); diff --git a/sal/qa/rtl/strings/test_oustring_concat.cxx b/sal/qa/rtl/strings/test_oustring_concat.cxx index 356c6013e7fb..0cf305f9b133 100644 --- a/sal/qa/rtl/strings/test_oustring_concat.cxx +++ b/sal/qa/rtl/strings/test_oustring_concat.cxx @@ -69,8 +69,6 @@ void test::oustring::StringConcat::checkConcat() const char d1[] = "xyz"; CPPUNIT_ASSERT_EQUAL( OUString( "fooxyz" ), OUString( OUString( "foo" ) + d1 )); CPPUNIT_ASSERT_EQUAL(( typeid( OUStringConcat< OUString, const char[ 4 ] > )), typeid( OUString( "foo" ) + d1 )); - CPPUNIT_ASSERT_EQUAL( OUString( "foobar" ), OUString( OUStringBuffer( "foo" ) + OUString( "bar" ))); - CPPUNIT_ASSERT_EQUAL(( typeid( OUStringConcat< OUStringBuffer, OUString > )), typeid( OUStringBuffer( "foo" ) + OUString( "bar" ))); } void test::oustring::StringConcat::checkConcatAsciiL() @@ -146,6 +144,7 @@ void test::oustring::StringConcat::checkAppend() void test::oustring::StringConcat::checkInvalid() { CPPUNIT_ASSERT( !INVALID_CONCAT( OUString() + OUString())); + CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + OUStringBuffer( "b" ))); CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + OString( "b" ))); CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + OStringBuffer( "b" ))); CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "a" ) + static_cast("b") )); -- cgit