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>
This commit is contained in:
Noel Grandin
2023-03-30 11:37:59 +00:00
parent 6b19f32252
commit db9912d824
8 changed files with 49 additions and 126 deletions
+6 -17
View File
@@ -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 );
}
}
+2 -7
View File
@@ -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>
+30 -80
View File
@@ -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 -------------------------------------------------
+2 -4
View File
@@ -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;
}
+4 -8
View File
@@ -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));
+2 -6
View File
@@ -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!");
+1 -2
View File
@@ -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());
}
+2 -2
View File
@@ -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());