loplugin:stringadd in various

when applying my upcoming patch to also consider O[U]StringBuffer

Change-Id: I8cf6a47ad357ddc73e2c430d966be72d5efd1485
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149767
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2023-03-30 20:03:41 +00:00
parent 7d8ffcc587
commit db7f33af14
11 changed files with 32 additions and 48 deletions
@@ -906,8 +906,9 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32
{
if ( cLast == '\\' )
{ // escaped
aSymbol.append(rText.subView(postSymbolIndex, nextCharIndex - postSymbolIndex - 2));
aSymbol.append(OUString(&current, 1));
aSymbol.append(
OUString::Concat(rText.subView(postSymbolIndex, nextCharIndex - postSymbolIndex - 2))
+ OUString(&current, 1));
}
else
{
@@ -931,8 +932,9 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32
{
if ( cLast == '\\' )
{ // escaped
aSymbol.append(rText.subView(postSymbolIndex, nextCharIndex - postSymbolIndex - 2));
aSymbol.append(OUString(&current, 1));
aSymbol.append(
rText.subView(postSymbolIndex, nextCharIndex - postSymbolIndex - 2)
+ OUString(&current, 1));
}
else if (current == nextChar &&
!(nContTypes & KParseTokens::TWO_DOUBLE_QUOTES_BREAK_STRING) )
@@ -1129,8 +1129,7 @@ OUString DefaultNumberingProvider::makeNumberingIdentifier(sal_Int16 index)
aPropertiesRange[1].Name = "Value";
for (sal_Int32 j = 1; j <= 3; j++) {
aPropertiesRange[1].Value <<= j;
result.append( makeNumberingString( aProperties, aLocale ) );
result.append(", ");
result.append( makeNumberingString( aProperties, aLocale ) + ", " );
}
result.append("...");
// Make known duplicate generated identifiers unique.
+1 -2
View File
@@ -1127,8 +1127,7 @@ OUString ToggleUnicodeCodepoint::ReplacementString()
//pad with zeros - minimum length of 4.
for( sal_Int32 i = 4 - aTmp.getLength(); i > 0; --i )
aTmp.insert( 0,"0" );
output.append( "U+" );
output.append( aTmp );
output.append( "U+" + aTmp );
}
}
return output.makeStringAndClear();
+6 -7
View File
@@ -417,8 +417,7 @@ void SvIdlDataBase::WriteError( SvTokenStream & rInStm )
// error text
if( !aError.GetText().isEmpty() )
{
aErrorText.append("may be <");
aErrorText.append(aError.GetText());
aErrorText.append("may be <" + aError.GetText());
}
SvToken * pPrevTok = nullptr;
while( &rTok != pPrevTok )
@@ -431,11 +430,11 @@ void SvIdlDataBase::WriteError( SvTokenStream & rInStm )
}
// error position
aErrorText.append("> at ( ");
aErrorText.append(static_cast<sal_Int64>(aError.nLine));
aErrorText.append(", ");
aErrorText.append(static_cast<sal_Int64>(aError.nColumn));
aErrorText.append(" )");
aErrorText.append("> at ( "
+ OString::number(static_cast<sal_Int64>(aError.nLine))
+ ", "
+ OString::number(static_cast<sal_Int64>(aError.nColumn))
+ " )");
// reset error
aError = SvIdlError();
+2 -7
View File
@@ -63,18 +63,13 @@ protected:
if (args.size() == 0)
return "";
OUStringBuffer sResult;
sResult.append(",\"args\":{");
OUStringBuffer sResult(",\"args\":{");
bool first = true;
for (auto& i : args)
{
if (!first)
sResult.append(',');
sResult.append('"');
sResult.append(i.first);
sResult.append("\":\"");
sResult.append(i.second);
sResult.append('"');
sResult.append("\"" + i.first + "\":\"" + i.second + "\"");
first = false;
}
sResult.append('}');
@@ -165,9 +165,9 @@ std::unique_ptr<JavaInfo> createJavaInfo(
buf.append(info->getRuntimeLibrary());
if (!info->getLibraryPath().isEmpty())
{
buf.append("\n");
buf.append(info->getLibraryPath());
buf.append("\n");
buf.append("\n"
+ info->getLibraryPath()
+ "\n");
}
OUString sVendorData = buf.makeStringAndClear();
return std::unique_ptr<JavaInfo>(
@@ -416,13 +416,11 @@ void RehearseTimingsActivity::paint( cppcanvas::CanvasSharedPtr const & canvas )
sal_Int32 n = nTimeSecs / 3600;
if (n < 10)
buf.append( '0' );
buf.append( n );
buf.append( ':' );
buf.append( OUString::number(n) + ":" );
n = ((nTimeSecs % 3600) / 60);
if (n < 10)
buf.append( '0' );
buf.append( n );
buf.append( ':' );
buf.append( OUString::number(n) + ":" );
n = (nTimeSecs % 60);
if (n < 10)
buf.append( '0' );
@@ -81,8 +81,7 @@ static short generateNamespace(std::ostream & o,
OStringBuffer buf;
if (index == -1) {
if (serviceobject) {
buf.append("comp_");
buf.append(implname);
buf.append("comp_" + implname);
nm = buf.makeStringAndClear();
o << "namespace comp_" << implname << " {\n\n";
count=1;
@@ -94,13 +93,11 @@ static short generateNamespace(std::ostream & o,
do {
OString token(implname.getToken(0, '.', nPos));
if (nPos < 0 && serviceobject) {
buf.append("::comp_");
buf.append(token);
buf.append("::comp_" + token);
o << "namespace comp_" << token << " { ";
count++;
} else {
buf.append("::");
buf.append(token);
buf.append("::" + token);
o << "namespace " << token << " { ";
count++;
}
@@ -612,14 +609,14 @@ static OString generateClassDefinition(std::ostream& o,
if (!interfaces.empty()) {
if (supportxcomponent) {
parentname.append("::cppu::WeakComponentImplHelper");
parentname.append(static_cast<sal_Int32>(interfaces.size()));
parentname.append("::cppu::WeakComponentImplHelper" +
OString::number(static_cast<sal_Int32>(interfaces.size())));
o << " private ::cppu::BaseMutex,\n"
" public ::cppu::WeakComponentImplHelper"
<< interfaces.size() << "<";
} else {
parentname.append("::cppu::WeakImplHelper");
parentname.append(static_cast<sal_Int32>(interfaces.size()));
parentname.append("::cppu::WeakImplHelper" +
OString::number(static_cast<sal_Int32>(interfaces.size())));
o << " public ::cppu::WeakImplHelper" << interfaces.size() << "<";
}
@@ -661,8 +658,7 @@ static OString generateClassDefinition(std::ostream& o,
"css::uno::RuntimeException);\n";
OStringBuffer buffer(256);
buffer.append(parentname);
buffer.append("< ");
buffer.append(parentname + "< ");
std::set< OUString >::const_iterator iter = interfaces.begin();
while (iter != interfaces.end())
{
@@ -5248,8 +5248,7 @@ uno::Reference<beans::XPropertySet> DomainMapper_Impl::FindOrCreateFieldMaster(c
aFieldMasterName.append('.');
if ( bIsMergeField && !sDatabaseDataSourceName.isEmpty() )
{
aFieldMasterName.append(sDatabaseDataSourceName);
aFieldMasterName.append('.');
aFieldMasterName.append(sDatabaseDataSourceName + ".");
}
aFieldMasterName.append(rFieldMasterName);
OUString sFieldMasterName = aFieldMasterName.makeStringAndClear();
+1 -3
View File
@@ -47,9 +47,7 @@ std::string RTFSprm::toString() const
aBuf.append(sal_Int32(m_nKeyword));
else
aBuf.append(sResult.c_str());
aBuf.append("', '");
aBuf.append(m_pValue->toString().c_str());
aBuf.append("')");
aBuf.append("', '" + m_pValue->toString() + "')");
return aBuf.makeStringAndClear().getStr();
}
@@ -543,8 +543,7 @@ static OUString CompatDNCryptoAPI(std::u16string_view rDN)
{
if (rDN.size() != i+1 && rDN[i+1] == '"')
{
buf.append('\\');
buf.append(rDN[i+1]);
buf.append(OUString::Concat("\\") + OUStringChar(rDN[i+1]));
++i;
}
else