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

Julien Nabet serval2412 at yahoo.fr
Tue Feb 6 13:31:13 UTC 2018


 vcl/source/gdi/pngwrite.cxx |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

New commits:
commit f23b15106dae5424a8b928793a1ae8c1445c0477
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Tue Feb 6 10:44:16 2018 +0100

    Use for-range loop in pngwrite (vcl)
    
    Change-Id: I957fb399fd1dc630c9a6bdcffe530921eaf66e2d
    Reviewed-on: https://gerrit.libreoffice.org/49278
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/vcl/source/gdi/pngwrite.cxx b/vcl/source/gdi/pngwrite.cxx
index 072e74d62530..e4c41d0386c6 100644
--- a/vcl/source/gdi/pngwrite.cxx
+++ b/vcl/source/gdi/pngwrite.cxx
@@ -261,24 +261,21 @@ bool PNGWriterImpl::Write(SvStream& rOStm)
     rOStm.WriteUInt32(0x89504e47);
     rOStm.WriteUInt32(0x0d0a1a0a);
 
-    std::vector< vcl::PNGWriter::ChunkData >::iterator aBeg(maChunkSeq.begin());
-    std::vector< vcl::PNGWriter::ChunkData >::iterator aEnd(maChunkSeq.end());
-    while (aBeg != aEnd)
+    for (auto const& chunk : maChunkSeq)
     {
-        sal_uInt32 nType = aBeg->nType;
+        sal_uInt32 nType = chunk.nType;
     #if defined(__LITTLEENDIAN) || defined(OSL_LITENDIAN)
         nType = OSL_SWAPDWORD(nType);
     #endif
         sal_uInt32 nCRC = rtl_crc32(0, &nType, 4);
-        sal_uInt32 nDataSize = aBeg->aData.size();
+        sal_uInt32 nDataSize = chunk.aData.size();
         if (nDataSize)
-            nCRC = rtl_crc32(nCRC, &aBeg->aData[0], nDataSize);
+            nCRC = rtl_crc32(nCRC, &chunk.aData[0], nDataSize);
         rOStm.WriteUInt32(nDataSize);
-        rOStm.WriteUInt32(aBeg->nType);
+        rOStm.WriteUInt32(chunk.nType);
         if (nDataSize)
-            rOStm.WriteBytes(&aBeg->aData[0], nDataSize);
+            rOStm.WriteBytes(&chunk.aData[0], nDataSize);
         rOStm.WriteUInt32(nCRC);
-        ++aBeg;
     }
     rOStm.SetEndian(nOldMode);
     return mbStatus;


More information about the Libreoffice-commits mailing list