summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-01-28 17:53:30 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-01-28 17:56:18 +0100
commitcead54b6e555fe907348943b4586e956771f6ad0 (patch)
tree509e515c969fa27449fd7f7674c252e742133aae /connectivity
parented874d2eab1a6b1146f411a5a83cc790d3226f10 (diff)
Use vector::data
...in some places where it is obvious that it does not hurt that for an empty vector the obtained pointer is not necessarily a nullptr. Change-Id: Id5d66b1559ca8b8955d379bcdbfae6986ef46a51
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/commontools/parameters.cxx6
-rw-r--r--connectivity/source/drivers/calc/CTable.cxx3
-rw-r--r--connectivity/source/drivers/dbase/DTable.cxx3
-rw-r--r--connectivity/source/drivers/file/FCatalog.cxx3
-rw-r--r--connectivity/source/drivers/flat/EResultSet.cxx3
-rw-r--r--connectivity/source/drivers/flat/ETable.cxx3
-rw-r--r--connectivity/source/drivers/hsqldb/HCatalog.cxx3
-rw-r--r--connectivity/source/drivers/hsqldb/HTable.cxx3
-rw-r--r--connectivity/source/drivers/mysql/YCatalog.cxx3
-rw-r--r--connectivity/source/drivers/mysql/YDriver.cxx3
-rw-r--r--connectivity/source/sdbcx/VCollection.cxx3
11 files changed, 12 insertions, 24 deletions
diff --git a/connectivity/source/commontools/parameters.cxx b/connectivity/source/commontools/parameters.cxx
index 4bc8b46bef7c..25c7da56dce8 100644
--- a/connectivity/source/commontools/parameters.cxx
+++ b/connectivity/source/commontools/parameters.cxx
@@ -324,10 +324,8 @@ namespace dbtools
if ( bNeedExchangeLinks )
{
- OUString *pFields = aStrippedMasterFields.empty() ? 0 : &aStrippedMasterFields[0];
- m_aMasterFields = Sequence< OUString >( pFields, aStrippedMasterFields.size() );
- pFields = aStrippedDetailFields.empty() ? 0 : &aStrippedDetailFields[0];
- m_aDetailFields = Sequence< OUString >( pFields, aStrippedDetailFields.size() );
+ m_aMasterFields = Sequence< OUString >( aStrippedMasterFields.data(), aStrippedMasterFields.size() );
+ m_aDetailFields = Sequence< OUString >( aStrippedDetailFields.data(), aStrippedDetailFields.size() );
}
}
diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx
index fbf7e9400653..b7a4b29ef7fe 100644
--- a/connectivity/source/drivers/calc/CTable.cxx
+++ b/connectivity/source/drivers/calc/CTable.cxx
@@ -666,8 +666,7 @@ Sequence< Type > SAL_CALL OCalcTable::getTypes( ) throw(RuntimeException, std::
}
aOwnTypes.push_back(cppu::UnoType<com::sun::star::lang::XUnoTunnel>::get());
- const Type* pAttrs = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
- return Sequence< Type >(pAttrs, aOwnTypes.size());
+ return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size());
}
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index 750be4f7f98d..8df0a2bd9d63 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -740,8 +740,7 @@ Sequence< Type > SAL_CALL ODbaseTable::getTypes( ) throw(RuntimeException, std:
}
}
aOwnTypes.push_back(cppu::UnoType<com::sun::star::lang::XUnoTunnel>::get());
- Type *pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
- return Sequence< Type >(pTypes, aOwnTypes.size());
+ return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size());
}
diff --git a/connectivity/source/drivers/file/FCatalog.cxx b/connectivity/source/drivers/file/FCatalog.cxx
index 079f53b84fc6..24cc23086efd 100644
--- a/connectivity/source/drivers/file/FCatalog.cxx
+++ b/connectivity/source/drivers/file/FCatalog.cxx
@@ -96,8 +96,7 @@ Sequence< Type > SAL_CALL OFileCatalog::getTypes( ) throw(RuntimeException, std
aOwnTypes.push_back(*pBegin);
}
}
- const Type *pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
- return Sequence< Type >(pTypes, aOwnTypes.size());
+ return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size());
}
diff --git a/connectivity/source/drivers/flat/EResultSet.cxx b/connectivity/source/drivers/flat/EResultSet.cxx
index a9a8bc54130e..84a3a078fe1f 100644
--- a/connectivity/source/drivers/flat/EResultSet.cxx
+++ b/connectivity/source/drivers/flat/EResultSet.cxx
@@ -88,8 +88,7 @@ Sequence< Type > SAL_CALL OFlatResultSet::getTypes( ) throw( RuntimeException,
aOwnTypes.push_back(*pBegin);
}
}
- Type* pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
- Sequence< Type > aRet(pTypes, aOwnTypes.size());
+ Sequence< Type > aRet(aOwnTypes.data(), aOwnTypes.size());
return ::comphelper::concatSequences(aRet,OFlatResultSet_BASE::getTypes());
}
diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx
index df816fbc5fb3..b1335b91aa9c 100644
--- a/connectivity/source/drivers/flat/ETable.cxx
+++ b/connectivity/source/drivers/flat/ETable.cxx
@@ -539,8 +539,7 @@ Sequence< Type > SAL_CALL OFlatTable::getTypes( ) throw(RuntimeException, std::
aOwnTypes.push_back(*pBegin);
}
}
- Type *pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
- return Sequence< Type >(pTypes, aOwnTypes.size());
+ return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size());
}
diff --git a/connectivity/source/drivers/hsqldb/HCatalog.cxx b/connectivity/source/drivers/hsqldb/HCatalog.cxx
index 975192d1406c..09e55a238e4a 100644
--- a/connectivity/source/drivers/hsqldb/HCatalog.cxx
+++ b/connectivity/source/drivers/hsqldb/HCatalog.cxx
@@ -147,8 +147,7 @@ Sequence< Type > SAL_CALL OHCatalog::getTypes( ) throw(RuntimeException, std::e
aOwnTypes.push_back(*pBegin);
}
}
- const Type* pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
- return Sequence< Type >(pTypes, aOwnTypes.size());
+ return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size());
}
diff --git a/connectivity/source/drivers/hsqldb/HTable.cxx b/connectivity/source/drivers/hsqldb/HTable.cxx
index 31923db3579a..dc6a71146df9 100644
--- a/connectivity/source/drivers/hsqldb/HTable.cxx
+++ b/connectivity/source/drivers/hsqldb/HTable.cxx
@@ -356,8 +356,7 @@ Sequence< Type > SAL_CALL OHSQLTable::getTypes( ) throw(RuntimeException, std::
aOwnTypes.push_back(*pIter);
}
}
- Type *pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
- return Sequence< Type >(pTypes, aOwnTypes.size());
+ return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size());
}
return OTableHelper::getTypes();
}
diff --git a/connectivity/source/drivers/mysql/YCatalog.cxx b/connectivity/source/drivers/mysql/YCatalog.cxx
index cb071e05b4f5..78016434d66d 100644
--- a/connectivity/source/drivers/mysql/YCatalog.cxx
+++ b/connectivity/source/drivers/mysql/YCatalog.cxx
@@ -140,8 +140,7 @@ Sequence< Type > SAL_CALL OMySQLCatalog::getTypes( ) throw(RuntimeException, st
aOwnTypes.push_back(*pBegin);
}
}
- const Type* pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
- return Sequence< Type >(pTypes, aOwnTypes.size());
+ return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size());
}
diff --git a/connectivity/source/drivers/mysql/YDriver.cxx b/connectivity/source/drivers/mysql/YDriver.cxx
index aa776a4234c9..63507adcab5a 100644
--- a/connectivity/source/drivers/mysql/YDriver.cxx
+++ b/connectivity/source/drivers/mysql/YDriver.cxx
@@ -218,8 +218,7 @@ namespace connectivity
,0
,makeAny(sal_True)
,PropertyState_DIRECT_VALUE) );
- PropertyValue* pProps = aProps.empty() ? 0 : &aProps[0];
- return Sequence< PropertyValue >(pProps, aProps.size());
+ return Sequence< PropertyValue >(aProps.data(), aProps.size());
}
}
diff --git a/connectivity/source/sdbcx/VCollection.cxx b/connectivity/source/sdbcx/VCollection.cxx
index cc886dfd3584..c43cc185d92d 100644
--- a/connectivity/source/sdbcx/VCollection.cxx
+++ b/connectivity/source/sdbcx/VCollection.cxx
@@ -279,8 +279,7 @@ Sequence< Type > SAL_CALL OCollection::getTypes() throw (RuntimeException, std::
if ( *pBegin != aType )
aOwnTypes.push_back(*pBegin);
}
- Type* pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
- return Sequence< Type >(pTypes,aOwnTypes.size());
+ return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size());
}
return OCollectionBase::getTypes( );
}