loplugin:sequenceloop in scaddins..scripting

Change-Id: I25044332e107b630b257e48d95ee9272145ed344
Reviewed-on: https://gerrit.libreoffice.org/77524
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2019-08-15 12:53:34 +02:00
parent 16d7e22d78
commit f23f9d38db
9 changed files with 17 additions and 17 deletions

View File

@@ -1481,7 +1481,7 @@ void SortedIndividualInt32List::InsertHolidayList(
if( !(rHolAny >>= aAnySeq) ) if( !(rHolAny >>= aAnySeq) )
throw lang::IllegalArgumentException(); throw lang::IllegalArgumentException();
for( const uno::Sequence< uno::Any >& rSubSeq : aAnySeq ) for( const uno::Sequence< uno::Any >& rSubSeq : std::as_const(aAnySeq) )
{ {
for( const uno::Any& rAny : rSubSeq ) for( const uno::Any& rAny : rSubSeq )
InsertHolidayList( rAnyConv, rAny, nNullDate, false/*bInsertOnWeekend*/ ); InsertHolidayList( rAnyConv, rAny, nNullDate, false/*bInsertOnWeekend*/ );
@@ -2036,7 +2036,7 @@ void ComplexList::Append( const uno::Sequence< uno::Any >& aMultPars )
if( !(r >>= aValArr) ) if( !(r >>= aValArr) )
throw lang::IllegalArgumentException(); throw lang::IllegalArgumentException();
for( const uno::Sequence< uno::Any >& rArr : aValArr ) for( const uno::Sequence< uno::Any >& rArr : std::as_const(aValArr) )
Append( rArr ); Append( rArr );
} }
break; break;

View File

@@ -72,7 +72,7 @@ void SAL_CALL CoinMPSolver::solve()
ScSolverCellHashMap aCellsHash; ScSolverCellHashMap aCellsHash;
aCellsHash[maObjective].reserve( nVariables + 1 ); // objective function aCellsHash[maObjective].reserve( nVariables + 1 ); // objective function
for (const auto& rConstr : maConstraints) for (const auto& rConstr : std::as_const(maConstraints))
{ {
table::CellAddress aCellAddr = rConstr.Left; table::CellAddress aCellAddr = rConstr.Left;
aCellsHash[aCellAddr].reserve( nVariables + 1 ); // constraints: left hand side aCellsHash[aCellAddr].reserve( nVariables + 1 ); // constraints: left hand side
@@ -255,7 +255,7 @@ void SAL_CALL CoinMPSolver::solve()
// apply single-var integer constraints // apply single-var integer constraints
for (const auto& rConstr : maConstraints) for (const auto& rConstr : std::as_const(maConstraints))
{ {
sheet::SolverConstraintOperator eOp = rConstr.Operator; sheet::SolverConstraintOperator eOp = rConstr.Operator;
if ( eOp == sheet::SolverConstraintOperator_INTEGER || if ( eOp == sheet::SolverConstraintOperator_INTEGER ||

View File

@@ -107,7 +107,7 @@ void SAL_CALL LpsolveSolver::solve()
ScSolverCellHashMap aCellsHash; ScSolverCellHashMap aCellsHash;
aCellsHash[maObjective].reserve( nVariables + 1 ); // objective function aCellsHash[maObjective].reserve( nVariables + 1 ); // objective function
for (const auto& rConstr : maConstraints) for (const auto& rConstr : std::as_const(maConstraints))
{ {
table::CellAddress aCellAddr = rConstr.Left; table::CellAddress aCellAddr = rConstr.Left;
aCellsHash[aCellAddr].reserve( nVariables + 1 ); // constraints: left hand side aCellsHash[aCellAddr].reserve( nVariables + 1 ); // constraints: left hand side
@@ -192,7 +192,7 @@ void SAL_CALL LpsolveSolver::solve()
set_add_rowmode(lp, TRUE); set_add_rowmode(lp, TRUE);
for (const auto& rConstr : maConstraints) for (const auto& rConstr : std::as_const(maConstraints))
{ {
// integer constraints are set later // integer constraints are set later
sheet::SolverConstraintOperator eOp = rConstr.Operator; sheet::SolverConstraintOperator eOp = rConstr.Operator;
@@ -260,7 +260,7 @@ void SAL_CALL LpsolveSolver::solve()
// apply single-var integer constraints // apply single-var integer constraints
for (const auto& rConstr : maConstraints) for (const auto& rConstr : std::as_const(maConstraints))
{ {
sheet::SolverConstraintOperator eOp = rConstr.Operator; sheet::SolverConstraintOperator eOp = rConstr.Operator;
if ( eOp == sheet::SolverConstraintOperator_INTEGER || if ( eOp == sheet::SolverConstraintOperator_INTEGER ||

View File

@@ -513,7 +513,7 @@ void SAL_CALL SwarmSolver::solve()
} }
// Determine variable bounds // Determine variable bounds
for (sheet::SolverConstraint const& rConstraint : maConstraints) for (sheet::SolverConstraint const& rConstraint : std::as_const(maConstraints))
{ {
table::CellAddress aLeftCellAddress = rConstraint.Left; table::CellAddress aLeftCellAddress = rConstraint.Left;
sheet::SolverConstraintOperator eOp = rConstraint.Operator; sheet::SolverConstraintOperator eOp = rConstraint.Operator;

View File

@@ -425,7 +425,7 @@ namespace basprov
if ( pBasicManager && xLibContainer.is() ) if ( pBasicManager && xLibContainer.is() )
{ {
Sequence< OUString > aLibNames = xLibContainer->getElementNames(); const Sequence< OUString > aLibNames = xLibContainer->getElementNames();
sal_Int32 nLibCount = aLibNames.getLength(); sal_Int32 nLibCount = aLibNames.getLength();
aChildNodes.realloc( nLibCount ); aChildNodes.realloc( nLibCount );
Reference< browse::XBrowseNode >* pChildNodes = aChildNodes.getArray(); Reference< browse::XBrowseNode >* pChildNodes = aChildNodes.getArray();

View File

@@ -220,7 +220,7 @@ namespace dlgprov
Reference< XPropertySet > xProps( xControlModel, uno::UNO_QUERY ); Reference< XPropertySet > xProps( xControlModel, uno::UNO_QUERY );
if ( xEventCont.is() ) if ( xEventCont.is() )
{ {
Sequence< OUString > aNames = xEventCont->getElementNames(); const Sequence< OUString > aNames = xEventCont->getElementNames();
for ( const OUString& rName : aNames ) for ( const OUString& rName : aNames )
{ {

View File

@@ -324,7 +324,7 @@ namespace dlgprov
} }
else else
{ {
Sequence< OUString > aOpenDocsTdocURLs( MiscUtils::allOpenTDocUrls( m_xContext ) ); const Sequence< OUString > aOpenDocsTdocURLs( MiscUtils::allOpenTDocUrls( m_xContext ) );
for ( auto const & tdocURL : aOpenDocsTdocURLs ) for ( auto const & tdocURL : aOpenDocsTdocURLs )
{ {
Reference< frame::XModel > xModel( MiscUtils::tDocUrlToModel( tdocURL ) ); Reference< frame::XModel > xModel( MiscUtils::tDocUrlToModel( tdocURL ) );

View File

@@ -215,7 +215,7 @@ private:
{ {
m_hBNA.reset( new std::unordered_map< OUString, Reference< browse::XBrowseNode > > ); m_hBNA.reset( new std::unordered_map< OUString, Reference< browse::XBrowseNode > > );
Sequence< Reference< browse::XBrowseNode > > langNodes = const Sequence< Reference< browse::XBrowseNode > > langNodes =
m_origNode->getChildNodes(); m_origNode->getChildNodes();
for ( const auto& rLangNode : langNodes ) for ( const auto& rLangNode : langNodes )
@@ -230,7 +230,7 @@ private:
xbn.set( rLangNode ); xbn.set( rLangNode );
} }
Sequence< Reference< browse::XBrowseNode > > grandchildren = const Sequence< Reference< browse::XBrowseNode > > grandchildren =
xbn->getChildNodes(); xbn->getChildNodes();
for ( const Reference< browse::XBrowseNode >& grandchild : grandchildren ) for ( const Reference< browse::XBrowseNode >& grandchild : grandchildren )
@@ -262,7 +262,7 @@ namespace
std::vector< Reference< browse::XBrowseNode > > getAllBrowseNodes( const Reference< XComponentContext >& xCtx ) std::vector< Reference< browse::XBrowseNode > > getAllBrowseNodes( const Reference< XComponentContext >& xCtx )
{ {
Sequence< OUString > openDocs = const Sequence< OUString > openDocs =
MiscUtils::allOpenTDocUrls( xCtx ); MiscUtils::allOpenTDocUrls( xCtx );
Reference< provider::XScriptProviderFactory > xFac; Reference< provider::XScriptProviderFactory > xFac;
@@ -395,7 +395,7 @@ public:
if ( hasChildNodes() ) if ( hasChildNodes() )
{ {
vXBrowseNodes aVNodes; vXBrowseNodes aVNodes;
Sequence < Reference< browse::XBrowseNode > > nodes = const Sequence < Reference< browse::XBrowseNode > > nodes =
m_xWrappedBrowseNode->getChildNodes(); m_xWrappedBrowseNode->getChildNodes();
for ( const Reference< browse::XBrowseNode >& xBrowseNode : nodes ) for ( const Reference< browse::XBrowseNode >& xBrowseNode : nodes )
{ {

View File

@@ -380,7 +380,7 @@ ScriptEventHelper::getEventListeners()
Reference< beans::XIntrospectionAccess > xIntrospectionAccess = Reference< beans::XIntrospectionAccess > xIntrospectionAccess =
xIntrospection->inspect( makeAny( m_xControl ) ); xIntrospection->inspect( makeAny( m_xControl ) );
Sequence< Type > aControlListeners = const Sequence< Type > aControlListeners =
xIntrospectionAccess->getSupportedListeners(); xIntrospectionAccess->getSupportedListeners();
for ( const Type& listType : aControlListeners ) for ( const Type& listType : aControlListeners )
{ {
@@ -397,7 +397,7 @@ ScriptEventHelper::getEventListeners()
Sequence< ScriptEventDescriptor > Sequence< ScriptEventDescriptor >
ScriptEventHelper::createEvents( const OUString& sCodeName ) ScriptEventHelper::createEvents( const OUString& sCodeName )
{ {
Sequence< OUString > aControlListeners = getEventListeners(); const Sequence< OUString > aControlListeners = getEventListeners();
sal_Int32 nLength = aControlListeners.getLength(); sal_Int32 nLength = aControlListeners.getLength();
Sequence< ScriptEventDescriptor > aDest( nLength ); Sequence< ScriptEventDescriptor > aDest( nLength );