From c504780e7883e911916689c12709d64d78125422 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 15 Aug 2019 13:56:26 +0200 Subject: [PATCH] loplugin:sequenceloop in starmath..svl Change-Id: I473a8eec9cbf6d44b55ffd6f2233bf39cf6217da Reviewed-on: https://gerrit.libreoffice.org/77528 Tested-by: Jenkins Reviewed-by: Noel Grandin --- starmath/source/cfgitem.cxx | 2 +- starmath/source/unomodel.cxx | 2 +- stoc/source/defaultregistry/defaultregistry.cxx | 2 +- stoc/source/implementationregistration/implreg.cxx | 22 +++++++++++----------- stoc/source/inspect/introspection.cxx | 6 +++--- stoc/source/servicemanager/servicemanager.cxx | 12 ++++++------ svgio/qa/cppunit/SvgImportTest.cxx | 4 ++-- svl/source/items/grabbagitem.cxx | 2 +- svl/source/items/srchitem.cxx | 2 +- svl/source/numbers/zforlist.cxx | 4 ++-- svl/source/passwordcontainer/passwordcontainer.cxx | 4 ++-- 11 files changed, 31 insertions(+), 31 deletions(-) diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx index 4636df044b08..a8f246423c21 100644 --- a/starmath/source/cfgitem.cxx +++ b/starmath/source/cfgitem.cxx @@ -559,7 +559,7 @@ void SmMathConfig::LoadFontFormatList() else pFontFormatList->Clear(); - Sequence< OUString > aNodes( GetNodeNames( FONT_FORMAT_LIST ) ); + const Sequence< OUString > aNodes( GetNodeNames( FONT_FORMAT_LIST ) ); for (const OUString& rNode : aNodes) { diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 8f200542829e..c271f079d9d3 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -638,7 +638,7 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any* SmModule *pp = SM_MOD(); SmSymbolManager &rManager = pp->GetSymbolManager(); - for (const SymbolDescriptor& rDescriptor : aSequence) + for (const SymbolDescriptor& rDescriptor : std::as_const(aSequence)) { vcl::Font aFont; aFont.SetFamilyName ( rDescriptor.sFontName ); diff --git a/stoc/source/defaultregistry/defaultregistry.cxx b/stoc/source/defaultregistry/defaultregistry.cxx index 69cd40406944..bfa698b13b91 100644 --- a/stoc/source/defaultregistry/defaultregistry.cxx +++ b/stoc/source/defaultregistry/defaultregistry.cxx @@ -770,7 +770,7 @@ Sequence< Reference< XRegistryKey > > SAL_CALL NestedKeyImpl::openKeys( ) std::transform(localSeq.begin(), localSeq.end(), retSeq.begin(), lKeyNameToRegKey); sal_uInt32 k = local; - for (const auto& rDef : defaultSeq) + for (const auto& rDef : std::as_const(defaultSeq)) { bool insert = std::none_of(retSeq.begin(), std::next(retSeq.begin(), local), [&rDef](const Reference& rKey) { return rKey->getKeyName() == rDef; }); diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx index 545e2cd6820b..c3d0f1e38820 100644 --- a/stoc/source/implementationregistration/implreg.cxx +++ b/stoc/source/implementationregistration/implreg.cxx @@ -91,7 +91,7 @@ void deleteAllLinkReferences(const Reference < XSimpleRegistry >& xReg, if (!(xKey.is() && (xKey->getValueType() == RegistryValueType_ASCIILIST))) return; - Sequence linkNames = xKey->getAsciiListValue(); + const Sequence linkNames = xKey->getAsciiListValue(); if (!linkNames.hasElements()) return; @@ -216,7 +216,7 @@ OUString searchImplForLink( Reference < XRegistryKey > xKey = xRootKey->openKey( slash_IMPLEMENTATIONS ); if (xKey.is()) { - Sequence< Reference < XRegistryKey > > subKeys( xKey->openKeys() ); + const Sequence< Reference < XRegistryKey > > subKeys( xKey->openKeys() ); OUString key_name( slash_UNO + linkName ); for (const Reference < XRegistryKey >& xImplKey : subKeys) @@ -526,7 +526,7 @@ void prepareUserKeys(const Reference < XSimpleRegistry >& xDest, } } else { - Sequence< Reference < XRegistryKey> > subKeys = xKey->openKeys(); + const Sequence< Reference < XRegistryKey> > subKeys = xKey->openKeys(); if (subKeys.hasElements()) { @@ -581,7 +581,7 @@ void deleteAllImplementations( const Reference < XSimpleRegistry >& xReg, { bool hasLocationUrl = false; - for (const Reference < XRegistryKey> & xImplKey : subKeys) + for (const Reference < XRegistryKey> & xImplKey : std::as_const(subKeys)) { Reference < XRegistryKey > xKey = xImplKey->openKey( slash_UNO_slash_LOCATION ); @@ -605,7 +605,7 @@ void deleteAllImplementations( const Reference < XSimpleRegistry >& xReg, xKey = xImplKey->openKey( slash_UNO ); if (xKey.is()) { - Sequence< Reference < XRegistryKey > > subKeys2 = xKey->openKeys(); + const Sequence< Reference < XRegistryKey > > subKeys2 = xKey->openKeys(); for (const Reference < XRegistryKey > & rSubKey2 : subKeys2) { @@ -721,7 +721,7 @@ void deleteAllServiceEntries( const Reference < XSimpleRegistry >& xReg, { bool hasNoImplementations = false; - for (const Reference < XRegistryKey > & xServiceKey : subKeys) + for (const Reference < XRegistryKey > & xServiceKey : std::as_const(subKeys)) { if (xServiceKey->getValueType() == RegistryValueType_ASCIILIST) { @@ -902,7 +902,7 @@ void prepareRegistry( Reference< XComponentContext > const & xContext ) // throw ( InvalidRegistryException, CannotRegisterImplementationException, RuntimeException ) { - Sequence< Reference < XRegistryKey > > subKeys = xSource->openKeys(); + const Sequence< Reference < XRegistryKey > > subKeys = xSource->openKeys(); if (!subKeys.hasElements()) { @@ -918,7 +918,7 @@ void prepareRegistry( if (xKey.is()) { // update entries in SERVICES section - Sequence< Reference < XRegistryKey > > serviceKeys = xKey->openKeys(); + const Sequence< Reference < XRegistryKey > > serviceKeys = xKey->openKeys(); OUString implName = xImplKey->getKeyName().copy(1); sal_Int32 firstDot = implName.indexOf('/'); @@ -941,7 +941,7 @@ void prepareRegistry( xKey = xImplKey->openKey( slash_UNO ); if (xKey.is()) { - Sequence< Reference < XRegistryKey > > subKeys2 = xKey->openKeys(); + const Sequence< Reference < XRegistryKey > > subKeys2 = xKey->openKeys(); for (const Reference < XRegistryKey >& rSubKey2 : subKeys2) { @@ -976,7 +976,7 @@ void prepareRegistry( if (xKey.is() && (xKey->getValueType() == RegistryValueType_ASCIILIST)) { // update link entries in REGISTRY_LINKS section - Sequence linkNames = xKey->getAsciiListValue(); + const Sequence linkNames = xKey->getAsciiListValue(); for (const OUString& rLinkName : linkNames) { @@ -1020,7 +1020,7 @@ void findImplementations( const Reference < XRegistryKey > & xSource, try { - Sequence< Reference < XRegistryKey > > subKeys = xSource->openKeys(); + const Sequence< Reference < XRegistryKey > > subKeys = xSource->openKeys(); for (const Reference < XRegistryKey >& rSubKey : subKeys) { diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx index ecfd5684004e..b5cebfd268d5 100644 --- a/stoc/source/inspect/introspection.cxx +++ b/stoc/source/inspect/introspection.cxx @@ -1754,7 +1754,7 @@ css::uno::Reference Implementation::inspect( aClassSeq.realloc( nIfaceCount + 1 ); aClassSeq.getArray()[ nIfaceCount ] = xImplClass2; - for( const Reference& rxIfaceClass : aClassSeq ) + for( const Reference& rxIfaceClass : std::as_const(aClassSeq) ) { if (!seen.insert(rxIfaceClass->getName()).second) { continue; @@ -1763,7 +1763,7 @@ css::uno::Reference Implementation::inspect( // 2. Register fields as properties // Get fields - Sequence< Reference > fields = rxIfaceClass->getFields(); + const Sequence< Reference > fields = rxIfaceClass->getFields(); for( const Reference& xField : fields ) { @@ -2355,7 +2355,7 @@ css::uno::Reference Implementation::inspect( } // Get fields - Sequence< Reference > fields = xClassRef->getFields(); + const Sequence< Reference > fields = xClassRef->getFields(); for( const Reference& xField : fields ) { diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx index 2af11198678a..880b478ec847 100644 --- a/stoc/source/servicemanager/servicemanager.cxx +++ b/stoc/source/servicemanager/servicemanager.cxx @@ -773,7 +773,7 @@ Reference< XInterface > OServiceManager::createInstanceWithContext( } #endif - Sequence< Reference< XInterface > > factories( + const Sequence< Reference< XInterface > > factories( queryServiceFactories( rServiceSpecifier, xContext ) ); for ( Reference< XInterface > const & xFactory : factories ) { @@ -825,7 +825,7 @@ Reference< XInterface > OServiceManager::createInstanceWithArgumentsAndContext( } #endif - Sequence< Reference< XInterface > > factories( + const Sequence< Reference< XInterface > > factories( queryServiceFactories( rServiceSpecifier, xContext ) ); for ( Reference< XInterface > const & xFactory : factories ) { @@ -1038,7 +1038,7 @@ void OServiceManager::insert( const Any & Element ) m_ImplementationNameMap[ aImplName ] = xEle; //put into the service map - Sequence< OUString > aServiceNames = xInfo->getSupportedServiceNames(); + const Sequence< OUString > aServiceNames = xInfo->getSupportedServiceNames(); for( const OUString& rServiceName : aServiceNames ) { m_ServiceMap.emplace( @@ -1122,7 +1122,7 @@ void OServiceManager::remove( const Any & Element ) if( !xSF.is() ) return; - Sequence< OUString > aServiceNames = xSF->getSupportedServiceNames(); + const Sequence< OUString > aServiceNames = xSF->getSupportedServiceNames(); for( const OUString& rServiceName : aServiceNames ) { pair p = @@ -1305,7 +1305,7 @@ Sequence ORegistryServiceManager::getFromServiceName( Reference ORegistryServiceManager::loadWithServiceName( const OUString& serviceName, Reference< XComponentContext > const & xContext ) { - Sequence implEntries = getFromServiceName( serviceName ); + const Sequence implEntries = getFromServiceName( serviceName ); for (const auto& rEntry : implEntries) { Reference< XInterface > x( loadWithImplementationName( rEntry, xContext ) ); @@ -1411,7 +1411,7 @@ Reference ORegistryServiceManager::createContentEnumeration( check_undisposed(); MutexGuard aGuard(m_mutex); // get all implementation names registered under this service name from the registry - Sequence aImpls = getFromServiceName( aServiceName ); + const Sequence aImpls = getFromServiceName( aServiceName ); // load and insert all factories specified by the registry for( const OUString& aImplName : aImpls ) { diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index be3f719ab1d2..501df9c21ea1 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -639,7 +639,7 @@ void Test::testBehaviourWhenWidthAndHeightIsOrIsNotSet() // the container. { - Primitive2DSequence aSequence = parseSvg("svgio/qa/cppunit/data/Drawing_WithWidthHeight.svg"); + const Primitive2DSequence aSequence = parseSvg("svgio/qa/cppunit/data/Drawing_WithWidthHeight.svg"); CPPUNIT_ASSERT(aSequence.hasElements()); geometry::RealRectangle2D aRealRect; @@ -663,7 +663,7 @@ void Test::testBehaviourWhenWidthAndHeightIsOrIsNotSet() } { - Primitive2DSequence aSequence = parseSvg("svgio/qa/cppunit/data/Drawing_NoWidthHeight.svg"); + const Primitive2DSequence aSequence = parseSvg("svgio/qa/cppunit/data/Drawing_NoWidthHeight.svg"); CPPUNIT_ASSERT(aSequence.hasElements()); diff --git a/svl/source/items/grabbagitem.cxx b/svl/source/items/grabbagitem.cxx index 191d7b35c74b..83c0323450ab 100644 --- a/svl/source/items/grabbagitem.cxx +++ b/svl/source/items/grabbagitem.cxx @@ -43,7 +43,7 @@ bool SfxGrabBagItem::PutValue(const uno::Any& rVal, sal_uInt8 /*nMemberId*/) if (rVal >>= aValue) { m_aMap.clear(); - for (beans::PropertyValue const& aPropertyValue : aValue) + for (beans::PropertyValue const& aPropertyValue : std::as_const(aValue)) { m_aMap[aPropertyValue.Name] = aPropertyValue.Value; } diff --git a/svl/source/items/srchitem.cxx b/svl/source/items/srchitem.cxx index 5443cc06539b..4fd9ead794af 100644 --- a/svl/source/items/srchitem.cxx +++ b/svl/source/items/srchitem.cxx @@ -508,7 +508,7 @@ bool SvxSearchItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) if ( ( rVal >>= aSeq ) && ( aSeq.getLength() == SRCH_PARAMS ) ) { sal_Int16 nConvertedCount( 0 ); - for ( const auto& rProp : aSeq ) + for ( const auto& rProp : std::as_const(aSeq) ) { if ( rProp.Name == SRCH_PARA_OPTIONS ) { diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index bd35c725d5db..e862b45f5db4 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -2798,7 +2798,7 @@ void SvNumberFormatter::ImpGenerateAdditionalFormats( sal_uInt32 CLOffset, // There is no harm though, on first invocation ImpGetDefaultFormat() will // use the first default encountered. aFormatSeq = rNumberFormatCode->getAllFormatCodes( aLocale ); - for ( const auto& rFormat : aFormatSeq ) + for ( const auto& rFormat : std::as_const(aFormatSeq) ) { if ( nPos - CLOffset >= SV_COUNTRY_LANGUAGE_OFFSET ) { @@ -3842,7 +3842,7 @@ void SvNumberFormatter::ImpInitCurrencyTable() std::make_unique(*pLocaleData, LANGUAGE_SYSTEM)); sal_uInt16 nCurrencyPos = 1; - css::uno::Sequence< css::lang::Locale > xLoc = LocaleDataWrapper::getInstalledLocaleNames(); + const css::uno::Sequence< css::lang::Locale > xLoc = LocaleDataWrapper::getInstalledLocaleNames(); sal_Int32 nLocaleCount = xLoc.getLength(); SAL_INFO( "svl.numbers", "number of locales: \"" << nLocaleCount << "\"" ); NfCurrencyTable &rCurrencyTable = theCurrencyTable::get(); diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx index 0c6c1b29abde..55f959cfc3a5 100644 --- a/svl/source/passwordcontainer/passwordcontainer.cxx +++ b/svl/source/passwordcontainer/passwordcontainer.cxx @@ -1091,7 +1091,7 @@ sal_Bool SAL_CALL PasswordContainer::changeMasterPassword( const uno::Reference< if ( !aPass.isEmpty() ) { // get all the persistent entries if it is possible - Sequence< UrlRecord > aPersistent = getAllPersistent( uno::Reference< task::XInteractionHandler >() ); + const Sequence< UrlRecord > aPersistent = getAllPersistent( uno::Reference< task::XInteractionHandler >() ); // remove the master password and the entries persistence removeMasterPassword(); @@ -1194,7 +1194,7 @@ sal_Bool SAL_CALL PasswordContainer::useDefaultMasterPassword( const uno::Refere if ( !aPass.isEmpty() ) { // get all the persistent entries if it is possible - Sequence< UrlRecord > aPersistent = getAllPersistent( uno::Reference< task::XInteractionHandler >() ); + const Sequence< UrlRecord > aPersistent = getAllPersistent( uno::Reference< task::XInteractionHandler >() ); // remove the master password and the entries persistence removeMasterPassword(); -- 2.11.4.GIT