zvbi/zvbi-0.2.33-libpng-1.5.patch

39 lines
964 B
Diff

Support build with libpng version 1.5.x.
--- zvbi-0.2.33-orig/src/exp-gfx.c 2012-02-18 03:20:39.668146729 +0100
+++ zvbi-0.2.33/src/exp-gfx.c 2012-02-18 03:08:29.578283492 +0100
@@ -1637,6 +1637,19 @@ VBI_AUTOREG_EXPORT_MODULE(vbi_export_cla
#include "png.h"
#include "setjmp.h"
+/* starting from libpng version 1.5 it is not possible
+ * to access inside the PNG struct directly
+ */
+#ifdef PNG_SETJMP
+#undef PNG_SETJMP
+#endif
+
+#if (defined(PNG_LIBPNG_VER) && PNG_LIBPNG_VER >= 10500)
+#define PNG_SETJMP(ptr) setjmp(png_jmpbuf(ptr))
+#else
+#define PNG_SETJMP(ptr) setjmp(ptr->jmpbuf)
+#endif
+
static void
write_data (png_structp png_ptr,
png_bytep data,
@@ -1672,11 +1685,11 @@ write_png (gfx_instance * gfx,
char title[80];
unsigned int i;
- if (setjmp (png_ptr->jmpbuf))
+ if (PNG_SETJMP(png_ptr))
return FALSE;
png_set_write_fn (png_ptr,
- (voidp) gfx,
+ (png_voidp) gfx,
write_data,
flush_data);