From b678dee6a856e3c0bd4e969db76f6a19970e5343 Mon Sep 17 00:00:00 2001 From: Jochen Nitschke Date: Sat, 8 Sep 2018 10:44:10 +0200 Subject: cppcheck: variableScope in basic use a range based loop in one case Change-Id: I3d3acc35739634797e2b6e4d1cc2909b3fe33750 Reviewed-on: https://gerrit.libreoffice.org/60188 Tested-by: Jenkins Reviewed-by: Noel Grandin --- basic/source/basmgr/basmgr.cxx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'basic/source/basmgr') diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index 8318466c88f1..08e13d857eae 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -551,20 +551,18 @@ void BasicManager::SetLibraryContainerInfo( const LibraryContainerInfo& rInfo ) xLibContainer->addContainerListener( xLibContainerListener ); uno::Sequence< OUString > aScriptLibNames = xScriptCont->getElementNames(); - const OUString* pScriptLibName = aScriptLibNames.getConstArray(); - sal_Int32 i, nNameCount = aScriptLibNames.getLength(); - if( nNameCount ) + if( aScriptLibNames.hasElements() ) { - for( i = 0 ; i < nNameCount ; ++i, ++pScriptLibName ) + for(const auto& rScriptLibName : aScriptLibNames) { - uno::Any aLibAny = xScriptCont->getByName( *pScriptLibName ); + uno::Any aLibAny = xScriptCont->getByName( rScriptLibName ); - if ( *pScriptLibName == "Standard" || *pScriptLibName == "VBAProject") - xScriptCont->loadLibrary( *pScriptLibName ); + if ( rScriptLibName == "Standard" || rScriptLibName == "VBAProject") + xScriptCont->loadLibrary( rScriptLibName ); BasMgrContainerListenerImpl::insertLibraryImpl - ( xScriptCont, this, aLibAny, *pScriptLibName ); + ( xScriptCont, this, aLibAny, rScriptLibName ); } } else -- cgit