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 /framework | |
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 'framework')
-rw-r--r-- | framework/source/accelerators/presethandler.cxx | 12 | ||||
-rw-r--r-- | framework/source/fwe/classes/addonsoptions.cxx | 152 | ||||
-rw-r--r-- | framework/source/xml/acceleratorconfigurationreader.cxx | 12 | ||||
-rw-r--r-- | framework/source/xml/imagesdocumenthandler.cxx | 7 |
4 files changed, 74 insertions, 109 deletions
diff --git a/framework/source/accelerators/presethandler.cxx b/framework/source/accelerators/presethandler.cxx index 50de9d7179e5..e4ae9251ab84 100644 --- a/framework/source/accelerators/presethandler.cxx +++ b/framework/source/accelerators/presethandler.cxx @@ -355,10 +355,7 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType { case E_GLOBAL : { - sRelPathBuf.append("global"); - sRelPathBuf.append("/"); - sRelPathBuf.append(sResource); - sRelPathShare = sRelPathBuf.makeStringAndClear(); + sRelPathShare = OUString::Concat("global/") + sResource; sRelPathUser = sRelPathShare; xShare = impl_openPathIgnoringErrors(sRelPathShare, eShareMode, true ); @@ -368,12 +365,7 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType case E_MODULES : { - sRelPathBuf.append("modules"); - sRelPathBuf.append("/"); - sRelPathBuf.append(sModule); - sRelPathBuf.append("/"); - sRelPathBuf.append(sResource); - sRelPathShare = sRelPathBuf.makeStringAndClear(); + sRelPathShare = OUString::Concat("modules/") + sModule + "/" + sResource; sRelPathUser = sRelPathShare; xShare = impl_openPathIgnoringErrors(sRelPathShare, eShareMode, true ); diff --git a/framework/source/fwe/classes/addonsoptions.cxx b/framework/source/fwe/classes/addonsoptions.cxx index fad4fc858fdd..c67f3b65a06d 100644 --- a/framework/source/fwe/classes/addonsoptions.cxx +++ b/framework/source/fwe/classes/addonsoptions.cxx @@ -952,31 +952,26 @@ void AddonsOptions_Impl::ReadMenuMergeInstructions( MergeMenuInstructionContaine for ( sal_uInt32 j = 0; j < nCountAddons; j++ ) { - OUStringBuffer aMergeAddonInstructionBase( aMergeAddonInstructions ); - aMergeAddonInstructionBase.append( m_aPathDelimiter ); - aMergeAddonInstructionBase.append( aAddonInstMergeNodesSeq[j] ); - aMergeAddonInstructionBase.append( m_aPathDelimiter ); + OUString aMergeAddonInstructionBase = aMergeAddonInstructions + + m_aPathDelimiter + + aAddonInstMergeNodesSeq[j] + + m_aPathDelimiter; // Create sequence for data access - OUStringBuffer aBuffer( aMergeAddonInstructionBase ); - aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGEPOINT ] ); - aNodePropNames[0] = aBuffer.makeStringAndClear(); + aNodePropNames[0] = aMergeAddonInstructionBase + + m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGEPOINT ]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGECOMMAND ] ); - aNodePropNames[1] = aBuffer.makeStringAndClear(); + aNodePropNames[1] = aMergeAddonInstructionBase + + m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGECOMMAND ]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGECOMMANDPARAMETER ] ); - aNodePropNames[2] = aBuffer.makeStringAndClear(); + aNodePropNames[2] = aMergeAddonInstructionBase + + m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGECOMMANDPARAMETER ]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGEFALLBACK ] ); - aNodePropNames[3] = aBuffer.makeStringAndClear(); + aNodePropNames[3] = aMergeAddonInstructionBase + + m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGEFALLBACK ]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGECONTEXT ] ); - aNodePropNames[4] = aBuffer.makeStringAndClear(); + aNodePropNames[4] = aMergeAddonInstructionBase + + m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGECONTEXT ]; Sequence< Any > aNodePropValues = GetProperties( aNodePropNames ); @@ -987,8 +982,7 @@ void AddonsOptions_Impl::ReadMenuMergeInstructions( MergeMenuInstructionContaine aNodePropValues[3] >>= aMergeMenuInstruction.aMergeFallback; aNodePropValues[4] >>= aMergeMenuInstruction.aMergeContext; - OUString aMergeMenuBase = aMergeAddonInstructionBase.makeStringAndClear(); - ReadMergeMenuData( aMergeMenuBase, aMergeMenuInstruction.aMergeMenu ); + ReadMergeMenuData( aMergeAddonInstructionBase, aMergeMenuInstruction.aMergeMenu ); aContainer.push_back( aMergeMenuInstruction ); } @@ -1028,35 +1022,29 @@ void AddonsOptions_Impl::ReadToolbarMergeInstructions( ToolbarMergingInstruction for ( sal_uInt32 j = 0; j < nCountAddons; j++ ) { - OUStringBuffer aMergeAddonInstructionBase( aMergeAddonInstructions ); - aMergeAddonInstructionBase.append( m_aPathDelimiter ); - aMergeAddonInstructionBase.append( aAddonInstMergeNodesSeq[j] ); - aMergeAddonInstructionBase.append( m_aPathDelimiter ); + OUString aMergeAddonInstructionBase = aMergeAddonInstructions + + m_aPathDelimiter + + aAddonInstMergeNodesSeq[j] + + m_aPathDelimiter; // Create sequence for data access - OUStringBuffer aBuffer( aMergeAddonInstructionBase ); - aBuffer.append( m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_TOOLBAR ] ); - aNodePropNames[0] = aBuffer.makeStringAndClear(); + aNodePropNames[0] = aMergeAddonInstructionBase + + m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_TOOLBAR ]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append( m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGEPOINT ] ); - aNodePropNames[1] = aBuffer.makeStringAndClear(); + aNodePropNames[1] = aMergeAddonInstructionBase + + m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGEPOINT ]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append( m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGECOMMAND ] ); - aNodePropNames[2] = aBuffer.makeStringAndClear(); + aNodePropNames[2] = aMergeAddonInstructionBase + + m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGECOMMAND ]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append( m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGECOMMANDPARAMETER ] ); - aNodePropNames[3] = aBuffer.makeStringAndClear(); + aNodePropNames[3] = aMergeAddonInstructionBase + + m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGECOMMANDPARAMETER ]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append( m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGEFALLBACK ] ); - aNodePropNames[4] = aBuffer.makeStringAndClear(); + aNodePropNames[4] = aMergeAddonInstructionBase + + m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGEFALLBACK ]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append( m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGECONTEXT ] ); - aNodePropNames[5] = aBuffer.makeStringAndClear(); + aNodePropNames[5] = aMergeAddonInstructionBase + + m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGECONTEXT ]; Sequence< Any > aNodePropValues = GetProperties( aNodePropNames ); @@ -1068,7 +1056,7 @@ void AddonsOptions_Impl::ReadToolbarMergeInstructions( ToolbarMergingInstruction aNodePropValues[4] >>= aMergeToolbarInstruction.aMergeFallback; aNodePropValues[5] >>= aMergeToolbarInstruction.aMergeContext; - ReadMergeToolbarData( aMergeAddonInstructionBase.makeStringAndClear(), + ReadMergeToolbarData( aMergeAddonInstructionBase, aMergeToolbarInstruction.aMergeToolbarItems ); MergeToolbarInstructionContainer& rVector = rCachedToolbarMergingInstructions[ aMergeToolbarInstruction.aMergeToolbar ]; @@ -1105,36 +1093,29 @@ void AddonsOptions_Impl::ReadNotebookBarMergeInstructions( for (sal_uInt32 j = 0; j < nCountAddons; j++) { - OUStringBuffer aMergeAddonInstructionBase(aMergeAddonInstructions); - aMergeAddonInstructionBase.append(m_aPathDelimiter); - aMergeAddonInstructionBase.append(aAddonInstMergeNodesSeq[j]); - aMergeAddonInstructionBase.append(m_aPathDelimiter); + OUString aMergeAddonInstructionBase = aMergeAddonInstructions + + m_aPathDelimiter + + aAddonInstMergeNodesSeq[j] + + m_aPathDelimiter; // Create sequence for data access - OUStringBuffer aBuffer(aMergeAddonInstructionBase); - aBuffer.append(m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_NOTEBOOKBAR]); - aNodePropNames[0] = aBuffer.makeStringAndClear(); + aNodePropNames[0] = aMergeAddonInstructionBase + + m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_NOTEBOOKBAR]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append(m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGEPOINT]); - aNodePropNames[1] = aBuffer.makeStringAndClear(); + aNodePropNames[1] = aMergeAddonInstructionBase + + m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGEPOINT]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append(m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGECOMMAND]); - aNodePropNames[2] = aBuffer.makeStringAndClear(); + aNodePropNames[2] = aMergeAddonInstructionBase + + m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGECOMMAND]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append( - m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGECOMMANDPARAMETER]); - aNodePropNames[3] = aBuffer.makeStringAndClear(); + aNodePropNames[3] = aMergeAddonInstructionBase + + m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGECOMMANDPARAMETER]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append(m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGEFALLBACK]); - aNodePropNames[4] = aBuffer.makeStringAndClear(); + aNodePropNames[4] = aMergeAddonInstructionBase + + m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGEFALLBACK]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append(m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGECONTEXT]); - aNodePropNames[5] = aBuffer.makeStringAndClear(); + aNodePropNames[5] = aMergeAddonInstructionBase + + m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGECONTEXT]; Sequence<Any> aNodePropValues = GetProperties(aNodePropNames); @@ -1146,7 +1127,7 @@ void AddonsOptions_Impl::ReadNotebookBarMergeInstructions( aNodePropValues[4] >>= aMergeNotebookBarInstruction.aMergeFallback; aNodePropValues[5] >>= aMergeNotebookBarInstruction.aMergeContext; - ReadMergeNotebookBarData(aMergeAddonInstructionBase.makeStringAndClear(), + ReadMergeNotebookBarData(aMergeAddonInstructionBase, aMergeNotebookBarInstruction.aMergeNotebookBarItems); MergeNotebookBarInstructionContainer& rVector @@ -1185,31 +1166,26 @@ void AddonsOptions_Impl::ReadStatusbarMergeInstructions( MergeStatusbarInstructi for ( sal_uInt32 j = 0; j < nCountAddons; j++ ) { - OUStringBuffer aMergeAddonInstructionBase( aMergeAddonInstructions ); - aMergeAddonInstructionBase.append( m_aPathDelimiter ); - aMergeAddonInstructionBase.append( aAddonInstMergeNodesSeq[j] ); - aMergeAddonInstructionBase.append( m_aPathDelimiter ); + OUString aMergeAddonInstructionBase = aMergeAddonInstructions + + m_aPathDelimiter + + aAddonInstMergeNodesSeq[j] + + m_aPathDelimiter; // Create sequence for data access - OUStringBuffer aBuffer( aMergeAddonInstructionBase ); - aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGEPOINT ] ); - aNodePropNames[0] = aBuffer.makeStringAndClear(); + aNodePropNames[0] = aMergeAddonInstructionBase + + m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGEPOINT ]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGECOMMAND ] ); - aNodePropNames[1] = aBuffer.makeStringAndClear(); + aNodePropNames[1] = aMergeAddonInstructionBase + + m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGECOMMAND ]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGECOMMANDPARAMETER ] ); - aNodePropNames[2] = aBuffer.makeStringAndClear(); + aNodePropNames[2] = aMergeAddonInstructionBase + + m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGECOMMANDPARAMETER ]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGEFALLBACK ] ); - aNodePropNames[3] = aBuffer.makeStringAndClear(); + aNodePropNames[3] = aMergeAddonInstructionBase + + m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGEFALLBACK ]; - aBuffer = aMergeAddonInstructionBase; - aBuffer.append( m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGECONTEXT ] ); - aNodePropNames[4] = aBuffer.makeStringAndClear(); + aNodePropNames[4] = aMergeAddonInstructionBase + + m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGECONTEXT ]; Sequence< Any > aNodePropValues = GetProperties( aNodePropNames ); @@ -1220,7 +1196,7 @@ void AddonsOptions_Impl::ReadStatusbarMergeInstructions( MergeStatusbarInstructi // aNodePropValues[3] >>= aMergeStatusbarInstruction.aMergeFallback; aNodePropValues[4] >>= aMergeStatusbarInstruction.aMergeContext; - ReadMergeStatusbarData( aMergeAddonInstructionBase.makeStringAndClear(), + ReadMergeStatusbarData( aMergeAddonInstructionBase, aMergeStatusbarInstruction.aMergeStatusbarItems ); aContainer.push_back( aMergeStatusbarInstruction ); diff --git a/framework/source/xml/acceleratorconfigurationreader.cxx b/framework/source/xml/acceleratorconfigurationreader.cxx index 1b36119f2fd6..ea31cd6b1d0d 100644 --- a/framework/source/xml/acceleratorconfigurationreader.cxx +++ b/framework/source/xml/acceleratorconfigurationreader.cxx @@ -248,13 +248,11 @@ OUString AcceleratorConfigurationReader::implts_getErrorLineString() if (!m_xLocator.is()) return "Error during parsing XML. (No further info available ...)"; - OUStringBuffer sMsg(256); - sMsg.append("Error during parsing XML in\nline = "); - sMsg.append (m_xLocator->getLineNumber() ); - sMsg.append("\ncolumn = " ); - sMsg.append (m_xLocator->getColumnNumber() ); - sMsg.append("." ); - return sMsg.makeStringAndClear(); + return "Error during parsing XML in\nline = " + + OUString::number(m_xLocator->getLineNumber()) + + "\ncolumn = " + + OUString::number(m_xLocator->getColumnNumber()) + + "."; } } // namespace framework diff --git a/framework/source/xml/imagesdocumenthandler.cxx b/framework/source/xml/imagesdocumenthandler.cxx index 0cb245cfcc3a..c3007397ea33 100644 --- a/framework/source/xml/imagesdocumenthandler.cxx +++ b/framework/source/xml/imagesdocumenthandler.cxx @@ -279,10 +279,9 @@ OUString OReadImagesDocumentHandler::getErrorLineString() SolarMutexGuard g; if ( m_xLocator.is() ) { - OUStringBuffer buffer("Line: "); - buffer.append(m_xLocator->getLineNumber()); - buffer.append(" - "); - return buffer.makeStringAndClear(); + return "Line: " + + OUString::number(m_xLocator->getLineNumber()) + + " - "; } else return OUString(); |