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

Julien Nabet serval2412 at yahoo.fr
Thu Nov 16 22:01:40 UTC 2017


 xmloff/source/draw/animationimport.cxx  |   10 ++++------
 xmloff/source/text/XMLRedlineExport.cxx |   16 ++++++----------
 xmloff/source/text/XMLRedlineExport.hxx |   10 +++++-----
 3 files changed, 15 insertions(+), 21 deletions(-)

New commits:
commit 05fc30e38899348fb58548adb7a72e4fa2874d62
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Wed Nov 15 21:06:36 2017 +0100

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

diff --git a/xmloff/source/draw/animationimport.cxx b/xmloff/source/draw/animationimport.cxx
index 6820c7ba8694..8134fd671499 100644
--- a/xmloff/source/draw/animationimport.cxx
+++ b/xmloff/source/draw/animationimport.cxx
@@ -51,7 +51,7 @@
 
 #include <sax/tools/converter.hxx>
 
-#include <list>
+#include <vector>
 
 #include <o3tl/make_unique.hxx>
 
@@ -741,7 +741,7 @@ void AnimationNodeContext::init_node(  const css::uno::Reference< css::xml::sax:
         Reference< XTransitionFilter > xTransitionFilter( mxNode, UNO_QUERY );
         Reference< XIterateContainer > xIter( mxNode, UNO_QUERY );
 
-        std::list< NamedValue > aUserData;
+        std::vector< NamedValue > aUserData;
         XMLTokenEnum meAttributeName = XML_TOKEN_INVALID;
         OUString aFrom, aBy, aTo, aValues;
         bool bHaveXmlId( false );
@@ -1201,10 +1201,8 @@ void AnimationNodeContext::init_node(  const css::uno::Reference< css::xml::sax:
         {
             Sequence< NamedValue > aUnoUserData( nUserDataCount );
             NamedValue* pData = aUnoUserData.getArray();
-            std::list< NamedValue >::iterator aIter( aUserData.begin() );
-            const std::list< NamedValue >::iterator aEnd( aUserData.end() );
-            while( aIter != aEnd )
-                *pData++ = (*aIter++);
+            for (auto const& item : aUserData)
+                *pData++ = item;
 
             mxNode->setUserData( aUnoUserData );
         }
diff --git a/xmloff/source/text/XMLRedlineExport.cxx b/xmloff/source/text/XMLRedlineExport.cxx
index 557f131aca87..f8bcf62dd228 100644
--- a/xmloff/source/text/XMLRedlineExport.cxx
+++ b/xmloff/source/text/XMLRedlineExport.cxx
@@ -71,11 +71,9 @@ XMLRedlineExport::XMLRedlineExport(SvXMLExport& rExp)
 XMLRedlineExport::~XMLRedlineExport()
 {
     // delete changes lists
-    for( ChangesMapType::iterator aIter = aChangeMap.begin();
-         aIter != aChangeMap.end();
-         ++aIter )
+    for (auto const& change : aChangeMap)
     {
-        delete aIter->second;
+        delete change.second;
     }
     aChangeMap.clear();
 }
@@ -130,7 +128,7 @@ void XMLRedlineExport::ExportChangesList(
     ChangesMapType::iterator aFind = aChangeMap.find(rText);
     if (aFind != aChangeMap.end())
     {
-        ChangesListType* pChangesList = aFind->second;
+        ChangesVectorType* pChangesList = aFind->second;
 
         // export only if changes are found
         if (pChangesList->size() > 0)
@@ -141,11 +139,9 @@ void XMLRedlineExport::ExportChangesList(
                                         true, true);
 
             // iterate over changes list
-            for( ChangesListType::iterator aIter = pChangesList->begin();
-                 aIter != pChangesList->end();
-                 ++aIter )
+            for (auto const& change : *pChangesList)
             {
-                ExportChangedRegion( *aIter );
+                ExportChangedRegion(change);
             }
         }
         // else: changes list empty -> ignore
@@ -162,7 +158,7 @@ void XMLRedlineExport::SetCurrentXText(
         ChangesMapType::iterator aIter = aChangeMap.find(rText);
         if (aIter == aChangeMap.end())
         {
-            ChangesListType* pList = new ChangesListType;
+            ChangesVectorType* pList = new ChangesVectorType;
             aChangeMap[rText] = pList;
             pCurrentChangesList = pList;
         }
diff --git a/xmloff/source/text/XMLRedlineExport.hxx b/xmloff/source/text/XMLRedlineExport.hxx
index c5b234ee67e7..0d7ab3114401 100644
--- a/xmloff/source/text/XMLRedlineExport.hxx
+++ b/xmloff/source/text/XMLRedlineExport.hxx
@@ -24,7 +24,7 @@
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/uno/Sequence.h>
 
-#include <list>
+#include <vector>
 #include <map>
 
 class SvXMLExport;
@@ -37,13 +37,13 @@ namespace com { namespace sun { namespace star {
  } } }
 
 // store a list of redline properties
-typedef ::std::list<
-            css::uno::Reference<css::beans::XPropertySet> > ChangesListType;
+typedef ::std::vector<
+            css::uno::Reference<css::beans::XPropertySet> > ChangesVectorType;
 
 // store a list of redline properties for each XText
 typedef ::std::map<
             css::uno::Reference< css::text::XText>,
-            ChangesListType* > ChangesMapType;
+            ChangesVectorType* > ChangesMapType;
 
 
 /**
@@ -70,7 +70,7 @@ class XMLRedlineExport
     ChangesMapType aChangeMap;              /// map of recorded changes
 
     /// list of current changes; is NULL or points to member of aChangeMap
-    ChangesListType* pCurrentChangesList;
+    ChangesVectorType* pCurrentChangesList;
 
 
 public:


More information about the Libreoffice-commits mailing list