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>
This commit is contained in:
Noel Grandin
2019-08-15 11:05:55 +02:00
parent 5827e30109
commit fe00a724a9
17 changed files with 31 additions and 25 deletions

View File

@@ -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();

View File

@@ -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 );

View File

@@ -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 );

View File

@@ -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)

View File

@@ -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);

View File

@@ -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);

View File

@@ -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)
{

View File

@@ -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));
}
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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(

View File

@@ -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;

View File

@@ -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();

View File

@@ -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);

View File

@@ -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 )

View File

@@ -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)
{

View File

@@ -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);