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

Julien Nabet serval2412 at yahoo.fr
Tue Nov 7 06:02:28 UTC 2017


 sw/source/core/table/swnewtable.cxx |   15 ++++++---------
 sw/source/core/unocore/unotbl.cxx   |    3 +--
 2 files changed, 7 insertions(+), 11 deletions(-)

New commits:
commit d0dd80c8afd83dcfe0788d1c428996a9d8a85fa0
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Mon Nov 6 23:22:57 2017 +0100

    Replace some lists by vectors (sw)
    
    Change-Id: I9fef822040403fc61d00240c07b63e9394cf069f
    Reviewed-on: https://gerrit.libreoffice.org/44379
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx
index 391e1b1081f3..9a2a7372ddd8 100644
--- a/sw/source/core/table/swnewtable.cxx
+++ b/sw/source/core/table/swnewtable.cxx
@@ -371,7 +371,7 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& rPam ) const
     long nMid = ( nMin + nMax ) / 2;
 
     SwBoxSelection* pRet = new SwBoxSelection();
-    std::list< std::pair< SwTableBox*, long > > aNewWidthList;
+    std::vector< std::pair< SwTableBox*, long > > aNewWidthVector;
     size_t nCheckBottom = nBottom;
     long nLeftSpan = 0;
     long nRightSpan = 0;
@@ -543,10 +543,10 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& rPam ) const
                         std::pair< SwTableBox*, long > aTmp;
                         aTmp.first = pInnerBox;
                         aTmp.second = -nDiff;
-                        aNewWidthList.push_back( aTmp );
+                        aNewWidthVector.push_back(aTmp);
                         aTmp.first = pOuterBox;
                         aTmp.second = nDiff;
-                        aNewWidthList.push_back( aTmp );
+                        aNewWidthVector.push_back(aTmp);
                     }
                     pOuterBox = pOuterBox == pRightBox ? nullptr : pRightBox;
                     if( nDiff2 )
@@ -565,14 +565,11 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& rPam ) const
         bOkay = false;
     if( bOkay )
     {
-        std::list< std::pair< SwTableBox*, long > >::iterator
-            pCurr = aNewWidthList.begin();
-        while( pCurr != aNewWidthList.end() )
+        for (auto const& newWidth : aNewWidthVector)
         {
-            SwFrameFormat* pFormat = pCurr->first->ClaimFrameFormat();
-            long nNewWidth = pFormat->GetFrameSize().GetWidth() + pCurr->second;
+            SwFrameFormat* pFormat = newWidth.first->ClaimFrameFormat();
+            long nNewWidth = pFormat->GetFrameSize().GetWidth() + newWidth.second;
             pFormat->SetFormatAttr( SwFormatFrameSize( ATT_VAR_SIZE, nNewWidth, 0 ) );
-            ++pCurr;
         }
     }
     else
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index ce2d9a370ad3..1905492f50ef 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -18,7 +18,6 @@
  */
 
 #include <tuple>
-#include <list>
 #include <array>
 #include <utility>
 #include <memory>
@@ -1803,7 +1802,7 @@ bool SwTableProperties_Impl::GetProperty(sal_uInt16 nWhichId, sal_uInt16 nMember
 template<typename Tpoolitem>
 void SwTableProperties_Impl::AddItemToSet(SfxItemSet& rSet, std::function<Tpoolitem()> aItemFactory, sal_uInt16 nWhich, std::initializer_list<sal_uInt16> vMember, bool bAddTwips)
 {
-    std::list< std::pair<sal_uInt16, const uno::Any* > > vMemberAndAny;
+    std::vector< std::pair<sal_uInt16, const uno::Any* > > vMemberAndAny;
     for(sal_uInt16 nMember : vMember)
     {
         const uno::Any* pAny = nullptr;


More information about the Libreoffice-commits mailing list