summaryrefslogtreecommitdiff
path: root/connectivity/source
diff options
context:
space:
mode:
authorPragat Pandya <pragat.pandya@gmail.com>2022-05-08 23:56:45 +0530
committerBartosz Kosiorek <gang65@poczta.onet.pl>2022-05-09 20:42:03 +0200
commit6abc09926c9b55a445b906303f56c6ec7fdeabf9 (patch)
tree0dda52e9d57325cc510acfa4d8951e60c84e7409 /connectivity/source
parent0c3950c4954848fde1515a932cc16b38ab961a7d (diff)
tdf#147021 Use std::size() instead of SAL_N_ELEMENTS() macro
Change-Id: I54257e87da0cd66da59d820c7960c3e4b020fda3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134027 Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl> Tested-by: Jenkins
Diffstat (limited to 'connectivity/source')
-rw-r--r--connectivity/source/commontools/TDatabaseMetaDataBase.cxx2
-rw-r--r--connectivity/source/drivers/ado/Awrapado.cxx24
-rw-r--r--connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx2
-rw-r--r--connectivity/source/drivers/jdbc/DatabaseMetaData.cxx2
-rw-r--r--connectivity/source/drivers/postgresql/pq_statics.cxx32
-rw-r--r--connectivity/source/parse/sqlnode.cxx2
6 files changed, 32 insertions, 32 deletions
diff --git a/connectivity/source/commontools/TDatabaseMetaDataBase.cxx b/connectivity/source/commontools/TDatabaseMetaDataBase.cxx
index 173f87987659..0e81e71cf4ea 100644
--- a/connectivity/source/commontools/TDatabaseMetaDataBase.cxx
+++ b/connectivity/source/commontools/TDatabaseMetaDataBase.cxx
@@ -139,7 +139,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaDataBase::getTypeInfo( )
::connectivity::ODatabaseMetaDataResultSet::ORow aRow;
aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
const sal_Int32* pType = pTypes;
- for (sal_Int32 i = 1; i <= sal_Int32(SAL_N_ELEMENTS(pTypes)); ++i,++pType)
+ for (sal_Int32 i = 1; i <= sal_Int32(std::size(pTypes)); ++i,++pType)
{
ORowSetValue aValue;
aValue.fill(i,*pType,xRow);
diff --git a/connectivity/source/drivers/ado/Awrapado.cxx b/connectivity/source/drivers/ado/Awrapado.cxx
index c4abecf1db4f..c25c0d6e0e7a 100644
--- a/connectivity/source/drivers/ado/Awrapado.cxx
+++ b/connectivity/source/drivers/ado/Awrapado.cxx
@@ -1463,7 +1463,7 @@ ADORecordset* WpADOConnection::getExportedKeys( const css::uno::Any& catalog, co
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -1503,7 +1503,7 @@ ADORecordset* WpADOConnection::getImportedKeys( const css::uno::Any& catalog, co
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -1545,7 +1545,7 @@ ADORecordset* WpADOConnection::getPrimaryKeys( const css::uno::Any& catalog, con
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -1585,7 +1585,7 @@ ADORecordset* WpADOConnection::getIndexInfo(
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -1627,7 +1627,7 @@ ADORecordset* WpADOConnection::getTablePrivileges( const css::uno::Any& catalog,
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -1673,7 +1673,7 @@ ADORecordset* WpADOConnection::getCrossReference( const css::uno::Any& primaryCa
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -1722,7 +1722,7 @@ ADORecordset* WpADOConnection::getProcedures( const css::uno::Any& catalog,
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -1763,7 +1763,7 @@ ADORecordset* WpADOConnection::getProcedureColumns( const css::uno::Any& catalog
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -1834,7 +1834,7 @@ ADORecordset* WpADOConnection::getTables( const css::uno::Any& catalog,
varCriteria[nPos].setString(sTypeNames);
// Create SafeArray Bounds and initialize the array
- const sal_Int32 nCrit = SAL_N_ELEMENTS(varCriteria);
+ const sal_Int32 nCrit = std::size(varCriteria);
SAFEARRAYBOUND rgsabound[1];
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = nCrit;
@@ -1871,7 +1871,7 @@ ADORecordset* WpADOConnection::getColumns( const css::uno::Any& catalog,
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -1915,7 +1915,7 @@ ADORecordset* WpADOConnection::getColumnPrivileges( const css::uno::Any& catalog
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -1950,7 +1950,7 @@ ADORecordset* WpADOConnection::getTypeInfo(DataTypeEnum /*_eType*/)
{
// Create elements used in the array
OLEVariant varCriteria[2];
- const int nCrit = SAL_N_ELEMENTS(varCriteria);
+ const int nCrit = std::size(varCriteria);
// Create SafeArray Bounds and initialize the array
SAFEARRAYBOUND rgsabound[1];
rgsabound[0].lLbound = 0;
diff --git a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx
index 1dc72f669d26..dbb8cb447159 100644
--- a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx
@@ -996,7 +996,7 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTableTypes( )
rtl::Reference<::connectivity::ODatabaseMetaDataResultSet> pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes);
// here we fill the rows which should be visible when ask for data from the resultset returned here
- auto nNbTypes = SAL_N_ELEMENTS(sTableTypes);
+ auto nNbTypes = std::size(sTableTypes);
ODatabaseMetaDataResultSet::ORows aRows;
for(std::size_t i=0;i < nNbTypes;++i)
{
diff --git a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
index bd2f8470a2a9..2633fd09b64a 100644
--- a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
+++ b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
@@ -449,7 +449,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTablePrivileges(
for (sal_Int32 i = 1 ; i <= nCount ; ++i)
{
sColumnName = xMeta->getColumnName(i);
- for (size_t j = 0 ; j < SAL_N_ELEMENTS(sPrivs); ++j)
+ for (size_t j = 0 ; j < std::size(sPrivs); ++j)
{
if ( sPrivs[j] == sColumnName )
{
diff --git a/connectivity/source/drivers/postgresql/pq_statics.cxx b/connectivity/source/drivers/postgresql/pq_statics.cxx
index 3ae01b8b267c..ec3d0d8ac587 100644
--- a/connectivity/source/drivers/postgresql/pq_statics.cxx
+++ b/connectivity/source/drivers/postgresql/pq_statics.cxx
@@ -196,7 +196,7 @@ Statics & getStatics()
PropertyDef( statics.TYPE , tString )
};
ist.pProps = createPropertyArrayHelper(
- tableDef, SAL_N_ELEMENTS(tableDef), READONLY );
+ tableDef, std::size(tableDef), READONLY );
statics.refl.tableDescriptor.implName =
"org.openoffice.comp.pq.sdbcx.TableDescriptor";
@@ -210,7 +210,7 @@ Statics & getStatics()
PropertyDef( statics.SCHEMA_NAME , tString )
};
statics.refl.tableDescriptor.pProps = createPropertyArrayHelper(
- tableDescDef, SAL_N_ELEMENTS(tableDescDef), 0 );
+ tableDescDef, std::size(tableDescDef), 0 );
// Column props set
statics.refl.column.implName = "org.openoffice.comp.pq.sdbcx.Column";
@@ -232,7 +232,7 @@ Statics & getStatics()
PropertyDefEx( statics.TYPE_NAME , tString ,READONLY)
};
statics.refl.column.pProps = createPropertyArrayHelper(
- columnDef, SAL_N_ELEMENTS(columnDef) );
+ columnDef, std::size(columnDef) );
statics.refl.columnDescriptor.implName =
"org.openoffice.comp.pq.sdbcx.ColumnDescriptor";
@@ -255,7 +255,7 @@ Statics & getStatics()
};
statics.refl.columnDescriptor.pProps = createPropertyArrayHelper(
- columnDescDef, SAL_N_ELEMENTS(columnDescDef), 0 );
+ columnDescDef, std::size(columnDescDef), 0 );
// Key properties
statics.refl.key.implName = "org.openoffice.comp.pq.sdbcx.Key";
@@ -271,7 +271,7 @@ Statics & getStatics()
PropertyDef( statics.UPDATE_RULE, tInt )
};
statics.refl.key.pProps = createPropertyArrayHelper(
- keyDef, SAL_N_ELEMENTS(keyDef), READONLY );
+ keyDef, std::size(keyDef), READONLY );
// Key properties
@@ -287,7 +287,7 @@ Statics & getStatics()
PropertyDef( statics.UPDATE_RULE, tInt )
};
statics.refl.keyDescriptor.pProps = createPropertyArrayHelper(
- keyDescDef, SAL_N_ELEMENTS(keyDescDef), 0 );
+ keyDescDef, std::size(keyDescDef), 0 );
// KeyColumn props set
@@ -310,7 +310,7 @@ Statics & getStatics()
PropertyDef( statics.TYPE_NAME , tString )
};
statics.refl.keycolumn.pProps = createPropertyArrayHelper(
- keycolumnDef, SAL_N_ELEMENTS(keycolumnDef), READONLY );
+ keycolumnDef, std::size(keycolumnDef), READONLY );
// KeyColumn props set
statics.refl.keycolumnDescriptor.implName =
@@ -323,7 +323,7 @@ Statics & getStatics()
PropertyDef( statics.RELATED_COLUMN, tString )
};
statics.refl.keycolumnDescriptor.pProps = createPropertyArrayHelper(
- keycolumnDescDef, SAL_N_ELEMENTS(keycolumnDescDef), 0 );
+ keycolumnDescDef, std::size(keycolumnDescDef), 0 );
// view props set
statics.refl.view.implName = "org.openoffice.comp.pq.sdbcx.View";
@@ -337,13 +337,13 @@ Statics & getStatics()
PropertyDef( statics.SCHEMA_NAME , tString )
};
statics.refl.view.pProps = createPropertyArrayHelper(
- viewDef, SAL_N_ELEMENTS(viewDef), READONLY );
+ viewDef, std::size(viewDef), READONLY );
// view props set
statics.refl.viewDescriptor.implName = "org.openoffice.comp.pq.sdbcx.ViewDescriptor";
statics.refl.viewDescriptor.serviceNames = { "com.sun.star.sdbcx.ViewDescriptor" };
statics.refl.viewDescriptor.pProps = createPropertyArrayHelper(
- viewDef, SAL_N_ELEMENTS(viewDef), 0 ); // reuse view, as it is identical
+ viewDef, std::size(viewDef), 0 ); // reuse view, as it is identical
// user props set
statics.refl.user.implName = "org.openoffice.comp.pq.sdbcx.User";
statics.refl.user.serviceNames = { "com.sun.star.sdbcx.User" };
@@ -352,7 +352,7 @@ Statics & getStatics()
PropertyDef( statics.NAME , tString )
};
statics.refl.user.pProps = createPropertyArrayHelper(
- userDefRO, SAL_N_ELEMENTS(userDefRO), READONLY );
+ userDefRO, std::size(userDefRO), READONLY );
// user props set
statics.refl.userDescriptor.implName =
@@ -364,7 +364,7 @@ Statics & getStatics()
PropertyDef( statics.PASSWORD , tString )
};
statics.refl.userDescriptor.pProps = createPropertyArrayHelper(
- userDefWR, SAL_N_ELEMENTS(userDefWR), 0 );
+ userDefWR, std::size(userDefWR), 0 );
// index props set
statics.refl.index.implName = "org.openoffice.comp.pq.sdbcx.Index";
@@ -379,14 +379,14 @@ Statics & getStatics()
PropertyDef( statics.PRIVATE_COLUMN_INDEXES, tStringSequence )
};
statics.refl.index.pProps = createPropertyArrayHelper(
- indexDef, SAL_N_ELEMENTS(indexDef), READONLY );
+ indexDef, std::size(indexDef), READONLY );
// index props set
statics.refl.indexDescriptor.implName =
"org.openoffice.comp.pq.sdbcx.IndexDescriptor";
statics.refl.indexDescriptor.serviceNames = { "com.sun.star.sdbcx.IndexDescriptor" };
statics.refl.indexDescriptor.pProps = createPropertyArrayHelper(
- indexDef, SAL_N_ELEMENTS(indexDef), 0 );
+ indexDef, std::size(indexDef), 0 );
// indexColumn props set
statics.refl.indexColumn.implName = "org.openoffice.comp.pq.sdbcx.IndexColumn";
@@ -408,7 +408,7 @@ Statics & getStatics()
PropertyDef( statics.TYPE_NAME , tString )
};
statics.refl.indexColumn.pProps = createPropertyArrayHelper(
- indexColumnDef, SAL_N_ELEMENTS(indexColumnDef), READONLY );
+ indexColumnDef, std::size(indexColumnDef), READONLY );
// indexColumn props set
statics.refl.indexColumnDescriptor.implName =
@@ -421,7 +421,7 @@ Statics & getStatics()
PropertyDef( statics.NAME , tString )
};
statics.refl.indexColumnDescriptor.pProps = createPropertyArrayHelper(
- indexColumnDescDef, SAL_N_ELEMENTS(indexColumnDescDef), 0 );
+ indexColumnDescDef, std::size(indexColumnDescDef), 0 );
// databasemetadata
statics.tablesRowNames = std::vector< OUString > ( 5 );
diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index c121eb05b474..75acac48f7b8 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -1456,7 +1456,7 @@ OSQLParser::OSQLParser(const css::uno::Reference< css::uno::XComponentContext >&
{ OSQLParseNode::cast_spec, "cast_spec" },
{ OSQLParseNode::window_function, "window_function" }
};
- const size_t nRuleMapCount = SAL_N_ELEMENTS( aRuleDescriptions );
+ const size_t nRuleMapCount = std::size( aRuleDescriptions );
// added a new rule? Adjust this map!
// +1 for UNKNOWN_RULE
static_assert(nRuleMapCount + 1 == static_cast<size_t>(OSQLParseNode::rule_count), "must be equal");