[Libreoffice-commits] core.git: dbaccess/source sc/source sw/source xmloff/source

Noel Grandin noel.grandin at collabora.co.uk
Thu Mar 2 09:29:32 UTC 2017


 dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx    |    3 +--
 dbaccess/source/ui/querydesign/TableFieldDescription.cxx |    3 +--
 sc/source/filter/oox/worksheethelper.cxx                 |    3 +--
 sw/source/ui/frmdlg/cption.cxx                           |    4 +---
 xmloff/source/chart/SchXMLExport.cxx                     |    7 ++++---
 5 files changed, 8 insertions(+), 12 deletions(-)

New commits:
commit 4730b23b1da929b802d527611e974ff1b1e6d6c5
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Mar 2 11:28:17 2017 +0200

    use std::vector::insert when inserting multiple of the same thing
    
    instead of looping
    
    Change-Id: I7b8c1663e303449302e0b96dc5b483367c2a52ba

diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index b0d0581..d0ba352 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -140,8 +140,7 @@ OSelectionBrowseBox::OSelectionBrowseBox( vcl::Window* pParent )
     for (sal_Int32 nIdx = 0; nIdx < nCount; nIdx++)
         m_pOrderCell->InsertEntry(aTxt.getToken(nIdx, ';'));
 
-    for(long i=0;i < BROW_ROW_CNT;i++)
-        m_bVisibleRow.push_back(true);
+    m_bVisibleRow.insert(m_bVisibleRow.end(), BROW_ROW_CNT, true);
 
     m_bVisibleRow[BROW_FUNCTION_ROW] = false;   // first hide
 
diff --git a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx
index 21e7348..20298d1 100644
--- a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx
+++ b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx
@@ -104,8 +104,7 @@ void OTableFieldDesc::SetCriteria( sal_uInt16 nIdx, const OUString& rCrit)
         m_aCriteria[nIdx] = rCrit;
     else
     {
-        for(sal_Int32 i=m_aCriteria.size();i<nIdx;++i)
-            m_aCriteria.push_back( OUString());
+        m_aCriteria.insert(m_aCriteria.end(), nIdx - m_aCriteria.size(), OUString());
         m_aCriteria.push_back(rCrit);
     }
 }
diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx
index 14a021a..0f01e0d 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -1248,8 +1248,7 @@ void WorksheetGlobals::convertOutlines( OutlineLevelVec& orLevels,
     if( nSize < nLevel )
     {
         // Outline level increased. Push the begin column position.
-        for( sal_Int32 nIndex = nSize; nIndex < nLevel; ++nIndex )
-            orLevels.push_back( nColRow );
+        orLevels.insert(orLevels.end(), nLevel - nSize, nColRow);
     }
     else if( nLevel < nSize )
     {
diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx
index 4d0bac6b..ae9cf89 100644
--- a/sw/source/ui/frmdlg/cption.cxx
+++ b/sw/source/ui/frmdlg/cption.cxx
@@ -366,10 +366,8 @@ void SwCaptionDialog::DrawSample()
                                             RES_SETEXPFLD, sFieldTypeName ));
             if( pFieldType && pFieldType->GetOutlineLvl() < MAXLEVEL )
             {
-                sal_Int8 nLvl = pFieldType->GetOutlineLvl();
                 SwNumberTree::tNumberVector aNumVector;
-                for( sal_Int8 i = 0; i <= nLvl; ++i )
-                    aNumVector.push_back(1);
+                aNumVector.insert(aNumVector.end(), pFieldType->GetOutlineLvl(), 1);
 
                 OUString sNumber( rSh.GetOutlineNumRule()->
                                 MakeNumString(aNumVector, false ));
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index ef7d581..9b8c205 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -739,12 +739,13 @@ void lcl_ReorderInternalSequencesAccordingToTheirRangeName(
         if( aIt->first < 0 )
             continue;
         // fill empty columns
-        for( ; nIndex < aIt->first; ++nIndex )
-            rInOutSequences.push_back(
+        rInOutSequences.insert(
+                rInOutSequences.end(),
+                aIt->first - nIndex,
                 SchXMLExportHelper_Impl::tDataSequenceCont::value_type(
                     uno::Reference< chart2::data::XDataSequence >(),
                     uno::Reference< chart2::data::XDataSequence >() ));
-        OSL_ASSERT( nIndex == aIt->first );
+        nIndex = aIt->first;
         rInOutSequences.push_back( aIt->second );
     }
 }


More information about the Libreoffice-commits mailing list