diff -rup old/libpng-1.0.12/png.c new/libpng-1.0.12/png.c --- old/libpng-1.0.12/png.c Fri Jun 8 19:21:26 2001 +++ new/libpng-1.0.12/png.c Sun Aug 5 14:29:10 2001 @@ -82,6 +82,7 @@ const int FARDATA png_pass_dsp_mask[] #endif +#ifndef DEAD /* Tells libpng that we have already handled the first "num_bytes" bytes * of the PNG file signature. If the PNG data is embedded into another * stream we can set num_bytes = 8 so that libpng will not attempt to read @@ -97,6 +98,7 @@ png_set_sig_bytes(png_structp png_ptr, i png_ptr->sig_bytes = (png_byte)(num_bytes < 0 ? 0 : num_bytes); } +#endif /* !DEAD */ /* Checks whether the supplied bytes match the PNG signature. We allow * checking less than the full 8-byte signature so that those apps that @@ -109,7 +111,7 @@ png_set_sig_bytes(png_structp png_ptr, i int PNGAPI png_sig_cmp(png_bytep sig, png_size_t start, png_size_t num_to_check) { - png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10}; + static PNG_CONST png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10}; if (num_to_check > 8) num_to_check = 8; else if (num_to_check < 1) @@ -124,6 +126,7 @@ png_sig_cmp(png_bytep sig, png_size_t st return ((int)(png_memcmp(&sig[start], &png_signature[start], num_to_check))); } +#ifndef DEAD /* (Obsolete) function to check signature bytes. It does not allow one * to check a partial signature. This function might be removed in the * future - use png_sig_cmp(). Returns true (nonzero) if the file is a PNG. @@ -162,6 +165,7 @@ png_zfree(voidpf png_ptr, voidpf ptr) { png_free((png_structp)png_ptr, (png_voidp)ptr); } +#endif /* !DEAD */ /* Reset the CRC variable to 32 bits of 1's. Care must be taken * in case CRC is > 32 bits to leave the top bits 0. @@ -559,6 +563,7 @@ png_info_destroy(png_structp png_ptr, pn png_info_init_3(&info_ptr, sizeof(png_info)); } +#if !defined(PNG_NO_STDIO) /* This function returns a pointer to the io_ptr associated with the user * functions. The application should free any memory associated with this * pointer before png_write_destroy() or png_read_destroy() are called. @@ -569,7 +574,6 @@ png_get_io_ptr(png_structp png_ptr) return (png_ptr->io_ptr); } -#if !defined(PNG_NO_STDIO) /* Initialize the default input/output functions for the PNG file. If you * use your own read or write routines, you can call either png_set_read_fn() * or png_set_write_fn() instead of png_init_io(). If you have defined @@ -653,6 +657,7 @@ png_get_copyright(png_structp png_ptr) return ((png_charp) ""); } +#ifndef DEAD /* The following return the library version as a short string in the * format 1.0.0 through 99.99.99zz. To get the version of *.h files used * with your application, print out PNG_LIBPNG_VER_STRING, which is defined @@ -685,6 +690,7 @@ png_get_header_version(png_structp png_p return((png_charp) PNG_HEADER_VERSION_STRING); return((png_charp) PNG_HEADER_VERSION_STRING); } +#endif /* !DEAD */ #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED int /* PRIVATE */ @@ -703,6 +709,7 @@ png_handle_as_unknown(png_structp png_pt } #endif +#ifndef DEAD /* This function, added to libpng-1.0.6g, is untested. */ int PNGAPI png_reset_zstream(png_structp png_ptr) @@ -717,6 +724,7 @@ png_access_version_number(void) /* Version of *.c files used when building libpng */ return((png_uint_32) 10012L); } +#endif /* !DEAD */ /* this function was added to libpng 1.2.0 */ #if !defined(PNG_USE_PNGGCCRD) && \ diff -rup old/libpng-1.0.12/png.h new/libpng-1.0.12/png.h --- old/libpng-1.0.12/png.h Fri Jun 8 19:21:25 2001 +++ new/libpng-1.0.12/png.h Sun Aug 5 14:25:50 2001 @@ -1812,7 +1812,7 @@ extern void *png_far_to_near PNGARG((png /* Fatal error in PNG image of libpng - can't continue */ extern PNG_EXPORT(void,png_error) PNGARG((png_structp png_ptr, - png_const_charp error)); + png_const_charp error)) __attribute__ ((noreturn)); /* The same, but the chunk name is prepended to the error string. */ extern PNG_EXPORT(void,png_chunk_error) PNGARG((png_structp png_ptr, @@ -3082,6 +3082,11 @@ PNG_EXTERN void png_do_write_intrapixel #ifdef __cplusplus } #endif + +#ifdef DEAD +#define png_memset_check(a,b,c,d) png_memset(b,c,d) +#define png_memcpy_check(a,b,c,d) png_memcpy(b,c,d) +#endif /* DEAD */ #endif /* PNG_VERSION_INFO_ONLY */ /* do not put anything past this line */ diff -rup old/libpng-1.0.12/pngconf.h new/libpng-1.0.12/pngconf.h --- old/libpng-1.0.12/pngconf.h Fri Jun 8 19:21:26 2001 +++ new/libpng-1.0.12/pngconf.h Sun Aug 5 14:25:50 2001 @@ -173,6 +173,10 @@ # endif #endif +#ifdef DEAD +#define PNG_NO_STDIO +#endif /* DEAD */ + # ifdef PNG_NO_STDIO # ifndef PNG_NO_CONSOLE_IO # define PNG_NO_CONSOLE_IO @@ -248,9 +252,19 @@ # endif # endif /* __linux__ */ +# ifdef __regargs +# define setjmp __stdargs setjmp +# define longjmp __stdargs longjmp +# endif + /* include setjmp.h for error handling */ # include +# ifdef __regargs +# undef longjmp +# undef setjmp +# endif + # ifdef __linux__ # ifdef PNG_SAVE_BSD_SOURCE # define _BSD_SOURCE @@ -382,6 +396,99 @@ */ /* Any features you will not be using can be undef'ed here */ + +#ifdef DEAD + +//#define PNG_NO_FREE_ME +#define PNG_NO_FIXED_POINT_SUPPORTED + +//#define PNG_NO_READ_EXPAND +#define PNG_NO_READ_SHIFT +//#define PNG_NO_READ_PACK +#define PNG_NO_READ_BGR +#define PNG_NO_READ_SWAP +#define PNG_NO_READ_PACKSWAP +#define PNG_NO_READ_INVERT +#define PNG_NO_READ_DITHER +//#define PNG_NO_READ_BACKGROUND +//#define PNG_NO_READ_16_TO_8 +#define PNG_NO_READ_FILLER +//#define PNG_NO_READ_GAMMA +#define PNG_NO_READ_GRAY_TO_RGB +#define PNG_NO_READ_SWAP_ALPHA +#define PNG_NO_READ_INVERT_ALPHA +#define PNG_NO_READ_STRIP_ALPHA +#define PNG_NO_READ_USER_TRANSFORM +#define PNG_NO_READ_RGB_TO_GRAY +#define PNG_NO_PROGRESSIVE_READ +//#define PNG_NO_READ_COMPOSITED_NODIV +#define PNG_NO_READ_EMPTY_PLTE + +#define PNG_NO_WRITE_SHIFT +//#define PNG_NO_WRITE_PACK +#define PNG_NO_WRITE_BGR +#define PNG_NO_WRITE_SWAP +#define PNG_NO_WRITE_PACKSWAP +#define PNG_NO_WRITE_INVERT +#define PNG_NO_WRITE_FILLER +#define PNG_NO_WRITE_SWAP_ALPHA +#define PNG_NO_WRITE_INVERT_ALPHA +#define PNG_NO_WRITE_USER_TRANSFORM +#define PNG_NO_WRITE_WEIGHTED_FILTER +#define PNG_NO_WRITE_FLUSH +#define PNG_NO_WRITE_EMPTY_PLTE + +//#define PNG_NO_READ_bKGD +//#define PNG_NO_READ_cHRM +//#define PNG_NO_READ_gAMA +#define PNG_NO_READ_hIST +#define PNG_NO_READ_iCCP +#define PNG_NO_READ_iTXt +#define PNG_NO_READ_oFFs +#define PNG_NO_READ_pCAL +#define PNG_NO_READ_sCAL +#define PNG_NO_READ_pHYs +#define PNG_NO_READ_sBIT +#define PNG_NO_READ_sPLT +//#define PNG_NO_READ_sRGB +#define PNG_NO_READ_tEXt +#define PNG_NO_READ_tIME +//#define PNG_NO_READ_tRNS +#define PNG_NO_READ_zTXt +#define PNG_NO_READ_USER_CHUNKS +#define PNG_NO_READ_UNKNOWN_CHUNKS +#define PNG_NO_READ_OPT_PLTE + +//#define PNG_NO_WRITE_bKGD +//#define PNG_NO_WRITE_cHRM +//#define PNG_NO_WRITE_gAMA +#define PNG_NO_WRITE_hIST +#define PNG_NO_WRITE_iCCP +#define PNG_NO_WRITE_iTXt +#define PNG_NO_WRITE_oFFs +#define PNG_NO_WRITE_pCAL +#define PNG_NO_WRITE_sCAL +#define PNG_NO_WRITE_pHYs +#define PNG_NO_WRITE_sBIT +#define PNG_NO_WRITE_sPLT +//#define PNG_NO_WRITE_sRGB +#define PNG_NO_WRITE_tEXt +#define PNG_NO_WRITE_tIME +//#define PNG_NO_WRITE_tRNS +#define PNG_NO_WRITE_zTXt +#define PNG_NO_WRITE_UNKNOWN_CHUNKS + +#define PNG_NO_MNG_FEATURES +#define PNG_NO_INFO_IMAGE +#define PNG_NO_EASY_ACCESS +#define PNG_NO_ASSEMBLER_CODE +//#define PNG_NO_GLOBAL_ARRAYS +//#define PNG_USE_LOCAL_ARRAYS +//#define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED +//#define PNG_USER_MEM_SUPPORTED +#define PNG_READ_BIG_ENDIAN_SUPPORTED + +#endif /* DEAD */ /* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user * to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS diff -rup old/libpng-1.0.12/pngget.c new/libpng-1.0.12/pngget.c --- old/libpng-1.0.12/pngget.c Fri Jun 8 19:21:27 2001 +++ new/libpng-1.0.12/pngget.c Sun Aug 5 14:25:50 2001 @@ -820,10 +820,12 @@ png_get_user_chunk_ptr(png_structp png_p #endif +#ifndef DEAD png_uint_32 PNGAPI png_get_compression_buffer_size(png_structp png_ptr) { return (png_uint_32)(png_ptr? png_ptr->zbuf_size : 0L); } +#endif /* !DEAD */ diff -rup old/libpng-1.0.12/pngread.c new/libpng-1.0.12/pngread.c --- old/libpng-1.0.12/pngread.c Fri Jun 8 19:21:27 2001 +++ new/libpng-1.0.12/pngread.c Sun Aug 5 14:25:50 2001 @@ -164,11 +164,14 @@ png_create_read_struct_2(png_const_charp png_ptr->zstream.next_out = png_ptr->zbuf; png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; +#ifndef DEAD png_set_read_fn(png_ptr, NULL, NULL); +#endif /* !DEAD */ return (png_ptr); } +#ifndef DEAD /* Initialize PNG structure for reading, and allocate any memory needed. This interface is deprecated in favour of the png_create_read_struct(), and it will eventually disappear. */ @@ -294,6 +297,7 @@ png_read_init_3(png_structpp ptr_ptr, pn png_set_read_fn(png_ptr, NULL, NULL); } +#endif /* !DEAD */ /* Read the information before the actual image data. This has been * changed in v0.90 to allow reading a file that already has the magic @@ -773,6 +777,7 @@ png_read_row(png_structp png_ptr, png_by (*(png_ptr->read_row_fn))(png_ptr, png_ptr->row_number, png_ptr->pass); } +#ifndef DEAD /* Read one or more rows of image data. If the image is interlaced, * and png_set_interlace_handling() has been called, the rows need to * contain the contents of the rows from the previous pass. If the @@ -878,6 +883,7 @@ png_read_image(png_structp png_ptr, png_ } } } +#endif /* !DEAD */ /* Read the end of the PNG file. Will not read past the end of the * file, will verify the end is accurate, and will read any comments @@ -1275,11 +1281,13 @@ png_read_destroy(png_structp png_ptr, pn } +#ifndef DEAD void PNGAPI png_set_read_status_fn(png_structp png_ptr, png_read_status_ptr read_row_fn) { png_ptr->read_row_fn = read_row_fn; } +#endif /* !DEAD */ #if defined(PNG_INFO_IMAGE_SUPPORTED) void PNGAPI diff -rup old/libpng-1.0.12/pngrtran.c new/libpng-1.0.12/pngrtran.c --- old/libpng-1.0.12/pngrtran.c Fri Jun 8 19:21:28 2001 +++ new/libpng-1.0.12/pngrtran.c Sun Aug 5 14:25:50 2001 @@ -16,6 +16,7 @@ #define PNG_INTERNAL #include "png.h" +#ifndef DEAD /* Set the action on getting a CRC error for an ancillary or critical chunk. */ void PNGAPI png_set_crc_action(png_structp png_ptr, int crit_action, int ancil_action) @@ -68,6 +69,7 @@ png_set_crc_action(png_structp png_ptr, break; } } +#endif /* !DEAD */ #if defined(PNG_READ_BACKGROUND_SUPPORTED) && \ defined(PNG_FLOATING_POINT_SUPPORTED) @@ -2307,6 +2309,7 @@ png_do_rgb_to_gray(png_structp png_ptr, } #endif +#ifndef DEAD /* Build a grayscale palette. Palette is assumed to be 1 << bit_depth * large of png_color. This lets grayscale images be treated as * paletted. Most useful for gamma correction and simplification @@ -2355,6 +2358,7 @@ png_build_grayscale_palette(int bit_dept palette[i].blue = (png_byte)v; } } +#endif /* !DEAD */ /* This function is currently unused. Do we really need it? */ #if defined(PNG_READ_DITHER_SUPPORTED) && defined(PNG_CORRECT_PALETTE_SUPPORTED) @@ -3832,7 +3836,7 @@ png_do_dither(png_row_infop row_info, pn #ifdef PNG_FLOATING_POINT_SUPPORTED #if defined(PNG_READ_GAMMA_SUPPORTED) -static int png_gamma_shift[] = +static PNG_CONST int png_gamma_shift[] = {0x10, 0x21, 0x42, 0x84, 0x110, 0x248, 0x550, 0xff0}; /* We build the 8- or 16-bit gamma tables here. Note that for 16-bit diff -rup old/libpng-1.0.12/pngset.c new/libpng-1.0.12/pngset.c --- old/libpng-1.0.12/pngset.c Fri Jun 8 19:21:29 2001 +++ new/libpng-1.0.12/pngset.c Sun Aug 5 14:37:05 2001 @@ -113,6 +113,7 @@ png_set_gAMA(png_structp png_ptr, png_in png_warning(png_ptr, "Setting gamma=0"); } #endif +#ifdef PNG_FIXED_POINT_SUPPORTED void PNGAPI png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point int_gamma) @@ -124,14 +125,13 @@ png_set_gAMA_fixed(png_structp png_ptr, #ifdef PNG_FLOATING_POINT_SUPPORTED info_ptr->gamma = (float)(int_gamma/100000.); #endif -#ifdef PNG_FIXED_POINT_SUPPORTED info_ptr->int_gamma = int_gamma; -#endif info_ptr->valid |= PNG_INFO_gAMA; if(int_gamma == 0) png_warning(png_ptr, "Setting gamma=0"); } #endif +#endif /* PNG_gAMA_SUPPORTED */ #if defined(PNG_hIST_SUPPORTED) void PNGAPI @@ -951,6 +951,7 @@ png_set_rows(png_structp png_ptr, png_in } #endif +#ifndef DEAD void PNGAPI png_set_compression_buffer_size(png_structp png_ptr, png_uint_32 size) { @@ -968,5 +969,6 @@ png_set_invalid(png_structp png_ptr, png if (png_ptr && info_ptr) info_ptr->valid &= ~(mask); } +#endif /* !DEAD */