diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-08-14 11:14:08 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-08-16 09:04:51 +0200 |
commit | 7d7a7862a7dccb6764f80258f28685a0da3cbbcb (patch) | |
tree | b7281950f84b12c4868542f103a23c1460d22863 /xmlscript/source | |
parent | abeab40aeb2bf16c1438b5e5f0cd70b3e11f6b7a (diff) |
new loplugin:sequenceloop
look for places we should be using std::as_const on for-range
loops over uno::Sequence, to avoid triggering a copy
Change-Id: I7efb641bf09d37c87946f03428ee4eec90298c8a
Reviewed-on: https://gerrit.libreoffice.org/77441
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmlscript/source')
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx | 6 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_export.cxx | 2 | ||||
-rw-r--r-- | xmlscript/source/xmlflat_imexp/xmlbas_export.cxx | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx index cf0a13e39235..09910dfb6a89 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx @@ -318,7 +318,7 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles ) { ElementDescriptor * popup = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menupopup", _xDocument ); - for ( const auto& rItemValue : itemValues ) + for ( const auto& rItemValue : std::as_const(itemValues) ) { ElementDescriptor * item = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menuitem", _xDocument ); item->addAttribute( XMLNS_DIALOGS_PREFIX ":value", rItemValue ); @@ -365,7 +365,7 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles ) { ElementDescriptor * popup = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menupopup", _xDocument ); - for ( const auto& rItemValue : itemValues ) + for ( const auto& rItemValue : std::as_const(itemValues) ) { ElementDescriptor * item = new ElementDescriptor(_xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menuitem", _xDocument ); item->addAttribute( XMLNS_DIALOGS_PREFIX ":value", rItemValue ); @@ -1086,7 +1086,7 @@ void ElementDescriptor::readBullitinBoard( StyleBag * all_styles ) Reference< container::XNameContainer > xDialogModel( _xProps, UNO_QUERY ); if ( !xDialogModel.is() ) return; // #TODO throw??? - Sequence< OUString > aElements( xDialogModel->getElementNames() ); + const Sequence< OUString > aElements( xDialogModel->getElementNames() ); ElementDescriptor * pRadioGroup = nullptr; diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx index 3deca0ba6c04..2ad8ae7b929f 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx @@ -1151,7 +1151,7 @@ void ElementDescriptor::readEvents() Reference< container::XNameContainer > xEvents( xSupplier->getEvents() ); if (xEvents.is()) { - Sequence< OUString > aNames( xEvents->getElementNames() ); + const Sequence< OUString > aNames( xEvents->getElementNames() ); for ( const auto& rName : aNames ) { script::ScriptEventDescriptor descr; diff --git a/xmlscript/source/xmlflat_imexp/xmlbas_export.cxx b/xmlscript/source/xmlflat_imexp/xmlbas_export.cxx index 76a20aa3a5a5..6101ec60ecfd 100644 --- a/xmlscript/source/xmlflat_imexp/xmlbas_export.cxx +++ b/xmlscript/source/xmlflat_imexp/xmlbas_export.cxx @@ -153,7 +153,7 @@ sal_Bool XMLBasicExporterBase::filter( const Sequence< beans::PropertyValue >& / if ( xLibContainer.is() ) { - Sequence< OUString > aLibNames = xLibContainer->getElementNames(); + const Sequence< OUString > aLibNames = xLibContainer->getElementNames(); for ( const OUString& rLibName : aLibNames ) { if ( xLibContainer->hasByName( rLibName ) ) @@ -229,7 +229,7 @@ sal_Bool XMLBasicExporterBase::filter( const Sequence< beans::PropertyValue >& / if ( xLib.is() ) { - Sequence< OUString > aModNames = xLib->getElementNames(); + const Sequence< OUString > aModNames = xLib->getElementNames(); for ( const OUString& rModName : aModNames ) { if ( xLib->hasByName( rModName ) ) |