diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-01-28 17:53:30 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-01-28 17:56:18 +0100 |
commit | cead54b6e555fe907348943b4586e956771f6ad0 (patch) | |
tree | 509e515c969fa27449fd7f7674c252e742133aae /dbaccess | |
parent | ed874d2eab1a6b1146f411a5a83cc790d3226f10 (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 'dbaccess')
-rw-r--r-- | dbaccess/source/core/api/View.cxx | 3 | ||||
-rw-r--r-- | dbaccess/source/core/api/table.cxx | 3 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/formadapter.cxx | 3 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/adtabdlg.cxx | 3 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/TableWindowAccess.cxx | 3 |
5 files changed, 5 insertions, 10 deletions
diff --git a/dbaccess/source/core/api/View.cxx b/dbaccess/source/core/api/View.cxx index 547eab3cd8bd..cc8e77e05c20 100644 --- a/dbaccess/source/core/api/View.cxx +++ b/dbaccess/source/core/api/View.cxx @@ -107,8 +107,7 @@ namespace dbaccess aOwnTypes.push_back(*pIter); } - Type* pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0]; - return Sequence< Type >(pTypes, aOwnTypes.size()); + return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size()); } void SAL_CALL View::alterCommand( const OUString& _rNewCommand ) throw (SQLException, RuntimeException, std::exception) diff --git a/dbaccess/source/core/api/table.cxx b/dbaccess/source/core/api/table.cxx index 07c40771fd42..6c2ac8e039ab 100644 --- a/dbaccess/source/core/api/table.cxx +++ b/dbaccess/source/core/api/table.cxx @@ -276,8 +276,7 @@ Sequence< Type > SAL_CALL ODBTable::getTypes( ) throw(RuntimeException, std::ex aOwnTypes.push_back(*pIter); } - Type* pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0]; - return Sequence< Type >(pTypes, aOwnTypes.size()); + return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size()); } // XRename, diff --git a/dbaccess/source/ui/browser/formadapter.cxx b/dbaccess/source/ui/browser/formadapter.cxx index 87d5e2fde797..0600bd3afb3e 100644 --- a/dbaccess/source/ui/browser/formadapter.cxx +++ b/dbaccess/source/ui/browser/formadapter.cxx @@ -1479,8 +1479,7 @@ Any SAL_CALL SbaXFormAdapter::getByName(const OUString& aName) throw( ::com::sun Sequence< OUString > SAL_CALL SbaXFormAdapter::getElementNames() throw( RuntimeException, std::exception ) { - OUString *pChildNames = m_aChildNames.empty() ? 0 : &m_aChildNames[0]; - return Sequence< OUString >(pChildNames, m_aChildNames.size()); + return Sequence< OUString >(m_aChildNames.data(), m_aChildNames.size()); } sal_Bool SAL_CALL SbaXFormAdapter::hasByName(const OUString& aName) throw( RuntimeException, std::exception ) diff --git a/dbaccess/source/ui/dlg/adtabdlg.cxx b/dbaccess/source/ui/dlg/adtabdlg.cxx index a6ca7ae16bd9..5e4cb63aa6f0 100644 --- a/dbaccess/source/ui/dlg/adtabdlg.cxx +++ b/dbaccess/source/ui/dlg/adtabdlg.cxx @@ -191,8 +191,7 @@ void TableListFacade::updateTableObjectList( bool _bAllowViews ) ::comphelper::UStringMixEqual aEqualFunctor; for(;pViewBegin != pViewEnd;++pViewBegin) aTables.erase(::std::remove_if(aTables.begin(),aTables.end(),::std::bind2nd(aEqualFunctor,*pViewBegin)),aTables.end()); - OUString* pTables = aTables.empty() ? 0 : &aTables[0]; - sTables = Sequence< OUString>(pTables, aTables.size()); + sTables = Sequence< OUString>(aTables.data(), aTables.size()); sViews = Sequence< OUString>(); } diff --git a/dbaccess/source/ui/querydesign/TableWindowAccess.cxx b/dbaccess/source/ui/querydesign/TableWindowAccess.cxx index f4ed8116345f..433e008e6e68 100644 --- a/dbaccess/source/ui/querydesign/TableWindowAccess.cxx +++ b/dbaccess/source/ui/querydesign/TableWindowAccess.cxx @@ -224,8 +224,7 @@ namespace dbaui aRelations.push_back(xInterface); } - Reference<XInterface> *pRelations = aRelations.empty() ? 0 : &aRelations[0]; - Sequence< Reference<XInterface> > aSeq(pRelations, aRelations.size()); + Sequence< Reference<XInterface> > aSeq(aRelations.data(), aRelations.size()); return AccessibleRelation(AccessibleRelationType::CONTROLLER_FOR,aSeq); } return AccessibleRelation(); |