[devel] Added PNG_{READ,WRITE}_INT_FUNCTIONS_SUPPORTED.

This allows the functions
to read and write ints to be disabled independently of PNG_USE_READ_MACROS,
which allows libpng to be built with the functions even though the default
is to use the macros - this allows applications to choose at app build
time whether or not to use macros (previously impossible because the
functions weren't in the default build.)
This commit is contained in:
Glenn Randers-Pehrson 2010-04-24 09:18:57 -05:00
parent 1ff571914c
commit c3d73f4da9
6 changed files with 55 additions and 17 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.5.0beta19 - April 18, 2010 Libpng 1.5.0beta19 - April 24, 2010
This is not intended to be a public release. It will be replaced This is not intended to be a public release. It will be replaced
within a few weeks by a public version or by another test version. within a few weeks by a public version or by another test version.
@ -162,7 +162,7 @@ version 1.5.0beta17 [April 17, 2010]
Removed the xcode project because it has not been updated to work Removed the xcode project because it has not been updated to work
with libpng-1.5.0. with libpng-1.5.0.
version 1.5.0beta18 [April 18, 2010] version 1.5.0beta18 [April 17, 2010]
Restored the ability to include optional pngusr.h Restored the ability to include optional pngusr.h
Moved replacements for png_error() and png_warning() from the Moved replacements for png_error() and png_warning() from the
contrib/pngminim project to pngerror.c, for use when warnings or contrib/pngminim project to pngerror.c, for use when warnings or
@ -171,7 +171,13 @@ version 1.5.0beta18 [April 18, 2010]
Updated contrib/pngminim project to work with the new pnglibconf.h Updated contrib/pngminim project to work with the new pnglibconf.h
Added some PNG_NO_* defines to contrib/pngminim/*/pngusr.h to save space. Added some PNG_NO_* defines to contrib/pngminim/*/pngusr.h to save space.
version 1.5.0beta19 [April 18, 2010] version 1.5.0beta19 [April 24, 2010]
Added PNG_{READ,WRITE}_INT_FUNCTIONS_SUPPORTED. This allows the functions
to read and write ints to be disabled independently of PNG_USE_READ_MACROS,
which allows libpng to be built with the functions even though the default
is to use the macros - this allows applications to choose at app build
time whether or not to use macros (previously impossible because the
functions weren't in the default build.)
Send comments/corrections/commendations to png-mng-implement at lists.sf.net: Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
(subscription required; visit (subscription required; visit

View File

@ -2653,7 +2653,13 @@ version 1.5.0beta18 [April 17, 2010]
Updated contrib/pngminim project to work with the new pnglibconf.h Updated contrib/pngminim project to work with the new pnglibconf.h
Added some PNG_NO_* defines to contrib/pngminim/*/pngusr.h to save space. Added some PNG_NO_* defines to contrib/pngminim/*/pngusr.h to save space.
version 1.5.0beta19 [April 18, 2010] version 1.5.0beta19 [April 24, 2010]
Added PNG_{READ,WRITE}_INT_FUNCTIONS_SUPPORTED. This allows the functions
to read and write ints to be disabled independently of PNG_USE_READ_MACROS,
which allows libpng to be built with the functions even though the default
is to use the macros - this allows applications to choose at app build
time whether or not to use macros (previously impossible because the
functions weren't in the default build.)
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

22
png.h
View File

@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library /* png.h - header file for PNG reference library
* *
* libpng version 1.5.0beta19 - April 18, 2010 * libpng version 1.5.0beta19 - April 24, 2010
* Copyright (c) 1998-2010 Glenn Randers-Pehrson * Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -11,7 +11,7 @@
* Authors and maintainers: * Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * 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.89c, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.5.0beta19 - April 18, 2010: Glenn * libpng versions 0.97, January 1998, through 1.5.0beta19 - April 24, 2010: Glenn
* See also "Contributing Authors", below. * See also "Contributing Authors", below.
* *
* Note about libpng version numbers: * Note about libpng version numbers:
@ -170,7 +170,7 @@
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* *
* libpng versions 1.2.6, August 15, 2004, through 1.5.0beta19, April 18, 2010, are * libpng versions 1.2.6, August 15, 2004, through 1.5.0beta19, April 24, 2010, are
* Copyright (c) 2004, 2006-2010 Glenn Randers-Pehrson, and are * Copyright (c) 2004, 2006-2010 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.2.5 * distributed according to the same disclaimer and license as libpng-1.2.5
* with the following individual added to the list of Contributing Authors: * with the following individual added to the list of Contributing Authors:
@ -282,7 +282,7 @@
* Y2K compliance in libpng: * Y2K compliance in libpng:
* ========================= * =========================
* *
* April 18, 2010 * April 24, 2010
* *
* Since the PNG Development group is an ad-hoc body, we can't make * Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration. * an official declaration.
@ -346,7 +346,7 @@
/* Version information for png.h - this should match the version in png.c */ /* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.5.0beta19" #define PNG_LIBPNG_VER_STRING "1.5.0beta19"
#define PNG_HEADER_VERSION_STRING \ #define PNG_HEADER_VERSION_STRING \
" libpng version 1.5.0beta19 - April 18, 2010\n" " libpng version 1.5.0beta19 - April 24, 2010\n"
#define PNG_LIBPNG_VER_SONUM 15 #define PNG_LIBPNG_VER_SONUM 15
#define PNG_LIBPNG_VER_DLLNUM 15 #define PNG_LIBPNG_VER_DLLNUM 15
@ -2024,17 +2024,23 @@ extern PNG_EXPORT(png_bytep,png_get_io_chunk_name,(png_structp png_ptr),,200);
((png_int_32)(*((buf) + 3)))) ((png_int_32)(*((buf) + 3))))
# endif # endif
#endif #endif
#ifdef PNG_READ_INT_FUNCTIONS_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_uint_32,(png_bytep buf),,201); extern PNG_EXPORT(png_uint_32,png_get_uint_32,(png_bytep buf),,201);
extern PNG_EXPORT(png_uint_16,png_get_uint_16,(png_bytep buf),,202); extern PNG_EXPORT(png_uint_16,png_get_uint_16,(png_bytep buf),,202);
# ifdef PNG_GET_INT_32_SUPPORTED #endif
#ifdef PNG_GET_INT_32_SUPPORTED
extern PNG_EXPORT(png_int_32,png_get_int_32,(png_bytep buf),,203); extern PNG_EXPORT(png_int_32,png_get_int_32,(png_bytep buf),,203);
# endif #endif
extern PNG_EXPORT(png_uint_32,png_get_uint_31,(png_structp png_ptr, extern PNG_EXPORT(png_uint_32,png_get_uint_31,(png_structp png_ptr,
png_bytep buf),,204); png_bytep buf),,204);
/* No png_get_int_16 -- may be added if there's a real need for it. */ /* No png_get_int_16 -- may be added if there's a real need for it. */
/* Place a 32-bit number into a buffer in PNG byte order (big-endian). */ /* Place a 32-bit number into a buffer in PNG byte order (big-endian). */
#ifdef PNG_WRITE_INT_FUNCTIONS_SUPPORTED
extern PNG_EXPORT(void,png_save_uint_32,(png_bytep buf, png_uint_32 i),,205); extern PNG_EXPORT(void,png_save_uint_32,(png_bytep buf, png_uint_32 i),,205);
#endif
#ifdef PNG_SAVE_INT_32_SUPPORTED #ifdef PNG_SAVE_INT_32_SUPPORTED
extern PNG_EXPORT(void,png_save_int_32,(png_bytep buf, png_int_32 i),,206); extern PNG_EXPORT(void,png_save_int_32,(png_bytep buf, png_int_32 i),,206);
#endif #endif
@ -2043,8 +2049,10 @@ extern PNG_EXPORT(void,png_save_int_32,(png_bytep buf, png_int_32 i),,206);
* The parameter is declared unsigned int, not png_uint_16, * The parameter is declared unsigned int, not png_uint_16,
* just to avoid potential problems on pre-ANSI C compilers. * just to avoid potential problems on pre-ANSI C compilers.
*/ */
#ifdef PNG_WRITE_INT_FUNCTIONS_SUPPORTED
extern PNG_EXPORT(void,png_save_uint_16,(png_bytep buf, unsigned int i),,207); extern PNG_EXPORT(void,png_save_uint_16,(png_bytep buf, unsigned int i),,207);
/* No png_save_int_16 -- may be added if there's a real need for it. */ /* No png_save_int_16 -- may be added if there's a real need for it. */
#endif
/* The last ordinal number (this is the *last* one, the next one to /* The last ordinal number (this is the *last* one, the next one to
* use is one more than this.) * use is one more than this.)

View File

@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng /* pngconf.h - machine configurable file for libpng
* *
* libpng version 1.5.0beta19 - April 18, 2010 * libpng version 1.5.0beta19 - April 24, 2010
* *
* Copyright (c) 1998-2010 Glenn Randers-Pehrson * Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -41,8 +41,12 @@
/* This controls optimization of the reading of 16 and 32 bit values /* This controls optimization of the reading of 16 and 32 bit values
* from PNG files. It can be set on a per-app-file basis - it * from PNG files. It can be set on a per-app-file basis - it
* just changes whether a macro is used to the function is called. * just changes whether a macro is used to the function is called.
* The library builder sets the default. * The library builder sets the default, if read functions are not
* built into the library the macro implementation is forced on.
*/ */
#ifndef PNG_READ_INT_FUNCTIONS_SUPPORTED
# define PNG_USE_READ_MACROS
#endif
#if !defined(PNG_NO_USE_READ_MACROS) && !defined(PNG_USE_READ_MACROS) #if !defined(PNG_NO_USE_READ_MACROS) && !defined(PNG_USE_READ_MACROS)
# if PNG_DEFAULT_READ_MACROS # if PNG_DEFAULT_READ_MACROS
# define PNG_USE_READ_MACROS # define PNG_USE_READ_MACROS

View File

@ -137,6 +137,18 @@ setting API_RULE default 0
# Default to using the read macros # Default to using the read macros
setting DEFAULT_READ_MACROS default 1 setting DEFAULT_READ_MACROS default 1
# The alternative is to call functions to read PNG values, if
# the functions are turned *off* the read macros must always
# be enabled, so turning this off will actually force the
# USE_READ_MACROS option on (see pngconf.h)
option READ_INT_FUNCTIONS requires READ
# The same for write, but these can only be switched off if
# no writing is required at all - hence the use of an 'enables'
# not a 'requires' below:
option WRITE_INT_FUNCTIONS off
option WRITE enables WRITE_INT_FUNCTIONS
# Generic options - affect both read and write. # Generic options - affect both read and write.
option BENIGN_ERRORS off option BENIGN_ERRORS off
option MNG_FEATURES option MNG_FEATURES
@ -361,7 +373,7 @@ option WRITE_UNKNOWN_CHUNKS requires WRITE
option HANDLE_AS_UNKNOWN option HANDLE_AS_UNKNOWN
option GET_INT_32 requires READ option GET_INT_32 requires READ READ_INT_FUNCTIONS
# png_get_int_32 is required by the ancillary chunks oFFs and pCAL # png_get_int_32 is required by the ancillary chunks oFFs and pCAL
option READ_oFFs enables GET_INT_32 option READ_oFFs enables GET_INT_32
option READ_pCAL enables GET_INT_32 option READ_pCAL enables GET_INT_32

View File

@ -1,7 +1,7 @@
/* 1.5.0beta17 STANDARD API DEFINITION */ /* 1.5.0beta19 STANDARD API DEFINITION */
/* pnglibconf.h - library build configuration */ /* pnglibconf.h - library build configuration */
/* libpng version 1.5.0beta17 - April 2, 2010 */ /* libpng version 1.5.0beta19 - April 2, 2010 */
/* Copyright (c) 1998-2010 Glenn Randers-Pehrson */ /* Copyright (c) 1998-2010 Glenn Randers-Pehrson */
@ -48,6 +48,7 @@
#define PNG_IO_STATE_SUPPORTED #define PNG_IO_STATE_SUPPORTED
#define PNG_SET_USER_LIMITS_SUPPORTED #define PNG_SET_USER_LIMITS_SUPPORTED
#define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED #define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
#define PNG_WRITE_INT_FUNCTIONS_SUPPORTED
#define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED #define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
#define PNG_WRITE_FILTER_SUPPORTED #define PNG_WRITE_FILTER_SUPPORTED
#define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED #define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED
@ -84,14 +85,15 @@
#define PNG_READ_SHIFT_SUPPORTED #define PNG_READ_SHIFT_SUPPORTED
#define PNG_CONVERT_tIME_SUPPORTED #define PNG_CONVERT_tIME_SUPPORTED
#define PNG_READ_USER_TRANSFORM_SUPPORTED #define PNG_READ_USER_TRANSFORM_SUPPORTED
#define PNG_READ_INT_FUNCTIONS_SUPPORTED
#define PNG_READ_USER_CHUNKS_SUPPORTED #define PNG_READ_USER_CHUNKS_SUPPORTED
#define PNG_READ_hIST_SUPPORTED #define PNG_READ_hIST_SUPPORTED
#define PNG_READ_QUANTIZE_SUPPORTED
#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED #define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
#define PNG_READ_SWAP_ALPHA_SUPPORTED #define PNG_READ_SWAP_ALPHA_SUPPORTED
#define PNG_READ_COMPOSITE_NODIV_SUPPORTED #define PNG_READ_COMPOSITE_NODIV_SUPPORTED
#define PNG_SEQUENTIAL_READ_SUPPORTED #define PNG_SEQUENTIAL_READ_SUPPORTED
#define PNG_READ_BACKGROUND_SUPPORTED #define PNG_READ_BACKGROUND_SUPPORTED
#define PNG_READ_QUANTIZE_SUPPORTED
#define PNG_READ_iCCP_SUPPORTED #define PNG_READ_iCCP_SUPPORTED
#define PNG_READ_STRIP_ALPHA_SUPPORTED #define PNG_READ_STRIP_ALPHA_SUPPORTED
#define PNG_READ_PACKSWAP_SUPPORTED #define PNG_READ_PACKSWAP_SUPPORTED