diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2021-06-08 10:16:31 +0200 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2021-06-08 13:27:37 +0200 |
commit | 6ef69234cf9138000a1dcf483114ea7c792fe3ed (patch) | |
tree | febed2238b8ec721cc822ace9b3e45049a8f9bd6 /connectivity | |
parent | de9b6e3deeeffa2405fe890946714c2e439e1583 (diff) |
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@yahoo.fr>
Diffstat (limited to 'connectivity')
9 files changed, 19 insertions, 34 deletions
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() ) { |