dbaccess/source/filter/hsqldb/fbalterparser.cxx | 6 -- dbaccess/source/filter/hsqldb/fbcreateparser.cxx | 6 -- dbaccess/source/filter/hsqldb/hsqlimport.cxx | 8 --- dbaccess/source/ui/misc/DExport.cxx | 3 - dbaccess/source/ui/misc/WCopyTable.cxx | 3 - dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx | 3 - dbaccess/source/ui/misc/defaultobjectnamecheck.cxx | 3 - dbaccess/source/ui/querydesign/QueryDesignView.cxx | 24 ++++------ desktop/source/app/officeipcthread.cxx | 8 +-- desktop/source/deployment/gui/dp_gui_extlistbox.cxx | 4 - desktop/source/deployment/gui/dp_gui_updatedialog.cxx | 14 +---- desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx | 5 -- desktop/source/deployment/manager/dp_manager.cxx | 11 ++-- desktop/source/deployment/misc/dp_misc.cxx | 3 - desktop/source/deployment/registry/component/dp_component.cxx | 14 +---- desktop/source/deployment/registry/dp_registry.cxx | 8 +-- desktop/source/lib/init.cxx | 7 +- desktop/source/migration/migration.cxx | 7 +- desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx | 7 -- desktop/source/pkgchk/unopkg/unopkg_misc.cxx | 7 -- 20 files changed, 54 insertions(+), 97 deletions(-)
New commits: commit d638a512ac19fa68f7760ff110469337f061f481 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Mar 24 19:08:40 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sat Mar 25 06:21:25 2023 +0000 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.gran...@collabora.co.uk> diff --git a/dbaccess/source/filter/hsqldb/fbalterparser.cxx b/dbaccess/source/filter/hsqldb/fbalterparser.cxx index 024598c0b319..a8948069e4e6 100644 --- a/dbaccess/source/filter/hsqldb/fbalterparser.cxx +++ b/dbaccess/source/filter/hsqldb/fbalterparser.cxx @@ -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); diff --git a/dbaccess/source/filter/hsqldb/fbcreateparser.cxx b/dbaccess/source/filter/hsqldb/fbcreateparser.cxx index f3399474c272..1740998c62d2 100644 --- a/dbaccess/source/filter/hsqldb/fbcreateparser.cxx +++ b/dbaccess/source/filter/hsqldb/fbcreateparser.cxx @@ -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"); diff --git a/dbaccess/source/filter/hsqldb/hsqlimport.cxx b/dbaccess/source/filter/hsqldb/hsqlimport.cxx index 045a32f93ce3..af9b637cb862 100644 --- a/dbaccess/source/filter/hsqldb/hsqlimport.cxx +++ b/dbaccess/source/filter/hsqldb/hsqlimport.cxx @@ -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("?"); diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx index d45b791af1af..fdc6bc4b3d26 100644 --- a/dbaccess/source/ui/misc/DExport.cxx +++ b/dbaccess/source/ui/misc/DExport.cxx @@ -823,8 +823,7 @@ Reference< XPreparedStatement > ODatabaseExport::createPreparedStatement( const { if ( !elem.isEmpty() ) { - aSql.append(elem); - aSql.append(","); + aSql.append(elem + ","); aValues.append("?,"); } } diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index c5db4b2fd956..4d8e73141a5c 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -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 diff --git a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx index d4b039ce66ef..12a73c78877f 100644 --- a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx +++ b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx @@ -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(); diff --git a/dbaccess/source/ui/misc/defaultobjectnamecheck.cxx b/dbaccess/source/ui/misc/defaultobjectnamecheck.cxx index d2a158d2b76e..736d9378ae9b 100644 --- a/dbaccess/source/ui/misc/defaultobjectnamecheck.cxx +++ b/dbaccess/source/ui/misc/defaultobjectnamecheck.cxx @@ -88,8 +88,7 @@ namespace dbaui OUStringBuffer aCompleteName; if ( !msRelativeRoot.isEmpty() ) { - aCompleteName.append( msRelativeRoot ); - aCompleteName.append( "/" ); + aCompleteName.append( msRelativeRoot + "/" ); } aCompleteName.append( _rObjectName ); diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index c081012ddf2a..1c23e936b016 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -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; diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx index 74f838939bfa..9b77da1a9037 100644 --- a/desktop/source/app/officeipcthread.cxx +++ b/desktop/source/app/officeipcthread.cxx @@ -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, diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index f21585c3e402..9953e0549a7b 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -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(); diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx index 2861d77856ca..e8da99f3c103 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx @@ -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; } diff --git a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx index 9b1aa423d03f..0248a1537fa1 100644 --- a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx @@ -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(), diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx index 9c4a849e2843..206b44d85bd6 100644 --- a/desktop/source/deployment/manager/dp_manager.cxx +++ b/desktop/source/deployment/manager/dp_manager.cxx @@ -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() ); } diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx index 15e31b0fe402..01fb414a7909 100644 --- a/desktop/source/deployment/misc/dp_misc.cxx +++ b/desktop/source/deployment/misc/dp_misc.cxx @@ -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 ); } diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx index 234381d0657b..cbe7548f05cb 100644 --- a/desktop/source/deployment/registry/component/dp_component.cxx +++ b/desktop/source/deployment/registry/component/dp_component.cxx @@ -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); diff --git a/desktop/source/deployment/registry/dp_registry.cxx b/desktop/source/deployment/registry/dp_registry.cxx index 961afe7bbec1..ac19bcd8e9d8 100644 --- a/desktop/source/deployment/registry/dp_registry.cxx +++ b/desktop/source/deployment/registry/dp_registry.cxx @@ -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( ", " ); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 6753220051e0..5a5d3e4399b2 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -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) diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index 38c8ccb61167..273dd5e3def6 100644 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx @@ -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(); diff --git a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx index a902f956d8d5..581922a3c365 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx @@ -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) ); diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx index c9c9b33674ac..553952917748 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx @@ -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>" );