Comment 2 for bug 1001285

Revision history for this message
brezerk (brezerk) wrote :

Yeah. It looks like libpng ab[ himera ] brezerk@pts/1:233 ~/build/wargus_2.2.6.orig/build $
diff -u /home/brezerk/build/wargus_2.2.6.orig/wartool.c.orig /home/brezerk/build/wargus_2.2.6.orig/wartool.c
--- /home/brezerk/build/wargus_2.2.6.orig/wartool.c.orig 2012-05-18 18:06:25.000000000 +0300
+++ /home/brezerk/build/wargus_2.2.6.orig/wartool.c 2012-05-18 18:14:45.000000000 +0300
@@ -53,6 +53,7 @@
 #include <stdint.h>
 #include <ctype.h>
 #include <png.h>
+#include <zlib.h>

 #if defined(_MSC_VER) || defined(WIN32)
 #include <windows.h>
@@ -1849,7 +1850,7 @@
                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,8 @@
        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, 0, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
+ png_set_PLTE(png_ptr, info_ptr, (png_colorp)pal, 256);

        if (transparent) {
                unsigned char* p;i was changed too :(