summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-08-15 11:05:55 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-08-15 11:59:02 +0200
commitfe00a724a918606e5c8c2c32b155bc50b33d56bd (patch)
treec638ef9b9ca8d354a911feb82d6905f10861f0bc
parent5827e30109b683cb74efa21d154e5219fe9e2a0c (diff)
loplugin:sequenceloop in basic..cui
Change-Id: I15d825de3201808d188b461415f78a4d81b64127 Reviewed-on: https://gerrit.libreoffice.org/77494 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--UnoControls/source/base/basecontainercontrol.cxx2
-rw-r--r--UnoControls/source/base/multiplexer.cxx4
-rw-r--r--basic/source/basmgr/basmgr.cxx6
-rw-r--r--chart2/qa/extras/chart2dump/chart2dump.cxx2
-rw-r--r--chart2/source/view/main/ChartView.cxx6
-rw-r--r--chart2/source/view/main/VLegend.cxx3
-rw-r--r--comphelper/source/property/property.cxx2
-rw-r--r--connectivity/source/commontools/ConnectionWrapper.cxx4
-rw-r--r--connectivity/source/commontools/paramwrapper.cxx3
-rw-r--r--connectivity/source/drivers/hsqldb/HDriver.cxx2
-rw-r--r--connectivity/source/drivers/mork/MColumnAlias.cxx2
-rw-r--r--connectivity/source/manager/mdrivermanager.cxx2
-rw-r--r--cui/source/customize/CommandCategoryListBox.cxx6
-rw-r--r--cui/source/customize/CustomNotebookbarGenerator.cxx2
-rw-r--r--cui/source/customize/cfg.cxx6
-rw-r--r--cui/source/customize/cfgutil.cxx2
-rw-r--r--cui/source/inc/CustomNotebookbarGenerator.hxx2
17 files changed, 31 insertions, 25 deletions
diff --git a/UnoControls/source/base/basecontainercontrol.cxx b/UnoControls/source/base/basecontainercontrol.cxx
index c814eb0107e6..dda72799d550 100644
--- a/UnoControls/source/base/basecontainercontrol.cxx
+++ b/UnoControls/source/base/basecontainercontrol.cxx
@@ -163,7 +163,7 @@ void SAL_CALL BaseContainerControl::dispose()
m_aListeners.disposeAndClear( aObject );
// remove controls
- Sequence< Reference< XControl > > seqCtrls = getControls();
+ const Sequence< Reference< XControl > > seqCtrls = getControls();
maControlInfoList.clear();
diff --git a/UnoControls/source/base/multiplexer.cxx b/UnoControls/source/base/multiplexer.cxx
index cfeb5975e9b9..3b51249d09ff 100644
--- a/UnoControls/source/base/multiplexer.cxx
+++ b/UnoControls/source/base/multiplexer.cxx
@@ -158,7 +158,7 @@ void OMRCListenerMultiplexerHelper::setPeer( const Reference< XWindow >& xPeer )
if( m_xPeer.is() )
{
// get all types from the listener added to the peer
- Sequence< Type > aContainedTypes = m_aListenerHolder.getContainedTypes();
+ const Sequence< Type > aContainedTypes = m_aListenerHolder.getContainedTypes();
// loop over all listener types and remove the listeners from the peer
for( const auto& rContainedType : aContainedTypes )
impl_unadviseFromPeer( m_xPeer, rContainedType );
@@ -167,7 +167,7 @@ void OMRCListenerMultiplexerHelper::setPeer( const Reference< XWindow >& xPeer )
if( m_xPeer.is() )
{
// get all types from the listener added to the peer
- Sequence< Type > aContainedTypes = m_aListenerHolder.getContainedTypes();
+ const Sequence< Type > aContainedTypes = m_aListenerHolder.getContainedTypes();
// loop over all listener types and add the listeners to the peer
for( const auto& rContainedType : aContainedTypes )
impl_adviseToPeer( m_xPeer, rContainedType );
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index 71674e7825d0..a8707a825d0f 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -551,7 +551,7 @@ void BasicManager::SetLibraryContainerInfo( const LibraryContainerInfo& rInfo )
uno::Reference< container::XContainer> xLibContainer( xScriptCont, uno::UNO_QUERY );
xLibContainer->addContainerListener( xLibContainerListener );
- uno::Sequence< OUString > aScriptLibNames = xScriptCont->getElementNames();
+ const uno::Sequence< OUString > aScriptLibNames = xScriptCont->getElementNames();
if( aScriptLibNames.hasElements() )
{
@@ -1419,7 +1419,7 @@ bool BasicManager::LegacyPsswdBinaryLimitExceeded( std::vector< OUString >& _out
uno::Reference< container::XNameAccess > xScripts( GetScriptLibraryContainer(), uno::UNO_QUERY_THROW );
uno::Reference< script::XLibraryContainerPassword > xPassword( GetScriptLibraryContainer(), uno::UNO_QUERY_THROW );
- uno::Sequence< OUString > aNames( xScripts->getElementNames() );
+ const uno::Sequence< OUString > aNames( xScripts->getElementNames() );
for ( auto const & scriptElementName : aNames )
{
if( !xPassword->isLibraryPasswordProtected( scriptElementName ) )
@@ -1430,7 +1430,7 @@ bool BasicManager::LegacyPsswdBinaryLimitExceeded( std::vector< OUString >& _out
continue;
uno::Reference< container::XNameAccess > xScriptLibrary( xScripts->getByName( scriptElementName ), uno::UNO_QUERY_THROW );
- uno::Sequence< OUString > aElementNames( xScriptLibrary->getElementNames() );
+ const uno::Sequence< OUString > aElementNames( xScriptLibrary->getElementNames() );
sal_Int32 nLen = aElementNames.getLength();
std::vector< OUString > aBigModules( nLen );
diff --git a/chart2/qa/extras/chart2dump/chart2dump.cxx b/chart2/qa/extras/chart2dump/chart2dump.cxx
index 5a467dbd448f..b640a46f9010 100644
--- a/chart2/qa/extras/chart2dump/chart2dump.cxx
+++ b/chart2/qa/extras/chart2dump/chart2dump.cxx
@@ -224,7 +224,7 @@ protected:
std::abs(aExpectedTransform.Line3.Column3 - rTransform.Line3.Column3) < fEPS);
}
- OUString sequenceToOneLineString(uno::Sequence<OUString>& rSeq)
+ OUString sequenceToOneLineString(const uno::Sequence<OUString>& rSeq)
{
OUStringBuffer aBufer;
for (const OUString& seqItem : rSeq)
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 3c4d4eb5828b..897d1276c095 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -2304,7 +2304,8 @@ void lcl_createButtons(const uno::Reference<drawing::XShapes>& xPageShapes,
{
x = 0;
- for (css::chart2::data::PivotTableFieldEntry const & rPageFieldEntry : xPivotTableDataProvider->getPageFields())
+ const css::uno::Sequence<chart2::data::PivotTableFieldEntry> aPivotFieldEntries = xPivotTableDataProvider->getPageFields();
+ for (css::chart2::data::PivotTableFieldEntry const & rPageFieldEntry : aPivotFieldEntries)
{
std::unique_ptr<VButton> pButton(new VButton);
pButton->init(xPageShapes, xShapeFactory);
@@ -2330,7 +2331,8 @@ void lcl_createButtons(const uno::Reference<drawing::XShapes>& xPageShapes,
if (xPivotTableDataProvider->getRowFields().hasElements())
{
x = 200;
- for (css::chart2::data::PivotTableFieldEntry const & rRowFieldEntry : xPivotTableDataProvider->getRowFields())
+ const css::uno::Sequence<chart2::data::PivotTableFieldEntry> aPivotFieldEntries = xPivotTableDataProvider->getRowFields();
+ for (css::chart2::data::PivotTableFieldEntry const & rRowFieldEntry : aPivotFieldEntries)
{
std::unique_ptr<VButton> pButton(new VButton);
diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx
index 43f103db7ca1..cc7ff9a2d567 100644
--- a/chart2/source/view/main/VLegend.cxx
+++ b/chart2/source/view/main/VLegend.cxx
@@ -793,7 +793,8 @@ std::vector<std::shared_ptr<VButton>> lcl_createButtons(
int x = 100;
int y = 100;
- for (chart2::data::PivotTableFieldEntry const & sColumnFieldEntry : xPivotTableDataProvider->getColumnFields())
+ const css::uno::Sequence<chart2::data::PivotTableFieldEntry> aPivotFieldEntries = xPivotTableDataProvider->getColumnFields();
+ for (chart2::data::PivotTableFieldEntry const & sColumnFieldEntry : aPivotFieldEntries)
{
std::shared_ptr<VButton> pButton(new VButton);
aButtons.push_back(pButton);
diff --git a/comphelper/source/property/property.cxx b/comphelper/source/property/property.cxx
index 6b7787725d43..84a5abebc70b 100644
--- a/comphelper/source/property/property.cxx
+++ b/comphelper/source/property/property.cxx
@@ -68,7 +68,7 @@ void copyProperties(const Reference<XPropertySet>& _rxSource,
Reference< XPropertySetInfo > xSourceProps = _rxSource->getPropertySetInfo();
Reference< XPropertySetInfo > xDestProps = _rxDest->getPropertySetInfo();
- Sequence< Property > aSourceProps = xSourceProps->getProperties();
+ const Sequence< Property > aSourceProps = xSourceProps->getProperties();
Property aDestProp;
for (const Property& rSourceProp : aSourceProps)
{
diff --git a/connectivity/source/commontools/ConnectionWrapper.cxx b/connectivity/source/commontools/ConnectionWrapper.cxx
index bf882ee1bdd6..e5a10447316e 100644
--- a/connectivity/source/commontools/ConnectionWrapper.cxx
+++ b/connectivity/source/commontools/ConnectionWrapper.cxx
@@ -206,7 +206,7 @@ void OConnectionWrapper::createUniqueId( const OUString& _rURL
// now we need to sort the properties
std::sort(_rInfo.begin(),_rInfo.end(),TPropertyValueLessFunctor());
- for (PropertyValue const & prop : _rInfo)
+ for (PropertyValue const & prop : std::as_const(_rInfo))
{
// we only include strings an integer values
OUString sValue;
@@ -222,7 +222,7 @@ void OConnectionWrapper::createUniqueId( const OUString& _rURL
Sequence< OUString> aSeq;
if ( prop.Value >>= aSeq )
{
- for(OUString const & s : aSeq)
+ for(OUString const & s : std::as_const(aSeq))
sha1.update(reinterpret_cast<unsigned char const*>(s.getStr()), s.getLength() * sizeof(sal_Unicode));
}
}
diff --git a/connectivity/source/commontools/paramwrapper.cxx b/connectivity/source/commontools/paramwrapper.cxx
index 54b381b72bb7..aae53c2d2a0f 100644
--- a/connectivity/source/commontools/paramwrapper.cxx
+++ b/connectivity/source/commontools/paramwrapper.cxx
@@ -131,7 +131,8 @@ namespace param
OUString ParameterWrapper::impl_getPseudoAggregatePropertyName( sal_Int32 _nHandle ) const
{
Reference< XPropertySetInfo > xInfo = const_cast<ParameterWrapper*>( this )->getPropertySetInfo();
- for ( const Property& rProperty : xInfo->getProperties() )
+ const css::uno::Sequence<Property> aProperties = xInfo->getProperties();
+ for ( const Property& rProperty : aProperties )
{
if ( rProperty.Handle == _nHandle )
return rProperty.Name;
diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx
index 56c22443d0da..17fb9de34676 100644
--- a/connectivity/source/drivers/hsqldb/HDriver.cxx
+++ b/connectivity/source/drivers/hsqldb/HDriver.cxx
@@ -149,7 +149,7 @@ namespace connectivity
_rxContext, aConfigPath.makeStringAndClear() ) );
OUStringBuffer aPermittedMethods;
- Sequence< OUString > aNodeNames( aConfig.getNodeNames() );
+ const Sequence< OUString > aNodeNames( aConfig.getNodeNames() );
for ( auto const & nodeName : aNodeNames )
{
OUString sPermittedMethod;
diff --git a/connectivity/source/drivers/mork/MColumnAlias.cxx b/connectivity/source/drivers/mork/MColumnAlias.cxx
index a5b178d47178..1c9badd3280f 100644
--- a/connectivity/source/drivers/mork/MColumnAlias.cxx
+++ b/connectivity/source/drivers/mork/MColumnAlias.cxx
@@ -91,7 +91,7 @@ void OColumnAlias::initialize( const css::uno::Reference< css::lang::XMultiServi
com_sun_star_comp_sdbc_MozabDriver::ColumnAliases::get(
comphelper::getComponentContext(_rxORB)),
UNO_QUERY_THROW);
- Sequence< OUString > aProgrammaticNames(xAliasesNode->getElementNames());
+ const Sequence< OUString > aProgrammaticNames(xAliasesNode->getElementNames());
for (const auto& rProgrammaticName : aProgrammaticNames) {
OString sAsciiProgrammaticName(
OUStringToOString(
diff --git a/connectivity/source/manager/mdrivermanager.cxx b/connectivity/source/manager/mdrivermanager.cxx
index 2a9f3e1de08f..c88e117414fa 100644
--- a/connectivity/source/manager/mdrivermanager.cxx
+++ b/connectivity/source/manager/mdrivermanager.cxx
@@ -354,7 +354,7 @@ void OSDBCDriverManager::initializeDriverPrecedence()
// at the moment this is the first of all drivers we know
// loop through the names in the precedence order
- for ( const OUString& rDriverOrder : aDriverOrder )
+ for ( const OUString& rDriverOrder : std::as_const(aDriverOrder) )
{
if (aNoPrefDriversStart == m_aDriversBS.end())
break;
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<void *>(rootNode.get()) ) );
// Add main macro groups
- for ( auto const & childGroup : rootNode->getChildNodes() )
+ const css::uno::Sequence<css::uno::Reference<css::script::browse::XBrowseNode>> 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<css::uno::Reference<css::script::browse::XBrowseNode>> 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<OUString> sUIItemProperties)
+void CustomNotebookbarGenerator::modifyCustomizedUIFile(const Sequence<OUString>& 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<OUString> getCustomizedUIItem(OUString sNotebookbarConfigType);
static void getFileNameAndAppName(OUString& sAppName, OUString& sNotebookbarUIFileName);
- static void modifyCustomizedUIFile(Sequence<OUString> sUIItemProperties);
+ static void modifyCustomizedUIFile(const Sequence<OUString>& sUIItemProperties);
static void createCustomizedUIFile();
static void setCustomizedUIItem(Sequence<OUString> sUIItemProperties,
OUString sNotebookbarConfigType);