[Libreoffice-commits] core.git: basctl/source basegfx/source chart2/source cui/source editeng/source extensions/source oox/source sc/source sdext/source sd/source sfx2/source slideshow/source svx/source sw/source UnoControls/source vcl/backendtest vcl/headless vcl/source vcl/unx writerfilter/source xmloff/source xmlscript/source xmlsecurity/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Sep 15 10:43:57 UTC 2021


 UnoControls/source/base/basecontainercontrol.cxx                   |    4 ++--
 basctl/source/dlged/dlgedfunc.cxx                                  |    2 +-
 basegfx/source/polygon/b2dpolygontools.cxx                         |    2 +-
 basegfx/source/polygon/b3dpolygontools.cxx                         |    2 +-
 chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx |    4 ++--
 chart2/source/view/charttypes/VSeriesPlotter.cxx                   |    2 +-
 cui/source/dialogs/GraphicTestsDialog.cxx                          |    2 +-
 editeng/source/editeng/eerdll.cxx                                  |    2 +-
 editeng/source/editeng/impedit3.cxx                                |    2 +-
 extensions/source/propctrlr/propertyeditor.cxx                     |    6 +++---
 oox/source/export/chartexport.cxx                                  |    2 +-
 oox/source/export/drawingml.cxx                                    |    2 +-
 sc/source/core/tool/chartpos.cxx                                   |    2 +-
 sc/source/ui/cctrl/checklistmenu.cxx                               |    2 +-
 sd/source/core/CustomAnimationEffect.cxx                           |    2 +-
 sd/source/ui/animations/CustomAnimationList.cxx                    |    2 +-
 sd/source/ui/animations/CustomAnimationPane.cxx                    |    4 ++--
 sd/source/ui/view/drviews4.cxx                                     |    2 +-
 sdext/source/presenter/PresenterToolBar.cxx                        |    2 +-
 sfx2/source/control/listview.cxx                                   |    2 +-
 sfx2/source/sidebar/Deck.cxx                                       |    2 +-
 slideshow/source/engine/box2dtools.cxx                             |    2 +-
 svx/source/tbxctrls/StylesPreviewWindow.cxx                        |    2 +-
 svx/source/xml/xmlxtimp.cxx                                        |    2 +-
 sw/source/core/doc/docnew.cxx                                      |    2 +-
 sw/source/core/fields/authfld.cxx                                  |    2 +-
 sw/source/core/model/SearchResultLocator.cxx                       |    2 +-
 vcl/backendtest/GraphicsRenderTests.cxx                            |    2 +-
 vcl/headless/svpgdi.cxx                                            |    4 ++--
 vcl/source/app/salvtables.cxx                                      |    2 +-
 vcl/source/control/button.cxx                                      |    2 +-
 vcl/source/control/imivctl1.cxx                                    |    2 +-
 vcl/source/gdi/pdfwriter_impl.cxx                                  |    2 +-
 vcl/source/window/dialog.cxx                                       |    2 +-
 vcl/source/window/printdlg.cxx                                     |    4 ++--
 vcl/unx/generic/fontmanager/fontconfig.cxx                         |    2 +-
 vcl/unx/gtk3/gtkinst.cxx                                           |    2 +-
 writerfilter/source/dmapper/StyleSheetTable.cxx                    |    4 ++--
 writerfilter/source/rtftok/rtfreferencetable.cxx                   |    2 +-
 xmloff/source/chart/SchXMLExport.cxx                               |    4 ++--
 xmloff/source/chart/SchXMLPlotAreaContext.cxx                      |    2 +-
 xmloff/source/draw/shapeimport.cxx                                 |    2 +-
 xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx                 |    2 +-
 xmlsecurity/source/gpg/SecurityEnvironment.cxx                     |    2 +-
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx      |    2 +-
 45 files changed, 54 insertions(+), 54 deletions(-)

New commits:
commit 3a1a448ac4a04137705ea0aaf0163358fd2e5549
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Sep 15 10:58:18 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Sep 15 12:43:21 2021 +0200

    loplugin:constvars
    
    Change-Id: I9b35d6333afa6b305bf73fc55a7e60c8365674e9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122134
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/UnoControls/source/base/basecontainercontrol.cxx b/UnoControls/source/base/basecontainercontrol.cxx
index a440505149ed..a20059d100b8 100644
--- a/UnoControls/source/base/basecontainercontrol.cxx
+++ b/UnoControls/source/base/basecontainercontrol.cxx
@@ -309,7 +309,7 @@ Reference< XControl > SAL_CALL BaseContainerControl::getControl ( const OUString
     MutexGuard  aGuard ( Mutex::getGlobalMutex() );
 
     // Search for right control
-    for( IMPL_ControlInfo& rSearchControl : maControlInfoList )
+    for( const IMPL_ControlInfo& rSearchControl : maControlInfoList )
     {
         if ( rSearchControl.sName == rName )
         {
@@ -336,7 +336,7 @@ Sequence< Reference< XControl > > SAL_CALL BaseContainerControl::getControls ()
     Reference< XControl > *             pDestination    = aDescriptor.getArray ();
 
     // Copy controls to sequence
-    for( IMPL_ControlInfo& rCopyControl : maControlInfoList )
+    for( const IMPL_ControlInfo& rCopyControl : maControlInfoList )
     {
         pDestination [ nCount++ ] = rCopyControl.xControl;
     }
diff --git a/basctl/source/dlged/dlgedfunc.cxx b/basctl/source/dlged/dlgedfunc.cxx
index 593f0370f635..da0a20bbaf55 100644
--- a/basctl/source/dlged/dlgedfunc.cxx
+++ b/basctl/source/dlged/dlgedfunc.cxx
@@ -41,7 +41,7 @@ void DlgEdFunc::ForceScroll( const Point& rPos )
 
     vcl::Window& rWindow  = rParent.GetWindow();
 
-    static Point aDefPoint;
+    static const Point aDefPoint;
     tools::Rectangle aOutRect( aDefPoint, rWindow.GetOutputSizePixel() );
     aOutRect = rWindow.PixelToLogic( aOutRect );
 
diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx
index 6e78aed363e1..d4644a6f0606 100644
--- a/basegfx/source/polygon/b2dpolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolygontools.cxx
@@ -1235,7 +1235,7 @@ namespace basegfx::utils
             // precalculate maximal acceptable length of candidate polygon assuming
             // we want to create a maximum of fNumberOfAllowedSnippets. For
             // fNumberOfAllowedSnippets use ca. 65536, double due to line & gap.
-            static double fNumberOfAllowedSnippets(65535.0 * 2.0);
+            static const double fNumberOfAllowedSnippets(65535.0 * 2.0);
             const double fAllowedLength((fNumberOfAllowedSnippets * fDotDashLength) / double(rDotDashArray.size()));
             const double fCandidateLength(basegfx::utils::getLength(rCandidate));
             std::vector<double> aDotDashArray(rDotDashArray);
diff --git a/basegfx/source/polygon/b3dpolygontools.cxx b/basegfx/source/polygon/b3dpolygontools.cxx
index 1282ddbd216e..377b05802986 100644
--- a/basegfx/source/polygon/b3dpolygontools.cxx
+++ b/basegfx/source/polygon/b3dpolygontools.cxx
@@ -199,7 +199,7 @@ namespace basegfx::utils
             // we want to create a maximum of fNumberOfAllowedSnippets. In 3D
             // use less for fNumberOfAllowedSnippets, ca. 6553.6, double due to line & gap.
             // Less in 3D due to potentially blowing up to rounded line segments.
-            static double fNumberOfAllowedSnippets(6553.5 * 2.0);
+            static const double fNumberOfAllowedSnippets(6553.5 * 2.0);
             const double fAllowedLength((fNumberOfAllowedSnippets * fDotDashLength) / double(rDotDashArray.size()));
             const double fCandidateLength(basegfx::utils::getLength(rCandidate));
             std::vector<double> aDotDashArray(rDotDashArray);
diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
index fccdee2ac33e..92a5e591cf4f 100644
--- a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
@@ -248,7 +248,7 @@ DataPointItemConverter::DataPointItemConverter(
     uno::Reference<beans::XPropertySet> xSeriesProp(xSeries, uno::UNO_QUERY);
     uno::Sequence<sal_Int32> deletedLegendEntriesSeq;
     xSeriesProp->getPropertyValue("DeletedLegendEntries") >>= deletedLegendEntriesSeq;
-    for (auto& deletedLegendEntry : deletedLegendEntriesSeq)
+    for (const auto& deletedLegendEntry : std::as_const(deletedLegendEntriesSeq))
     {
         if (nPointIndex == deletedLegendEntry)
         {
@@ -573,7 +573,7 @@ bool DataPointItemConverter::ApplySpecialItem(
                 Reference<beans::XPropertySet> xSeriesProp(m_xSeries, uno::UNO_QUERY);
                 xSeriesProp->getPropertyValue("DeletedLegendEntries") >>= deletedLegendEntriesSeq;
                 std::vector<sal_Int32> deletedLegendEntries;
-                for (auto& deletedLegendEntry : deletedLegendEntriesSeq)
+                for (const auto& deletedLegendEntry : std::as_const(deletedLegendEntriesSeq))
                 {
                     if (bHideLegendEntry || m_nPointIndex != deletedLegendEntry)
                         deletedLegendEntries.push_back(deletedLegendEntry);
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index dd3fec5bd61a..fe460c170df2 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -2713,7 +2713,7 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries(
             for( sal_Int32 nIdx=0; nIdx<aCategoryNames.getLength(); ++nIdx )
             {
                 bool deletedLegendEntry = false;
-                for (auto& deletedLegendEntryIdx : deletedLegendEntries)
+                for (const auto& deletedLegendEntryIdx : std::as_const(deletedLegendEntries))
                 {
                     if (nIdx == deletedLegendEntryIdx)
                     {
diff --git a/cui/source/dialogs/GraphicTestsDialog.cxx b/cui/source/dialogs/GraphicTestsDialog.cxx
index 8cacba0d1607..555ef3bd888c 100644
--- a/cui/source/dialogs/GraphicTestsDialog.cxx
+++ b/cui/source/dialogs/GraphicTestsDialog.cxx
@@ -68,7 +68,7 @@ short GraphicsTestsDialog::run()
                           + "\n(Click on any test to view its resultant bitmap image)";
     m_xResultLog->set_text(aResultLog);
     sal_Int32 nTestNumber = 0;
-    for (VclTestResult& test : aTestObject.getTestResults())
+    for (const VclTestResult& test : aTestObject.getTestResults())
     {
         auto xGpTest = std::make_unique<GraphicTestEntry>(m_xContainerBox.get(), m_xDialog.get(),
                                                           test.getTestName(), test.getStatus(),
diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx
index 5e6929ec33a1..2ec4519b6446 100644
--- a/editeng/source/editeng/eerdll.cxx
+++ b/editeng/source/editeng/eerdll.cxx
@@ -152,7 +152,7 @@ DefItems::DefItems()
 
 DefItems::~DefItems()
 {
-    for (auto& rItem : mvDefItems)
+    for (const auto& rItem : mvDefItems)
         delete rItem;
 }
 
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 7b4a96412181..94d838a4de8a 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -730,7 +730,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
 
     EditLine* pLine = &rParaPortion.GetLines()[nLine];
 
-    static tools::Rectangle aZeroArea { Point(), Point() };
+    static const tools::Rectangle aZeroArea { Point(), Point() };
     tools::Rectangle aBulletArea( aZeroArea );
     if ( !nLine )
     {
diff --git a/extensions/source/propctrlr/propertyeditor.cxx b/extensions/source/propctrlr/propertyeditor.cxx
index 36131848c403..3c94a3a24bf3 100644
--- a/extensions/source/propctrlr/propertyeditor.cxx
+++ b/extensions/source/propctrlr/propertyeditor.cxx
@@ -79,7 +79,7 @@ namespace pcr
     void OPropertyEditor::CommitModified()
     {
         // commit all of my pages, if necessary
-        for (auto& page : m_aShownPages)
+        for (const auto& page : m_aShownPages)
         {
             OBrowserPage* pPage = page.second.xPage.get();
             if (pPage && pPage->getListBox().IsModified() )
@@ -318,7 +318,7 @@ namespace pcr
 
     void OPropertyEditor::EnablePropertyControls( const OUString& rEntryName, sal_Int16 nControls, bool bEnable )
     {
-        for (auto& rPage : m_aShownPages)
+        for (const auto& rPage : m_aShownPages)
         {
             OBrowserPage* pPage = rPage.second.xPage.get();
             if (pPage)
@@ -328,7 +328,7 @@ namespace pcr
 
     void OPropertyEditor::EnablePropertyLine( const OUString& rEntryName, bool bEnable )
     {
-        for (auto& rPage : m_aShownPages)
+        for (const auto& rPage : m_aShownPages)
         {
             OBrowserPage* pPage = rPage.second.xPage.get();
             if (pPage)
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 0e905ee7ba15..e2052dc93909 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1351,7 +1351,7 @@ void ChartExport::exportLegend( const Reference< css::chart::XChartDocument >& x
                     {
                         Sequence<sal_Int32> deletedLegendEntriesSeq;
                         aSeriesProp.getProperty(deletedLegendEntriesSeq, PROP_DeletedLegendEntries);
-                        for (auto& deletedLegendEntry : deletedLegendEntriesSeq)
+                        for (const auto& deletedLegendEntry : std::as_const(deletedLegendEntriesSeq))
                         {
                             pFS->startElement(FSNS(XML_c, XML_legendEntry));
                             pFS->singleElement(FSNS(XML_c, XML_idx), XML_val,
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index e9492fde0b48..2f8043aad2e7 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -3284,7 +3284,7 @@ void DrawingML::WriteText(const Reference<XInterface>& rXIface, bool bBodyPr, bo
                 }
                 if (bUpright)
                 {
-                    for (auto& aProp : aGrabBag)
+                    for (const auto& aProp : std::as_const(aGrabBag))
                     {
                         if (aProp.Name == "nShapeRotationAtImport")
                             aProp.Value >>= nOldShapeRotation;
diff --git a/sc/source/core/tool/chartpos.cxx b/sc/source/core/tool/chartpos.cxx
index 6ba4a4609f6b..4c93be995b29 100644
--- a/sc/source/core/tool/chartpos.cxx
+++ b/sc/source/core/tool/chartpos.cxx
@@ -424,7 +424,7 @@ void ScChartPositioner::CreatePositionMap()
         {   // fill gaps with Dummies, first column is master
             RowMap& rFirstCol = aColMap.begin()->second;
 
-            for ( auto& it1 : rFirstCol )
+            for ( const auto& it1 : rFirstCol )
             {
                 sal_uLong nKey = it1.first;
                 for (ColumnMap::iterator it2 = ++aColMap.begin(); it2 != aColMap.end(); ++it2 )
diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx
index 60e57b59f72e..c6ef7d8bf9b6 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -1296,7 +1296,7 @@ size_t ScCheckListMenuControl::initMembers(int nMaxMemberWidth)
 
         mpChecks->thaw();
 
-        for (auto& rRow : aExpandRows)
+        for (const auto& rRow : aExpandRows)
             mpChecks->expand_row(*rRow);
     }
 
diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx
index 3e7d26ff8065..f3a4291f9ea6 100644
--- a/sd/source/core/CustomAnimationEffect.cxx
+++ b/sd/source/core/CustomAnimationEffect.cxx
@@ -2409,7 +2409,7 @@ void EffectSequenceHelper::updateTextGroups()
     maGroupMap.clear();
 
     // first create all the groups
-    for( CustomAnimationEffectPtr& pEffect : maEffects )
+    for( const CustomAnimationEffectPtr& pEffect : maEffects )
     {
         const sal_Int32 nGroupId = pEffect->getGroupId();
 
diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx
index 13a4fb652e29..a6bfbdfab8d7 100644
--- a/sd/source/ui/animations/CustomAnimationList.cxx
+++ b/sd/source/ui/animations/CustomAnimationList.cxx
@@ -1015,7 +1015,7 @@ IMPL_LINK_NOARG(CustomAnimationList, PostCollapseHdl, void*, void)
     mxTreeView->unselect_all();
 
     // Restore selection state for entries which are still visible
-    for (auto &pEntry : lastSelectedEntries)
+    for (const auto &pEntry : lastSelectedEntries)
     {
         if (weld::IsEntryVisible(*mxTreeView, *pEntry))
             mxTreeView->select(*pEntry);
diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx
index 8bae65604b1a..f96d2f8f7133 100644
--- a/sd/source/ui/animations/CustomAnimationPane.cxx
+++ b/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -2204,7 +2204,7 @@ sal_Int32 CustomAnimationPane::fillAnimationLB( bool bHasText )
         mxLBAnimation->set_text_emphasis(mnFreeformPathPos, false, 0);
     }
 
-    for (PresetCategoryPtr& pCategory : rCategoryList)
+    for (const PresetCategoryPtr& pCategory : rCategoryList)
     {
         if( pCategory )
         {
@@ -2215,7 +2215,7 @@ sal_Int32 CustomAnimationPane::fillAnimationLB( bool bHasText )
             std::vector< CustomAnimationPresetPtr > aSortedVector =
                 pCategory->maEffects;
 
-            for( CustomAnimationPresetPtr& pDescriptor : aSortedVector )
+            for( const CustomAnimationPresetPtr& pDescriptor : aSortedVector )
             {
                 // ( !isTextOnly || ( isTextOnly && bHasText ) ) <=> !isTextOnly || bHasText
                 if( pDescriptor && ( !pDescriptor->isTextOnly() || bHasText ) )
diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx
index 7cf042178d73..bcfcc452713d 100644
--- a/sd/source/ui/view/drviews4.cxx
+++ b/sd/source/ui/view/drviews4.cxx
@@ -123,7 +123,7 @@ void DrawViewShell::DeleteActualPage()
                 pagesToDelete.push_back(xPage);
             }
         }
-        for (auto &xPage: pagesToDelete)
+        for (const auto &xPage: pagesToDelete)
         {
             xPages->remove(xPage);
         }
diff --git a/sdext/source/presenter/PresenterToolBar.cxx b/sdext/source/presenter/PresenterToolBar.cxx
index cb638c601dbd..291ba59e5e70 100644
--- a/sdext/source/presenter/PresenterToolBar.cxx
+++ b/sdext/source/presenter/PresenterToolBar.cxx
@@ -415,7 +415,7 @@ void SAL_CALL PresenterToolBar::disposing()
     for (const auto& rxPart : maElementContainer)
     {
         OSL_ASSERT(rxPart != nullptr);
-        for (rtl::Reference<Element>& pElement : *rxPart)
+        for (const rtl::Reference<Element>& pElement : *rxPart)
         {
             if (pElement)
             {
diff --git a/sfx2/source/control/listview.cxx b/sfx2/source/control/listview.cxx
index 6aa657e7e7e4..725d7564bbe8 100644
--- a/sfx2/source/control/listview.cxx
+++ b/sfx2/source/control/listview.cxx
@@ -285,7 +285,7 @@ void ListView::clearListView()
 IMPL_LINK(ListView, QueryTooltipHdl, const weld::TreeIter&, rIter, OUString)
 {
     OUString sId = mxTreeView->get_id(rIter);
-    for (auto& pItem : mListViewItems)
+    for (const auto& pItem : mListViewItems)
     {
         if (pItem->maId == sId)
             return pItem->maDisplayPath;
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 2267b222d82e..450cfe57fe19 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -138,7 +138,7 @@ void Deck::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
         rJsonWriter.put("visible", false);
 
     auto childrenNode = rJsonWriter.startArray("children");
-    for (auto &it : maPanels)
+    for (const auto &it : maPanels)
     {
         // collapse the panel itself out
         auto xContent = it->GetContents();
diff --git a/slideshow/source/engine/box2dtools.cxx b/slideshow/source/engine/box2dtools.cxx
index 8aeb46ac318f..cb365165a274 100644
--- a/slideshow/source/engine/box2dtools.cxx
+++ b/slideshow/source/engine/box2dtools.cxx
@@ -743,7 +743,7 @@ Box2DBodySharedPtr box2DWorld::createStaticBody(const slideshow::internal::Shape
     {
         basegfx::triangulator::B2DTriangleVector aTriangleVector;
         // iterate over the polygons of the shape and create representations for them
-        for (auto& rPolygon : aPolyPolygon)
+        for (const auto& rPolygon : std::as_const(aPolyPolygon))
         {
             // if the polygon is closed it will be represented by triangles
             if (rPolygon.isClosed())
diff --git a/svx/source/tbxctrls/StylesPreviewWindow.cxx b/svx/source/tbxctrls/StylesPreviewWindow.cxx
index 5a31cf88a276..a90612c0b3c8 100644
--- a/svx/source/tbxctrls/StylesPreviewWindow.cxx
+++ b/svx/source/tbxctrls/StylesPreviewWindow.cxx
@@ -462,7 +462,7 @@ void StylesPreviewWindow_Base::UpdateStylesList()
     }
 
     m_xStylesView->clear();
-    for (auto& rStyle : m_aAllStyles)
+    for (const auto& rStyle : m_aAllStyles)
     {
         ScopedVclPtr<VirtualDevice> pImg = VclPtr<VirtualDevice>::Create();
         const Size aSize(100, 30);
diff --git a/svx/source/xml/xmlxtimp.cxx b/svx/source/xml/xmlxtimp.cxx
index f3d0785e0fdb..9bf7b6996b43 100644
--- a/svx/source/xml/xmlxtimp.cxx
+++ b/svx/source/xml/xmlxtimp.cxx
@@ -142,7 +142,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler >
     try
     {
         rtl::Reference<sax_fastparser::FastAttributeList> xFastList = new sax_fastparser::FastAttributeList(nullptr);
-        for (auto& aIter : aTmpAttrList)
+        for (const auto& aIter : aTmpAttrList)
             xFastList->add(aIter.first, aIter.second);
 
         Any aAny;
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 8d449d3382a6..d64c23f044d7 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -469,7 +469,7 @@ SwDoc::~SwDoc()
         delete pTmp;
     }
 
-    for(auto& pType : *mpTOXTypes)
+    for(const auto& pType : *mpTOXTypes)
         pType->CallSwClientNotify(sw::DocumentDyingHint());
     mpTOXTypes->clear();
     mpDefTOXBases.reset();
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx
index fec3e1a2b4c4..a754e8bce767 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -112,7 +112,7 @@ SwAuthEntry* SwAuthorityFieldType::AddField(const OUString& rFieldContents)
         pEntry->SetAuthorField( static_cast<ToxAuthorityField>(i),
                         rFieldContents.getToken( 0, TOX_STYLE_DELIMITER, nIdx ));
 
-    for (auto &rpTemp : m_DataArr)
+    for (const auto &rpTemp : m_DataArr)
     {
         if (*rpTemp == *pEntry)
         {
diff --git a/sw/source/core/model/SearchResultLocator.cxx b/sw/source/core/model/SearchResultLocator.cxx
index 435f0110aedf..79ba42a97b7c 100644
--- a/sw/source/core/model/SearchResultLocator.cxx
+++ b/sw/source/core/model/SearchResultLocator.cxx
@@ -104,7 +104,7 @@ bool SearchResultLocator::tryParseJSON(const char* pPayload,
         return false;
     }
 
-    for (auto& rEachNode : boost::make_iterator_range(aTree.equal_range("")))
+    for (const auto& rEachNode : boost::make_iterator_range(aTree.equal_range("")))
     {
         auto const& rEach = rEachNode.second;
 
diff --git a/vcl/backendtest/GraphicsRenderTests.cxx b/vcl/backendtest/GraphicsRenderTests.cxx
index 7928c06e2fb0..dc4483442fd6 100644
--- a/vcl/backendtest/GraphicsRenderTests.cxx
+++ b/vcl/backendtest/GraphicsRenderTests.cxx
@@ -2125,7 +2125,7 @@ std::vector<VclTestResult>& GraphicsRenderTests::getTestResults() { return m_aTe
 OUString GraphicsRenderTests::getResultString()
 {
     std::vector<int> testResults(4);
-    for (VclTestResult& test : m_aTestResult)
+    for (const VclTestResult& test : m_aTestResult)
     {
         if (test.getStatus() == "PASSED")
         {
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index c87a90e3fbf9..316349088e9e 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -589,7 +589,7 @@ namespace
     // MM02 decide to use buffers or not
     const char* pDisableMM02Goodies(getenv("SAL_DISABLE_MM02_GOODIES"));
     bool bUseBuffer(nullptr == pDisableMM02Goodies);
-    tools::Long nMinimalSquareSizeToBuffer(64*64);
+    const tools::Long nMinimalSquareSizeToBuffer(64*64);
 
     void tryToUseSourceBuffer(
         const SalBitmap& rSourceBitmap,
@@ -1627,7 +1627,7 @@ bool SvpSalGraphics::drawPolyLine(
     assert(!bStrokeUsed || (bStrokeUsed && pStroke));
 
     // MM01 decide if to stroke directly
-    static bool bDoDirectCairoStroke(true);
+    static const bool bDoDirectCairoStroke(true);
 
     // MM01 activate to stroke directly
     if(bDoDirectCairoStroke && bStrokeUsed)
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 61eacb855af4..5a907cd45e8e 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -1126,7 +1126,7 @@ IMPL_LINK(SalInstanceToolbar, MenuToggleListener, VclWindowEvent&, rEvent, void)
 {
     if (rEvent.GetId() == VclEventId::WindowEndPopupMode)
     {
-        for (auto& rFloat : m_aFloats)
+        for (const auto& rFloat : m_aFloats)
         {
             if (rEvent.GetWindow() == rFloat.second)
             {
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 0554bcfb3446..cb7581b35c76 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -2949,7 +2949,7 @@ void RadioButton::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
 
     OUString sGroupId;
     std::vector<VclPtr<RadioButton>> aGroup = GetRadioButtonGroup();
-    for(auto& pButton : aGroup)
+    for(const auto& pButton : aGroup)
         sGroupId += pButton->get_id();
 
     if (!sGroupId.isEmpty())
diff --git a/vcl/source/control/imivctl1.cxx b/vcl/source/control/imivctl1.cxx
index 2eae406b4299..0e828a941662 100644
--- a/vcl/source/control/imivctl1.cxx
+++ b/vcl/source/control/imivctl1.cxx
@@ -451,7 +451,7 @@ void SvxIconChoiceCtrl_Impl::Arrange( bool bKeepPredecessors, tools::Long nSetMa
 
 void SvxIconChoiceCtrl_Impl::ImpArrange( bool bKeepPredecessors )
 {
-    static Point aEmptyPoint;
+    static const Point aEmptyPoint;
 
     bool bOldUpdate = bUpdateMode;
     tools::Rectangle aCurOutputArea( GetOutputRect() );
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 31aea83a9685..2aa85ce2075c 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -4461,7 +4461,7 @@ bool PDFWriterImpl::emitAnnotations()
 
 bool PDFWriterImpl::emitEmbeddedFiles()
 {
-    for (auto& rEmbeddedFile : m_aEmbeddedFiles)
+    for (const auto& rEmbeddedFile : m_aEmbeddedFiles)
     {
         if (!updateObject(rEmbeddedFile.m_nObject))
             continue;
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 1a4d179e1809..a3ae03980540 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -1678,7 +1678,7 @@ void Dialog::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
 
     {
         auto aResponses = rJsonWriter.startArray("responses");
-        for (auto& rResponse : mpDialogImpl->maResponses)
+        for (const auto& rResponse : mpDialogImpl->maResponses)
         {
             auto aResponse = rJsonWriter.startStruct();
             rJsonWriter.put("id", rResponse.first->get_id());
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index c6fde48ef28c..6f1e2a008c2d 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -379,7 +379,7 @@ void PrintDialog::PrintPreviewWindow::preparePreviewBitmap()
     // gets really bad for FormControls starting by a scale factor
     // smaller than 0.2 - that makes the ClipRegion overlap start.
     // So - for now - try not to go below that.
-    static double fMinimumScale(0.2);
+    static const double fMinimumScale(0.2);
     double fFactor(0.0);
     if(fScale < fMinimumScale)
     {
@@ -395,7 +395,7 @@ void PrintDialog::PrintPreviewWindow::preparePreviewBitmap()
         // necessary, also empirically estimated to
         // avoid the quality from collapsing (using a direct
         // in-between , ceil'd result)
-        static double fMaximumQualitySquare(1396221.0);
+        static const double fMaximumQualitySquare(1396221.0);
 
         if(fNewNeededPixels > fMaximumQualitySquare)
         {
diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx
index 18a0408d34ae..9ae5004d5256 100644
--- a/vcl/unx/generic/fontmanager/fontconfig.cxx
+++ b/vcl/unx/generic/fontmanager/fontconfig.cxx
@@ -668,7 +668,7 @@ void PrintFontManager::countFontconfigFonts( std::unordered_map<OString, int>& o
                 if( eIndexRes == FcResultMatch && nEntryId != -1 )
                 {
                     int nCollectionEntry = GetCollectionIndex(nEntryId);
-                    for (auto & font : aFonts)
+                    for (const auto & font : aFonts)
                     {
                         if( font.m_nCollectionEntry == nCollectionEntry )
                         {
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 79e22ea4fb3d..3899bb35c29f 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -10913,7 +10913,7 @@ private:
 
     void signal_item_toggled(GtkToggleButton* pItem)
     {
-        for (auto& a : m_aMenuButtonMap)
+        for (const auto& a : m_aMenuButtonMap)
         {
             if (a.second->getWidget() == GTK_WIDGET(pItem))
             {
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index f1f14ee493e9..f1d1df4496b5 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -901,7 +901,7 @@ void StyleSheetTable::ApplyNumberingStyleNameToParaStyles()
         if ( !xParaStyles.is() )
             return;
 
-        for ( auto& pEntry : m_pImpl->m_aStyleSheetEntries )
+        for ( const auto& pEntry : m_pImpl->m_aStyleSheetEntries )
         {
             StyleSheetPropertyMap* pStyleSheetProperties = nullptr;
             if ( pEntry->nStyleTypeCode == STYLE_TYPE_PARA && (pStyleSheetProperties = pEntry->pProperties.get()) )
@@ -954,7 +954,7 @@ void StyleSheetTable::ReApplyInheritedOutlineLevelFromChapterNumbering()
         if (!xParaStyles.is())
             return;
 
-        for (auto& pEntry : m_pImpl->m_aStyleSheetEntries)
+        for (const auto& pEntry : m_pImpl->m_aStyleSheetEntries)
         {
             if (pEntry->nStyleTypeCode != STYLE_TYPE_PARA || pEntry->sBaseStyleIdentifier.isEmpty())
                 continue;
diff --git a/writerfilter/source/rtftok/rtfreferencetable.cxx b/writerfilter/source/rtftok/rtfreferencetable.cxx
index ffa9eddaec9a..1a70a93d9bf8 100644
--- a/writerfilter/source/rtftok/rtfreferencetable.cxx
+++ b/writerfilter/source/rtftok/rtfreferencetable.cxx
@@ -20,7 +20,7 @@ RTFReferenceTable::~RTFReferenceTable() = default;
 
 void RTFReferenceTable::resolve(Table& rHandler)
 {
-    for (auto& rEntry : m_aEntries)
+    for (const auto& rEntry : m_aEntries)
         rHandler.entry(rEntry.first, rEntry.second);
 }
 
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index 65510e036ac2..68e23a5616a9 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -3646,7 +3646,7 @@ void SchXMLExportHelper_Impl::exportDataPoints(
                 mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_REPEATED,
                                     OUString::number( aLastPoint.mnRepeat ));
 
-            for (auto& deletedLegendEntry : deletedLegendEntriesSeq)
+            for (const auto& deletedLegendEntry : std::as_const(deletedLegendEntriesSeq))
             {
                 if (nIndex == deletedLegendEntry)
                 {
@@ -3672,7 +3672,7 @@ void SchXMLExportHelper_Impl::exportDataPoints(
         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_REPEATED,
                             OUString::number( aLastPoint.mnRepeat ));
 
-    for (auto& deletedLegendEntry : deletedLegendEntriesSeq)
+    for (const auto& deletedLegendEntry : std::as_const(deletedLegendEntriesSeq))
     {
         if (nIndex == deletedLegendEntry)
         {
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
index a66b05d0661b..3d2b9495c643 100644
--- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
@@ -757,7 +757,7 @@ void SchXMLDataPointContext::startFastElement (sal_Int32 /*Element*/,
                     Reference<beans::XPropertySet> xSeriesProp(mDataPoint.m_xSeries, uno::UNO_QUERY);
                     xSeriesProp->getPropertyValue("DeletedLegendEntries") >>= deletedLegendEntriesSeq;
                     std::vector<sal_Int32> deletedLegendEntries;
-                    for (auto& deletedLegendEntry : deletedLegendEntriesSeq)
+                    for (const auto& deletedLegendEntry : std::as_const(deletedLegendEntriesSeq))
                     {
                         deletedLegendEntries.push_back(deletedLegendEntry);
                     }
diff --git a/xmloff/source/draw/shapeimport.cxx b/xmloff/source/draw/shapeimport.cxx
index c338c15c724a..f0886de65d2a 100644
--- a/xmloff/source/draw/shapeimport.cxx
+++ b/xmloff/source/draw/shapeimport.cxx
@@ -641,7 +641,7 @@ void ShapeGroupContext::popGroupAndPostProcess()
         uno::Sequence<sal_Int32> aNewOrder(maZOrderList.size() + maUnsortedList.size());
         sal_Int32 nIndex = 0;
 
-        for (ZOrderHint& rHint : maZOrderList)
+        for (const ZOrderHint& rHint : maZOrderList)
         {
             // fill in the gaps from unordered list
             for (vector<ZOrderHint>::iterator aIt = maUnsortedList.begin(); aIt != maUnsortedList.end() && nIndex < rHint.nShould; )
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
index be5899fb72d9..1ab4d3d21cce 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
@@ -1260,7 +1260,7 @@ void ElementDescriptor::readBullitinBoard( StyleBag * all_styles )
             }
         }
     }
-    for (rtl::Reference<ElementDescriptor> & p : all_elements)
+    for (const rtl::Reference<ElementDescriptor> & p : all_elements)
     {
         addSubElement( p );
     }
diff --git a/xmlsecurity/source/gpg/SecurityEnvironment.cxx b/xmlsecurity/source/gpg/SecurityEnvironment.cxx
index 941651aaf64b..b864700ec30d 100644
--- a/xmlsecurity/source/gpg/SecurityEnvironment.cxx
+++ b/xmlsecurity/source/gpg/SecurityEnvironment.cxx
@@ -139,7 +139,7 @@ Sequence< Reference < XCertificate > > SecurityEnvironmentGpg::getCertificatesIm
 
     Sequence< Reference< XCertificate > > xCertificateSequence(certsList.size());
     int i = 0;
-    for (auto& cert : certsList) {
+    for (const auto& cert : certsList) {
         xCertificateSequence[i++] = cert;
     }
 
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index ee7b884ea343..94200051d57d 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -304,7 +304,7 @@ SecurityEnvironment_NssImpl::getPersonalCertificates()
         int i = 0;
         Sequence< Reference< XCertificate > > certSeq( length ) ;
 
-        for( auto& rXCert : certsList ) {
+        for( const auto& rXCert : certsList ) {
             certSeq[i] = rXCert ;
             ++i;
         }


More information about the Libreoffice-commits mailing list