[gthumb-list] [PATCH] Add support for libpng version 1.5.x



Hello !

I have filed a bug against gthumb because currently it does not build
against libpng version 1.5.x (latest):

https://bugzilla.gnome.org/show_bug.cgi?id=655739

The problem is due to the Cairo PNG extension trying to to access inside
the PNG struct directly.

It seems trivial to sort out this problem. I propose the following patch
(which works for me and can be applied both to git and 2.13.2 versions).

--- gthumb-2.13.2-original/extensions/cairo_io/cairo-io-png.c   2011-06-06 00:35:29.000000000 +0200
+++ gthumb-2.13.2/extensions/cairo_io/cairo-io-png.c    2011-08-01 19:39:34.198483356 +0200
@@ -24,6 +24,19 @@
 #include <gthumb.h>
 #include "cairo-io-png.h"

+/* starting from libpng version 1.5 it is not possible
+ * to access inside the PNG struct directly
+ */
+#define PNG_SETJMP(ptr) setjmp(png_jmpbuf(ptr))
+
+#ifdef PNG_LIBPNG_VER
+#if PNG_LIBPNG_VER < 10500
+#ifdef PNG_SETJMP
+#undef PNG_SETJMP
+#endif
+#define PNG_SETJMP(ptr) setjmp(ptr->jmpbuf)
+#endif
+#endif

 typedef struct {
        GFileInputStream  *stream;
@@ -162,7 +175,7 @@ _cairo_image_surface_create_from_png (Gt
                return image;
        }

-       if (setjmp (cairo_png_data->png_ptr->jmpbuf)) {
+       if (PNG_SETJMP(cairo_png_data->png_ptr)) {
                _cairo_png_data_destroy (cairo_png_data);
                return image;
        }

Regards,

Guido Trentalancia





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]