[Libreoffice-commits] core.git: connectivity/source connectivity/workben

Julien Nabet serval2412 at yahoo.fr
Thu Aug 31 20:31:52 UTC 2017


 connectivity/source/drivers/jdbc/JConnection.cxx                   |    8 +--
 connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx       |    2 
 connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx       |    8 +--
 connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx |    4 -
 connectivity/source/drivers/postgresql/pq_connection.cxx           |   24 +++++-----
 connectivity/workben/iniParser/main.cxx                            |   14 ++---
 6 files changed, 30 insertions(+), 30 deletions(-)

New commits:
commit 4c99b8a9de59f3c5280ff2944d9f828822897f4a
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Thu Aug 31 21:42:24 2017 +0200

    Replace some lists by vectors (+rename vars)
    
    Change-Id: Iad4e3cc13f7908840ef45a04ea4b551d3b0fc487
    Reviewed-on: https://gerrit.libreoffice.org/41771
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/connectivity/source/drivers/jdbc/JConnection.cxx b/connectivity/source/drivers/jdbc/JConnection.cxx
index ecd265d3f5dd..60d974079b6a 100644
--- a/connectivity/source/drivers/jdbc/JConnection.cxx
+++ b/connectivity/source/drivers/jdbc/JConnection.cxx
@@ -45,7 +45,7 @@
 #include <unotools/confignode.hxx>
 #include "strings.hxx"
 
-#include <list>
+#include <vector>
 #include <memory>
 
 using namespace connectivity;
@@ -70,7 +70,7 @@ struct ClassMapEntry {
     jweak classObject;
 };
 
-typedef std::list< ClassMapEntry > ClassMap;
+typedef std::vector< ClassMapEntry > ClassMap;
 
 struct ClassMapData {
     osl::Mutex mutex;
@@ -177,8 +177,8 @@ bool loadClass(
             // JVM that are not easily undone).  If the pushed ClassMapEntry is
             // not used after all (return false, etc.) it will be pruned on next
             // call because its classLoader/classObject are null:
-            d->map.push_front( ClassMapEntry( classPath, name ) );
-            i = d->map.begin();
+            d->map.push_back( ClassMapEntry( classPath, name ) );
+            i = std::prev(d->map.end());
         }
 
         LocalRef< jclass > clClass( environment );
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx
index ebd6ac016c68..178a2f794636 100644
--- a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx
+++ b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx
@@ -63,7 +63,7 @@ IniParser::IniParser(OUString const & rIniName)
                 nameValue.sValue = OStringToOUString(
                     line.copy(nIndex+1).trim(), RTL_TEXTENCODING_UTF8 );
 
-                aSection->lList.push_back(nameValue);
+                aSection->vVector.push_back(nameValue);
 
             }
             else
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx
index 120f47121915..95ca6d748cf5 100644
--- a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx
+++ b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx
@@ -24,7 +24,7 @@
 #include <osl/process.h>
 
 #include <map>
-#include <list>
+#include <vector>
 
 struct ini_NameValue
 {
@@ -32,14 +32,14 @@ struct ini_NameValue
     OUString sValue;
 };
 
-typedef std::list<
+typedef std::vector<
     ini_NameValue
-> NameValueList;
+> NameValueVector;
 
 struct ini_Section
 {
     OUString sName;
-    NameValueList lList;
+    NameValueVector vVector;
 };
 typedef std::map<OUString,
                 ini_Section
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx
index f3e80833b6f5..ac0cca926bbb 100644
--- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx
+++ b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx
@@ -85,8 +85,8 @@ namespace connectivity
                 OUString sIsRelative;
                 OUString sIsDefault;
 
-                for(NameValueList::iterator itor=aSection->lList.begin();
-                    itor != aSection->lList.end();
+                for(NameValueVector::iterator itor=aSection->vVector.begin();
+                    itor != aSection->vVector.end();
                     ++itor)
                 {
                         struct ini_NameValue * aValue = &(*itor);
diff --git a/connectivity/source/drivers/postgresql/pq_connection.cxx b/connectivity/source/drivers/postgresql/pq_connection.cxx
index bd2b7e236524..76ac4de02d57 100644
--- a/connectivity/source/drivers/postgresql/pq_connection.cxx
+++ b/connectivity/source/drivers/postgresql/pq_connection.cxx
@@ -34,7 +34,7 @@
  *
  ************************************************************************/
 
-#include <list>
+#include <vector>
 #include <time.h>
 #include <string.h>
 
@@ -196,14 +196,14 @@ Connection::~Connection()
         m_settings.logFile = nullptr;
     }
 }
-typedef std::list< css::uno::Reference< css::sdbc::XCloseable > > CloseableList;
+typedef std::vector< css::uno::Reference< css::sdbc::XCloseable > > CloseableVector;
 
-typedef std::list< css::uno::Reference< css::lang::XComponent > > DisposeableList;
+typedef std::vector< css::uno::Reference< css::lang::XComponent > > DisposeableVector;
 
 void Connection::close()
 {
-    CloseableList lst;
-    DisposeableList lstDispose;
+    CloseableVector vectorCloseable;
+    DisposeableVector vectorDispose;
     {
         MutexGuard guard( m_xMutex->GetMutex() );
         // silently ignore, if the connection has been closed already
@@ -214,9 +214,9 @@ void Connection::close()
             m_settings.pConnection = nullptr;
         }
 
-        lstDispose.push_back( Reference< XComponent > ( m_settings.users, UNO_QUERY ) );
-        lstDispose.push_back( Reference< XComponent > ( m_settings.tables , UNO_QUERY ) );
-        lstDispose.push_back( Reference< XComponent > ( m_meta, UNO_QUERY ) );
+        vectorDispose.push_back( Reference< XComponent > ( m_settings.users, UNO_QUERY ) );
+        vectorDispose.push_back( Reference< XComponent > ( m_settings.tables , UNO_QUERY ) );
+        vectorDispose.push_back( Reference< XComponent > ( m_meta, UNO_QUERY ) );
         m_meta.clear();
         m_settings.tables.clear();
         m_settings.users.clear();
@@ -227,17 +227,17 @@ void Connection::close()
         {
             Reference< XCloseable > r = ii->second;
             if( r.is() )
-                lst.push_back( r );
+                vectorCloseable.push_back( r );
         }
     }
 
     // close all created statements
-    for( CloseableList::iterator ii = lst.begin(); ii != lst.end() ; ++ii )
+    for( CloseableVector::iterator ii = vectorCloseable.begin(); ii != vectorCloseable.end() ; ++ii )
         ii->get()->close();
 
     // close all created statements
-    for( DisposeableList::iterator iiDispose = lstDispose.begin();
-         iiDispose != lstDispose.end() ; ++iiDispose )
+    for( DisposeableVector::iterator iiDispose = vectorDispose.begin();
+         iiDispose != vectorDispose.end() ; ++iiDispose )
     {
         if( iiDispose->is() )
             iiDispose->get()->dispose();
diff --git a/connectivity/workben/iniParser/main.cxx b/connectivity/workben/iniParser/main.cxx
index dacc8bae337e..2667d957e605 100644
--- a/connectivity/workben/iniParser/main.cxx
+++ b/connectivity/workben/iniParser/main.cxx
@@ -22,7 +22,7 @@
 #include <osl/process.h>
 
 #include <map>
-#include <list>
+#include <vector>
 
 
 struct ini_NameValue
@@ -39,14 +39,14 @@ struct ini_NameValue
         {}
 };
 
-typedef std::list<
+typedef std::vector<
     ini_NameValue
-> NameValueList;
+> NameValueVector;
 
 struct ini_Section
 {
     OUString sName;
-    NameValueList lList;
+    NameValueVector vVector;
 };
 typedef std::map<OUString,
                 ini_Section
@@ -100,7 +100,7 @@ public:
                     nameValue.sValue = OStringToOUString(
                         line.copy(nIndex+1).trim(), RTL_TEXTENCODING_UTF8 );
 
-                    aSection->lList.push_back(nameValue);
+                    aSection->vVector.push_back(nameValue);
 
                 }
                 else
@@ -137,8 +137,8 @@ public:
         for(;iBegin != iEnd;iBegin++)
         {
             ini_Section *aSection = &(*iBegin).second;
-            for(NameValueList::iterator itor=aSection->lList.begin();
-                itor != aSection->lList.end();
+            for(NameValueVector::iterator itor=aSection->vVector.begin();
+                itor != aSection->vVector.end();
                 itor++)
             {
                     struct ini_NameValue * aValue = &(*itor);


More information about the Libreoffice-commits mailing list