Enlightenment CVS committal

Author  : cedric
Project : e17
Module  : libs/eet

Dir     : e17/libs/eet/src/lib


Modified Files:
        eet_image.c 


Log Message:
Fix wrongly stored image when compressed size is bigger than uncompressed. Fix 
bug #523.


===================================================================
RCS file: /cvs/e/e17/libs/eet/src/lib/eet_image.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- eet_image.c 2 Jun 2008 16:01:18 -0000       1.22
+++ eet_image.c 24 Jul 2008 13:25:18 -0000      1.23
@@ -503,8 +503,9 @@
        if (buflen > (w * h * 4))
          {
             free(comp);
-            *size = ((w * h * 4) + (8 * 4));
-            return d;
+            free(d);
+            *size = -1;
+            return NULL;
          }
        memcpy(d + 32, comp, buflen);
        *size = (8 * 4) + buflen;
@@ -880,10 +881,13 @@
 
    if (lossy == 0)
      {
-       if (compress <= 0)
-         d = eet_data_image_lossless_convert(&size, data, w, h, alpha);
-       else
+       if (compress > 0)
          d = eet_data_image_lossless_compressed_convert(&size, data, w, h, 
alpha, compress);
+
+       /* eet_data_image_lossless_compressed_convert will refuse to compress 
something
+          if the result is bigger than the entry. */
+       if (compress <= 0 || d == NULL)
+         d = eet_data_image_lossless_convert(&size, data, w, h, alpha);
      }
    else
      {



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to