loplugin:stringadd in d*

after my patch to merge the bufferadd loplugin into stringadd

Change-Id: I625a0adf89f54ea25f0377a266c37acf9a37d723
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149550
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2023-03-25 06:21:25 +00:00
parent 4ca4282517
commit d638a512ac
20 changed files with 54 additions and 97 deletions
@@ -32,15 +32,13 @@ OUString FbAlterStmtParser::compose() const
}
else if (getActionType() == AlterAction::ADD_FOREIGN)
return getStatement(); // do nothing with that
OUStringBuffer sSql("ALTER TABLE ");
sSql.append(getTableName());
OUStringBuffer sSql("ALTER TABLE " + getTableName());
if (getActionType() == AlterAction::IDENTITY_RESTART)
{
sSql.append(" ALTER COLUMN ");
}
sSql.append(getColumnName());
sSql.append(" RESTART WITH ");
sSql.append(getColumnName() + " RESTART WITH ");
// Firebird: restart with 0 means the first number is 1, not 0.
sSql.append(getIdentityParam() - 1);
@@ -135,8 +135,7 @@ OUString FbCreateStmtParser::compose() const
{
ensureProperTableLengths();
OUStringBuffer sSql(128);
sSql.append("CREATE TABLE ");
sSql.append(getTableName());
sSql.append("CREATE TABLE " + getTableName());
lcl_appendWithSpace(sSql, u"("); // column declaration
auto& rColumns = getColumnDef();
@@ -183,8 +182,7 @@ OUString FbCreateStmtParser::compose() const
// start with 0:
// HSQLDB: first value will be 0.
// Firebird: first value will be 1.
sSql.append(columnIter->getStartValue() - 1);
sSql.append(")");
sSql.append(OUString::number(columnIter->getStartValue() - 1) + ")");
}
else if (!columnIter->isNullable())
lcl_appendWithSpace(sSql, u"NOT NULL");
+2 -6
View File
@@ -180,9 +180,7 @@ OUString lcl_createInsertStatement(std::u16string_view sTableName,
const std::vector<dbahsql::ColumnDefinition>& rColTypes)
{
assert(rColTypes.size() > 0);
OUStringBuffer sql("INSERT INTO ");
sql.append(sTableName);
sql.append(" (");
OUStringBuffer sql(OUString::Concat("INSERT INTO ") + sTableName + " (");
// column names
for (size_t i = 0; i < rColTypes.size(); ++i)
@@ -191,9 +189,7 @@ OUString lcl_createInsertStatement(std::u16string_view sTableName,
if (i < rColTypes.size() - 1)
sql.append(", ");
}
sql.append(")");
sql.append(" VALUES (");
sql.append(") VALUES (");
for (size_t i = 0; i < rColTypes.size(); ++i)
{
sql.append("?");
+1 -2
View File
@@ -823,8 +823,7 @@ Reference< XPreparedStatement > ODatabaseExport::createPreparedStatement( const
{
if ( !elem.isEmpty() )
{
aSql.append(elem);
aSql.append(",");
aSql.append(elem + ",");
aValues.append("?,");
}
}
+1 -2
View File
@@ -213,8 +213,7 @@ OUString ObjectCopySource::getSelectStatement() const
}
else
{ // table
OUStringBuffer aSQL;
aSQL.append( "SELECT " );
OUStringBuffer aSQL( "SELECT " );
// we need to create the sql stmt with column names
// otherwise it is possible that names don't match
@@ -535,8 +535,7 @@ namespace dbaui
Reference< XTitle > xTitle(getPrivateModel(),UNO_QUERY);
if ( xTitle.is() )
{
sTitle.append( xTitle->getTitle() );
sTitle.append(" : ");
sTitle.append( xTitle->getTitle() + " : ");
}
sTitle.append( getPrivateTitle() );
return sTitle.makeStringAndClear();
@@ -88,8 +88,7 @@ namespace dbaui
OUStringBuffer aCompleteName;
if ( !msRelativeRoot.isEmpty() )
{
aCompleteName.append( msRelativeRoot );
aCompleteName.append( "/" );
aCompleteName.append( msRelativeRoot + "/" );
}
aCompleteName.append( _rObjectName );
@@ -291,11 +291,12 @@ namespace
{
if(!aCondition.isEmpty())
aCondition.append(C_AND);
aCondition.append(quoteTableAlias(true,pData->GetAliasName(JTCS_FROM),aQuote));
aCondition.append(::dbtools::quoteName(aQuote, lineData->GetFieldName(JTCS_FROM) ));
aCondition.append(" = ");
aCondition.append(quoteTableAlias(true,pData->GetAliasName(JTCS_TO),aQuote));
aCondition.append(::dbtools::quoteName(aQuote, lineData->GetFieldName(JTCS_TO) ));
aCondition.append(
quoteTableAlias(true,pData->GetAliasName(JTCS_FROM),aQuote)
+ ::dbtools::quoteName(aQuote, lineData->GetFieldName(JTCS_FROM) )
+ " = "
+ quoteTableAlias(true,pData->GetAliasName(JTCS_TO),aQuote)
+ ::dbtools::quoteName(aQuote, lineData->GetFieldName(JTCS_TO) ));
}
}
catch(SQLException&)
@@ -668,8 +669,7 @@ namespace
field->isNumericOrAggregateFunction() ||
field->isOtherFunction()))
{
aTmpStr.append(" AS ");
aTmpStr.append(::dbtools::quoteName(aQuote, rFieldAlias));
aTmpStr.append(" AS " + ::dbtools::quoteName(aQuote, rFieldAlias));
}
aFieldListStr.append(aTmpStr);
aTmpStr.setLength(0);
@@ -2771,14 +2771,11 @@ OUString OQueryDesignView::getStatement()
OUStringBuffer aSqlCmd("SELECT ");
if(rController.isDistinct())
aSqlCmd.append(" DISTINCT ");
aSqlCmd.append(aFieldListStr);
aSqlCmd.append(" FROM ");
aSqlCmd.append(aTableListStr);
aSqlCmd.append(aFieldListStr + " FROM " + aTableListStr);
if (!aCriteriaListStr.isEmpty())
{
aSqlCmd.append(" WHERE ");
aSqlCmd.append(aCriteriaListStr);
aSqlCmd.append(" WHERE " + aCriteriaListStr);
}
Reference<XDatabaseMetaData> xMeta;
if ( xConnection.is() )
@@ -2791,8 +2788,7 @@ OUString OQueryDesignView::getStatement()
// ----------------- construct GroupBy and attach ------------
if(!aHavingStr.isEmpty())
{
aSqlCmd.append(" HAVING ");
aSqlCmd.append(aHavingStr);
aSqlCmd.append(" HAVING " + aHavingStr);
}
// ----------------- construct sorting and attach ------------
OUString sOrder;
+4 -4
View File
@@ -1066,12 +1066,12 @@ bool IpcThread::process(OString const & arguments, bool * waitProcessed) {
aHelpURLBuffer.append("vnd.sun.star.help://smath/start");
}
if (bShowHelp) {
aHelpURLBuffer.append("?Language=");
aHelpURLBuffer.append(utl::ConfigManager::getUILocale());
aHelpURLBuffer.append("?Language="
+ utl::ConfigManager::getUILocale()
#if defined UNX
aHelpURLBuffer.append("&System=UNX");
+ "&System=UNX");
#elif defined _WIN32
aHelpURLBuffer.append("&System=WIN");
+ "&System=WIN");
#endif
ApplicationEvent* pAppEvent = new ApplicationEvent(
ApplicationEvent::Type::OpenHelpUrl,
@@ -150,8 +150,8 @@ void Entry_Impl::checkDependencies()
OUStringBuffer aMissingDep( DpResId( RID_STR_ERROR_MISSING_DEPENDENCIES ) );
for ( const auto& i : std::as_const(depExc.UnsatisfiedDependencies) )
{
aMissingDep.append("\n");
aMissingDep.append(dp_misc::Dependencies::getErrorText(i));
aMissingDep.append("\n"
+ dp_misc::Dependencies::getErrorText(i));
}
aMissingDep.append("\n");
m_sErrorText = aMissingDep.makeStringAndClear();
@@ -881,31 +881,25 @@ IMPL_LINK_NOARG(UpdateDialog, selectionHandler, weld::TreeView&, void)
m_noDependency = m_noDependency.replaceAt( nPos, sProductName.getLength(), utl::ConfigManager::getProductName() );
}
b.append(m_noInstall);
b.append(LF);
b.append(m_noDependency);
b.append(m_noInstall + OUStringChar(LF) + m_noDependency);
for (sal_Int32 i = 0;
i < data.unsatisfiedDependencies.getLength(); ++i)
{
b.append(LF);
b.append(" ");
b.append(OUStringChar(LF) + " ");
// U+2003 EM SPACE would be better than two spaces,
// but some fonts do not contain it
b.append(
confineToParagraph(
data.unsatisfiedDependencies[i]));
}
b.append(LF);
b.append(" ");
b.append(m_noDependencyCurVer);
b.append(OUStringChar(LF) + " " + m_noDependencyCurVer);
}
break;
}
case SPECIFIC_ERROR:
{
UpdateDialog::SpecificError & data = m_specificErrors[ pos ];
b.append(m_failure);
b.append(LF);
b.append(m_failure + OUStringChar(LF));
b.append( data.message.isEmpty() ? m_unknownError : data.message );
break;
}
@@ -373,10 +373,7 @@ void UpdateInstallDialog::Thread::downloadExtensions()
{
if (nPos)
buf.append("\n");
buf.append("Could not download ");
buf.append(elem.first);
buf.append(". ");
buf.append(elem.second.Message);
buf.append("Could not download " + elem.first + ". " + elem.second.Message);
++nPos;
}
m_dialog.setError(UpdateInstallDialog::ERROR_DOWNLOAD, updateData.aInstalledPackage->getDisplayName(),
@@ -941,17 +941,16 @@ void PackageManagerImpl::removePackage(
OUString PackageManagerImpl::getDeployPath( ActivePackages::Data const & data )
{
OUStringBuffer buf;
buf.append( data.temporaryName );
OUStringBuffer buf( data.temporaryName );
//The bundled extensions are not contained in an additional folder
//with a unique name. data.temporaryName contains already the
//UTF8 encoded folder name. See PackageManagerImpl::synchronize
if (m_context != "bundled")
{
buf.append( "_/" );
buf.append( ::rtl::Uri::encode( data.fileName, rtl_UriCharClassPchar,
rtl_UriEncodeIgnoreEscapes,
RTL_TEXTENCODING_UTF8 ) );
buf.append( "_/"
+ ::rtl::Uri::encode( data.fileName, rtl_UriCharClassPchar,
rtl_UriEncodeIgnoreEscapes,
RTL_TEXTENCODING_UTF8 ) );
}
return makeURL( m_activePackages, buf.makeStringAndClear() );
}
+1 -2
View File
@@ -104,8 +104,7 @@ OUString generateOfficePipeId()
// create hex-value string from the MD5 value to keep
// the string size minimal
OUStringBuffer buf;
buf.append( "SingleOfficeIPC_" );
OUStringBuffer buf( "SingleOfficeIPC_" );
for ( sal_uInt32 i = 0; i < md5_key_len; ++i ) {
buf.append( static_cast<sal_Int32>(md5_buf[ i ]), 0x10 );
}
@@ -858,13 +858,9 @@ void BackendImpl::unorc_flush( Reference<XCommandEnvironment> const & xCmdEnv )
if (!m_unorc_inited || !m_unorc_modified)
return;
OStringBuffer buf;
buf.append("ORIGIN=");
OUString sOrigin = dp_misc::makeRcTerm(m_cachePath);
OString osOrigin = OUStringToOString(sOrigin, RTL_TEXTENCODING_UTF8);
buf.append(osOrigin);
buf.append(LF);
OStringBuffer buf("ORIGIN=" + osOrigin + OStringChar(LF));
if (! m_jar_typelibs.empty())
{
@@ -913,9 +909,8 @@ void BackendImpl::unorc_flush( Reference<XCommandEnvironment> const & xCmdEnv )
bool space = false;
if (!sCommonRDB.isEmpty())
{
buf.append( "?$ORIGIN/" );
buf.append( OUStringToOString(
sCommonRDB, RTL_TEXTENCODING_ASCII_US ) );
buf.append( "?$ORIGIN/"
+ OUStringToOString( sCommonRDB, RTL_TEXTENCODING_ASCII_US ) );
space = true;
}
if (!sNativeRDB.isEmpty())
@@ -951,8 +946,7 @@ void BackendImpl::unorc_flush( Reference<XCommandEnvironment> const & xCmdEnv )
{
buf.append(' ');
}
buf.append('?');
buf.append(OUStringToOString(component, RTL_TEXTENCODING_UTF8));
buf.append("?" + OUStringToOString(component, RTL_TEXTENCODING_UTF8));
space = true;
}
buf.append(LF);
@@ -381,8 +381,8 @@ Reference<deployment::XPackageRegistry> PackageRegistryImpl::create(
OUStringBuffer buf;
buf.append(
Reference<lang::XServiceInfo>(
ambiguousBackend, UNO_QUERY_THROW )->getImplementationName() );
buf.append( ": " );
ambiguousBackend, UNO_QUERY_THROW )->getImplementationName()
+ ": " );
const Sequence< Reference<deployment::XPackageTypeInfo> > types(
ambiguousBackend->getSupportedPackageTypes() );
for ( sal_Int32 pos = 0; pos < types.getLength(); ++pos ) {
@@ -391,9 +391,7 @@ Reference<deployment::XPackageRegistry> PackageRegistryImpl::create(
buf.append( xInfo->getMediaType() );
const OUString filter( xInfo->getFileFilter() );
if (!filter.isEmpty()) {
buf.append( " (" );
buf.append( filter );
buf.append( ")" );
buf.append( " (" + filter + ")" );
}
if (pos < (types.getLength() - 1))
buf.append( ", " );
+3 -4
View File
@@ -259,8 +259,8 @@ public:
OStringBuffer aOutput;
for (const auto &s : aEvents)
{
aOutput.append(OUStringToOString(s, RTL_TEXTENCODING_UTF8));
aOutput.append("\n");
aOutput.append(OUStringToOString(s, RTL_TEXTENCODING_UTF8)
+ "\n");
}
if (aOutput.getLength() > 0)
{
@@ -3120,8 +3120,7 @@ static char* lo_extractRequest(LibreOfficeKit* /*pThis*/, const char* pFilePath)
if( xLTS.is() )
{
OUStringBuffer jsonText;
jsonText.append("{ \"Targets\": { ");
OUStringBuffer jsonText("{ \"Targets\": { ");
bool lastParentheses = extractLinks(xLTS->getLinks(), false, jsonText);
jsonText.append("} }");
if (!lastParentheses)
+3 -4
View File
@@ -728,8 +728,8 @@ void MigrationImpl::copyConfig()
// shared registrymodifications.xcu does not exists
// the configuration is split in many registry files
// determine the file names from the first element in included paths
OUStringBuffer buf(m_aInfo.userdata);
buf.append("/user/registry/data");
OUStringBuffer buf(m_aInfo.userdata
+ "/user/registry/data");
sal_Int32 n = 0;
do {
OUString seg(comp.first.getToken(0, '.', n));
@@ -741,8 +741,7 @@ void MigrationImpl::copyConfig()
SAL_INFO( "desktop.migration", "configuration migration component " << comp.first << " ignored (cannot be encoded as file path)" );
goto next;
}
buf.append('/');
buf.append(enc);
buf.append("/" + enc);
} while (n >= 0);
buf.append(".xcu");
regFilePath = buf.makeStringAndClear();
@@ -324,13 +324,10 @@ void CommandEnvironmentImpl::update_( Any const & Status )
return;
}
else {
OUStringBuffer buf;
buf.append( "WARNING: " );
OUStringBuffer buf( "WARNING: " );
deployment::DeploymentException dp_exc;
if (Status >>= dp_exc) {
buf.append( dp_exc.Message );
buf.append( ", Cause: " );
buf.append( ::comphelper::anyToString(dp_exc.Cause) );
buf.append( dp_exc.Message + ", Cause: " + ::comphelper::anyToString(dp_exc.Cause) );
}
else {
buf.append( ::comphelper::anyToString(Status) );
+2 -5
View File
@@ -55,14 +55,11 @@ namespace unopkg {
OUString toString( OptionInfo const * info )
{
assert(info != nullptr);
OUStringBuffer buf;
buf.append("--");
OUStringBuffer buf("--");
buf.appendAscii(info->m_name);
if (info->m_short_option != '\0')
{
buf.append(" (short -" );
buf.append(info->m_short_option );
buf.append(")");
buf.append(" (short -" + OUStringChar(info->m_short_option) + ")");
}
if (info->m_has_argument)
buf.append(" <argument>" );