[maemo-commits] [maemo-commits] r13100 - projects/haf/tags/hildon-thumbnail/0.12/thumbs

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Aug 10 13:25:17 EEST 2007
Author: kihamala
Date: 2007-08-10 13:25:16 +0300 (Fri, 10 Aug 2007)
New Revision: 13100

Modified:
   projects/haf/tags/hildon-thumbnail/0.12/thumbs/thumber-gdk-pixbuf.c
Log:
fixed more


Modified: projects/haf/tags/hildon-thumbnail/0.12/thumbs/thumber-gdk-pixbuf.c
===================================================================
--- projects/haf/tags/hildon-thumbnail/0.12/thumbs/thumber-gdk-pixbuf.c	2007-08-10 10:13:36 UTC (rev 13099)
+++ projects/haf/tags/hildon-thumbnail/0.12/thumbs/thumber-gdk-pixbuf.c	2007-08-10 10:25:16 UTC (rev 13100)
@@ -158,11 +158,27 @@
 
        while (!oom && items_read >= sizeof(buffer) / BLK)
        {
+         long pos;
          int nbytes;
+
          /* read BLK bytes at a time as much as possible */
+         if ((pos = ftell(f)) == -1)
+         {
+           gdk_pixbuf_loader_close(loader, NULL);
+           goto cleanup;
+         }
          items_read = fread(buffer, BLK, sizeof(buffer) / BLK, f);
-         if (items_read < 1)
+
+         if (items_read < sizeof(buffer) / BLK)
+         {
+           /* read again one byte at a time */
+           if (fseek(f, pos, SEEK_SET) == -1)
+           {
+             gdk_pixbuf_loader_close(loader, NULL);
+             goto cleanup;
+           }
            nbytes = fread(buffer, 1, sizeof(buffer), f);
+         }
          else
            nbytes = items_read * BLK;
 


More information about the maemo-commits mailing list