--- wartool.c 2011-12-24 14:29:37.000000000 +0100 +++ wartool.c 2012-01-03 08:13:43.639666444 +0100 @@ -53,6 +53,7 @@ const char NameLine[] = "wartool V" VERS #include #include #include +#include #if defined(_MSC_VER) || defined(WIN32) #include @@ -1849,7 +1850,7 @@ int SavePNG(const char* name, unsigned c return 1; } - if (setjmp(png_ptr->jmpbuf)) { + if (setjmp(png_jmpbuf(png_ptr))) { // FIXME: must free buffers!! png_destroy_write_struct(&png_ptr, &info_ptr); fclose(fp); @@ -1861,14 +1862,12 @@ int SavePNG(const char* name, unsigned c png_set_compression_level(png_ptr, Z_BEST_COMPRESSION); // prepare the file information - info_ptr->width = w; - info_ptr->height = h; - info_ptr->bit_depth = 8; - info_ptr->color_type = PNG_COLOR_TYPE_PALETTE; - info_ptr->interlace_type = 0; - info_ptr->valid |= PNG_INFO_PLTE; - info_ptr->palette = (png_colorp)pal; - info_ptr->num_palette = 256; + png_set_IHDR(png_ptr, info_ptr, w, h, 8, + PNG_COLOR_TYPE_PALETTE, + PNG_INTERLACE_NONE, + PNG_COMPRESSION_TYPE_BASE, + PNG_FILTER_TYPE_BASE); + png_set_PLTE(png_ptr, info_ptr, (png_colorp)pal, 256); if (transparent) { unsigned char* p;