From dbd4014239e6b2b185c532bd83b56fea629abdfe Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Mon, 31 Aug 2009 08:42:02 -0500 Subject: [devel] Replaced all "PNG_NO_FEATURE" tests with "PNG_FEATURE_SUPPORTED" tests except in pngconf.h where they can be used to request that PNG_FEATURE_SUPPORTED not be defined. --- example.c | 2 +- png.c | 12 +++---- png.h | 20 ++++++------ pngconf.h | 105 ++++++++++++++++++++++++++++++++++++++++--------------------- pngerror.c | 32 +++++++++---------- pngget.c | 2 +- pngmem.c | 2 +- pngpread.c | 2 +- pngpriv.h | 12 +++---- pngread.c | 32 +++++++++---------- pngrio.c | 6 ++-- pngrtran.c | 5 ++- pngrutil.c | 26 +++++++-------- pngset.c | 6 ++-- pngtest.c | 22 ++++++------- pngtrans.c | 2 +- pngwio.c | 18 +++++------ pngwrite.c | 20 ++++++------ pngwtran.c | 2 +- pngwutil.c | 32 +++++++++---------- 20 files changed, 196 insertions(+), 164 deletions(-) diff --git a/example.c b/example.c index 8243e4469..8d926469c 100644 --- a/example.c +++ b/example.c @@ -2,7 +2,7 @@ #if 0 /* in case someone actually tries to compile this */ /* example.c - an example of using libpng - * Last changed in libpng 1.4.0 [August 28, 2009] + * Last changed in libpng 1.4.0 [August 31, 2009] * This file has been placed in the public domain by the authors. * Maintained 1998-2009 Glenn Randers-Pehrson * Maintained 1996, 1997 Andreas Dilger) diff --git a/png.c b/png.c index 4cb4fec3b..c6532beea 100644 --- a/png.c +++ b/png.c @@ -1,7 +1,7 @@ /* png.c - location for general purpose libpng functions * - * Last changed in libpng 1.4.0 [August 28, 2009] + * Last changed in libpng 1.4.0 [August 31, 2009] * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -594,7 +594,7 @@ png_get_io_ptr(png_structp png_ptr) } #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) -#if !defined(PNG_NO_STDIO) +#ifdef PNG_STDIO_SUPPORTED /* 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 @@ -663,13 +663,13 @@ png_get_copyright(png_structp png_ptr) #else #ifdef __STDC__ return ((png_charp) PNG_STRING_NEWLINE \ - "libpng version x 1.4.0beta78 - August 28, 2009" PNG_STRING_NEWLINE \ + "libpng version x 1.4.0beta78 - August 31, 2009" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2009 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ PNG_STRING_NEWLINE); #else - return ((png_charp) "libpng version 1.4.0beta78 - August 28, 2009\ + return ((png_charp) "libpng version 1.4.0beta78 - August 31, 2009\ Copyright (c) 1998-2009 Glenn Randers-Pehrson\ Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."); @@ -770,7 +770,7 @@ png_convert_size(size_t size) /* Added at libpng version 1.2.34 and 1.4.0 (moved from pngset.c) */ #if defined(PNG_cHRM_SUPPORTED) -#if !defined(PNG_NO_CHECK_cHRM) +#if defined(PNG_CHECK_cHRM_SUPPORTED) /* * Multiply two 32-bit numbers, V1 and V2, using 32-bit @@ -881,6 +881,6 @@ png_check_cHRM_fixed(png_structp png_ptr, return ret; } -#endif /* NO_PNG_CHECK_cHRM */ +#endif /* PNG_CHECK_cHRM_SUPPORTED */ #endif /* PNG_cHRM_SUPPORTED */ #endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */ diff --git a/png.h b/png.h index a98bcbcc9..1ca9cb858 100644 --- a/png.h +++ b/png.h @@ -1,7 +1,7 @@ /* png.h - header file for PNG reference library * - * libpng version 1.4.0beta78 - August 28, 2009 + * libpng version 1.4.0beta78 - August 31, 2009 * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -11,7 +11,7 @@ * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.4.0beta78 - August 28, 2009: Glenn + * libpng versions 0.97, January 1998, through 1.4.0beta78 - August 31, 2009: Glenn * See also "Contributing Authors", below. * * Note about libpng version numbers: @@ -161,7 +161,7 @@ * * This code is released under the libpng license. * - * libpng versions 1.2.6, August 15, 2004, through 1.4.0beta78, August 28, 2009, are + * libpng versions 1.2.6, August 15, 2004, through 1.4.0beta78, August 31, 2009, are * Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are * distributed according to the same disclaimer and license as libpng-1.2.5 * with the following individual added to the list of Contributing Authors: @@ -337,7 +337,7 @@ /* Version information for png.h - this should match the version in png.c */ #define PNG_LIBPNG_VER_STRING "1.4.0beta78" #define PNG_HEADER_VERSION_STRING \ - " libpng version 1.4.0beta78 - August 28, 2009\n" + " libpng version 1.4.0beta78 - August 31, 2009\n" #define PNG_LIBPNG_VER_SONUM 14 #define PNG_LIBPNG_VER_DLLNUM 14 @@ -1459,7 +1459,7 @@ extern PNG_EXPORT(void,png_write_info_before_PLTE) PNGARG((png_structp png_ptr, extern PNG_EXPORT(void,png_write_info) PNGARG((png_structp png_ptr, png_infop info_ptr)); -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED /* Read the information before the actual image data. */ extern PNG_EXPORT(void,png_read_info) PNGARG((png_structp png_ptr, png_infop info_ptr)); @@ -1625,20 +1625,20 @@ extern PNG_EXPORT(void,png_start_read_image) PNGARG((png_structp png_ptr)); extern PNG_EXPORT(void,png_read_update_info) PNGARG((png_structp png_ptr, png_infop info_ptr)); -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED /* Read one or more rows of image data. */ extern PNG_EXPORT(void,png_read_rows) PNGARG((png_structp png_ptr, png_bytepp row, png_bytepp display_row, png_uint_32 num_rows)); #endif -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED /* Read a row of data. */ extern PNG_EXPORT(void,png_read_row) PNGARG((png_structp png_ptr, png_bytep row, png_bytep display_row)); #endif -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED /* Read the whole image into memory at once. */ extern PNG_EXPORT(void,png_read_image) PNGARG((png_structp png_ptr, png_bytepp image)); @@ -1660,7 +1660,7 @@ extern PNG_EXPORT(void,png_write_image) PNGARG((png_structp png_ptr, extern PNG_EXPORT(void,png_write_end) PNGARG((png_structp png_ptr, png_infop info_ptr)); -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED /* Read the end of the PNG file. */ extern PNG_EXPORT(void,png_read_end) PNGARG((png_structp png_ptr, png_infop info_ptr)); @@ -1818,7 +1818,7 @@ extern PNG_EXPORT(void,png_set_compression_method) PNGARG((png_structp png_ptr, * more information. */ -#if !defined(PNG_NO_STDIO) +#ifdef PNG_STDIO_SUPPORTED /* Initialize the input/output for the PNG file to the default functions. */ extern PNG_EXPORT(void,png_init_io) PNGARG((png_structp png_ptr, png_FILE_p fp)); #endif diff --git a/pngconf.h b/pngconf.h index 2b454351a..d384d4e3e 100644 --- a/pngconf.h +++ b/pngconf.h @@ -1,7 +1,7 @@ /* pngconf.h - machine configurable file for libpng * - * libpng version 1.4.0beta78 - August 29, 2009 + * libpng version 1.4.0beta78 - August 31, 2009 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -129,6 +129,19 @@ # endif #endif +/* Added at libpng version 1.4.0 */ +#if !defined(PNG_NO_WARNINGS) && !defined(PNG_WARNINGS_SUPPORTED) +# define PNG_WARNINGS_SUPPORTED +#endif + +#if !defined(PNG_NO_ERROR_TEXT) && !defined(PNG_ERROR_TEXT_SUPPORTED) +# define PNG_ERROR_TEXT_SUPPORTED +#endif + +#if !defined(PNG_NO_CHECK_cHRM) && !defined(PNG_CHECK_cHRM_SUPPORTED) +# define PNG_CHECK_cHRM_SUPPORTED +#endif + /* Enabled by default in 1.2.0. You can disable this if you don't need to support PNGs that are embedded in MNG datastreams */ #if !defined(PNG_NO_MNG_FEATURES) @@ -137,6 +150,7 @@ # endif #endif +/* Added at libpng version 1.4.0 */ #ifndef PNG_NO_FLOATING_POINT_SUPPORTED # ifndef PNG_FLOATING_POINT_SUPPORTED # define PNG_FLOATING_POINT_SUPPORTED @@ -246,6 +260,10 @@ * #define PNG_NO_STDIO */ +#if !defined(PNG_NO_STDIO) && !defined(PNG_STDIO_SUPPORTED) +# define PNG_STDIO_SUPPORTED +#endif + #if defined(_WIN32_WCE) # include /* Console I/O functions are not supported on WindowsCE */ @@ -256,10 +274,8 @@ #endif #ifdef PNG_BUILD_DLL -# ifndef PNG_CONSOLE_IO_SUPPORTED -# ifndef PNG_NO_CONSOLE_IO -# define PNG_NO_CONSOLE_IO -# endif +# if !defined(PNG_CONSOLE_IO_SUPPORTED) && !defined(PNG_NO_CONSOLE_IO) +# define PNG_NO_CONSOLE_IO # endif #endif @@ -276,6 +292,10 @@ # include # endif +#if !(defined PNG_NO_CONSOLE_IO) && !defined(PNG_CONSOLE_IO_SUPPORTED) +# define PNG_CONSOLE_IO_SUPPORTED +#endif + /* This macro protects us against machines that don't have function * prototypes (ie K&R style headers). If your compiler does not handle * function prototypes, define this macro and use the included ansi2knr. @@ -310,12 +330,14 @@ # endif #endif -/* enough people need this for various reasons to include it here */ +/* Enough people need this for various reasons to include it here */ #if !defined(MACOS) && !defined(RISCOS) && !defined(_WIN32_WCE) # include #endif -#if !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED) +/* PNG_SETJMP_NOT_SUPPORTED and PNG_NO_SETJMP_SUPPORTED are deprecated. */ +#if !defined(PNG_NO_SETJMP) && \ + !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED) # define PNG_SETJMP_SUPPORTED #endif @@ -346,7 +368,7 @@ # endif /* __linux__ */ # endif /* PNG_SKIP_SETJMP_CHECK */ - /* include setjmp.h for error handling */ + /* Include setjmp.h for error handling */ # include # ifdef __linux__ @@ -428,31 +450,16 @@ /* Any features you will not be using can be undef'ed here */ /* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user - * to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS - * on the compile line, then pick and choose which ones to define without - * having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED + * to turn it off with PNG_NO_READ|WRITE_TRANSFORMS on the compile line, + * then pick and choose which ones to define without having to edit this + * file. It is safe to use the PNG_NO_READ|WRITE_TRANSFORMS * if you only want to have a png-compliant reader/writer but don't need * any of the extra transformations. This saves about 80 kbytes in a * typical installation of the library. (PNG_NO_* form added in version - * 1.0.1c, for consistency) - */ - -/* The size of the png_text structure changed in libpng-1.0.6 when - * iTXt support was added. iTXt support was turned off by default through - * libpng-1.2.x, to support old apps that malloc the png_text structure - * instead of calling png_set_text() and letting libpng malloc it. It - * was turned on by default in libpng-1.4.0. + * 1.0.1c, for consistency; PNG_*_TRANSFORMS_NOT_SUPPORTED deprecated in + * 1.4.0) */ -#if !defined(PNG_NO_iTXt_SUPPORTED) -# if !defined(PNG_READ_iTXt_SUPPORTED) && !defined(PNG_NO_READ_iTXt) -# define PNG_READ_iTXt -# endif -# if !defined(PNG_WRITE_iTXt_SUPPORTED) && !defined(PNG_NO_WRITE_iTXt) -# define PNG_WRITE_iTXt -# endif -#endif - /* Ignore attempt to turn off both floating and fixed point support */ #if !defined(PNG_FLOATING_POINT_SUPPORTED) || \ !defined(PNG_NO_FIXED_POINT_SUPPORTED) @@ -465,6 +472,7 @@ #ifdef PNG_READ_SUPPORTED +/* PNG_READ_TRANSFORMS_NOT_SUPPORTED is deprecated. */ #if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \ !defined(PNG_NO_READ_TRANSFORMS) # define PNG_READ_TRANSFORMS_SUPPORTED @@ -532,14 +540,22 @@ # endif #endif /* PNG_READ_TRANSFORMS_SUPPORTED */ +/* PNG_PROGRESSIVE_READ_NOT_SUPPORTED is deprecated. */ #if !defined(PNG_NO_PROGRESSIVE_READ) && \ !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */ # define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */ #endif /* about interlacing capability! You'll */ - /* still have interlacing unless you change the following line: */ + /* still have interlacing unless you change the following define: */ #define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */ +/* PNG_NO_SEQUENTIAL_READ_SUPPORTED is deprecated. */ +#if !defined(PNG_NO_SEQUENTIAL_READ) && \ + !defined(PNG_SEQUENTIAL_READ_SUPPORTED) && \ + !defined(PNG_NO_SEQUENTIAL_READ_SUPPORTED) +# define PNG_SEQUENTIAL_READ_SUPPORTED +#endif + #ifndef PNG_NO_READ_COMPOSITE_NODIV # ifndef PNG_NO_READ_COMPOSITED_NODIV /* libpng-1.0.x misspelling */ # define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel, SGI */ @@ -557,6 +573,7 @@ #ifdef PNG_WRITE_SUPPORTED +/* PNG_WRITE_TRANSFORMS_NOT_SUPPORTED is deprecated. */ # if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \ !defined(PNG_NO_WRITE_TRANSFORMS) # define PNG_WRITE_TRANSFORMS_SUPPORTED @@ -630,7 +647,7 @@ # endif #endif -#ifndef PNG_NO_STDIO +#if defined(PNG_STDIO_SUPPORTED) && !defined(PNG_TIME_RFC1123_SUPPORTED) # define PNG_TIME_RFC1123_SUPPORTED #endif @@ -700,7 +717,7 @@ /* These are currently experimental features, define them if you want */ -/* very little testing */ +/* Very little testing */ /* #ifdef PNG_READ_SUPPORTED # ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED @@ -721,10 +738,12 @@ # define PNG_USE_READ_MACROS #endif -/* Buggy compilers (e.g., gcc 2.7.2.2) need this */ -/* -#define PNG_NO_POINTER_INDEXING -*/ +/* Buggy compilers (e.g., gcc 2.7.2.2) need PNG_NO_POINTER_INDEXING */ + +#if !defined(PNG_NO_POINTER_INDEXING) && \ + !defined(PNG_POINTER_INDEXING_SUPPORTED) +# define PNG_POINTER_INDEXING_SUPPORTED +#endif /* Any chunks you are not interested in, you can undef here. The @@ -733,12 +752,21 @@ * a bit smaller. */ +/* The size of the png_text structure changed in libpng-1.0.6 when + * iTXt support was added. iTXt support was turned off by default through + * libpng-1.2.x, to support old apps that malloc the png_text structure + * instead of calling png_set_text() and letting libpng malloc it. It + * was turned on by default in libpng-1.4.0. + */ + +/* PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED is deprecated. */ #if defined(PNG_READ_SUPPORTED) && \ !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \ !defined(PNG_NO_READ_ANCILLARY_CHUNKS) # define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED #endif +/* PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED is deprecated. */ #if defined(PNG_WRITE_SUPPORTED) && \ !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \ !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS) @@ -752,6 +780,7 @@ # define PNG_NO_READ_tEXt # define PNG_NO_READ_zTXt #endif + #ifndef PNG_NO_READ_bKGD # define PNG_READ_bKGD_SUPPORTED # define PNG_bKGD_SUPPORTED @@ -980,6 +1009,10 @@ #endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */ +#if !defined(PNG_NO_WRITE_FILTER) && !defined(PNG_WRITE_FILTER_SUPPORTED) +# define PNG_WRITE_FILTER_SUPPORTED +#endif + #ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS # define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED # ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED @@ -1311,7 +1344,7 @@ typedef char FAR * FAR * FAR * png_charppp; # define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf) #else # define png_jmpbuf(png_ptr) \ - (LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED) + (LIBPNG_WAS_COMPILED_WITH__PNG_NO_SETJMP) #endif /* memory model/platform independent fns */ diff --git a/pngerror.c b/pngerror.c index 308728ead..70c297bb8 100644 --- a/pngerror.c +++ b/pngerror.c @@ -1,7 +1,7 @@ /* pngerror.c - stub functions for i/o and memory allocation * - * Last changed in libpng 1.4.0 [August 28, 2009] + * Last changed in libpng 1.4.0 [August 31, 2009] * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -23,18 +23,18 @@ static void /* PRIVATE */ png_default_error PNGARG((png_structp png_ptr, png_const_charp error_message)); -#ifndef PNG_NO_WARNINGS +#ifdef PNG_WARNINGS_SUPPORTED static void /* PRIVATE */ png_default_warning PNGARG((png_structp png_ptr, png_const_charp warning_message)); -#endif /* PNG_NO_WARNINGS */ +#endif /* PNG_WARNINGS_SUPPORTED */ /* This function is called whenever there is a fatal error. This function * should not be changed. If there is a need to handle errors differently, * you should supply a replacement error function and use png_set_error_fn() * to replace the error function at run-time. */ -#ifndef PNG_NO_ERROR_TEXT +#ifdef PNG_ERROR_TEXT_SUPPORTED void PNGAPI png_error(png_structp png_ptr, png_const_charp error_message) { @@ -93,9 +93,9 @@ png_err(png_structp png_ptr) use the default handler, which will not return. */ png_default_error(png_ptr, '\0'); } -#endif /* PNG_NO_ERROR_TEXT */ +#endif /* PNG_ERROR_TEXT_SUPPORTED */ -#ifndef PNG_NO_WARNINGS +#ifdef PNG_WARNINGS_SUPPORTED /* This function is called whenever there is a non-fatal error. This function * should not be changed. If there is a need to handle warnings differently, * you should supply a replacement warning function and use @@ -125,7 +125,7 @@ png_warning(png_structp png_ptr, png_const_charp warning_message) else png_default_warning(png_ptr, warning_message + offset); } -#endif /* PNG_NO_WARNINGS */ +#endif /* PNG_WARNINGS_SUPPORTED */ #ifdef PNG_BENIGN_ERRORS_SUPPORTED void PNGAPI @@ -152,7 +152,7 @@ static PNG_CONST char png_digit[16] = { #define PNG_MAX_ERROR_TEXT 64 -#if !defined(PNG_NO_WARNINGS) || !defined(PNG_NO_ERROR_TEXT) +#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED) static void /* PRIVATE */ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp error_message) @@ -200,9 +200,9 @@ png_chunk_error(png_structp png_ptr, png_const_charp error_message) } } #endif /* PNG_READ_SUPPORTED */ -#endif /* !defined(PNG_NO_WARNINGS) || !defined(PNG_NO_ERROR_TEXT) */ +#endif /* PNG_WARNINGS_SUPPORTED || PNG_ERROR_TEXT_SUPPORTED */ -#ifndef PNG_NO_WARNINGS +#ifdef PNG_WARNINGS_SUPPORTED void PNGAPI png_chunk_warning(png_structp png_ptr, png_const_charp warning_message) { @@ -215,7 +215,7 @@ png_chunk_warning(png_structp png_ptr, png_const_charp warning_message) png_warning(png_ptr, msg); } } -#endif /* PNG_NO_WARNINGS */ +#endif /* PNG_WARNINGS_SUPPORTED */ #ifdef PNG_READ_SUPPORTED #ifdef PNG_BENIGN_ERRORS_SUPPORTED @@ -238,7 +238,7 @@ png_chunk_benign_error(png_structp png_ptr, png_const_charp error_message) static void /* PRIVATE */ png_default_error(png_structp png_ptr, png_const_charp error_message) { -#ifndef PNG_NO_CONSOLE_IO +#ifdef PNG_CONSOLE_IO_SUPPORTED #ifdef PNG_ERROR_NUMBERS_SUPPORTED if (*error_message == PNG_LITERAL_SHARP) { @@ -289,12 +289,12 @@ png_default_error(png_structp png_ptr, png_const_charp error_message) #else PNG_ABORT(); #endif -#ifdef PNG_NO_CONSOLE_IO +#ifndef PNG_CONSOLE_IO_SUPPORTED error_message = error_message; /* Make compiler happy */ #endif } -#ifndef PNG_NO_WARNINGS +#ifdef PNG_WARNINGS_SUPPORTED /* This function is called when there is a warning, but the library thinks * it can continue anyway. Replacement functions don't have to do anything * here if you don't want them to. In the default configuration, png_ptr is @@ -303,7 +303,7 @@ png_default_error(png_structp png_ptr, png_const_charp error_message) static void /* PRIVATE */ png_default_warning(png_structp png_ptr, png_const_charp warning_message) { -#ifndef PNG_NO_CONSOLE_IO +#ifndef PNG_CONSOLE_IO_SUPPORTED # ifdef PNG_ERROR_NUMBERS_SUPPORTED if (*warning_message == PNG_LITERAL_SHARP) { @@ -340,7 +340,7 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message) #endif png_ptr = png_ptr; /* Make compiler happy */ } -#endif /* PNG_NO_WARNINGS */ +#endif /* PNG_WARNINGS_SUPPORTED */ /* This function is called when the application wants to use another method * of handling errors and warnings. Note that the error function MUST NOT diff --git a/pngget.c b/pngget.c index 5b4f39a47..76a4362a3 100644 --- a/pngget.c +++ b/pngget.c @@ -1,7 +1,7 @@ /* pngget.c - retrieval of values from info struct * - * Last changed in libpng 1.4.0 [August 28, 2009] + * Last changed in libpng 1.4.0 [August 31, 2009] * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) diff --git a/pngmem.c b/pngmem.c index bdacd6839..6f6907d76 100644 --- a/pngmem.c +++ b/pngmem.c @@ -1,7 +1,7 @@ /* pngmem.c - stub functions for memory allocation * - * Last changed in libpng 1.4.0 [August 28, 2009] + * Last changed in libpng 1.4.0 [August 31, 2009] * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) diff --git a/pngpread.c b/pngpread.c index 0b9e40143..38360ea3c 100644 --- a/pngpread.c +++ b/pngpread.c @@ -1,7 +1,7 @@ /* pngpread.c - read a png file in push mode * - * Last changed in libpng 1.4.0 [August 28, 2009] + * Last changed in libpng 1.4.0 [August 31, 2009] * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) diff --git a/pngpriv.h b/pngpriv.h index ddb46aa84..d3399d2fc 100644 --- a/pngpriv.h +++ b/pngpriv.h @@ -1,7 +1,7 @@ /* pngpriv.h - private declarations for use inside libpng * - * libpng version 1.4.0beta78 - August 28, 2009 + * libpng version 1.4.0beta78 - August 31, 2009 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -314,8 +314,8 @@ PNG_EXTERN void PNGAPI png_push_fill_buffer PNGARG((png_structp png_ptr, PNG_EXTERN void PNGAPI png_default_write_data PNGARG((png_structp png_ptr, png_bytep data, png_size_t length)); -#if defined(PNG_WRITE_FLUSH_SUPPORTED) -#if !defined(PNG_NO_STDIO) +#ifdef PNG_WRITE_FLUSH_SUPPORTED +#ifdef PNG_STDIO_SUPPORTED PNG_EXTERN void PNGAPI png_default_flush PNGARG((png_structp png_ptr)); #endif #endif @@ -492,7 +492,7 @@ PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr, #endif #if defined(PNG_WRITE_sCAL_SUPPORTED) -#if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO) +#if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_STDIO_SUPPORTED) PNG_EXTERN void png_write_sCAL PNGARG((png_structp png_ptr, int unit, double width, double height)); #else @@ -851,8 +851,8 @@ PNG_EXTERN int png_check_cHRM_fixed PNGARG((png_structp png_ptr, png_fixed_point int_blue_y)); #endif -#if defined(PNG_cHRM_SUPPORTED) -#if !defined(PNG_NO_CHECK_cHRM) +#ifdef PNG_cHRM_SUPPORTED +#ifdef PNG_CHECK_cHRM_SUPPORTED /* Added at libpng version 1.2.34 and 1.4.0 */ PNG_EXTERN void png_64bit_product (long v1, long v2, unsigned long *hi_product, unsigned long *lo_product); diff --git a/pngread.c b/pngread.c index f019bdd5f..5313be2eb 100644 --- a/pngread.c +++ b/pngread.c @@ -1,7 +1,7 @@ /* pngread.c - read a PNG file * - * Last changed in libpng 1.4.0 [August 28, 2009] + * Last changed in libpng 1.4.0 [August 31, 2009] * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -111,7 +111,7 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, (user_png_ver[0] == '1' && user_png_ver[2] != png_libpng_ver[2]) || (user_png_ver[0] == '0' && user_png_ver[2] < '9')) { -#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE) +#if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE) char msg[80]; if (user_png_ver) { @@ -187,7 +187,7 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, } -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED /* 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 * bytes read from the stream. You can tell libpng how many bytes have @@ -407,7 +407,7 @@ png_read_info(png_structp png_ptr, png_infop info_ptr) png_handle_unknown(png_ptr, info_ptr, length); } } -#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ +#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */ /* Optional call to update the users info_ptr structure */ void PNGAPI @@ -425,7 +425,7 @@ png_read_update_info(png_structp png_ptr, png_infop info_ptr) png_read_transform_info(png_ptr, info_ptr); } -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED /* Initialize palette, background, etc, after transformations * are set, but before any reading takes place. This allows * the user to obtain a gamma-corrected palette, for example. @@ -441,9 +441,9 @@ png_start_read_image(png_structp png_ptr) if (!(png_ptr->flags & PNG_FLAG_ROW_INIT)) png_read_start_row(png_ptr); } -#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ +#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */ -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED void PNGAPI png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row) { @@ -674,9 +674,9 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row) if (png_ptr->read_row_fn != NULL) (*(png_ptr->read_row_fn))(png_ptr, png_ptr->row_number, png_ptr->pass); } -#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ +#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */ -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED /* 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 @@ -738,9 +738,9 @@ png_read_rows(png_structp png_ptr, png_bytepp row, dp++; } } -#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ +#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */ -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED /* Read the entire image. If the image has an alpha channel or a tRNS * chunk, and you have called png_handle_alpha()[*], you will need to * initialize the image to the current image that PNG will be overlaying. @@ -788,9 +788,9 @@ png_read_image(png_structp png_ptr, png_bytepp image) } } } -#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ +#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */ -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED /* 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 * or time information at the end of the file, if info is not NULL. @@ -966,7 +966,7 @@ png_read_end(png_structp png_ptr, png_infop info_ptr) png_handle_unknown(png_ptr, info_ptr, length); } while (!(png_ptr->mode & PNG_HAVE_IEND)); } -#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ +#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */ /* Free all memory used by the read */ void PNGAPI @@ -1197,7 +1197,7 @@ png_set_read_status_fn(png_structp png_ptr, png_read_status_ptr read_row_fn) } -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED #if defined(PNG_INFO_IMAGE_SUPPORTED) void PNGAPI png_read_png(png_structp png_ptr, png_infop info_ptr, @@ -1365,5 +1365,5 @@ png_read_png(png_structp png_ptr, png_infop info_ptr, } #endif /* PNG_INFO_IMAGE_SUPPORTED */ -#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ +#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */ #endif /* PNG_READ_SUPPORTED */ diff --git a/pngrio.c b/pngrio.c index 8c8d580a2..7c9195a8e 100644 --- a/pngrio.c +++ b/pngrio.c @@ -1,7 +1,7 @@ /* pngrio.c - functions for data input * - * Last changed in libpng 1.4.0 [August 28, 2009] + * Last changed in libpng 1.4.0 [August 31, 2009] * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -39,7 +39,7 @@ png_read_data(png_structp png_ptr, png_bytep data, png_size_t length) png_error(png_ptr, "Call to NULL read function"); } -#if !defined(PNG_NO_STDIO) +#ifdef PNG_STDIO_SUPPORTED /* This is the function that does the actual reading of data. If you are * not reading from a standard C stream, you should create a replacement * read_data function and use it at run time with png_set_read_fn(), rather @@ -136,7 +136,7 @@ png_set_read_fn(png_structp png_ptr, png_voidp io_ptr, return; png_ptr->io_ptr = io_ptr; -#if !defined(PNG_NO_STDIO) +#ifdef PNG_STDIO_SUPPORTED if (read_data_fn != NULL) png_ptr->read_data_fn = read_data_fn; else diff --git a/pngrtran.c b/pngrtran.c index 4558559ab..af4c22985 100644 --- a/pngrtran.c +++ b/pngrtran.c @@ -1,7 +1,7 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * Last changed in libpng 1.4.0 [August 28, 2009] + * Last changed in libpng 1.4.0 [August 31, 2009] * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -517,7 +517,6 @@ png_set_dither(png_structp png_ptr, png_colorp palette, distance = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_entries * png_sizeof(png_byte))); - png_memset(distance, 0xff, num_entries * png_sizeof(png_byte)); for (i = 0; i < num_palette; i++) @@ -1329,7 +1328,7 @@ png_do_read_transformations(png_structp png_ptr) if (png_ptr->row_buf == NULL) { -#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE) +#if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE) char msg[50]; png_snprintf2(msg, 50, diff --git a/pngrutil.c b/pngrutil.c index 88717eb36..bbaa1e06a 100644 --- a/pngrutil.c +++ b/pngrutil.c @@ -1,7 +1,7 @@ /* pngrutil.c - utilities to read a PNG file * - * Last changed in libpng 1.4.0 [August 28, 2009] + * Last changed in libpng 1.4.0 [August 31, 2009] * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -315,7 +315,7 @@ png_decompress_chunk(png_structp png_ptr, int comp_type, } if (ret != Z_STREAM_END) { -#if !defined(PNG_NO_STDIO) +#if defined(PNG_STDIO_SUPPORTED) char umsg[52]; if (ret == Z_BUF_ERROR) @@ -362,7 +362,7 @@ png_decompress_chunk(png_structp png_ptr, int comp_type, } else /* if (comp_type != PNG_COMPRESSION_TYPE_BASE) */ { -#if !defined(PNG_NO_STDIO) +#if defined(PNG_STDIO_SUPPORTED) char umsg[50]; png_snprintf(umsg, 50, "Unknown zTXt compression type %d", comp_type); @@ -457,7 +457,7 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) { png_color palette[PNG_MAX_PALETTE_LENGTH]; int num, i; -#ifndef PNG_NO_POINTER_INDEXING +#ifdef PNG_POINTER_INDEXING_SUPPORTED png_colorp pal_ptr; #endif @@ -510,7 +510,7 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) num = (int)length / 3; -#ifndef PNG_NO_POINTER_INDEXING +#ifdef PNG_POINTER_INDEXING_SUPPORTED for (i = 0, pal_ptr = palette; i < num; i++, pal_ptr++) { png_byte buf[3]; @@ -676,7 +676,7 @@ png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) { png_warning(png_ptr, "Ignoring incorrect gAMA value when sRGB is also present"); -#ifndef PNG_NO_CONSOLE_IO +#ifdef PNG_CONSOLE_IO_SUPPORTED fprintf(stderr, "gamma = (%d/100000)", (int)igamma); #endif return; @@ -856,7 +856,7 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) { png_warning(png_ptr, "Ignoring incorrect cHRM value when sRGB is also present"); -#ifndef PNG_NO_CONSOLE_IO +#ifdef PNG_CONSOLE_IO_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED fprintf(stderr, "wx=%f, wy=%f, rx=%f, ry=%f\n", white_x, white_y, red_x, red_y); @@ -868,7 +868,7 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) fprintf(stderr, "gx=%ld, gy=%ld, bx=%ld, by=%ld\n", int_x_green, int_y_green, int_x_blue, int_y_blue); #endif -#endif /* PNG_NO_CONSOLE_IO */ +#endif /* PNG_CONSOLE_IO_SUPPORTED */ } return; } @@ -948,7 +948,7 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) { png_warning(png_ptr, "Ignoring incorrect gAMA value when sRGB is also present"); -#ifndef PNG_NO_CONSOLE_IO +#ifdef PNG_CONSOLE_IO_SUPPORTED # ifdef PNG_FIXED_POINT_SUPPORTED fprintf(stderr, "incorrect gamma=(%d/100000)\n", (int)png_ptr->int_gamma); @@ -1111,7 +1111,7 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) { png_bytep entry_start; png_sPLT_t new_palette; -#ifdef PNG_NO_POINTER_INDEXING +#ifndef PNG_POINTER_INDEXING_SUPPORTED png_sPLT_entryp pp; #endif int data_length, entry_size, i; @@ -1211,7 +1211,7 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) return; } -#ifndef PNG_NO_POINTER_INDEXING +#ifdef PNG_POINTER_INDEXING_SUPPORTED for (i = 0; i < new_palette.nentries; i++) { png_sPLT_entryp pp = new_palette.entries + i; @@ -2976,7 +2976,7 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row, } } -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED void /* PRIVATE */ png_read_finish_row(png_structp png_ptr) { @@ -3108,7 +3108,7 @@ png_read_finish_row(png_structp png_ptr) png_ptr->mode |= PNG_AFTER_IDAT; } -#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ +#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */ void /* PRIVATE */ png_read_start_row(png_structp png_ptr) diff --git a/pngset.c b/pngset.c index 847f37e09..9bb23eb8b 100644 --- a/pngset.c +++ b/pngset.c @@ -1,7 +1,7 @@ /* pngset.c - storage of image information into info struct * - * Last changed in libpng 1.4.0 [August 28, 2009] + * Last changed in libpng 1.4.0 [August 31, 2009] * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -80,7 +80,7 @@ png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr, if (png_ptr == NULL || info_ptr == NULL) return; -#if !defined(PNG_NO_CHECK_cHRM) +#if defined(PNG_CHECK_cHRM_SUPPORTED) if (png_check_cHRM_fixed(png_ptr, white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y)) #endif @@ -646,7 +646,7 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr, blue_y = (float).06; #endif -#if !defined(PNG_NO_CHECK_cHRM) +#if defined(PNG_CHECK_cHRM_SUPPORTED) if (png_check_cHRM_fixed(png_ptr, int_white_x, int_white_y, int_red_x, int_red_y, int_green_x, int_green_y, int_blue_x, int_blue_y)) diff --git a/pngtest.c b/pngtest.c index c420d639b..b472e4e8e 100644 --- a/pngtest.c +++ b/pngtest.c @@ -1,7 +1,7 @@ /* pngtest.c - a simple test program to test libpng * - * Last changed in libpng 1.4.0 [August 28, 2009] + * Last changed in libpng 1.4.0 [August 31, 2009] * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -38,7 +38,7 @@ # include # define FCLOSE(file) fclose(file) -#if defined(PNG_NO_STDIO) +#ifndef PNG_STDIO_SUPPORTED typedef FILE * png_FILE_p; #endif @@ -55,7 +55,7 @@ #define PNGTEST_TIMING */ -#ifdef PNG_NO_FLOATING_POINT_SUPPORTED +#ifndef PNG_FLOATING_POINT_SUPPORTED #undef PNGTEST_TIMING #endif @@ -253,7 +253,7 @@ count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data) static int wrote_question = 0; -#if defined(PNG_NO_STDIO) +#ifndef PNG_STDIO_SUPPORTED /* START of code to validate stdio-free compilation */ /* These copies of the default read/write functions come from pngrio.c and * pngwio.c. They allow "don't include stdio" testing of the library. @@ -430,7 +430,7 @@ pngtest_error(png_structp png_ptr, png_const_charp message) * actually OK in this case. */ } -#endif /* PNG_NO_STDIO */ +#endif /* !PNG_STDIO_SUPPORTED */ /* END of code to validate stdio-free compilation */ /* START of code to validate memory allocation and deallocation */ @@ -684,7 +684,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) read_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); #endif -#if defined(PNG_NO_STDIO) +#ifndef PNG_STDIO_SUPPORTED png_set_error_fn(read_ptr, (png_voidp)inname, pngtest_error, pngtest_warning); #endif @@ -707,7 +707,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) write_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); #endif -#if defined(PNG_NO_STDIO) +#ifndef PNG_STDIO_SUPPORTED png_set_error_fn(write_ptr, (png_voidp)inname, pngtest_error, pngtest_warning); #endif @@ -769,7 +769,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) #endif png_debug(0, "Initializing input and output streams"); -#if !defined(PNG_NO_STDIO) +#ifdef PNG_STDIO_SUPPORTED png_init_io(read_ptr, fpin); # ifdef PNG_WRITE_SUPPORTED png_init_io(write_ptr, fpout); @@ -868,8 +868,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) } #endif #else /* Use floating point versions */ -#if defined(PNG_FLOATING_POINT_SUPPORTED) -#if defined(PNG_cHRM_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED +#ifdef PNG_cHRM_SUPPORTED { double white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y; @@ -983,7 +983,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) png_set_sBIT(write_ptr, write_info_ptr, sig_bit); } #endif -#if defined(PNG_sCAL_SUPPORTED) +#if def PNG_sCAL_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED { int unit; diff --git a/pngtrans.c b/pngtrans.c index eeef15bbc..9c0734a37 100644 --- a/pngtrans.c +++ b/pngtrans.c @@ -1,7 +1,7 @@ /* pngtrans.c - transforms the data in a row (used by both readers and writers) * - * Last changed in libpng 1.4.0 [August 28, 2009] + * Last changed in libpng 1.4.0 [August 31, 2009] * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) diff --git a/pngwio.c b/pngwio.c index 81c0e4aa9..e3d48a90b 100644 --- a/pngwio.c +++ b/pngwio.c @@ -1,7 +1,7 @@ /* pngwio.c - functions for data output * - * Last changed in libpng 1.4.0 [August 28, 2009] + * Last changed in libpng 1.4.0 [August 31, 2009] * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -38,7 +38,7 @@ png_write_data(png_structp png_ptr, png_bytep data, png_size_t length) png_error(png_ptr, "Call to NULL write function"); } -#if !defined(PNG_NO_STDIO) +#ifdef PNG_STDIO_SUPPORTED /* This is the function that does the actual writing of data. If you are * not writing to a standard C stream, you should create a replacement * write_data function and use it at run time with png_set_write_fn(), rather @@ -114,7 +114,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length) * to disk). After png_flush is called, there should be no data pending * writing in any buffers. */ -#if defined(PNG_WRITE_FLUSH_SUPPORTED) +#ifdef PNG_WRITE_FLUSH_SUPPORTED void /* PRIVATE */ png_flush(png_structp png_ptr) { @@ -122,7 +122,7 @@ png_flush(png_structp png_ptr) (*(png_ptr->output_flush_fn))(png_ptr); } -#if !defined(PNG_NO_STDIO) +#ifdef PNG_STDIO_SUPPORTED void PNGAPI png_default_flush(png_structp png_ptr) { @@ -173,7 +173,7 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr, png_ptr->io_ptr = io_ptr; -#if !defined(PNG_NO_STDIO) +#ifdef PNG_STDIO_SUPPORTED if (write_data_fn != NULL) png_ptr->write_data_fn = write_data_fn; @@ -183,8 +183,8 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr, png_ptr->write_data_fn = write_data_fn; #endif -#if defined(PNG_WRITE_FLUSH_SUPPORTED) -#if !defined(PNG_NO_STDIO) +#ifdef PNG_WRITE_FLUSH_SUPPORTED +#ifdef PNG_STDIO_SUPPORTED if (output_flush_fn != NULL) png_ptr->output_flush_fn = output_flush_fn; @@ -206,8 +206,8 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr, } } -#if defined(USE_FAR_KEYWORD) -#if defined(_MSC_VER) +#ifdef USE_FAR_KEYWORD +#ifdef _MSC_VER void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check) { void *near_ptr; diff --git a/pngwrite.c b/pngwrite.c index 923511bce..1bd2be33a 100644 --- a/pngwrite.c +++ b/pngwrite.c @@ -1,7 +1,7 @@ /* pngwrite.c - general routines to write a PNG file * - * Last changed in libpng 1.4.0 [August 28, 2009] + * Last changed in libpng 1.4.0 [August 31, 2009] * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -189,7 +189,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr) #if defined(PNG_sCAL_SUPPORTED) if (info_ptr->valid & PNG_INFO_sCAL) #if defined(PNG_WRITE_sCAL_SUPPORTED) -#if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO) +#if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_STDIO_SUPPORTED) png_write_sCAL(png_ptr, (int)info_ptr->scal_unit, info_ptr->scal_pixel_width, info_ptr->scal_pixel_height); #else /* !FLOATING_POINT */ @@ -532,7 +532,7 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, (user_png_ver[0] == '1' && user_png_ver[2] != png_libpng_ver[2]) || (user_png_ver[0] == '0' && user_png_ver[2] < '9')) { -#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE) +#if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE) char msg[80]; if (user_png_ver) { @@ -984,7 +984,7 @@ png_write_destroy(png_structp png_ptr) /* Free our memory. png_free checks NULL for us. */ png_free(png_ptr, png_ptr->zbuf); png_free(png_ptr, png_ptr->row_buf); -#ifndef PNG_NO_WRITE_FILTER +#ifdef PNG_WRITE_FILTER_SUPPORTED png_free(png_ptr, png_ptr->prev_row); png_free(png_ptr, png_ptr->sub_row); png_free(png_ptr, png_ptr->up_row); @@ -1047,14 +1047,14 @@ png_set_filter(png_structp png_ptr, int method, int filters) { switch (filters & (PNG_ALL_FILTERS | 0x07)) { -#ifndef PNG_NO_WRITE_FILTER +#ifdef PNG_WRITE_FILTER_SUPPORTED case 5: case 6: case 7: png_warning(png_ptr, "Unknown row filter for method 0"); -#endif /* PNG_NO_WRITE_FILTER */ +#endif /* PNG_WRITE_FILTER_SUPPORTED */ case PNG_FILTER_VALUE_NONE: png_ptr->do_filter=PNG_FILTER_NONE; break; -#ifndef PNG_NO_WRITE_FILTER +#ifdef PNG_WRITE_FILTER_SUPPORTED case PNG_FILTER_VALUE_SUB: png_ptr->do_filter=PNG_FILTER_SUB; break; case PNG_FILTER_VALUE_UP: @@ -1066,7 +1066,7 @@ png_set_filter(png_structp png_ptr, int method, int filters) default: png_ptr->do_filter = (png_byte)filters; break; #else default: png_warning(png_ptr, "Unknown row filter for method 0"); -#endif /* PNG_NO_WRITE_FILTER */ +#endif /* PNG_WRITE_FILTER_SUPPORTED */ } /* If we have allocated the row_buf, this means we have already started @@ -1080,7 +1080,7 @@ png_set_filter(png_structp png_ptr, int method, int filters) */ if (png_ptr->row_buf != NULL) { -#ifndef PNG_NO_WRITE_FILTER +#ifdef PNG_WRITE_FILTER_SUPPORTED if ((png_ptr->do_filter & PNG_FILTER_SUB) && png_ptr->sub_row == NULL) { png_ptr->sub_row = (png_bytep)png_malloc(png_ptr, @@ -1135,7 +1135,7 @@ png_set_filter(png_structp png_ptr, int method, int filters) } if (png_ptr->do_filter == PNG_NO_FILTERS) -#endif /* PNG_NO_WRITE_FILTER */ +#endif /* PNG_WRITE_FILTER_SUPPORTED */ png_ptr->do_filter = PNG_FILTER_NONE; } } diff --git a/pngwtran.c b/pngwtran.c index bc46b176a..b0db3ad2c 100644 --- a/pngwtran.c +++ b/pngwtran.c @@ -1,7 +1,7 @@ /* pngwtran.c - transforms the data in a row for PNG writers * - * Last changed in libpng 1.4.0 [August 28, 2009] + * Last changed in libpng 1.4.0 [August 31, 2009] * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) diff --git a/pngwutil.c b/pngwutil.c index 0d126562d..d89256b90 100644 --- a/pngwutil.c +++ b/pngwutil.c @@ -1,7 +1,7 @@ /* pngwutil.c - utilities to write a PNG file * - * Last changed in libpng 1.4.0 [August 28, 2009] + * Last changed in libpng 1.4.0 [August 31, 2009] * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -220,7 +220,7 @@ png_text_compress(png_structp png_ptr, if (compression >= PNG_TEXT_COMPRESSION_LAST) { -#if !defined(PNG_NO_STDIO) +#if defined(PNG_STDIO_SUPPORTED) char msg[50]; png_snprintf(msg, 50, "Unknown compression type %d", compression); png_warning(png_ptr, msg); @@ -633,7 +633,7 @@ png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal) png_write_chunk_start(png_ptr, (png_bytep)png_PLTE, (png_uint_32)(num_pal * 3)); -#ifndef PNG_NO_POINTER_INDEXING +#ifdef PNG_POINTER_INDEXING_SUPPORTED for (i = 0, pal_ptr = palette; i < num_pal; i++, pal_ptr++) { buf[0] = pal_ptr->red; @@ -879,7 +879,7 @@ png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette) png_size_t entry_size = (spalette->depth == 8 ? 6 : 10); png_size_t palette_size = entry_size * spalette->nentries; png_sPLT_entryp ep; -#ifdef PNG_NO_POINTER_INDEXING +#ifndef PNG_POINTER_INDEXING_SUPPORTED int i; #endif @@ -896,7 +896,7 @@ png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette) png_write_chunk_data(png_ptr, (png_bytep)&spalette->depth, (png_size_t)1); /* Loop through each palette entry, writing appropriately */ -#ifndef PNG_NO_POINTER_INDEXING +#ifdef PNG_POINTER_INDEXING_SUPPORTED for (ep = spalette->entries; epentries + spalette->nentries; ep++) { if (spalette->depth == 8) @@ -1030,7 +1030,7 @@ png_write_cHRM(png_structp png_ptr, double white_x, double white_y, int_blue_x = (png_uint_32)(blue_x * 100000.0 + 0.5); int_blue_y = (png_uint_32)(blue_y * 100000.0 + 0.5); -#if !defined(PNG_NO_CHECK_cHRM) +#if defined(PNG_CHECK_cHRM_SUPPORTED) if (png_check_cHRM_fixed(png_ptr, int_white_x, int_white_y, int_red_x, int_red_y, int_green_x, int_green_y, int_blue_x, int_blue_y)) #endif @@ -1068,7 +1068,7 @@ png_write_cHRM_fixed(png_structp png_ptr, png_fixed_point white_x, png_debug(1, "in png_write_cHRM"); /* Each value is saved in 1/100,000ths */ -#if !defined(PNG_NO_CHECK_cHRM) +#if defined(PNG_CHECK_cHRM_SUPPORTED) if (png_check_cHRM_fixed(png_ptr, white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y)) #endif @@ -1279,7 +1279,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key) if ((png_byte)*kp < 0x20 || ((png_byte)*kp > 0x7E && (png_byte)*kp < 0xA1)) { -#if !defined(PNG_NO_STDIO) +#if defined(PNG_STDIO_SUPPORTED) char msg[40]; png_snprintf(msg, 40, @@ -1643,7 +1643,7 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0, #if defined(PNG_WRITE_sCAL_SUPPORTED) /* Write the sCAL chunk */ -#if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO) +#if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_STDIO_SUPPORTED) void /* PRIVATE */ png_write_sCAL(png_structp png_ptr, int unit, double width, double height) { @@ -1790,7 +1790,7 @@ png_write_start_row(png_structp png_ptr) (png_alloc_size_t)buf_size); png_ptr->row_buf[0] = PNG_FILTER_VALUE_NONE; -#ifndef PNG_NO_WRITE_FILTER +#ifdef PNG_WRITE_FILTER_SUPPORTED /* Set up filtering buffer, if using this filter */ if (png_ptr->do_filter & PNG_FILTER_SUB) { @@ -1833,7 +1833,7 @@ png_write_start_row(png_structp png_ptr) png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH; } } -#endif /* PNG_NO_WRITE_FILTER */ +#endif /* PNG_WRITE_FILTER_SUPPORTED */ #ifdef PNG_WRITE_INTERLACING_SUPPORTED /* If interlaced, we need to set up width and height of pass */ @@ -2155,7 +2155,7 @@ void /* PRIVATE */ png_write_find_filter(png_structp png_ptr, png_row_infop row_info) { png_bytep best_row; -#ifndef PNG_NO_WRITE_FILTER +#ifdef PNG_WRITE_FILTER_SUPPORTED png_bytep prev_row, row_buf; png_uint_32 mins, bpp; png_byte filter_to_do = png_ptr->do_filter; @@ -2180,7 +2180,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info) prev_row = png_ptr->prev_row; #endif best_row = png_ptr->row_buf; -#ifndef PNG_NO_WRITE_FILTER +#ifdef PNG_WRITE_FILTER_SUPPORTED row_buf = best_row; mins = PNG_MAXSUM; @@ -2756,12 +2756,12 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info) best_row = png_ptr->paeth_row; } } -#endif /* PNG_NO_WRITE_FILTER */ +#endif /* PNG_WRITE_FILTER_SUPPORTED */ /* Do the actual writing of the filtered row data from the chosen filter. */ png_write_filtered_row(png_ptr, best_row); -#ifndef PNG_NO_WRITE_FILTER +#ifdef PNG_WRITE_FILTER_SUPPORTED #if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) /* Save the type of filter we picked this time for future calculations */ if (png_ptr->num_prev_filters > 0) @@ -2774,7 +2774,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info) png_ptr->prev_filters[j] = best_row[0]; } #endif -#endif /* PNG_NO_WRITE_FILTER */ +#endif /* PNG_WRITE_FILTER_SUPPORTED */ } -- cgit v1.2.1