summaryrefslogtreecommitdiffstats
path: root/connectivity/source
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2018-01-25 19:05:11 +0100
committerJulien Nabet <serval2412@yahoo.fr>2018-01-26 09:07:59 +0100
commit199b307be547405fc32ed29e23e6aa9bb81ce398 (patch)
tree82834ea393ea8b8fd23e33c989a86e913431e46a /connectivity/source
parentFix typos (diff)
downloadcore-199b307be547405fc32ed29e23e6aa9bb81ce398.tar.gz
core-199b307be547405fc32ed29e23e6aa9bb81ce398.zip
Modernize a bit connectivity (part1)
by using for range loops + use returned iterator by erase call in ZConnectionPool Change-Id: I97b14b24ebddefea909bc17cb3463f840fde38a0 Reviewed-on: https://gerrit.libreoffice.org/48634 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'connectivity/source')
-rw-r--r--connectivity/source/commontools/TConnection.cxx4
-rw-r--r--connectivity/source/commontools/TSortIndex.cxx14
-rw-r--r--connectivity/source/commontools/parameters.cxx67
-rw-r--r--connectivity/source/cpool/ZConnectionPool.cxx4
-rw-r--r--connectivity/source/drivers/dbase/DTable.cxx4
-rw-r--r--connectivity/source/drivers/file/FDriver.cxx8
-rw-r--r--connectivity/source/drivers/file/FNoException.cxx11
-rw-r--r--connectivity/source/drivers/file/FPreparedStatement.cxx5
-rw-r--r--connectivity/source/drivers/file/FResultSet.cxx11
-rw-r--r--connectivity/source/drivers/file/fanalyzer.cxx39
-rw-r--r--connectivity/source/drivers/file/fcomp.cxx18
-rw-r--r--connectivity/source/drivers/firebird/Connection.cxx4
-rw-r--r--connectivity/source/drivers/firebird/Driver.cxx4
-rw-r--r--connectivity/source/drivers/flat/ETable.cxx4
14 files changed, 88 insertions, 109 deletions
diff --git a/connectivity/source/commontools/TConnection.cxx b/connectivity/source/commontools/TConnection.cxx
index 3a7705bd75fb..779ea853520f 100644
--- a/connectivity/source/commontools/TConnection.cxx
+++ b/connectivity/source/commontools/TConnection.cxx
@@ -41,11 +41,11 @@ void OMetaConnection::disposing()
{
::osl::MutexGuard aGuard(m_aMutex);
m_xMetaData = WeakReference< XDatabaseMetaData>();
- for (OWeakRefArray::iterator i = m_aStatements.begin(); m_aStatements.end() != i; ++i)
+ for (auto const& statement : m_aStatements)
{
try
{
- Reference< XInterface > xStatement( i->get() );
+ Reference< XInterface > xStatement( statement.get() );
::comphelper::disposeComponent( xStatement );
}
catch (const DisposedException&)
diff --git a/connectivity/source/commontools/TSortIndex.cxx b/connectivity/source/commontools/TSortIndex.cxx
index 748350121c66..63e5037a7279 100644
--- a/connectivity/source/commontools/TSortIndex.cxx
+++ b/connectivity/source/commontools/TSortIndex.cxx
@@ -36,14 +36,14 @@ struct TKeyValueFunc
bool operator()(const OSortIndex::TIntValuePairVector::value_type& lhs,const OSortIndex::TIntValuePairVector::value_type& rhs) const
{
const std::vector<OKeyType>& aKeyType = pIndex->getKeyType();
- std::vector<OKeyType>::const_iterator aIter = aKeyType.begin();
- for (std::vector<sal_Int16>::size_type i=0;aIter != aKeyType.end(); ++aIter,++i)
+ size_t i = 0;
+ for (auto const& elem : aKeyType)
{
const bool bGreater = pIndex->getAscending(i) != TAscendingOrder::ASC;
const bool bLess = !bGreater;
// compare depending for type
- switch (*aIter)
+ switch (elem)
{
case OKeyType::String:
{
@@ -68,6 +68,7 @@ struct TKeyValueFunc
case OKeyType::NONE:
break;
}
+ ++i;
}
// know we know that the values are equal
@@ -122,11 +123,10 @@ void OSortIndex::Freeze()
// we will sort ourself when the first keyType say so
std::sort(m_aKeyValues.begin(),m_aKeyValues.end(),TKeyValueFunc(this));
- TIntValuePairVector::iterator aIter = m_aKeyValues.begin();
- for(;aIter != m_aKeyValues.end();++aIter)
+ for (auto & keyValue : m_aKeyValues)
{
- delete aIter->second;
- aIter->second = nullptr;
+ delete keyValue.second;
+ keyValue.second = nullptr;
}
m_bFrozen = true;
diff --git a/connectivity/source/commontools/parameters.cxx b/connectivity/source/commontools/parameters.cxx
index 10d445d0e8c5..4fc69a8018d3 100644
--- a/connectivity/source/commontools/parameters.cxx
+++ b/connectivity/source/commontools/parameters.cxx
@@ -163,12 +163,9 @@ namespace dbtools
// strip previous index information
if ( _bSecondRun )
{
- for ( ParameterInformation::iterator aParamInfo = m_aParameterInformation.begin();
- aParamInfo != m_aParameterInformation.end();
- ++aParamInfo
- )
+ for (auto & paramInfo : m_aParameterInformation)
{
- aParamInfo->second.aInnerIndexes.clear();
+ paramInfo.second.aInnerIndexes.clear();
}
}
@@ -394,16 +391,13 @@ namespace dbtools
{
// build a conjunction of all the filter components
OUStringBuffer sAdditionalFilter;
- for ( std::vector< OUString >::const_iterator aComponent = aAdditionalFilterComponents.begin();
- aComponent != aAdditionalFilterComponents.end();
- ++aComponent
- )
+ for (auto const& elem : aAdditionalFilterComponents)
{
if ( !sAdditionalFilter.isEmpty() )
sAdditionalFilter.append(" AND ");
sAdditionalFilter.append("( ");
- sAdditionalFilter.append(*aComponent);
+ sAdditionalFilter.append(elem);
sAdditionalFilter.append(" )");
}
@@ -417,16 +411,13 @@ namespace dbtools
{
// build a conjunction of all the filter components
OUStringBuffer sAdditionalHaving;
- for ( std::vector< OUString >::const_iterator aComponent = aAdditionalHavingComponents.begin();
- aComponent != aAdditionalHavingComponents.end();
- ++aComponent
- )
+ for (auto const& elem : aAdditionalHavingComponents)
{
if ( !sAdditionalHaving.isEmpty() )
sAdditionalHaving.append(" AND ");
sAdditionalHaving.append("( ");
- sAdditionalHaving.append(*aComponent);
+ sAdditionalHaving.append(elem);
sAdditionalHaving.append(" )");
}
@@ -456,49 +447,43 @@ namespace dbtools
sal_Int32 nSmallestIndexLinkedByColumnName = -1;
sal_Int32 nLargestIndexNotLinkedByColumnName = -1;
#endif
- for ( ParameterInformation::iterator aParam = m_aParameterInformation.begin();
- aParam != m_aParameterInformation.end();
- ++aParam
- )
+ for (auto & aParam : m_aParameterInformation)
{
#if OSL_DEBUG_LEVEL > 0
- if ( aParam->second.aInnerIndexes.size() )
+ if ( aParam.second.aInnerIndexes.size() )
{
- if ( aParam->second.eType == ParameterClassification::LinkedByColumnName )
+ if ( aParam.second.eType == ParameterClassification::LinkedByColumnName )
{
if ( nSmallestIndexLinkedByColumnName == -1 )
- nSmallestIndexLinkedByColumnName = aParam->second.aInnerIndexes[ 0 ];
+ nSmallestIndexLinkedByColumnName = aParam.second.aInnerIndexes[ 0 ];
}
else
{
- nLargestIndexNotLinkedByColumnName = aParam->second.aInnerIndexes[ aParam->second.aInnerIndexes.size() - 1 ];
+ nLargestIndexNotLinkedByColumnName = aParam.second.aInnerIndexes[ aParam.second.aInnerIndexes.size() - 1 ];
}
}
#endif
- if ( aParam->second.eType != ParameterClassification::FilledExternally )
+ if ( aParam.second.eType != ParameterClassification::FilledExternally )
continue;
// check which of the parameters have already been visited (e.g. filled via XParameters)
size_t nAlreadyVisited = 0;
- for ( std::vector< sal_Int32 >::iterator aIndex = aParam->second.aInnerIndexes.begin();
- aIndex != aParam->second.aInnerIndexes.end();
- ++aIndex
- )
+ for (auto & aIndex : aParam.second.aInnerIndexes)
{
- if ( ( m_aParametersVisited.size() > static_cast<size_t>(*aIndex) ) && m_aParametersVisited[ *aIndex ] )
+ if ( ( m_aParametersVisited.size() > static_cast<size_t>(aIndex) ) && m_aParametersVisited[ aIndex ] )
{ // exclude this index
- *aIndex = -1;
+ aIndex = -1;
++nAlreadyVisited;
}
}
- if ( nAlreadyVisited == aParam->second.aInnerIndexes.size() )
+ if ( nAlreadyVisited == aParam.second.aInnerIndexes.size() )
continue;
// need a wrapper for this .... the "inner parameters" as supplied by a result set don't have a "Value"
// property, but the parameter listeners expect such a property. So we need an object "aggregating"
// xParam and supplying an additional property ("Value")
// (it's no real aggregation of course ...)
- m_pOuterParameters->push_back( new param::ParameterWrapper( aParam->second.xComposerColumn, m_xInnerParamUpdate, aParam->second.aInnerIndexes ) );
+ m_pOuterParameters->push_back( new param::ParameterWrapper( aParam.second.xComposerColumn, m_xInnerParamUpdate, aParam.second.aInnerIndexes ) );
}
#if OSL_DEBUG_LEVEL > 0
@@ -613,13 +598,10 @@ namespace dbtools
Reference< XPropertySet > xMasterField(_rxParentColumns->getByName( *pMasterFields ),UNO_QUERY);
// the positions where we have to fill in values for the current parameter name
- for ( std::vector< sal_Int32 >::const_iterator aPosition = aParamInfo->second.aInnerIndexes.begin();
- aPosition != aParamInfo->second.aInnerIndexes.end();
- ++aPosition
- )
+ for (auto const& aPosition : aParamInfo->second.aInnerIndexes)
{
// the concrete detail field
- Reference< XPropertySet > xDetailField(m_xInnerParamColumns->getByIndex( *aPosition ),UNO_QUERY);
+ Reference< XPropertySet > xDetailField(m_xInnerParamColumns->getByIndex(aPosition),UNO_QUERY);
OSL_ENSURE( xDetailField.is(), "ParameterManager::fillLinkedParameters: invalid detail field!" );
if ( !xDetailField.is() )
continue;
@@ -636,7 +618,7 @@ namespace dbtools
try
{
m_xInnerParamUpdate->setObjectWithInfo(
- *aPosition + 1, // parameters are based at 1
+ aPosition + 1, // parameters are based at 1
xMasterField->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_VALUE) ),
nParamType,
nScale
@@ -646,7 +628,7 @@ namespace dbtools
{
DBG_UNHANDLED_EXCEPTION();
SAL_WARN( "connectivity.commontools", "ParameterManager::fillLinkedParameters: master-detail parameter number " <<
- sal_Int32( *aPosition + 1 ) << " could not be filled!" );
+ sal_Int32( aPosition + 1 ) << " could not be filled!" );
}
}
}
@@ -940,13 +922,10 @@ namespace dbtools
if ( !xMasterField.is() )
continue;
- for ( std::vector< sal_Int32 >::const_iterator aPosition = aParamInfo->second.aInnerIndexes.begin();
- aPosition != aParamInfo->second.aInnerIndexes.end();
- ++aPosition
- )
+ for (auto const& aPosition : aParamInfo->second.aInnerIndexes)
{
Reference< XPropertySet > xInnerParameter;
- m_xInnerParamColumns->getByIndex( *aPosition ) >>= xInnerParameter;
+ m_xInnerParamColumns->getByIndex(aPosition) >>= xInnerParameter;
if ( !xInnerParameter.is() )
continue;
diff --git a/connectivity/source/cpool/ZConnectionPool.cxx b/connectivity/source/cpool/ZConnectionPool.cxx
index 2a0609ed58e1..672ba58d8086 100644
--- a/connectivity/source/cpool/ZConnectionPool.cxx
+++ b/connectivity/source/cpool/ZConnectionPool.cxx
@@ -247,9 +247,7 @@ void OConnectionPool::invalidatePooledConnections()
}
if(aActIter == m_aActiveConnections.end())
{// he isn't so we can delete him
- TConnectionMap::iterator aDeleteIter = aIter;
- ++aIter;
- m_aPool.erase(aDeleteIter);
+ aIter = m_aPool.erase(aIter);
}
else
++aIter;
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index 5b7b60915531..75c79b6c4bfd 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -642,8 +642,8 @@ void ODbaseTable::refreshColumns()
::std::vector< OUString> aVector;
aVector.reserve(m_aColumns->get().size());
- for(OSQLColumns::Vector::const_iterator aIter = m_aColumns->get().begin();aIter != m_aColumns->get().end();++aIter)
- aVector.push_back(Reference< XNamed>(*aIter,UNO_QUERY)->getName());
+ for (auto const& column : m_aColumns->get())
+ aVector.push_back(Reference< XNamed>(column,UNO_QUERY)->getName());
if(m_pColumns)
m_pColumns->reFill(aVector);
diff --git a/connectivity/source/drivers/file/FDriver.cxx b/connectivity/source/drivers/file/FDriver.cxx
index 33a1f447d07e..29a295757373 100644
--- a/connectivity/source/drivers/file/FDriver.cxx
+++ b/connectivity/source/drivers/file/FDriver.cxx
@@ -47,9 +47,9 @@ void OFileDriver::disposing()
::osl::MutexGuard aGuard(m_aMutex);
- for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i)
+ for (auto const& connection : m_xConnections)
{
- Reference< XComponent > xComp(i->get(), UNO_QUERY);
+ Reference< XComponent > xComp(connection.get(), UNO_QUERY);
if (xComp.is())
xComp->dispose();
}
@@ -194,9 +194,9 @@ Reference< XTablesSupplier > SAL_CALL OFileDriver::getDataDefinitionByConnection
{
OConnection* pSearchConnection = reinterpret_cast< OConnection* >( xTunnel->getSomething(OConnection::getUnoTunnelImplementationId()) );
OConnection* pConnection = nullptr;
- for (OWeakRefArray::const_iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i)
+ for (auto const& elem : m_xConnections)
{
- if (static_cast<OConnection*>( Reference< XConnection >::query(i->get().get()).get() ) == pSearchConnection)
+ if (static_cast<OConnection*>( Reference< XConnection >::query(elem.get().get()).get() ) == pSearchConnection)
{
pConnection = pSearchConnection;
break;
diff --git a/connectivity/source/drivers/file/FNoException.cxx b/connectivity/source/drivers/file/FNoException.cxx
index fbf639d47aa2..bc87c7d0535f 100644
--- a/connectivity/source/drivers/file/FNoException.cxx
+++ b/connectivity/source/drivers/file/FNoException.cxx
@@ -59,9 +59,9 @@ void OPredicateCompiler::Clean()
void OSQLAnalyzer::bindParameterRow(OValueRefRow const & _pRow)
{
OCodeList& rCodeList = m_aCompiler->m_aCodeList;
- for(OCodeList::iterator aIter = rCodeList.begin(); aIter != rCodeList.end();++aIter)
+ for (auto const& code : rCodeList)
{
- OOperandParam* pParam = dynamic_cast<OOperandParam*>(*aIter);
+ OOperandParam* pParam = dynamic_cast<OOperandParam*>(code);
if ( pParam )
pParam->bindValue(_pRow);
}
@@ -93,11 +93,10 @@ OKeyValue* OResultSet::GetOrderbyKeyValue(OValueRefRow const & _rRow)
OKeyValue* pKeyValue = OKeyValue::createKeyValue(nBookmarkValue);
- std::vector<sal_Int32>::const_iterator aIter = m_aOrderbyColumnNumber.begin();
- for (;aIter != m_aOrderbyColumnNumber.end(); ++aIter)
+ for (auto const& elem : m_aOrderbyColumnNumber)
{
- OSL_ENSURE(*aIter < static_cast<sal_Int32>(_rRow->get().size()),"Invalid index for orderkey values!");
- pKeyValue->pushKey(new ORowSetValueDecorator((_rRow->get())[*aIter]->getValue()));
+ OSL_ENSURE(elem < static_cast<sal_Int32>(_rRow->get().size()),"Invalid index for orderkey values!");
+ pKeyValue->pushKey(new ORowSetValueDecorator((_rRow->get())[elem]->getValue()));
}
return pKeyValue;
diff --git a/connectivity/source/drivers/file/FPreparedStatement.cxx b/connectivity/source/drivers/file/FPreparedStatement.cxx
index 3de5465b29a5..ff71807d1bf4 100644
--- a/connectivity/source/drivers/file/FPreparedStatement.cxx
+++ b/connectivity/source/drivers/file/FPreparedStatement.cxx
@@ -491,10 +491,9 @@ void OPreparedStatement::describeParameter()
if( !rTabs.empty() )
{
OSQLTable xTable = rTabs.begin()->second;
- std::vector< OSQLParseNode*>::const_iterator aIter = aParseNodes.begin();
- for (;aIter != aParseNodes.end();++aIter )
+ for (auto const& parseNode : aParseNodes)
{
- describeColumn(*aIter,(*aIter)->getParent()->getChild(0),xTable);
+ describeColumn(parseNode,parseNode->getParent()->getChild(0),xTable);
}
}
}
diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx
index 079295402cee..2b52192250a3 100644
--- a/connectivity/source/drivers/file/FResultSet.cxx
+++ b/connectivity/source/drivers/file/FResultSet.cxx
@@ -1111,11 +1111,11 @@ void OResultSet::sortRows()
}
OSortIndex::TKeyTypeVector eKeyType(m_aOrderbyColumnNumber.size());
- std::vector<sal_Int32>::const_iterator aOrderByIter = m_aOrderbyColumnNumber.begin();
- for (std::vector<sal_Int16>::size_type i=0;aOrderByIter != m_aOrderbyColumnNumber.end(); ++aOrderByIter,++i)
+ size_t i = 0;
+ for (auto const& elem : m_aOrderbyColumnNumber)
{
- OSL_ENSURE(static_cast<sal_Int32>(m_aSelectRow->get().size()) > *aOrderByIter,"Invalid Index");
- switch ((*(m_aSelectRow->get().begin()+*aOrderByIter))->getValue().getTypeKind())
+ OSL_ENSURE(static_cast<sal_Int32>(m_aSelectRow->get().size()) > elem,"Invalid Index");
+ switch ((*(m_aSelectRow->get().begin()+elem))->getValue().getTypeKind())
{
case DataType::CHAR:
case DataType::VARCHAR:
@@ -1144,7 +1144,8 @@ void OResultSet::sortRows()
SAL_WARN( "connectivity.drivers","OFILECursor::Execute: Data type not implemented");
break;
}
- (m_aSelectRow->get())[*aOrderByIter]->setBound(true);
+ (m_aSelectRow->get())[elem]->setBound(true);
+ ++i;
}
m_pSortIndex = new OSortIndex(eKeyType,m_aOrderbyAscending);
diff --git a/connectivity/source/drivers/file/fanalyzer.cxx b/connectivity/source/drivers/file/fanalyzer.cxx
index 74a433d0adbe..a700f3511046 100644
--- a/connectivity/source/drivers/file/fanalyzer.cxx
+++ b/connectivity/source/drivers/file/fanalyzer.cxx
@@ -118,9 +118,9 @@ void OSQLAnalyzer::start(OSQLParseNode const * pSQLParseNode)
void OSQLAnalyzer::bindRow(OCodeList& rCodeList,const OValueRefRow& _pRow)
{
- for (OCodeList::iterator aIter = rCodeList.begin(); aIter != rCodeList.end(); ++aIter)
+ for (auto const& code : rCodeList)
{
- OOperandAttr* pAttr = dynamic_cast<OOperandAttr*>(*aIter);
+ OOperandAttr* pAttr = dynamic_cast<OOperandAttr*>(code);
if (pAttr)
{
pAttr->bindValue(_pRow);
@@ -131,10 +131,10 @@ void OSQLAnalyzer::bindRow(OCodeList& rCodeList,const OValueRefRow& _pRow)
void OSQLAnalyzer::bindSelectRow(const OValueRefRow& _pRow)
{
// first the select part
- for ( std::vector< TPredicates >::const_iterator aIter = m_aSelectionEvaluations.begin(); aIter != m_aSelectionEvaluations.end();++aIter)
+ for (auto const& selectionEval : m_aSelectionEvaluations)
{
- if ( aIter->first.is() )
- bindRow(aIter->first->m_aCodeList,_pRow);
+ if ( selectionEval.first.is() )
+ bindRow(selectionEval.first->m_aCodeList,_pRow);
}
}
@@ -159,10 +159,14 @@ bool OSQLAnalyzer::hasFunctions() const
if ( m_bSelectionFirstTime )
{
m_bSelectionFirstTime = false;
- for ( std::vector< TPredicates >::const_iterator aIter = m_aSelectionEvaluations.begin(); aIter != m_aSelectionEvaluations.end() && !m_bHasSelectionCode ;++aIter)
+ for (auto const& selectionEval : m_aSelectionEvaluations)
{
- if ( aIter->first.is() )
- m_bHasSelectionCode = aIter->first->hasCode();
+ if ( selectionEval.first.is() )
+ {
+ m_bHasSelectionCode = selectionEval.first->hasCode();
+ if (m_bHasSelectionCode)
+ break;
+ }
}
}
return m_bHasSelectionCode;
@@ -171,37 +175,38 @@ bool OSQLAnalyzer::hasFunctions() const
void OSQLAnalyzer::setSelectionEvaluationResult(OValueRefRow const & _pRow,const std::vector<sal_Int32>& _rColumnMapping)
{
sal_Int32 nPos = 1;
- for ( std::vector< TPredicates >::iterator aIter = m_aSelectionEvaluations.begin(); aIter != m_aSelectionEvaluations.end();++aIter,++nPos)
+ for (auto const& selectionEval : m_aSelectionEvaluations)
{
- if ( aIter->second.is() )
+ if ( selectionEval.second.is() )
{
// the first column (index 0) is for convenience only. The first real select column is no 1.
sal_Int32 map = nPos;
if ( nPos < static_cast< sal_Int32 >( _rColumnMapping.size() ) )
map = _rColumnMapping[nPos];
if ( map > 0 )
- aIter->second->startSelection( (_pRow->get())[map] );
+ selectionEval.second->startSelection( (_pRow->get())[map] );
}
+ ++nPos;
}
}
void OSQLAnalyzer::dispose()
{
m_aCompiler->dispose();
- for ( std::vector< TPredicates >::iterator aIter = m_aSelectionEvaluations.begin(); aIter != m_aSelectionEvaluations.end();++aIter)
+ for (auto const& selectionEval : m_aSelectionEvaluations)
{
- if ( aIter->first.is() )
- aIter->first->dispose();
+ if ( selectionEval.first.is() )
+ selectionEval.first->dispose();
}
}
void OSQLAnalyzer::setOrigColumns(const css::uno::Reference< css::container::XNameAccess>& rCols)
{
m_aCompiler->setOrigColumns(rCols);
- for ( std::vector< TPredicates >::iterator aIter = m_aSelectionEvaluations.begin(); aIter != m_aSelectionEvaluations.end();++aIter)
+ for (auto const& selectionEval : m_aSelectionEvaluations)
{
- if ( aIter->first.is() )
- aIter->first->setOrigColumns(rCols);
+ if ( selectionEval.first.is() )
+ selectionEval.first->setOrigColumns(rCols);
}
}
diff --git a/connectivity/source/drivers/file/fcomp.cxx b/connectivity/source/drivers/file/fcomp.cxx
index d04e3f1e1c63..ec6f1622f94a 100644
--- a/connectivity/source/drivers/file/fcomp.cxx
+++ b/connectivity/source/drivers/file/fcomp.cxx
@@ -536,17 +536,16 @@ bool OPredicateInterpreter::evaluate(OCodeList& rCodeList)
{
static bool bResult;
- OCodeList::iterator aIter = rCodeList.begin();
- if (!(*aIter))
+ if (!(rCodeList[0]))
return true; // no Predicate
- for(;aIter != rCodeList.end();++aIter)
+ for (auto const& code : rCodeList)
{
- OOperand* pOperand = dynamic_cast<OOperand* >(*aIter);
+ OOperand* pOperand = dynamic_cast<OOperand* >(code);
if (pOperand)
m_aStack.push(pOperand);
else
- static_cast<OOperator *>(*aIter)->Exec(m_aStack);
+ static_cast<OOperator *>(code)->Exec(m_aStack);
}
OOperand* pOperand = m_aStack.top();
@@ -563,17 +562,16 @@ bool OPredicateInterpreter::evaluate(OCodeList& rCodeList)
void OPredicateInterpreter::evaluateSelection(OCodeList& rCodeList, ORowSetValueDecoratorRef const & _rVal)
{
- OCodeList::iterator aIter = rCodeList.begin();
- if (!(*aIter))
+ if (!(rCodeList[0]))
return ; // no Predicate
- for(;aIter != rCodeList.end();++aIter)
+ for (auto const& code : rCodeList)
{
- OOperand* pOperand = dynamic_cast<OOperand* >(*aIter);
+ OOperand* pOperand = dynamic_cast<OOperand* >(code);
if (pOperand)
m_aStack.push(pOperand);
else
- static_cast<OOperator *>(*aIter)->Exec(m_aStack);
+ static_cast<OOperator *>(code)->Exec(m_aStack);
}
OOperand* pOperand = m_aStack.top();
diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx
index 4ae13ad6beae..5316895c3679 100644
--- a/connectivity/source/drivers/firebird/Connection.cxx
+++ b/connectivity/source/drivers/firebird/Connection.cxx
@@ -942,9 +942,9 @@ void Connection::disposing()
void Connection::disposeStatements()
{
MutexGuard aGuard(m_aMutex);
- for (OWeakRefArray::iterator i = m_aStatements.begin(); m_aStatements.end() != i; ++i)
+ for (auto const& statement : m_aStatements)
{
- Reference< XComponent > xComp(i->get(), UNO_QUERY);
+ Reference< XComponent > xComp(statement.get(), UNO_QUERY);
if (xComp.is())
xComp->dispose();
}
diff --git a/connectivity/source/drivers/firebird/Driver.cxx b/connectivity/source/drivers/firebird/Driver.cxx
index b3b129d3fbe2..398435163b6e 100644
--- a/connectivity/source/drivers/firebird/Driver.cxx
+++ b/connectivity/source/drivers/firebird/Driver.cxx
@@ -118,9 +118,9 @@ void FirebirdDriver::disposing()
{
MutexGuard aGuard(m_aMutex);
- for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i)
+ for (auto const& elem : m_xConnections)
{
- Reference< XComponent > xComp(i->get(), UNO_QUERY);
+ Reference< XComponent > xComp(elem.get(), UNO_QUERY);
if (xComp.is())
xComp->dispose();
}
diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx
index 829f1e43854f..9801a37e4516 100644
--- a/connectivity/source/drivers/flat/ETable.cxx
+++ b/connectivity/source/drivers/flat/ETable.cxx
@@ -498,8 +498,8 @@ void OFlatTable::refreshColumns()
::std::vector< OUString> aVector;
aVector.reserve(m_aColumns->get().size());
- for(OSQLColumns::Vector::const_iterator aIter = m_aColumns->get().begin();aIter != m_aColumns->get().end();++aIter)
- aVector.push_back(Reference< XNamed>(*aIter,UNO_QUERY)->getName());
+ for (auto const& column : m_aColumns->get())
+ aVector.push_back(Reference< XNamed>(column,UNO_QUERY)->getName());
if(m_pColumns)
m_pColumns->reFill(aVector);