[Libreoffice-commits] core.git: test/source toolkit/source ucb/source unoidl/source unotools/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 20 16:40:10 UTC 2019


 test/source/sheet/functiondescription.cxx  |    4 ++--
 test/source/sheet/sheetsortdescriptor2.cxx |    4 ++--
 toolkit/source/awt/vclxtoolkit.cxx         |    6 +++---
 toolkit/source/controls/unocontrol.cxx     |    2 +-
 toolkit/source/helper/btndlg.cxx           |    4 ++--
 ucb/source/ucp/ftp/ftpcontentprovider.cxx  |    2 +-
 ucb/source/ucp/ftp/ftpurl.cxx              |    2 +-
 unoidl/source/sourceprovider-parser.y      |   26 +++++++++++++-------------
 unoidl/source/unoidl-read.cxx              |    4 ++--
 unoidl/source/unoidl-write.cxx             |    4 ++--
 unotools/source/config/moduleoptions.cxx   |    2 +-
 11 files changed, 30 insertions(+), 30 deletions(-)

New commits:
commit 1d4eb1be35cc393f98496883c2cb4ee89f4bcf0c
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Aug 20 15:54:16 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Aug 20 18:39:11 2019 +0200

    loplugin:constvars in test..unotools
    
    Change-Id: I087dc53ca5c18893974bbd9d959de56d5a4cdfa0
    Reviewed-on: https://gerrit.libreoffice.org/77827
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/test/source/sheet/functiondescription.cxx b/test/source/sheet/functiondescription.cxx
index e629331175ae..5b7aeb5ca99a 100644
--- a/test/source/sheet/functiondescription.cxx
+++ b/test/source/sheet/functiondescription.cxx
@@ -24,13 +24,13 @@ namespace apitest
 {
 void FunctionDescription::testFunctionDescriptionProperties()
 {
-    uno::Sequence<beans::PropertyValue> aFunctionDescription(init());
+    const uno::Sequence<beans::PropertyValue> aFunctionDescription(init());
 
     std::vector<OUString> names;
     // Only test the get/read operation of the values, because set/write operation doesn't
     // make any sense. It doesn't trigger any changes.
     // See discussion: nabble.documentfoundation.org/Testing-UNO-API-service-properties-td4236286.html.
-    for (auto& value : aFunctionDescription)
+    for (const auto& value : aFunctionDescription)
     {
         if (value.Name == "Id")
         {
diff --git a/test/source/sheet/sheetsortdescriptor2.cxx b/test/source/sheet/sheetsortdescriptor2.cxx
index 9f7133f8809a..85ca8706cd4c 100644
--- a/test/source/sheet/sheetsortdescriptor2.cxx
+++ b/test/source/sheet/sheetsortdescriptor2.cxx
@@ -27,13 +27,13 @@ namespace apitest
 void SheetSortDescriptor2::testSheetSortDescriptor2Properties()
 {
     uno::Reference<util::XSortable> xSortable(init(), UNO_QUERY_THROW);
-    uno::Sequence<beans::PropertyValue> values = xSortable->createSortDescriptor();
+    const uno::Sequence<beans::PropertyValue> values = xSortable->createSortDescriptor();
 
     std::vector<OUString> names;
     // Only test the get/read operation of the values, because set/write operation doesn't
     // make any sense. It doesn't trigger any changes.
     // See discussion: nabble.documentfoundation.org/Testing-UNO-API-service-properties-td4236286.html.
-    for (auto& value : values)
+    for (const auto& value : values)
     {
         if (value.Name == "BindFormatsToContent")
         {
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index b385ce385958..7ede778ef9f5 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -2068,7 +2068,7 @@ void VCLXToolkit::callTopWindowListeners(
         {
             css::lang::EventObject aAwtEvent(
                 static_cast< css::awt::XWindow * >(pWindow->GetWindowPeer()));
-            for (css::uno::Reference<XInterface> & i : aListeners)
+            for (const css::uno::Reference<XInterface> & i : aListeners)
             {
                 css::uno::Reference< css::awt::XTopWindowListener >
                       xListener(i, css::uno::UNO_QUERY);
@@ -2111,7 +2111,7 @@ bool VCLXToolkit::callKeyHandlers(::VclSimpleEvent const * pEvent,
             pKeyEvent->GetKeyCode().GetCode(), pKeyEvent->GetCharCode(),
             sal::static_int_cast< sal_Int16 >(
                 pKeyEvent->GetKeyCode().GetFunction()));
-        for (css::uno::Reference<XInterface> & i : aHandlers)
+        for (const css::uno::Reference<XInterface> & i : aHandlers)
         {
             css::uno::Reference< css::awt::XKeyHandler > xHandler(
                 i, css::uno::UNO_QUERY);
@@ -2158,7 +2158,7 @@ void VCLXToolkit::callFocusListeners(::VclSimpleEvent const * pEvent,
                 static_cast< css::awt::XWindow * >(pWindow->GetWindowPeer()),
                 static_cast<sal_Int16>(pWindow->GetGetFocusFlags()),
                 xNext, false);
-            for (css::uno::Reference<XInterface> & i : aListeners)
+            for (const css::uno::Reference<XInterface> & i : aListeners)
             {
                 css::uno::Reference< css::awt::XFocusListener > xListener(
                     i, css::uno::UNO_QUERY);
diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx
index 1881fa374bd3..17aa5d74207d 100644
--- a/toolkit/source/controls/unocontrol.cxx
+++ b/toolkit/source/controls/unocontrol.cxx
@@ -579,7 +579,7 @@ void UnoControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent
         while ( pLangDepProp->pPropName != nullptr )
         {
             bool bMustBeInserted( true );
-            for (PropertyValue & i : aPeerPropertiesToSet)
+            for (const PropertyValue & i : aPeerPropertiesToSet)
             {
                 if ( i.Name.equalsAsciiL(
                         pLangDepProp->pPropName, pLangDepProp->nPropNameLength ))
diff --git a/toolkit/source/helper/btndlg.cxx b/toolkit/source/helper/btndlg.cxx
index 8a19c6041506..f890ddb0fd8b 100644
--- a/toolkit/source/helper/btndlg.cxx
+++ b/toolkit/source/helper/btndlg.cxx
@@ -103,7 +103,7 @@ long ButtonDialog::ImplGetButtonSize()
     long nSepSize = 0;
     maCtrlSize = Size( IMPL_MINSIZE_BUTTON_WIDTH, IMPL_MINSIZE_BUTTON_HEIGHT );
 
-    for (auto & it : m_ItemList)
+    for (const auto & it : m_ItemList)
     {
         nSepSize += nLastSepSize;
 
@@ -203,7 +203,7 @@ void ButtonDialog::ImplPosControls()
 
 IMPL_LINK( ButtonDialog, ImplClickHdl, Button*, pBtn, void )
 {
-    for (auto & it : m_ItemList)
+    for (const auto & it : m_ItemList)
     {
         if ( it->mpPushButton == pBtn )
         {
diff --git a/ucb/source/ucp/ftp/ftpcontentprovider.cxx b/ucb/source/ucp/ftp/ftpcontentprovider.cxx
index 99cb557db1de..c132ef33c888 100644
--- a/ucb/source/ucp/ftp/ftpcontentprovider.cxx
+++ b/ucb/source/ucp/ftp/ftpcontentprovider.cxx
@@ -227,7 +227,7 @@ void FTPContentProvider::forHost( const OUString& host,
                                   OUString& account)
 {
     osl::MutexGuard aGuard(m_aMutex);
-    for(ServerInfo & i : m_ServerInfo)
+    for(const ServerInfo & i : m_ServerInfo)
         if(host == i.host &&
            port == i.port &&
            username == i.username )
diff --git a/ucb/source/ucp/ftp/ftpurl.cxx b/ucb/source/ucp/ftp/ftpurl.cxx
index 3d04a716a82c..2c5a8d5dc9ef 100644
--- a/ucb/source/ucp/ftp/ftpurl.cxx
+++ b/ucb/source/ucp/ftp/ftpurl.cxx
@@ -605,7 +605,7 @@ FTPDirentry FTPURL::direntry() const
 
         std::vector<FTPDirentry> aList = aURL.list(OpenMode::ALL);
 
-        for(FTPDirentry & d : aList) {
+        for(const FTPDirentry & d : aList) {
             if(d.m_aName == nettitle) { // the relevant file is found
                 aDirentry = d;
                 break;
diff --git a/unoidl/source/sourceprovider-parser.y b/unoidl/source/sourceprovider-parser.y
index c867c65551eb..5fb347099ced 100644
--- a/unoidl/source/sourceprovider-parser.y
+++ b/unoidl/source/sourceprovider-parser.y
@@ -1334,7 +1334,7 @@ structMember:
           dynamic_cast<unoidl::detail::SourceProviderPlainStructTypeEntityPad *>(
               ent->pad.get());
       if (p1 != nullptr) {
-          for (auto & i: p1->members) {
+          for (const auto & i: p1->members) {
               if (id == i.name) {
                   error(
                       @3, yyscanner,
@@ -1401,7 +1401,7 @@ structMember:
               p2 = dynamic_cast<unoidl::detail::SourceProviderPolymorphicStructTypeTemplateEntityPad *>(
                   ent->pad.get());
           if (p2 != nullptr) {
-              for (auto & i: p2->members) {
+              for (const auto & i: p2->members) {
                   if (id == i.name) {
                       error(
                           @3, yyscanner,
@@ -1420,7 +1420,7 @@ structMember:
                   = dynamic_cast<unoidl::detail::SourceProviderExceptionTypeEntityPad *>(
                       ent->pad.get());
               assert(p3 != nullptr);
-              for (auto & i: p3->members) {
+              for (const auto & i: p3->members) {
                   if (id == i.name) {
                       error(
                           @3, yyscanner,
@@ -1869,7 +1869,7 @@ methodParam:
       default:
           break;
       }
-      for (auto & i: pad->directMethods.back().parameters) {
+      for (const auto & i: pad->directMethods.back().parameters) {
           if (id == i.name) {
               error(
                   @5, yyscanner,
@@ -2353,7 +2353,7 @@ singleInterfaceBasedServiceDefn:
       assert(pad != nullptr);
       std::vector<unoidl::SingleInterfaceBasedServiceEntity::Constructor> ctors;
       if ($7) {
-          for (auto & i: pad->constructors) {
+          for (const auto & i: pad->constructors) {
               std::vector<unoidl::SingleInterfaceBasedServiceEntity::Constructor::Parameter> parms;
               for (auto & j: i.parameters) {
                   parms.emplace_back(j.name, j.type.getName(), j.rest);
@@ -2392,7 +2392,7 @@ ctor:
       rtl::Reference<unoidl::detail::SourceProviderSingleInterfaceBasedServiceEntityPad>
           pad(getCurrentPad<unoidl::detail::SourceProviderSingleInterfaceBasedServiceEntityPad>(
                   data));
-      for (auto & i: pad->constructors) {
+      for (const auto & i: pad->constructors) {
           if (id == i.name) {
               error(
                   @2, yyscanner,
@@ -2518,7 +2518,7 @@ ctorParam:
                + " rest parameter must be last parameter"));
           YYERROR;
       }
-      for (auto & i: pad->constructors.back().parameters) {
+      for (const auto & i: pad->constructors.back().parameters) {
           if (id == i.name) {
               error(
                   @6, yyscanner,
@@ -2630,7 +2630,7 @@ serviceBase:
       std::vector<unoidl::AnnotatedReference> & v(
           opt
           ? pad->directOptionalBaseServices : pad->directMandatoryBaseServices);
-      for (auto & i: v) {
+      for (const auto & i: v) {
           if (name == i.name) {
               error(
                   @4, yyscanner,
@@ -2707,7 +2707,7 @@ serviceInterfaceBase:
           opt
           ? pad->directOptionalBaseInterfaces
           : pad->directMandatoryBaseInterfaces);
-      for (auto & i: v) {
+      for (const auto & i: v) {
           if (name == i.name) {
               error(
                   @4, yyscanner,
@@ -2794,7 +2794,7 @@ serviceProperty:
       rtl::Reference<unoidl::detail::SourceProviderAccumulationBasedServiceEntityPad>
           pad(getCurrentPad<unoidl::detail::SourceProviderAccumulationBasedServiceEntityPad>(
                   data));
-      for (auto & i: pad->directProperties) {
+      for (const auto & i: pad->directProperties) {
           if (id == i.name) {
               error(
                   @4, yyscanner,
@@ -3477,7 +3477,7 @@ primaryExpr:
           unoidl::detail::SourceProviderEnumTypeEntityPad * p1 = dynamic_cast<
               unoidl::detail::SourceProviderEnumTypeEntityPad *>(pad.get());
           if (p1 != nullptr) {
-              for (auto & j: p1->members) {
+              for (const auto & j: p1->members) {
                   if (j.name == name) {
                       v = unoidl::ConstantValue(j.value);
                       found = true;
@@ -3490,7 +3490,7 @@ primaryExpr:
                       unoidl::detail::SourceProviderConstantGroupEntityPad *>(
                           pad.get());
               if (p2 != nullptr) {
-                  for (auto & j: p2->members) {
+                  for (const auto & j: p2->members) {
                       if (j.name == name) {
                           v = j.value;
                           found = true;
@@ -3538,7 +3538,7 @@ primaryExpr:
                           unoidl::detail::SourceProviderConstantGroupEntityPad *>(
                               ent->pad.get());
                   if (pad != nullptr) {
-                      for (auto & j: pad->members) {
+                      for (const auto & j: pad->members) {
                           if (j.name == id) {
                               v = j.value;
                               found = true;
diff --git a/unoidl/source/unoidl-read.cxx b/unoidl/source/unoidl-read.cxx
index 6414fb376a1c..2cd44aceefa5 100644
--- a/unoidl/source/unoidl-read.cxx
+++ b/unoidl/source/unoidl-read.cxx
@@ -204,7 +204,7 @@ void insertTypeDependency(
     OUString nucl(decomposeType(type, &rank, &args, &entity));
     if (entity) {
         insertEntityDependency(manager, iterator, nucl, true);
-        for (auto & i: args) {
+        for (const auto & i: args) {
             insertTypeDependency(manager, iterator, i);
         }
     }
@@ -1041,7 +1041,7 @@ SAL_IMPLEMENT_MAIN() {
         scanMap(mgr, prov->createRootCursor(), published, "", ents);
         std::vector<OUString> sorted(sort(ents));
         std::vector<OUString> mods;
-        for (auto & i: sorted) {
+        for (const auto & i: sorted) {
             writeEntity(ents, mods, i);
         }
         closeModules(mods, mods.size());
diff --git a/unoidl/source/unoidl-write.cxx b/unoidl/source/unoidl-write.cxx
index ef3d888b66d6..3f51b68c07dd 100644
--- a/unoidl/source/unoidl-write.cxx
+++ b/unoidl/source/unoidl-write.cxx
@@ -713,7 +713,7 @@ sal_uInt64 writeMap(
                 write32(file, cmap.size());
                     // overflow from std::map::size_type -> sal_uInt64 is
                     // unrealistic
-                for (auto & j: cmap) {
+                for (const auto & j: cmap) {
                     write32(file, j.second.nameOffset);
                     write32(file, j.second.dataOffset);
                 }
@@ -846,7 +846,7 @@ sal_uInt64 writeMap(
         *rootSize = map.size();
             // overflow from std::map::size_type -> std::size_t is unrealistic
     }
-    for (auto & i: map) {
+    for (const auto & i: map) {
         write32(file, i.second.nameOffset);
         write32(file, i.second.dataOffset);
     }
diff --git a/unotools/source/config/moduleoptions.cxx b/unotools/source/config/moduleoptions.cxx
index a3881ffc06da..ffdfb3008d2e 100644
--- a/unotools/source/config/moduleoptions.cxx
+++ b/unotools/source/config/moduleoptions.cxx
@@ -416,7 +416,7 @@ css::uno::Sequence < OUString > SvtModuleOptions_Impl::GetAllServiceNames()
 {
     std::vector<OUString> aVec;
 
-    for( auto & rFactory : m_lFactories )
+    for( const auto & rFactory : m_lFactories )
         if( rFactory.getInstalled() )
             aVec.push_back( rFactory.getFactory() );
 


More information about the Libreoffice-commits mailing list