[Libreoffice-commits] core.git: chart2/source codemaker/source forms/source idl/source include/rtl sal/qa
Stephan Bergmann
sbergman at redhat.com
Wed Oct 12 14:08:56 UTC 2016
chart2/source/tools/ExponentialRegressionCurveCalculator.cxx | 2 -
codemaker/source/javamaker/javatype.cxx | 2 -
forms/source/xforms/model_ui.cxx | 4 +-
idl/source/prj/database.cxx | 9 +++---
include/rtl/strbuf.hxx | 15 -----------
include/rtl/ustrbuf.hxx | 14 ----------
sal/qa/rtl/strings/test_ostring_concat.cxx | 5 ---
sal/qa/rtl/strings/test_oustring_concat.cxx | 3 --
8 files changed, 11 insertions(+), 43 deletions(-)
New commits:
commit 802f2a420859f6787c86a960aa331245423d5820
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Oct 12 16:00:24 2016 +0200
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
<https://lists.freedesktop.org/archives/libreoffice/2016-October/075464.html>
"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
diff --git a/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx b/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx
index 491f43a..d620576 100644
--- a/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx
@@ -205,7 +205,7 @@ OUString ExponentialRegressionCurveCalculator::ImplGetRepresentation(
OUString aValueString = getFormattedString( xNumFormatter, nNumberFormatKey, m_fLogIntercept, pValueLength );
if ( aValueString != "0" ) // aValueString may be rounded to 0 if nValueLength is small
{
- aTmpBuf.append( aValueString + ( (m_fLogSlope < 0.0) ? OUStringBuffer(" ") : OUStringBuffer(" + ") ) );
+ aTmpBuf.append( aValueString + ( (m_fLogSlope < 0.0) ? OUStringLiteral(" ") : OUStringLiteral(" + ") ) );
}
}
}
diff --git a/codemaker/source/javamaker/javatype.cxx b/codemaker/source/javamaker/javatype.cxx
index 06328a9..1d414a1 100644
--- a/codemaker/source/javamaker/javatype.cxx
+++ b/codemaker/source/javamaker/javatype.cxx
@@ -329,7 +329,7 @@ public:
OString getDescriptor() const;
- OString getSignature() const { return m_needsSignature ? m_signatureStart + m_signatureEnd : OString();}
+ OString getSignature() const { return m_needsSignature ? m_signatureStart.toString() + m_signatureEnd : OString();}
private:
rtl::Reference< TypeManager > m_manager;
diff --git a/forms/source/xforms/model_ui.cxx b/forms/source/xforms/model_ui.cxx
index 482fe7a..f8f5784c 100644
--- a/forms/source/xforms/model_ui.cxx
+++ b/forms/source/xforms/model_ui.cxx
@@ -293,7 +293,7 @@ OUString Model::getNodeDisplayName( const XNode_t& xNode,
OUString sContent = xNode->getNodeValue();
if( bDetail || ! lcl_isWhitespace( sContent ) )
{
- aBuffer = aBuffer + "\"" + Convert::collapseWhitespace( sContent ) + "\"";
+ aBuffer.append("\"" + Convert::collapseWhitespace( sContent ) + "\"");
}
}
break;
@@ -866,7 +866,7 @@ static OUString lcl_serializeForDisplay( const Reference<XXPathObject>& xResult
break;
case XPathObjectType_XPATH_STRING:
- aBuffer = aBuffer + "\"" + xResult->getString() + "\"";
+ aBuffer.append("\"" + xResult->getString() + "\"");
break;
case XPathObjectType_XPATH_NODESET:
diff --git a/idl/source/prj/database.cxx b/idl/source/prj/database.cxx
index d001ee4..2b45e6e 100644
--- a/idl/source/prj/database.cxx
+++ b/idl/source/prj/database.cxx
@@ -220,16 +220,16 @@ bool SvIdlDataBase::ReadIdFile( const OString& rOFileName )
else if( rTok.Is( SvHash_include() ) )
{
rTok = aTokStm.GetToken_Next();
- OStringBuffer aName;
+ OStringBuffer aNameBuf;
if( rTok.IsString() )
- aName.append(rTok.GetString());
+ aNameBuf.append(rTok.GetString());
else if( rTok.IsChar() && rTok.GetChar() == '<' )
{
rTok = aTokStm.GetToken_Next();
while( !rTok.IsEof()
&& !(rTok.IsChar() && rTok.GetChar() == '>') )
{
- aName.append(rTok.GetTokenAsString());
+ aNameBuf.append(rTok.GetTokenAsString());
rTok = aTokStm.GetToken_Next();
}
if( rTok.IsEof() )
@@ -237,7 +237,8 @@ bool SvIdlDataBase::ReadIdFile( const OString& rOFileName )
throw SvParseException("unexpected eof in #include", rTok);
}
}
- if (!ReadIdFile(aName.toString()))
+ OString aName(aNameBuf.makeStringAndClear());
+ if (!ReadIdFile(aName))
{
throw SvParseException("cannot read file: " + aName, rTok);
}
diff --git a/include/rtl/strbuf.hxx b/include/rtl/strbuf.hxx
index 0fc3284..90bf41b 100644
--- a/include/rtl/strbuf.hxx
+++ b/include/rtl/strbuf.hxx
@@ -995,21 +995,6 @@ private:
sal_Int32 nCapacity;
};
-#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
-/**
- @internal
-*/
-template<>
-struct ToStringHelper< OStringBuffer >
- {
- static int length( const OStringBuffer& s ) { return s.getLength(); }
- static char* addData( char* buffer, const OStringBuffer& s ) { return addDataHelper( buffer, s.getStr(), s.getLength()); }
- static const bool allowOStringConcat = true;
- static const bool allowOUStringConcat = false;
- };
-#endif
-
-
}
#ifdef RTL_STRING_UNITTEST
diff --git a/include/rtl/ustrbuf.hxx b/include/rtl/ustrbuf.hxx
index ecae7f0..07188a7 100644
--- a/include/rtl/ustrbuf.hxx
+++ b/include/rtl/ustrbuf.hxx
@@ -1561,20 +1561,6 @@ private:
sal_Int32 nCapacity;
};
-#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
-/**
- @internal
-*/
-template<>
-struct ToStringHelper< OUStringBuffer >
- {
- static int length( const OUStringBuffer& s ) { return s.getLength(); }
- static sal_Unicode* addData( sal_Unicode* buffer, const OUStringBuffer& s ) { return addDataHelper( buffer, s.getStr(), s.getLength()); }
- static const bool allowOStringConcat = false;
- static const bool allowOUStringConcat = true;
- };
-#endif
-
}
#ifdef RTL_STRING_UNITTEST
diff --git a/sal/qa/rtl/strings/test_ostring_concat.cxx b/sal/qa/rtl/strings/test_ostring_concat.cxx
index e3bdcc7..0326df1 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 356c601..0cf305f 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<const char*>("b") ));
More information about the Libreoffice-commits
mailing list