From fe00a724a918606e5c8c2c32b155bc50b33d56bd Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 15 Aug 2019 11:05:55 +0200 Subject: loplugin:sequenceloop in basic..cui Change-Id: I15d825de3201808d188b461415f78a4d81b64127 Reviewed-on: https://gerrit.libreoffice.org/77494 Tested-by: Jenkins Reviewed-by: Noel Grandin --- cui/source/customize/CommandCategoryListBox.cxx | 6 ++++-- cui/source/customize/CustomNotebookbarGenerator.cxx | 2 +- cui/source/customize/cfg.cxx | 6 +++--- cui/source/customize/cfgutil.cxx | 2 +- cui/source/inc/CustomNotebookbarGenerator.hxx | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) (limited to 'cui/source') diff --git a/cui/source/customize/CommandCategoryListBox.cxx b/cui/source/customize/CommandCategoryListBox.cxx index 3335836afe3a..e361388943c4 100644 --- a/cui/source/customize/CommandCategoryListBox.cxx +++ b/cui/source/customize/CommandCategoryListBox.cxx @@ -351,7 +351,8 @@ void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio SfxCfgKind::GROUP_SCRIPTCONTAINER, 0, static_cast(rootNode.get()) ) ); // Add main macro groups - for ( auto const & childGroup : rootNode->getChildNodes() ) + const css::uno::Sequence> aChildNodes = rootNode->getChildNodes(); + for ( auto const & childGroup : aChildNodes ) { OUString sUIName; childGroup->acquire(); @@ -490,7 +491,8 @@ void CommandCategoryListBox::addChildren( m_searchOptions.searchString = filterTerm; utl::TextSearch textSearch( m_searchOptions ); - for (auto const & child : parentNode->getChildNodes()) + const css::uno::Sequence> aChildNodes = parentNode->getChildNodes(); + for (auto const & child : aChildNodes) { // Acquire to prevent auto-destruction child->acquire(); diff --git a/cui/source/customize/CustomNotebookbarGenerator.cxx b/cui/source/customize/CustomNotebookbarGenerator.cxx index 57efc2776d18..dee8e141d37c 100644 --- a/cui/source/customize/CustomNotebookbarGenerator.cxx +++ b/cui/source/customize/CustomNotebookbarGenerator.cxx @@ -188,7 +188,7 @@ static xmlDocPtr notebookbarXMLParser(char* pDocName, char* pUIItemID, char* pPr return pDocPtr; } -void CustomNotebookbarGenerator::modifyCustomizedUIFile(Sequence sUIItemProperties) +void CustomNotebookbarGenerator::modifyCustomizedUIFile(const Sequence& sUIItemProperties) { OUString sCustomizedUIPath = getCustomizedUIPath(); char* cCustomizedUIPath = convertToCharPointer(sCustomizedUIPath); diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index c5c324a40d69..f9d67ec32ee3 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -711,7 +711,7 @@ OUString ContextMenuSaveInData::GetUIName( const OUString& rResourceURL ) catch ( const css::uno::Exception& ) {} - for ( const auto& aProp : aProps ) + for ( const auto& aProp : std::as_const(aProps) ) { if ( aProp.Name == ITEM_DESCRIPTOR_UINAME ) { @@ -739,7 +739,7 @@ SvxEntries* ContextMenuSaveInData::GetEntries() catch ( const css::lang::IllegalArgumentException& ) {} - for ( const auto& aElement : aElementsInfo ) + for ( const auto& aElement : std::as_const(aElementsInfo) ) { OUString aUrl; for ( const auto& aElementProp : aElement ) @@ -787,7 +787,7 @@ SvxEntries* ContextMenuSaveInData::GetEntries() catch ( const css::lang::IllegalArgumentException& ) {} - for ( const auto& aElement : aParentElementsInfo ) + for ( const auto& aElement : std::as_const(aParentElementsInfo) ) { OUString aUrl; for ( const auto& aElementProp : aElement ) diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx index 06249776bfca..1e675a682296 100644 --- a/cui/source/customize/cfgutil.cxx +++ b/cui/source/customize/cfgutil.cxx @@ -157,7 +157,7 @@ std::vector< SfxStyleInfo_Impl > SfxStylesInfo_Impl::getStyleFamilies() return std::vector< SfxStyleInfo_Impl >(); css::uno::Reference< css::container::XNameAccess > xCont = xModel->getStyleFamilies(); - css::uno::Sequence< OUString > lFamilyNames = xCont->getElementNames(); + const css::uno::Sequence< OUString > lFamilyNames = xCont->getElementNames(); std::vector< SfxStyleInfo_Impl > lFamilies; for (const auto& aFamily : lFamilyNames) { diff --git a/cui/source/inc/CustomNotebookbarGenerator.hxx b/cui/source/inc/CustomNotebookbarGenerator.hxx index 00ebec31e7a4..170b1a6ff0cb 100644 --- a/cui/source/inc/CustomNotebookbarGenerator.hxx +++ b/cui/source/inc/CustomNotebookbarGenerator.hxx @@ -34,7 +34,7 @@ public: static char* convertToCharPointer(const OUString& sString); static Sequence getCustomizedUIItem(OUString sNotebookbarConfigType); static void getFileNameAndAppName(OUString& sAppName, OUString& sNotebookbarUIFileName); - static void modifyCustomizedUIFile(Sequence sUIItemProperties); + static void modifyCustomizedUIFile(const Sequence& sUIItemProperties); static void createCustomizedUIFile(); static void setCustomizedUIItem(Sequence sUIItemProperties, OUString sNotebookbarConfigType); -- cgit