summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-03-30 10:39:24 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-03-30 11:37:59 +0000
commitdb9912d824c1d621fdc409b9cdd6c79caefe1327 (patch)
tree5a3c905b93df25b5baf3c773927778c6f7fc4389
parent6b19f32252f8ba5540ce3b1e38f8ac6112421906 (diff)
loplugin:stringadd in ucbhelper..uui
when applying my upcoming patch to also consider O[U]StringBuffer Change-Id: I49549347c1c041cc9ce103aed1fe1cc3bc1a780f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149751 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--ucbhelper/source/client/proxydecider.cxx23
-rw-r--r--unotools/source/config/docinfohelper.cxx9
-rw-r--r--unotools/source/i18n/localedatawrapper.cxx110
-rw-r--r--unotools/source/i18n/textsearch.cxx6
-rw-r--r--unotools/source/misc/datetime.cxx12
-rw-r--r--unoxml/source/xpath/xpathapi.cxx8
-rw-r--r--uui/source/iahndl-authentication.cxx3
-rw-r--r--uui/source/secmacrowarnings.cxx4
8 files changed, 49 insertions, 126 deletions
diff --git a/ucbhelper/source/client/proxydecider.cxx b/ucbhelper/source/client/proxydecider.cxx
index 10228b72aedc..862347465066 100644
--- a/ucbhelper/source/client/proxydecider.cxx
+++ b/ucbhelper/source/client/proxydecider.cxx
@@ -410,9 +410,7 @@ bool InternetProxyDecider_Impl::shouldUseProxy( std::u16string_view rHost,
( rHost[ 0 ] != '[' ) )
{
// host is given as numeric IPv6 address
- aBuffer.append( "[" );
- aBuffer.append( rHost );
- aBuffer.append( "]" );
+ aBuffer.append( OUString::Concat("[") + rHost + "]" );
}
else
{
@@ -420,20 +418,18 @@ bool InternetProxyDecider_Impl::shouldUseProxy( std::u16string_view rHost,
aBuffer.append( rHost );
}
- aBuffer.append( ':' );
- aBuffer.append( nPort );
- const OUString aHostAndPort( aBuffer.makeStringAndClear() );
+ aBuffer.append( ":" + OUString::number( nPort ) );
for (auto const& noProxy : m_aNoProxyList)
{
if ( bUseFullyQualified )
{
- if ( noProxy.second.Matches( aHostAndPort ) )
+ if ( noProxy.second.Matches( aBuffer ) )
return false;
}
else
{
- if ( noProxy.first.Matches( aHostAndPort ) )
+ if ( noProxy.first.Matches( aBuffer ) )
return false;
}
}
@@ -889,17 +885,10 @@ void InternetProxyDecider_Impl::setNoProxyList(
if ( aTmp != aServer.toAsciiLowerCase() )
{
if ( bIPv6Address )
- {
- aFullyQualifiedHost.append( "[" );
- aFullyQualifiedHost.append( aTmp );
- aFullyQualifiedHost.append( "]" );
- }
+ aFullyQualifiedHost.append( "[" + aTmp + "]" );
else
- {
aFullyQualifiedHost.append( aTmp );
- }
- aFullyQualifiedHost.append( ":" );
- aFullyQualifiedHost.append( aPort );
+ aFullyQualifiedHost.append( ":" + aPort );
}
}
diff --git a/unotools/source/config/docinfohelper.cxx b/unotools/source/config/docinfohelper.cxx
index 6b36fb21b7e3..6674649eae3d 100644
--- a/unotools/source/config/docinfohelper.cxx
+++ b/unotools/source/config/docinfohelper.cxx
@@ -46,8 +46,7 @@ OUString DocInfoHelper::GetGeneratorString()
OUString aValue( utl::ConfigManager::getProductName() );
if ( !aValue.isEmpty() )
{
- aResult.append( aValue.replace( ' ', '_' ) );
- aResult.append( '/' );
+ aResult.append( aValue.replace( ' ', '_' ) + "/" );
aValue = utl::ConfigManager::getProductVersion();
if ( !aValue.isEmpty() )
@@ -65,11 +64,7 @@ OUString DocInfoHelper::GetGeneratorString()
OUString arch( "$_ARCH" );
::rtl::Bootstrap::expandMacros(os);
::rtl::Bootstrap::expandMacros(arch);
- aResult.append( '$' );
- aResult.append( os );
- aResult.append( '_' );
- aResult.append( arch );
- aResult.append( ' ' );
+ aResult.append( "$" + os + "_" + arch + " " );
}
// second product: LibreOffice_project/<build_information>
diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index 9e6fe8990979..56524372e21f 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -347,13 +347,13 @@ const std::vector< LanguageType >& LocaleDataWrapper::getInstalledLanguageTypes(
// && aDebugLocale != "es-BR" // ?!? Brazil/es
)
{
- OUStringBuffer aMsg("ConvertIsoNamesToLanguage/ConvertLanguageToIsoNames: ambiguous locale (MS-LCID?)\n");
- aMsg.append(aDebugLocale);
- aMsg.append(" -> 0x");
- aMsg.append(static_cast<sal_Int32>(static_cast<sal_uInt16>(eLang)), 16);
- aMsg.append(" -> ");
- aMsg.append(aBackLanguageTag.getBcp47());
- outputCheckMessage( aMsg );
+ outputCheckMessage(Concat2View(
+ "ConvertIsoNamesToLanguage/ConvertLanguageToIsoNames: ambiguous locale (MS-LCID?)\n"
+ + aDebugLocale
+ + " -> 0x"
+ + OUString::number(static_cast<sal_Int32>(static_cast<sal_uInt16>(eLang)), 16)
+ + " -> "
+ + aBackLanguageTag.getBcp47() ));
}
eLang = LANGUAGE_DONTKNOW;
}
@@ -1234,8 +1234,7 @@ OUString LocaleDataWrapper::getCurr( sal_Int64 nNumber, sal_uInt16 nDecimals,
// check if digits and separators will fit into fixed buffer or allocate
size_t nGuess = ImplGetNumberStringLengthGuess( aLocaleDataItem, nDecimals );
- OUStringBuffer aNumBuf(int(nGuess + 16));
- OUStringBuffer aBuf(int(rCurrencySymbol.size() + nGuess + 20 ));
+ OUStringBuffer aNumBuf(sal_Int32(nGuess + 16));
bool bNeg;
if ( nNumber < 0 )
@@ -1286,27 +1285,22 @@ OUString LocaleDataWrapper::getCurr( sal_Int64 nNumber, sal_uInt16 nDecimals,
}
}
+ OUString aCur;
if ( !bNeg )
{
switch( getCurrPositiveFormat() )
{
case 0:
- aBuf.append( rCurrencySymbol );
- aBuf.append( aNumBuf );
+ aCur = rCurrencySymbol + aNumBuf;
break;
case 1:
- aBuf.append( aNumBuf );
- aBuf.append( rCurrencySymbol );
+ aCur = aNumBuf + rCurrencySymbol;
break;
case 2:
- aBuf.append( rCurrencySymbol );
- aBuf.append( ' ' );
- aBuf.append( aNumBuf );
+ aCur = OUString::Concat(rCurrencySymbol) + " " + aNumBuf;
break;
case 3:
- aBuf.append( aNumBuf );
- aBuf.append( ' ' );
- aBuf.append( rCurrencySymbol );
+ aCur = aNumBuf + " " + rCurrencySymbol;
break;
}
}
@@ -1315,101 +1309,57 @@ OUString LocaleDataWrapper::getCurr( sal_Int64 nNumber, sal_uInt16 nDecimals,
switch( getCurrNegativeFormat() )
{
case 0:
- aBuf.append( '(' );
- aBuf.append( rCurrencySymbol );
- aBuf.append( aNumBuf );
- aBuf.append( ')' );
+ aCur = OUString::Concat("(") + rCurrencySymbol + aNumBuf + ")";
break;
case 1:
- aBuf.append( '-' );
- aBuf.append( rCurrencySymbol );
- aBuf.append( aNumBuf );
+ aCur = OUString::Concat("-") + rCurrencySymbol + aNumBuf;
break;
case 2:
- aBuf.append( rCurrencySymbol );
- aBuf.append( '-' );
- aBuf.append( aNumBuf );
+ aCur = OUString::Concat(rCurrencySymbol) + "-" + aNumBuf;
break;
case 3:
- aBuf.append( rCurrencySymbol );
- aBuf.append( aNumBuf );
- aBuf.append( '-' );
+ aCur = rCurrencySymbol + aNumBuf + "-";
break;
case 4:
- aBuf.append( '(' );
- aBuf.append( aNumBuf );
- aBuf.append( rCurrencySymbol );
- aBuf.append( ')' );
+ aCur = "(" + aNumBuf + rCurrencySymbol + ")";
break;
case 5:
- aBuf.append( '-' );
- aBuf.append( aNumBuf );
- aBuf.append( rCurrencySymbol );
+ aCur = "-" + aNumBuf + rCurrencySymbol;
break;
case 6:
- aBuf.append( aNumBuf );
- aBuf.append( '-' );
- aBuf.append( rCurrencySymbol );
+ aCur = aNumBuf + "-" + rCurrencySymbol;
break;
case 7:
- aBuf.append( aNumBuf );
- aBuf.append( rCurrencySymbol );
- aBuf.append( '-' );
+ aCur = aNumBuf + rCurrencySymbol + "-";
break;
case 8:
- aBuf.append( '-' );
- aBuf.append( aNumBuf );
- aBuf.append( ' ' );
- aBuf.append( rCurrencySymbol );
+ aCur = "-" + aNumBuf + " " + rCurrencySymbol;
break;
case 9:
- aBuf.append( '-' );
- aBuf.append( rCurrencySymbol );
- aBuf.append( ' ' );
- aBuf.append( aNumBuf );
+ aCur = OUString::Concat("-") + rCurrencySymbol + " " + aNumBuf;
break;
case 10:
- aBuf.append( aNumBuf );
- aBuf.append( ' ' );
- aBuf.append( rCurrencySymbol );
- aBuf.append( '-' );
+ aCur = aNumBuf + " " + rCurrencySymbol + "-";
break;
case 11:
- aBuf.append( rCurrencySymbol );
- aBuf.append( ' ' );
- aBuf.append( '-' );
- aBuf.append( aNumBuf );
+ aCur = OUString::Concat(rCurrencySymbol) + " -" + aNumBuf;
break;
case 12:
- aBuf.append( rCurrencySymbol );
- aBuf.append( ' ' );
- aBuf.append( aNumBuf );
- aBuf.append( '-' );
+ aCur = OUString::Concat(rCurrencySymbol) + " " + aNumBuf + "-";
break;
case 13:
- aBuf.append( aNumBuf );
- aBuf.append( '-' );
- aBuf.append( ' ' );
- aBuf.append( rCurrencySymbol );
+ aCur = aNumBuf + "- " + rCurrencySymbol;
break;
case 14:
- aBuf.append( '(' );
- aBuf.append( rCurrencySymbol );
- aBuf.append( ' ' );
- aBuf.append( aNumBuf );
- aBuf.append( ')' );
+ aCur = OUString::Concat("(") + rCurrencySymbol + " " + aNumBuf + ")";
break;
case 15:
- aBuf.append( '(' );
- aBuf.append( aNumBuf );
- aBuf.append( ' ' );
- aBuf.append( rCurrencySymbol );
- aBuf.append( ')' );
+ aCur = "(" + aNumBuf + " " + rCurrencySymbol + ")";
break;
}
}
- return aBuf.makeStringAndClear();
+ return aCur;
}
// --- number parsing -------------------------------------------------
diff --git a/unotools/source/i18n/textsearch.cxx b/unotools/source/i18n/textsearch.cxx
index 91f70d2fb641..b7f104895f8c 100644
--- a/unotools/source/i18n/textsearch.cxx
+++ b/unotools/source/i18n/textsearch.cxx
@@ -357,8 +357,7 @@ void TextSearch::ReplaceBackReferences( OUString& rReplaceStr, std::u16string_vi
}
break;
default:
- sBuff.append(rReplaceStr[i]);
- sBuff.append(rReplaceStr[i+1]);
+ sBuff.append(OUStringChar(rReplaceStr[i]) + OUStringChar(rReplaceStr[i+1]));
i += 1;
break;
}
@@ -379,8 +378,7 @@ void TextSearch::ReplaceBackReferences( OUString& rReplaceStr, std::u16string_vi
i += 1;
break;
default:
- sBuff.append(rReplaceStr[i]);
- sBuff.append(rReplaceStr[i+1]);
+ sBuff.append(OUStringChar(rReplaceStr[i]) + OUStringChar(rReplaceStr[i+1]));
i += 1;
break;
}
diff --git a/unotools/source/misc/datetime.cxx b/unotools/source/misc/datetime.cxx
index f95f39f92112..348dd0df4934 100644
--- a/unotools/source/misc/datetime.cxx
+++ b/unotools/source/misc/datetime.cxx
@@ -264,12 +264,10 @@ void typeConvert(const css::util::DateTime& _rDateTime, DateTime& _rOut)
OUString toISO8601(const css::util::DateTime& rDateTime)
{
OUStringBuffer rBuffer(32);
- rBuffer.append(static_cast<sal_Int32>(rDateTime.Year));
- rBuffer.append('-');
+ rBuffer.append(OUString::number(static_cast<sal_Int32>(rDateTime.Year)) + "-");
if( rDateTime.Month < 10 )
rBuffer.append('0');
- rBuffer.append(static_cast<sal_Int32>(rDateTime.Month));
- rBuffer.append('-');
+ rBuffer.append(OUString::number(static_cast<sal_Int32>(rDateTime.Month)) + "-");
if( rDateTime.Day < 10 )
rBuffer.append('0');
rBuffer.append(static_cast<sal_Int32>(rDateTime.Day));
@@ -282,12 +280,10 @@ OUString toISO8601(const css::util::DateTime& rDateTime)
rBuffer.append('T');
if( rDateTime.Hours < 10 )
rBuffer.append('0');
- rBuffer.append(static_cast<sal_Int32>(rDateTime.Hours));
- rBuffer.append(':');
+ rBuffer.append(OUString::number(static_cast<sal_Int32>(rDateTime.Hours)) + ":");
if( rDateTime.Minutes < 10 )
rBuffer.append('0');
- rBuffer.append(static_cast<sal_Int32>(rDateTime.Minutes));
- rBuffer.append(':');
+ rBuffer.append(OUString::number(static_cast<sal_Int32>(rDateTime.Minutes)) + ":");
if( rDateTime.Seconds < 10 )
rBuffer.append('0');
rBuffer.append(static_cast<sal_Int32>(rDateTime.Seconds));
diff --git a/unoxml/source/xpath/xpathapi.cxx b/unoxml/source/xpath/xpathapi.cxx
index d4c4f0a469cc..17b28027534c 100644
--- a/unoxml/source/xpath/xpathapi.cxx
+++ b/unoxml/source/xpath/xpathapi.cxx
@@ -226,15 +226,11 @@ namespace XPath
}
int line = pError->line;
if (line) {
- buf.append("Line: ");
- buf.append(static_cast<sal_Int32>(line));
- buf.append("\n");
+ buf.append("Line: " + OUString::number(static_cast<sal_Int32>(line)) + "\n");
}
int column = pError->int2;
if (column) {
- buf.append("Column: ");
- buf.append(static_cast<sal_Int32>(column));
- buf.append("\n");
+ buf.append("Column: " + OUString::number(static_cast<sal_Int32>(column)) + "\n");
}
} else {
buf.append("no error argument!");
diff --git a/uui/source/iahndl-authentication.cxx b/uui/source/iahndl-authentication.cxx
index ed8150997a30..8a2ae199c2fd 100644
--- a/uui/source/iahndl-authentication.cxx
+++ b/uui/source/iahndl-authentication.cxx
@@ -438,8 +438,7 @@ executeMasterPasswordDialog(
for (sal_uInt8 i : aKey)
{
// match PasswordContainer::DecodePasswords aMasterPasswd.copy(index * 2, 2).toUInt32(16));
- aBuffer.append(OUString::number(i >> 4, 16));
- aBuffer.append(OUString::number(i & 15, 16));
+ aBuffer.append(OUString::number(i >> 4, 16) + OUString::number(i & 15, 16));
}
rInfo.SetPassword(aBuffer.makeStringAndClear());
}
diff --git a/uui/source/secmacrowarnings.cxx b/uui/source/secmacrowarnings.cxx
index 31281c2f5236..9b81f6d9cb22 100644
--- a/uui/source/secmacrowarnings.cxx
+++ b/uui/source/secmacrowarnings.cxx
@@ -182,8 +182,8 @@ void MacroWarning::SetStorage( const css::uno::Reference < css::embed::XStorage
for( sal_Int32 i = 1 ; i < nCnt ; ++i )
{
- s.append("\n");
- s.append(GetContentPart( rInfos[ i ].Signer->getSubjectName(), aCN_Id ));
+ s.append(OUString::Concat("\n")
+ + GetContentPart( rInfos[ i ].Signer->getSubjectName(), aCN_Id ));
}
mxSignsFI->set_label(s.makeStringAndClear());