From 6af1a48de1f19670f6bdb53d342dde629f43a3c6 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Sat, 30 May 2009 19:36:49 -0500 Subject: [PATCH] Fixed double FCLOSE problem and revised pngcrush.h to add PNG_NO_READ|WRITE_cHRM|iCCP which are handled as unknown chunks. --- pngcrush.c | 10 +++++++--- pngcrush.h | 50 +++++++++++++++++++++++++------------------------- 2 files changed, 32 insertions(+), 28 deletions(-) diff --git a/pngcrush.c b/pngcrush.c index a6e1d86af..820363930 100644 --- a/pngcrush.c +++ b/pngcrush.c @@ -156,7 +156,11 @@ Change log: -Version 1.6.18 (built with libpng-1.2.36 and zlib-1.2.3.2) +Version 1.6.18 (built with libpng-1.2.37rc01 and zlib-1.2.3.2) + Removed extra FCLOSE(fpin) and FCLOSE(fpout) in the first Catch{} block, + since they get removed anyway right after that (hanno boeck). + Define PNG_NO_READ|WRITE_cHRM and PNG_NO_READ_|WRITEiCCP in pngcrush.h + and reordered pngcrush.h Version 1.6.17 (built with libpng-1.2.36 and zlib-1.2.3.2) Defined TOO_FAR == 32767 in deflate.c (again). The definition @@ -931,7 +935,9 @@ static PNG_CONST char *extension = "_C" DOT "png"; static png_uint_32 width, height; static png_uint_32 measured_idat_length; static int found_gAMA = 0; +#ifdef PNG_cHRM_SUPPORTED static int found_cHRM = 0; +#endif static int found_CgBI = 0; static int found_any_chunk = 0; static int image_is_immutable = 0; @@ -5013,12 +5019,10 @@ int main(int argc, char *argv[]) png_destroy_info_struct(write_ptr, &write_end_info_ptr); png_destroy_write_struct(&write_ptr, &write_info_ptr); - FCLOSE(fpout); setfiletype(outname); } png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr); - FCLOSE(fpin); if (verbose > 1) fprintf(stderr, "returning after cleanup\n"); trial = MAX_METHODS + 1; diff --git a/pngcrush.h b/pngcrush.h index 9206b7a81..6450100aa 100644 --- a/pngcrush.h +++ b/pngcrush.h @@ -10,12 +10,6 @@ #include */ -#define PNG_NO_ASSEMBLER_CODE - -#define PNG_NO_ERROR_NUMBERS - -#define PNG_NO_CHECK_cHRM - #ifndef PNG_NO_ZALLOC_ZERO # define PNG_NO_ZALLOC_ZERO /* speeds it up a little */ #endif @@ -39,31 +33,24 @@ #define PNG_READ_GRAY_TO_RGB_SUPPORTED #endif -#define PNG_NO_READ_hIST -#define PNG_NO_WRITE_hIST -#define PNG_NO_READ_pCAL -#define PNG_NO_WRITE_pCAL -#define PNG_NO_READ_sCAL -#define PNG_NO_WRITE_sCAL -#define PNG_NO_READ_sPLT -#define PNG_NO_WRITE_sPLT -#define PNG_NO_READ_tIME -#define PNG_NO_WRITE_tIME - -#define PNG_NO_INFO_IMAGE -#define PNG_EASY_ACCESS +# define PNG_NO_READ_cHRM +# define PNG_NO_READ_hIST +# define PNG_NO_READ_iCCP +# define PNG_NO_READ_pCAL +# define PNG_NO_READ_sCAL +# define PNG_NO_READ_sPLT +# define PNG_NO_READ_tIME +#define PNG_NO_ASSEMBLER_CODE +#define PNG_NO_CHECK_cHRM +#define PNG_NO_READ_BGR #define PNG_NO_READ_DITHER #define PNG_NO_READ_EMPTY_PLTE -#define PNG_NO_WRITE_TRANSFORMS #define PNG_NO_PROGRESSIVE_READ -#define PNG_NO_WRITE_WEIGHTED_FILTER #define PNG_NO_READ_COMPOSITED_NODIV -#define PNG_NO_READ_PREMULTIPLY_ALPHA -#define PNG_NO_READ_SWAP_ALPHA #define PNG_NO_READ_INVERT_ALPHA -#define PNG_NO_READ_BGR +#define PNG_NO_READ_PREMULTIPLY_ALPHA #define PNG_NO_READ_SWAP - +#define PNG_NO_READ_SWAP_ALPHA #define PNG_READ_USER_TRANSFORM_SUPPORTED #define PNG_READ_STRIP_ALPHA_SUPPORTED #define PNG_READ_EXPAND_SUPPORTED @@ -71,8 +58,21 @@ #define PNG_READ_PACK_SUPPORTED #define PNG_READ_SHIFT_SUPPORTED +# define PNG_NO_WRITE_cHRM +# define PNG_NO_WRITE_hIST +# define PNG_NO_WRITE_iCCP +# define PNG_NO_WRITE_pCAL +# define PNG_NO_WRITE_sCAL +# define PNG_NO_WRITE_sPLT +# define PNG_NO_WRITE_tIME +#define PNG_NO_WRITE_TRANSFORMS #define PNG_WRITE_PACK_SUPPORTED #define PNG_WRITE_SHIFT_SUPPORTED +#define PNG_NO_WRITE_WEIGHTED_FILTER + +#define PNG_NO_ERROR_NUMBERS +#define PNG_NO_INFO_IMAGE +#define PNG_EASY_ACCESS #if (PNGCRUSH_LIBPNG_VER > 10002) /* versions 0.96 through 1.0.2 have a stub png_rgb_to_gray() with the