From ff7e241d54000ae8110a108f8043ef63cd21367e Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Sat, 24 Mar 2018 17:24:19 +0100
Subject: loadpng, fix build


diff --git a/loadpng.c b/loadpng.c
index 3905f97..06f9b0b 100644
--- a/loadpng.c
+++ b/loadpng.c
@@ -9,6 +9,7 @@
 #include <allegro.h>
 #include <allegro/internal/aintern.h>
 #include "loadpng.h"
+#include <zlib.h>
 
 /* We need internals _color_load_depth and _fixup_loaded_bitmap.  The
  * first can be replaced by the new get_color_depth() function which
@@ -276,7 +277,8 @@ BITMAP *load_png_pf(PACKFILE *fp, RGB *pal)
      * the normal method of doing things with libpng).  REQUIRED unless you
      * set up your own error handlers in the png_create_read_struct() earlier.
      */
-    if (setjmp(png_ptr->jmpbuf)) {
+    // if (setjmp(png_ptr->jmpbuf)) {
+	if (setjmp(png_jmpbuf(png_ptr))) {
 	/* Free all of the memory associated with the png_ptr and info_ptr */
 	png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
 	/* If we get here, we had a problem reading the file */
@@ -372,7 +374,7 @@ BITMAP *load_memory_png(AL_CONST void *buffer, int bufsize, RGB *pal)
      * the normal method of doing things with libpng).  REQUIRED unless you
      * set up your own error handlers in the png_create_read_struct() earlier.
      */
-    if (setjmp(png_ptr->jmpbuf)) {
+    if (setjmp(png_jmpbuf(png_ptr))) {
 	/* Free all of the memory associated with the png_ptr and info_ptr */
 	png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
 	/* If we get here, we had a problem reading the file */
diff --git a/savepng.c b/savepng.c
index 02a3725..1602cf0 100644
--- a/savepng.c
+++ b/savepng.c
@@ -188,7 +188,7 @@ static int really_save_png(PACKFILE *fp, BITMAP *bmp, AL_CONST RGB *pal)
 	goto Error;
 
     /* Set error handling. */
-    if (setjmp(png_ptr->jmpbuf)) {
+    if (setjmp(png_jmpbuf(png_ptr))) {
 	/* If we get here, we had a problem reading the file. */
 	goto Error;
     }
-- 
2.16.2

