diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-04-29 12:24:31 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-04-29 18:25:31 +0200 |
commit | 04aafba860f613c20e7078d038cc83eb02de0b54 (patch) | |
tree | 8153152b87089419bde17313d9ac7b9de6fcce32 /dbaccess | |
parent | 76c793d2acf66f46e9edcda43d2f4327e8374841 (diff) |
loplugin:stringadd simplify some *StringBuffer operations
pulled from a larger patch which I created with a more permissive
variant of this plugin
Change-Id: I7abf1f3f09e84703b6e0e52fe9587dff691b2187
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114875
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/core/dataaccess/documentdefinition.cxx | 6 | ||||
-rw-r--r-- | dbaccess/source/core/misc/sdbcoretools.cxx | 9 | ||||
-rw-r--r-- | dbaccess/source/filter/hsqldb/parseschema.cxx | 5 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppDetailPageHelper.cxx | 7 | ||||
-rw-r--r-- | dbaccess/source/ui/app/DocumentInfoPreview.cxx | 8 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/WCopyTable.cxx | 8 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/QueryDesignView.cxx | 9 |
7 files changed, 16 insertions, 36 deletions
diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 58047bb31101..8291597870c5 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -1892,11 +1892,7 @@ OUString SAL_CALL ODocumentDefinition::getHierarchicalName() OUString SAL_CALL ODocumentDefinition::composeHierarchicalName( const OUString& i_rRelativeName ) { - OUStringBuffer aBuffer; - aBuffer.append( getHierarchicalName() ); - aBuffer.append( '/' ); - aBuffer.append( i_rRelativeName ); - return aBuffer.makeStringAndClear(); + return getHierarchicalName() + "/" + i_rRelativeName; } void SAL_CALL ODocumentDefinition::rename( const OUString& _rNewName ) diff --git a/dbaccess/source/core/misc/sdbcoretools.cxx b/dbaccess/source/core/misc/sdbcoretools.cxx index bc830418db39..5cd5367ba117 100644 --- a/dbaccess/source/core/misc/sdbcoretools.cxx +++ b/dbaccess/source/core/misc/sdbcoretools.cxx @@ -95,12 +95,9 @@ namespace dbaccess Exception aExcept; _rError >>= aExcept; - OUStringBuffer aBuffer; - aBuffer.append( _rError.getValueTypeName() ); - aBuffer.append( ":\n" ); - aBuffer.append( aExcept.Message ); - - sDisplayMessage = aBuffer.makeStringAndClear(); + sDisplayMessage = _rError.getValueTypeName() + + ":\n" + + aExcept.Message; } return sDisplayMessage; diff --git a/dbaccess/source/filter/hsqldb/parseschema.cxx b/dbaccess/source/filter/hsqldb/parseschema.cxx index 3e615428f2d4..c3b7951a8219 100644 --- a/dbaccess/source/filter/hsqldb/parseschema.cxx +++ b/dbaccess/source/filter/hsqldb/parseschema.cxx @@ -84,10 +84,7 @@ public: if (sName.indexOf('"') >= 0) { // Table name with string delimiter - OUStringBuffer sMultiName("\""); - sMultiName.append(string::split(m_sql, u'"')[1]); - sMultiName.append("\""); - sName = sMultiName.makeStringAndClear(); + sName = "\"" + string::split(m_sql, u'"')[1] + "\""; } return sName; } diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx index f13926e3d204..00ace78497b1 100644 --- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx +++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx @@ -334,12 +334,7 @@ void OAppDetailPageHelper::describeCurrentSelectionForType(const ElementType eTy bool bParent = rTreeView.iter_parent(*xParent); while (bParent) { - OUStringBuffer buffer; - buffer.append(rTreeView.get_text(*xParent)); - buffer.append('/'); - buffer.append(sName); - sName = buffer.makeStringAndClear(); - + sName = rTreeView.get_text(*xParent) + "/" + sName; bParent = rTreeView.iter_parent(*xParent); } diff --git a/dbaccess/source/ui/app/DocumentInfoPreview.cxx b/dbaccess/source/ui/app/DocumentInfoPreview.cxx index d00a77899572..7220eb2bdb30 100644 --- a/dbaccess/source/ui/app/DocumentInfoPreview.cxx +++ b/dbaccess/source/ui/app/DocumentInfoPreview.cxx @@ -152,10 +152,10 @@ void ODocumentInfoPreview::insertDateTime( value.Hours, value.Minutes, value.Seconds, value.NanoSeconds)); if (aToolsDT.IsValidAndGregorian()) { const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() ); - OUStringBuffer buf(rLocaleWrapper.getDate(aToolsDT)); - buf.append(", "); - buf.append(rLocaleWrapper.getTime(aToolsDT)); - insertEntry(SvtDocInfoTable_Impl::GetString(id), buf.makeStringAndClear()); + OUString buf = rLocaleWrapper.getDate(aToolsDT) + + ", " + + rLocaleWrapper.getTime(aToolsDT); + insertEntry(SvtDocInfoTable_Impl::GetString(id), buf); } } diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index 05d6181ca881..6ef0819c4099 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -369,12 +369,8 @@ OFieldDescription* NamedTableCopySource::createFieldDescription( const OUString& OUString NamedTableCopySource::getSelectStatement() const { - OUStringBuffer aSQL; - aSQL.append( "SELECT * FROM " ); - - aSQL.append( ::dbtools::composeTableNameForSelect( m_xConnection, m_sTableCatalog, m_sTableSchema, m_sTableBareName ) ); - - return aSQL.makeStringAndClear(); + return "SELECT * FROM " + + ::dbtools::composeTableNameForSelect( m_xConnection, m_sTableCatalog, m_sTableSchema, m_sTableBareName ); } ::utl::SharedUNOComponent< XPreparedStatement > NamedTableCopySource::getPreparedSelectStatement() const diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index 22408bbc58aa..63c5d07998ec 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -658,11 +658,10 @@ namespace if ( field->isAggregateFunction() ) { OSL_ENSURE(!field->GetFunction().isEmpty(),"Function name must not be empty! ;-("); - OUStringBuffer aTmpStr2( field->GetFunction()); - aTmpStr2.append("("); - aTmpStr2.append(aTmpStr.makeStringAndClear()); - aTmpStr2.append(")"); - aTmpStr = aTmpStr2; + aTmpStr = field->GetFunction() + + "(" + + aTmpStr + + ")"; } if (!rFieldAlias.isEmpty() && |