diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-05-04 23:16:48 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-06-10 10:55:57 +0200 |
commit | 1eb8859813ff43b3753dcbab9e3e0bdfe7d72edb (patch) | |
tree | 4e04ab9584a5ef874faf8141c962158c32448d35 /connectivity | |
parent | ec905d131374f0860bac77c52873eed984b1966f (diff) |
Use hasElements to check Sequence emptiness in chart2..connectivity
Similar to clang-tidy readability-container-size-empty
Change-Id: I41824e8a4ef38d6a35a0ac4421cffcbcd17308e1
Reviewed-on: https://gerrit.libreoffice.org/71802
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'connectivity')
7 files changed, 10 insertions, 10 deletions
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index d8a65d0cd241..f5dd3b61fcd2 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -2302,7 +2302,7 @@ namespace aProps[0].Value <<= sNewName; Sequence< Any > aValues; aContent.executeCommand( "setPropertyValues",makeAny(aProps) ) >>= aValues; - if(aValues.getLength() && aValues[0].hasValue()) + if(aValues.hasElements() && aValues[0].hasValue()) throw Exception("setPropertyValues returned non-zero", nullptr); } catch(const Exception&) diff --git a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx index f3fad5ff3636..1b3a1692b0c8 100644 --- a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx +++ b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx @@ -1319,7 +1319,7 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( "WHERE "); // TODO: GLOBAL TEMPORARY, LOCAL TEMPORARY, ALIAS, SYNONYM - if ((types.getLength() == 0) || (types.getLength() == 1 && types[0].match(wld))) + if (!types.hasElements() || (types.getLength() == 1 && types[0].match(wld))) { // All table types? I.e. includes system tables. queryBuf.append("(RDB$RELATION_TYPE = 0 OR RDB$RELATION_TYPE = 1) "); diff --git a/connectivity/source/drivers/jdbc/JConnection.cxx b/connectivity/source/drivers/jdbc/JConnection.cxx index 9a3dd6bf2955..4c600cf2e767 100644 --- a/connectivity/source/drivers/jdbc/JConnection.cxx +++ b/connectivity/source/drivers/jdbc/JConnection.cxx @@ -578,7 +578,7 @@ namespace bool lcl_setSystemProperties_nothrow( const java::sql::ConnectionLog& _rLogger, JNIEnv& _rEnv, const Sequence< NamedValue >& _rSystemProperties ) { - if ( _rSystemProperties.getLength() == 0 ) + if ( !_rSystemProperties.hasElements() ) // nothing to do return true; diff --git a/connectivity/source/drivers/jdbc/Reader.cxx b/connectivity/source/drivers/jdbc/Reader.cxx index 6d3b846f88f8..1c7bfe9660df 100644 --- a/connectivity/source/drivers/jdbc/Reader.cxx +++ b/connectivity/source/drivers/jdbc/Reader.cxx @@ -111,7 +111,7 @@ sal_Int32 SAL_CALL java_io_Reader::readBytes( css::uno::Sequence< sal_Int8 >& aD if (m_buf) { - if(aData.getLength() == 0) + if(!aData.hasElements()) { aData.realloc(1); dst = aData.getArray(); diff --git a/connectivity/source/drivers/jdbc/tools.cxx b/connectivity/source/drivers/jdbc/tools.cxx index 29b68991b5f5..77265009d20b 100644 --- a/connectivity/source/drivers/jdbc/tools.cxx +++ b/connectivity/source/drivers/jdbc/tools.cxx @@ -183,7 +183,7 @@ jobject connectivity::convertTypeMapToJavaMap(const Reference< css::container::X if ( _rMap.is() ) { css::uno::Sequence< OUString > aNames = _rMap->getElementNames(); - if ( aNames.getLength() > 0 ) + if ( aNames.hasElements() ) ::dbtools::throwFeatureNotImplementedSQLException( "Type maps", nullptr ); } return nullptr; diff --git a/connectivity/source/drivers/odbc/OResultSet.cxx b/connectivity/source/drivers/odbc/OResultSet.cxx index 8b5d7b82e477..c9755e762140 100644 --- a/connectivity/source/drivers/odbc/OResultSet.cxx +++ b/connectivity/source/drivers/odbc/OResultSet.cxx @@ -1160,7 +1160,7 @@ Sequence<sal_Int8> OResultSet::impl_getBookmark( ) Sequence<sal_Int8> bookmark = OTools::getBytesValue(m_pStatement->getOwnConnection(),m_aStatementHandle,0,SQL_C_VARBOOKMARK,m_bWasNull,**this); m_aPosToBookmarks[bookmark] = m_nRowPos; - OSL_ENSURE(bookmark.getLength(),"Invalid bookmark from length 0!"); + OSL_ENSURE(bookmark.hasElements(),"Invalid bookmark from length 0!"); return bookmark; } else @@ -1177,8 +1177,8 @@ sal_Bool SAL_CALL OResultSet::moveToBookmark( const Any& bookmark ) invalidateCache(); Sequence<sal_Int8> aBookmark; bookmark >>= aBookmark; - OSL_ENSURE(aBookmark.getLength(),"Invalid bookmark from length 0!"); - if(aBookmark.getLength()) + OSL_ENSURE(aBookmark.hasElements(),"Invalid bookmark from length 0!"); + if(aBookmark.hasElements()) { SQLRETURN nReturn = setStmtOption<SQLLEN*, SQL_IS_POINTER>(SQL_ATTR_FETCH_BOOKMARK_PTR, reinterpret_cast<SQLLEN*>(aBookmark.getArray())); @@ -1708,7 +1708,7 @@ bool OResultSet::move(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nO ensureCacheForColumn(0); Sequence<sal_Int8> bookmark = OTools::getBytesValue(m_pStatement->getOwnConnection(),m_aStatementHandle,0,SQL_C_VARBOOKMARK,m_bWasNull,**this); m_aPosToBookmarks[bookmark] = m_nRowPos; - OSL_ENSURE(bookmark.getLength(),"Invalid bookmark from length 0!"); + OSL_ENSURE(bookmark.hasElements(),"Invalid bookmark from length 0!"); m_aRow[0] = bookmark; } m_aRow[0].setBound(true); diff --git a/connectivity/source/drivers/postgresql/pq_statement.cxx b/connectivity/source/drivers/postgresql/pq_statement.cxx index 7796cac8cc10..3f3e1c14a4fb 100644 --- a/connectivity/source/drivers/postgresql/pq_statement.cxx +++ b/connectivity/source/drivers/postgresql/pq_statement.cxx @@ -710,7 +710,7 @@ Reference< XResultSet > getGeneratedValuesFromLastInsert( // in postgresql doc Sequence< OUString > keyColumnNames = getPrimaryKeyColumnNames( connection, schemaName, tableName ); - if( keyColumnNames.getLength() ) + if( keyColumnNames.hasElements() ) { OUStringBuffer buf( 128 ); buf.append( "SELECT * FROM " ); |