loplugin:sequenceloop in test..toolkit

Change-Id: Ic8dad06c535b0af713bfe7cd46e601c8ea7ba6c7
Reviewed-on: https://gerrit.libreoffice.org/77531
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2019-08-15 20:23:50 +02:00
parent 3c6cb83b80
commit 2dfb192edf
19 changed files with 33 additions and 33 deletions
+1 -1
View File
@@ -273,7 +273,7 @@ void XPropertySet::fillPropsToTest(const uno::Reference<beans::XPropertySetInfo>
if (maPropsToTest.initialized)
return;
uno::Sequence<beans::Property> aProps = xPropInfo->getProperties();
const uno::Sequence<beans::Property> aProps = xPropInfo->getProperties();
// some properties should not be changed in a unspecific way.
// TODO: Maybe we should mark these properties read-only, instead of
+1 -1
View File
@@ -64,7 +64,7 @@ void XDatabaseRange::testGetSubtotalDescriptor()
void XDatabaseRange::testGetSortDescriptor()
{
uno::Reference< sheet::XDatabaseRange > xDBRange(init("SortDescriptor"), UNO_QUERY_THROW);
uno::Sequence< beans::PropertyValue > xSortDescr = xDBRange->getSortDescriptor();
const uno::Sequence< beans::PropertyValue > xSortDescr = xDBRange->getSortDescriptor();
for (const beans::PropertyValue& aProp : xSortDescr)
{
//std::cout << "Prop " << i << " Name: " << OUString(aProp.Name) << std::endl;
+2 -2
View File
@@ -42,7 +42,7 @@ void XFunctionDescriptions::testGetById()
OUString aName1;
uno::Sequence<beans::PropertyValue> aProps1;
CPPUNIT_ASSERT(xFD->getByIndex(nNumber) >>= aProps1);
for (const auto& aProp : aProps1)
for (const auto& aProp : std::as_const(aProps1))
{
if (aProp.Name == "Id")
aId1 = aProp.Value.get<sal_Int32>();
@@ -53,7 +53,7 @@ void XFunctionDescriptions::testGetById()
// fetch the same descriptions by its id
sal_Int32 aId2 = 0;
OUString aName2;
uno::Sequence<beans::PropertyValue> aProps2 = xFD->getById(aId1);
const uno::Sequence<beans::PropertyValue> aProps2 = xFD->getById(aId1);
CPPUNIT_ASSERT_MESSAGE("Received empty FunctionDescriptions from getById()",
aProps2.hasElements());
for (const auto& aProp : aProps2)
@@ -42,7 +42,7 @@ void XSheetCellRangeContainer::testAddRemoveRangeAddress()
CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to remove CellRangeAddress (count)", cnt - 1,
xSCRC->getCount());
uno::Sequence<table::CellRangeAddress> aAfterRemoveAddr = xSCRC->getRangeAddresses();
const uno::Sequence<table::CellRangeAddress> aAfterRemoveAddr = xSCRC->getRangeAddresses();
for (auto const& addr : aAfterRemoveAddr)
{
CPPUNIT_ASSERT_MESSAGE("Unable to remove CellRangeAddress (entry)", aAddr[0] != addr);
@@ -71,7 +71,7 @@ void XSheetCellRangeContainer::testAddRemoveRangeAddresses()
CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to remove CellRangeAddresses (count)", cnt - 2,
xSCRC->getCount());
uno::Sequence<table::CellRangeAddress> aAfterRemoveAddr = xSCRC->getRangeAddresses();
const uno::Sequence<table::CellRangeAddress> aAfterRemoveAddr = xSCRC->getRangeAddresses();
for (auto const& addr : aAfterRemoveAddr)
{
CPPUNIT_ASSERT_MESSAGE("Unable to remove CellRangeAddresses (entry: first)",
+1 -1
View File
@@ -35,7 +35,7 @@ void XSheetFilterableEx::testCreateFilterDescriptorByObject()
uno::Reference<sheet::XSheetFilterDescriptor> xSFD = xSFEx->createFilterDescriptorByObject(xSF);
CPPUNIT_ASSERT_MESSAGE("no XSheetFilterDescriptor", xSFD.is());
uno::Sequence<sheet::TableFilterField> xTFF = xSFD->getFilterFields();
const uno::Sequence<sheet::TableFilterField> xTFF = xSFD->getFilterFields();
CPPUNIT_ASSERT_MESSAGE("The gained XSheetFilterDescriptor is empty", xTFF.hasElements());
for (const auto& field : xTFF)
+2 -2
View File
@@ -44,7 +44,7 @@ void XSheetPageBreak::testRemoveAllManualPageBreaks()
xSheetPageBreak->removeAllManualPageBreaks();
uno::Sequence< sheet::TablePageBreakData > xColPageBreak = xSheetPageBreak->getColumnPageBreaks();
const uno::Sequence< sheet::TablePageBreakData > xColPageBreak = xSheetPageBreak->getColumnPageBreaks();
sal_Int32 manualColPageBreaks = 0;
for ( const auto & data : xColPageBreak )
{
@@ -54,7 +54,7 @@ void XSheetPageBreak::testRemoveAllManualPageBreaks()
CPPUNIT_ASSERT_EQUAL_MESSAGE("Found manual column page break",
sal_Int32(0), manualColPageBreaks);
uno::Sequence< sheet::TablePageBreakData > xRowPageBreak = xSheetPageBreak->getRowPageBreaks();
const uno::Sequence< sheet::TablePageBreakData > xRowPageBreak = xSheetPageBreak->getRowPageBreaks();
sal_Int32 manualRowPageBreaks = 0;
for ( const auto & data : xRowPageBreak )
{
+1 -1
View File
@@ -31,7 +31,7 @@ bool isPropertyReadOnly(css::uno::Reference<css::beans::XPropertySet> const& rxP
{
css::uno::Reference<css::beans::XPropertySetInfo> xPropertySetInfo(
rxPropertySet->getPropertySetInfo());
css::uno::Sequence<css::beans::Property> xProperties = xPropertySetInfo->getProperties();
const css::uno::Sequence<css::beans::Property> xProperties = xPropertySetInfo->getProperties();
for (auto const& rProperty : xProperties)
{
+2 -2
View File
@@ -1414,7 +1414,7 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
css::uno::Sequence< css::beans::NamedValue > aProps;
if( anyHandle >>= aProps )
{
for( const css::beans::NamedValue& rProp : aProps )
for( const css::beans::NamedValue& rProp : std::as_const(aProps) )
{
if ( rProp.Name == "WINDOW" )
rProp.Value >>= nWindowHandle;
@@ -1647,7 +1647,7 @@ css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::createSystemChild( con
css::uno::Sequence< css::beans::NamedValue > aProps;
if( Parent >>= aProps )
{
for( const css::beans::NamedValue& rProp : aProps )
for( const css::beans::NamedValue& rProp : std::as_const(aProps) )
{
if ( rProp.Name == "WINDOW" )
rProp.Value >>= nWindowHandle;
+1 -1
View File
@@ -55,7 +55,7 @@ void VCLXWindow::SetSystemParent_Impl( const css::uno::Any& rHandle )
css::uno::Sequence< css::beans::NamedValue > aProps;
if( rHandle >>= aProps )
{
for( const css::beans::NamedValue& rProp : aProps )
for( const css::beans::NamedValue& rProp : std::as_const(aProps) )
{
if ( rProp.Name == "WINDOW" )
rProp.Value >>= nHandle;
+2 -2
View File
@@ -2155,7 +2155,7 @@ void SAL_CALL VCLXListBox::itemListChanged( const EventObject& i_rEvent )
Reference< XItemList > xItemList( i_rEvent.Source, uno::UNO_QUERY_THROW );
uno::Sequence< beans::Pair< OUString, OUString > > aItems = xItemList->getAllItems();
const uno::Sequence< beans::Pair< OUString, OUString > > aItems = xItemList->getAllItems();
for ( const auto& rItem : aItems )
{
OUString aLocalizationKey( rItem.First );
@@ -4615,7 +4615,7 @@ void SAL_CALL VCLXComboBox::itemListChanged( const EventObject& i_rEvent )
Reference< XItemList > xItemList( i_rEvent.Source, uno::UNO_QUERY_THROW );
uno::Sequence< beans::Pair< OUString, OUString > > aItems = xItemList->getAllItems();
const uno::Sequence< beans::Pair< OUString, OUString > > aItems = xItemList->getAllItems();
for ( const auto& rItem : aItems )
{
OUString aLocalizationKey( rItem.First );
@@ -914,7 +914,7 @@ void ControlModelContainerBase::implUpdateGroupStructure()
maGroups.clear();
Sequence< Reference< XControlModel > > aControlModels = getControlModels();
const Sequence< Reference< XControlModel > > aControlModels = getControlModels();
// in extreme we have as much groups as controls
maGroups.reserve( aControlModels.getLength() );
@@ -1436,7 +1436,7 @@ sal_Bool ControlContainerBase::setModel( const Reference< XControlModel >& rxMod
if ( getModel().is() )
{
Sequence< Reference< XControl > > aControls = getControls();
const Sequence< Reference< XControl > > aControls = getControls();
for ( const Reference< XControl >& rCtrl : aControls )
removeControl( rCtrl );
@@ -1460,7 +1460,7 @@ sal_Bool ControlContainerBase::setModel( const Reference< XControlModel >& rxMod
Reference< XNameAccess > xNA( getModel(), UNO_QUERY );
if ( xNA.is() )
{
Sequence< OUString > aNames = xNA->getElementNames();
const Sequence< OUString > aNames = xNA->getElementNames();
Reference< XControlModel > xCtrlModel;
for( const OUString& rName : aNames )
@@ -1818,7 +1818,7 @@ ControlModelContainerBase::updateUserFormChildren( const Reference< XNameContain
// global list of containers
if ( xProps.is() )
xProps->setPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ), uno::makeAny( uno::Reference< XNameContainer >() ) );
Sequence< OUString > aChildNames = xChildContainer->getElementNames();
const Sequence< OUString > aChildNames = xChildContainer->getElementNames();
for ( const auto& rName : aChildNames )
updateUserFormChildren( xAllChildren, rName, Operation, Reference< XControlModel > () );
}
@@ -1834,7 +1834,7 @@ ControlModelContainerBase::updateUserFormChildren( const Reference< XNameContain
Reference< XPropertySet > xProps( xChildContainer, UNO_QUERY );
if ( xProps.is() )
xProps->setPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ), uno::makeAny( xAllChildren ) );
Sequence< OUString > aChildNames = xChildContainer->getElementNames();
const Sequence< OUString > aChildNames = xChildContainer->getElementNames();
for ( const auto& rName : aChildNames )
{
Reference< XControlModel > xChildTarget( xChildContainer->getByName( rName ), UNO_QUERY );
+2 -2
View File
@@ -210,7 +210,7 @@ UnoControlDialogModel::UnoControlDialogModel( const UnoControlDialogModel& rMode
Reference< XNameContainer > xSrcNameCont( const_cast< UnoControlDialogModel& >(rModel).getPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ) ), UNO_QUERY );
Reference<XNameContainer > xNameCont( new SimpleNamedThingContainer< XControlModel > );
uno::Sequence< OUString > sNames = xSrcNameCont->getElementNames();
const uno::Sequence< OUString > sNames = xSrcNameCont->getElementNames();
for ( OUString const & name : sNames )
{
if ( xSrcNameCont->hasByName( name ) )
@@ -792,7 +792,7 @@ void UnoMultiPageControl::createPeer( const Reference< XToolkit > & rxToolkit, c
UnoControlContainer::createPeer( rxToolkit, rParentPeer );
uno::Sequence< uno::Reference< awt::XControl > > aCtrls = getControls();
const uno::Sequence< uno::Reference< awt::XControl > > aCtrls = getControls();
for( const auto& rCtrl : aCtrls )
bindPage( rCtrl );
sal_Int32 nActiveTab(0);
@@ -400,7 +400,7 @@
Reference< XNameContainer > xEventCont = xEventsSupplier->getEvents();
Reference< XNameContainer > xCloneEventCont = xCloneEventsSupplier->getEvents();
css::uno::Sequence< OUString > aNames =
const css::uno::Sequence< OUString > aNames =
xEventCont->getElementNames();
for( const OUString& aName : aNames )
@@ -533,7 +533,7 @@
);
// now loop through our own props
for ( const Property& rProp : aProps )
for ( const Property& rProp : std::as_const(aProps) )
{
// look for the current property in the properties of our aggregate
const Property* pAggPropPos = ::std::find_if( aAggregateProps.begin(), aAggregateProps.end(), PropertyNameEqual( rProp.Name ) );
+2 -2
View File
@@ -96,7 +96,7 @@ bool StdTabController::ImplCreateComponentSequence(
}
bool bOK = true;
for ( const Reference< XControl >& xCtrl : rControls )
for ( const Reference< XControl >& xCtrl : std::as_const(rControls) )
{
// Get the matching control for this model
if ( !xCtrl.is() )
@@ -259,7 +259,7 @@ void StdTabController::autoTabOrder( )
// insert sort algorithm
std::vector< ComponentEntry > aCtrls;
aCtrls.reserve(nCtrls);
for ( const Reference< XWindow >& rComponent : aCompSeq )
for ( const Reference< XWindow >& rComponent : std::as_const(aCompSeq) )
{
XWindow* pC = rComponent.get();
ComponentEntry newEntry;
+1 -1
View File
@@ -308,7 +308,7 @@ void UnoControlTabPageContainer::updateFromModel()
ContainerEvent aEvent;
aEvent.Source = getModel();
Sequence< Reference< XControl > > aControls = getControls();
const Sequence< Reference< XControl > > aControls = getControls();
for ( const Reference< XControl >& rCtrl : aControls )
{
+1 -1
View File
@@ -130,7 +130,7 @@ void SAL_CALL UnoControlTabPageModel::initialize (const Sequence<Any>& rArgument
Reference<container::XNameContainer > xDialogModel = awt::UnoControlDialogModelProvider::create( m_xContext, sURL );
if ( xDialogModel.is() )
{
Sequence< OUString> aNames = xDialogModel->getElementNames();
const Sequence< OUString> aNames = xDialogModel->getElementNames();
for(const OUString& rName : aNames)
{
try
@@ -295,7 +295,7 @@ static void implUpdateVisibility
const uno::Reference< awt::XControlContainer >& xControlContainer
)
{
uno::Sequence< uno::Reference< awt::XControl > >
const uno::Sequence< uno::Reference< awt::XControl > >
aCtrls = xControlContainer->getControls();
bool bCompleteVisible = (nDialogStep == 0);
for( const uno::Reference< awt::XControl >& xControl : aCtrls )
@@ -406,7 +406,7 @@ void UnoControlContainer::dispose( )
maCListeners.disposeAndClear( aDisposeEvent );
uno::Sequence< uno::Reference< awt::XControl > > aCtrls = getControls();
const uno::Sequence< uno::Reference< awt::XControl > > aCtrls = getControls();
for( uno::Reference< awt::XControl > const & control : aCtrls )
{
+2 -2
View File
@@ -344,7 +344,7 @@ css::uno::Any UnoControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
sBankSymbol = aLocaleInfo.getCurrBankSymbol();
// look for the currency entry (for this language) which has the given bank symbol
Sequence< Currency2 > aAllCurrencies = aLocaleInfo.getAllCurrencies();
const Sequence< Currency2 > aAllCurrencies = aLocaleInfo.getAllCurrencies();
OUString sCurrencySymbol = aLocaleInfo.getCurrSymbol();
if ( sBankSymbol.isEmpty() )
@@ -670,7 +670,7 @@ void UnoControlModel::write( const css::uno::Reference< css::io::XObjectOutputSt
rValue >>= aSeq;
long nEntries = aSeq.getLength();
OutStream->writeLong( nEntries );
for ( const auto& rVal : aSeq )
for ( const auto& rVal : std::as_const(aSeq) )
OutStream->writeUTF( rVal );
}
else if ( rType == cppu::UnoType< cppu::UnoSequenceType<cppu::UnoUnsignedShortType> >::get() )
+1 -1
View File
@@ -133,7 +133,7 @@ vcl::Region VCLUnoHelper::GetRegion( const css::uno::Reference< css::awt::XRegio
aRegion = pVCLRegion->GetRegion();
else
{
css::uno::Sequence< css::awt::Rectangle > aRects = rxRegion->getRectangles();
const css::uno::Sequence< css::awt::Rectangle > aRects = rxRegion->getRectangles();
for ( const auto& rRect : aRects )
aRegion.Union( VCLRectangle( rRect ) );
}