sfx2/source/appl/linkmgr2.cxx              |    6 ++----
 sfx2/source/appl/newhelp.cxx               |   11 +++--------
 sfx2/source/appl/sfxhelp.cxx               |    5 +----
 sfx2/source/control/unoctitm.cxx           |    4 +---
 sfx2/source/dialog/splitwin.cxx            |   15 +++++++--------
 sfx2/source/doc/DocumentMetadataAccess.cxx |    3 +--
 sfx2/source/view/viewfrm.cxx               |   10 +++++-----
 7 files changed, 20 insertions(+), 34 deletions(-)

New commits:
commit 1c8d43d8a9062dbe2cff52b61414e8be6d3b646d
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Mar 30 10:17:04 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Mar 30 09:45:16 2023 +0000

    loplugin:stringadd in sfx2
    
    when applying my upcoming patch to also consider O[U]StringBuffer
    
    Change-Id: I72c2afa0b6bddfe00fe09f34eb1b1bf2177461d1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149747
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx
index 977ed98518fe..aeefbf10da20 100644
--- a/sfx2/source/appl/linkmgr2.cxx
+++ b/sfx2/source/appl/linkmgr2.cxx
@@ -458,16 +458,14 @@ void LinkManager::InsertFileLink(
         return;
 
     OUStringBuffer aBuf(64);
-    aBuf.append(rFileNm);
-    aBuf.append(sfx2::cTokenSeparator);
+    aBuf.append(rFileNm + OUStringChar(sfx2::cTokenSeparator));
 
     if (pRange)
         aBuf.append(*pRange);
 
     if (pFilterNm)
     {
-        aBuf.append(sfx2::cTokenSeparator);
-        aBuf.append(*pFilterNm);
+        aBuf.append(OUStringChar(sfx2::cTokenSeparator) + *pFilterNm);
     }
 
     OUString aCmd = aBuf.makeStringAndClear();
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index fe84c8f44a17..dcd710e16704 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -575,8 +575,7 @@ void IndexTabPage_Impl::InitializeIndex()
 
     try
     {
-        OUStringBuffer aURL(HELP_URL);
-        aURL.append(sFactory);
+        OUStringBuffer aURL(HELP_URL + sFactory);
         AppendConfigToken(aURL, true);
 
         Content aCnt( aURL.makeStringAndClear(), Reference< 
css::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
@@ -1002,9 +1001,7 @@ void SearchTabPage_Impl::Search()
     std::unique_ptr<weld::WaitObject> xWaitCursor(new 
weld::WaitObject(m_pIdxWin->GetFrameWeld()));
     ClearSearchResults();
     RememberSearchText( aSearchText );
-    OUStringBuffer aSearchURL(HELP_URL);
-    aSearchURL.append(aFactory);
-    aSearchURL.append(HELP_SEARCH_TAG);
+    OUStringBuffer aSearchURL(HELP_URL + aFactory + HELP_SEARCH_TAG);
     if (!m_xFullWordsCB->get_active())
         aSearchText = sfx2::PrepareSearchString( aSearchText, xBreakIterator, 
true );
     aSearchURL.append(aSearchText);
@@ -1216,9 +1213,7 @@ OUString 
SfxHelpWindow_Impl::buildHelpURL(std::u16string_view sFactory        ,
                                           std::u16string_view sAnchor)
 {
     OUStringBuffer sHelpURL(256);
-    sHelpURL.append(HELP_URL);
-    sHelpURL.append(sFactory);
-    sHelpURL.append(sContent);
+    sHelpURL.append(HELP_URL + sFactory + sContent);
     AppendConfigToken(sHelpURL, true/*bUseQuestionMark*/);
     if (!sAnchor.empty())
         sHelpURL.append(sAnchor);
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index 01b35d5ca0c9..d49c76e822a8 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -524,10 +524,7 @@ OUString SfxHelp::CreateHelpURL_Impl( const OUString& 
aCommandURL, const OUStrin
     AppendConfigToken( aHelpURL, true );
 
     if ( bHasAnchor )
-    {
-        aHelpURL.append('#');
-        aHelpURL.append(aAnchor);
-    }
+        aHelpURL.append("#" + aAnchor);
 
     return aHelpURL.makeStringAndClear();
 }
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index c340db4005fe..346528d4b0d9 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -893,9 +893,7 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, 
SfxViewFrame* pViewFra
     if (!comphelper::LibreOfficeKit::isActive())
         return;
 
-    OUStringBuffer aBuffer;
-    aBuffer.append(aEvent.FeatureURL.Complete);
-    aBuffer.append(u'=');
+    OUStringBuffer aBuffer(aEvent.FeatureURL.Complete + "=");
 
     if (aEvent.FeatureURL.Path == "Bold" ||
         aEvent.FeatureURL.Path == "CenterPara" ||
diff --git a/sfx2/source/dialog/splitwin.cxx b/sfx2/source/dialog/splitwin.cxx
index 2abedce119a4..aac6c294b7ff 100644
--- a/sfx2/source/dialog/splitwin.cxx
+++ b/sfx2/source/dialog/splitwin.cxx
@@ -298,12 +298,12 @@ void SfxSplitWindow::dispose()
 void SfxSplitWindow::SaveConfig_Impl()
 {
     // Save configuration
-    OUStringBuffer aWinData;
-    aWinData.append('V');
-    aWinData.append(static_cast<sal_Int32>(VERSION));
-    aWinData.append(',');
-    aWinData.append(static_cast<sal_Int32>(pEmptyWin->nState));
-    aWinData.append(',');
+    OUStringBuffer aWinData =
+        "V"
+        + OUString::number(static_cast<sal_Int32>(VERSION))
+        + ","
+        + OUString::number(static_cast<sal_Int32>(pEmptyWin->nState))
+        + ",";
 
     sal_uInt16 nCount = 0;
     for ( auto const & rDock: maDockArr )
@@ -320,8 +320,7 @@ void SfxSplitWindow::SaveConfig_Impl()
             continue;
         if ( rDock->bNewLine )
             aWinData.append(",0");
-        aWinData.append(',');
-        aWinData.append(static_cast<sal_Int32>(rDock->nType));
+        aWinData.append("," + 
OUString::number(static_cast<sal_Int32>(rDock->nType)));
     }
 
     const OUString aWindowId{ "SplitWindow" + 
OUString::number(static_cast<sal_Int32>(GetAlign())) };
diff --git a/sfx2/source/doc/DocumentMetadataAccess.cxx 
b/sfx2/source/doc/DocumentMetadataAccess.cxx
index 42ec35c9f304..d551e0a8f985 100644
--- a/sfx2/source/doc/DocumentMetadataAccess.cxx
+++ b/sfx2/source/doc/DocumentMetadataAccess.cxx
@@ -195,8 +195,7 @@ uno::Reference<rdf::XURI> createBaseURI(
     }
     if (!i_rSubDocument.empty())
     {
-        buf.append(i_rSubDocument);
-        buf.append('/');
+        buf.append(OUString::Concat(i_rSubDocument) + "/");
     }
     if (!buf.isEmpty())
     {
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index a5f7c0a8a3c1..e5bf83088468 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -3024,11 +3024,11 @@ void SfxViewFrame::AddDispatchMacroToBasic_Impl( const 
OUString& sMacro )
         }
 
         // append new method
-        sRoutine.append( "\nsub " );
-        sRoutine.append(aMacroName);
-        sRoutine.append( "\n" );
-        sRoutine.append(sMacro);
-        sRoutine.append( "\nend sub\n" );
+        sRoutine.append( "\nsub "
+            + aMacroName
+            + "\n"
+            + sMacro
+            + "\nend sub\n" );
 
         // create the module inside the library and insert the macro routine
         aTemp <<= sRoutine.makeStringAndClear();

Reply via email to