[Libreoffice-commits] core.git: drawinglayer/source dtrans/source

Julien Nabet serval2412 at yahoo.fr
Sat Mar 10 23:15:41 UTC 2018


 drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx |    4 ++--
 drawinglayer/source/primitive2d/pointarrayprimitive2d.cxx  |    4 ++--
 drawinglayer/source/processor2d/vclprocessor2d.cxx         |   13 ++++++-------
 dtrans/source/generic/clipboardmanager.cxx                 |    7 ++-----
 dtrans/source/win32/dtobj/FmtFilter.cxx                    |   13 +++++--------
 5 files changed, 17 insertions(+), 24 deletions(-)

New commits:
commit 5a341e126709e3c9ef01680e116d5ce0d55d9f8c
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sat Mar 10 17:00:23 2018 +0100

    Use for-range loops in drawinglayer and dtrans
    
    Change-Id: I4d3368e2ffa4d98c04d69b8f5ef485558d812fda
    Reviewed-on: https://gerrit.libreoffice.org/51047
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx b/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx
index f7d4e619488d..d9865d100e4a 100644
--- a/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx
@@ -99,9 +99,9 @@ namespace drawinglayer
             if(getPositions().size())
             {
                 // get the basic range from the position vector
-                for(std::vector< basegfx::B2DPoint >::const_iterator aIter(getPositions().begin()), aEnd(getPositions().end()); aIter != aEnd; ++aIter)
+                for (auto const& pos : getPositions())
                 {
-                    aRetval.expand(*aIter);
+                    aRetval.expand(pos);
                 }
 
                 if(!getMarker().IsEmpty())
diff --git a/drawinglayer/source/primitive2d/pointarrayprimitive2d.cxx b/drawinglayer/source/primitive2d/pointarrayprimitive2d.cxx
index e32942661042..86292fd8e308 100644
--- a/drawinglayer/source/primitive2d/pointarrayprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/pointarrayprimitive2d.cxx
@@ -58,9 +58,9 @@ namespace drawinglayer
                 basegfx::B2DRange aNewRange;
 
                 // get the basic range from the position vector
-                for(std::vector< basegfx::B2DPoint >::const_iterator aIter(getPositions().begin()), aEnd(getPositions().end()); aIter != aEnd; ++aIter)
+                for (auto const& pos : getPositions())
                 {
-                    aNewRange.expand(*aIter);
+                    aNewRange.expand(pos);
                 }
 
                 // assign to buffered value
diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index 784ae2a4ff8c..df0b95b7cdec 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -235,10 +235,9 @@ namespace drawinglayer
                         const basegfx::B2DVector aPixelVector(maCurrentTransformation * basegfx::B2DVector(1.0, 0.0));
                         const double fPixelVectorFactor(aPixelVector.getLength());
 
-                        for(std::vector< double >::const_iterator aStart(rTextCandidate.getDXArray().begin());
-                            aStart != rTextCandidate.getDXArray().end(); ++aStart)
+                        for (auto const& elem : rTextCandidate.getDXArray())
                         {
-                            aTransformedDXArray.push_back(basegfx::fround((*aStart) * fPixelVectorFactor));
+                            aTransformedDXArray.push_back(basegfx::fround(elem * fPixelVectorFactor));
                         }
                     }
 
@@ -921,9 +920,9 @@ namespace drawinglayer
 
                     mpOutputDevice->EnableMapMode(false);
 
-                    for(std::vector< basegfx::B2DPoint >::const_iterator aIter(rPositions.begin()); aIter != rPositions.end(); ++aIter)
+                    for (auto const& pos : rPositions)
                     {
-                        const basegfx::B2DPoint aDiscreteTopLeft((maCurrentTransformation * (*aIter)) - aDiscreteHalfSize);
+                        const basegfx::B2DPoint aDiscreteTopLeft((maCurrentTransformation * pos) - aDiscreteHalfSize);
                         const Point aDiscretePoint(basegfx::fround(aDiscreteTopLeft.getX()), basegfx::fround(aDiscreteTopLeft.getY()));
 
                         mpOutputDevice->DrawBitmapEx(aDiscretePoint + aOrigin, rMarker);
@@ -941,9 +940,9 @@ namespace drawinglayer
             const basegfx::BColor aRGBColor(maBColorModifierStack.getModifiedColor(rPointArrayCandidate.getRGBColor()));
             const Color aVCLColor(aRGBColor);
 
-            for(std::vector< basegfx::B2DPoint >::const_iterator aIter(rPositions.begin()); aIter != rPositions.end(); ++aIter)
+            for (auto const& pos : rPositions)
             {
-                const basegfx::B2DPoint aViewPosition(maCurrentTransformation * (*aIter));
+                const basegfx::B2DPoint aViewPosition(maCurrentTransformation * pos);
                 const Point aPos(basegfx::fround(aViewPosition.getX()), basegfx::fround(aViewPosition.getY()));
 
                 mpOutputDevice->DrawPixel(aPos, aVCLColor);
diff --git a/dtrans/source/generic/clipboardmanager.cxx b/dtrans/source/generic/clipboardmanager.cxx
index c916bd5e0b60..0106cccd372a 100644
--- a/dtrans/source/generic/clipboardmanager.cxx
+++ b/dtrans/source/generic/clipboardmanager.cxx
@@ -157,12 +157,9 @@ void SAL_CALL ClipboardManager::dispose()
         aGuard2.clear();
 
         // dispose all clipboards still in list
-        ClipboardMap::iterator iter = aCopy.begin();
-        ClipboardMap::iterator imax = aCopy.end();
-
-        for (; iter != imax; ++iter)
+        for (auto const& elem : aCopy)
         {
-            Reference< XComponent > xComponent(iter->second, UNO_QUERY);
+            Reference< XComponent > xComponent(elem.second, UNO_QUERY);
             if (xComponent.is())
             {
                 try
diff --git a/dtrans/source/win32/dtobj/FmtFilter.cxx b/dtrans/source/win32/dtobj/FmtFilter.cxx
index c4580337a9bf..f8d04091a368 100644
--- a/dtrans/source/win32/dtobj/FmtFilter.cxx
+++ b/dtrans/source/win32/dtobj/FmtFilter.cxx
@@ -347,10 +347,9 @@ size_t CalcSizeForStringListBuffer(const FileList_t& fileList)
         return 0;
 
     size_t size = 1; // one for the very final '\0'
-    FileList_t::const_iterator iter_end = fileList.end();
-    for (FileList_t::const_iterator iter = fileList.begin(); iter != iter_end; ++iter)
+    for (auto const& elem : fileList)
     {
-        size += iter->length() + 1; // length including terminating '\0'
+        size += elem.length() + 1; // length including terminating '\0'
     }
     return (size * sizeof(FileList_t::value_type::value_type));
 }
@@ -366,12 +365,10 @@ ByteSequence_t FileListToByteSequence(const FileList_t& fileList)
         wchar_t* p = reinterpret_cast<wchar_t*>(bseq.getArray());
         ZeroMemory(p, size);
 
-        FileList_t::const_iterator iter;
-        FileList_t::const_iterator iter_end = fileList.end();
-        for (iter = fileList.begin(); iter != iter_end; ++iter)
+        for (auto const& elem : fileList)
         {
-            wcsncpy(p, iter->c_str(), iter->length());
-            p += (iter->length() + 1);
+            wcsncpy(p, elem.c_str(), elem.length());
+            p += (elem.length() + 1);
         }
     }
     return bseq;


More information about the Libreoffice-commits mailing list