Fixed double FCLOSE problem and revised pngcrush.h

to add PNG_NO_READ|WRITE_cHRM|iCCP which are handled as unknown chunks.
This commit is contained in:
Glenn Randers-Pehrson
2009-05-30 19:36:49 -05:00
parent f1dd616644
commit 6af1a48de1
2 changed files with 32 additions and 28 deletions

View File

@@ -156,7 +156,11 @@
Change log: 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) 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 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 width, height;
static png_uint_32 measured_idat_length; static png_uint_32 measured_idat_length;
static int found_gAMA = 0; static int found_gAMA = 0;
#ifdef PNG_cHRM_SUPPORTED
static int found_cHRM = 0; static int found_cHRM = 0;
#endif
static int found_CgBI = 0; static int found_CgBI = 0;
static int found_any_chunk = 0; static int found_any_chunk = 0;
static int image_is_immutable = 0; static int image_is_immutable = 0;
@@ -5013,12 +5019,10 @@ int main(int argc, char *argv[])
png_destroy_info_struct(write_ptr, png_destroy_info_struct(write_ptr,
&write_end_info_ptr); &write_end_info_ptr);
png_destroy_write_struct(&write_ptr, &write_info_ptr); png_destroy_write_struct(&write_ptr, &write_info_ptr);
FCLOSE(fpout);
setfiletype(outname); setfiletype(outname);
} }
png_destroy_read_struct(&read_ptr, &read_info_ptr, png_destroy_read_struct(&read_ptr, &read_info_ptr,
&end_info_ptr); &end_info_ptr);
FCLOSE(fpin);
if (verbose > 1) if (verbose > 1)
fprintf(stderr, "returning after cleanup\n"); fprintf(stderr, "returning after cleanup\n");
trial = MAX_METHODS + 1; trial = MAX_METHODS + 1;

View File

@@ -10,12 +10,6 @@
#include <malloc.h> #include <malloc.h>
*/ */
#define PNG_NO_ASSEMBLER_CODE
#define PNG_NO_ERROR_NUMBERS
#define PNG_NO_CHECK_cHRM
#ifndef PNG_NO_ZALLOC_ZERO #ifndef PNG_NO_ZALLOC_ZERO
# define PNG_NO_ZALLOC_ZERO /* speeds it up a little */ # define PNG_NO_ZALLOC_ZERO /* speeds it up a little */
#endif #endif
@@ -39,31 +33,24 @@
#define PNG_READ_GRAY_TO_RGB_SUPPORTED #define PNG_READ_GRAY_TO_RGB_SUPPORTED
#endif #endif
#define PNG_NO_READ_hIST # define PNG_NO_READ_cHRM
#define PNG_NO_WRITE_hIST # define PNG_NO_READ_hIST
#define PNG_NO_READ_pCAL # define PNG_NO_READ_iCCP
#define PNG_NO_WRITE_pCAL # define PNG_NO_READ_pCAL
#define PNG_NO_READ_sCAL # define PNG_NO_READ_sCAL
#define PNG_NO_WRITE_sCAL # define PNG_NO_READ_sPLT
#define PNG_NO_READ_sPLT # define PNG_NO_READ_tIME
#define PNG_NO_WRITE_sPLT #define PNG_NO_ASSEMBLER_CODE
#define PNG_NO_READ_tIME #define PNG_NO_CHECK_cHRM
#define PNG_NO_WRITE_tIME #define PNG_NO_READ_BGR
#define PNG_NO_INFO_IMAGE
#define PNG_EASY_ACCESS
#define PNG_NO_READ_DITHER #define PNG_NO_READ_DITHER
#define PNG_NO_READ_EMPTY_PLTE #define PNG_NO_READ_EMPTY_PLTE
#define PNG_NO_WRITE_TRANSFORMS
#define PNG_NO_PROGRESSIVE_READ #define PNG_NO_PROGRESSIVE_READ
#define PNG_NO_WRITE_WEIGHTED_FILTER
#define PNG_NO_READ_COMPOSITED_NODIV #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_INVERT_ALPHA
#define PNG_NO_READ_BGR #define PNG_NO_READ_PREMULTIPLY_ALPHA
#define PNG_NO_READ_SWAP #define PNG_NO_READ_SWAP
#define PNG_NO_READ_SWAP_ALPHA
#define PNG_READ_USER_TRANSFORM_SUPPORTED #define PNG_READ_USER_TRANSFORM_SUPPORTED
#define PNG_READ_STRIP_ALPHA_SUPPORTED #define PNG_READ_STRIP_ALPHA_SUPPORTED
#define PNG_READ_EXPAND_SUPPORTED #define PNG_READ_EXPAND_SUPPORTED
@@ -71,8 +58,21 @@
#define PNG_READ_PACK_SUPPORTED #define PNG_READ_PACK_SUPPORTED
#define PNG_READ_SHIFT_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_PACK_SUPPORTED
#define PNG_WRITE_SHIFT_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) #if (PNGCRUSH_LIBPNG_VER > 10002)
/* versions 0.96 through 1.0.2 have a stub png_rgb_to_gray() with the /* versions 0.96 through 1.0.2 have a stub png_rgb_to_gray() with the