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

Julien Nabet (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 8 11:28:17 UTC 2021


 comphelper/source/misc/accessiblekeybindinghelper.cxx    |    5 +----
 connectivity/source/commontools/TPrivilegesResultSet.cxx |    5 +----
 connectivity/source/drivers/firebird/Catalog.cxx         |    4 +---
 connectivity/source/drivers/hsqldb/HCatalog.cxx          |    4 +---
 connectivity/source/drivers/hsqldb/HStorageAccess.cxx    |   12 +++++++-----
 connectivity/source/drivers/hsqldb/HTables.cxx           |    5 +----
 connectivity/source/drivers/mysql_jdbc/YCatalog.cxx      |    7 +++----
 connectivity/source/drivers/mysql_jdbc/YTables.cxx       |    7 +++----
 connectivity/source/drivers/postgresql/pq_statics.cxx    |    4 +---
 connectivity/source/parse/sqliterator.cxx                |    5 +----
 10 files changed, 20 insertions(+), 38 deletions(-)

New commits:
commit 6ef69234cf9138000a1dcf483114ea7c792fe3ed
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Tue Jun 8 10:16:31 2021 +0200
Commit:     Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Tue Jun 8 13:27:37 2021 +0200

    Simplify Sequences initializations (comphelper+connectivity)
    
    Change-Id: I8a91f4bd2a1117acb571f1058af18071bc058c9d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116815
    Tested-by: Jenkins
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/comphelper/source/misc/accessiblekeybindinghelper.cxx b/comphelper/source/misc/accessiblekeybindinghelper.cxx
index 8028464aff2b..ce1203e42fcd 100644
--- a/comphelper/source/misc/accessiblekeybindinghelper.cxx
+++ b/comphelper/source/misc/accessiblekeybindinghelper.cxx
@@ -64,10 +64,7 @@ namespace comphelper
     void OAccessibleKeyBindingHelper::AddKeyBinding( const awt::KeyStroke& rKeyStroke )
     {
         ::osl::MutexGuard aGuard( m_aMutex );
-
-        Sequence< awt::KeyStroke > aSeq(1);
-        aSeq[0] = rKeyStroke;
-        m_aKeyBindings.push_back( aSeq );
+        m_aKeyBindings.push_back( { rKeyStroke } );
     }
 
 
diff --git a/connectivity/source/commontools/TPrivilegesResultSet.cxx b/connectivity/source/commontools/TPrivilegesResultSet.cxx
index de255d3cb8c1..54bfb37d7034 100644
--- a/connectivity/source/commontools/TPrivilegesResultSet.cxx
+++ b/connectivity/source/commontools/TPrivilegesResultSet.cxx
@@ -38,11 +38,8 @@ OResultSetPrivileges::OResultSetPrivileges( const Reference< XDatabaseMetaData>&
     osl_atomic_increment( &m_refCount );
     {
         OUString sUserWorkingFor;
-        Sequence< OUString > sTableTypes(3);
         // we want all catalogues, all schemas, all tables
-        sTableTypes[0] = "VIEW";
-        sTableTypes[1] = "TABLE";
-        sTableTypes[2] = "%"; // just to be sure to include anything else...
+        Sequence< OUString > sTableTypes {"VIEW", "TABLE", "%"}; // this last one is just to be sure to include anything else...
         try
         {
             m_xTables = _rxMeta->getTables(catalog,schemaPattern,tableNamePattern,sTableTypes);
diff --git a/connectivity/source/drivers/firebird/Catalog.cxx b/connectivity/source/drivers/firebird/Catalog.cxx
index 47fedab60d59..90cec2611110 100644
--- a/connectivity/source/drivers/firebird/Catalog.cxx
+++ b/connectivity/source/drivers/firebird/Catalog.cxx
@@ -27,9 +27,7 @@ Catalog::Catalog(const uno::Reference< XConnection >& rConnection):
 //----- OCatalog -------------------------------------------------------------
 void Catalog::refreshTables()
 {
-    Sequence< OUString > aTypes(2);
-    aTypes[0] = "TABLE";
-    aTypes[1] = "VIEW";
+    Sequence< OUString > aTypes {"TABLE", "VIEW"};
 
     uno::Reference< XResultSet > xTables = m_xMetaData->getTables(Any(),
                                                             "%",
diff --git a/connectivity/source/drivers/hsqldb/HCatalog.cxx b/connectivity/source/drivers/hsqldb/HCatalog.cxx
index 029e60f9450a..1074be53559c 100644
--- a/connectivity/source/drivers/hsqldb/HCatalog.cxx
+++ b/connectivity/source/drivers/hsqldb/HCatalog.cxx
@@ -54,9 +54,7 @@ void OHCatalog::refreshTables()
 {
     ::std::vector< OUString> aVector;
 
-    Sequence< OUString > sTableTypes(2);
-    sTableTypes[0] = "VIEW";
-    sTableTypes[1] = "TABLE";
+    Sequence< OUString > sTableTypes {"VIEW", "TABLE"};
 
     refreshObjects(sTableTypes,aVector);
 
diff --git a/connectivity/source/drivers/hsqldb/HStorageAccess.cxx b/connectivity/source/drivers/hsqldb/HStorageAccess.cxx
index 91b8324008e3..4e939ad58603 100644
--- a/connectivity/source/drivers/hsqldb/HStorageAccess.cxx
+++ b/connectivity/source/drivers/hsqldb/HStorageAccess.cxx
@@ -463,11 +463,13 @@ void write_to_storage_stream( JNIEnv* env, jstring name, jstring key, jint v )
     {
         if ( xOut.is() )
         {
-            Sequence< ::sal_Int8 > oneByte(4);
-            oneByte[0] = static_cast<sal_Int8>((v >> 24) & 0xFF);
-            oneByte[1] = static_cast<sal_Int8>((v >> 16) & 0xFF);
-            oneByte[2] = static_cast<sal_Int8>((v >>  8) & 0xFF);
-            oneByte[3] = static_cast<sal_Int8>((v >>  0) & 0xFF);
+            Sequence< ::sal_Int8 > oneByte
+            {
+                static_cast<sal_Int8>((v >> 24) & 0xFF),
+                static_cast<sal_Int8>((v >> 16) & 0xFF),
+                static_cast<sal_Int8>((v >>  8) & 0xFF),
+                static_cast<sal_Int8>((v >>  0) & 0xFF)
+            };
 
             xOut->writeBytes(oneByte);
         }
diff --git a/connectivity/source/drivers/hsqldb/HTables.cxx b/connectivity/source/drivers/hsqldb/HTables.cxx
index 472b8b514942..e92629bbb0f2 100644
--- a/connectivity/source/drivers/hsqldb/HTables.cxx
+++ b/connectivity/source/drivers/hsqldb/HTables.cxx
@@ -45,10 +45,7 @@ sdbcx::ObjectType OTables::createObject(const OUString& _rName)
     OUString sCatalog,sSchema,sTable;
     ::dbtools::qualifiedNameComponents(m_xMetaData,_rName,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation);
 
-    Sequence< OUString > sTableTypes(3);
-    sTableTypes[0] = "VIEW";
-    sTableTypes[1] = "TABLE";
-    sTableTypes[2] = "%";    // just to be sure to include anything else...
+    Sequence< OUString > sTableTypes {"VIEW", "TABLE", "%"};    // this last one just to be sure to include anything else...
 
     Any aCatalog;
     if ( !sCatalog.isEmpty() )
diff --git a/connectivity/source/drivers/mysql_jdbc/YCatalog.cxx b/connectivity/source/drivers/mysql_jdbc/YCatalog.cxx
index ad98bfa1a7fa..9c0afb55abd5 100644
--- a/connectivity/source/drivers/mysql_jdbc/YCatalog.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YCatalog.cxx
@@ -52,10 +52,9 @@ void OMySQLCatalog::refreshTables()
 {
     ::std::vector<OUString> aVector;
 
-    Sequence<OUString> sTableTypes(3);
-    sTableTypes[0] = "VIEW";
-    sTableTypes[1] = "TABLE";
-    sTableTypes[2] = "%"; // just to be sure to include anything else...
+    Sequence<OUString> sTableTypes{
+        "VIEW", "TABLE", "%"
+    }; // this last one just to be sure to include anything else...
 
     refreshObjects(sTableTypes, aVector);
 
diff --git a/connectivity/source/drivers/mysql_jdbc/YTables.cxx b/connectivity/source/drivers/mysql_jdbc/YTables.cxx
index a5a023808edd..be962d3d7c33 100644
--- a/connectivity/source/drivers/mysql_jdbc/YTables.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YTables.cxx
@@ -46,10 +46,9 @@ sdbcx::ObjectType OTables::createObject(const OUString& _rName)
     ::dbtools::qualifiedNameComponents(m_xMetaData, _rName, sCatalog, sSchema, sTable,
                                        ::dbtools::EComposeRule::InDataManipulation);
 
-    Sequence<OUString> sTableTypes(3);
-    sTableTypes[0] = "VIEW";
-    sTableTypes[1] = "TABLE";
-    sTableTypes[2] = "%"; // just to be sure to include anything else...
+    Sequence<OUString> sTableTypes{
+        "VIEW", "TABLE", "%"
+    }; // this last one just to be sure to include anything else...
 
     Any aCatalog;
     if (!sCatalog.isEmpty())
diff --git a/connectivity/source/drivers/postgresql/pq_statics.cxx b/connectivity/source/drivers/postgresql/pq_statics.cxx
index a68242e2c55d..c4bee2152ef2 100644
--- a/connectivity/source/drivers/postgresql/pq_statics.cxx
+++ b/connectivity/source/drivers/postgresql/pq_statics.cxx
@@ -200,9 +200,7 @@ Statics & getStatics()
 
             statics.refl.tableDescriptor.implName =
                 "org.openoffice.comp.pq.sdbcx.TableDescriptor";
-            statics.refl.tableDescriptor.serviceNames = Sequence< OUString > (1);
-            statics.refl.tableDescriptor.serviceNames[0] =
-                "com.sun.star.sdbcx.TableDescriptor";
+            statics.refl.tableDescriptor.serviceNames = { "com.sun.star.sdbcx.TableDescriptor" };
             PropertyDef tableDescDef[] =
                 {
                     PropertyDef( statics.CATALOG_NAME , tString ),
diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx
index 5a7e152b1aa6..94df96d39628 100644
--- a/connectivity/source/parse/sqliterator.cxx
+++ b/connectivity/source/parse/sqliterator.cxx
@@ -267,10 +267,7 @@ namespace
         static constexpr OUStringLiteral s_sWildcard = u"%" ;
 
         // we want all catalogues, all schemas, all tables
-        Sequence< OUString > sTableTypes(3);
-        sTableTypes[0] = "VIEW";
-        sTableTypes[1] = "TABLE";
-        sTableTypes[2] = s_sWildcard;   // just to be sure to include anything else...
+        Sequence< OUString > sTableTypes { "VIEW", "TABLE", s_sWildcard }; // this last one just to be sure to include anything else...
 
         if ( _rxDBMeta.is() )
         {


More information about the Libreoffice-commits mailing list