summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-04-21 11:03:55 +0200
committerNoel Grandin <noel@peralex.com>2016-04-21 11:03:55 +0200
commite1af7f0c438bc242e4562aa0286c99787b5ad544 (patch)
tree29c7faa3556f33baa7eae5cd0aca3946afb8a560 /connectivity
parent8762aa986dbca42e61cc8fb1b2c1d2ca66bcfcbe (diff)
clang-tidy modernize-loop-convert in c*
Change-Id: I77d2548f8be97792660761e6156cd24734a95aaf
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/mork/MDatabaseMetaData.cxx21
-rw-r--r--connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx3
-rw-r--r--connectivity/source/drivers/mork/MResultSet.cxx6
-rw-r--r--connectivity/source/drivers/postgresql/pq_connection.cxx6
-rw-r--r--connectivity/source/drivers/postgresql/pq_preparedstatement.cxx7
-rw-r--r--connectivity/source/drivers/postgresql/pq_updateableresultset.cxx6
-rw-r--r--connectivity/source/parse/sqlnode.cxx8
7 files changed, 27 insertions, 30 deletions
diff --git a/connectivity/source/drivers/mork/MDatabaseMetaData.cxx b/connectivity/source/drivers/mork/MDatabaseMetaData.cxx
index 26b103ce5331..db1b65a6e22f 100644
--- a/connectivity/source/drivers/mork/MDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/mork/MDatabaseMetaData.cxx
@@ -109,14 +109,14 @@ ODatabaseMetaDataResultSet::ORows& SAL_CALL ODatabaseMetaData::getColumnRows(
aRow[18] = new ORowSetValueDecorator(OUString("YES"));
// Iterate over all tables
- for(size_t j = 0; j < tables.size(); j++ ) {
- if(match(tableNamePattern, tables[j],'\0')) {
+ for(OUString & table : tables) {
+ if(match(tableNamePattern, table,'\0')) {
// TABLE_NAME
- aRow[3] = new ORowSetValueDecorator( tables[j] );
+ aRow[3] = new ORowSetValueDecorator( table );
const OColumnAlias& colNames = m_pConnection->getColumnAlias();
- SAL_INFO("connectivity.mork", "\tTableName = : " << tables[j]);
+ SAL_INFO("connectivity.mork", "\tTableName = : " << table);
// Iterate over all collumns in the table.
for ( OColumnAlias::AliasMap::const_iterator compare = colNames.begin();
compare != colNames.end();
@@ -853,13 +853,12 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLE
Reference< XResultSet > xRef = pResult;
// here we fill the rows which should be visible when ask for data from the resultset returned here
- const sal_Int32 nSize = sizeof(sTableTypes) / sizeof(OUString);
ODatabaseMetaDataResultSet::ORows aRows;
- for(sal_Int32 i=0;i < nSize;++i)
+ for(const auto & sTableType : sTableTypes)
{
ODatabaseMetaDataResultSet::ORow aRow;
aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator(sTableTypes[i]));
+ aRow.push_back(new ORowSetValueDecorator(sTableType));
// bound row
aRows.push_back(aRow);
}
@@ -975,13 +974,13 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
// Iterate over all tables
- for(size_t j = 0; j < tables.size(); j++ ) {
- if(match(tableNamePattern, tables[j],'\0'))
+ for(OUString & table : tables) {
+ if(match(tableNamePattern, table,'\0'))
{
// TABLE_NAME
- aRow[2] = new ORowSetValueDecorator( tables[j] );
+ aRow[2] = new ORowSetValueDecorator( table );
- SAL_INFO("connectivity.mork", "\tTableName = : " << tables[j]);
+ SAL_INFO("connectivity.mork", "\tTableName = : " << table);
aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getSelectValue();
aRows.push_back(aRow);
diff --git a/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx b/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx
index 86e4f6555001..3ffb8004285e 100644
--- a/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx
+++ b/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx
@@ -96,10 +96,9 @@ bool MDatabaseMetaDataHelper::getTables( OConnection* _pCon,
if ( !getTableStrings( _pCon, tables ) )
return false;
- for ( size_t i = 0; i < tables.size(); i++ ) {
+ for (OUString& aTableName : tables) {
ODatabaseMetaDataResultSet::ORow aRow { nullptr, nullptr, nullptr };
- OUString aTableName = tables[i];
SAL_INFO("connectivity.mork", "TableName: " << aTableName );
diff --git a/connectivity/source/drivers/mork/MResultSet.cxx b/connectivity/source/drivers/mork/MResultSet.cxx
index e84eacd891e8..10b2be9c1e98 100644
--- a/connectivity/source/drivers/mork/MResultSet.cxx
+++ b/connectivity/source/drivers/mork/MResultSet.cxx
@@ -1248,12 +1248,12 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep
{
OValueRow aSearchRow = new OValueVector( m_aRow->get().size() );
- for( OKeySet::Vector::size_type i = 0; i < m_pKeySet->get().size(); i++ )
+ for(sal_Int32 i : m_pKeySet->get())
{
- fetchRow( (m_pKeySet->get())[i] ); // Fills m_aRow
+ fetchRow( i ); // Fills m_aRow
if ( matchRow( m_aRow, aSearchRow ) )
{
- (m_pKeySet->get())[i] = 0; // Marker for later to be removed
+ i = 0; // Marker for later to be removed
}
else
{
diff --git a/connectivity/source/drivers/postgresql/pq_connection.cxx b/connectivity/source/drivers/postgresql/pq_connection.cxx
index 8d1d3b23568e..ebe1aaac52f2 100644
--- a/connectivity/source/drivers/postgresql/pq_connection.cxx
+++ b/connectivity/source/drivers/postgresql/pq_connection.cxx
@@ -465,11 +465,11 @@ static void properties2arrays( const Sequence< PropertyValue > & args,
for( int i = 0; i < args.getLength() ; ++i )
{
bool append = false;
- for( size_t j = 0; j < SAL_N_ELEMENTS( keyword_list ); j++)
+ for(const char* j : keyword_list)
{
- if( args[i].Name.equalsIgnoreAsciiCaseAscii( keyword_list[j] ))
+ if( args[i].Name.equalsIgnoreAsciiCaseAscii( j ))
{
- keywords.push_back( keyword_list[j], SAL_NO_ACQUIRE );
+ keywords.push_back( j, SAL_NO_ACQUIRE );
append = true;
break;
}
diff --git a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
index fe2c200752d3..15c9b1e99509 100644
--- a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
@@ -180,9 +180,8 @@ PreparedStatement::PreparedStatement(
splitSQL( m_stmt, m_splittedStatement );
int elements = 0;
- for( int i = 0, max = m_splittedStatement.size(); i < max ; i ++ )
+ for(OString & str : m_splittedStatement)
{
- const OString &str = m_splittedStatement[i];
// ignore quoted strings ....
if( ! isQuoted( str ) )
{
@@ -329,13 +328,13 @@ sal_Bool PreparedStatement::execute( )
OStringBuffer buf( m_stmt.getLength() *2 );
OStringVector::size_type vars = 0;
- for( OStringVector::size_type i = 0 ; i < m_splittedStatement.size() ; ++i )
+ for(OString & str : m_splittedStatement)
{
// LEM TODO: instead of this manual mucking with SQL
// could we use PQexecParams / PQExecPrepared / ...?
// Only snafu is giving the types of the parameters and
// that it needs $1, $2, etc instead of "?"
- const OString &str = m_splittedStatement[i];
+
// printf( "Splitted %d %s\n" , i , str.getStr() );
if( isQuoted( str ) )
{
diff --git a/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx b/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx
index ab2b83b5064f..5934f94fa228 100644
--- a/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx
+++ b/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx
@@ -226,14 +226,14 @@ void UpdateableResultSet::insertRow( ) throw (SQLException, RuntimeException, s
buf.append( " ) VALUES ( " );
columns = 0;
- for( UpdateableFieldVector::size_type i = 0 ; i < m_updateableField.size() ; i ++ )
+ for(UpdateableField & i : m_updateableField)
{
- if( m_updateableField[i].isTouched )
+ if( i.isTouched )
{
if( columns > 0 )
buf.append( " , " );
columns ++;
- bufferQuoteAnyConstant( buf, m_updateableField[i].value, *m_ppSettings );
+ bufferQuoteAnyConstant( buf, i.value, *m_ppSettings );
// OUString val;
// m_updateableField[i].value >>= val;
diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index 72862fd619b6..61d4b5fa5ef0 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -1444,14 +1444,14 @@ OSQLParser::OSQLParser(const ::com::sun::star::uno::Reference< ::com::sun::star:
// +1 for UNKNOWN_RULE
static_assert(nRuleMapCount + 1 == static_cast<size_t>(OSQLParseNode::rule_count), "must be equal");
- for ( size_t mapEntry = 0; mapEntry < nRuleMapCount; ++mapEntry )
+ for (const auto & aRuleDescription : aRuleDescriptions)
{
// look up the rule description in the our identifier map
- sal_uInt32 nParserRuleID = StrToRuleID( aRuleDescriptions[ mapEntry ].sRuleName );
+ sal_uInt32 nParserRuleID = StrToRuleID( aRuleDescription.sRuleName );
// map the parser's rule ID to the OSQLParseNode::Rule
- s_aReverseRuleIDLookup[ nParserRuleID ] = aRuleDescriptions[ mapEntry ].eRule;
+ s_aReverseRuleIDLookup[ nParserRuleID ] = aRuleDescription.eRule;
// and map the OSQLParseNode::Rule to the parser's rule ID
- s_nRuleIDs[ aRuleDescriptions[ mapEntry ].eRule ] = nParserRuleID;
+ s_nRuleIDs[ aRuleDescription.eRule ] = nParserRuleID;
}
}
++s_nRefCount;