[maemo-commits] [maemo-commits] r9188 - projects/haf/branches/gtk+/maemo-gtk-2-10/gdk-pixbuf

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Jan 19 13:35:04 EET 2007
Author: mitch
Date: 2007-01-19 13:35:02 +0200 (Fri, 19 Jan 2007)
New Revision: 9188

Modified:
   projects/haf/branches/gtk+/maemo-gtk-2-10/gdk-pixbuf/ChangeLog
   projects/haf/branches/gtk+/maemo-gtk-2-10/gdk-pixbuf/io-jpeg.c
Log:
2007-01-19  Michael Natterer  <mitch at imendio.com>

	Port over io-jpeg.c changed (also filed upstream):

	* io-jpeg.c (gdk_pixbuf__jpeg_image_load_increment): Use spinguard
	to avoid infinite looping also when num_left > 0.

	(gdk_pixbuf__jpeg_image_stop_load): Make sure the return value
	matches error status, to ensure the caller can handle 'error'
	correctly.



Modified: projects/haf/branches/gtk+/maemo-gtk-2-10/gdk-pixbuf/ChangeLog
===================================================================
--- projects/haf/branches/gtk+/maemo-gtk-2-10/gdk-pixbuf/ChangeLog	2007-01-19 11:31:45 UTC (rev 9187)
+++ projects/haf/branches/gtk+/maemo-gtk-2-10/gdk-pixbuf/ChangeLog	2007-01-19 11:35:02 UTC (rev 9188)
@@ -1,3 +1,14 @@
+2007-01-19  Michael Natterer  <mitch at imendio.com>
+
+	Port over io-jpeg.c changed (also filed upstream):
+
+	* io-jpeg.c (gdk_pixbuf__jpeg_image_load_increment): Use spinguard
+	to avoid infinite looping also when num_left > 0.
+
+	(gdk_pixbuf__jpeg_image_stop_load): Make sure the return value
+	matches error status, to ensure the caller can handle 'error'
+	correctly.
+
 2007-01-17  Michael Natterer  <mitch at imendio.com>
 
 	Port over io-png.c changes (also merged back to upstream):

Modified: projects/haf/branches/gtk+/maemo-gtk-2-10/gdk-pixbuf/io-jpeg.c
===================================================================
--- projects/haf/branches/gtk+/maemo-gtk-2-10/gdk-pixbuf/io-jpeg.c	2007-01-19 11:31:45 UTC (rev 9187)
+++ projects/haf/branches/gtk+/maemo-gtk-2-10/gdk-pixbuf/io-jpeg.c	2007-01-19 11:35:02 UTC (rev 9188)
@@ -516,6 +516,7 @@
 gdk_pixbuf__jpeg_image_stop_load (gpointer data, GError **error)
 {
 	JpegProgContext *context = (JpegProgContext *) data;
+        gboolean retval;
 
 	g_return_val_if_fail (context != NULL, TRUE);
 	
@@ -528,12 +529,14 @@
 	
 	/* if we have an error? */
 	if (sigsetjmp (context->jerr.setjmp_buffer, 1)) {
-		jpeg_destroy_decompress (&context->cinfo);
+                retval = FALSE;
 	} else {
-		jpeg_finish_decompress(&context->cinfo);
-		jpeg_destroy_decompress(&context->cinfo);
+		jpeg_finish_decompress (&context->cinfo);
+                retval = TRUE;
 	}
 
+        jpeg_destroy_decompress (&context->cinfo);
+
 	if (context->cinfo.src) {
 		my_src_ptr src = (my_src_ptr) context->cinfo.src;
 		
@@ -542,7 +545,7 @@
 
 	g_free (context);
 
-        return TRUE;
+        return retval;
 }
 
 
@@ -684,17 +687,17 @@
 			src->pub.bytes_in_buffer += num_copy;
 			bufhd += num_copy;
 			num_left -= num_copy;
-		} else {
-		/* did anything change from last pass, if not return */
-			if (first) {
-				last_bytes_left = src->pub.bytes_in_buffer;
-				first = FALSE;
-			} else if (src->pub.bytes_in_buffer == last_bytes_left)
-				spinguard++;
-			else
-				last_bytes_left = src->pub.bytes_in_buffer;
 		}
 
+                /* did anything change from last pass, if not return */
+                if (first) {
+                        last_bytes_left = src->pub.bytes_in_buffer;
+                        first = FALSE;
+                } else if (src->pub.bytes_in_buffer == last_bytes_left)
+                        spinguard++;
+                else
+                        last_bytes_left = src->pub.bytes_in_buffer;
+
 		/* should not go through twice and not pull bytes out of buf */
 		if (spinguard > 2)
 			return TRUE;


More information about the maemo-commits mailing list