kwo pushed a commit to branch master.

http://git.enlightenment.org/legacy/imlib2.git/commit/?id=269e0b8572b1051cfccdd90fff60940169334b50

commit 269e0b8572b1051cfccdd90fff60940169334b50
Author: Kim Woelders <k...@woelders.dk>
Date:   Mon Dec 2 19:20:11 2019 +0100

    BMP loader: Remove some bogus conditions
    
    And tweak (disabled) debug stuff.
---
 src/modules/loaders/loader_bmp.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/modules/loaders/loader_bmp.c b/src/modules/loaders/loader_bmp.c
index 9601c7c..d319b3d 100644
--- a/src/modules/loaders/loader_bmp.c
+++ b/src/modules/loaders/loader_bmp.c
@@ -482,12 +482,13 @@ load(ImlibImage * im, ImlibProgressFunction progress,
              x = 0;
              y = 0;
 
-             for (i = 0; i < imgsize && buffer_ptr < buffer_end_safe; i++)
+             for (; buffer_ptr < buffer_end_safe;)
                {
                   byte1 = buffer_ptr[0];
                   byte2 = buffer_ptr[1];
                   buffer_ptr += 2;
-                  Dx("%3d %3d: %02x %02x\n", x, y, byte1, byte2);
+                  Dx("%3d %3d: %02x %02x (%d %d)\n",
+                     x, y, byte1, byte2, byte2 >> 4, byte2 & 0xf);
                   if (byte1)
                     {
                        DATA32              t1, t2;
@@ -496,8 +497,6 @@ load(ImlibImage * im, ImlibProgressFunction progress,
                        /* Check for invalid length */
                        if (l + x > w)
                           goto bail_bc4;
-                       Dx("%3d %3d:   n=%d:  %d %d\n", x, y, byte1, byte2 >> 4,
-                          byte2 & 0xf);
 
                        t1 = argbCmap[byte2 >> 4];
                        t2 = argbCmap[byte2 & 0xF];
@@ -635,11 +634,12 @@ load(ImlibImage * im, ImlibProgressFunction progress,
 
              x = 0;
              y = 0;
-             for (i = 0; i < imgsize && buffer_ptr < buffer_end_safe; i++)
+             for (; buffer_ptr < buffer_end_safe;)
                {
                   byte1 = buffer_ptr[0];
                   byte2 = buffer_ptr[1];
                   buffer_ptr += 2;
+                  Dx("%3d %3d: %02x %02x\n", x, y, byte1, byte2);
                   if (byte1)
                     {
                        pixel = argbCmap[byte2];
@@ -685,6 +685,8 @@ load(ImlibImage * im, ImlibProgressFunction progress,
                             for (j = 0; j < l; j++)
                               {
                                  byte = *buffer_ptr++;
+                                 Dx("%3d %3d:   %d/%d: %2d\n",
+                                    x, y, j, l, byte);
                                  *ptr++ = argbCmap[byte];
                               }
                             x += l;

-- 


Reply via email to