[libpng16] Fixed fixed/float API export conditionals. 1) If FIXED_POINT or

FLOATING_POINT options were switched off, png.h ended up with lone ';'
    characters.  This is not valid ANSI-C outside a function.  The ';'
    characters have been moved inside the definition of PNG_FP_EXPORT and
    PNG_FIXED_EXPORT. 2) If either option was switched off, the declaration
    of the corresponding functions were completely omitted, even though some
    of them are still used internally.  The result is still valid, but
    produces warnings from gcc with some warning options (including -Wall). The
    fix is to cause png.h to declare the functions with PNG_INTERNAL_FUNCTION
    when png.h is included from pngpriv.h.
This commit is contained in:
John Bowler 2012-02-13 11:45:22 -06:00 committed by Glenn Randers-Pehrson
parent 864270e18f
commit bce7988230
7 changed files with 127 additions and 78 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.6.0beta11 - February 10, 2012 Libpng 1.6.0beta11 - February 13, 2012
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.
@ -176,7 +176,7 @@ Version 1.6.0beta10 [February 3, 2012]
Updated the prebuilt configure files to current condition. Updated the prebuilt configure files to current condition.
Revised INSTALL information about autogen.sh; it works in tar distributions. Revised INSTALL information about autogen.sh; it works in tar distributions.
Version 1.6.0beta11 [February 10, 2012] Version 1.6.0beta11 [February 13, 2012]
Fix character count in pngstest command in projects/owatcom/pngstest.tgt Fix character count in pngstest command in projects/owatcom/pngstest.tgt
Revised test-pngstest.sh to report PASS/FAIL for each image. Revised test-pngstest.sh to report PASS/FAIL for each image.
Updated documentation about the simplified API. Updated documentation about the simplified API.
@ -196,6 +196,17 @@ Version 1.6.0beta11 [February 10, 2012]
allow all possible RGB transforms to be passed; pngstest cmppixel needs allow all possible RGB transforms to be passed; pngstest cmppixel needs
to be rewritten to make it clearer which errors it allows and then changed to be rewritten to make it clearer which errors it allows and then changed
to permit known inaccuracies. to permit known inaccuracies.
Removed tests for no-longer-used *_EMPTY_PLTE_SUPPORTED from pngstruct.h
Fixed fixed/float API export conditionals. 1) If FIXED_POINT or
FLOATING_POINT options were switched off, png.h ended up with lone ';'
characters. This is not valid ANSI-C outside a function. The ';'
characters have been moved inside the definition of PNG_FP_EXPORT and
PNG_FIXED_EXPORT. 2) If either option was switched off, the declaration
of the corresponding functions were completely omitted, even though some
of them are still used internally. The result is still valid, but
produces warnings from gcc with some warning options (including -Wall). The
fix is to cause png.h to declare the functions with PNG_INTERNAL_FUNCTION
when png.h is included from pngpriv.h.
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

13
CHANGES
View File

@ -3927,7 +3927,7 @@ Version 1.6.0beta10 [February 3, 2012]
Updated the prebuilt configure files to current condition. Updated the prebuilt configure files to current condition.
Revised INSTALL information about autogen.sh; it works in tar distributions. Revised INSTALL information about autogen.sh; it works in tar distributions.
Version 1.6.0beta11 [February 10, 2012] Version 1.6.0beta11 [February 13, 2012]
Fix character count in pngstest command in projects/owatcom/pngstest.tgt Fix character count in pngstest command in projects/owatcom/pngstest.tgt
Revised test-pngstest.sh to report PASS/FAIL for each image. Revised test-pngstest.sh to report PASS/FAIL for each image.
Updated documentation about the simplified API. Updated documentation about the simplified API.
@ -3947,6 +3947,17 @@ Version 1.6.0beta11 [February 10, 2012]
allow all possible RGB transforms to be passed; pngstest cmppixel needs allow all possible RGB transforms to be passed; pngstest cmppixel needs
to be rewritten to make it clearer which errors it allows and then changed to be rewritten to make it clearer which errors it allows and then changed
to permit known inaccuracies. to permit known inaccuracies.
Removed tests for no-longer-used *_EMPTY_PLTE_SUPPORTED from pngstruct.h
Fixed fixed/float API export conditionals. 1) If FIXED_POINT or
FLOATING_POINT options were switched off, png.h ended up with lone ';'
characters. This is not valid ANSI-C outside a function. The ';'
characters have been moved inside the definition of PNG_FP_EXPORT and
PNG_FIXED_EXPORT. 2) If either option was switched off, the declaration
of the corresponding functions were completely omitted, even though some
of them are still used internally. The result is still valid, but
produces warnings from gcc with some warning options (including -Wall). The
fix is to cause png.h to declare the functions with PNG_INTERNAL_FUNCTION
when png.h is included from pngpriv.h.
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

@ -184,7 +184,7 @@ endif
mv $*.tf3 $@ mv $*.tf3 $@
# The .dfn file for pnglibconf.h is machine generated # The .dfn file for pnglibconf.h is machine generated
pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h $(DFA_XTRA)
rm -f $@ $*.tf[45] rm -f $@ $*.tf[45]
$(AWK) -f ${srcdir}/scripts/options.awk out=$*.tf4 version=search\ $(AWK) -f ${srcdir}/scripts/options.awk out=$*.tf4 version=search\
${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\ ${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\

88
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.6.0beta11 - February 4, 2012 * libpng version 1.6.0beta11 - February 13, 2012
* Copyright (c) 1998-2012 Glenn Randers-Pehrson * Copyright (c) 1998-2012 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.6.0beta11 - February 4, 2012: Glenn * libpng versions 0.97, January 1998, through 1.6.0beta11 - February 13, 2012: Glenn
* See also "Contributing Authors", below. * See also "Contributing Authors", below.
* *
* Note about libpng version numbers: * Note about libpng version numbers:
@ -198,7 +198,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.6.0beta11, February 4, 2012, are * libpng versions 1.2.6, August 15, 2004, through 1.6.0beta11, February 13, 2012, are
* Copyright (c) 2004, 2006-2012 Glenn Randers-Pehrson, and are * Copyright (c) 2004, 2006-2012 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:
@ -310,7 +310,7 @@
* Y2K compliance in libpng: * Y2K compliance in libpng:
* ========================= * =========================
* *
* February 4, 2012 * February 13, 2012
* *
* 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.
@ -376,7 +376,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.6.0beta11" #define PNG_LIBPNG_VER_STRING "1.6.0beta11"
#define PNG_HEADER_VERSION_STRING \ #define PNG_HEADER_VERSION_STRING \
" libpng version 1.6.0beta11 - February 4, 2012\n" " libpng version 1.6.0beta11 - February 13, 2012\n"
#define PNG_LIBPNG_VER_SONUM 16 #define PNG_LIBPNG_VER_SONUM 16
#define PNG_LIBPNG_VER_DLLNUM 16 #define PNG_LIBPNG_VER_DLLNUM 16
@ -1160,9 +1160,9 @@ PNG_EXPORT(31, void, png_set_gray_to_rgb, (png_structrp png_ptr));
#define PNG_RGB_TO_GRAY_DEFAULT (-1)/*for red/green coefficients*/ #define PNG_RGB_TO_GRAY_DEFAULT (-1)/*for red/green coefficients*/
PNG_FP_EXPORT(32, void, png_set_rgb_to_gray, (png_structrp png_ptr, PNG_FP_EXPORT(32, void, png_set_rgb_to_gray, (png_structrp png_ptr,
int error_action, double red, double green)); int error_action, double red, double green))
PNG_FIXED_EXPORT(33, void, png_set_rgb_to_gray_fixed, (png_structrp png_ptr, PNG_FIXED_EXPORT(33, void, png_set_rgb_to_gray_fixed, (png_structrp png_ptr,
int error_action, png_fixed_point red, png_fixed_point green)); int error_action, png_fixed_point red, png_fixed_point green))
PNG_EXPORT(34, png_byte, png_get_rgb_to_gray_status, (png_const_structrp PNG_EXPORT(34, png_byte, png_get_rgb_to_gray_status, (png_const_structrp
png_ptr)); png_ptr));
@ -1230,9 +1230,9 @@ PNG_EXPORT(35, void, png_build_grayscale_palette, (int bit_depth,
#define PNG_ALPHA_BROKEN 3 /* the alpha channel is gamma encoded */ #define PNG_ALPHA_BROKEN 3 /* the alpha channel is gamma encoded */
PNG_FP_EXPORT(227, void, png_set_alpha_mode, (png_structrp png_ptr, int mode, PNG_FP_EXPORT(227, void, png_set_alpha_mode, (png_structrp png_ptr, int mode,
double output_gamma)); double output_gamma))
PNG_FIXED_EXPORT(228, void, png_set_alpha_mode_fixed, (png_structrp png_ptr, PNG_FIXED_EXPORT(228, void, png_set_alpha_mode_fixed, (png_structrp png_ptr,
int mode, png_fixed_point output_gamma)); int mode, png_fixed_point output_gamma))
#endif #endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_ALPHA_MODE_SUPPORTED) #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_ALPHA_MODE_SUPPORTED)
@ -1454,10 +1454,10 @@ PNG_EXPORT(46, void, png_set_invert_mono, (png_structrp png_ptr));
*/ */
PNG_FP_EXPORT(47, void, png_set_background, (png_structrp png_ptr, PNG_FP_EXPORT(47, void, png_set_background, (png_structrp png_ptr,
png_const_color_16p background_color, int background_gamma_code, png_const_color_16p background_color, int background_gamma_code,
int need_expand, double background_gamma)); int need_expand, double background_gamma))
PNG_FIXED_EXPORT(215, void, png_set_background_fixed, (png_structrp png_ptr, PNG_FIXED_EXPORT(215, void, png_set_background_fixed, (png_structrp png_ptr,
png_const_color_16p background_color, int background_gamma_code, png_const_color_16p background_color, int background_gamma_code,
int need_expand, png_fixed_point background_gamma)); int need_expand, png_fixed_point background_gamma))
#endif #endif
#ifdef PNG_READ_BACKGROUND_SUPPORTED #ifdef PNG_READ_BACKGROUND_SUPPORTED
# define PNG_BACKGROUND_GAMMA_UNKNOWN 0 # define PNG_BACKGROUND_GAMMA_UNKNOWN 0
@ -1481,9 +1481,9 @@ PNG_EXPORT(48, void, png_set_strip_16, (png_structrp png_ptr));
/* Turn on quantizing, and reduce the palette to the number of colors /* Turn on quantizing, and reduce the palette to the number of colors
* available. * available.
*/ */
PNG_EXPORT(49, void, png_set_quantize, (png_structrp png_ptr, png_colorp palette, PNG_EXPORT(49, void, png_set_quantize, (png_structrp png_ptr,
int num_palette, int maximum_colors, png_const_uint_16p histogram, png_colorp palette, int num_palette, int maximum_colors,
int full_quantize)); png_const_uint_16p histogram, int full_quantize));
#endif #endif
#ifdef PNG_READ_GAMMA_SUPPORTED #ifdef PNG_READ_GAMMA_SUPPORTED
@ -1504,9 +1504,9 @@ PNG_EXPORT(49, void, png_set_quantize, (png_structrp png_ptr, png_colorp palette
* is the inverse of a 'screen gamma' value. * is the inverse of a 'screen gamma' value.
*/ */
PNG_FP_EXPORT(50, void, png_set_gamma, (png_structrp png_ptr, PNG_FP_EXPORT(50, void, png_set_gamma, (png_structrp png_ptr,
double screen_gamma, double override_file_gamma)); double screen_gamma, double override_file_gamma))
PNG_FIXED_EXPORT(208, void, png_set_gamma_fixed, (png_structrp png_ptr, PNG_FIXED_EXPORT(208, void, png_set_gamma_fixed, (png_structrp png_ptr,
png_fixed_point screen_gamma, png_fixed_point override_file_gamma)); png_fixed_point screen_gamma, png_fixed_point override_file_gamma))
#endif #endif
#ifdef PNG_WRITE_FLUSH_SUPPORTED #ifdef PNG_WRITE_FLUSH_SUPPORTED
@ -1663,11 +1663,11 @@ PNG_EXPORT(67, void, png_set_filter, (png_structrp png_ptr, int method,
*/ */
PNG_FP_EXPORT(68, void, png_set_filter_heuristics, (png_structrp png_ptr, PNG_FP_EXPORT(68, void, png_set_filter_heuristics, (png_structrp png_ptr,
int heuristic_method, int num_weights, png_const_doublep filter_weights, int heuristic_method, int num_weights, png_const_doublep filter_weights,
png_const_doublep filter_costs)); png_const_doublep filter_costs))
PNG_FIXED_EXPORT(209, void, png_set_filter_heuristics_fixed, PNG_FIXED_EXPORT(209, void, png_set_filter_heuristics_fixed,
(png_structrp png_ptr, int heuristic_method, int num_weights, (png_structrp png_ptr, int heuristic_method, int num_weights,
png_const_fixed_point_p filter_weights, png_const_fixed_point_p filter_weights,
png_const_fixed_point_p filter_costs)); png_const_fixed_point_p filter_costs))
#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */ #endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */
/* Heuristic used for row filter selection. These defines should NOT be /* Heuristic used for row filter selection. These defines should NOT be
@ -2045,15 +2045,15 @@ PNG_EXPORT(124, png_uint_32, png_get_y_pixels_per_meter,
/* Returns pixel aspect ratio, computed from pHYs chunk data. */ /* Returns pixel aspect ratio, computed from pHYs chunk data. */
PNG_FP_EXPORT(125, float, png_get_pixel_aspect_ratio, PNG_FP_EXPORT(125, float, png_get_pixel_aspect_ratio,
(png_const_structrp png_ptr, png_const_inforp info_ptr)); (png_const_structrp png_ptr, png_const_inforp info_ptr))
PNG_FIXED_EXPORT(210, png_fixed_point, png_get_pixel_aspect_ratio_fixed, PNG_FIXED_EXPORT(210, png_fixed_point, png_get_pixel_aspect_ratio_fixed,
(png_const_structrp png_ptr, png_const_inforp info_ptr)); (png_const_structrp png_ptr, png_const_inforp info_ptr))
/* Returns image x, y offset in pixels or microns, from oFFs chunk data. */ /* Returns image x, y offset in pixels or microns, from oFFs chunk data. */
PNG_EXPORT(126, png_int_32, png_get_x_offset_pixels, (png_const_structrp png_ptr, PNG_EXPORT(126, png_int_32, png_get_x_offset_pixels,
png_const_inforp info_ptr)); (png_const_structrp png_ptr, png_const_inforp info_ptr));
PNG_EXPORT(127, png_int_32, png_get_y_offset_pixels, (png_const_structrp png_ptr, PNG_EXPORT(127, png_int_32, png_get_y_offset_pixels,
png_const_inforp info_ptr)); (png_const_structrp png_ptr, png_const_inforp info_ptr));
PNG_EXPORT(128, png_int_32, png_get_x_offset_microns, PNG_EXPORT(128, png_int_32, png_get_x_offset_microns,
(png_const_structrp png_ptr, png_const_inforp info_ptr)); (png_const_structrp png_ptr, png_const_inforp info_ptr));
PNG_EXPORT(129, png_int_32, png_get_y_offset_microns, PNG_EXPORT(129, png_int_32, png_get_y_offset_microns,
@ -2079,18 +2079,18 @@ PNG_EXPORT(132, void, png_set_bKGD, (png_const_structrp png_ptr,
PNG_FP_EXPORT(133, png_uint_32, png_get_cHRM, (png_const_structrp png_ptr, PNG_FP_EXPORT(133, png_uint_32, png_get_cHRM, (png_const_structrp png_ptr,
png_const_inforp info_ptr, double *white_x, double *white_y, double *red_x, png_const_inforp info_ptr, double *white_x, double *white_y, double *red_x,
double *red_y, double *green_x, double *green_y, double *blue_x, double *red_y, double *green_x, double *green_y, double *blue_x,
double *blue_y)); double *blue_y))
PNG_FP_EXPORT(230, png_uint_32, png_get_cHRM_XYZ, (png_const_structrp png_ptr, PNG_FP_EXPORT(230, png_uint_32, png_get_cHRM_XYZ, (png_const_structrp png_ptr,
png_const_inforp info_ptr, double *red_X, double *red_Y, double *red_Z, png_const_inforp info_ptr, double *red_X, double *red_Y, double *red_Z,
double *green_X, double *green_Y, double *green_Z, double *blue_X, double *green_X, double *green_Y, double *green_Z, double *blue_X,
double *blue_Y, double *blue_Z)); double *blue_Y, double *blue_Z))
#ifdef PNG_FIXED_POINT_SUPPORTED /* Otherwise not implemented */ #ifdef PNG_FIXED_POINT_SUPPORTED /* Otherwise not implemented */
PNG_FIXED_EXPORT(134, png_uint_32, png_get_cHRM_fixed, PNG_FIXED_EXPORT(134, png_uint_32, png_get_cHRM_fixed,
(png_const_structrp png_ptr, png_const_inforp info_ptr, (png_const_structrp png_ptr, png_const_inforp info_ptr,
png_fixed_point *int_white_x, png_fixed_point *int_white_y, png_fixed_point *int_white_x, png_fixed_point *int_white_y,
png_fixed_point *int_red_x, png_fixed_point *int_red_y, png_fixed_point *int_red_x, png_fixed_point *int_red_y,
png_fixed_point *int_green_x, png_fixed_point *int_green_y, png_fixed_point *int_green_x, png_fixed_point *int_green_y,
png_fixed_point *int_blue_x, png_fixed_point *int_blue_y)); png_fixed_point *int_blue_x, png_fixed_point *int_blue_y))
#endif #endif
PNG_FIXED_EXPORT(231, png_uint_32, png_get_cHRM_XYZ_fixed, PNG_FIXED_EXPORT(231, png_uint_32, png_get_cHRM_XYZ_fixed,
(png_const_structrp png_ptr, png_const_inforp info_ptr, (png_const_structrp png_ptr, png_const_inforp info_ptr,
@ -2098,45 +2098,45 @@ PNG_FIXED_EXPORT(231, png_uint_32, png_get_cHRM_XYZ_fixed,
png_fixed_point *int_red_Z, png_fixed_point *int_green_X, png_fixed_point *int_red_Z, png_fixed_point *int_green_X,
png_fixed_point *int_green_Y, png_fixed_point *int_green_Z, png_fixed_point *int_green_Y, png_fixed_point *int_green_Z,
png_fixed_point *int_blue_X, png_fixed_point *int_blue_Y, png_fixed_point *int_blue_X, png_fixed_point *int_blue_Y,
png_fixed_point *int_blue_Z)); png_fixed_point *int_blue_Z))
#endif #endif
#ifdef PNG_cHRM_SUPPORTED #ifdef PNG_cHRM_SUPPORTED
PNG_FP_EXPORT(135, void, png_set_cHRM, (png_const_structrp png_ptr, PNG_FP_EXPORT(135, void, png_set_cHRM, (png_const_structrp png_ptr,
png_inforp info_ptr, png_inforp info_ptr,
double white_x, double white_y, double red_x, double red_y, double green_x, double white_x, double white_y, double red_x, double red_y, double green_x,
double green_y, double blue_x, double blue_y)); double green_y, double blue_x, double blue_y))
PNG_FP_EXPORT(232, void, png_set_cHRM_XYZ, (png_const_structrp png_ptr, PNG_FP_EXPORT(232, void, png_set_cHRM_XYZ, (png_const_structrp png_ptr,
png_inforp info_ptr, double red_X, double red_Y, double red_Z, png_inforp info_ptr, double red_X, double red_Y, double red_Z,
double green_X, double green_Y, double green_Z, double blue_X, double green_X, double green_Y, double green_Z, double blue_X,
double blue_Y, double blue_Z)); double blue_Y, double blue_Z))
PNG_FIXED_EXPORT(136, void, png_set_cHRM_fixed, (png_const_structrp png_ptr, PNG_FIXED_EXPORT(136, void, png_set_cHRM_fixed, (png_const_structrp png_ptr,
png_inforp info_ptr, png_fixed_point int_white_x, png_inforp info_ptr, png_fixed_point int_white_x,
png_fixed_point int_white_y, png_fixed_point int_red_x, png_fixed_point int_white_y, png_fixed_point int_red_x,
png_fixed_point int_red_y, png_fixed_point int_green_x, png_fixed_point int_red_y, png_fixed_point int_green_x,
png_fixed_point int_green_y, png_fixed_point int_blue_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
png_fixed_point int_blue_y)); png_fixed_point int_blue_y))
PNG_FIXED_EXPORT(233, void, png_set_cHRM_XYZ_fixed, (png_const_structrp png_ptr, PNG_FIXED_EXPORT(233, void, png_set_cHRM_XYZ_fixed, (png_const_structrp png_ptr,
png_inforp info_ptr, png_fixed_point int_red_X, png_fixed_point int_red_Y, png_inforp info_ptr, png_fixed_point int_red_X, png_fixed_point int_red_Y,
png_fixed_point int_red_Z, png_fixed_point int_green_X, png_fixed_point int_red_Z, png_fixed_point int_green_X,
png_fixed_point int_green_Y, png_fixed_point int_green_Z, png_fixed_point int_green_Y, png_fixed_point int_green_Z,
png_fixed_point int_blue_X, png_fixed_point int_blue_Y, png_fixed_point int_blue_X, png_fixed_point int_blue_Y,
png_fixed_point int_blue_Z)); png_fixed_point int_blue_Z))
#endif #endif
#ifdef PNG_gAMA_SUPPORTED #ifdef PNG_gAMA_SUPPORTED
PNG_FP_EXPORT(137, png_uint_32, png_get_gAMA, (png_const_structrp png_ptr, PNG_FP_EXPORT(137, png_uint_32, png_get_gAMA, (png_const_structrp png_ptr,
png_const_inforp info_ptr, double *file_gamma)); png_const_inforp info_ptr, double *file_gamma))
PNG_FIXED_EXPORT(138, png_uint_32, png_get_gAMA_fixed, PNG_FIXED_EXPORT(138, png_uint_32, png_get_gAMA_fixed,
(png_const_structrp png_ptr, png_const_inforp info_ptr, (png_const_structrp png_ptr, png_const_inforp info_ptr,
png_fixed_point *int_file_gamma)); png_fixed_point *int_file_gamma))
#endif #endif
#ifdef PNG_gAMA_SUPPORTED #ifdef PNG_gAMA_SUPPORTED
PNG_FP_EXPORT(139, void, png_set_gAMA, (png_const_structrp png_ptr, PNG_FP_EXPORT(139, void, png_set_gAMA, (png_const_structrp png_ptr,
png_inforp info_ptr, double file_gamma)); png_inforp info_ptr, double file_gamma))
PNG_FIXED_EXPORT(140, void, png_set_gAMA_fixed, (png_const_structrp png_ptr, PNG_FIXED_EXPORT(140, void, png_set_gAMA_fixed, (png_const_structrp png_ptr,
png_inforp info_ptr, png_fixed_point int_file_gamma)); png_inforp info_ptr, png_fixed_point int_file_gamma))
#endif #endif
#ifdef PNG_hIST_SUPPORTED #ifdef PNG_hIST_SUPPORTED
@ -2287,7 +2287,7 @@ PNG_EXPORT(167, void, png_set_tRNS, (png_structrp png_ptr,
#ifdef PNG_sCAL_SUPPORTED #ifdef PNG_sCAL_SUPPORTED
PNG_FP_EXPORT(168, png_uint_32, png_get_sCAL, (png_const_structrp png_ptr, PNG_FP_EXPORT(168, png_uint_32, png_get_sCAL, (png_const_structrp png_ptr,
png_const_inforp info_ptr, int *unit, double *width, double *height)); png_const_inforp info_ptr, int *unit, double *width, double *height))
#if (defined PNG_FLOATING_ARITHMETIC_SUPPORTED) || \ #if (defined PNG_FLOATING_ARITHMETIC_SUPPORTED) || \
(defined PNG_FLOATING_POINT_SUPPORTED) (defined PNG_FLOATING_POINT_SUPPORTED)
/* NOTE: this API is currently implemented using floating point arithmetic, /* NOTE: this API is currently implemented using floating point arithmetic,
@ -2297,17 +2297,17 @@ PNG_FP_EXPORT(168, png_uint_32, png_get_sCAL, (png_const_structrp png_ptr,
*/ */
PNG_FIXED_EXPORT(214, png_uint_32, png_get_sCAL_fixed, PNG_FIXED_EXPORT(214, png_uint_32, png_get_sCAL_fixed,
(png_const_structrp png_ptr, png_const_inforp info_ptr, int *unit, (png_const_structrp png_ptr, png_const_inforp info_ptr, int *unit,
png_fixed_point *width, png_fixed_point *height)); png_fixed_point *width, png_fixed_point *height))
#endif #endif
PNG_EXPORT(169, png_uint_32, png_get_sCAL_s, PNG_EXPORT(169, png_uint_32, png_get_sCAL_s,
(png_const_structrp png_ptr, png_const_inforp info_ptr, int *unit, (png_const_structrp png_ptr, png_const_inforp info_ptr, int *unit,
png_charpp swidth, png_charpp sheight)); png_charpp swidth, png_charpp sheight));
PNG_FP_EXPORT(170, void, png_set_sCAL, (png_const_structrp png_ptr, PNG_FP_EXPORT(170, void, png_set_sCAL, (png_const_structrp png_ptr,
png_inforp info_ptr, int unit, double width, double height)); png_inforp info_ptr, int unit, double width, double height))
PNG_FIXED_EXPORT(213, void, png_set_sCAL_fixed, (png_const_structrp png_ptr, PNG_FIXED_EXPORT(213, void, png_set_sCAL_fixed, (png_const_structrp png_ptr,
png_inforp info_ptr, int unit, png_fixed_point width, png_inforp info_ptr, int unit, png_fixed_point width,
png_fixed_point height)); png_fixed_point height))
PNG_EXPORT(171, void, png_set_sCAL_s, (png_const_structrp png_ptr, PNG_EXPORT(171, void, png_set_sCAL_s, (png_const_structrp png_ptr,
png_inforp info_ptr, int unit, png_inforp info_ptr, int unit,
png_const_charp swidth, png_const_charp sheight)); png_const_charp swidth, png_const_charp sheight));
@ -2418,17 +2418,17 @@ PNG_EXPORT(195, png_uint_32, png_get_y_pixels_per_inch,
(png_const_structrp png_ptr, png_const_inforp info_ptr)); (png_const_structrp png_ptr, png_const_inforp info_ptr));
PNG_FP_EXPORT(196, float, png_get_x_offset_inches, PNG_FP_EXPORT(196, float, png_get_x_offset_inches,
(png_const_structrp png_ptr, png_const_inforp info_ptr)); (png_const_structrp png_ptr, png_const_inforp info_ptr))
#ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */ #ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */
PNG_FIXED_EXPORT(211, png_fixed_point, png_get_x_offset_inches_fixed, PNG_FIXED_EXPORT(211, png_fixed_point, png_get_x_offset_inches_fixed,
(png_const_structrp png_ptr, png_const_inforp info_ptr)); (png_const_structrp png_ptr, png_const_inforp info_ptr))
#endif #endif
PNG_FP_EXPORT(197, float, png_get_y_offset_inches, (png_const_structrp png_ptr, PNG_FP_EXPORT(197, float, png_get_y_offset_inches, (png_const_structrp png_ptr,
png_const_inforp info_ptr)); png_const_inforp info_ptr))
#ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */ #ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */
PNG_FIXED_EXPORT(212, png_fixed_point, png_get_y_offset_inches_fixed, PNG_FIXED_EXPORT(212, png_fixed_point, png_get_y_offset_inches_fixed,
(png_const_structrp png_ptr, png_const_inforp info_ptr)); (png_const_structrp png_ptr, png_const_inforp info_ptr))
#endif #endif
# ifdef PNG_pHYs_SUPPORTED # ifdef PNG_pHYs_SUPPORTED

View File

@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng /* pngconf.h - machine configurable file for libpng
* *
* libpng version 1.6.0beta11 - February 3, 2012 * libpng version 1.6.0beta11 - February 13, 2012
* *
* Copyright (c) 1998-2012 Glenn Randers-Pehrson * Copyright (c) 1998-2012 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -414,7 +414,7 @@
#ifndef PNG_FP_EXPORT /* A floating point API. */ #ifndef PNG_FP_EXPORT /* A floating point API. */
# ifdef PNG_FLOATING_POINT_SUPPORTED # ifdef PNG_FLOATING_POINT_SUPPORTED
# define PNG_FP_EXPORT(ordinal, type, name, args)\ # define PNG_FP_EXPORT(ordinal, type, name, args)\
PNG_EXPORT(ordinal, type, name, args) PNG_EXPORT(ordinal, type, name, args);
# else /* No floating point APIs */ # else /* No floating point APIs */
# define PNG_FP_EXPORT(ordinal, type, name, args) # define PNG_FP_EXPORT(ordinal, type, name, args)
# endif # endif
@ -422,7 +422,7 @@
#ifndef PNG_FIXED_EXPORT /* A fixed point API. */ #ifndef PNG_FIXED_EXPORT /* A fixed point API. */
# ifdef PNG_FIXED_POINT_SUPPORTED # ifdef PNG_FIXED_POINT_SUPPORTED
# define PNG_FIXED_EXPORT(ordinal, type, name, args)\ # define PNG_FIXED_EXPORT(ordinal, type, name, args)\
PNG_EXPORT(ordinal, type, name, args) PNG_EXPORT(ordinal, type, name, args);
# else /* No fixed point APIs */ # else /* No fixed point APIs */
# define PNG_FIXED_EXPORT(ordinal, type, name, args) # define PNG_FIXED_EXPORT(ordinal, type, name, args)
# endif # endif

View File

@ -61,6 +61,20 @@
# define PNG_RESTRICT restrict # define PNG_RESTRICT restrict
#endif #endif
/* To support symbol prefixing it is necessary to know *before* including png.h
* whether the fixed point (and maybe other) APIs are exported, because if they
* are not internal definitions may be required. This is handled below just
* before png.h is included, but load the configuration now if it is available.
*/
#ifndef PNGLCONF_H
# include "pnglibconf.h"
#endif
/* Local renames may change non-exported API functions from png.h */
#if defined PNG_PREFIX && !defined PNGPREFIX_H
# include "pngprefix.h"
#endif
#ifdef PNG_USER_CONFIG #ifdef PNG_USER_CONFIG
# include "pngusr.h" # include "pngusr.h"
/* These should have been defined in pngusr.h */ /* These should have been defined in pngusr.h */
@ -136,12 +150,44 @@
# define PNG_PRIVATE # define PNG_PRIVATE
#endif #endif
/* Symbol preprocessing support.
*
* To enable listing global, but internal, symbols the following macros should
* always be used to declare an extern data or function object in this file.
*/
#ifndef PNG_INTERNAL_DATA
# define PNG_INTERNAL_DATA(type, name, array) extern type name array
#endif
#ifndef PNG_INTERNAL_FUNCTION
# define PNG_INTERNAL_FUNCTION(type, name, args, attributes)\
extern PNG_FUNCTION(type, name, args, PNG_EMPTY attributes)
#endif
/* If floating or fixed point APIs are disabled they may still be compiled
* internally. To handle this make sure they are declared as the appropriate
* internal extern function (otherwise the symbol prefixing stuff won't work and
* the functions will be used without definitions.)
*
* NOTE: although all the API functions are declared here they are not all
* actually built!
*/
#ifndef PNG_FP_EXPORT
# ifndef PNG_FLOATING_POINT_SUPPORTED
# define PNG_FP_EXPORT(ordinal, type, name, args)\
PNG_INTERNAL_FUNCTION(type, name, args, PNG_EMPTY);
# endif
#endif
#ifndef PNG_FIXED_EXPORT
# ifndef PNG_FIXED_POINT_SUPPORTED
# define PNG_FIXED_EXPORT(ordinal, type, name, args)\
PNG_INTERNAL_FUNCTION(type, name, args, PNG_EMPTY);
# endif
#endif
#include "png.h" #include "png.h"
#include "pnginfo.h" #include "pnginfo.h"
#include "pngstruct.h" #include "pngstruct.h"
#if defined PNG_PREFIX && !defined PNGPREFIX_H
# include "pngprefix.h"
#endif
/* pngconf.h does not set PNG_DLL_EXPORT unless it is required, so: */ /* pngconf.h does not set PNG_DLL_EXPORT unless it is required, so: */
#ifndef PNG_DLL_EXPORT #ifndef PNG_DLL_EXPORT
@ -358,20 +404,6 @@ typedef const png_uint_16p * png_const_uint_16pp;
/* End of memory model/platform independent support */ /* End of memory model/platform independent support */
/* End of 1.5.0beta36 move from pngconf.h */ /* End of 1.5.0beta36 move from pngconf.h */
/* Symbol preprocessing support.
*
* To enable listing global, but internal, symbols the following macros should
* always be used to declare an extern data or function object in this file.
*/
#ifndef PNG_INTERNAL_DATA
# define PNG_INTERNAL_DATA(type, name, array) extern type name array
#endif
#ifndef PNG_INTERNAL_FUNCTION
# define PNG_INTERNAL_FUNCTION(type, name, args, attributes)\
extern PNG_FUNCTION(type, name, args, PNG_EMPTY attributes)
#endif
/* CONSTANTS and UTILITY MACROS /* CONSTANTS and UTILITY MACROS
* These are used internally by libpng and not exposed in the API * These are used internally by libpng and not exposed in the API
*/ */
@ -576,7 +608,7 @@ PNG_INTERNAL_DATA(const png_byte, png_sRGB_delta, [512]);
#define png_fixed(png_ptr, fp, s) ((fp) <= 21474 && (fp) >= -21474 ?\ #define png_fixed(png_ptr, fp, s) ((fp) <= 21474 && (fp) >= -21474 ?\
((png_fixed_point)(100000 * (fp))) : (png_fixed_error(png_ptr, s),0)) ((png_fixed_point)(100000 * (fp))) : (png_fixed_error(png_ptr, s),0))
#endif #endif
/* else the corresponding function is defined below, inside the scopt of the /* else the corresponding function is defined below, inside the scope of the
* cplusplus test. * cplusplus test.
*/ */
#endif #endif
@ -796,14 +828,8 @@ PNG_INTERNAL_FUNCTION(void,png_write_IDAT,(png_structrp png_ptr, png_bytep data,
PNG_INTERNAL_FUNCTION(void,png_write_IEND,(png_structrp png_ptr),PNG_EMPTY); PNG_INTERNAL_FUNCTION(void,png_write_IEND,(png_structrp png_ptr),PNG_EMPTY);
#ifdef PNG_WRITE_gAMA_SUPPORTED #ifdef PNG_WRITE_gAMA_SUPPORTED
# ifdef PNG_FLOATING_POINT_SUPPORTED
PNG_INTERNAL_FUNCTION(void,png_write_gAMA,(png_structrp png_ptr, double file_gamma),
PNG_EMPTY);
# endif
# ifdef PNG_FIXED_POINT_SUPPORTED
PNG_INTERNAL_FUNCTION(void,png_write_gAMA_fixed,(png_structrp png_ptr, PNG_INTERNAL_FUNCTION(void,png_write_gAMA_fixed,(png_structrp png_ptr,
png_fixed_point file_gamma),PNG_EMPTY); png_fixed_point file_gamma),PNG_EMPTY);
# endif
#endif #endif
#ifdef PNG_WRITE_sBIT_SUPPORTED #ifdef PNG_WRITE_sBIT_SUPPORTED

View File

@ -18,7 +18,8 @@ SED = sed
COPY = cp COPY = cp
DELETE = rm -f DELETE = rm -f
ECHO = echo ECHO = echo
DFA_XTRA = # Appended to scripts/options.awk DFA_XTRA = # Put your configuration file here, see scripts/pnglibconf.dfa. Eg:
# DFA_XTRA = pngusr.dfa
# CPPFLAGS should contain the options to control the result, # CPPFLAGS should contain the options to control the result,
# but DEFS and CFLAGS are also supported here, override # but DEFS and CFLAGS are also supported here, override
@ -41,7 +42,7 @@ pnglibconf.h: pnglibconf.dfn
$(COPY) dfn3.out $@ $(COPY) dfn3.out $@
$(DELETE) dfn.c dfn1.out dfn2.out dfn3.out $(DELETE) dfn.c dfn1.out dfn2.out dfn3.out
pnglibconf.dfn: $(srcdir)/scripts/pnglibconf.dfa $(srcdir)/scripts/options.awk $(srcdir)/pngconf.h pnglibconf.dfn: $(srcdir)/scripts/pnglibconf.dfa $(srcdir)/scripts/options.awk $(srcdir)/pngconf.h $(DFA_XTRA)
$(DELETE) $@ dfn1.out dfn2.out $(DELETE) $@ dfn1.out dfn2.out
$(ECHO) "Calling $(AWK) from scripts/pnglibconf.mak" >&2 $(ECHO) "Calling $(AWK) from scripts/pnglibconf.mak" >&2
$(ECHO) "If 'awk' crashes try a better awk (e.g. AWK='nawk')" >&2 $(ECHO) "If 'awk' crashes try a better awk (e.g. AWK='nawk')" >&2