[Libreoffice-commits] core.git: helpcompiler/source i18npool/qa oox/source rsc/source sc/source svx/source sw/source unotools/source xmloff/source

Noel Grandin noel.grandin at collabora.co.uk
Thu Jun 8 06:46:17 UTC 2017


 helpcompiler/source/HelpIndexer.cxx        |    3 +--
 i18npool/qa/cppunit/test_breakiterator.cxx |    2 +-
 oox/source/core/relations.cxx              |    2 +-
 oox/source/core/xmlfilterbase.cxx          |    2 +-
 oox/source/dump/dumperbase.cxx             |    2 +-
 oox/source/export/chartexport.cxx          |    2 +-
 oox/source/export/vmlexport.cxx            |    2 +-
 oox/source/helper/containerhelper.cxx      |    2 +-
 oox/source/ole/vbacontrol.cxx              |    2 +-
 oox/source/vml/vmlshape.cxx                |    2 +-
 rsc/source/prj/start.cxx                   |    3 +--
 sc/source/filter/oox/defnamesbuffer.cxx    |    2 +-
 sc/source/filter/oox/excelvbaproject.cxx   |    2 +-
 sc/source/filter/oox/stylesbuffer.cxx      |    4 ++--
 sc/source/filter/oox/workbookhelper.cxx    |    2 +-
 sc/source/ui/vba/vbasheetobject.cxx        |    2 +-
 svx/source/form/databaselocationinput.cxx  |    2 +-
 sw/source/core/doc/doctxm.cxx              |    6 ++----
 sw/source/filter/ww8/docxexport.cxx        |    8 ++++----
 sw/source/filter/ww8/ww8par.cxx            |    2 +-
 unotools/source/config/bootstrap.cxx       |    2 +-
 xmloff/source/text/txtparae.cxx            |    2 +-
 22 files changed, 27 insertions(+), 31 deletions(-)

New commits:
commit 0e2a6e8ea20d74436b544104969a0fdca0003b59
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Jun 7 15:24:38 2017 +0200

    remove some unnecessary use of OUStringBuffer
    
    Change-Id: Ia4e02589d2fe79a27b83200a0e7a528a2c806519
    Reviewed-on: https://gerrit.libreoffice.org/38508
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/helpcompiler/source/HelpIndexer.cxx b/helpcompiler/source/HelpIndexer.cxx
index 0c10da99d0c5..5e016fb0ff6e 100644
--- a/helpcompiler/source/HelpIndexer.cxx
+++ b/helpcompiler/source/HelpIndexer.cxx
@@ -26,8 +26,7 @@ HelpIndexer::HelpIndexer(OUString const &lang, OUString const &module,
     OUString const &srcDir, OUString const &outDir)
     : d_lang(lang), d_module(module)
 {
-    d_indexDir = OUStringBuffer(outDir).append('/').
-        append(module).append(".idxl").makeStringAndClear();
+    d_indexDir = outDir + OUStringLiteral1('/') + module + ".idxl";
     d_captionDir = srcDir + "/caption";
     d_contentDir = srcDir + "/content";
 }
diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx
index d3da7dda4d95..e18efe843029 100644
--- a/i18npool/qa/cppunit/test_breakiterator.cxx
+++ b/i18npool/qa/cppunit/test_breakiterator.cxx
@@ -101,7 +101,7 @@ void TestBreakIterator::testLineBreaking()
     {
         const sal_Unicode HEBREW1[] = { 0x05DE, 0x05D9, 0x05DC, 0x05D9, 0x5DD };
         OUString aWord(HEBREW1, SAL_N_ELEMENTS(HEBREW1));
-        OUString aTest(OUStringBuffer(aWord).append(' ').append(aWord).makeStringAndClear());
+        OUString aTest(aWord + " " + aWord);
 
         aLocale.Language = "he";
         aLocale.Country = "IL";
diff --git a/oox/source/core/relations.cxx b/oox/source/core/relations.cxx
index c8d343847f0a..68a4256c0745 100644
--- a/oox/source/core/relations.cxx
+++ b/oox/source/core/relations.cxx
@@ -35,7 +35,7 @@ OUString lclRemoveFileName( const OUString& rPath )
 OUString lclAppendFileName( const OUString& rPath, const OUString& rFileName )
 {
     return rPath.isEmpty() ? rFileName :
-        OUStringBuffer( rPath ).append( '/' ).append( rFileName ).makeStringAndClear();
+        rPath + OUStringLiteral1('/') + rFileName;
 }
 
 OUString createOfficeDocRelationTypeTransitional(const OUString& rType)
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index 19f06ffcda85..b66dcf9e7301 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -458,7 +458,7 @@ namespace {
 
 OUString lclAddRelation( const Reference< XRelationshipAccess >& rRelations, sal_Int32 nId, const OUString& rType, const OUString& rTarget, bool bExternal )
 {
-    OUString sId = OUStringBuffer().append( "rId" ).append( nId ).makeStringAndClear();
+    OUString sId = "rId" + OUString::number( nId );
 
     Sequence< StringPair > aEntry( bExternal ? 3 : 2 );
     aEntry[0].First = "Type";
diff --git a/oox/source/dump/dumperbase.cxx b/oox/source/dump/dumperbase.cxx
index a4fca11906a8..36e9bf1a7c3d 100644
--- a/oox/source/dump/dumperbase.cxx
+++ b/oox/source/dump/dumperbase.cxx
@@ -2373,7 +2373,7 @@ void XmlStreamObject::implDumpText( TextInputStream& rTextStrm )
         {
             while( (nPos < aElem.getLength()) && (aElem[ nPos ] >= 32) ) ++nPos;
             if( nPos < aElem.getLength() )
-                aElem = OUStringBuffer( aElem.copy( 0, nPos ) ).append( ' ' ).append( aElem.copy( nPos ).trim() ).makeStringAndClear();
+                aElem = aElem.copy( 0, nPos ) + OUStringLiteral1(' ') + aElem.copy( nPos ).trim();
             ++nPos;
         }
 
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 25d70e8ee442..d893cc678cb8 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -786,7 +786,7 @@ void ChartExport::exportExternalData( const Reference< css::chart::XChartDocumen
             if( nSepPos > 0)
             {
                 relationPath = relationPath.copy( nSepPos,  ::std::max< sal_Int32 >( externalDataPath.getLength(), 0 ) -  nSepPos );
-                relationPath = OUStringBuffer( ".." ).append( relationPath ).makeStringAndClear();
+                relationPath = ".." + relationPath;
             }
         }
         FSHelperPtr pFS = GetFS();
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 623beaaa88ec..ff121025acd3 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -873,7 +873,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle&
 
 OString VMLExport::ShapeIdString( sal_uInt32 nId )
 {
-    return OStringBuffer( 20 ).append( "shape_" ).append( sal_Int64( nId ) ).makeStringAndClear();
+    return "shape_" + OString::number( nId );
 }
 
 void VMLExport::AddFlipXY( )
diff --git a/oox/source/helper/containerhelper.cxx b/oox/source/helper/containerhelper.cxx
index 99a14231190c..c1a23820f03a 100644
--- a/oox/source/helper/containerhelper.cxx
+++ b/oox/source/helper/containerhelper.cxx
@@ -86,7 +86,7 @@ OUString ContainerHelper::getUnusedName(
     OUString aNewName = rSuggestedName;
     sal_Int32 nIndex = -1;
     while( rxNameAccess->hasByName( aNewName ) )
-        aNewName = OUStringBuffer( rSuggestedName ).append( cSeparator ).append( nIndex++ ).makeStringAndClear();
+        aNewName = rSuggestedName + OUStringLiteral1(cSeparator) + OUString::number( nIndex++ );
     return aNewName;
 }
 
diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx
index eb7a54b94b9c..84402d3a0c3e 100644
--- a/oox/source/ole/vbacontrol.cxx
+++ b/oox/source/ole/vbacontrol.cxx
@@ -119,7 +119,7 @@ OUString VbaControlNamesSet::generateDummyName()
     OUString aCtrlName;
     do
     {
-        aCtrlName = OUStringBuffer( maDummyBaseName ).append( ++mnIndex ).makeStringAndClear();
+        aCtrlName = maDummyBaseName + OUString::number( ++mnIndex );
     }
     while( maCtrlNames.count( aCtrlName ) > 0 );
     maCtrlNames.insert( aCtrlName );
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index f7d6c6908b8f..17f52ff609b6 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -296,7 +296,7 @@ OUString ShapeBase::getShapeName() const
     {
         sal_Int32 nShapeIdx = mrDrawing.getLocalShapeIndex( getShapeId() );
         if( nShapeIdx > 0 )
-            return OUStringBuffer( aBaseName ).append( ' ' ).append( nShapeIdx ).makeStringAndClear();
+            return aBaseName + OUStringLiteral1(' ') + OUString::number( nShapeIdx );
     }
 
     return OUString();
diff --git a/rsc/source/prj/start.cxx b/rsc/source/prj/start.cxx
index 071350ca63cc..c4ed4bf21f5a 100644
--- a/rsc/source/prj/start.cxx
+++ b/rsc/source/prj/start.cxx
@@ -297,8 +297,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
             aResName = OutputFile( *aInputList[ 0 ], "res" );
         if( ! bSetSrs )
         {
-            aSrsName = OStringBuffer("-fp=").append(OutputFile(*aInputList[0], "srs")).
-                makeStringAndClear();
+            aSrsName = OString("-fp=") + OutputFile(*aInputList[0], "srs");
         }
     };
 
diff --git a/sc/source/filter/oox/defnamesbuffer.cxx b/sc/source/filter/oox/defnamesbuffer.cxx
index 650256c5ab69..4ead995f07b7 100644
--- a/sc/source/filter/oox/defnamesbuffer.cxx
+++ b/sc/source/filter/oox/defnamesbuffer.cxx
@@ -93,7 +93,7 @@ OUString lclGetBaseName( sal_Unicode cBuiltinId )
 
 OUString lclGetPrefixedName( sal_Unicode cBuiltinId )
 {
-    return OUStringBuffer( spcOoxPrefix ).append( lclGetBaseName( cBuiltinId ) ).makeStringAndClear();
+    return spcOoxPrefix + lclGetBaseName( cBuiltinId );
 }
 
 /** returns the built-in name identifier from a prefixed built-in name, e.g. '_xlnm.Print_Area'. */
diff --git a/sc/source/filter/oox/excelvbaproject.cxx b/sc/source/filter/oox/excelvbaproject.cxx
index 71475c1db2ad..d17497d3faf6 100644
--- a/sc/source/filter/oox/excelvbaproject.cxx
+++ b/sc/source/filter/oox/excelvbaproject.cxx
@@ -105,7 +105,7 @@ void ExcelVbaProject::prepareImport()
             OUString aCodeName;
             do
             {
-                aCodeName = OUStringBuffer( aIt->maPrefix ).append( nCounter++ ).makeStringAndClear();
+                aCodeName = aIt->maPrefix + OUString::number( nCounter++ );
             }
             while( aUsedCodeNames.count( aCodeName ) > 0 );
             aUsedCodeNames.insert( aCodeName );
diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx
index 25fca16c643e..b0acfa840f7e 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -2591,7 +2591,7 @@ void CellStyleBuffer::finalizeImport()
         OUString aUnusedName;
         do
         {
-            aUnusedName = OUStringBuffer( aStyleName ).append( ' ' ).append( ++nIndex ).makeStringAndClear();
+            aUnusedName = aStyleName + OUStringLiteral1(' ') + OUString::number( ++nIndex );
         }
         while( aCellStyles.find( aUnusedName ) != aCellStyles.end() );
         aCellStyles[ aUnusedName ] = *aIt;
@@ -2877,7 +2877,7 @@ OUString StylesBuffer::createDxfStyle( sal_Int32 nDxfId ) const
 
     if (Dxf* pDxf = maDxfs.get(nDxfId).get())
     {
-        rStyleName = OUStringBuffer("ConditionalStyle_").append(nDxfId + 1).makeStringAndClear();
+        rStyleName = "ConditionalStyle_" + OUString::number(nDxfId + 1);
 
         // Create a cell style. This may overwrite an existing style if
         // one with the same name exists.
diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx
index aad783f896c9..f8ac80db887b 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -379,7 +379,7 @@ OUString findUnusedName( const ScRangeName* pRangeName, const OUString& rSuggest
     OUString aNewName = rSuggestedName;
     sal_Int32 nIndex = 0;
     while(pRangeName->findByUpperName(ScGlobal::pCharClass->uppercase(aNewName)))
-        aNewName = OUStringBuffer(rSuggestedName).append( '_' ).append( nIndex++ ).makeStringAndClear();
+        aNewName = rSuggestedName + OUStringLiteral1('_') + OUString::number( nIndex++ );
 
     return aNewName;
 }
diff --git a/sc/source/ui/vba/vbasheetobject.cxx b/sc/source/ui/vba/vbasheetobject.cxx
index 7764a137d148..c339062b2ce2 100644
--- a/sc/source/ui/vba/vbasheetobject.cxx
+++ b/sc/source/ui/vba/vbasheetobject.cxx
@@ -278,7 +278,7 @@ void SAL_CALL ScVbaSheetObjectBase::setPrintObject( sal_Bool /*bPrintObject*/ )
 
 void ScVbaSheetObjectBase::setDefaultProperties( sal_Int32 nIndex )
 {
-    OUString aName = OUStringBuffer( implGetBaseName() ).append( ' ' ).append( nIndex + 1 ).makeStringAndClear();
+    OUString aName = implGetBaseName() + OUStringLiteral1(' ') + OUString::number( nIndex + 1 );
     setName( aName );
     implSetDefaultProperties();
 }
diff --git a/svx/source/form/databaselocationinput.cxx b/svx/source/form/databaselocationinput.cxx
index bf7355729a28..110f74b28866 100644
--- a/svx/source/form/databaselocationinput.cxx
+++ b/svx/source/form/databaselocationinput.cxx
@@ -234,7 +234,7 @@ namespace svx
         );
         aFileDlg.SetDisplayDirectory( impl_getCurrentURL() );
 
-        aFileDlg.AddFilter( m_sFilterUIName, OUStringBuffer().append( "*." ).append( m_aFilterExtensions[0] ).makeStringAndClear() );
+        aFileDlg.AddFilter( m_sFilterUIName, "*." + m_aFilterExtensions[0] );
         aFileDlg.SetCurrentFilter( m_sFilterUIName );
 
         if ( aFileDlg.Execute() == ERRCODE_NONE )
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 9280edf5199e..71b961e1522b 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -1664,11 +1664,9 @@ void SwTOXBaseSection::UpdatePageNum_( SwTextNode* pNd,
     // collect starts end ends of main entry character style
     std::unique_ptr< std::vector<sal_uInt16> > xCharStyleIdx(pMainEntryNums ? new std::vector<sal_uInt16> : nullptr);
 
-    OUString sSrchStr = OUStringBuffer().append(C_NUM_REPL).
-        append(S_PAGE_DELI).append(C_NUM_REPL).makeStringAndClear();
+    OUString sSrchStr = OUStringLiteral1(C_NUM_REPL) + S_PAGE_DELI + OUStringLiteral1(C_NUM_REPL);
     sal_Int32 nStartPos = pNd->GetText().indexOf(sSrchStr);
-    sSrchStr = OUStringBuffer().append(C_NUM_REPL).
-        append(C_END_PAGE_NUM).makeStringAndClear();
+    sSrchStr = OUStringLiteral1(C_NUM_REPL) + OUStringLiteral1(C_END_PAGE_NUM);
     sal_Int32 nEndPos = pNd->GetText().indexOf(sSrchStr);
 
     if (-1 == nEndPos || rNums.empty())
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 24a388ec1ab6..e434e670378e 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -708,26 +708,26 @@ void DocxExport::WriteHeaderFooter( const SwFormat& rFormat, bool bHeader, const
     ::sax_fastparser::FSHelperPtr pFS;
     if ( bHeader )
     {
-        OUString aName( OUStringBuffer().append("header").append( ++m_nHeaders ).append(".xml").makeStringAndClear() );
+        OUString aName( "header" + OUString::number( ++m_nHeaders ) + ".xml" );
 
         aRelId = m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
                 oox::getRelationship(Relationship::HEADER),
                 aName );
 
-        pFS = m_pFilter->openFragmentStreamWithSerializer( OUStringBuffer().append("word/").append( aName ).makeStringAndClear(),
+        pFS = m_pFilter->openFragmentStreamWithSerializer( "word/" + aName,
                     "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml" );
 
         pFS->startElementNS( XML_w, XML_hdr, MainXmlNamespaces());
     }
     else
     {
-        OUString aName( OUStringBuffer().append("footer").append( ++m_nFooters ).append(".xml").makeStringAndClear() );
+        OUString aName( "footer" + OUString::number( ++m_nFooters ) + ".xml" );
 
         aRelId = m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
                 oox::getRelationship(Relationship::FOOTER),
                 aName );
 
-        pFS = m_pFilter->openFragmentStreamWithSerializer( OUStringBuffer().append("word/").append( aName ).makeStringAndClear(),
+        pFS = m_pFilter->openFragmentStreamWithSerializer( "word/" + aName,
                     "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml" );
 
         pFS->startElementNS( XML_w, XML_ftr, MainXmlNamespaces());
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 69ebd26e56fe..bb25687723d2 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -4069,7 +4069,7 @@ bool SwWW8ImplReader::ReadText(WW8_CP nStartCp, WW8_CP nTextLen, ManTypes nType)
 
             if(m_pAktItemSet && !pFormat)
             {
-                OUString sPrefix(OUStringBuffer("WW8Dropcap").append(m_nDropCap++).makeStringAndClear());
+                OUString sPrefix = "WW8Dropcap" + OUString::number(m_nDropCap++);
                 pNewSwCharFormat = m_rDoc.MakeCharFormat(sPrefix, m_rDoc.GetDfltCharFormat());
                  m_pAktItemSet->ClearItem(RES_CHRATR_ESCAPEMENT);
                 pNewSwCharFormat->SetFormatAttr( *m_pAktItemSet );
diff --git a/unotools/source/config/bootstrap.cxx b/unotools/source/config/bootstrap.cxx
index f74185572544..39bfda75fb60 100644
--- a/unotools/source/config/bootstrap.cxx
+++ b/unotools/source/config/bootstrap.cxx
@@ -327,7 +327,7 @@ static PathStatus getDerivedPath(
     {
         OSL_PRECOND(!_aBaseURL.endsWith(OUStringLiteral1(cURLSeparator)), "Unexpected: base URL ends in slash");
 
-        sDerivedURL = OUStringBuffer(_aBaseURL).append(cURLSeparator).append(_sRelativeURL).makeStringAndClear();
+        sDerivedURL = _aBaseURL + OUStringLiteral1(cURLSeparator) + _sRelativeURL;
 
         // a derived (nested) URL can only exist or have a lesser status, if the parent exists
         if (aStatus == Bootstrap::PATH_EXISTS)
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 10a0158ed0c3..42d1af88e658 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -431,7 +431,7 @@ void FieldParamExporter::Export()
         {
             sal_Int32 nValue = 0;
             aValue >>= nValue;
-            ExportParameter(rParameter, OUStringBuffer().append(nValue).makeStringAndClear());
+            ExportParameter(rParameter, OUString::number(nValue));
         }
     }
 }


More information about the Libreoffice-commits mailing list