[Libreoffice-commits] core.git: vcl/opengl vcl/qt5 vcl/source vcl/unx

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


 vcl/opengl/RenderList.cxx                         |    2 +-
 vcl/opengl/gdiimpl.cxx                            |    2 +-
 vcl/qt5/Qt5Graphics_GDI.cxx                       |    2 +-
 vcl/source/app/svapp.cxx                          |    2 +-
 vcl/source/control/tabctrl.cxx                    |    2 +-
 vcl/source/gdi/WidgetDefinition.cxx               |    2 +-
 vcl/source/gdi/pdfwriter_impl.cxx                 |    4 ++--
 vcl/source/gdi/print.cxx                          |    4 ++--
 vcl/source/gdi/print3.cxx                         |    2 +-
 vcl/source/image/ImplImageTree.cxx                |    6 +++---
 vcl/source/treelist/imap.cxx                      |    2 +-
 vcl/source/uitest/logger.cxx                      |    2 +-
 vcl/source/window/accel.cxx                       |    2 +-
 vcl/source/window/builder.cxx                     |    4 ++--
 vcl/source/window/dialog.cxx                      |    4 ++--
 vcl/source/window/dockmgr.cxx                     |    2 +-
 vcl/source/window/event.cxx                       |    4 ++--
 vcl/source/window/splitwin.cxx                    |   10 +++++-----
 vcl/source/window/toolbox.cxx                     |    2 +-
 vcl/unx/generic/app/saldisp.cxx                   |    4 ++--
 vcl/unx/generic/desktopdetect/desktopdetector.cxx |    2 +-
 vcl/unx/gtk3/gtk3gtkinst.cxx                      |    2 +-
 22 files changed, 34 insertions(+), 34 deletions(-)

New commits:
commit 50a6041bfac60ab03ec896bd638504524853300d
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Aug 20 15:54:28 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Aug 20 18:37:47 2019 +0200

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

diff --git a/vcl/opengl/RenderList.cxx b/vcl/opengl/RenderList.cxx
index 823942121f3f..81817950d05a 100644
--- a/vcl/opengl/RenderList.cxx
+++ b/vcl/opengl/RenderList.cxx
@@ -293,7 +293,7 @@ void RenderList::addDrawPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon,
         {
             RenderParameters& rTriangleRenderParameter = maRenderEntries.back().maTriangleParameters;
 
-            for (basegfx::B2DTrapezoid & rTrapezoid : aTrapezoidVector)
+            for (const basegfx::B2DTrapezoid & rTrapezoid : aTrapezoidVector)
             {
                 GLfloat topX1 = rTrapezoid.getTopXLeft();
                 GLfloat topX2 = rTrapezoid.getTopXRight();
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index efbc4cea3682..b7443ffd6d26 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -900,7 +900,7 @@ void OpenGLSalGraphicsImpl::DrawPolyPolygon( const basegfx::B2DPolyPolygon& rPol
     basegfx::B2DTrapezoidVector aB2DTrapVector;
     basegfx::utils::trapezoidSubdivide( aB2DTrapVector, aSimplePolyPolygon );
     // draw tessellation result
-    for(basegfx::B2DTrapezoid & i : aB2DTrapVector)
+    for(const basegfx::B2DTrapezoid & i : aB2DTrapVector)
         DrawTrapezoid( i, blockAA );
 }
 
diff --git a/vcl/qt5/Qt5Graphics_GDI.cxx b/vcl/qt5/Qt5Graphics_GDI.cxx
index f95f18af474c..2aa70949dc32 100644
--- a/vcl/qt5/Qt5Graphics_GDI.cxx
+++ b/vcl/qt5/Qt5Graphics_GDI.cxx
@@ -127,7 +127,7 @@ bool Qt5Graphics::setClipRegion(const vcl::Region& rRegion)
         QRegion aQRegion;
         RectangleVector aRectangles;
         rRegion.GetRegionRectangles(aRectangles);
-        for (auto& rRect : aRectangles)
+        for (const auto& rRect : aRectangles)
             aQRegion += toQRect(rRect);
         m_aClipRegion = aQRegion;
         if (!m_aClipPath.isEmpty())
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index bbabe2aa9083..28ab180a77f7 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -801,7 +801,7 @@ bool Application::HandleKey( VclEventId nEvent, vcl::Window *pWin, KeyEvent* pKe
     bool bProcessed = false;
     // Copy the list, because this can be destroyed when calling a Link...
     std::vector<Link<VclWindowEvent&,bool>> aCopy( pSVData->maAppData.maKeyListeners );
-    for ( Link<VclWindowEvent&,bool>& rLink : aCopy )
+    for ( const Link<VclWindowEvent&,bool>& rLink : aCopy )
     {
         if( rLink.Call( aEvent ) )
         {
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index a63a63d04a56..522bf6e66310 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -1134,7 +1134,7 @@ void TabControl::Paint( vcl::RenderContext& rRenderContext, const tools::Rectang
             if (mpTabCtrlData->maItemList.size())
             {
                 long nRight = 0;
-                for (auto &item : mpTabCtrlData->maItemList)
+                for (const auto &item : mpTabCtrlData->maItemList)
                     if (item.m_bVisible)
                         nRight = item.maRect.Right();
                 assert(nRight);
diff --git a/vcl/source/gdi/WidgetDefinition.cxx b/vcl/source/gdi/WidgetDefinition.cxx
index 2a8ae5025020..cabb0d0817ba 100644
--- a/vcl/source/gdi/WidgetDefinition.cxx
+++ b/vcl/source/gdi/WidgetDefinition.cxx
@@ -31,7 +31,7 @@ WidgetDefinitionPart::getStates(ControlType eType, ControlPart ePart, ControlSta
 {
     std::vector<std::shared_ptr<WidgetDefinitionState>> aStatesToAdd;
 
-    for (auto& state : maStates)
+    for (const auto& state : maStates)
     {
         bool bAdd = true;
 
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index e31687a314a1..1bcc180a0863 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -2765,7 +2765,7 @@ bool PDFWriterImpl::emitFonts()
 
     OUString aTmpName;
     osl_createTempFile( nullptr, nullptr, &aTmpName.pData );
-    for (auto & subset : m_aSubsets)
+    for (const auto & subset : m_aSubsets)
     {
         for (auto & s_subset :subset.second.m_aSubsets)
         {
@@ -4604,7 +4604,7 @@ bool PDFWriterImpl::emitCatalog()
     aLine.append( " ]\n"
                   "/Kids[ " );
     unsigned int i = 0;
-    for (auto & page : m_aPages)
+    for (const auto & page : m_aPages)
     {
         aLine.append( page.m_nPageObject );
         aLine.append( " 0 R" );
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 17dc760b9d90..13041c14c3cd 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -783,7 +783,7 @@ SalPrinterQueueInfo* Printer::ImplGetQueueInfo( const OUString& rPrinterName,
             return pInfo->mpSalQueueInfo.get();
 
         // then search case insensitive
-        for(ImplPrnQueueData & rQueueInfo : pPrnList->m_aQueueInfos)
+        for(const ImplPrnQueueData & rQueueInfo : pPrnList->m_aQueueInfos)
         {
             if( rQueueInfo.mpSalQueueInfo->maPrinterName.equalsIgnoreAsciiCase( rPrinterName ) )
                 return rQueueInfo.mpSalQueueInfo.get();
@@ -792,7 +792,7 @@ SalPrinterQueueInfo* Printer::ImplGetQueueInfo( const OUString& rPrinterName,
         // then search for driver name
         if ( pDriver )
         {
-            for(ImplPrnQueueData & rQueueInfo : pPrnList->m_aQueueInfos)
+            for(const ImplPrnQueueData & rQueueInfo : pPrnList->m_aQueueInfos)
             {
                 if( rQueueInfo.mpSalQueueInfo->maDriver == *pDriver )
                     return rQueueInfo.mpSalQueueInfo.get();
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index b3c3f9ead130..ec1682f91012 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -1425,7 +1425,7 @@ css::uno::Sequence< css::beans::PropertyValue > PrinterController::getJobPropert
     css::uno::Sequence< css::beans::PropertyValue > aResult( nResultLen );
     std::copy(i_rMergeList.begin(), i_rMergeList.end(), aResult.begin());
     int nCur = i_rMergeList.getLength();
-    for(css::beans::PropertyValue & rPropVal : mpImplData->maUIProperties)
+    for(const css::beans::PropertyValue & rPropVal : mpImplData->maUIProperties)
     {
         if( aMergeSet.find( rPropVal.Name ) == aMergeSet.end() )
             aResult[nCur++] = rPropVal;
diff --git a/vcl/source/image/ImplImageTree.cxx b/vcl/source/image/ImplImageTree.cxx
index d90160c516eb..6d85500b2884 100644
--- a/vcl/source/image/ImplImageTree.cxx
+++ b/vcl/source/image/ImplImageTree.cxx
@@ -211,7 +211,7 @@ std::vector<OUString> ImplImageTree::getPaths(OUString const & name, LanguageTag
     sal_Int32 pos = name.lastIndexOf('/');
     if (pos != -1)
     {
-        for (OUString& rFallback : rLanguageTag.getFallbackStrings(true))
+        for (const OUString& rFallback : rLanguageTag.getFallbackStrings(true))
         {
             OUString aFallbackName = getNameNoExtension(getRealImageName(createPath(name, pos, rFallback)));
             sPaths.emplace_back(aFallbackName + ".png");
@@ -243,7 +243,7 @@ OUString ImplImageTree::getImageUrl(OUString const & rName, OUString const & rSt
 
                 LanguageTag aLanguageTag(rLang);
 
-                for (OUString& rPath: getPaths(rName, aLanguageTag))
+                for (const OUString& rPath: getPaths(rName, aLanguageTag))
                 {
                     if (rNameAccess->hasByName(rPath))
                     {
@@ -282,7 +282,7 @@ std::shared_ptr<SvMemoryStream> ImplImageTree::getImageStream(OUString const & r
 
                 LanguageTag aLanguageTag(rLang);
 
-                for (OUString& rPath: getPaths(rName, aLanguageTag))
+                for (const OUString& rPath: getPaths(rName, aLanguageTag))
                 {
                     if (rNameAccess->hasByName(rPath))
                     {
diff --git a/vcl/source/treelist/imap.cxx b/vcl/source/treelist/imap.cxx
index 18c673f42fe9..1e0a2a94f689 100644
--- a/vcl/source/treelist/imap.cxx
+++ b/vcl/source/treelist/imap.cxx
@@ -787,7 +787,7 @@ IMapObject* ImageMap::GetHitIMapObject( const Size& rTotalSize,
 
     // walk over all objects and execute HitTest
     IMapObject* pObj = nullptr;
-    for(auto& i : maList) {
+    for(const auto& i : maList) {
         if ( i->IsHit( aRelPoint ) ) {
             pObj = i.get();
             break;
diff --git a/vcl/source/uitest/logger.cxx b/vcl/source/uitest/logger.cxx
index 03c439fcbd7c..e2c3ade0a48b 100644
--- a/vcl/source/uitest/logger.cxx
+++ b/vcl/source/uitest/logger.cxx
@@ -202,7 +202,7 @@ void UITestLogger::logKeyInput(VclPtr<vcl::Window> const& xUIElement, const KeyE
             { "PAGEUP", KEY_PAGEUP }, { "PAGEDOWN", KEY_PAGEDOWN } };
 
     OUString aFound;
-    for (auto& itr : aKeyMap)
+    for (const auto& itr : aKeyMap)
     {
         if (itr.second == nKeyCode)
         {
diff --git a/vcl/source/window/accel.cxx b/vcl/source/window/accel.cxx
index 0b16a053730f..efb0284fc283 100644
--- a/vcl/source/window/accel.cxx
+++ b/vcl/source/window/accel.cxx
@@ -157,7 +157,7 @@ void Accelerator::ImplCopyData( ImplAccelData& rAccelData )
 void Accelerator::ImplDeleteData()
 {
     // delete accelerator-entries using the id-table
-    for (std::unique_ptr<ImplAccelEntry>& pEntry : mpData->maIdList) {
+    for (const std::unique_ptr<ImplAccelEntry>& pEntry : mpData->maIdList) {
         delete pEntry->mpAutoAccel;
     }
     mpData->maIdList.clear();
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 09c9a9a900a3..61be22e10d70 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -1615,7 +1615,7 @@ void VclBuilder::preload()
         "smlo",   "scuilo",    "basctllo",  "sduilo",
         "scnlo",  "xsltdlglo", "pcrlo" // "dbulo"
     };
-    for (auto & lib : aWidgetLibs)
+    for (const auto & lib : aWidgetLibs)
     {
         std::unique_ptr<NoAutoUnloadModule> pModule(new NoAutoUnloadModule);
         OUString sModule = SAL_DLLPREFIX + OUString::createFromAscii(lib) + SAL_DLLEXTENSION;
@@ -4141,7 +4141,7 @@ void VclBuilder::set_response(const OString& sID, short nResponse)
             break;
     };
 
-    for (auto & child : m_aChildren)
+    for (const auto & child : m_aChildren)
     {
         if (child.m_sID == sID)
         {
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 1377085a259e..a6d542fbcc69 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -1478,7 +1478,7 @@ vcl::Window* Dialog::get_widget_for_response(int response)
         }
     }
 
-    for (auto& a : aResponses)
+    for (const auto& a : aResponses)
     {
         if (a.second == response)
            return a.first;
@@ -1517,7 +1517,7 @@ int Dialog::get_default_response()
         }
     }
 
-    for (auto& a : aResponses)
+    for (const auto& a : aResponses)
     {
         if (a.first->GetStyle() & WB_DEFBUTTON)
         {
diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index c8599d46a318..257b863bba39 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -277,7 +277,7 @@ DockingManager::~DockingManager()
 
 ImplDockingWindowWrapper* DockingManager::GetDockingWindowWrapper( const vcl::Window *pWindow )
 {
-    for( auto& xWrapper : mvDockingWindows )
+    for( const auto& xWrapper : mvDockingWindows )
     {
         if( xWrapper->mpDockingWindow == pWindow )
             return xWrapper.get();
diff --git a/vcl/source/window/event.cxx b/vcl/source/window/event.cxx
index c8c6b730e1dd..4cba7187f86f 100644
--- a/vcl/source/window/event.cxx
+++ b/vcl/source/window/event.cxx
@@ -238,7 +238,7 @@ void Window::CallEventListeners( VclEventId nEvent, void* pData )
                 }
             }
         );
-        for ( Link<VclWindowEvent&,void>& rLink : aCopy )
+        for ( const Link<VclWindowEvent&,void>& rLink : aCopy )
         {
             if (xWindow->IsDisposed()) break;
             // check this hasn't been removed in some re-enterancy scenario fdo#47368
@@ -271,7 +271,7 @@ void Window::CallEventListeners( VclEventId nEvent, void* pData )
                     }
                 }
             );
-            for ( Link<VclWindowEvent&,void>& rLink : aCopy )
+            for ( const Link<VclWindowEvent&,void>& rLink : aCopy )
             {
                 if (xWindow->IsDisposed())
                     return;
diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx
index ee327678020d..9549497afbc9 100644
--- a/vcl/source/window/splitwin.cxx
+++ b/vcl/source/window/splitwin.cxx
@@ -280,7 +280,7 @@ static ImplSplitSet* ImplFindSet( ImplSplitSet* pSet, sal_uInt16 nId )
 
     std::vector< ImplSplitItem >&     rItems = pSet->mvItems;
 
-    for ( auto& rItem : rItems )
+    for ( const auto& rItem : rItems )
     {
         if ( rItem.mnId == nId )
             return rItem.mpSet.get();
@@ -423,7 +423,7 @@ static void ImplCalcSet( ImplSplitSet* pSet,
         long nRelPercent    = 0;
         long nAbsSize       = 0;
         long nCurSize       = 0;
-        for ( auto& rItem : rItems )
+        for ( const auto& rItem : rItems )
         {
             if ( rItem.mnBits & SplitWindowItemFlags::RelativeSize )
                 nRelCount += rItem.mnSize;
@@ -485,7 +485,7 @@ static void ImplCalcSet( ImplSplitSet* pSet,
             long nSizeWinSize    = 0;
 
             // first resize absolute items relative
-            for ( auto& rItem : rItems )
+            for ( const auto& rItem : rItems )
             {
                 if ( !(rItem.mnBits & (SplitWindowItemFlags::RelativeSize | SplitWindowItemFlags::PercentSize)) )
                 {
@@ -726,7 +726,7 @@ void SplitWindow::ImplCalcSet2( SplitWindow* pWindow, ImplSplitSet* pSet, bool b
 
     if ( pWindow->IsReallyVisible() && pWindow->IsUpdateMode() && pWindow->mbInvalidate )
     {
-        for ( auto& rItem : rItems )
+        for ( const auto& rItem : rItems )
         {
             if ( rItem.mnSplitSize )
             {
@@ -858,7 +858,7 @@ void SplitWindow::ImplDrawBack(vcl::RenderContext& rRenderContext, ImplSplitSet*
 {
     std::vector< ImplSplitItem >& rItems = pSet->mvItems;
 
-    for ( auto& rItem : rItems )
+    for ( const auto& rItem : rItems )
     {
         pSet = rItem.mpSet.get();
         if (pSet && pSet->mpWallpaper)
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 08e30d7f8e5d..6a4d1c2c3aaa 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -4172,7 +4172,7 @@ Size ToolBox::GetOptimalSize() const
     // If we have any expandable entries, then force them to their
     // optimal sizes, then reset them afterwards
     std::map<vcl::Window*, Size> aExpandables;
-    for (ImplToolItem & rItem : mpData->m_aItems)
+    for (const ImplToolItem & rItem : mpData->m_aItems)
     {
         if (rItem.mbExpand)
         {
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index d2f94a73622c..e214674d1e12 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -371,7 +371,7 @@ void SalDisplay::doDestruct()
             }
         }
 
-        for( Cursor & aCsr : aPointerCache_ )
+        for( const Cursor & aCsr : aPointerCache_ )
         {
             if( aCsr )
                 XFreeCursor( pDisp_, aCsr );
@@ -1986,7 +1986,7 @@ bool SalX11Display::Dispatch( XEvent *pEvent )
         case PropertyNotify:
             if( pEvent->xproperty.atom == getWMAdaptor()->getAtom( WMAdaptor::VCL_SYSTEM_SETTINGS ) )
             {
-                for(ScreenData & rScreen : m_aScreens)
+                for(const ScreenData & rScreen : m_aScreens)
                 {
                     if( pEvent->xproperty.window == rScreen.m_aRefWindow )
                     {
diff --git a/vcl/unx/generic/desktopdetect/desktopdetector.cxx b/vcl/unx/generic/desktopdetect/desktopdetector.cxx
index b2aea898e45c..1ae3bc91595f 100644
--- a/vcl/unx/generic/desktopdetect/desktopdetector.cxx
+++ b/vcl/unx/generic/desktopdetect/desktopdetector.cxx
@@ -165,7 +165,7 @@ DESKTOP_DETECTOR_PUBLIC DesktopType get_desktop_environment()
         //it may be separated by colon ( e.g. unity:unity7:ubuntu )
         std::vector<OUString> aSplitCurrentDesktop = comphelper::string::split(
                 OStringToOUString( aCurrentDesktop, RTL_TEXTENCODING_UTF8), ':');
-        for (auto& rCurrentDesktopStr : aSplitCurrentDesktop)
+        for (const auto& rCurrentDesktopStr : aSplitCurrentDesktop)
         {
             if ( rCurrentDesktopStr.equalsIgnoreAsciiCase( "unity" ) )
                 return DESKTOP_UNITY;
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 67bdae8b32f1..10e3331ee355 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -2556,7 +2556,7 @@ public:
 
     void clear_items()
     {
-        for (auto& a : m_aMap)
+        for (const auto& a : m_aMap)
         {
             GtkMenuItem* pMenuItem = a.second;
             g_signal_handlers_disconnect_by_data(pMenuItem, this);


More information about the Libreoffice-commits mailing list