[Libreoffice-commits] core.git: 2 commits - basctl/source chart2/source connectivity/source cppcanvas/source cui/source dbaccess/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Jul 28 15:23:00 UTC 2018


 basctl/source/basicide/baside2b.cxx                   |   32 +++++++--------
 chart2/source/controller/main/ElementSelector.cxx     |    8 +--
 chart2/source/tools/ExplicitCategoriesProvider.cxx    |    8 +--
 chart2/source/tools/TitleHelper.cxx                   |    8 +--
 connectivity/source/commontools/TTableHelper.cxx      |    3 -
 connectivity/source/commontools/dbtools2.cxx          |   10 ++--
 connectivity/source/drivers/file/FStringFunctions.cxx |    6 +-
 connectivity/source/drivers/odbc/OStatement.cxx       |   11 ++---
 cppcanvas/source/mtfrenderer/implrenderer.cxx         |    8 +--
 cui/source/customize/cfg.cxx                          |    6 +-
 cui/source/dialogs/FontFeaturesDialog.cxx             |   16 +++----
 cui/source/dialogs/SpellDialog.cxx                    |   16 +++----
 cui/source/dialogs/multipat.cxx                       |   20 ++++-----
 cui/source/dialogs/screenshotannotationdlg.cxx        |    6 +-
 cui/source/dialogs/scriptdlg.cxx                      |   10 ++--
 cui/source/options/optaboutconfig.cxx                 |   38 +++++++++---------
 cui/source/options/optjava.cxx                        |    8 +--
 cui/source/options/optpath.cxx                        |   20 ++++-----
 dbaccess/source/core/api/KeySet.cxx                   |   10 +---
 dbaccess/source/ui/dlg/directsql.cxx                  |    6 +-
 dbaccess/source/ui/dlg/queryfilter.cxx                |   23 +++++-----
 dbaccess/source/ui/dlg/queryorder.cxx                 |   12 ++---
 dbaccess/source/ui/dlg/tablespage.cxx                 |   19 +++------
 dbaccess/source/ui/inc/queryfilter.hxx                |    2 
 dbaccess/source/ui/misc/DExport.cxx                   |   18 ++++----
 dbaccess/source/ui/misc/HtmlReader.cxx                |    8 +--
 dbaccess/source/ui/misc/WCopyTable.cxx                |   14 ++----
 27 files changed, 168 insertions(+), 178 deletions(-)

New commits:
commit d407304544cdb2edc3cbdb4e56d49f3ceda79c38
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sat Jul 28 11:28:52 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Jul 28 17:22:52 2018 +0200

    loplugin:stringloop cui,dbaccess
    
    Change-Id: I32b63d2435d36b869823ea022ebd7f8347a46ea0
    Reviewed-on: https://gerrit.libreoffice.org/58211
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index e43192869947..b67e1e9def05 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -978,9 +978,9 @@ namespace cppcanvas
                 nMaxWidth += nWidth + 1;
 
                 long nFullStrikeoutWidth = 0;
-                OUString aStrikeoutText;
+                OUStringBuffer aStrikeoutText;
                 while( (nFullStrikeoutWidth+=nStrikeoutWidth ) < nMaxWidth+1 )
-                    aStrikeoutText += OUStringLiteral1(pChars[0]);
+                    aStrikeoutText.append(pChars[0]);
 
                 sal_Int32 nLen = aStrikeoutText.getLength();
 
@@ -1008,9 +1008,9 @@ namespace cppcanvas
                             aShadowOffset,
                             aShadowColor,
                             aTextFillColor,
-                            aStrikeoutText,
+                            aStrikeoutText.makeStringAndClear(),
                             0/*nStartPos*/,
-                            aStrikeoutText.getLength(),
+                            nLen,
                             pStrikeoutCharWidths,
                             rParms.mrVDev,
                             rParms.mrCanvas,
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 466b2caa877d..29f8641eacef 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -3345,16 +3345,16 @@ void SvxIconSelectorDialog::ImportGraphics(
 
     if ( rejectedCount != 0 )
     {
-        OUString message;
+        OUStringBuffer message;
         OUString fPath;
         if (rejectedCount > 1)
               fPath = rPaths[0].copy(8) + "/";
         for ( sal_Int32 i = 0; i < rejectedCount; ++i )
         {
-            message += fPath + rejected[i] + "\n";
+            message.append(fPath).append(rejected[i]).append("\n");
         }
 
-        SvxIconChangeDialog aDialog(GetFrameWeld(), message);
+        SvxIconChangeDialog aDialog(GetFrameWeld(), message.makeStringAndClear());
         (void)aDialog.run();
     }
 }
diff --git a/cui/source/dialogs/FontFeaturesDialog.cxx b/cui/source/dialogs/FontFeaturesDialog.cxx
index 676f216e25ec..21c71ce753b7 100644
--- a/cui/source/dialogs/FontFeaturesDialog.cxx
+++ b/cui/source/dialogs/FontFeaturesDialog.cxx
@@ -177,7 +177,7 @@ IMPL_LINK_NOARG(FontFeaturesDialog, ComboBoxSelectedHdl, ComboBox&, void) { upda
 OUString FontFeaturesDialog::createFontNameWithFeatures()
 {
     OUString sResultFontName;
-    OUString sNameSuffix;
+    OUStringBuffer sNameSuffix;
     bool bFirst = true;
 
     for (FontFeatureItem& rItem : m_aFeatureItems)
@@ -187,11 +187,11 @@ OUString FontFeaturesDialog::createFontNameWithFeatures()
             if (rItem.m_pCheck->IsChecked())
             {
                 if (!bFirst)
-                    sNameSuffix += OUString(vcl::font::FeatureSeparator);
+                    sNameSuffix.append(OUString(vcl::font::FeatureSeparator));
                 else
                     bFirst = false;
 
-                sNameSuffix += vcl::font::featureCodeAsString(rItem.m_aFeatureCode);
+                sNameSuffix.append(vcl::font::featureCodeAsString(rItem.m_aFeatureCode));
             }
         }
         else if (rItem.m_pCombo && rItem.m_pText)
@@ -200,19 +200,19 @@ OUString FontFeaturesDialog::createFontNameWithFeatures()
             if (nSelection > 0)
             {
                 if (!bFirst)
-                    sNameSuffix += OUString(vcl::font::FeatureSeparator);
+                    sNameSuffix.append(OUString(vcl::font::FeatureSeparator));
                 else
                     bFirst = false;
 
-                sNameSuffix += vcl::font::featureCodeAsString(rItem.m_aFeatureCode);
-                sNameSuffix += "=";
-                sNameSuffix += OUString::number(nSelection);
+                sNameSuffix.append(vcl::font::featureCodeAsString(rItem.m_aFeatureCode));
+                sNameSuffix.append("=");
+                sNameSuffix.append(OUString::number(nSelection));
             }
         }
     }
     sResultFontName = vcl::font::trimFontNameFeatures(m_sFontName);
     if (!sNameSuffix.isEmpty())
-        sResultFontName += OUString(vcl::font::FeaturePrefix) + sNameSuffix;
+        sResultFontName += OUString(vcl::font::FeaturePrefix) + sNameSuffix.makeStringAndClear();
     return sResultFontName;
 }
 
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index 073095d01c5f..7552ce613fcb 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -1034,14 +1034,14 @@ bool SpellDialog::GetNextSentence_Impl(bool bUseSavedSentence, bool bRecheck)
 
     if(!aSentence.empty())
     {
-        OUString sText;
+        OUStringBuffer sText;
         for (auto const& elem : aSentence)
         {
             // hidden text has to be ignored
             if(!elem.bIsHidden)
-                sText += elem.sText;
+                sText.append(elem.sText);
         }
-        m_pSentenceED->SetText(sText);
+        m_pSentenceED->SetText(sText.makeStringAndClear());
         sal_Int32 nStartPosition = 0;
         sal_Int32 nEndPosition = 0;
 
@@ -1882,22 +1882,22 @@ svx::SpellPortions SentenceEditWindow_Impl::CreateSpellPortions() const
         const sal_uInt32 nPara = pTextEngine->GetParagraphCount();
         if (nPara > 1)
         {
-            OUString aLeftOverText;
+            OUStringBuffer aLeftOverText;
             for (sal_uInt32 i = 1; i < nPara; ++i)
             {
-                aLeftOverText += "\x0a";    // the manual line break...
-                aLeftOverText += pTextEngine->GetText(i);
+                aLeftOverText.append("\x0a");    // the manual line break...
+                aLeftOverText.append(pTextEngine->GetText(i));
             }
             if (pError)
             {   // we need to add a new portion containing the left-over text
                 svx::SpellPortion aPortion2;
                 aPortion2.eLanguage = eLang;
-                aPortion2.sText = aLeftOverText;
+                aPortion2.sText = aLeftOverText.makeStringAndClear();
                 aRet.push_back( aPortion2 );
             }
             else
             {   // we just need to append the left-over text to the last portion (which had no errors)
-                aRet[ aRet.size() - 1 ].sText += aLeftOverText;
+                aRet[ aRet.size() - 1 ].sText += aLeftOverText.makeStringAndClear();
             }
         }
    }
diff --git a/cui/source/dialogs/multipat.cxx b/cui/source/dialogs/multipat.cxx
index ec1ecffa957f..a5f0734b85f2 100644
--- a/cui/source/dialogs/multipat.cxx
+++ b/cui/source/dialogs/multipat.cxx
@@ -246,7 +246,7 @@ void SvxMultiPathDialog::dispose()
 
 OUString SvxMultiPathDialog::GetPath() const
 {
-    OUString sNewPath;
+    OUStringBuffer sNewPath;
     sal_Unicode cDelim = SVT_SEARCHPATH_DELIMITER;
 
     OUString sWritable;
@@ -258,29 +258,29 @@ OUString SvxMultiPathDialog::GetPath() const
         else
         {
             if ( !sNewPath.isEmpty() )
-                sNewPath += OUStringLiteral1(cDelim);
-            sNewPath += *static_cast<OUString*>(pEntry->GetUserData());
+                sNewPath.append(cDelim);
+            sNewPath.append( *static_cast<OUString*>(pEntry->GetUserData()) );
         }
     }
     if ( !sNewPath.isEmpty() )
-        sNewPath += OUStringLiteral1(cDelim);
-    sNewPath += sWritable;
+        sNewPath.append(cDelim);
+    sNewPath.append(sWritable);
 
-    return sNewPath;
+    return sNewPath.makeStringAndClear();
 }
 
 OUString SvxPathSelectDialog::GetPath() const
 {
-    OUString sNewPath;
+    OUStringBuffer sNewPath;
 
     for (int i = 0; i < m_xPathLB->n_children(); ++i)
     {
         if ( !sNewPath.isEmpty() )
-            sNewPath += OUStringLiteral1(SVT_SEARCHPATH_DELIMITER);
-        sNewPath += m_xPathLB->get_id(i);
+            sNewPath.append(SVT_SEARCHPATH_DELIMITER);
+        sNewPath.append( m_xPathLB->get_id(i));
     }
 
-    return sNewPath;
+    return sNewPath.makeStringAndClear();
 }
 
 void SvxMultiPathDialog::SetPath( const OUString& rPath )
diff --git a/cui/source/dialogs/screenshotannotationdlg.cxx b/cui/source/dialogs/screenshotannotationdlg.cxx
index d0fa722fe0d5..86e53c89e081 100644
--- a/cui/source/dialogs/screenshotannotationdlg.cxx
+++ b/cui/source/dialogs/screenshotannotationdlg.cxx
@@ -599,14 +599,14 @@ IMPL_LINK(ScreenshotAnnotationDlg_Impl, pictureFrameListener, VclWindowEvent&, r
                         maSelected.insert(mpHilighted);
                     }
 
-                    OUString aBookmarks;
+                    OUStringBuffer aBookmarks(maMainMarkupText);
                     for (auto&& rCandidate : maSelected)
                     {
                         OUString aHelpId = OStringToOUString( rCandidate->GetHelpId(), RTL_TEXTENCODING_UTF8 );
-                        aBookmarks += lcl_Bookmark( aHelpId );
+                        aBookmarks.append(lcl_Bookmark( aHelpId ));
                     }
 
-                    mpText->SetText( maMainMarkupText + aBookmarks );
+                    mpText->SetText( aBookmarks.makeStringAndClear() );
                     bRepaint = true;
                 }
                 break;
diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index 18ee71314a1f..7e6d8ac97d0e 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -1090,12 +1090,12 @@ bool SvxScriptOrgDialog::getBoolProperty( Reference< beans::XPropertySet > const
 
 OUString SvxScriptOrgDialog::getListOfChildren( const Reference< browse::XBrowseNode >& node, int depth )
 {
-    OUString result = "\n";
+    OUStringBuffer result = "\n";
     for( int i=0;i<=depth;i++ )
     {
-        result += "\t";
+        result.append("\t");
     }
-    result += node->getName();
+    result.append(node->getName());
 
     try
     {
@@ -1105,7 +1105,7 @@ OUString SvxScriptOrgDialog::getListOfChildren( const Reference< browse::XBrowse
                 = node->getChildNodes();
             for ( sal_Int32 n = 0; n < children.getLength(); n++ )
             {
-                result += getListOfChildren( children[ n ] , depth+1 );
+                result.append( getListOfChildren( children[ n ] , depth+1 ) );
             }
         }
     }
@@ -1114,7 +1114,7 @@ OUString SvxScriptOrgDialog::getListOfChildren( const Reference< browse::XBrowse
         // ignore, will return an empty string
     }
 
-    return result;
+    return result.makeStringAndClear();
 }
 
 Selection_hash SvxScriptOrgDialog::m_lastSelection;
diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx
index 54348cbe63f1..2d81d02f4ee2 100644
--- a/cui/source/options/optaboutconfig.cxx
+++ b/cui/source/options/optaboutconfig.cxx
@@ -310,7 +310,7 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
             );
 
             OUString sType = aNode.getValueTypeName();
-            OUString sValue;
+            OUStringBuffer sValue;
 
             if (it != m_modifiedPrefBoxEntries.end())
                 sValue = static_cast< SvLBoxString& >( (*it)->GetItem(4) ).GetText();
@@ -347,9 +347,9 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
                         {
                             if( j != 0 )
                             {
-                                sValue += ",";
+                                sValue.append(",");
                             }
-                            sValue += OUString::boolean( seq[j] );
+                            sValue.append(OUString::boolean( seq[j] ));
                         }
                     }
                     else if( sType == "[]byte" )
@@ -361,9 +361,9 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
                                 static_cast<sal_uInt8>(seq[j]), 16 );
                             if( s.getLength() == 1 )
                             {
-                                sValue += "0";
+                                sValue.append("0");
                             }
-                            sValue += s.toAsciiUpperCase();
+                            sValue.append(s.toAsciiUpperCase());
                         }
                     }
                     else if( sType == "[][]byte" )
@@ -373,7 +373,7 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
                         {
                             if( j != 0 )
                             {
-                                sValue += ",";
+                                sValue.append(",");
                             }
                             for( sal_Int32 k = 0; k != seq[j].getLength(); ++k )
                             {
@@ -381,9 +381,9 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
                                     static_cast<sal_uInt8>(seq[j][k]), 16 );
                                 if( s.getLength() == 1 )
                                 {
-                                    sValue += "0";
+                                    sValue.append("0");
                                 }
-                                sValue += s.toAsciiUpperCase();
+                                sValue.append(s.toAsciiUpperCase());
                             }
                         }
                     }
@@ -394,9 +394,9 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
                         {
                             if( j != 0 )
                             {
-                                sValue += ",";
+                                sValue.append(",");
                             }
-                            sValue += OUString::number( seq[j] );
+                            sValue.append(OUString::number( seq[j] ));
                         }
                     }
                     else if( sType == "[]long" )
@@ -406,9 +406,9 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
                         {
                             if( j != 0 )
                             {
-                                sValue += ",";
+                                sValue.append(",");
                             }
-                            sValue += OUString::number( seq[j] );
+                            sValue.append(OUString::number( seq[j] ));
                         }
                     }
                     else if( sType == "[]hyper" )
@@ -418,9 +418,9 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
                         {
                             if( j != 0 )
                             {
-                                sValue += ",";
+                                sValue.append(",");
                             }
-                            sValue += OUString::number( seq[j] );
+                            sValue.append(OUString::number( seq[j] ));
                         }
                     }
                     else if( sType == "[]double" )
@@ -430,9 +430,9 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
                         {
                             if( j != 0 )
                             {
-                                sValue += ",";
+                                sValue.append(",");
                             }
-                            sValue += OUString::number( seq[j] );
+                            sValue.append(OUString::number( seq[j] ));
                         }
                     }
                     else if( sType == "[]string" )
@@ -442,9 +442,9 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
                         {
                             if( j != 0 )
                             {
-                                sValue += ",";
+                                sValue.append(",");
                             }
-                            sValue += seq[j];
+                            sValue.append(seq[j]);
                         }
                     }
                     else
@@ -470,7 +470,7 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
             for(int j = 1; j < lineage; ++j)
                 index = sPath.indexOf("/", index + 1);
 
-            InsertEntry(sPath, sPath.copy(index+1), seqItems[i], sType, sValue, pParentEntry, !bLoadAll);
+            InsertEntry(sPath, sPath.copy(index+1), seqItems[i], sType, sValue.makeStringAndClear(), pParentEntry, !bLoadAll);
         }
     }
 }
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index dd76e58280d0..6c72fb818e5e 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -984,15 +984,15 @@ bool SvxJavaClassPathDlg::IsPathDuplicate( const OUString& _rPath )
 
 OUString SvxJavaClassPathDlg::GetClassPath() const
 {
-    OUString sPath;
+    OUStringBuffer sPath;
     int nCount = m_xPathList->n_children();
     for (int i = 0; i < nCount; ++i)
     {
         if (!sPath.isEmpty())
-            sPath += OUStringLiteral1(CLASSPATH_DELIMITER);
-        sPath += m_xPathList->get_text(i);
+            sPath.append(CLASSPATH_DELIMITER);
+        sPath.append(m_xPathList->get_text(i));
     }
-    return sPath;
+    return sPath.makeStringAndClear();
 }
 
 void SvxJavaClassPathDlg::SetClassPath( const OUString& _rPath )
diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx
index cca312d78608..24f167b94bba 100644
--- a/cui/source/options/optpath.cxx
+++ b/cui/source/options/optpath.cxx
@@ -147,24 +147,23 @@ static OUString getCfgName_Impl( sal_uInt16 _nHandle )
 
 static OUString Convert_Impl( const OUString& rValue )
 {
-    OUString aReturn;
     if (rValue.isEmpty())
-        return aReturn;
+        return OUString();
 
     sal_Int32 nPos = 0;
-
+    OUStringBuffer aReturn;
     for (;;)
     {
         OUString aValue = rValue.getToken( 0, MULTIPATH_DELIMITER, nPos );
         INetURLObject aObj( aValue );
         if ( aObj.GetProtocol() == INetProtocol::File )
-            aReturn += aObj.PathToFileName();
+            aReturn.append(aObj.PathToFileName());
         if ( nPos < 0 )
             break;
-        aReturn += OUStringLiteral1(MULTIPATH_DELIMITER);
+        aReturn.append(MULTIPATH_DELIMITER);
     }
 
-    return aReturn;
+    return aReturn.makeStringAndClear();
 }
 
 // functions -------------------------------------------------------------
@@ -438,7 +437,8 @@ IMPL_LINK_NOARG(SvxPathTabPage, StandardHdl_Impl, Button*, void)
             }
             while ( nOldPos >= 0 );
 
-            OUString sUserPath, sWritablePath;
+            OUString sWritablePath;
+            OUStringBuffer sUserPath;
             if ( !sTemp.isEmpty() )
             {
                 sal_Int32 nNextPos = 0;
@@ -452,13 +452,13 @@ IMPL_LINK_NOARG(SvxPathTabPage, StandardHdl_Impl, Button*, void)
                         break;
                     }
                     if ( !sUserPath.isEmpty() )
-                        sUserPath += OUStringLiteral1(MULTIPATH_DELIMITER);
-                    sUserPath += sToken;
+                        sUserPath.append(MULTIPATH_DELIMITER);
+                    sUserPath.append(sToken);
                 }
             }
             pPathBox->SetEntryText( Convert_Impl( sTemp ), pEntry, 1 );
             pPathImpl->eState = SfxItemState::SET;
-            pPathImpl->sUserPath = sUserPath;
+            pPathImpl->sUserPath = sUserPath.makeStringAndClear();
             pPathImpl->sWritablePath = sWritablePath;
         }
         pEntry = pPathBox->NextSelected( pEntry );
diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx
index 78c10485df14..84cd83a3a43e 100644
--- a/dbaccess/source/core/api/KeySet.cxx
+++ b/dbaccess/source/core/api/KeySet.cxx
@@ -714,10 +714,8 @@ void OKeySet::executeInsert( const ORowSetRow& _rInsertRow,const OUString& i_sSQ
     if ( i_sTableName.isEmpty() && !bAutoValuesFetched && m_bInserted )
     {
         // first check if all key column values were set
-        const OUString sMax(" MAX(");
-        const OUString sMaxEnd("),");
         const OUString sQuote = getIdentifierQuoteString();
-        OUString sMaxStmt;
+        OUStringBuffer sMaxStmt;
         auto aEnd = m_pKeyColumnNames->end();
         for (auto const& autoColumn : m_aAutoColumns)
         {
@@ -725,14 +723,14 @@ void OKeySet::executeInsert( const ORowSetRow& _rInsertRow,const OUString& i_sSQ
             SelectColumnsMetaData::const_iterator aFind = m_pKeyColumnNames->find(autoColumn);
             if ( aFind != aEnd )
             {
-                sMaxStmt += sMax + ::dbtools::quoteName( sQuote,aFind->second.sRealName) + sMaxEnd;
+                sMaxStmt.append(" MAX(").append(::dbtools::quoteName( sQuote,aFind->second.sRealName)).append("),");
             }
         }
 
         if(!sMaxStmt.isEmpty())
         {
-            sMaxStmt = sMaxStmt.replaceAt(sMaxStmt.getLength()-1,1," ");
-            OUString sStmt = "SELECT " + sMaxStmt + "FROM ";
+            sMaxStmt[sMaxStmt.getLength()-1] = ' ';
+            OUString sStmt = "SELECT " + sMaxStmt.makeStringAndClear() + "FROM ";
             OUString sCatalog,sSchema,sTable;
             ::dbtools::qualifiedNameComponents(m_xConnection->getMetaData(),m_sUpdateTableName,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation);
             sStmt += ::dbtools::composeTableNameForSelect( m_xConnection, sCatalog, sSchema, sTable );
diff --git a/dbaccess/source/ui/dlg/directsql.cxx b/dbaccess/source/ui/dlg/directsql.cxx
index 6cab0eaa90d1..16216f60315f 100644
--- a/dbaccess/source/ui/dlg/directsql.cxx
+++ b/dbaccess/source/ui/dlg/directsql.cxx
@@ -259,7 +259,7 @@ namespace dbaui
         while (xRS->next())
         {
             // initialise the output line for each row
-            OUString out("");
+            OUStringBuffer out;
             // work along the columns until that are none left
             try
             {
@@ -267,7 +267,7 @@ namespace dbaui
                 for (;;)
                 {
                     // be dumb, treat everything as a string
-                    out += xRow->getString(i) + ",";
+                    out.append(xRow->getString(i)).append(",");
                     i++;
                 }
             }
@@ -276,7 +276,7 @@ namespace dbaui
             {
             }
             // report the output
-            addOutputText(out);
+            addOutputText(out.makeStringAndClear());
         }
     }
 
diff --git a/dbaccess/source/ui/dlg/queryfilter.cxx b/dbaccess/source/ui/dlg/queryfilter.cxx
index 72d1bdf51ac0..66f9c8c1d4fd 100644
--- a/dbaccess/source/ui/dlg/queryfilter.cxx
+++ b/dbaccess/source/ui/dlg/queryfilter.cxx
@@ -98,11 +98,10 @@ DlgFilterCrit::DlgFilterCrit(vcl::Window * pParent,
     m_pLB_WHERECOMP2->set_width_request(aSize.Width());
     m_pLB_WHERECOMP3->set_width_request(aSize.Width());
     const sal_Int32 nEntryCount =  m_pLB_WHERECOMP1->GetEntryCount();
+    m_aSTR_COMPARE_OPERATORS.resize(nEntryCount);
     for (sal_Int32 i = 0; i < nEntryCount; ++i)
     {
-        if (i > 0)
-            m_aSTR_COMPARE_OPERATORS += ";";
-        m_aSTR_COMPARE_OPERATORS += m_pLB_WHERECOMP1->GetEntry(i);
+        m_aSTR_COMPARE_OPERATORS[i] = m_pLB_WHERECOMP1->GetEntry(i);
     }
     m_pLB_WHERECOMP1->Clear();
 
@@ -218,8 +217,8 @@ void DlgFilterCrit::dispose()
 sal_Int32 DlgFilterCrit::GetOSQLPredicateType( const OUString& _rSelectedPredicate ) const
 {
     sal_Int32 nPredicateIndex = -1;
-    for ( sal_Int32 i=0; i < comphelper::string::getTokenCount(m_aSTR_COMPARE_OPERATORS, ';'); ++i)
-        if ( m_aSTR_COMPARE_OPERATORS.getToken(i, ';') == _rSelectedPredicate )
+    for ( size_t i=0; i < m_aSTR_COMPARE_OPERATORS.size(); ++i)
+        if ( m_aSTR_COMPARE_OPERATORS[i] == _rSelectedPredicate )
         {
             nPredicateIndex = i;
             break;
@@ -675,21 +674,21 @@ IMPL_LINK( DlgFilterCrit, ListSelectHdl, ListBox&, rListBox, void )
 
         if(eColumnSearch  == ColumnSearch::FULL)
         {
-            for(sal_Int32 i=0;i < comphelper::string::getTokenCount(m_aSTR_COMPARE_OPERATORS, ';');i++)
-                pComp->InsertEntry(m_aSTR_COMPARE_OPERATORS.getToken(i, ';'));
+            for(size_t i=0;i < m_aSTR_COMPARE_OPERATORS.size(); i++)
+                pComp->InsertEntry(m_aSTR_COMPARE_OPERATORS[i]);
         }
         else if(eColumnSearch == ColumnSearch::CHAR)
         {
             for(sal_Int32 i=6; i<10; i++)
-                pComp->InsertEntry(m_aSTR_COMPARE_OPERATORS.getToken(i, ';'));
+                pComp->InsertEntry(m_aSTR_COMPARE_OPERATORS[i]);
         }
         else if(eColumnSearch == ColumnSearch::BASIC)
         {
-            sal_Int32 i;
+            size_t i;
             for( i = 0; i < 6; i++ )
-                pComp->InsertEntry(m_aSTR_COMPARE_OPERATORS.getToken(i, ';'));
-            for(i=8; i < comphelper::string::getTokenCount(m_aSTR_COMPARE_OPERATORS, ';'); ++i)
-                pComp->InsertEntry(m_aSTR_COMPARE_OPERATORS.getToken(i, ';'));
+                pComp->InsertEntry(m_aSTR_COMPARE_OPERATORS[i]);
+            for(i=8; i < m_aSTR_COMPARE_OPERATORS.size(); ++i)
+                pComp->InsertEntry(m_aSTR_COMPARE_OPERATORS[i]);
         }
         else
         {
diff --git a/dbaccess/source/ui/dlg/queryorder.cxx b/dbaccess/source/ui/dlg/queryorder.cxx
index cb8af47b7f9b..a5d02374760a 100644
--- a/dbaccess/source/ui/dlg/queryorder.cxx
+++ b/dbaccess/source/ui/dlg/queryorder.cxx
@@ -219,23 +219,23 @@ OUString DlgOrderCrit::GetOrderList( ) const
 
     Reference< XNameAccess> xColumns = Reference< XColumnsSupplier >(m_xQueryComposer,UNO_QUERY)->getColumns();
 
-    OUString sOrder;
+    OUStringBuffer sOrder;
     for( sal_uInt16 i=0 ; i<DOG_ROWS; i++ )
     {
         if(m_aColumnList[i]->GetSelectedEntryPos() != 0)
         {
             if(!sOrder.isEmpty())
-                sOrder += ",";
+                sOrder.append(",");
 
             OUString sName = m_aColumnList[i]->GetSelectedEntry();
-            sOrder += ::dbtools::quoteName(sQuote,sName);
+            sOrder.append(::dbtools::quoteName(sQuote,sName));
             if(m_aValueList[i]->GetSelectedEntryPos())
-                sOrder += " DESC ";
+                sOrder.append(" DESC ");
             else
-                sOrder += " ASC ";
+                sOrder.append(" ASC ");
         }
     }
-    return sOrder;
+    return sOrder.makeStringAndClear();
 }
 
 void DlgOrderCrit::BuildOrderPart()
diff --git a/dbaccess/source/ui/dlg/tablespage.cxx b/dbaccess/source/ui/dlg/tablespage.cxx
index 431db3828481..ac348069c0e5 100644
--- a/dbaccess/source/ui/dlg/tablespage.cxx
+++ b/dbaccess/source/ui/dlg/tablespage.cxx
@@ -437,7 +437,6 @@ namespace dbaui
         Sequence< OUString > aTableFilter;
         static const char sWildcard[] = "%";
 
-        OUString sComposedName;
         const SvTreeListEntry* pAllObjectsEntry = m_pTablesList->getAllObjectsEntry();
         if (!pAllObjectsEntry)
             return aTableFilter;
@@ -451,6 +450,7 @@ namespace dbaui
 
             if (m_pTablesList->GetCheckButtonState(pEntry) == SvButtonState::Checked && !m_pTablesList->GetModel()->HasChildren(pEntry))
             {   // checked and a leaf, which means it's no catalog, no schema, but a real table
+                OUStringBuffer sComposedName;
                 OUString sCatalog;
                 if(m_pTablesList->GetModel()->HasParent(pEntry))
                 {
@@ -473,9 +473,9 @@ namespace dbaui
                                 bCatalogWildcard = OTableTreeListBox::isWildcardChecked(pCatalog);
                                 if (m_bCatalogAtStart)
                                 {
-                                    sComposedName += m_pTablesList->GetEntryText( pCatalog ) + m_sCatalogSeparator;
+                                    sComposedName.append(m_pTablesList->GetEntryText( pCatalog )).append(m_sCatalogSeparator);
                                     if (bCatalogWildcard)
-                                        sComposedName += sWildcard;
+                                        sComposedName.append(sWildcard);
                                 }
                                 else
                                 {
@@ -488,26 +488,23 @@ namespace dbaui
                             }
                         }
                         bSchemaWildcard = OTableTreeListBox::isWildcardChecked(pSchema);
-                        sComposedName += m_pTablesList->GetEntryText( pSchema ) + ".";
+                        sComposedName.append(m_pTablesList->GetEntryText( pSchema )).append(".");
                     }
 
                     if (bSchemaWildcard)
-                        sComposedName += sWildcard;
+                        sComposedName.append(sWildcard);
                 }
                 if (!bSchemaWildcard && !bCatalogWildcard)
-                    sComposedName += m_pTablesList->GetEntryText( pEntry );
+                    sComposedName.append(m_pTablesList->GetEntryText( pEntry ));
 
                 if (!m_bCatalogAtStart && !bCatalogWildcard)
-                    sComposedName += sCatalog;
+                    sComposedName.append(sCatalog);
 
                 // need some space
                 sal_Int32 nOldLen = aTableFilter.getLength();
                 aTableFilter.realloc(nOldLen + 1);
                 // add the new name
-                aTableFilter[nOldLen] = sComposedName;
-
-                // reset the composed name
-                sComposedName.clear();
+                aTableFilter[nOldLen] = sComposedName.makeStringAndClear();
             }
 
             if (bCatalogWildcard)
diff --git a/dbaccess/source/ui/inc/queryfilter.hxx b/dbaccess/source/ui/inc/queryfilter.hxx
index 377fb8dd51b9..1c4d46b7cc97 100644
--- a/dbaccess/source/ui/inc/queryfilter.hxx
+++ b/dbaccess/source/ui/inc/queryfilter.hxx
@@ -81,7 +81,7 @@ namespace dbaui
         VclPtr<ListBox>        m_pLB_WHERECOMP3;
         VclPtr<Edit>           m_pET_WHEREVALUE3;
 
-        OUString        m_aSTR_COMPARE_OPERATORS;
+        std::vector<OUString>  m_aSTR_COMPARE_OPERATORS;
 
         css::uno::Reference< css::sdb::XSingleSelectQueryComposer>    m_xQueryComposer;
         css::uno::Reference< css::container::XNameAccess>             m_xColumns;
diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx
index ddd3a07bc042..8cb191f8da8f 100644
--- a/dbaccess/source/ui/misc/DExport.cxx
+++ b/dbaccess/source/ui/misc/DExport.cxx
@@ -804,12 +804,12 @@ Reference< XPreparedStatement > ODatabaseExport::createPreparedStatment( const R
 {
     OUString sComposedTableName = ::dbtools::composeTableName( _xMetaData, _xDestTable, ::dbtools::EComposeRule::InDataManipulation, true );
 
-    OUString aSql = "INSERT INTO "
+    OUStringBuffer aSql = "INSERT INTO "
                   + sComposedTableName
                   + " ( ";
 
     // set values and column names
-    OUString aValues(" VALUES ( ");
+    OUStringBuffer aValues(" VALUES ( ");
 
     OUString aQuote;
     if ( _xMetaData.is() )
@@ -843,18 +843,18 @@ Reference< XPreparedStatement > ODatabaseExport::createPreparedStatment( const R
     {
         if ( !elem.isEmpty() )
         {
-            aSql += elem;
-            aSql += ",";
-            aValues += "?,";
+            aSql.append(elem);
+            aSql.append(",");
+            aValues.append("?,");
         }
     }
 
-    aSql = aSql.replaceAt(aSql.getLength()-1, 1, ")");
-    aValues = aValues.replaceAt(aValues.getLength()-1, 1, ")");
+    aSql[aSql.getLength()-1] = ')';
+    aValues[aValues.getLength()-1] = ')';
 
-    aSql += aValues;
+    aSql.append(aValues);
     // now create,fill and execute the prepared statement
-    return _xMetaData->getConnection()->prepareStatement(aSql);
+    return _xMetaData->getConnection()->prepareStatement(aSql.makeStringAndClear());
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/misc/HtmlReader.cxx b/dbaccess/source/ui/misc/HtmlReader.cxx
index c810a9175cf7..ad79d3b751ba 100644
--- a/dbaccess/source/ui/misc/HtmlReader.cxx
+++ b/dbaccess/source/ui/misc/HtmlReader.cxx
@@ -339,7 +339,7 @@ void OHTMLReader::TableFontOn(FontDescriptor& _rFont, Color &_rTextColor)
         case HtmlOptionId::FACE :
             {
                 const OUString& rFace = rOption.GetString();
-                OUString aFontName;
+                OUStringBuffer aFontName;
                 sal_Int32 nPos = 0;
                 while( nPos != -1 )
                 {
@@ -347,11 +347,11 @@ void OHTMLReader::TableFontOn(FontDescriptor& _rFont, Color &_rTextColor)
                     OUString aFName = rFace.getToken( 0, ',', nPos );
                     aFName = comphelper::string::strip(aFName, ' ');
                     if( !aFontName.isEmpty() )
-                        aFontName += ";";
-                    aFontName += aFName;
+                        aFontName.append(";");
+                    aFontName.append(aFName);
                 }
                 if ( !aFontName.isEmpty() )
-                    _rFont.Name = aFontName;
+                    _rFont.Name = aFontName.makeStringAndClear();
             }
             break;
         case HtmlOptionId::SIZE :
diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx
index ca58612c2c81..35b9df1de937 100644
--- a/dbaccess/source/ui/misc/WCopyTable.cxx
+++ b/dbaccess/source/ui/misc/WCopyTable.cxx
@@ -158,7 +158,7 @@ void ObjectCopySource::copyFilterAndSortingTo( const Reference< XConnection >& _
         const OUString sTargetName = ::dbtools::composeTableNameForSelect(_xConnection,_rxObject);
         const OUString sTargetNameTemp = sTargetName + ".";
 
-        OUString sStatement = "SELECT * FROM " + sTargetName + " WHERE 0=1";
+        OUStringBuffer sStatement = "SELECT * FROM " + sTargetName + " WHERE 0=1";
 
         for (const std::pair<OUString,OUString> & aPropertie : aProperties)
         {
@@ -168,17 +168,17 @@ void ObjectCopySource::copyFilterAndSortingTo( const Reference< XConnection >& _
                 m_xObject->getPropertyValue( aPropertie.first ) >>= sFilter;
                 if ( !sFilter.isEmpty() )
                 {
-                    sStatement += aPropertie.second;
+                    sStatement.append(aPropertie.second);
                     OUString sReplace = sFilter;
                     sReplace = sReplace.replaceFirst(sSourceName,sTargetNameTemp);
                     sFilter = sReplace;
                     _rxObject->setPropertyValue( aPropertie.first, makeAny(sFilter) );
-                    sStatement += sFilter;
+                    sStatement.append(sFilter);
                 }
             }
         }
 
-        _xConnection->createStatement()->executeQuery(sStatement);
+        _xConnection->createStatement()->executeQuery(sStatement.makeStringAndClear());
 
         if ( m_xObjectPSI->hasPropertyByName( PROPERTY_APPLYFILTER ) )
             _rxObject->setPropertyValue( PROPERTY_APPLYFILTER, m_xObject->getPropertyValue( PROPERTY_APPLYFILTER ) );
@@ -1384,8 +1384,7 @@ OUString OCopyTableWizard::convertColumnName(const TColumnFindFunctor&   _rCmpFu
 
             while(_rCmpFunctor(sName))
             {
-                sName = sAlias;
-                sName += OUString::number(++nPos);
+                sName = sAlias + OUString::number(++nPos);
             }
             sAlias = sName;
             // we have to check again, it could happen that the name is already to long
@@ -1521,8 +1520,7 @@ OUString OCopyTableWizard::createUniqueName(const OUString& _sName)
             sal_Int32 nPos = 0;
             while(m_vSourceColumns.find(sName) != m_vSourceColumns.end())
             {
-                sName = _sName;
-                sName += OUString::number(++nPos);
+                sName = _sName + OUString::number(++nPos);
             }
         }
     }
commit fa87224130a4ab6c4b79f993cc990adc4be0465b
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sat Jul 28 11:27:41 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Jul 28 17:22:39 2018 +0200

    loplugin:stringloop basctl,chart2,connectivity
    
    Change-Id: I21353dace60705d55b3d70f1e0bc610d55b84d63
    Reviewed-on: https://gerrit.libreoffice.org/58210
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index f32885c1292d..26c8b5170bf0 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -1890,15 +1890,15 @@ void StackWindow::UpdateCalls()
         SbMethod* pMethod = StarBASIC::GetActiveMethod( nScope );
         while ( pMethod )
         {
-            OUString aEntry( OUString::number(nScope ));
+            OUStringBuffer aEntry( OUString::number(nScope ));
             if ( aEntry.getLength() < 2 )
-                aEntry = " " + aEntry;
-            aEntry += ": "  + pMethod->GetName();
+                aEntry.insert(0, " ");
+            aEntry.append(": ").append(pMethod->GetName());
             SbxArray* pParams = pMethod->GetParameters();
             SbxInfo* pInfo = pMethod->GetInfo();
             if ( pParams )
             {
-                aEntry += "(";
+                aEntry.append("(");
                 // 0 is the sub's name...
                 for ( sal_uInt16 nParam = 1; nParam < pParams->Count(); nParam++ )
                 {
@@ -1906,34 +1906,34 @@ void StackWindow::UpdateCalls()
                     assert(pVar && "Parameter?!");
                     if ( !pVar->GetName().isEmpty() )
                     {
-                        aEntry += pVar->GetName();
+                        aEntry.append(pVar->GetName());
                     }
                     else if ( pInfo )
                     {
                         const SbxParamInfo* pParam = pInfo->GetParam( nParam );
                         if ( pParam )
                         {
-                            aEntry += pParam->aName;
+                            aEntry.append(pParam->aName);
                         }
                     }
-                    aEntry += "=";
+                    aEntry.append("=");
                     SbxDataType eType = pVar->GetType();
                     if( eType & SbxARRAY )
                     {
-                        aEntry += "..." ;
+                        aEntry.append("...");
                     }
                     else if( eType != SbxOBJECT )
                     {
-                        aEntry += pVar->GetOUString();
+                        aEntry.append(pVar->GetOUString());
                     }
                     if ( nParam < ( pParams->Count() - 1 ) )
                     {
-                        aEntry += ", ";
+                        aEntry.append(", ");
                     }
                 }
-                aEntry += ")";
+                aEntry.append(")");
             }
-            aTreeListBox->InsertEntry( aEntry );
+            aTreeListBox->InsertEntry( aEntry.makeStringAndClear() );
             nScope++;
             pMethod = StarBASIC::GetActiveMethod( nScope );
         }
@@ -2168,7 +2168,7 @@ void WatchTreeListBox::RequestingChildren( SvTreeListEntry * pParent )
 
             // Copy data and create name
 
-            OUString aIndexStr = "(";
+            OUStringBuffer aIndexStr = "(";
             pChildItem->mpArrayParentItem = pItem;
             pChildItem->nDimLevel = nThisLevel;
             pChildItem->nDimCount = pItem->nDimCount;
@@ -2177,10 +2177,10 @@ void WatchTreeListBox::RequestingChildren( SvTreeListEntry * pParent )
             for( j = 0 ; j < nParentLevel ; j++ )
             {
                 short n = pChildItem->vIndices[j] = pItem->vIndices[j];
-                aIndexStr += OUString::number( n ) + ",";
+                aIndexStr.append(OUString::number( n )).append(",");
             }
             pChildItem->vIndices[nParentLevel] = sal::static_int_cast<short>( i );
-            aIndexStr += OUString::number( i ) + ")";
+            aIndexStr.append(OUString::number( i )).append(")");
 
             OUString aDisplayName;
             WatchItem* pArrayRootItem = pChildItem->GetRootItem();
@@ -2188,7 +2188,7 @@ void WatchTreeListBox::RequestingChildren( SvTreeListEntry * pParent )
                 aDisplayName = pItem->maDisplayName;
             else
                 aDisplayName = pItem->maName;
-            aDisplayName += aIndexStr;
+            aDisplayName += aIndexStr.makeStringAndClear();
             pChildItem->maDisplayName = aDisplayName;
 
             SvTreeListEntry* pChildEntry = SvTreeListBox::InsertEntry( aDisplayName, pEntry );
diff --git a/chart2/source/controller/main/ElementSelector.cxx b/chart2/source/controller/main/ElementSelector.cxx
index a7ce1843d8f1..fd43b5457bf3 100644
--- a/chart2/source/controller/main/ElementSelector.cxx
+++ b/chart2/source/controller/main/ElementSelector.cxx
@@ -61,14 +61,12 @@ void lcl_addObjectsToList( const ObjectHierarchy& rHierarchy, const  ObjectIdent
     ObjectHierarchy::tChildContainer aChildren( rHierarchy.getChildren(rParent) );
     for (auto const& child : aChildren)
     {
-        ObjectIdentifier aOID = child;
-        OUString aCID = aOID.getObjectCID();
         ListBoxEntryData aEntry;
-        aEntry.OID = aOID;
-        aEntry.UIName += ObjectNameProvider::getNameForCID( aCID, xChartDoc );
+        aEntry.OID = child;
+        aEntry.UIName = ObjectNameProvider::getNameForCID( child.getObjectCID(), xChartDoc );
         aEntry.nHierarchyDepth = nHierarchyDepth;
         rEntries.push_back(aEntry);
-        lcl_addObjectsToList( rHierarchy, aOID, rEntries, nHierarchyDepth+1, xChartDoc );
+        lcl_addObjectsToList( rHierarchy, child, rEntries, nHierarchyDepth+1, xChartDoc );
     }
 }
 
diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx
index cab1103655dd..744d2ac2d383 100644
--- a/chart2/source/tools/ExplicitCategoriesProvider.cxx
+++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx
@@ -355,7 +355,7 @@ Sequence< OUString > lcl_getExplicitSimpleCategories(
         aRet.realloc(nMaxCategoryCount);
         for(sal_Int32 nN=0; nN<nMaxCategoryCount; nN++)
         {
-            OUString aText;
+            OUStringBuffer aText;
             for (auto const& complexCatPerIndex : aComplexCatsPerIndex)
             {
                 if ( static_cast<size_t>(nN) < complexCatPerIndex.size() )
@@ -364,12 +364,12 @@ Sequence< OUString > lcl_getExplicitSimpleCategories(
                     if( !aAddText.isEmpty() )
                     {
                         if(!aText.isEmpty())
-                            aText += " ";
-                        aText += aAddText;
+                            aText.append(" ");
+                        aText.append(aAddText);
                     }
                 }
             }
-            aRet[nN]=aText;
+            aRet[nN]=aText.makeStringAndClear();
         }
     }
     return aRet;
diff --git a/chart2/source/tools/TitleHelper.cxx b/chart2/source/tools/TitleHelper.cxx
index f93798d4aee4..0487fa6f51e2 100644
--- a/chart2/source/tools/TitleHelper.cxx
+++ b/chart2/source/tools/TitleHelper.cxx
@@ -300,13 +300,13 @@ uno::Reference< XTitle > TitleHelper::createTitle(
 
 OUString TitleHelper::getCompleteString( const uno::Reference< XTitle >& xTitle )
 {
-    OUString aRet;
     if(!xTitle.is())
-        return aRet;
+        return OUString();
+    OUStringBuffer aRet;
     uno::Sequence< uno::Reference< XFormattedString > > aStringList = xTitle->getText();
     for( sal_Int32 nN=0; nN<aStringList.getLength();nN++ )
-        aRet += aStringList[nN]->getString();
-    return aRet;
+        aRet.append( aStringList[nN]->getString() );
+    return aRet.makeStringAndClear();
 }
 
 void TitleHelper::setCompleteString( const OUString& rNewText
diff --git a/connectivity/source/commontools/TTableHelper.cxx b/connectivity/source/commontools/TTableHelper.cxx
index 6c7cd5f5aafc..92447c8e94db 100644
--- a/connectivity/source/commontools/TTableHelper.cxx
+++ b/connectivity/source/commontools/TTableHelper.cxx
@@ -448,12 +448,11 @@ void OTableHelper::refreshIndexes()
         if(xResult.is())
         {
             Reference< XRow > xRow(xResult,UNO_QUERY);
-            OUString aName;
             OUString sCatalogSep = getMetaData()->getCatalogSeparator();
             OUString sPreviousRoundName;
             while( xResult->next() )
             {
-                aName = xRow->getString(5);
+                OUString aName = xRow->getString(5);
                 if(!aName.isEmpty())
                     aName += sCatalogSep;
                 aName += xRow->getString(6);
diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx
index 5faf1146e67e..cd09553e06df 100644
--- a/connectivity/source/commontools/dbtools2.cxx
+++ b/connectivity/source/commontools/dbtools2.cxx
@@ -251,20 +251,20 @@ namespace
         ::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap();
 
         const OUString sQuote(_xMetaData->getIdentifierQuoteString());
-        OUString sSql( " (" );
+        OUStringBuffer sSql( " (" );
         Reference< XPropertySet > xColProp;
 
         sal_Int32 nColCount  = _xColumns->getCount();
         for(sal_Int32 i=0;i<nColCount;++i)
         {
             if ( (_xColumns->getByIndex(i) >>= xColProp) && xColProp.is() )
-                sSql += ::dbtools::quoteName(sQuote,::comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME))))
-                        + ",";
+                sSql.append( ::dbtools::quoteName(sQuote,::comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME)))) )
+                        .append(",");
         }
 
         if ( nColCount )
-            sSql = sSql.replaceAt(sSql.getLength()-1, 1, ")");
-        return sSql;
+            sSql[sSql.getLength()-1] = ')';
+        return sSql.makeStringAndClear();
     }
 }
 
diff --git a/connectivity/source/drivers/file/FStringFunctions.cxx b/connectivity/source/drivers/file/FStringFunctions.cxx
index 95119f650ebe..27dbdbfcc695 100644
--- a/connectivity/source/drivers/file/FStringFunctions.cxx
+++ b/connectivity/source/drivers/file/FStringFunctions.cxx
@@ -191,13 +191,13 @@ ORowSetValue OOp_Repeat::operate(const ORowSetValue& lhs,const ORowSetValue& rhs
     if ( lhs.isNull() || rhs.isNull() )
         return lhs;
 
-    OUString sRet;
+    OUStringBuffer sRet;
     sal_Int32 nCount = rhs;
     for (sal_Int32 i=0; i < nCount; ++i)
     {
-        sRet += lhs;
+        sRet.append(lhs.operator OUString());
     }
-    return sRet;
+    return sRet.makeStringAndClear();
 }
 
 ORowSetValue OOp_Insert::operate(const std::vector<ORowSetValue>& lhs) const
diff --git a/connectivity/source/drivers/odbc/OStatement.cxx b/connectivity/source/drivers/odbc/OStatement.cxx
index a26526894080..0ebc71e7dbde 100644
--- a/connectivity/source/drivers/odbc/OStatement.cxx
+++ b/connectivity/source/drivers/odbc/OStatement.cxx
@@ -33,6 +33,7 @@
 #include <cppuhelper/typeprovider.hxx>
 #include <cppuhelper/queryinterface.hxx>
 #include <comphelper/types.hxx>
+#include <rtl/strbuf.hxx>
 #include <algorithm>
 #include <strings.hrc>
 #include <connectivity/dbexception.hxx>
@@ -474,18 +475,18 @@ Sequence< sal_Int32 > SAL_CALL OStatement::executeBatch(  )
     ::osl::MutexGuard aGuard( m_aMutex );
     checkDisposed(OStatement_BASE::rBHelper.bDisposed);
 
-
-    OString aBatchSql;
+    OStringBuffer aBatchSql;
     sal_Int32 nLen = m_aBatchVector.size();
 
     for (auto const& elem : m_aBatchVector)
     {
-        aBatchSql += OUStringToOString(elem,getOwnConnection()->getTextEncoding());
-        aBatchSql += ";";
+        aBatchSql.append(OUStringToOString(elem,getOwnConnection()->getTextEncoding()));
+        aBatchSql.append(";");
     }
 
     OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
-    THROW_SQL(N3SQLExecDirect(m_aStatementHandle, reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(aBatchSql.getStr())), aBatchSql.getLength()));
+    auto s = aBatchSql.makeStringAndClear();
+    THROW_SQL(N3SQLExecDirect(m_aStatementHandle, reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(s.getStr())), s.getLength()));
 
     Sequence< sal_Int32 > aRet(nLen);
     sal_Int32* pArray = aRet.getArray();


More information about the Libreoffice-commits mailing list