diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-04-23 16:07:32 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-04-27 14:07:56 +0200 |
commit | c7c6f0af6c836ebe0968967a1e7c8320b0ac17d6 (patch) | |
tree | 4bc5b2fa623b9765b88bbfe7de10a7590c87d5c8 /connectivity | |
parent | 99482297c7dd497e41fad2e7193759043e305101 (diff) |
loplugin:stringadd convert chained append to +
which can use the more efficient *StringConcat
Also fix a crash in stringview plugin which
started happening while I working on this.
Change-Id: I91a5b9b7707d1594d27d80b73930f5afac8ae608
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114568
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/commontools/dbtools2.cxx | 4 | ||||
-rw-r--r-- | connectivity/source/commontools/sqlerror.cxx | 6 | ||||
-rw-r--r-- | connectivity/source/drivers/firebird/Util.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/drivers/postgresql/pq_xkeys.cxx | 5 | ||||
-rw-r--r-- | connectivity/source/drivers/postgresql/pq_xviews.cxx | 2 |
5 files changed, 7 insertions, 12 deletions
diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx index 907bc7fd3698..9805f63afba4 100644 --- a/connectivity/source/commontools/dbtools2.cxx +++ b/connectivity/source/commontools/dbtools2.cxx @@ -261,8 +261,8 @@ namespace for(sal_Int32 i=0;i<nColCount;++i) { if ( (_xColumns->getByIndex(i) >>= xColProp) && xColProp.is() ) - sSql.append( ::dbtools::quoteName(sQuote,::comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME)))) ) - .append(","); + sSql.append( ::dbtools::quoteName(sQuote,::comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME)))) + + ","); } if ( nColCount ) diff --git a/connectivity/source/commontools/sqlerror.cxx b/connectivity/source/commontools/sqlerror.cxx index dee6f36f0b61..9f8608384d1d 100644 --- a/connectivity/source/commontools/sqlerror.cxx +++ b/connectivity/source/commontools/sqlerror.cxx @@ -222,13 +222,9 @@ namespace connectivity OUString SQLError_Impl::impl_getErrorMessage( ErrorCondition _eCondition ) { - OUStringBuffer aMessage; - OUString sResMessage(Translate::get(lcl_getResourceErrorID(_eCondition), m_aResources)); OSL_ENSURE( !sResMessage.isEmpty(), "SQLError_Impl::impl_getErrorMessage: illegal error condition, or invalid resource!" ); - aMessage.append( getMessagePrefix() ).append( " " ).append( sResMessage ); - - return aMessage.makeStringAndClear(); + return getMessagePrefix() + " " + sResMessage; } OUString SQLError_Impl::impl_getSQLState( ErrorCondition _eCondition ) diff --git a/connectivity/source/drivers/firebird/Util.cxx b/connectivity/source/drivers/firebird/Util.cxx index 3bf3cfbc4d82..46b87d7caf12 100644 --- a/connectivity/source/drivers/firebird/Util.cxx +++ b/connectivity/source/drivers/firebird/Util.cxx @@ -51,7 +51,7 @@ OUString firebird::StatusVectorToString(const ISC_STATUS_ARRAY& rStatusVector, { SAL_WARN("connectivity.firebird", "ignore fb_interpret exception"); } - buf.append("\ncaused by\n'").append(rCause).append("'\n"); + buf.append(OUString::Concat("\ncaused by\n'") + rCause + "'\n"); OUString error = buf.makeStringAndClear(); SAL_WARN("connectivity.firebird", error); diff --git a/connectivity/source/drivers/postgresql/pq_xkeys.cxx b/connectivity/source/drivers/postgresql/pq_xkeys.cxx index 88d8b5b1189b..84507202fa9a 100644 --- a/connectivity/source/drivers/postgresql/pq_xkeys.cxx +++ b/connectivity/source/drivers/postgresql/pq_xkeys.cxx @@ -172,10 +172,9 @@ void Keys::refresh() if( css::sdbcx::KeyType::FOREIGN == keyType ) { - OUStringBuffer buf( 128 ); - buf.append( xRow->getString( 6 ) ).append( "." ).append( xRow->getString( 5 ) ); + OUString buf = xRow->getString( 6 ) + "." + xRow->getString( 5 ); pKey->setPropertyValue_NoBroadcast_public( - st.REFERENCED_TABLE, makeAny( buf.makeStringAndClear() ) ); + st.REFERENCED_TABLE, makeAny( buf ) ); Int2StringMap foreignMap; fillAttnum2attnameMap( foreignMap, m_origin, xRow->getString(6), xRow->getString(5)); diff --git a/connectivity/source/drivers/postgresql/pq_xviews.cxx b/connectivity/source/drivers/postgresql/pq_xviews.cxx index 3f36c168b6d2..d71219fa6420 100644 --- a/connectivity/source/drivers/postgresql/pq_xviews.cxx +++ b/connectivity/source/drivers/postgresql/pq_xviews.cxx @@ -149,7 +149,7 @@ void Views::appendByDescriptor( buf.append( "CREATE VIEW "); bufferQuoteQualifiedIdentifier( buf, schema, name, m_pSettings ); - buf.append(" AS " ).append( command ); + buf.append(" AS " + command ); stmt->executeUpdate( buf.makeStringAndClear() ); |