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

Caolán McNamara caolanm at redhat.com
Tue Feb 28 16:17:06 UTC 2017


 filter/source/graphicfilter/itiff/ccidecom.cxx |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 3ae57096ae33eeed5b4e658ebdf3563a6dd86474
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Feb 28 16:15:46 2017 +0000

    use memset instead of loop
    
    Change-Id: I572f52658914a0814bc3d3990830e247275e110b

diff --git a/filter/source/graphicfilter/itiff/ccidecom.cxx b/filter/source/graphicfilter/itiff/ccidecom.cxx
index 1cb7d7d..125d9c8 100644
--- a/filter/source/graphicfilter/itiff/ccidecom.cxx
+++ b/filter/source/graphicfilter/itiff/ccidecom.cxx
@@ -995,10 +995,14 @@ void CCIDecompressor::Read1DScanlineData(sal_uInt8 * pTarget, sal_uInt16 nTarget
                 nDataBits = nDataBits - nTgtFreeByteBits;
                 pTarget++;
                 nTgtFreeByteBits=8;
-                while (nDataBits>=8) {
-                    *(pTarget++)=nBlackOrWhite;
-                    nDataBits-=8;
+                if (nDataBits >= 8)
+                {
+                    const sal_uInt16 nDataBytes = nDataBits / 8;
+                    memset(pTarget, nBlackOrWhite, nDataBytes);
+                    pTarget += nDataBytes;
+                    nDataBits -= nDataBytes * 8;
                 }
+
                 if (nDataBits>0) {
                     *pTarget=nBlackOrWhite;
                     nTgtFreeByteBits = nTgtFreeByteBits - nDataBits;


More information about the Libreoffice-commits mailing list