compilerplugins/clang/bufferadd.cxx                             |   13 +
 connectivity/source/drivers/postgresql/pq_connection.cxx        |    7 
 connectivity/source/drivers/postgresql/pq_databasemetadata.cxx  |   48 +-----
 connectivity/source/drivers/postgresql/pq_preparedstatement.cxx |   38 +---
 connectivity/source/drivers/postgresql/pq_statement.cxx         |   78 
+++-------
 connectivity/source/drivers/postgresql/pq_tools.cxx             |    6 
 connectivity/source/drivers/postgresql/pq_xtables.cxx           |    4 
 connectivity/source/drivers/postgresql/pq_xviews.cxx            |    9 -
 cppu/source/cppu/cppu_opt.cxx                                   |   16 --
 cppu/source/typelib/static_types.cxx                            |    6 
 cppu/source/uno/lbenv.cxx                                       |    8 -
 i18npool/source/localedata/LocaleNode.cxx                       |    4 
 idlc/source/options.cxx                                         |    8 -
 idlc/source/parser.y                                            |    7 
 sc/qa/unit/helper/csv_handler.hxx                               |   21 --
 scripting/source/provider/MasterScriptProvider.cxx              |    5 
 sw/qa/core/macros-test.cxx                                      |    7 
 unotools/source/config/eventcfg.cxx                             |    7 
 unotools/source/config/moduleoptions.cxx                        |    7 
 unotools/source/config/syslocaleoptions.cxx                     |    7 
 xmlhelp/source/treeview/tvread.cxx                              |    7 
 21 files changed, 91 insertions(+), 222 deletions(-)

New commits:
commit c8eaadb5d70f42723517bb028f363e37726be256
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Wed Oct 16 22:53:34 2019 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Thu Oct 17 09:03:53 2019 +0200

    Remaining loplugin:bufferadd
    
    ...that had been missing because the plugin didn't implement postRun, so it
    didn't report anything when run as part of the shared plugin.  (But did 
report
    the expected warnings when run as a standalone plugin during
    CompilerTest_compilerplugins_clang.)
    
    Most fixes are straightforward.  A noteworthy one is 
PreparedStatement::setBytes
    in connectivity/source/drivers/postgresql/pq_preparedstatement.cxx:  The old
    preallocation of a 20 character OStringBuffer might have prevented
    
      buf.append( reinterpret_cast<char *>(escapedString), len -1 );
    
    from potentially throwing std::bad_alloc, which would have caused 
escapedString
    to be leaked.  Even though that 20-character preallocation was likely just
    random junk and not meant to address the potential leak, lets address it 
now.
    
    Change-Id: Ib506332d061684a22a74e5e39e591539fd2c4900
    Reviewed-on: https://gerrit.libreoffice.org/80925
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/compilerplugins/clang/bufferadd.cxx 
b/compilerplugins/clang/bufferadd.cxx
index a1c9738f0041..659b110403e3 100644
--- a/compilerplugins/clang/bufferadd.cxx
+++ b/compilerplugins/clang/bufferadd.cxx
@@ -56,11 +56,8 @@ public:
         return true;
     }
 
-    virtual void run() override
+    void postRun() override
     {
-        if (!preRun())
-            return;
-        TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
         for (auto const& pair : goodMap)
             if (!isa<ParmVarDecl>(pair.first) &&
                 // reference types have slightly weird behaviour
@@ -72,6 +69,14 @@ public:
                     << pair.first->getSourceRange();
     }
 
+    virtual void run() override
+    {
+        if (!preRun())
+            return;
+        TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+        postRun();
+    }
+
     bool VisitStmt(Stmt const*);
     bool VisitCallExpr(CallExpr const*);
     bool VisitCXXConstructExpr(CXXConstructExpr const*);
diff --git a/connectivity/source/drivers/postgresql/pq_connection.cxx 
b/connectivity/source/drivers/postgresql/pq_connection.cxx
index 0b5ea84bc6fa..56670cef1aa5 100644
--- a/connectivity/source/drivers/postgresql/pq_connection.cxx
+++ b/connectivity/source/drivers/postgresql/pq_connection.cxx
@@ -50,7 +50,6 @@
 #include "pq_xviews.hxx"
 #include "pq_xusers.hxx"
 
-#include <rtl/ustrbuf.hxx>
 #include <rtl/strbuf.hxx>
 #include <rtl/uuid.h>
 #include <rtl/bootstrap.hxx>
@@ -576,11 +575,7 @@ void Connection::initialize( const Sequence< Any >& 
aArguments )
 
     if (isLog(&m_settings, LogLevel::Info))
     {
-        OUStringBuffer buf( 128 );
-        buf.append( "connection to '" );
-        buf.append( url );
-        buf.append( "' successfully opened" );
-        log(&m_settings, LogLevel::Info, buf.makeStringAndClear());
+        log(&m_settings, LogLevel::Info, "connection to '" + url + "' 
successfully opened");
     }
 }
 
diff --git a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx 
b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
index 99d2f22b86b3..4002d2fc866a 100644
--- a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
+++ b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
@@ -1119,12 +1119,9 @@ css::uno::Reference< XResultSet > 
DatabaseMetaData::getTables(
 
     if (isLog(m_pSettings, LogLevel::Info))
     {
-        OUStringBuffer buf( 128 );
-        buf.append( "DatabaseMetaData::getTables got called with " );
-        buf.append( schemaPattern );
-        buf.append( "." );
-        buf.append( tableNamePattern );
-        log(m_pSettings, LogLevel::Info, buf.makeStringAndClear());
+        log(m_pSettings, LogLevel::Info,
+            ("DatabaseMetaData::getTables got called with " + schemaPattern + 
"."
+             + tableNamePattern));
     }
     // ignore catalog, as a single pq connection does not support multiple 
catalogs
 
@@ -1453,14 +1450,9 @@ css::uno::Reference< XResultSet > 
DatabaseMetaData::getColumns(
 
     if (isLog(m_pSettings, LogLevel::Info))
     {
-        OUStringBuffer buf( 128 );
-        buf.append( "DatabaseMetaData::getColumns got called with " );
-        buf.append( schemaPattern );
-        buf.append( "." );
-        buf.append( tableNamePattern );
-        buf.append( "." );
-        buf.append( columnNamePattern );
-        log(m_pSettings, LogLevel::Info, buf.makeStringAndClear());
+        log(m_pSettings, LogLevel::Info,
+            ("DatabaseMetaData::getColumns got called with " + schemaPattern + 
"."
+             + tableNamePattern + "." + columnNamePattern));
     }
 
     // ignore catalog, as a single pq connection
@@ -1634,14 +1626,9 @@ css::uno::Reference< XResultSet > 
DatabaseMetaData::getColumnPrivileges(
 
     if (isLog(m_pSettings, LogLevel::Info))
     {
-        OUStringBuffer buf( 128 );
-        buf.append( "DatabaseMetaData::getColumnPrivileges got called with " );
-        buf.append( schema );
-        buf.append( "." );
-        buf.append( table );
-        buf.append( "." );
-        buf.append( columnNamePattern );
-        log(m_pSettings, LogLevel::Info, buf.makeStringAndClear());
+        log(m_pSettings, LogLevel::Info,
+            ("DatabaseMetaData::getColumnPrivileges got called with " + schema 
+ "." + table + "."
+             + columnNamePattern));
     }
 
     Reference< XParameters > parameters( m_getColumnPrivs_stmt, 
UNO_QUERY_THROW );
@@ -1663,12 +1650,9 @@ css::uno::Reference< XResultSet > 
DatabaseMetaData::getTablePrivileges(
 
     if (isLog(m_pSettings, LogLevel::Info))
     {
-        OUStringBuffer buf( 128 );
-        buf.append( "DatabaseMetaData::getTablePrivileges got called with " );
-        buf.append( schemaPattern );
-        buf.append( "." );
-        buf.append( tableNamePattern );
-        log(m_pSettings, LogLevel::Info, buf.makeStringAndClear());
+        log(m_pSettings, LogLevel::Info,
+            ("DatabaseMetaData::getTablePrivileges got called with " + 
schemaPattern + "."
+             + tableNamePattern));
     }
 
     Reference< XParameters > parameters( m_getTablePrivs_stmt, UNO_QUERY_THROW 
);
@@ -1721,12 +1705,8 @@ css::uno::Reference< XResultSet > 
DatabaseMetaData::getPrimaryKeys(
 
     if (isLog(m_pSettings, LogLevel::Info))
     {
-        OUStringBuffer buf( 128 );
-        buf.append( "DatabaseMetaData::getPrimaryKeys got called with " );
-        buf.append( schema );
-        buf.append( "." );
-        buf.append( table );
-        log(m_pSettings, LogLevel::Info, buf.makeStringAndClear());
+        log(m_pSettings, LogLevel::Info,
+            "DatabaseMetaData::getPrimaryKeys got called with " + schema + "." 
+ table);
     }
 
     Reference< XPreparedStatement > statement = m_origin->prepareStatement(
diff --git a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx 
b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
index 74254ebffd14..d30d62d9032e 100644
--- a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
@@ -53,6 +53,7 @@
 #include <com/sun/star/sdbc/ResultSetType.hpp>
 #include <com/sun/star/sdbc/SQLException.hpp>
 
+#include <memory>
 #include <string.h>
 
 #include <connectivity/dbconversion.hxx>
@@ -430,11 +431,7 @@ void PreparedStatement::setInt( sal_Int32 parameterIndex, 
sal_Int32 x )
     MutexGuard guard(m_xMutex->GetMutex() );
     checkClosed();
     checkColumnIndex( parameterIndex );
-    OStringBuffer buf( 20 );
-    buf.append( "'" );
-    buf.append( x );
-    buf.append( "'" );
-    m_vars[parameterIndex-1] = buf.makeStringAndClear();
+    m_vars[parameterIndex-1] = "'" + OString::number(x) + "'";
 }
 
 void PreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 x )
@@ -442,11 +439,7 @@ void PreparedStatement::setLong( sal_Int32 parameterIndex, 
sal_Int64 x )
     MutexGuard guard(m_xMutex->GetMutex() );
     checkClosed();
     checkColumnIndex( parameterIndex );
-    OStringBuffer buf( 20 );
-    buf.append( "'" );
-    buf.append( x );
-    buf.append( "'" );
-    m_vars[parameterIndex-1] = buf.makeStringAndClear();
+    m_vars[parameterIndex-1] = "'" + OString::number(x) + "'";
 }
 
 void PreparedStatement::setFloat( sal_Int32 parameterIndex, float x )
@@ -454,11 +447,7 @@ void PreparedStatement::setFloat( sal_Int32 
parameterIndex, float x )
     MutexGuard guard(m_xMutex->GetMutex() );
     checkClosed();
     checkColumnIndex( parameterIndex );
-    OStringBuffer buf( 20 );
-    buf.append( "'" );
-    buf.append( x );
-    buf.append( "'" );
-    m_vars[parameterIndex-1] = buf.makeStringAndClear();
+    m_vars[parameterIndex-1] = "'" + OString::number(x) + "'";
 }
 
 void PreparedStatement::setDouble( sal_Int32 parameterIndex, double x )
@@ -466,11 +455,7 @@ void PreparedStatement::setDouble( sal_Int32 
parameterIndex, double x )
     MutexGuard guard(m_xMutex->GetMutex() );
     checkClosed();
     checkColumnIndex( parameterIndex );
-    OStringBuffer buf( 20 );
-    buf.append( "'" );
-    buf.append( x );
-    buf.append( "'" );
-    m_vars[parameterIndex-1] = buf.makeStringAndClear();
+    m_vars[parameterIndex-1] = "'" + OString::number(x) + "'";
 }
 
 void PreparedStatement::setString( sal_Int32 parameterIndex, const OUString& x 
)
@@ -496,21 +481,18 @@ void PreparedStatement::setBytes(
     MutexGuard guard(m_xMutex->GetMutex() );
     checkClosed();
     checkColumnIndex( parameterIndex );
-    OStringBuffer buf( 20 );
-    buf.append( "'" );
     size_t len;
-    unsigned char * escapedString =
-        PQescapeBytea( reinterpret_cast<unsigned char const 
*>(x.getConstArray()), x.getLength(), &len);
+    struct Free { void operator ()(void * p) const { free(p); } };
+    std::unique_ptr<unsigned char, Free> escapedString(
+        PQescapeBytea( reinterpret_cast<unsigned char const 
*>(x.getConstArray()), x.getLength(), &len));
     if( ! escapedString )
     {
         throw SQLException(
             "pq_preparedstatement.setBytes: Error during converting 
bytesequence to an SQL conform string",
             *this, OUString(), 1, Any() );
     }
-    buf.append( reinterpret_cast<char *>(escapedString), len -1 );
-    free( escapedString );
-    buf.append( "'" );
-    m_vars[parameterIndex-1] = buf.makeStringAndClear();
+    m_vars[parameterIndex-1]
+        = "'" + rtl::OStringView(reinterpret_cast<char 
*>(escapedString.get()), len -1) + "'";
 }
 
 
diff --git a/connectivity/source/drivers/postgresql/pq_statement.cxx 
b/connectivity/source/drivers/postgresql/pq_statement.cxx
index b8303c1a5ad0..ae17e3bb5c81 100644
--- a/connectivity/source/drivers/postgresql/pq_statement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_statement.cxx
@@ -218,14 +218,9 @@ void Statement::close(  )
 void Statement::raiseSQLException(
     const OUString & sql, const char * errorMsg )
 {
-    OUStringBuffer buf(128);
-    buf.append( "pq_driver: ");
-    buf.append(
-        OUString( errorMsg, strlen(errorMsg), ConnectionSettings::encoding ) );
-    buf.append( " (caused by statement '" );
-    buf.append( sql );
-    buf.append( "')" );
-    OUString error = buf.makeStringAndClear();
+    OUString error = "pq_driver: "
+        + OUString( errorMsg, strlen(errorMsg), ConnectionSettings::encoding )
+        + " (caused by statement '" + sql + "')";
     log(m_pSettings, LogLevel::Error, error);
     throw SQLException( error, *this, OUString(), 1, Any() );
 }
@@ -319,11 +314,10 @@ static std::vector< OUString > lookupKeys(
                         keySupplier.clear();
                         if (isLog(pSettings, LogLevel::Info))
                         {
-                            OStringBuffer buf( 128 );
-                            buf.append( "Can't offer updateable result set 
because table " );
-                            buf.append( OUStringToOString(name, 
ConnectionSettings::encoding) );
-                            buf.append( " is duplicated, add schema to resolve 
ambiguity" );
-                            log(pSettings, LogLevel::Info, 
buf.makeStringAndClear().getStr());
+                            OString buf = "Can't offer updateable result set 
because table "
+                                + OUStringToOString(name, 
ConnectionSettings::encoding)
+                                + " is duplicated, add schema to resolve 
ambiguity";
+                            log(pSettings, LogLevel::Info, buf.getStr());
                         }
                         break;
                     }
@@ -336,11 +330,9 @@ static std::vector< OUString > lookupKeys(
     {
         if (isLog(pSettings, LogLevel::Info))
         {
-            OStringBuffer buf( 128 );
-            buf.append( "Can't offer updateable result set ( table " );
-            buf.append( OUStringToOString(table, ConnectionSettings::encoding) 
);
-            buf.append( " is unknown)" );
-            log(pSettings, LogLevel::Info, buf.makeStringAndClear().getStr());
+            OString buf = "Can't offer updateable result set ( table "
+                + OUStringToOString(table, ConnectionSettings::encoding) + " 
is unknown)";
+            log(pSettings, LogLevel::Info, buf.getStr());
         }
     }
 
@@ -382,11 +374,10 @@ static std::vector< OUString > lookupKeys(
         {
             if (isLog(pSettings, LogLevel::Info))
             {
-                OStringBuffer buf( 128 );
-                buf.append( "Can't offer updateable result set ( table " );
-                buf.append( OUStringToOString(table, 
ConnectionSettings::encoding) );
-                buf.append( " does not have a primary key)" );
-                log(pSettings, LogLevel::Info, 
buf.makeStringAndClear().getStr());
+                OString buf = "Can't offer updateable result set ( table "
+                    + OUStringToOString(table, ConnectionSettings::encoding)
+                    + " does not have a primary key)";
+                log(pSettings, LogLevel::Info, buf.getStr());
             }
         }
     }
@@ -496,12 +487,8 @@ bool executePostgresCommand( const OString & cmd, struct 
CommandData *data )
                 }
                 else if( ! table.getLength() )
                 {
-                    OStringBuffer buf( 128 );
-                    buf.append( "can't support updateable resultset, because a 
single table in the "
-                                "WHERE part of the statement could not be 
identified (" );
-                    buf.append( cmd );
-                    buf.append( "." );
-                    aReason = buf.makeStringAndClear();
+                    aReason = "can't support updateable resultset, because a 
single table in the "
+                        "WHERE part of the statement could not be identified 
(" + cmd + ".";
                 }
                 else if( !sourceTableKeys.empty() )
                 {
@@ -518,22 +505,17 @@ bool executePostgresCommand( const OString & cmd, struct 
CommandData *data )
                 else
                 {
 
-                    OStringBuffer buf( 128 );
-                    buf.append( "can't support updateable resultset for table 
" );
-                    buf.append( OUStringToOString( schema, 
ConnectionSettings::encoding ) );
-                    buf.append( "." );
-                    buf.append( OUStringToOString( table, 
ConnectionSettings::encoding ) );
-                    buf.append( ", because resultset table does not have a 
primary key " );
-                    aReason = buf.makeStringAndClear();
+                    aReason = "can't support updateable resultset for table "
+                        + OUStringToOString( schema, 
ConnectionSettings::encoding ) + "."
+                        + OUStringToOString( table, 
ConnectionSettings::encoding )
+                        + ", because resultset table does not have a primary 
key ";
                 }
             }
             else
             {
-                OStringBuffer buf( 128 );
-                buf.append( "can't support updateable result for selects with 
multiple tables (" );
-                buf.append( cmd );
-                buf.append( ")" );
-                log(pSettings, LogLevel::Sql, 
buf.makeStringAndClear().getStr() );
+                OString buf = "can't support updateable result for selects 
with multiple tables ("
+                    + cmd + ")";
+                log(pSettings, LogLevel::Sql, buf.getStr() );
             }
             if( ! (*(data->pLastResultset)).is() )
             {
@@ -568,16 +550,10 @@ bool executePostgresCommand( const OString & cmd, struct 
CommandData *data )
         ret = true;
         if (isLog(pSettings, LogLevel::Sql))
         {
-            OStringBuffer buf( 128 );
-            buf.append( "executed query '" );
-            buf.append( cmd );
-            buf.append( "' successfully" );
-            buf.append( ", duration=" );
-            buf.append( duration );
-            buf.append( "ms, returnedRows=" );
-            buf.append( returnedRows );
-            buf.append( "." );
-            log(pSettings, LogLevel::Sql, buf.makeStringAndClear().getStr());
+            OString buf = "executed query '" + cmd + "' successfully, 
duration="
+                + OString::number(duration) + "ms, returnedRows=" + 
OString::number(returnedRows)
+                + ".";
+            log(pSettings, LogLevel::Sql, buf.getStr());
         }
         break;
     }
diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx 
b/connectivity/source/drivers/postgresql/pq_tools.cxx
index 63ed515e2659..20fa3b4bb215 100644
--- a/connectivity/source/drivers/postgresql/pq_tools.cxx
+++ b/connectivity/source/drivers/postgresql/pq_tools.cxx
@@ -88,11 +88,7 @@ namespace pq_sdbc_driver
 
 OUString concatQualified( const OUString & a, const OUString &b)
 {
-    OUStringBuffer buf( a.getLength() + 2 + b.getLength() );
-    buf.append( a );
-    buf.append( "." );
-    buf.append( b );
-    return buf.makeStringAndClear();
+    return a + "." + b;
 }
 
 static OString iOUStringToOString( const OUString& str, ConnectionSettings 
const *settings) {
diff --git a/connectivity/source/drivers/postgresql/pq_xtables.cxx 
b/connectivity/source/drivers/postgresql/pq_xtables.cxx
index 2c57e8f10551..e15dc478e210 100644
--- a/connectivity/source/drivers/postgresql/pq_xtables.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xtables.cxx
@@ -133,9 +133,7 @@ void Tables::refresh()
 
             {
                 m_values.push_back( makeAny( prop ) );
-                OUStringBuffer buf( name.getLength() + schema.getLength() + 1);
-                buf.append( schema ).append( "." ).append( name );
-                map[ buf.makeStringAndClear() ] = tableIndex;
+                map[ schema + "." + name ] = tableIndex;
                 ++tableIndex;
             }
         }
diff --git a/connectivity/source/drivers/postgresql/pq_xviews.cxx 
b/connectivity/source/drivers/postgresql/pq_xviews.cxx
index 2d0ed008fa4b..ac684a16c124 100644
--- a/connectivity/source/drivers/postgresql/pq_xviews.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xviews.cxx
@@ -115,9 +115,7 @@ void Views::refresh()
 
             {
                 m_values.push_back( makeAny( prop ) );
-                OUStringBuffer buf( table.getLength() + schema.getLength() + 
1);
-                buf.append( schema ).append( "." ).append( table );
-                map[ buf.makeStringAndClear() ] = viewIndex;
+                map[ schema + "." + table ] = viewIndex;
                 ++viewIndex;
             }
         }
@@ -191,12 +189,9 @@ void Views::dropByIndex( sal_Int32 index )
     set->getPropertyValue( st.SCHEMA_NAME ) >>= schema;
     set->getPropertyValue( st.NAME ) >>= name;
 
-    OUStringBuffer update( 128 );
-    update.append( "DROP VIEW \"" ).append( schema ).append( "\".\"" ).append( 
name ).append( "\"" );
-
     Reference< XStatement > stmt = m_origin->createStatement( );
 
-    stmt->executeUpdate( update.makeStringAndClear() );
+    stmt->executeUpdate( "DROP VIEW \"" + schema + "\".\"" + name + "\"" );
 }
 
 
diff --git a/cppu/source/cppu/cppu_opt.cxx b/cppu/source/cppu/cppu_opt.cxx
index 9ad9fbd98f0f..40f90de6e347 100644
--- a/cppu/source/cppu/cppu_opt.cxx
+++ b/cppu/source/cppu/cppu_opt.cxx
@@ -22,7 +22,7 @@
 #include <com/sun/star/uno/Any.hxx>
 #include <typelib/typedescription.h>
 #include <uno/any2.h>
-#include <rtl/ustrbuf.hxx>
+#include <rtl/ustring.hxx>
 
 
 using namespace ::rtl;
@@ -32,11 +32,8 @@ extern "C" rtl_uString * SAL_CALL 
cppu_unsatisfied_iquery_msg(
     typelib_TypeDescriptionReference * pType )
     SAL_THROW_EXTERN_C()
 {
-    OUStringBuffer buf( 64 );
-    buf.append( "unsatisfied query for interface of type " );
-    buf.append( OUString::unacquired( &pType->pTypeName ) );
-    buf.append( '!' );
-    OUString ret( buf.makeStringAndClear() );
+    OUString ret = "unsatisfied query for interface of type "
+        + OUString::unacquired( &pType->pTypeName ) + "!";
     rtl_uString_acquire( ret.pData );
     return ret.pData;
 }
@@ -46,11 +43,8 @@ extern "C" rtl_uString * SAL_CALL cppu_unsatisfied_iset_msg(
     typelib_TypeDescriptionReference * pType )
     SAL_THROW_EXTERN_C()
 {
-    OUStringBuffer buf( 64 );
-    buf.append( "invalid attempt to assign an empty interface of type " );
-    buf.append( OUString::unacquired( &pType->pTypeName ) );
-    buf.append( '!' );
-    OUString ret( buf.makeStringAndClear() );
+    OUString ret = "invalid attempt to assign an empty interface of type "
+        + OUString::unacquired( &pType->pTypeName ) + "!";
     rtl_uString_acquire( ret.pData );
     return ret.pData;
 }
diff --git a/cppu/source/typelib/static_types.cxx 
b/cppu/source/typelib/static_types.cxx
index f88e642aeb7b..5a400817115d 100644
--- a/cppu/source/typelib/static_types.cxx
+++ b/cppu/source/typelib/static_types.cxx
@@ -24,7 +24,6 @@
 
 #include <osl/mutex.hxx>
 #include <rtl/ustring.hxx>
-#include <rtl/ustrbuf.hxx>
 #include <rtl/instance.hxx>
 
 #include <typelib/typedescription.h>
@@ -297,10 +296,7 @@ void SAL_CALL typelib_static_sequence_type_init(
         MutexGuard aGuard( typelib_StaticInitMutex::get() );
         if (! *ppRef)
         {
-            OUStringBuffer aBuf( 32 );
-            aBuf.append( "[]" );
-            aBuf.append( pElementType->pTypeName );
-            OUString aTypeName( aBuf.makeStringAndClear() );
+            OUString aTypeName = "[]" + 
OUString::unacquired(&pElementType->pTypeName);
 
             assert( ! 
TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(typelib_TypeClass_SEQUENCE) );
             *ppRef = igetTypeByName( aTypeName.pData );
diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index fd1464d5244f..10995e7ad3e0 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -774,11 +774,9 @@ extern "C" void SAL_CALL uno_dumpEnvironmentByName(
     }
     else
     {
-        OUStringBuffer buf( 32 );
-        buf.append( "environment \"" );
-        buf.append( pEnvDcp );
-        buf.append( "\" does not exist!" );
-        writeLine( stream, buf.makeStringAndClear(), pFilter );
+        writeLine(
+            stream, "environment \"" + OUString::unacquired(&pEnvDcp) + "\" 
does not exist!",
+            pFilter );
     }
 }
 
diff --git a/i18npool/source/localedata/LocaleNode.cxx 
b/i18npool/source/localedata/LocaleNode.cxx
index 15c6a2f69ca1..f9436d5ddf9a 100644
--- a/i18npool/source/localedata/LocaleNode.cxx
+++ b/i18npool/source/localedata/LocaleNode.cxx
@@ -796,9 +796,7 @@ void LCFormatNode::generateCode (const OFileWriter &of) 
const
                         if (n100s < 0)
                             incErrorInt( "Error: Time100SecSeparator not 
present in FormatCode formatindex=\"%d\".\n",
                                     formatindex);
-                        OUStringBuffer a100s( pSep->getValue());
-                        a100s.append( "00");
-                        n100s = aCode.indexOf( a100s.makeStringAndClear());
+                        n100s = aCode.indexOf( pSep->getValue() + "00");
                         if (n100s < 0)
                             incErrorInt( "Error: Time100SecSeparator+00 not 
present in FormatCode formatindex=\"%d\".\n",
                                     formatindex);
diff --git a/idlc/source/options.cxx b/idlc/source/options.cxx
index c3a19a365267..d9b0003a60cb 100644
--- a/idlc/source/options.cxx
+++ b/idlc/source/options.cxx
@@ -274,9 +274,7 @@ bool Options::initOptions(std::vector< std::string > & 
rArgs)
         if (m_options.count("-I") > 0)
         {
           // append param.
-          OStringBuffer buffer(m_options["-I"]);
-          buffer.append(' '); buffer.append(param);
-          param = buffer.makeStringAndClear();
+          param = m_options["-I"] + " " + param;
         }
         m_options["-I"] = param;
         break;
@@ -291,9 +289,7 @@ bool Options::initOptions(std::vector< std::string > & 
rArgs)
         param += OString((*first).c_str(), (*first).size());
         if (m_options.count("-D") > 0)
         {
-          OStringBuffer buffer(m_options["-D"]);
-          buffer.append(' '); buffer.append(param);
-          param = buffer.makeStringAndClear();
+          param = m_options["-D"] + " " + param;
         }
         m_options["-D"] = param;
         break;
diff --git a/idlc/source/parser.y b/idlc/source/parser.y
index 083153c1827a..9c055d920a33 100644
--- a/idlc/source/parser.y
+++ b/idlc/source/parser.y
@@ -48,7 +48,7 @@
 
 #include "attributeexceptions.hxx"
 
-#include <rtl/strbuf.hxx>
+#include <rtl/string.hxx>
 #include <osl/diagnose.h>
 
 #include <algorithm>
@@ -75,10 +75,7 @@ static void checkIdentifier(OString const * id)
         if ( (id->pData->buffer[0] >= 97 && id->pData->buffer[0] <= 122)
              || id->pData->buffer[0] == '_') {
             if (check == 1) {
-                OStringBuffer msg(25 + id->getLength());
-                msg.append("mismatched identifier '");
-                msg.append(*id);
-                msg.append("'");
+                OString msg = "mismatched identifier '" + *id + "'";
                 ErrorHandler::syntaxError(idlc()->getParseState(),
                                          idlc()->getLineNumber(),
                                          msg.getStr());
diff --git a/sc/qa/unit/helper/csv_handler.hxx 
b/sc/qa/unit/helper/csv_handler.hxx
index 71dfc9cae1e2..cadcf0050d8b 100644
--- a/sc/qa/unit/helper/csv_handler.hxx
+++ b/sc/qa/unit/helper/csv_handler.hxx
@@ -17,8 +17,6 @@
 #include <cellform.hxx>
 #include <cellvalue.hxx>
 
-#include <rtl/strbuf.hxx>
-
 #define DEBUG_CSV_HANDLER 0
 
 inline OUString getConditionalFormatString(ScDocument* pDoc, SCCOL nCol, SCROW 
nRow, SCTAB nTab)
@@ -49,24 +47,15 @@ inline OString createErrorMessage(SCCOL nCol, SCROW nRow, 
SCTAB nTab)
 
 inline OString createErrorMessage(SCCOL nCol, SCROW nRow, SCTAB nTab, const 
OUString& rExpectedString, const OUString& rString)
 {
-    OStringBuffer aString(createErrorMessage(nCol, nRow, nTab));
-    aString.append("; Expected: '");
-    aString.append(OUStringToOString(rExpectedString, RTL_TEXTENCODING_UTF8));
-    aString.append("' Found: '");
-    aString.append(OUStringToOString(rString, RTL_TEXTENCODING_UTF8));
-    aString.append("'");
-    return aString.makeStringAndClear();
+    return createErrorMessage(nCol, nRow, nTab) + "; Expected: '"
+        + OUStringToOString(rExpectedString, RTL_TEXTENCODING_UTF8) + "' 
Found: '"
+        + OUStringToOString(rString, RTL_TEXTENCODING_UTF8) + "'";
 }
 
 inline OString createErrorMessage(SCCOL nCol, SCROW nRow, SCTAB nTab, double 
aExpected, double aValue)
 {
-    OStringBuffer aString(createErrorMessage(nCol, nRow, nTab));
-    aString.append("; Expected: '");
-    aString.append(aExpected);
-    aString.append("' Found: '");
-    aString.append(aValue);
-    aString.append("'");
-    return aString.makeStringAndClear();
+    return createErrorMessage(nCol, nRow, nTab) + "; Expected: '" + 
OString::number(aExpected)
+        + "' Found: '" + OString::number(aValue) + "'";
 
 }
 
diff --git a/scripting/source/provider/MasterScriptProvider.cxx 
b/scripting/source/provider/MasterScriptProvider.cxx
index 7a5475541179..9367ea4c4236 100644
--- a/scripting/source/provider/MasterScriptProvider.cxx
+++ b/scripting/source/provider/MasterScriptProvider.cxx
@@ -298,10 +298,7 @@ MasterScriptProvider::getScript( const OUString& scriptURI 
)
          )
     {
         Reference< provider::XScriptProvider > xScriptProvider;
-        OUStringBuffer buf( 80 );
-        buf.append( "com.sun.star.script.provider.ScriptProviderFor");
-        buf.append( language );
-        OUString serviceName = buf.makeStringAndClear();
+        OUString serviceName = 
"com.sun.star.script.provider.ScriptProviderFor" + language;
         if ( !providerCache() )
         {
             throw provider::ScriptFrameworkErrorException(
diff --git a/sw/qa/core/macros-test.cxx b/sw/qa/core/macros-test.cxx
index 01b317cb12c2..739b24afbf5c 100644
--- a/sw/qa/core/macros-test.cxx
+++ b/sw/qa/core/macros-test.cxx
@@ -93,11 +93,8 @@ private:
 
 void SwMacrosTest::createFileURL(const OUString& aFileBase, const OUString& 
aFileExtension, OUString& rFilePath)
 {
-    OUString aSep("/");
-    OUStringBuffer aBuffer( m_directories.getSrcRootURL() );
-    aBuffer.append(m_aBaseString).append(aSep).append(aFileExtension);
-    aBuffer.append(aSep).append(aFileBase).append(aFileExtension);
-    rFilePath = aBuffer.makeStringAndClear();
+    rFilePath = m_directories.getSrcRootURL() + m_aBaseString + "/" + 
aFileExtension + "/"
+        + aFileBase + aFileExtension;
 }
 
 void SwMacrosTest::testVba()
diff --git a/unotools/source/config/eventcfg.cxx 
b/unotools/source/config/eventcfg.cxx
index deb87647599c..b0e36fc62c4d 100644
--- a/unotools/source/config/eventcfg.cxx
+++ b/unotools/source/config/eventcfg.cxx
@@ -26,7 +26,6 @@
 #include <o3tl/enumarray.hxx>
 #include <o3tl/enumrange.hxx>
 #include <rtl/ref.hxx>
-#include <rtl/ustrbuf.hxx>
 #include <sal/log.hxx>
 
 #include "itemholder1.hxx"
@@ -194,11 +193,7 @@ void GlobalEventConfig_Impl::initBindingInfo()
     Sequence< OUString > lMacros(1);
     for (const auto& rEventName : lEventNames )
     {
-        OUStringBuffer aBuffer( 32 );
-        aBuffer.append( aSetNode );
-        aBuffer.append( rEventName );
-        aBuffer.append( aCommandKey );
-        lMacros[0] = aBuffer.makeStringAndClear();
+        lMacros[0] = aSetNode + rEventName + aCommandKey;
         SAL_INFO("unotools", "reading binding for: " << lMacros[0]);
         Sequence< Any > lValues = GetProperties( lMacros );
         OUString sMacroURL;
diff --git a/unotools/source/config/moduleoptions.cxx 
b/unotools/source/config/moduleoptions.cxx
index 103bf2a7bd3e..c6442a16ab9e 100644
--- a/unotools/source/config/moduleoptions.cxx
+++ b/unotools/source/config/moduleoptions.cxx
@@ -24,7 +24,6 @@
 #include <comphelper/sequence.hxx>
 #include <osl/diagnose.h>
 #include <o3tl/enumarray.hxx>
-#include <rtl/ustrbuf.hxx>
 #include <rtl/instance.hxx>
 #include <com/sun/star/uno/Any.hxx>
 #include <com/sun/star/uno/Sequence.hxx>
@@ -728,11 +727,7 @@ void SvtModuleOptions_Impl::MakeReadonlyStatesAvailable()
     css::uno::Sequence< OUString > lFactories = GetNodeNames(OUString());
     std::transform(lFactories.begin(), lFactories.end(), lFactories.begin(),
         [](const OUString& rFactory) -> OUString {
-            OUStringBuffer sPath(256);
-            sPath.append(rFactory                  );
-            sPath.append(PATHSEPARATOR             );
-            sPath.append(PROPERTYNAME_DEFAULTFILTER);
-            return sPath.makeStringAndClear();
+            return rFactory + PATHSEPARATOR PROPERTYNAME_DEFAULTFILTER;
         });
 
     css::uno::Sequence< sal_Bool > lReadonlyStates = 
GetReadOnlyStates(lFactories);
diff --git a/unotools/source/config/syslocaleoptions.cxx 
b/unotools/source/config/syslocaleoptions.cxx
index f3942f5b7c4d..7cbb817ee1bf 100644
--- a/unotools/source/config/syslocaleoptions.cxx
+++ b/unotools/source/config/syslocaleoptions.cxx
@@ -18,7 +18,6 @@
  */
 
 #include <com/sun/star/uno/Sequence.hxx>
-#include <rtl/ustrbuf.hxx>
 #include <rtl/instance.hxx>
 #include <sal/log.hxx>
 #include <i18nlangtag/mslangid.hxx>
@@ -660,11 +659,7 @@ OUString SvtSysLocaleOptions::CreateCurrencyConfigString(
     OUString aIsoStr( LanguageTag::convertToBcp47( eLang ) );
     if ( !aIsoStr.isEmpty() )
     {
-        OUStringBuffer aStr( rAbbrev.getLength() + 1 + aIsoStr.getLength() );
-        aStr.append( rAbbrev );
-        aStr.append( '-' );
-        aStr.append( aIsoStr );
-        return aStr.makeStringAndClear();
+        return rAbbrev + "-" + aIsoStr;
     }
     else
         return rAbbrev;
diff --git a/xmlhelp/source/treeview/tvread.cxx 
b/xmlhelp/source/treeview/tvread.cxx
index ddfba452c67d..d791692fc782 100644
--- a/xmlhelp/source/treeview/tvread.cxx
+++ b/xmlhelp/source/treeview/tvread.cxx
@@ -123,12 +123,7 @@ namespace treeview {
         {
             if( targetURL.isEmpty() )
             {
-                OUStringBuffer strBuff( 21 + id.getLength() );
-                strBuff.append(
-                                    "vnd.sun.star.help://"
-                                    ).append(id);
-
-                targetURL = strBuff.makeStringAndClear();
+                targetURL = "vnd.sun.star.help://" + id;
             }
 
             return targetURL;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to