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

Julien Nabet serval2412 at yahoo.fr
Tue Feb 6 17:58:01 UTC 2018


 vcl/source/filter/graphicfilter.cxx |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

New commits:
commit ccf7025d7c60f73d65a772181399a5339968360b
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Tue Feb 6 12:55:53 2018 +0100

    Use for-range loop in graphicfilter (vcl)
    
    Change-Id: I416746df2b2f120b264fab85f6a9570c5f176ddf
    Reviewed-on: https://gerrit.libreoffice.org/49290
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 4c0166716ddd..340308c83073 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -1561,19 +1561,16 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
             {
                 // check if this PNG contains a GIF chunk!
                 const std::vector<vcl::PNGReader::ChunkData>& rChunkData = aPNGReader.GetChunks();
-                std::vector<vcl::PNGReader::ChunkData>::const_iterator aIter(rChunkData.begin());
-                std::vector<vcl::PNGReader::ChunkData>::const_iterator aEnd(rChunkData.end());
-
-                while (aIter != aEnd)
+                for (auto const& chunk : rChunkData)
                 {
                     // Microsoft Office is storing Animated GIFs in following chunk
-                    if (aIter->nType == PMGCHUNG_msOG)
+                    if (chunk.nType == PMGCHUNG_msOG)
                     {
-                        sal_uInt32 nChunkSize = aIter->aData.size();
+                        sal_uInt32 nChunkSize = chunk.aData.size();
 
                         if (nChunkSize > 11)
                         {
-                            const std::vector<sal_uInt8>& rData = aIter->aData;
+                            const std::vector<sal_uInt8>& rData = chunk.aData;
                             nGraphicContentSize = nChunkSize - 11;
                             SvMemoryStream aIStrm(const_cast<sal_uInt8*>(&rData[11]), nGraphicContentSize, StreamMode::READ);
                             pGraphicContent.reset(new sal_uInt8[nGraphicContentSize]);
@@ -1585,7 +1582,6 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
                             break;
                         }
                     }
-                    ++aIter;
                 }
             }
 


More information about the Libreoffice-commits mailing list