[gthumb] add support for libpng version 1.5.x



commit b4cd0554f871398f8e15a451b30b25f13763a279
Author: Guido Trentalancia <guido trentalancia com>
Date:   Tue Aug 2 09:24:41 2011 +0200

    add support for libpng version 1.5.x

 extensions/cairo_io/cairo-io-png.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/extensions/cairo_io/cairo-io-png.c b/extensions/cairo_io/cairo-io-png.c
index 146754b..45d0c9d 100644
--- a/extensions/cairo_io/cairo-io-png.c
+++ b/extensions/cairo_io/cairo-io-png.c
@@ -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 (GthFileData   *file_data,
 	        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;
 	}



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