[libpng16] Implemented 'restrict' for png_info and png_struct.

Added new "png_structrp" typedef. Because of the
way libpng works both png_info and png_struct are always accessed via a
single pointer.  This means adding C99 'restrict' to the pointer gives
the compiler some opportunity to optimize the code.  This change allows that.
This commit is contained in:
John Bowler 2011-12-24 09:12:00 -06:00 committed by Glenn Randers-Pehrson
parent d7c22fb7ec
commit 5d56786eff
21 changed files with 875 additions and 845 deletions

View File

@ -86,6 +86,11 @@ Version 1.6.0beta04 [December 24, 2011]
which meant it didn't exist even on systems where FP was available but not which meant it didn't exist even on systems where FP was available but not
preferred. preferred.
Added pngvalid.c compile time checks for const APIs. Added pngvalid.c compile time checks for const APIs.
Implemented 'restrict' for png_info and png_struct. Because of the way
libpng works both png_info and png_struct are always accessed via a
single pointer. This means adding C99 'restrict' to the pointer gives
the compiler some opportunity to optimize the code. This change allows
that.
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

@ -3837,6 +3837,11 @@ Version 1.6.0beta04 [December 24, 2011]
which meant it didn't exist even on systems where FP was available but not which meant it didn't exist even on systems where FP was available but not
preferred. preferred.
Added pngvalid.c compile time checks for const APIs. Added pngvalid.c compile time checks for const APIs.
Implemented 'restrict' for png_info and png_struct. Because of the way
libpng works both png_info and png_struct are always accessed via a
single pointer. This means adding C99 'restrict' to the pointer gives
the compiler some opportunity to optimize the code. This change allows
that.
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

@ -39,6 +39,7 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <png.h> #include <png.h>
#include <zlib.h>
int main(int argc, const char **argv) int main(int argc, const char **argv)
{ {

80
png.c
View File

@ -24,7 +24,7 @@ typedef png_libpng_version_1_6_0beta04 Your_png_h_is_not_version_1_6_0beta04;
#ifdef PNG_READ_SUPPORTED #ifdef PNG_READ_SUPPORTED
void PNGAPI void PNGAPI
png_set_sig_bytes(png_structp png_ptr, int num_bytes) png_set_sig_bytes(png_structrp png_ptr, int num_bytes)
{ {
png_debug(1, "in png_set_sig_bytes"); png_debug(1, "in png_set_sig_bytes");
@ -79,27 +79,27 @@ png_zalloc,(voidpf png_ptr, uInt items, uInt size),PNG_ALLOCATED)
if (items >= (~(png_alloc_size_t)0)/size) if (items >= (~(png_alloc_size_t)0)/size)
{ {
png_warning (png_voidcast(png_structp, png_ptr), png_warning (png_voidcast(png_structrp, png_ptr),
"Potential overflow in png_zalloc()"); "Potential overflow in png_zalloc()");
return NULL; return NULL;
} }
num_bytes *= items; num_bytes *= items;
return png_malloc_warn(png_voidcast(png_structp, png_ptr), num_bytes); return png_malloc_warn(png_voidcast(png_structrp, png_ptr), num_bytes);
} }
/* Function to free memory for zlib */ /* Function to free memory for zlib */
void /* PRIVATE */ void /* PRIVATE */
png_zfree(voidpf png_ptr, voidpf ptr) png_zfree(voidpf png_ptr, voidpf ptr)
{ {
png_free(png_voidcast(png_const_structp,png_ptr), ptr); png_free(png_voidcast(png_const_structrp,png_ptr), ptr);
} }
/* Reset the CRC variable to 32 bits of 1's. Care must be taken /* Reset the CRC variable to 32 bits of 1's. Care must be taken
* in case CRC is > 32 bits to leave the top bits 0. * in case CRC is > 32 bits to leave the top bits 0.
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_reset_crc(png_structp png_ptr) png_reset_crc(png_structrp png_ptr)
{ {
/* The cast is safe because the crc is a 32 bit value. */ /* The cast is safe because the crc is a 32 bit value. */
png_ptr->crc = (png_uint_32)crc32(0, Z_NULL, 0); png_ptr->crc = (png_uint_32)crc32(0, Z_NULL, 0);
@ -111,7 +111,7 @@ png_reset_crc(png_structp png_ptr)
* trouble of calculating it. * trouble of calculating it.
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_calculate_crc(png_structp png_ptr, png_const_bytep ptr, png_size_t length) png_calculate_crc(png_structrp png_ptr, png_const_bytep ptr, png_size_t length)
{ {
int need_crc = 1; int need_crc = 1;
@ -163,7 +163,7 @@ png_calculate_crc(png_structp png_ptr, png_const_bytep ptr, png_size_t length)
* functions that create a png_struct * functions that create a png_struct
*/ */
int int
png_user_version_check(png_structp png_ptr, png_const_charp user_png_ver) png_user_version_check(png_structrp png_ptr, png_const_charp user_png_ver)
{ {
if (user_png_ver) if (user_png_ver)
{ {
@ -295,7 +295,7 @@ png_create_png_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
/* Finally allocate the png_struct itself. */ /* Finally allocate the png_struct itself. */
if (create_struct.zbuf != NULL) if (create_struct.zbuf != NULL)
{ {
png_structp png_ptr = png_voidcast(png_structp, png_structrp png_ptr = png_voidcast(png_structrp,
png_malloc_warn(&create_struct, sizeof *png_ptr)); png_malloc_warn(&create_struct, sizeof *png_ptr));
if (png_ptr != NULL) if (png_ptr != NULL)
@ -333,9 +333,9 @@ png_create_png_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
/* Allocate the memory for an info_struct for the application. */ /* Allocate the memory for an info_struct for the application. */
PNG_FUNCTION(png_infop,PNGAPI PNG_FUNCTION(png_infop,PNGAPI
png_create_info_struct,(png_const_structp png_ptr),PNG_ALLOCATED) png_create_info_struct,(png_const_structrp png_ptr),PNG_ALLOCATED)
{ {
png_infop info_ptr; png_inforp info_ptr;
png_debug(1, "in png_create_info_struct"); png_debug(1, "in png_create_info_struct");
@ -347,7 +347,7 @@ png_create_info_struct,(png_const_structp png_ptr),PNG_ALLOCATED)
* error handling *after* creating the info_struct because this is the way it * error handling *after* creating the info_struct because this is the way it
* has always been done in 'example.c'. * has always been done in 'example.c'.
*/ */
info_ptr = png_voidcast(png_infop, png_malloc_base(png_ptr, info_ptr = png_voidcast(png_inforp, png_malloc_base(png_ptr,
sizeof *info_ptr)); sizeof *info_ptr));
if (info_ptr != NULL) if (info_ptr != NULL)
@ -365,9 +365,9 @@ png_create_info_struct,(png_const_structp png_ptr),PNG_ALLOCATED)
* it). * it).
*/ */
void PNGAPI void PNGAPI
png_destroy_info_struct(png_const_structp png_ptr, png_infopp info_ptr_ptr) png_destroy_info_struct(png_const_structrp png_ptr, png_infopp info_ptr_ptr)
{ {
png_infop info_ptr = NULL; png_inforp info_ptr = NULL;
png_debug(1, "in png_destroy_info_struct"); png_debug(1, "in png_destroy_info_struct");
@ -406,7 +406,7 @@ PNG_FUNCTION(void,PNGAPI
png_info_init_3,(png_infopp ptr_ptr, png_size_t png_info_struct_size), png_info_init_3,(png_infopp ptr_ptr, png_size_t png_info_struct_size),
PNG_DEPRECATED) PNG_DEPRECATED)
{ {
png_infop info_ptr = *ptr_ptr; png_inforp info_ptr = *ptr_ptr;
png_debug(1, "in png_info_init_3"); png_debug(1, "in png_info_init_3");
@ -418,7 +418,7 @@ png_info_init_3,(png_infopp ptr_ptr, png_size_t png_info_struct_size),
*ptr_ptr = NULL; *ptr_ptr = NULL;
/* The following line is why this API should not be used: */ /* The following line is why this API should not be used: */
free(info_ptr); free(info_ptr);
info_ptr = png_voidcast(png_infop, png_malloc_base(NULL, info_ptr = png_voidcast(png_inforp, png_malloc_base(NULL,
sizeof *info_ptr)); sizeof *info_ptr));
*ptr_ptr = info_ptr; *ptr_ptr = info_ptr;
} }
@ -428,7 +428,7 @@ png_info_init_3,(png_infopp ptr_ptr, png_size_t png_info_struct_size),
} }
void PNGAPI void PNGAPI
png_data_freer(png_const_structp png_ptr, png_infop info_ptr, png_data_freer(png_const_structrp png_ptr, png_inforp info_ptr,
int freer, png_uint_32 mask) int freer, png_uint_32 mask)
{ {
png_debug(1, "in png_data_freer"); png_debug(1, "in png_data_freer");
@ -448,7 +448,7 @@ png_data_freer(png_const_structp png_ptr, png_infop info_ptr,
} }
void PNGAPI void PNGAPI
png_free_data(png_const_structp png_ptr, png_infop info_ptr, png_uint_32 mask, png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask,
int num) int num)
{ {
png_debug(1, "in png_free_data"); png_debug(1, "in png_free_data");
@ -649,7 +649,7 @@ png_free_data(png_const_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
* pointer before png_write_destroy() or png_read_destroy() are called. * pointer before png_write_destroy() or png_read_destroy() are called.
*/ */
png_voidp PNGAPI png_voidp PNGAPI
png_get_io_ptr(png_const_structp png_ptr) png_get_io_ptr(png_const_structrp png_ptr)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
return (NULL); return (NULL);
@ -666,7 +666,7 @@ png_get_io_ptr(png_const_structp png_ptr)
* function of your own because "FILE *" isn't necessarily available. * function of your own because "FILE *" isn't necessarily available.
*/ */
void PNGAPI void PNGAPI
png_init_io(png_structp png_ptr, png_FILE_p fp) png_init_io(png_structrp png_ptr, png_FILE_p fp)
{ {
png_debug(1, "in png_init_io"); png_debug(1, "in png_init_io");
@ -734,7 +734,7 @@ png_convert_to_rfc1123_buffer(char out[29], png_const_timep ptime)
* buffer (png_struct::time_buffer), better to have the caller pass this in. * buffer (png_struct::time_buffer), better to have the caller pass this in.
*/ */
png_const_charp PNGAPI png_const_charp PNGAPI
png_convert_to_rfc1123(png_structp png_ptr, png_const_timep ptime) png_convert_to_rfc1123(png_structrp png_ptr, png_const_timep ptime)
{ {
if (png_ptr != NULL) if (png_ptr != NULL)
{ {
@ -754,7 +754,7 @@ png_convert_to_rfc1123(png_structp png_ptr, png_const_timep ptime)
#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */ #endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */
png_const_charp PNGAPI png_const_charp PNGAPI
png_get_copyright(png_const_structp png_ptr) png_get_copyright(png_const_structrp png_ptr)
{ {
PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */ PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */
#ifdef PNG_STRING_COPYRIGHT #ifdef PNG_STRING_COPYRIGHT
@ -785,14 +785,14 @@ png_get_copyright(png_const_structp png_ptr)
* it is guaranteed that png.c uses the correct version of png.h. * it is guaranteed that png.c uses the correct version of png.h.
*/ */
png_const_charp PNGAPI png_const_charp PNGAPI
png_get_libpng_ver(png_const_structp png_ptr) png_get_libpng_ver(png_const_structrp png_ptr)
{ {
/* Version of *.c files used when building libpng */ /* Version of *.c files used when building libpng */
return png_get_header_ver(png_ptr); return png_get_header_ver(png_ptr);
} }
png_const_charp PNGAPI png_const_charp PNGAPI
png_get_header_ver(png_const_structp png_ptr) png_get_header_ver(png_const_structrp png_ptr)
{ {
/* Version of *.h files used when building libpng */ /* Version of *.h files used when building libpng */
PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */ PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */
@ -800,7 +800,7 @@ png_get_header_ver(png_const_structp png_ptr)
} }
png_const_charp PNGAPI png_const_charp PNGAPI
png_get_header_version(png_const_structp png_ptr) png_get_header_version(png_const_structrp png_ptr)
{ {
/* Returns longer string containing both version and date */ /* Returns longer string containing both version and date */
PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */ PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */
@ -817,7 +817,7 @@ png_get_header_version(png_const_structp png_ptr)
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
int PNGAPI int PNGAPI
png_handle_as_unknown(png_structp png_ptr, png_const_bytep chunk_name) png_handle_as_unknown(png_structrp png_ptr, png_const_bytep chunk_name)
{ {
/* Check chunk_name and return "keep" value if it's on the list, else 0 */ /* Check chunk_name and return "keep" value if it's on the list, else 0 */
png_const_bytep p, p_end; png_const_bytep p, p_end;
@ -844,7 +844,7 @@ png_handle_as_unknown(png_structp png_ptr, png_const_bytep chunk_name)
} }
int /* PRIVATE */ int /* PRIVATE */
png_chunk_unknown_handling(png_structp png_ptr, png_uint_32 chunk_name) png_chunk_unknown_handling(png_structrp png_ptr, png_uint_32 chunk_name)
{ {
png_byte chunk_string[5]; png_byte chunk_string[5];
@ -856,7 +856,7 @@ png_chunk_unknown_handling(png_structp png_ptr, png_uint_32 chunk_name)
#ifdef PNG_READ_SUPPORTED #ifdef PNG_READ_SUPPORTED
/* This function, added to libpng-1.0.6g, is untested. */ /* This function, added to libpng-1.0.6g, is untested. */
int PNGAPI int PNGAPI
png_reset_zstream(png_structp png_ptr) png_reset_zstream(png_structrp png_ptr)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
return Z_STREAM_ERROR; return Z_STREAM_ERROR;
@ -884,7 +884,7 @@ png_access_version_number(void)
# ifdef PNG_CHECK_cHRM_SUPPORTED # ifdef PNG_CHECK_cHRM_SUPPORTED
int /* PRIVATE */ int /* PRIVATE */
png_check_cHRM_fixed(png_structp png_ptr, png_check_cHRM_fixed(png_structrp png_ptr,
png_fixed_point white_x, png_fixed_point white_y, png_fixed_point red_x, png_fixed_point white_x, png_fixed_point white_y, png_fixed_point red_x,
png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y, png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y,
png_fixed_point blue_x, png_fixed_point blue_y) png_fixed_point blue_x, png_fixed_point blue_y)
@ -1243,7 +1243,7 @@ int png_XYZ_from_xy(png_XYZ *XYZ, png_xy xy)
return 0; /*success*/ return 0; /*success*/
} }
int png_XYZ_from_xy_checked(png_const_structp png_ptr, png_XYZ *XYZ, png_xy xy) int png_XYZ_from_xy_checked(png_const_structrp png_ptr, png_XYZ *XYZ, png_xy xy)
{ {
switch (png_XYZ_from_xy(XYZ, xy)) switch (png_XYZ_from_xy(XYZ, xy))
{ {
@ -1273,7 +1273,7 @@ int png_XYZ_from_xy_checked(png_const_structp png_ptr, png_XYZ *XYZ, png_xy xy)
#endif #endif
void /* PRIVATE */ void /* PRIVATE */
png_check_IHDR(png_const_structp png_ptr, png_check_IHDR(png_const_structrp png_ptr,
png_uint_32 width, png_uint_32 height, int bit_depth, png_uint_32 width, png_uint_32 height, int bit_depth,
int color_type, int interlace_type, int compression_type, int color_type, int interlace_type, int compression_type,
int filter_type) int filter_type)
@ -1608,7 +1608,7 @@ png_pow10(int power)
* precision. * precision.
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_ascii_from_fp(png_structp png_ptr, png_charp ascii, png_size_t size, png_ascii_from_fp(png_structrp png_ptr, png_charp ascii, png_size_t size,
double fp, unsigned int precision) double fp, unsigned int precision)
{ {
/* We use standard functions from math.h, but not printf because /* We use standard functions from math.h, but not printf because
@ -1922,7 +1922,7 @@ png_ascii_from_fp(png_structp png_ptr, png_charp ascii, png_size_t size,
/* Function to format a fixed point value in ASCII. /* Function to format a fixed point value in ASCII.
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_ascii_from_fixed(png_structp png_ptr, png_charp ascii, png_size_t size, png_ascii_from_fixed(png_structrp png_ptr, png_charp ascii, png_size_t size,
png_fixed_point fp) png_fixed_point fp)
{ {
/* Require space for 10 decimal digits, a decimal point, a minus sign and a /* Require space for 10 decimal digits, a decimal point, a minus sign and a
@ -1995,7 +1995,7 @@ png_ascii_from_fixed(png_structp png_ptr, png_charp ascii, png_size_t size,
#if defined(PNG_FLOATING_POINT_SUPPORTED) && \ #if defined(PNG_FLOATING_POINT_SUPPORTED) && \
!defined(PNG_FIXED_POINT_MACRO_SUPPORTED) !defined(PNG_FIXED_POINT_MACRO_SUPPORTED)
png_fixed_point png_fixed_point
png_fixed(png_const_structp png_ptr, double fp, png_const_charp text) png_fixed(png_const_structrp png_ptr, double fp, png_const_charp text)
{ {
double r = floor(100000 * fp + .5); double r = floor(100000 * fp + .5);
@ -2134,7 +2134,7 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
* result. * result.
*/ */
png_fixed_point png_fixed_point
png_muldiv_warn(png_const_structp png_ptr, png_fixed_point a, png_int_32 times, png_muldiv_warn(png_const_structrp png_ptr, png_fixed_point a, png_int_32 times,
png_int_32 divisor) png_int_32 divisor)
{ {
png_fixed_point result; png_fixed_point result;
@ -2601,7 +2601,7 @@ png_gamma_16bit_correct(unsigned int value, png_fixed_point gamma_val)
* 8-bit (as are the arguments.) * 8-bit (as are the arguments.)
*/ */
png_uint_16 /* PRIVATE */ png_uint_16 /* PRIVATE */
png_gamma_correct(png_structp png_ptr, unsigned int value, png_gamma_correct(png_structrp png_ptr, unsigned int value,
png_fixed_point gamma_val) png_fixed_point gamma_val)
{ {
if (png_ptr->bit_depth == 8) if (png_ptr->bit_depth == 8)
@ -2630,7 +2630,7 @@ png_gamma_significant(png_fixed_point gamma_val)
* should be somewhere that will be cleaned. * should be somewhere that will be cleaned.
*/ */
static void static void
png_build_16bit_table(png_structp png_ptr, png_uint_16pp *ptable, png_build_16bit_table(png_structrp png_ptr, png_uint_16pp *ptable,
PNG_CONST unsigned int shift, PNG_CONST png_fixed_point gamma_val) PNG_CONST unsigned int shift, PNG_CONST png_fixed_point gamma_val)
{ {
/* Various values derived from 'shift': */ /* Various values derived from 'shift': */
@ -2698,7 +2698,7 @@ png_build_16bit_table(png_structp png_ptr, png_uint_16pp *ptable,
* required. * required.
*/ */
static void static void
png_build_16to8_table(png_structp png_ptr, png_uint_16pp *ptable, png_build_16to8_table(png_structrp png_ptr, png_uint_16pp *ptable,
PNG_CONST unsigned int shift, PNG_CONST png_fixed_point gamma_val) PNG_CONST unsigned int shift, PNG_CONST png_fixed_point gamma_val)
{ {
PNG_CONST unsigned int num = 1U << (8U - shift); PNG_CONST unsigned int num = 1U << (8U - shift);
@ -2765,7 +2765,7 @@ png_build_16to8_table(png_structp png_ptr, png_uint_16pp *ptable,
* (apparently contrary to the spec) so a 256 entry table is always generated. * (apparently contrary to the spec) so a 256 entry table is always generated.
*/ */
static void static void
png_build_8bit_table(png_structp png_ptr, png_bytepp ptable, png_build_8bit_table(png_structrp png_ptr, png_bytepp ptable,
PNG_CONST png_fixed_point gamma_val) PNG_CONST png_fixed_point gamma_val)
{ {
unsigned int i; unsigned int i;
@ -2782,7 +2782,7 @@ png_build_8bit_table(png_structp png_ptr, png_bytepp ptable,
* tables. * tables.
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_destroy_gamma_table(png_structp png_ptr) png_destroy_gamma_table(png_structrp png_ptr)
{ {
png_free(png_ptr, png_ptr->gamma_table); png_free(png_ptr, png_ptr->gamma_table);
png_ptr->gamma_table = NULL; png_ptr->gamma_table = NULL;
@ -2838,7 +2838,7 @@ png_destroy_gamma_table(png_structp png_ptr)
* we don't need to allocate > 64K chunks for a full 16-bit table. * we don't need to allocate > 64K chunks for a full 16-bit table.
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_build_gamma_table(png_structp png_ptr, int bit_depth) png_build_gamma_table(png_structrp png_ptr, int bit_depth)
{ {
png_debug(1, "in png_build_gamma_table"); png_debug(1, "in png_build_gamma_table");

586
png.h

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng /* pngconf.h - machine configurable file for libpng
* *
* libpng version 1.6.0beta04 - December 22, 2011 * libpng version 1.6.0beta04 - December 24, 2011
* *
* Copyright (c) 1998-2011 Glenn Randers-Pehrson * Copyright (c) 1998-2011 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -334,9 +334,10 @@
#ifdef PNG_PEDANTIC_WARNINGS_SUPPORTED #ifdef PNG_PEDANTIC_WARNINGS_SUPPORTED
/* Support for compiler specific function attributes. These are used /* Support for compiler specific function attributes. These are used
* so that where compiler support is available incorrect use of API * so that where compiler support is available, incorrect use of API
* functions in png.h will generate compiler warnings. Added at libpng * functions in png.h will generate compiler warnings. Added at libpng
* version 1.2.41. * version 1.2.41. Disabling these removes the warnings but may also produce
* less efficient code.
*/ */
# if defined(__GNUC__) # if defined(__GNUC__)
# ifndef PNG_USE_RESULT # ifndef PNG_USE_RESULT
@ -360,9 +361,11 @@
__attribute__((__deprecated__)) __attribute__((__deprecated__))
# endif # endif
# endif # endif
# endif /* __GNUC__ */ # ifndef PNG_RESTRICT
# define PNG_RESTRICT __restrict
# endif
# if defined(_MSC_VER) && (_MSC_VER >= 1300) # elif defined(_MSC_VER) && (_MSC_VER >= 1300)
# ifndef PNG_USE_RESULT # ifndef PNG_USE_RESULT
# define PNG_USE_RESULT /* not supported */ # define PNG_USE_RESULT /* not supported */
# endif # endif
@ -380,6 +383,16 @@
# ifndef PNG_PRIVATE # ifndef PNG_PRIVATE
# define PNG_PRIVATE __declspec(deprecated) # define PNG_PRIVATE __declspec(deprecated)
# endif # endif
# ifndef PNG_RESTRICT
# if (_MSC_VER >= 1400)
# define PNG_RESTRICT __restrict
# endif
# endif
# elif defined(__WATCOMC__)
# ifndef PNG_RESTRICT
# define PNG_RESTRICT __restrict
# endif
# endif /* _MSC_VER */ # endif /* _MSC_VER */
#endif /* PNG_PEDANTIC_WARNINGS */ #endif /* PNG_PEDANTIC_WARNINGS */

View File

@ -20,12 +20,12 @@
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
static PNG_FUNCTION(void, png_default_error,PNGARG((png_const_structp png_ptr, static PNG_FUNCTION(void, png_default_error,PNGARG((png_const_structrp png_ptr,
png_const_charp error_message)),PNG_NORETURN); png_const_charp error_message)),PNG_NORETURN);
#ifdef PNG_WARNINGS_SUPPORTED #ifdef PNG_WARNINGS_SUPPORTED
static void /* PRIVATE */ static void /* PRIVATE */
png_default_warning PNGARG((png_const_structp png_ptr, png_default_warning PNGARG((png_const_structrp png_ptr,
png_const_charp warning_message)); png_const_charp warning_message));
#endif /* PNG_WARNINGS_SUPPORTED */ #endif /* PNG_WARNINGS_SUPPORTED */
@ -36,7 +36,7 @@ png_default_warning PNGARG((png_const_structp png_ptr,
*/ */
#ifdef PNG_ERROR_TEXT_SUPPORTED #ifdef PNG_ERROR_TEXT_SUPPORTED
PNG_FUNCTION(void,PNGAPI PNG_FUNCTION(void,PNGAPI
png_error,(png_const_structp png_ptr, png_const_charp error_message), png_error,(png_const_structrp png_ptr, png_const_charp error_message),
PNG_NORETURN) PNG_NORETURN)
{ {
#ifdef PNG_ERROR_NUMBERS_SUPPORTED #ifdef PNG_ERROR_NUMBERS_SUPPORTED
@ -80,7 +80,7 @@ png_error,(png_const_structp png_ptr, png_const_charp error_message),
} }
#endif #endif
if (png_ptr != NULL && png_ptr->error_fn != NULL) if (png_ptr != NULL && png_ptr->error_fn != NULL)
(*(png_ptr->error_fn))(png_constcast(png_structp,png_ptr), error_message); (*(png_ptr->error_fn))(png_constcast(png_structrp,png_ptr), error_message);
/* If the custom handler doesn't exist, or if it returns, /* If the custom handler doesn't exist, or if it returns,
use the default handler, which will not return. */ use the default handler, which will not return. */
@ -88,7 +88,7 @@ png_error,(png_const_structp png_ptr, png_const_charp error_message),
} }
#else #else
PNG_FUNCTION(void,PNGAPI PNG_FUNCTION(void,PNGAPI
png_err,(png_const_structp png_ptr),PNG_NORETURN) png_err,(png_const_structrp png_ptr),PNG_NORETURN)
{ {
/* Prior to 1.5.2 the error_fn received a NULL pointer, expressed /* Prior to 1.5.2 the error_fn received a NULL pointer, expressed
* erroneously as '\0', instead of the empty string "". This was * erroneously as '\0', instead of the empty string "". This was
@ -212,7 +212,7 @@ png_format_number(png_const_charp start, png_charp end, int format,
* png_set_error_fn() to replace the warning function at run-time. * png_set_error_fn() to replace the warning function at run-time.
*/ */
void PNGAPI void PNGAPI
png_warning(png_const_structp png_ptr, png_const_charp warning_message) png_warning(png_const_structrp png_ptr, png_const_charp warning_message)
{ {
int offset = 0; int offset = 0;
if (png_ptr != NULL) if (png_ptr != NULL)
@ -231,7 +231,7 @@ png_warning(png_const_structp png_ptr, png_const_charp warning_message)
} }
} }
if (png_ptr != NULL && png_ptr->warning_fn != NULL) if (png_ptr != NULL && png_ptr->warning_fn != NULL)
(*(png_ptr->warning_fn))(png_constcast(png_structp,png_ptr), (*(png_ptr->warning_fn))(png_constcast(png_structrp,png_ptr),
warning_message + offset); warning_message + offset);
else else
png_default_warning(png_ptr, warning_message + offset); png_default_warning(png_ptr, warning_message + offset);
@ -280,7 +280,7 @@ png_warning_parameter_signed(png_warning_parameters p, int number, int format,
} }
void void
png_formatted_warning(png_const_structp png_ptr, png_warning_parameters p, png_formatted_warning(png_const_structrp png_ptr, png_warning_parameters p,
png_const_charp message) png_const_charp message)
{ {
/* The internal buffer is just 128 bytes - enough for all our messages, /* The internal buffer is just 128 bytes - enough for all our messages,
@ -349,7 +349,7 @@ png_formatted_warning(png_const_structp png_ptr, png_warning_parameters p,
#ifdef PNG_BENIGN_ERRORS_SUPPORTED #ifdef PNG_BENIGN_ERRORS_SUPPORTED
void PNGAPI void PNGAPI
png_benign_error(png_const_structp png_ptr, png_const_charp error_message) png_benign_error(png_const_structrp png_ptr, png_const_charp error_message)
{ {
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN) if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
png_warning(png_ptr, error_message); png_warning(png_ptr, error_message);
@ -373,7 +373,7 @@ static PNG_CONST char png_digit[16] = {
#define PNG_MAX_ERROR_TEXT 64 #define PNG_MAX_ERROR_TEXT 64
#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED) #if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED)
static void /* PRIVATE */ static void /* PRIVATE */
png_format_buffer(png_const_structp png_ptr, png_charp buffer, png_const_charp png_format_buffer(png_const_structrp png_ptr, png_charp buffer, png_const_charp
error_message) error_message)
{ {
png_uint_32 chunk_name = png_ptr->chunk_name; png_uint_32 chunk_name = png_ptr->chunk_name;
@ -419,7 +419,7 @@ png_format_buffer(png_const_structp png_ptr, png_charp buffer, png_const_charp
#if defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED) #if defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)
PNG_FUNCTION(void,PNGAPI PNG_FUNCTION(void,PNGAPI
png_chunk_error,(png_const_structp png_ptr, png_const_charp error_message), png_chunk_error,(png_const_structrp png_ptr, png_const_charp error_message),
PNG_NORETURN) PNG_NORETURN)
{ {
char msg[18+PNG_MAX_ERROR_TEXT]; char msg[18+PNG_MAX_ERROR_TEXT];
@ -436,7 +436,7 @@ png_chunk_error,(png_const_structp png_ptr, png_const_charp error_message),
#ifdef PNG_WARNINGS_SUPPORTED #ifdef PNG_WARNINGS_SUPPORTED
void PNGAPI void PNGAPI
png_chunk_warning(png_const_structp png_ptr, png_const_charp warning_message) png_chunk_warning(png_const_structrp png_ptr, png_const_charp warning_message)
{ {
char msg[18+PNG_MAX_ERROR_TEXT]; char msg[18+PNG_MAX_ERROR_TEXT];
if (png_ptr == NULL) if (png_ptr == NULL)
@ -453,7 +453,7 @@ png_chunk_warning(png_const_structp png_ptr, png_const_charp warning_message)
#ifdef PNG_READ_SUPPORTED #ifdef PNG_READ_SUPPORTED
#ifdef PNG_BENIGN_ERRORS_SUPPORTED #ifdef PNG_BENIGN_ERRORS_SUPPORTED
void PNGAPI void PNGAPI
png_chunk_benign_error(png_const_structp png_ptr, png_const_charp error_message) png_chunk_benign_error(png_const_structrp png_ptr, png_const_charp error_message)
{ {
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN) if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
png_chunk_warning(png_ptr, error_message); png_chunk_warning(png_ptr, error_message);
@ -467,7 +467,7 @@ png_chunk_benign_error(png_const_structp png_ptr, png_const_charp error_message)
#ifdef PNG_ERROR_TEXT_SUPPORTED #ifdef PNG_ERROR_TEXT_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
PNG_FUNCTION(void, PNG_FUNCTION(void,
png_fixed_error,(png_const_structp png_ptr, png_const_charp name),PNG_NORETURN) png_fixed_error,(png_const_structrp png_ptr, png_const_charp name),PNG_NORETURN)
{ {
# define fixed_message "fixed point overflow in " # define fixed_message "fixed point overflow in "
# define fixed_message_ln ((sizeof fixed_message)-1) # define fixed_message_ln ((sizeof fixed_message)-1)
@ -491,7 +491,7 @@ png_fixed_error,(png_const_structp png_ptr, png_const_charp name),PNG_NORETURN)
* otherwise it is necessary for png_default_error to be overridden. * otherwise it is necessary for png_default_error to be overridden.
*/ */
jmp_buf* PNGAPI jmp_buf* PNGAPI
png_set_longjmp_fn(png_structp png_ptr, png_longjmp_ptr longjmp_fn, png_set_longjmp_fn(png_structrp png_ptr, png_longjmp_ptr longjmp_fn,
size_t jmp_buf_size) size_t jmp_buf_size)
{ {
/* From libpng 1.6.0 the app gets one chance to set a 'jmpbuf_size' value /* From libpng 1.6.0 the app gets one chance to set a 'jmpbuf_size' value
@ -560,7 +560,7 @@ png_set_longjmp_fn(png_structp png_ptr, png_longjmp_ptr longjmp_fn,
} }
void /* PRIVATE */ void /* PRIVATE */
png_free_jmpbuf(png_structp png_ptr) png_free_jmpbuf(png_structrp png_ptr)
{ {
if (png_ptr != NULL) if (png_ptr != NULL)
{ {
@ -605,7 +605,7 @@ png_free_jmpbuf(png_structp png_ptr)
* error function pointer in png_set_error_fn(). * error function pointer in png_set_error_fn().
*/ */
static PNG_FUNCTION(void /* PRIVATE */, static PNG_FUNCTION(void /* PRIVATE */,
png_default_error,(png_const_structp png_ptr, png_const_charp error_message), png_default_error,(png_const_structrp png_ptr, png_const_charp error_message),
PNG_NORETURN) PNG_NORETURN)
{ {
#ifdef PNG_CONSOLE_IO_SUPPORTED #ifdef PNG_CONSOLE_IO_SUPPORTED
@ -652,7 +652,7 @@ png_default_error,(png_const_structp png_ptr, png_const_charp error_message),
} }
PNG_FUNCTION(void,PNGAPI PNG_FUNCTION(void,PNGAPI
png_longjmp,(png_const_structp png_ptr, int val),PNG_NORETURN) png_longjmp,(png_const_structrp png_ptr, int val),PNG_NORETURN)
{ {
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
if (png_ptr && png_ptr->longjmp_fn && png_ptr->jmp_buf_ptr) if (png_ptr && png_ptr->longjmp_fn && png_ptr->jmp_buf_ptr)
@ -670,7 +670,7 @@ png_longjmp,(png_const_structp png_ptr, int val),PNG_NORETURN)
* not used, but it is passed in case it may be useful. * not used, but it is passed in case it may be useful.
*/ */
static void /* PRIVATE */ static void /* PRIVATE */
png_default_warning(png_const_structp png_ptr, png_const_charp warning_message) png_default_warning(png_const_structrp png_ptr, png_const_charp warning_message)
{ {
#ifdef PNG_CONSOLE_IO_SUPPORTED #ifdef PNG_CONSOLE_IO_SUPPORTED
# ifdef PNG_ERROR_NUMBERS_SUPPORTED # ifdef PNG_ERROR_NUMBERS_SUPPORTED
@ -720,7 +720,7 @@ png_default_warning(png_const_structp png_ptr, png_const_charp warning_message)
* method used in the default routine calls longjmp(png_ptr->jmp_buf_ptr, 1) * method used in the default routine calls longjmp(png_ptr->jmp_buf_ptr, 1)
*/ */
void PNGAPI void PNGAPI
png_set_error_fn(png_structp png_ptr, png_voidp error_ptr, png_set_error_fn(png_structrp png_ptr, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warning_fn) png_error_ptr error_fn, png_error_ptr warning_fn)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
@ -741,7 +741,7 @@ png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
* pointer before png_write_destroy and png_read_destroy are called. * pointer before png_write_destroy and png_read_destroy are called.
*/ */
png_voidp PNGAPI png_voidp PNGAPI
png_get_error_ptr(png_const_structp png_ptr) png_get_error_ptr(png_const_structrp png_ptr)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
return NULL; return NULL;
@ -752,7 +752,7 @@ png_get_error_ptr(png_const_structp png_ptr)
#ifdef PNG_ERROR_NUMBERS_SUPPORTED #ifdef PNG_ERROR_NUMBERS_SUPPORTED
void PNGAPI void PNGAPI
png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode) png_set_strip_error_numbers(png_structrp png_ptr, png_uint_32 strip_mode)
{ {
if (png_ptr != NULL) if (png_ptr != NULL)
{ {
@ -773,7 +773,7 @@ PNG_FUNCTION(void /* PRIVATE */,
png_safe_error,(png_structp png_nonconst_ptr, png_const_charp error_message), png_safe_error,(png_structp png_nonconst_ptr, png_const_charp error_message),
PNG_NORETURN) PNG_NORETURN)
{ {
const png_const_structp png_ptr = png_nonconst_ptr; const png_const_structrp png_ptr = png_nonconst_ptr;
png_imagep image = png_voidcast(png_imagep, png_ptr->error_ptr); png_imagep image = png_voidcast(png_imagep, png_ptr->error_ptr);
/* An error is always logged here, overwriting anything (typically a warning) /* An error is always logged here, overwriting anything (typically a warning)
@ -807,7 +807,7 @@ png_safe_error,(png_structp png_nonconst_ptr, png_const_charp error_message),
void /* PRIVATE */ void /* PRIVATE */
png_safe_warning(png_structp png_nonconst_ptr, png_const_charp warning_message) png_safe_warning(png_structp png_nonconst_ptr, png_const_charp warning_message)
{ {
const png_const_structp png_ptr = png_nonconst_ptr; const png_const_structrp png_ptr = png_nonconst_ptr;
png_imagep image = png_voidcast(png_imagep, png_ptr->error_ptr); png_imagep image = png_voidcast(png_imagep, png_ptr->error_ptr);
/* A warning is only logged if there is no prior warning or error. */ /* A warning is only logged if there is no prior warning or error. */

134
pngget.c
View File

@ -17,7 +17,7 @@
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_valid(png_const_structp png_ptr, png_const_infop info_ptr, png_get_valid(png_const_structrp png_ptr, png_const_inforp info_ptr,
png_uint_32 flag) png_uint_32 flag)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
@ -27,7 +27,7 @@ png_get_valid(png_const_structp png_ptr, png_const_infop info_ptr,
} }
png_size_t PNGAPI png_size_t PNGAPI
png_get_rowbytes(png_const_structp png_ptr, png_const_infop info_ptr) png_get_rowbytes(png_const_structrp png_ptr, png_const_inforp info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
return(info_ptr->rowbytes); return(info_ptr->rowbytes);
@ -37,7 +37,7 @@ png_get_rowbytes(png_const_structp png_ptr, png_const_infop info_ptr)
#ifdef PNG_INFO_IMAGE_SUPPORTED #ifdef PNG_INFO_IMAGE_SUPPORTED
png_bytepp PNGAPI png_bytepp PNGAPI
png_get_rows(png_const_structp png_ptr, png_const_infop info_ptr) png_get_rows(png_const_structrp png_ptr, png_const_inforp info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
return(info_ptr->row_pointers); return(info_ptr->row_pointers);
@ -49,7 +49,7 @@ png_get_rows(png_const_structp png_ptr, png_const_infop info_ptr)
#ifdef PNG_EASY_ACCESS_SUPPORTED #ifdef PNG_EASY_ACCESS_SUPPORTED
/* Easy access to info, added in libpng-0.99 */ /* Easy access to info, added in libpng-0.99 */
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_image_width(png_const_structp png_ptr, png_const_infop info_ptr) png_get_image_width(png_const_structrp png_ptr, png_const_inforp info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
return info_ptr->width; return info_ptr->width;
@ -58,7 +58,7 @@ png_get_image_width(png_const_structp png_ptr, png_const_infop info_ptr)
} }
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_image_height(png_const_structp png_ptr, png_const_infop info_ptr) png_get_image_height(png_const_structrp png_ptr, png_const_inforp info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
return info_ptr->height; return info_ptr->height;
@ -67,7 +67,7 @@ png_get_image_height(png_const_structp png_ptr, png_const_infop info_ptr)
} }
png_byte PNGAPI png_byte PNGAPI
png_get_bit_depth(png_const_structp png_ptr, png_const_infop info_ptr) png_get_bit_depth(png_const_structrp png_ptr, png_const_inforp info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
return info_ptr->bit_depth; return info_ptr->bit_depth;
@ -76,7 +76,7 @@ png_get_bit_depth(png_const_structp png_ptr, png_const_infop info_ptr)
} }
png_byte PNGAPI png_byte PNGAPI
png_get_color_type(png_const_structp png_ptr, png_const_infop info_ptr) png_get_color_type(png_const_structrp png_ptr, png_const_inforp info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
return info_ptr->color_type; return info_ptr->color_type;
@ -85,7 +85,7 @@ png_get_color_type(png_const_structp png_ptr, png_const_infop info_ptr)
} }
png_byte PNGAPI png_byte PNGAPI
png_get_filter_type(png_const_structp png_ptr, png_const_infop info_ptr) png_get_filter_type(png_const_structrp png_ptr, png_const_inforp info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
return info_ptr->filter_type; return info_ptr->filter_type;
@ -94,7 +94,7 @@ png_get_filter_type(png_const_structp png_ptr, png_const_infop info_ptr)
} }
png_byte PNGAPI png_byte PNGAPI
png_get_interlace_type(png_const_structp png_ptr, png_const_infop info_ptr) png_get_interlace_type(png_const_structrp png_ptr, png_const_inforp info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
return info_ptr->interlace_type; return info_ptr->interlace_type;
@ -103,7 +103,7 @@ png_get_interlace_type(png_const_structp png_ptr, png_const_infop info_ptr)
} }
png_byte PNGAPI png_byte PNGAPI
png_get_compression_type(png_const_structp png_ptr, png_const_infop info_ptr) png_get_compression_type(png_const_structrp png_ptr, png_const_inforp info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
return info_ptr->compression_type; return info_ptr->compression_type;
@ -112,7 +112,7 @@ png_get_compression_type(png_const_structp png_ptr, png_const_infop info_ptr)
} }
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_x_pixels_per_meter(png_const_structp png_ptr, png_const_infop info_ptr) png_get_x_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp info_ptr)
{ {
#ifdef PNG_pHYs_SUPPORTED #ifdef PNG_pHYs_SUPPORTED
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
@ -129,7 +129,7 @@ png_get_x_pixels_per_meter(png_const_structp png_ptr, png_const_infop info_ptr)
} }
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_y_pixels_per_meter(png_const_structp png_ptr, png_const_infop info_ptr) png_get_y_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp info_ptr)
{ {
#ifdef PNG_pHYs_SUPPORTED #ifdef PNG_pHYs_SUPPORTED
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
@ -146,7 +146,7 @@ png_get_y_pixels_per_meter(png_const_structp png_ptr, png_const_infop info_ptr)
} }
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_pixels_per_meter(png_const_structp png_ptr, png_const_infop info_ptr) png_get_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp info_ptr)
{ {
#ifdef PNG_pHYs_SUPPORTED #ifdef PNG_pHYs_SUPPORTED
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
@ -164,7 +164,7 @@ png_get_pixels_per_meter(png_const_structp png_ptr, png_const_infop info_ptr)
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
float PNGAPI float PNGAPI
png_get_pixel_aspect_ratio(png_const_structp png_ptr, png_const_infop info_ptr) png_get_pixel_aspect_ratio(png_const_structrp png_ptr, png_const_inforp info_ptr)
{ {
#ifdef PNG_READ_pHYs_SUPPORTED #ifdef PNG_READ_pHYs_SUPPORTED
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
@ -183,8 +183,8 @@ png_get_pixel_aspect_ratio(png_const_structp png_ptr, png_const_infop info_ptr)
#ifdef PNG_FIXED_POINT_SUPPORTED #ifdef PNG_FIXED_POINT_SUPPORTED
png_fixed_point PNGAPI png_fixed_point PNGAPI
png_get_pixel_aspect_ratio_fixed(png_const_structp png_ptr, png_get_pixel_aspect_ratio_fixed(png_const_structrp png_ptr,
png_const_infop info_ptr) png_const_inforp info_ptr)
{ {
#ifdef PNG_READ_pHYs_SUPPORTED #ifdef PNG_READ_pHYs_SUPPORTED
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)
@ -210,7 +210,7 @@ png_get_pixel_aspect_ratio_fixed(png_const_structp png_ptr,
#endif #endif
png_int_32 PNGAPI png_int_32 PNGAPI
png_get_x_offset_microns(png_const_structp png_ptr, png_const_infop info_ptr) png_get_x_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
{ {
#ifdef PNG_oFFs_SUPPORTED #ifdef PNG_oFFs_SUPPORTED
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
@ -226,7 +226,7 @@ png_get_x_offset_microns(png_const_structp png_ptr, png_const_infop info_ptr)
} }
png_int_32 PNGAPI png_int_32 PNGAPI
png_get_y_offset_microns(png_const_structp png_ptr, png_const_infop info_ptr) png_get_y_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
{ {
#ifdef PNG_oFFs_SUPPORTED #ifdef PNG_oFFs_SUPPORTED
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
@ -242,7 +242,7 @@ png_get_y_offset_microns(png_const_structp png_ptr, png_const_infop info_ptr)
} }
png_int_32 PNGAPI png_int_32 PNGAPI
png_get_x_offset_pixels(png_const_structp png_ptr, png_const_infop info_ptr) png_get_x_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
{ {
#ifdef PNG_oFFs_SUPPORTED #ifdef PNG_oFFs_SUPPORTED
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
@ -258,7 +258,7 @@ png_get_x_offset_pixels(png_const_structp png_ptr, png_const_infop info_ptr)
} }
png_int_32 PNGAPI png_int_32 PNGAPI
png_get_y_offset_pixels(png_const_structp png_ptr, png_const_infop info_ptr) png_get_y_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
{ {
#ifdef PNG_oFFs_SUPPORTED #ifdef PNG_oFFs_SUPPORTED
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
@ -307,26 +307,26 @@ ppi_from_ppm(png_uint_32 ppm)
} }
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_pixels_per_inch(png_const_structp png_ptr, png_const_infop info_ptr) png_get_pixels_per_inch(png_const_structrp png_ptr, png_const_inforp info_ptr)
{ {
return ppi_from_ppm(png_get_pixels_per_meter(png_ptr, info_ptr)); return ppi_from_ppm(png_get_pixels_per_meter(png_ptr, info_ptr));
} }
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_x_pixels_per_inch(png_const_structp png_ptr, png_const_infop info_ptr) png_get_x_pixels_per_inch(png_const_structrp png_ptr, png_const_inforp info_ptr)
{ {
return ppi_from_ppm(png_get_x_pixels_per_meter(png_ptr, info_ptr)); return ppi_from_ppm(png_get_x_pixels_per_meter(png_ptr, info_ptr));
} }
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_y_pixels_per_inch(png_const_structp png_ptr, png_const_infop info_ptr) png_get_y_pixels_per_inch(png_const_structrp png_ptr, png_const_inforp info_ptr)
{ {
return ppi_from_ppm(png_get_y_pixels_per_meter(png_ptr, info_ptr)); return ppi_from_ppm(png_get_y_pixels_per_meter(png_ptr, info_ptr));
} }
#ifdef PNG_FIXED_POINT_SUPPORTED #ifdef PNG_FIXED_POINT_SUPPORTED
static png_fixed_point static png_fixed_point
png_fixed_inches_from_microns(png_const_structp png_ptr, png_int_32 microns) png_fixed_inches_from_microns(png_const_structrp png_ptr, png_int_32 microns)
{ {
/* Convert from metres * 1,000,000 to inches * 100,000, meters to /* Convert from metres * 1,000,000 to inches * 100,000, meters to
* inches is simply *(100/2.54), so we want *(10/2.54) == 500/127. * inches is simply *(100/2.54), so we want *(10/2.54) == 500/127.
@ -337,8 +337,8 @@ png_fixed_inches_from_microns(png_const_structp png_ptr, png_int_32 microns)
} }
png_fixed_point PNGAPI png_fixed_point PNGAPI
png_get_x_offset_inches_fixed(png_const_structp png_ptr, png_get_x_offset_inches_fixed(png_const_structrp png_ptr,
png_const_infop info_ptr) png_const_inforp info_ptr)
{ {
return png_fixed_inches_from_microns(png_ptr, return png_fixed_inches_from_microns(png_ptr,
png_get_x_offset_microns(png_ptr, info_ptr)); png_get_x_offset_microns(png_ptr, info_ptr));
@ -347,8 +347,8 @@ png_get_x_offset_inches_fixed(png_const_structp png_ptr,
#ifdef PNG_FIXED_POINT_SUPPORTED #ifdef PNG_FIXED_POINT_SUPPORTED
png_fixed_point PNGAPI png_fixed_point PNGAPI
png_get_y_offset_inches_fixed(png_const_structp png_ptr, png_get_y_offset_inches_fixed(png_const_structrp png_ptr,
png_const_infop info_ptr) png_const_inforp info_ptr)
{ {
return png_fixed_inches_from_microns(png_ptr, return png_fixed_inches_from_microns(png_ptr,
png_get_y_offset_microns(png_ptr, info_ptr)); png_get_y_offset_microns(png_ptr, info_ptr));
@ -357,7 +357,7 @@ png_get_y_offset_inches_fixed(png_const_structp png_ptr,
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
float PNGAPI float PNGAPI
png_get_x_offset_inches(png_const_structp png_ptr, png_const_infop info_ptr) png_get_x_offset_inches(png_const_structrp png_ptr, png_const_inforp info_ptr)
{ {
/* To avoid the overflow do the conversion directly in floating /* To avoid the overflow do the conversion directly in floating
* point. * point.
@ -368,7 +368,7 @@ png_get_x_offset_inches(png_const_structp png_ptr, png_const_infop info_ptr)
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
float PNGAPI float PNGAPI
png_get_y_offset_inches(png_const_structp png_ptr, png_const_infop info_ptr) png_get_y_offset_inches(png_const_structrp png_ptr, png_const_inforp info_ptr)
{ {
/* To avoid the overflow do the conversion directly in floating /* To avoid the overflow do the conversion directly in floating
* point. * point.
@ -379,7 +379,7 @@ png_get_y_offset_inches(png_const_structp png_ptr, png_const_infop info_ptr)
#ifdef PNG_pHYs_SUPPORTED #ifdef PNG_pHYs_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_pHYs_dpi(png_const_structp png_ptr, png_const_infop info_ptr, png_get_pHYs_dpi(png_const_structrp png_ptr, png_const_inforp info_ptr,
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type) png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
{ {
png_uint_32 retval = 0; png_uint_32 retval = 0;
@ -423,7 +423,7 @@ png_get_pHYs_dpi(png_const_structp png_ptr, png_const_infop info_ptr,
#endif /* PNG_EASY_ACCESS_SUPPORTED */ #endif /* PNG_EASY_ACCESS_SUPPORTED */
png_byte PNGAPI png_byte PNGAPI
png_get_channels(png_const_structp png_ptr, png_const_infop info_ptr) png_get_channels(png_const_structrp png_ptr, png_const_inforp info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
return(info_ptr->channels); return(info_ptr->channels);
@ -432,7 +432,7 @@ png_get_channels(png_const_structp png_ptr, png_const_infop info_ptr)
} }
png_const_bytep PNGAPI png_const_bytep PNGAPI
png_get_signature(png_const_structp png_ptr, png_infop info_ptr) png_get_signature(png_const_structrp png_ptr, png_inforp info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
return(info_ptr->signature); return(info_ptr->signature);
@ -442,7 +442,7 @@ png_get_signature(png_const_structp png_ptr, png_infop info_ptr)
#ifdef PNG_bKGD_SUPPORTED #ifdef PNG_bKGD_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_bKGD(png_const_structp png_ptr, png_infop info_ptr, png_get_bKGD(png_const_structrp png_ptr, png_inforp info_ptr,
png_color_16p *background) png_color_16p *background)
{ {
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD)
@ -464,7 +464,7 @@ png_get_bKGD(png_const_structp png_ptr, png_infop info_ptr,
* cHRM chunk in 1.5.4 * cHRM chunk in 1.5.4
*/ */
png_uint_32 PNGFAPI png_uint_32 PNGFAPI
png_get_cHRM_XYZ_fixed(png_const_structp png_ptr, png_const_infop info_ptr, png_get_cHRM_XYZ_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
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_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,
@ -520,7 +520,7 @@ png_get_cHRM_XYZ_fixed(png_const_structp png_ptr, png_const_infop info_ptr,
# ifdef PNG_FLOATING_POINT_SUPPORTED # ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_cHRM(png_const_structp png_ptr, png_const_infop info_ptr, png_get_cHRM(png_const_structrp png_ptr, png_const_inforp info_ptr,
double *white_x, double *white_y, double *red_x, double *red_y, 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_x, double *green_y, double *blue_x, double *blue_y)
{ {
@ -551,7 +551,7 @@ png_get_cHRM(png_const_structp png_ptr, png_const_infop info_ptr,
} }
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_cHRM_XYZ(png_const_structp png_ptr, png_const_infop info_ptr, png_get_cHRM_XYZ(png_const_structrp png_ptr, png_const_inforp info_ptr,
double *red_X, double *red_Y, double *red_Z, double *green_X, double *red_X, double *red_Y, double *red_Z, double *green_X,
double *green_Y, double *green_Z, double *blue_X, double *blue_Y, double *green_Y, double *green_Z, double *blue_X, double *blue_Y,
double *blue_Z) double *blue_Z)
@ -589,7 +589,7 @@ png_get_cHRM_XYZ(png_const_structp png_ptr, png_const_infop info_ptr,
# ifdef PNG_FIXED_POINT_SUPPORTED # ifdef PNG_FIXED_POINT_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_cHRM_fixed(png_const_structp png_ptr, png_const_infop info_ptr, png_get_cHRM_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
png_fixed_point *white_x, png_fixed_point *white_y, png_fixed_point *red_x, png_fixed_point *white_x, png_fixed_point *white_y, png_fixed_point *red_x,
png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y, png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y,
png_fixed_point *blue_x, png_fixed_point *blue_y) png_fixed_point *blue_x, png_fixed_point *blue_y)
@ -624,7 +624,7 @@ png_get_cHRM_fixed(png_const_structp png_ptr, png_const_infop info_ptr,
#ifdef PNG_gAMA_SUPPORTED #ifdef PNG_gAMA_SUPPORTED
png_uint_32 PNGFAPI png_uint_32 PNGFAPI
png_get_gAMA_fixed(png_const_structp png_ptr, png_const_infop info_ptr, png_get_gAMA_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
png_fixed_point *file_gamma) png_fixed_point *file_gamma)
{ {
png_debug1(1, "in %s retrieval function", "gAMA"); png_debug1(1, "in %s retrieval function", "gAMA");
@ -640,7 +640,7 @@ png_get_gAMA_fixed(png_const_structp png_ptr, png_const_infop info_ptr,
} }
# ifdef PNG_FLOATING_POINT_SUPPORTED # ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_gAMA(png_const_structp png_ptr, png_const_infop info_ptr, png_get_gAMA(png_const_structrp png_ptr, png_const_inforp info_ptr,
double *file_gamma) double *file_gamma)
{ {
png_fixed_point igamma; png_fixed_point igamma;
@ -657,7 +657,7 @@ png_get_gAMA(png_const_structp png_ptr, png_const_infop info_ptr,
#ifdef PNG_sRGB_SUPPORTED #ifdef PNG_sRGB_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_sRGB(png_const_structp png_ptr, png_const_infop info_ptr, png_get_sRGB(png_const_structrp png_ptr, png_const_inforp info_ptr,
int *file_srgb_intent) int *file_srgb_intent)
{ {
png_debug1(1, "in %s retrieval function", "sRGB"); png_debug1(1, "in %s retrieval function", "sRGB");
@ -675,7 +675,7 @@ png_get_sRGB(png_const_structp png_ptr, png_const_infop info_ptr,
#ifdef PNG_iCCP_SUPPORTED #ifdef PNG_iCCP_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_iCCP(png_const_structp png_ptr, png_const_infop info_ptr, png_get_iCCP(png_const_structrp png_ptr, png_const_inforp info_ptr,
png_charpp name, int *compression_type, png_charpp name, int *compression_type,
png_bytepp profile, png_uint_32 *proflen) png_bytepp profile, png_uint_32 *proflen)
{ {
@ -701,7 +701,7 @@ png_get_iCCP(png_const_structp png_ptr, png_const_infop info_ptr,
#ifdef PNG_sPLT_SUPPORTED #ifdef PNG_sPLT_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_sPLT(png_const_structp png_ptr, png_const_infop info_ptr, png_get_sPLT(png_const_structrp png_ptr, png_const_inforp info_ptr,
png_sPLT_tpp spalettes) png_sPLT_tpp spalettes)
{ {
if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL) if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL)
@ -716,7 +716,7 @@ png_get_sPLT(png_const_structp png_ptr, png_const_infop info_ptr,
#ifdef PNG_hIST_SUPPORTED #ifdef PNG_hIST_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_hIST(png_const_structp png_ptr, png_const_infop info_ptr, png_get_hIST(png_const_structrp png_ptr, png_const_inforp info_ptr,
png_uint_16p *hist) png_uint_16p *hist)
{ {
png_debug1(1, "in %s retrieval function", "hIST"); png_debug1(1, "in %s retrieval function", "hIST");
@ -733,7 +733,7 @@ png_get_hIST(png_const_structp png_ptr, png_const_infop info_ptr,
#endif #endif
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_IHDR(png_const_structp png_ptr, png_infop info_ptr, png_get_IHDR(png_const_structrp png_ptr, png_inforp info_ptr,
png_uint_32 *width, png_uint_32 *height, int *bit_depth, png_uint_32 *width, png_uint_32 *height, int *bit_depth,
int *color_type, int *interlace_type, int *compression_type, int *color_type, int *interlace_type, int *compression_type,
int *filter_type) int *filter_type)
@ -772,7 +772,7 @@ png_get_IHDR(png_const_structp png_ptr, png_infop info_ptr,
#ifdef PNG_oFFs_SUPPORTED #ifdef PNG_oFFs_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_oFFs(png_const_structp png_ptr, png_const_infop info_ptr, png_get_oFFs(png_const_structrp png_ptr, png_const_inforp info_ptr,
png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type) png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)
{ {
png_debug1(1, "in %s retrieval function", "oFFs"); png_debug1(1, "in %s retrieval function", "oFFs");
@ -792,7 +792,7 @@ png_get_oFFs(png_const_structp png_ptr, png_const_infop info_ptr,
#ifdef PNG_pCAL_SUPPORTED #ifdef PNG_pCAL_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_pCAL(png_const_structp png_ptr, png_const_infop info_ptr, png_get_pCAL(png_const_structrp png_ptr, png_const_inforp info_ptr,
png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams, png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams,
png_charp *units, png_charpp *params) png_charp *units, png_charpp *params)
{ {
@ -821,7 +821,7 @@ png_get_pCAL(png_const_structp png_ptr, png_const_infop info_ptr,
# if (defined PNG_FLOATING_ARITHMETIC_SUPPORTED) || \ # if (defined PNG_FLOATING_ARITHMETIC_SUPPORTED) || \
(defined PNG_FLOATING_POINT_SUPPORTED) (defined PNG_FLOATING_POINT_SUPPORTED)
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_sCAL_fixed(png_const_structp png_ptr, png_const_infop info_ptr, png_get_sCAL_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
int *unit, png_fixed_point *width, png_fixed_point *height) int *unit, png_fixed_point *width, png_fixed_point *height)
{ {
if (png_ptr != NULL && info_ptr != NULL && if (png_ptr != NULL && info_ptr != NULL &&
@ -844,7 +844,7 @@ png_get_sCAL_fixed(png_const_structp png_ptr, png_const_infop info_ptr,
# endif /* FIXED_POINT */ # endif /* FIXED_POINT */
# ifdef PNG_FLOATING_POINT_SUPPORTED # ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_sCAL(png_const_structp png_ptr, png_const_infop info_ptr, png_get_sCAL(png_const_structrp png_ptr, png_const_inforp info_ptr,
int *unit, double *width, double *height) int *unit, double *width, double *height)
{ {
if (png_ptr != NULL && info_ptr != NULL && if (png_ptr != NULL && info_ptr != NULL &&
@ -860,7 +860,7 @@ png_get_sCAL(png_const_structp png_ptr, png_const_infop info_ptr,
} }
# endif /* FLOATING POINT */ # endif /* FLOATING POINT */
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_sCAL_s(png_const_structp png_ptr, png_const_infop info_ptr, png_get_sCAL_s(png_const_structrp png_ptr, png_const_inforp info_ptr,
int *unit, png_charpp width, png_charpp height) int *unit, png_charpp width, png_charpp height)
{ {
if (png_ptr != NULL && info_ptr != NULL && if (png_ptr != NULL && info_ptr != NULL &&
@ -878,7 +878,7 @@ png_get_sCAL_s(png_const_structp png_ptr, png_const_infop info_ptr,
#ifdef PNG_pHYs_SUPPORTED #ifdef PNG_pHYs_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_pHYs(png_const_structp png_ptr, png_const_infop info_ptr, png_get_pHYs(png_const_structrp png_ptr, png_const_inforp info_ptr,
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type) png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
{ {
png_uint_32 retval = 0; png_uint_32 retval = 0;
@ -912,7 +912,7 @@ png_get_pHYs(png_const_structp png_ptr, png_const_infop info_ptr,
#endif /* pHYs */ #endif /* pHYs */
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_PLTE(png_const_structp png_ptr, png_const_infop info_ptr, png_get_PLTE(png_const_structrp png_ptr, png_const_inforp info_ptr,
png_colorp *palette, int *num_palette) png_colorp *palette, int *num_palette)
{ {
png_debug1(1, "in %s retrieval function", "PLTE"); png_debug1(1, "in %s retrieval function", "PLTE");
@ -931,7 +931,7 @@ png_get_PLTE(png_const_structp png_ptr, png_const_infop info_ptr,
#ifdef PNG_sBIT_SUPPORTED #ifdef PNG_sBIT_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_sBIT(png_const_structp png_ptr, png_infop info_ptr, png_get_sBIT(png_const_structrp png_ptr, png_inforp info_ptr,
png_color_8p *sig_bit) png_color_8p *sig_bit)
{ {
png_debug1(1, "in %s retrieval function", "sBIT"); png_debug1(1, "in %s retrieval function", "sBIT");
@ -949,7 +949,7 @@ png_get_sBIT(png_const_structp png_ptr, png_infop info_ptr,
#ifdef PNG_TEXT_SUPPORTED #ifdef PNG_TEXT_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_text(png_const_structp png_ptr, png_const_infop info_ptr, png_get_text(png_const_structrp png_ptr, png_const_inforp info_ptr,
png_textp *text_ptr, int *num_text) png_textp *text_ptr, int *num_text)
{ {
if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0) if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0)
@ -975,7 +975,7 @@ png_get_text(png_const_structp png_ptr, png_const_infop info_ptr,
#ifdef PNG_tIME_SUPPORTED #ifdef PNG_tIME_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_tIME(png_const_structp png_ptr, png_infop info_ptr, png_timep *mod_time) png_get_tIME(png_const_structrp png_ptr, png_inforp info_ptr, png_timep *mod_time)
{ {
png_debug1(1, "in %s retrieval function", "tIME"); png_debug1(1, "in %s retrieval function", "tIME");
@ -992,7 +992,7 @@ png_get_tIME(png_const_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
#ifdef PNG_tRNS_SUPPORTED #ifdef PNG_tRNS_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_tRNS(png_const_structp png_ptr, png_infop info_ptr, png_get_tRNS(png_const_structrp png_ptr, png_inforp info_ptr,
png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color) png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color)
{ {
png_uint_32 retval = 0; png_uint_32 retval = 0;
@ -1037,7 +1037,7 @@ png_get_tRNS(png_const_structp png_ptr, png_infop info_ptr,
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
int PNGAPI int PNGAPI
png_get_unknown_chunks(png_const_structp png_ptr, png_const_infop info_ptr, png_get_unknown_chunks(png_const_structrp png_ptr, png_const_inforp info_ptr,
png_unknown_chunkpp unknowns) png_unknown_chunkpp unknowns)
{ {
if (png_ptr != NULL && info_ptr != NULL && unknowns != NULL) if (png_ptr != NULL && info_ptr != NULL && unknowns != NULL)
@ -1052,7 +1052,7 @@ png_get_unknown_chunks(png_const_structp png_ptr, png_const_infop info_ptr,
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
png_byte PNGAPI png_byte PNGAPI
png_get_rgb_to_gray_status (png_const_structp png_ptr) png_get_rgb_to_gray_status (png_const_structrp png_ptr)
{ {
return (png_byte)(png_ptr ? png_ptr->rgb_to_gray_status : 0); return (png_byte)(png_ptr ? png_ptr->rgb_to_gray_status : 0);
} }
@ -1060,14 +1060,14 @@ png_get_rgb_to_gray_status (png_const_structp png_ptr)
#ifdef PNG_USER_CHUNKS_SUPPORTED #ifdef PNG_USER_CHUNKS_SUPPORTED
png_voidp PNGAPI png_voidp PNGAPI
png_get_user_chunk_ptr(png_const_structp png_ptr) png_get_user_chunk_ptr(png_const_structrp png_ptr)
{ {
return (png_ptr ? png_ptr->user_chunk_ptr : NULL); return (png_ptr ? png_ptr->user_chunk_ptr : NULL);
} }
#endif #endif
png_size_t PNGAPI png_size_t PNGAPI
png_get_compression_buffer_size(png_const_structp png_ptr) png_get_compression_buffer_size(png_const_structrp png_ptr)
{ {
return (png_ptr ? png_ptr->zbuf_size : 0); return (png_ptr ? png_ptr->zbuf_size : 0);
} }
@ -1076,27 +1076,27 @@ png_get_compression_buffer_size(png_const_structp png_ptr)
/* These functions were added to libpng 1.2.6 and were enabled /* These functions were added to libpng 1.2.6 and were enabled
* by default in libpng-1.4.0 */ * by default in libpng-1.4.0 */
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_user_width_max (png_const_structp png_ptr) png_get_user_width_max (png_const_structrp png_ptr)
{ {
return (png_ptr ? png_ptr->user_width_max : 0); return (png_ptr ? png_ptr->user_width_max : 0);
} }
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_user_height_max (png_const_structp png_ptr) png_get_user_height_max (png_const_structrp png_ptr)
{ {
return (png_ptr ? png_ptr->user_height_max : 0); return (png_ptr ? png_ptr->user_height_max : 0);
} }
/* This function was added to libpng 1.4.0 */ /* This function was added to libpng 1.4.0 */
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_chunk_cache_max (png_const_structp png_ptr) png_get_chunk_cache_max (png_const_structrp png_ptr)
{ {
return (png_ptr ? png_ptr->user_chunk_cache_max : 0); return (png_ptr ? png_ptr->user_chunk_cache_max : 0);
} }
/* This function was added to libpng 1.4.1 */ /* This function was added to libpng 1.4.1 */
png_alloc_size_t PNGAPI png_alloc_size_t PNGAPI
png_get_chunk_malloc_max (png_const_structp png_ptr) png_get_chunk_malloc_max (png_const_structrp png_ptr)
{ {
return (png_ptr ? png_ptr->user_chunk_malloc_max : 0); return (png_ptr ? png_ptr->user_chunk_malloc_max : 0);
} }
@ -1105,20 +1105,20 @@ png_get_chunk_malloc_max (png_const_structp png_ptr)
/* These functions were added to libpng 1.4.0 */ /* These functions were added to libpng 1.4.0 */
#ifdef PNG_IO_STATE_SUPPORTED #ifdef PNG_IO_STATE_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_io_state (png_const_structp png_ptr) png_get_io_state (png_const_structrp png_ptr)
{ {
return png_ptr->io_state; return png_ptr->io_state;
} }
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_io_chunk_type (png_const_structp png_ptr) png_get_io_chunk_type (png_const_structrp png_ptr)
{ {
return png_ptr->chunk_name; return png_ptr->chunk_name;
} }
#if PNG_LIBPNG_VER < 10600 #if PNG_LIBPNG_VER < 10600
png_const_bytep PNGAPI png_const_bytep PNGAPI
png_get_io_chunk_name (png_structp png_ptr) png_get_io_chunk_name (png_structrp png_ptr)
{ {
PNG_CSTRING_FROM_CHUNK(png_ptr->io_chunk_string, png_ptr->chunk_name); PNG_CSTRING_FROM_CHUNK(png_ptr->io_chunk_string, png_ptr->chunk_name);
return png_ptr->io_chunk_string; return png_ptr->io_chunk_string;

View File

@ -22,7 +22,7 @@
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
/* Free a png_struct */ /* Free a png_struct */
void /* PRIVATE */ void /* PRIVATE */
png_destroy_png_struct(png_structp png_ptr) png_destroy_png_struct(png_structrp png_ptr)
{ {
if (png_ptr != NULL) if (png_ptr != NULL)
{ {
@ -47,7 +47,7 @@ png_destroy_png_struct(png_structp png_ptr)
* have the ability to do that. * have the ability to do that.
*/ */
PNG_FUNCTION(png_voidp,PNGAPI PNG_FUNCTION(png_voidp,PNGAPI
png_calloc,(png_const_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED) png_calloc,(png_const_structrp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{ {
png_voidp ret; png_voidp ret;
@ -65,7 +65,7 @@ png_calloc,(png_const_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
* if the allocation cannot be done (for any reason.) * if the allocation cannot be done (for any reason.)
*/ */
PNG_FUNCTION(png_voidp /* PRIVATE */, PNG_FUNCTION(png_voidp /* PRIVATE */,
png_malloc_base,(png_const_structp png_ptr, png_alloc_size_t size), png_malloc_base,(png_const_structrp png_ptr, png_alloc_size_t size),
PNG_ALLOCATED) PNG_ALLOCATED)
{ {
/* Moved to png_malloc_base from png_malloc_default in 1.6.0; the DOS /* Moved to png_malloc_base from png_malloc_default in 1.6.0; the DOS
@ -84,7 +84,7 @@ png_malloc_base,(png_const_structp png_ptr, png_alloc_size_t size),
{ {
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
if (png_ptr != NULL && png_ptr->malloc_fn != NULL) if (png_ptr != NULL && png_ptr->malloc_fn != NULL)
return png_ptr->malloc_fn(png_constcast(png_structp,png_ptr), size); return png_ptr->malloc_fn(png_constcast(png_structrp,png_ptr), size);
else else
#endif #endif
@ -100,7 +100,7 @@ png_malloc_base,(png_const_structp png_ptr, png_alloc_size_t size),
* function png_malloc_default is also provided. * function png_malloc_default is also provided.
*/ */
PNG_FUNCTION(png_voidp,PNGAPI PNG_FUNCTION(png_voidp,PNGAPI
png_malloc,(png_const_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED) png_malloc,(png_const_structrp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{ {
png_voidp ret; png_voidp ret;
@ -117,7 +117,7 @@ png_malloc,(png_const_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
PNG_FUNCTION(png_voidp,PNGAPI PNG_FUNCTION(png_voidp,PNGAPI
png_malloc_default,(png_const_structp png_ptr, png_alloc_size_t size), png_malloc_default,(png_const_structrp png_ptr, png_alloc_size_t size),
PNG_ALLOCATED PNG_DEPRECATED) PNG_ALLOCATED PNG_DEPRECATED)
{ {
png_voidp ret; png_voidp ret;
@ -140,7 +140,7 @@ png_malloc_default,(png_const_structp png_ptr, png_alloc_size_t size),
* png_error, if it fails to allocate the requested memory. * png_error, if it fails to allocate the requested memory.
*/ */
PNG_FUNCTION(png_voidp,PNGAPI PNG_FUNCTION(png_voidp,PNGAPI
png_malloc_warn,(png_const_structp png_ptr, png_alloc_size_t size), png_malloc_warn,(png_const_structrp png_ptr, png_alloc_size_t size),
PNG_ALLOCATED) PNG_ALLOCATED)
{ {
if (png_ptr != NULL) if (png_ptr != NULL)
@ -160,21 +160,21 @@ png_malloc_warn,(png_const_structp png_ptr, png_alloc_size_t size),
* without taking any action. * without taking any action.
*/ */
void PNGAPI void PNGAPI
png_free(png_const_structp png_ptr, png_voidp ptr) png_free(png_const_structrp png_ptr, png_voidp ptr)
{ {
if (png_ptr == NULL || ptr == NULL) if (png_ptr == NULL || ptr == NULL)
return; return;
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
if (png_ptr->free_fn != NULL) if (png_ptr->free_fn != NULL)
png_ptr->free_fn(png_constcast(png_structp,png_ptr), ptr); png_ptr->free_fn(png_constcast(png_structrp,png_ptr), ptr);
else else
png_free_default(png_ptr, ptr); png_free_default(png_ptr, ptr);
} }
PNG_FUNCTION(void,PNGAPI PNG_FUNCTION(void,PNGAPI
png_free_default,(png_const_structp png_ptr, png_voidp ptr),PNG_DEPRECATED) png_free_default,(png_const_structrp png_ptr, png_voidp ptr),PNG_DEPRECATED)
{ {
if (png_ptr == NULL || ptr == NULL) if (png_ptr == NULL || ptr == NULL)
return; return;
@ -188,7 +188,7 @@ png_free_default,(png_const_structp png_ptr, png_voidp ptr),PNG_DEPRECATED)
* of allocating and freeing memory. * of allocating and freeing memory.
*/ */
void PNGAPI void PNGAPI
png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr png_set_mem_fn(png_structrp png_ptr, png_voidp mem_ptr, png_malloc_ptr
malloc_fn, png_free_ptr free_fn) malloc_fn, png_free_ptr free_fn)
{ {
if (png_ptr != NULL) if (png_ptr != NULL)
@ -204,7 +204,7 @@ png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
* pointer before png_write_destroy and png_read_destroy are called. * pointer before png_write_destroy and png_read_destroy are called.
*/ */
png_voidp PNGAPI png_voidp PNGAPI
png_get_mem_ptr(png_const_structp png_ptr) png_get_mem_ptr(png_const_structrp png_ptr)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
return NULL; return NULL;

View File

@ -27,7 +27,7 @@
#define PNG_ERROR_MODE 8 #define PNG_ERROR_MODE 8
void PNGAPI void PNGAPI
png_process_data(png_structp png_ptr, png_infop info_ptr, png_process_data(png_structrp png_ptr, png_inforp info_ptr,
png_bytep buffer, png_size_t buffer_size) png_bytep buffer, png_size_t buffer_size)
{ {
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
@ -42,7 +42,7 @@ png_process_data(png_structp png_ptr, png_infop info_ptr,
} }
png_size_t PNGAPI png_size_t PNGAPI
png_process_data_pause(png_structp png_ptr, int save) png_process_data_pause(png_structrp png_ptr, int save)
{ {
if (png_ptr != NULL) if (png_ptr != NULL)
{ {
@ -69,7 +69,7 @@ png_process_data_pause(png_structp png_ptr, int save)
} }
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_process_data_skip(png_structp png_ptr) png_process_data_skip(png_structrp png_ptr)
{ {
png_uint_32 remaining = 0; png_uint_32 remaining = 0;
@ -103,7 +103,7 @@ png_process_data_skip(png_structp png_ptr)
* doing before we ran out of data... * doing before we ran out of data...
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_process_some_data(png_structp png_ptr, png_infop info_ptr) png_process_some_data(png_structrp png_ptr, png_inforp info_ptr)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
@ -173,7 +173,7 @@ png_process_some_data(png_structp png_ptr, png_infop info_ptr)
* routine. * routine.
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_push_read_sig(png_structp png_ptr, png_infop info_ptr) png_push_read_sig(png_structrp png_ptr, png_inforp info_ptr)
{ {
png_size_t num_checked = png_ptr->sig_bytes, png_size_t num_checked = png_ptr->sig_bytes,
num_to_check = 8 - num_checked; num_to_check = 8 - num_checked;
@ -206,7 +206,7 @@ png_push_read_sig(png_structp png_ptr, png_infop info_ptr)
} }
void /* PRIVATE */ void /* PRIVATE */
png_push_read_chunk(png_structp png_ptr, png_infop info_ptr) png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
{ {
png_uint_32 chunk_name; png_uint_32 chunk_name;
@ -587,14 +587,14 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
} }
void /* PRIVATE */ void /* PRIVATE */
png_push_crc_skip(png_structp png_ptr, png_uint_32 skip) png_push_crc_skip(png_structrp png_ptr, png_uint_32 skip)
{ {
png_ptr->process_mode = PNG_SKIP_MODE; png_ptr->process_mode = PNG_SKIP_MODE;
png_ptr->skip_length = skip; png_ptr->skip_length = skip;
} }
void /* PRIVATE */ void /* PRIVATE */
png_push_crc_finish(png_structp png_ptr) png_push_crc_finish(png_structrp png_ptr)
{ {
if (png_ptr->skip_length && png_ptr->save_buffer_size) if (png_ptr->skip_length && png_ptr->save_buffer_size)
{ {
@ -698,7 +698,7 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
} }
void /* PRIVATE */ void /* PRIVATE */
png_push_save_buffer(png_structp png_ptr) png_push_save_buffer(png_structrp png_ptr)
{ {
if (png_ptr->save_buffer_size) if (png_ptr->save_buffer_size)
{ {
@ -755,7 +755,7 @@ png_push_save_buffer(png_structp png_ptr)
} }
void /* PRIVATE */ void /* PRIVATE */
png_push_restore_buffer(png_structp png_ptr, png_bytep buffer, png_push_restore_buffer(png_structrp png_ptr, png_bytep buffer,
png_size_t buffer_length) png_size_t buffer_length)
{ {
png_ptr->current_buffer = buffer; png_ptr->current_buffer = buffer;
@ -765,7 +765,7 @@ png_push_restore_buffer(png_structp png_ptr, png_bytep buffer,
} }
void /* PRIVATE */ void /* PRIVATE */
png_push_read_IDAT(png_structp png_ptr) png_push_read_IDAT(png_structrp png_ptr)
{ {
if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER)) if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER))
{ {
@ -866,7 +866,7 @@ png_push_read_IDAT(png_structp png_ptr)
} }
void /* PRIVATE */ void /* PRIVATE */
png_process_IDAT_data(png_structp png_ptr, png_bytep buffer, png_process_IDAT_data(png_structrp png_ptr, png_bytep buffer,
png_size_t buffer_length) png_size_t buffer_length)
{ {
/* The caller checks for a non-zero buffer length. */ /* The caller checks for a non-zero buffer length. */
@ -970,7 +970,7 @@ png_process_IDAT_data(png_structp png_ptr, png_bytep buffer,
} }
void /* PRIVATE */ void /* PRIVATE */
png_push_process_row(png_structp png_ptr) png_push_process_row(png_structrp png_ptr)
{ {
/* 1.5.6: row_info moved out of png_struct to a local here. */ /* 1.5.6: row_info moved out of png_struct to a local here. */
png_row_info row_info; png_row_info row_info;
@ -1199,7 +1199,7 @@ png_push_process_row(png_structp png_ptr)
} }
void /* PRIVATE */ void /* PRIVATE */
png_read_push_finish_row(png_structp png_ptr) png_read_push_finish_row(png_structrp png_ptr)
{ {
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
@ -1264,7 +1264,7 @@ png_read_push_finish_row(png_structp png_ptr)
#ifdef PNG_READ_tEXt_SUPPORTED #ifdef PNG_READ_tEXt_SUPPORTED
void /* PRIVATE */ void /* PRIVATE */
png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 png_push_handle_tEXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32
length) length)
{ {
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND)) if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
@ -1295,7 +1295,7 @@ png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
} }
void /* PRIVATE */ void /* PRIVATE */
png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr) png_push_read_tEXt(png_structrp png_ptr, png_inforp info_ptr)
{ {
if (png_ptr->buffer_size && png_ptr->current_text_left) if (png_ptr->buffer_size && png_ptr->current_text_left)
{ {
@ -1361,7 +1361,7 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
#ifdef PNG_READ_zTXt_SUPPORTED #ifdef PNG_READ_zTXt_SUPPORTED
void /* PRIVATE */ void /* PRIVATE */
png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 png_push_handle_zTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32
length) length)
{ {
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND)) if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
@ -1394,7 +1394,7 @@ png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
} }
void /* PRIVATE */ void /* PRIVATE */
png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr) png_push_read_zTXt(png_structrp png_ptr, png_inforp info_ptr)
{ {
if (png_ptr->buffer_size && png_ptr->current_text_left) if (png_ptr->buffer_size && png_ptr->current_text_left)
{ {
@ -1565,7 +1565,7 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
#ifdef PNG_READ_iTXt_SUPPORTED #ifdef PNG_READ_iTXt_SUPPORTED
void /* PRIVATE */ void /* PRIVATE */
png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 png_push_handle_iTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32
length) length)
{ {
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND)) if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
@ -1596,7 +1596,7 @@ png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
} }
void /* PRIVATE */ void /* PRIVATE */
png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr) png_push_read_iTXt(png_structrp png_ptr, png_inforp info_ptr)
{ {
if (png_ptr->buffer_size && png_ptr->current_text_left) if (png_ptr->buffer_size && png_ptr->current_text_left)
@ -1691,7 +1691,7 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
* name or a critical chunk), the chunk is (currently) silently ignored. * name or a critical chunk), the chunk is (currently) silently ignored.
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 png_push_handle_unknown(png_structrp png_ptr, png_inforp info_ptr, png_uint_32
length) length)
{ {
png_uint_32 skip = 0; png_uint_32 skip = 0;
@ -1782,21 +1782,21 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
} }
void /* PRIVATE */ void /* PRIVATE */
png_push_have_info(png_structp png_ptr, png_infop info_ptr) png_push_have_info(png_structrp png_ptr, png_inforp info_ptr)
{ {
if (png_ptr->info_fn != NULL) if (png_ptr->info_fn != NULL)
(*(png_ptr->info_fn))(png_ptr, info_ptr); (*(png_ptr->info_fn))(png_ptr, info_ptr);
} }
void /* PRIVATE */ void /* PRIVATE */
png_push_have_end(png_structp png_ptr, png_infop info_ptr) png_push_have_end(png_structrp png_ptr, png_inforp info_ptr)
{ {
if (png_ptr->end_fn != NULL) if (png_ptr->end_fn != NULL)
(*(png_ptr->end_fn))(png_ptr, info_ptr); (*(png_ptr->end_fn))(png_ptr, info_ptr);
} }
void /* PRIVATE */ void /* PRIVATE */
png_push_have_row(png_structp png_ptr, png_bytep row) png_push_have_row(png_structrp png_ptr, png_bytep row)
{ {
if (png_ptr->row_fn != NULL) if (png_ptr->row_fn != NULL)
(*(png_ptr->row_fn))(png_ptr, row, png_ptr->row_number, (*(png_ptr->row_fn))(png_ptr, row, png_ptr->row_number,
@ -1805,7 +1805,7 @@ png_push_have_row(png_structp png_ptr, png_bytep row)
#ifdef PNG_READ_INTERLACING_SUPPORTED #ifdef PNG_READ_INTERLACING_SUPPORTED
void PNGAPI void PNGAPI
png_progressive_combine_row(png_const_structp png_ptr, png_bytep old_row, png_progressive_combine_row(png_const_structrp png_ptr, png_bytep old_row,
png_const_bytep new_row) png_const_bytep new_row)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
@ -1821,7 +1821,7 @@ png_progressive_combine_row(png_const_structp png_ptr, png_bytep old_row,
#endif /* PNG_READ_INTERLACING_SUPPORTED */ #endif /* PNG_READ_INTERLACING_SUPPORTED */
void PNGAPI void PNGAPI
png_set_progressive_read_fn(png_structp png_ptr, png_voidp progressive_ptr, png_set_progressive_read_fn(png_structrp png_ptr, png_voidp progressive_ptr,
png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn, png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,
png_progressive_end_ptr end_fn) png_progressive_end_ptr end_fn)
{ {
@ -1836,7 +1836,7 @@ png_set_progressive_read_fn(png_structp png_ptr, png_voidp progressive_ptr,
} }
png_voidp PNGAPI png_voidp PNGAPI
png_get_progressive_ptr(png_const_structp png_ptr) png_get_progressive_ptr(png_const_structrp png_ptr)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
return (NULL); return (NULL);

309
pngpriv.h
View File

@ -45,6 +45,22 @@
#define PNGLIB_BUILD /*libpng is being built, not used*/ #define PNGLIB_BUILD /*libpng is being built, not used*/
/* If HAVE_CONFIG_H is defined during the build then the build system must
* provide an appropriate "config.h" file on the include path. The header file
* must provide definitions as required below (search for "HAVE_CONFIG_H");
* see configure.ac for more details of the requirements. The macro
* "PNG_NO_CONFIG_H" is provided for maintainers to test for dependencies on
* 'configure'; define this macro to prevent the configure build including the
* configure generated config.h. Libpng is expected to compile without *any*
* special build system support on a reasonably ANSI-C compliant system.
*/
#if (defined HAVE_CONFIG_H) && !(defined PNG_NO_CONFIG_H)
# include <config.h>
/* Pick up the definition of 'restrict' from config.h if it was read: */
# define PNG_RESTRICT restrict
#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 */
@ -134,22 +150,6 @@
*/ */
typedef const png_uint_16p * png_const_uint_16pp; typedef const png_uint_16p * png_const_uint_16pp;
/* Added at libpng-1.2.9 */
/* Moved to pngpriv.h at libpng-1.5.0 */
/* If HAVE_CONFIG_H is defined during the build then the build system must
* provide an appropriate "config.h" file on the include path. The header file
* must provide definitions as required below (search for "HAVE_CONFIG_H");
* see configure.ac for more details of the requirements. The macro
* "PNG_NO_CONFIG_H" is provided for maintainers to test for dependencies on
* 'configure'; define this macro to prevent the configure build including the
* configure generated config.h. Libpng is expected to compile without *any*
* special build system support on a reasonably ANSI-C compliant system.
*/
#if (defined HAVE_CONFIG_H) && !(defined PNG_NO_CONFIG_H)
# include <config.h>
#endif
/* Moved to pngpriv.h at libpng-1.5.0 */ /* Moved to pngpriv.h at libpng-1.5.0 */
/* NOTE: some of these may have been used in external applications as /* NOTE: some of these may have been used in external applications as
* these definitions were exposed in pngconf.h prior to 1.5. * these definitions were exposed in pngconf.h prior to 1.5.
@ -195,23 +195,6 @@ typedef const png_uint_16p * png_const_uint_16pp;
# define PNG_STATIC static # define PNG_STATIC static
#endif #endif
/* C99 restrict is used where possible, to do this 'restrict' is defined as
* empty if we can't be sure it is supported. configure builds have already
* done this work.
*/
#ifdef HAVE_CONFIG_H
# define PNG_RESTRICT restrict
#else
/* Modern compilers support restrict, but assume not for anything not
* recognized here:
*/
# if defined __GNUC__ || defined _MSC_VER || defined __WATCOMC__
# define PNG_RESTRICT restrict
# else
# define PNG_RESTRICT
# endif
#endif
/* If warnings or errors are turned off the code is disabled or redirected here. /* If warnings or errors are turned off the code is disabled or redirected here.
* From 1.5.4 functions have been added to allow very limited formatting of * From 1.5.4 functions have been added to allow very limited formatting of
* error and warning messages - this code will also be disabled here. * error and warning messages - this code will also be disabled here.
@ -598,7 +581,7 @@ extern /*PRIVATE*/ PNG_CONST_DATA 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))
#else #else
PNG_EXTERN png_fixed_point png_fixed PNGARG((png_const_structp png_ptr, PNG_EXTERN png_fixed_point png_fixed PNGARG((png_const_structrp png_ptr,
double fp, png_const_charp text)); double fp, png_const_charp text));
#endif #endif
#endif #endif
@ -686,7 +669,7 @@ extern "C" {
/* Check the user version string for compatibility, returns false if the version /* Check the user version string for compatibility, returns false if the version
* numbers aren't compatible. * numbers aren't compatible.
*/ */
PNG_EXTERN int png_user_version_check PNGARG((png_structp png_ptr, PNG_EXTERN int png_user_version_check PNGARG((png_structrp png_ptr,
png_const_charp user_png_ver)); png_const_charp user_png_ver));
/* Internal base allocator - no messages, NULL on failure to allocate. This /* Internal base allocator - no messages, NULL on failure to allocate. This
@ -694,7 +677,7 @@ PNG_EXTERN int png_user_version_check PNGARG((png_structp png_ptr,
* png_error (although that would be a bug in the application implementation.) * png_error (although that would be a bug in the application implementation.)
*/ */
PNG_EXTERN PNG_FUNCTION(png_voidp,png_malloc_base, PNG_EXTERN PNG_FUNCTION(png_voidp,png_malloc_base,
PNGARG((png_const_structp png_ptr, png_alloc_size_t size)),PNG_ALLOCATED); PNGARG((png_const_structrp png_ptr, png_alloc_size_t size)),PNG_ALLOCATED);
/* Magic to create a struct when there is no struct to call the user supplied /* Magic to create a struct when there is no struct to call the user supplied
* memory allocators. Because error handling has not been set up the memory * memory allocators. Because error handling has not been set up the memory
@ -708,10 +691,10 @@ PNG_EXTERN PNG_FUNCTION(png_structp,png_create_png_struct,
png_malloc_ptr malloc_fn, png_free_ptr free_fn)),PNG_ALLOCATED); png_malloc_ptr malloc_fn, png_free_ptr free_fn)),PNG_ALLOCATED);
/* Free memory from internal libpng struct */ /* Free memory from internal libpng struct */
PNG_EXTERN void png_destroy_png_struct PNGARG((png_structp png_ptr)); PNG_EXTERN void png_destroy_png_struct PNGARG((png_structrp png_ptr));
/* Free an allocated jmp_buf (always succeeds) */ /* Free an allocated jmp_buf (always succeeds) */
PNG_EXTERN void png_free_jmpbuf PNGARG((png_structp png_ptr)); PNG_EXTERN void png_free_jmpbuf PNGARG((png_structrp png_ptr));
/* Function to allocate memory for zlib. PNGAPI is disallowed. */ /* Function to allocate memory for zlib. PNGAPI is disallowed. */
PNG_EXTERN PNG_FUNCTION(voidpf,png_zalloc,PNGARG((voidpf png_ptr, uInt items, PNG_EXTERN PNG_FUNCTION(voidpf,png_zalloc,PNGARG((voidpf png_ptr, uInt items,
@ -743,48 +726,48 @@ PNG_EXTERN void PNGCBAPI png_default_flush PNGARG((png_structp png_ptr));
#endif #endif
/* Reset the CRC variable */ /* Reset the CRC variable */
PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr)); PNG_EXTERN void png_reset_crc PNGARG((png_structrp png_ptr));
/* Write the "data" buffer to whatever output you are using */ /* Write the "data" buffer to whatever output you are using */
PNG_EXTERN void png_write_data PNGARG((png_structp png_ptr, PNG_EXTERN void png_write_data PNGARG((png_structrp png_ptr,
png_const_bytep data, png_size_t length)); png_const_bytep data, png_size_t length));
/* Read and check the PNG file signature */ /* Read and check the PNG file signature */
PNG_EXTERN void png_read_sig PNGARG((png_structp png_ptr, png_infop info_ptr)); PNG_EXTERN void png_read_sig PNGARG((png_structrp png_ptr, png_inforp info_ptr));
/* Read the chunk header (length + type name) */ /* Read the chunk header (length + type name) */
PNG_EXTERN png_uint_32 png_read_chunk_header PNGARG((png_structp png_ptr)); PNG_EXTERN png_uint_32 png_read_chunk_header PNGARG((png_structrp png_ptr));
/* Read data from whatever input you are using into the "data" buffer */ /* Read data from whatever input you are using into the "data" buffer */
PNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data, PNG_EXTERN void png_read_data PNGARG((png_structrp png_ptr, png_bytep data,
png_size_t length)); png_size_t length));
/* Read bytes into buf, and update png_ptr->crc */ /* Read bytes into buf, and update png_ptr->crc */
PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf, PNG_EXTERN void png_crc_read PNGARG((png_structrp png_ptr, png_bytep buf,
png_size_t length)); png_size_t length));
/* Decompress data in a chunk that uses compression */ /* Decompress data in a chunk that uses compression */
#if defined(PNG_READ_COMPRESSED_TEXT_SUPPORTED) #if defined(PNG_READ_COMPRESSED_TEXT_SUPPORTED)
PNG_EXTERN void png_decompress_chunk PNGARG((png_structp png_ptr, PNG_EXTERN void png_decompress_chunk PNGARG((png_structrp png_ptr,
int comp_type, png_size_t chunklength, png_size_t prefix_length, int comp_type, png_size_t chunklength, png_size_t prefix_length,
png_size_t *data_length)); png_size_t *data_length));
#endif #endif
/* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */ /* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */
PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip)); PNG_EXTERN int png_crc_finish PNGARG((png_structrp png_ptr, png_uint_32 skip));
/* Read the CRC from the file and compare it to the libpng calculated CRC */ /* Read the CRC from the file and compare it to the libpng calculated CRC */
PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr)); PNG_EXTERN int png_crc_error PNGARG((png_structrp png_ptr));
/* Calculate the CRC over a section of data. Note that we are only /* Calculate the CRC over a section of data. Note that we are only
* passing a maximum of 64K on systems that have this as a memory limit, * passing a maximum of 64K on systems that have this as a memory limit,
* since this is the maximum buffer size we can specify. * since this is the maximum buffer size we can specify.
*/ */
PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, PNG_EXTERN void png_calculate_crc PNGARG((png_structrp png_ptr,
png_const_bytep ptr, png_size_t length)); png_const_bytep ptr, png_size_t length));
#ifdef PNG_WRITE_FLUSH_SUPPORTED #ifdef PNG_WRITE_FLUSH_SUPPORTED
PNG_EXTERN void png_flush PNGARG((png_structp png_ptr)); PNG_EXTERN void png_flush PNGARG((png_structrp png_ptr));
#endif #endif
/* Write various chunks */ /* Write various chunks */
@ -792,42 +775,42 @@ PNG_EXTERN void png_flush PNGARG((png_structp png_ptr));
/* Write the IHDR chunk, and update the png_struct with the necessary /* Write the IHDR chunk, and update the png_struct with the necessary
* information. * information.
*/ */
PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width, PNG_EXTERN void png_write_IHDR PNGARG((png_structrp png_ptr, png_uint_32 width,
png_uint_32 height, png_uint_32 height,
int bit_depth, int color_type, int compression_method, int filter_method, int bit_depth, int color_type, int compression_method, int filter_method,
int interlace_method)); int interlace_method));
PNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr, PNG_EXTERN void png_write_PLTE PNGARG((png_structrp png_ptr,
png_const_colorp palette, png_uint_32 num_pal)); png_const_colorp palette, png_uint_32 num_pal));
PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data, PNG_EXTERN void png_write_IDAT PNGARG((png_structrp png_ptr, png_bytep data,
png_size_t length)); png_size_t length));
PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr)); PNG_EXTERN void png_write_IEND PNGARG((png_structrp png_ptr));
#ifdef PNG_WRITE_gAMA_SUPPORTED #ifdef PNG_WRITE_gAMA_SUPPORTED
# ifdef PNG_FLOATING_POINT_SUPPORTED # ifdef PNG_FLOATING_POINT_SUPPORTED
PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma)); PNG_EXTERN void png_write_gAMA PNGARG((png_structrp png_ptr, double file_gamma));
# endif # endif
# ifdef PNG_FIXED_POINT_SUPPORTED # ifdef PNG_FIXED_POINT_SUPPORTED
PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr, PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structrp png_ptr,
png_fixed_point file_gamma)); png_fixed_point file_gamma));
# endif # endif
#endif #endif
#ifdef PNG_WRITE_sBIT_SUPPORTED #ifdef PNG_WRITE_sBIT_SUPPORTED
PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, PNG_EXTERN void png_write_sBIT PNGARG((png_structrp png_ptr,
png_const_color_8p sbit, int color_type)); png_const_color_8p sbit, int color_type));
#endif #endif
#ifdef PNG_WRITE_cHRM_SUPPORTED #ifdef PNG_WRITE_cHRM_SUPPORTED
# ifdef PNG_FLOATING_POINT_SUPPORTED # ifdef PNG_FLOATING_POINT_SUPPORTED
PNG_EXTERN void png_write_cHRM PNGARG((png_structp png_ptr, PNG_EXTERN void png_write_cHRM PNGARG((png_structrp png_ptr,
double white_x, double white_y, double white_x, double white_y,
double red_x, double red_y, double green_x, double green_y, double red_x, double red_y, double green_x, double green_y,
double blue_x, double blue_y)); double blue_x, double blue_y));
# endif # endif
PNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structp png_ptr, PNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structrp png_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 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_blue_x, int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
@ -835,98 +818,98 @@ PNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structp png_ptr,
#endif #endif
#ifdef PNG_WRITE_sRGB_SUPPORTED #ifdef PNG_WRITE_sRGB_SUPPORTED
PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr, PNG_EXTERN void png_write_sRGB PNGARG((png_structrp png_ptr,
int intent)); int intent));
#endif #endif
#ifdef PNG_WRITE_iCCP_SUPPORTED #ifdef PNG_WRITE_iCCP_SUPPORTED
PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr, PNG_EXTERN void png_write_iCCP PNGARG((png_structrp png_ptr,
png_const_charp name, int compression_type, png_const_charp name, int compression_type,
png_const_charp profile, int proflen)); png_const_charp profile, int proflen));
/* Note to maintainer: profile should be png_bytep */ /* Note to maintainer: profile should be png_bytep */
#endif #endif
#ifdef PNG_WRITE_sPLT_SUPPORTED #ifdef PNG_WRITE_sPLT_SUPPORTED
PNG_EXTERN void png_write_sPLT PNGARG((png_structp png_ptr, PNG_EXTERN void png_write_sPLT PNGARG((png_structrp png_ptr,
png_const_sPLT_tp palette)); png_const_sPLT_tp palette));
#endif #endif
#ifdef PNG_WRITE_tRNS_SUPPORTED #ifdef PNG_WRITE_tRNS_SUPPORTED
PNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr, PNG_EXTERN void png_write_tRNS PNGARG((png_structrp png_ptr,
png_const_bytep trans, png_const_color_16p values, int number, png_const_bytep trans, png_const_color_16p values, int number,
int color_type)); int color_type));
#endif #endif
#ifdef PNG_WRITE_bKGD_SUPPORTED #ifdef PNG_WRITE_bKGD_SUPPORTED
PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr, PNG_EXTERN void png_write_bKGD PNGARG((png_structrp png_ptr,
png_const_color_16p values, int color_type)); png_const_color_16p values, int color_type));
#endif #endif
#ifdef PNG_WRITE_hIST_SUPPORTED #ifdef PNG_WRITE_hIST_SUPPORTED
PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, PNG_EXTERN void png_write_hIST PNGARG((png_structrp png_ptr,
png_const_uint_16p hist, int num_hist)); png_const_uint_16p hist, int num_hist));
#endif #endif
/* Chunks that have keywords */ /* Chunks that have keywords */
#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \ #if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED) defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr, PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structrp png_ptr,
png_const_charp key, png_charpp new_key)); png_const_charp key, png_charpp new_key));
#endif #endif
#ifdef PNG_WRITE_tEXt_SUPPORTED #ifdef PNG_WRITE_tEXt_SUPPORTED
PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_const_charp key, PNG_EXTERN void png_write_tEXt PNGARG((png_structrp png_ptr, png_const_charp key,
png_const_charp text, png_size_t text_len)); png_const_charp text, png_size_t text_len));
#endif #endif
#ifdef PNG_WRITE_zTXt_SUPPORTED #ifdef PNG_WRITE_zTXt_SUPPORTED
PNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_const_charp key, PNG_EXTERN void png_write_zTXt PNGARG((png_structrp png_ptr, png_const_charp key,
png_const_charp text, png_size_t text_len, int compression)); png_const_charp text, png_size_t text_len, int compression));
#endif #endif
#ifdef PNG_WRITE_iTXt_SUPPORTED #ifdef PNG_WRITE_iTXt_SUPPORTED
PNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr, PNG_EXTERN void png_write_iTXt PNGARG((png_structrp png_ptr,
int compression, png_const_charp key, png_const_charp lang, int compression, png_const_charp key, png_const_charp lang,
png_const_charp lang_key, png_const_charp text)); png_const_charp lang_key, png_const_charp text));
#endif #endif
#ifdef PNG_TEXT_SUPPORTED /* Added at version 1.0.14 and 1.2.4 */ #ifdef PNG_TEXT_SUPPORTED /* Added at version 1.0.14 and 1.2.4 */
PNG_EXTERN int png_set_text_2 PNGARG((png_structp png_ptr, PNG_EXTERN int png_set_text_2 PNGARG((png_structrp png_ptr,
png_infop info_ptr, png_const_textp text_ptr, int num_text)); png_inforp info_ptr, png_const_textp text_ptr, int num_text));
#endif #endif
#ifdef PNG_WRITE_oFFs_SUPPORTED #ifdef PNG_WRITE_oFFs_SUPPORTED
PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr, PNG_EXTERN void png_write_oFFs PNGARG((png_structrp png_ptr,
png_int_32 x_offset, png_int_32 y_offset, int unit_type)); png_int_32 x_offset, png_int_32 y_offset, int unit_type));
#endif #endif
#ifdef PNG_WRITE_pCAL_SUPPORTED #ifdef PNG_WRITE_pCAL_SUPPORTED
PNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose, PNG_EXTERN void png_write_pCAL PNGARG((png_structrp png_ptr, png_charp purpose,
png_int_32 X0, png_int_32 X1, int type, int nparams, png_int_32 X0, png_int_32 X1, int type, int nparams,
png_const_charp units, png_charpp params)); png_const_charp units, png_charpp params));
#endif #endif
#ifdef PNG_WRITE_pHYs_SUPPORTED #ifdef PNG_WRITE_pHYs_SUPPORTED
PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr, PNG_EXTERN void png_write_pHYs PNGARG((png_structrp png_ptr,
png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit, png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit,
int unit_type)); int unit_type));
#endif #endif
#ifdef PNG_WRITE_tIME_SUPPORTED #ifdef PNG_WRITE_tIME_SUPPORTED
PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr, PNG_EXTERN void png_write_tIME PNGARG((png_structrp png_ptr,
png_const_timep mod_time)); png_const_timep mod_time));
#endif #endif
#ifdef PNG_WRITE_sCAL_SUPPORTED #ifdef PNG_WRITE_sCAL_SUPPORTED
PNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr, PNG_EXTERN void png_write_sCAL_s PNGARG((png_structrp png_ptr,
int unit, png_const_charp width, png_const_charp height)); int unit, png_const_charp width, png_const_charp height));
#endif #endif
/* Called when finished processing a row of data */ /* Called when finished processing a row of data */
PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr)); PNG_EXTERN void png_write_finish_row PNGARG((png_structrp png_ptr));
/* Internal use only. Called before first row of data */ /* Internal use only. Called before first row of data */
PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr)); PNG_EXTERN void png_write_start_row PNGARG((png_structrp png_ptr));
/* Combine a row of data, dealing with alpha, etc. if requested. 'row' is an /* Combine a row of data, dealing with alpha, etc. if requested. 'row' is an
* array of png_ptr->width pixels. If the image is not interlaced or this * array of png_ptr->width pixels. If the image is not interlaced or this
@ -954,7 +937,7 @@ PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr));
#ifndef PNG_USE_COMPILE_TIME_MASKS #ifndef PNG_USE_COMPILE_TIME_MASKS
# define PNG_USE_COMPILE_TIME_MASKS 1 # define PNG_USE_COMPILE_TIME_MASKS 1
#endif #endif
PNG_EXTERN void png_combine_row PNGARG((png_const_structp png_ptr, PNG_EXTERN void png_combine_row PNGARG((png_const_structrp png_ptr,
png_bytep row, int display)); png_bytep row, int display));
#ifdef PNG_READ_INTERLACING_SUPPORTED #ifdef PNG_READ_INTERLACING_SUPPORTED
@ -979,7 +962,7 @@ PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info,
/* Unfilter a row: check the filter value before calling this, there is no point /* Unfilter a row: check the filter value before calling this, there is no point
* calling it for PNG_FILTER_VALUE_NONE. * calling it for PNG_FILTER_VALUE_NONE.
*/ */
PNG_EXTERN void png_read_filter_row PNGARG((png_structp pp, png_row_infop row_info, PNG_EXTERN void png_read_filter_row PNGARG((png_structrp pp, png_row_infop row_info,
png_bytep row, png_const_bytep prev_row, int filter)); png_bytep row, png_const_bytep prev_row, int filter));
PNG_EXTERN void png_read_filter_row_up_neon PNGARG((png_row_infop row_info, PNG_EXTERN void png_read_filter_row_up_neon PNGARG((png_row_infop row_info,
@ -998,19 +981,19 @@ PNG_EXTERN void png_read_filter_row_paeth4_neon PNGARG((png_row_infop row_info,
png_bytep row, png_const_bytep prev_row)); png_bytep row, png_const_bytep prev_row));
/* Choose the best filter to use and filter the row data */ /* Choose the best filter to use and filter the row data */
PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr, PNG_EXTERN void png_write_find_filter PNGARG((png_structrp png_ptr,
png_row_infop row_info)); png_row_infop row_info));
/* Finish a row while reading, dealing with interlacing passes, etc. */ /* Finish a row while reading, dealing with interlacing passes, etc. */
PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr)); PNG_EXTERN void png_read_finish_row PNGARG((png_structrp png_ptr));
/* Initialize the row buffers, etc. */ /* Initialize the row buffers, etc. */
PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr)); PNG_EXTERN void png_read_start_row PNGARG((png_structrp png_ptr));
#ifdef PNG_READ_TRANSFORMS_SUPPORTED #ifdef PNG_READ_TRANSFORMS_SUPPORTED
/* Optional call to update the users info structure */ /* Optional call to update the users info structure */
PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr, PNG_EXTERN void png_read_transform_info PNGARG((png_structrp png_ptr,
png_infop info_ptr)); png_inforp info_ptr));
#endif #endif
/* These are the functions that do the transformations */ /* These are the functions that do the transformations */
@ -1059,7 +1042,7 @@ PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info,
#endif #endif
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr, PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structrp png_ptr,
png_row_infop row_info, png_bytep row)); png_row_infop row_info, png_bytep row));
#endif #endif
@ -1099,7 +1082,7 @@ PNG_EXTERN void png_do_quantize PNGARG((png_row_infop row_info,
png_const_bytep quantize_lookup)); png_const_bytep quantize_lookup));
# ifdef PNG_CORRECT_PALETTE_SUPPORTED # ifdef PNG_CORRECT_PALETTE_SUPPORTED
PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr, PNG_EXTERN void png_correct_palette PNGARG((png_structrp png_ptr,
png_colorp palette, int num_palette)); png_colorp palette, int num_palette));
# endif # endif
#endif #endif
@ -1122,17 +1105,17 @@ PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info,
#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\ #if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
defined(PNG_READ_ALPHA_MODE_SUPPORTED) defined(PNG_READ_ALPHA_MODE_SUPPORTED)
PNG_EXTERN void png_do_compose PNGARG((png_row_infop row_info, PNG_EXTERN void png_do_compose PNGARG((png_row_infop row_info,
png_bytep row, png_structp png_ptr)); png_bytep row, png_structrp png_ptr));
#endif #endif
#ifdef PNG_READ_GAMMA_SUPPORTED #ifdef PNG_READ_GAMMA_SUPPORTED
PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info,
png_bytep row, png_structp png_ptr)); png_bytep row, png_structrp png_ptr));
#endif #endif
#ifdef PNG_READ_ALPHA_MODE_SUPPORTED #ifdef PNG_READ_ALPHA_MODE_SUPPORTED
PNG_EXTERN void png_do_encode_alpha PNGARG((png_row_infop row_info, PNG_EXTERN void png_do_encode_alpha PNGARG((png_row_infop row_info,
png_bytep row, png_structp png_ptr)); png_bytep row, png_structrp png_ptr));
#endif #endif
#ifdef PNG_READ_EXPAND_SUPPORTED #ifdef PNG_READ_EXPAND_SUPPORTED
@ -1153,173 +1136,173 @@ PNG_EXTERN void png_do_expand_16 PNGARG((png_row_infop row_info,
*/ */
/* Decode the IHDR chunk */ /* Decode the IHDR chunk */
PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr, PNG_EXTERN void png_handle_IHDR PNGARG((png_structrp png_ptr, png_inforp info_ptr,
png_uint_32 length)); png_uint_32 length));
PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr, PNG_EXTERN void png_handle_PLTE PNGARG((png_structrp png_ptr, png_inforp info_ptr,
png_uint_32 length)); png_uint_32 length));
PNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr, PNG_EXTERN void png_handle_IEND PNGARG((png_structrp png_ptr, png_inforp info_ptr,
png_uint_32 length)); png_uint_32 length));
#ifdef PNG_READ_bKGD_SUPPORTED #ifdef PNG_READ_bKGD_SUPPORTED
PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr, PNG_EXTERN void png_handle_bKGD PNGARG((png_structrp png_ptr, png_inforp info_ptr,
png_uint_32 length)); png_uint_32 length));
#endif #endif
#ifdef PNG_READ_cHRM_SUPPORTED #ifdef PNG_READ_cHRM_SUPPORTED
PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr, PNG_EXTERN void png_handle_cHRM PNGARG((png_structrp png_ptr, png_inforp info_ptr,
png_uint_32 length)); png_uint_32 length));
#endif #endif
#ifdef PNG_READ_gAMA_SUPPORTED #ifdef PNG_READ_gAMA_SUPPORTED
PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr, PNG_EXTERN void png_handle_gAMA PNGARG((png_structrp png_ptr, png_inforp info_ptr,
png_uint_32 length)); png_uint_32 length));
#endif #endif
#ifdef PNG_READ_hIST_SUPPORTED #ifdef PNG_READ_hIST_SUPPORTED
PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr, PNG_EXTERN void png_handle_hIST PNGARG((png_structrp png_ptr, png_inforp info_ptr,
png_uint_32 length)); png_uint_32 length));
#endif #endif
#ifdef PNG_READ_iCCP_SUPPORTED #ifdef PNG_READ_iCCP_SUPPORTED
PNG_EXTERN void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr, PNG_EXTERN void png_handle_iCCP PNGARG((png_structrp png_ptr, png_inforp info_ptr,
png_uint_32 length)); png_uint_32 length));
#endif /* PNG_READ_iCCP_SUPPORTED */ #endif /* PNG_READ_iCCP_SUPPORTED */
#ifdef PNG_READ_iTXt_SUPPORTED #ifdef PNG_READ_iTXt_SUPPORTED
PNG_EXTERN void png_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr, PNG_EXTERN void png_handle_iTXt PNGARG((png_structrp png_ptr, png_inforp info_ptr,
png_uint_32 length)); png_uint_32 length));
#endif #endif
#ifdef PNG_READ_oFFs_SUPPORTED #ifdef PNG_READ_oFFs_SUPPORTED
PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr, PNG_EXTERN void png_handle_oFFs PNGARG((png_structrp png_ptr, png_inforp info_ptr,
png_uint_32 length)); png_uint_32 length));
#endif #endif
#ifdef PNG_READ_pCAL_SUPPORTED #ifdef PNG_READ_pCAL_SUPPORTED
PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr, PNG_EXTERN void png_handle_pCAL PNGARG((png_structrp png_ptr, png_inforp info_ptr,
png_uint_32 length)); png_uint_32 length));
#endif #endif
#ifdef PNG_READ_pHYs_SUPPORTED #ifdef PNG_READ_pHYs_SUPPORTED
PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr, PNG_EXTERN void png_handle_pHYs PNGARG((png_structrp png_ptr, png_inforp info_ptr,
png_uint_32 length)); png_uint_32 length));
#endif #endif
#ifdef PNG_READ_sBIT_SUPPORTED #ifdef PNG_READ_sBIT_SUPPORTED
PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr, PNG_EXTERN void png_handle_sBIT PNGARG((png_structrp png_ptr, png_inforp info_ptr,
png_uint_32 length)); png_uint_32 length));
#endif #endif
#ifdef PNG_READ_sCAL_SUPPORTED #ifdef PNG_READ_sCAL_SUPPORTED
PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr, PNG_EXTERN void png_handle_sCAL PNGARG((png_structrp png_ptr, png_inforp info_ptr,
png_uint_32 length)); png_uint_32 length));
#endif #endif
#ifdef PNG_READ_sPLT_SUPPORTED #ifdef PNG_READ_sPLT_SUPPORTED
PNG_EXTERN void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr, PNG_EXTERN void png_handle_sPLT PNGARG((png_structrp png_ptr, png_inforp info_ptr,
png_uint_32 length)); png_uint_32 length));
#endif /* PNG_READ_sPLT_SUPPORTED */ #endif /* PNG_READ_sPLT_SUPPORTED */
#ifdef PNG_READ_sRGB_SUPPORTED #ifdef PNG_READ_sRGB_SUPPORTED
PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr, PNG_EXTERN void png_handle_sRGB PNGARG((png_structrp png_ptr, png_inforp info_ptr,
png_uint_32 length)); png_uint_32 length));
#endif #endif
#ifdef PNG_READ_tEXt_SUPPORTED #ifdef PNG_READ_tEXt_SUPPORTED
PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr, PNG_EXTERN void png_handle_tEXt PNGARG((png_structrp png_ptr, png_inforp info_ptr,
png_uint_32 length)); png_uint_32 length));
#endif #endif
#ifdef PNG_READ_tIME_SUPPORTED #ifdef PNG_READ_tIME_SUPPORTED
PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr, PNG_EXTERN void png_handle_tIME PNGARG((png_structrp png_ptr, png_inforp info_ptr,
png_uint_32 length)); png_uint_32 length));
#endif #endif
#ifdef PNG_READ_tRNS_SUPPORTED #ifdef PNG_READ_tRNS_SUPPORTED
PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr, PNG_EXTERN void png_handle_tRNS PNGARG((png_structrp png_ptr, png_inforp info_ptr,
png_uint_32 length)); png_uint_32 length));
#endif #endif
#ifdef PNG_READ_zTXt_SUPPORTED #ifdef PNG_READ_zTXt_SUPPORTED
PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr, PNG_EXTERN void png_handle_zTXt PNGARG((png_structrp png_ptr, png_inforp info_ptr,
png_uint_32 length)); png_uint_32 length));
#endif #endif
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr, PNG_EXTERN void png_handle_unknown PNGARG((png_structrp png_ptr,
png_infop info_ptr, png_uint_32 length)); png_inforp info_ptr, png_uint_32 length));
#endif #endif
PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr, PNG_EXTERN void png_check_chunk_name PNGARG((png_structrp png_ptr,
png_uint_32 chunk_name)); png_uint_32 chunk_name));
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
/* Exactly as png_handle_as_unknown() except that the argument is a 32-bit chunk /* Exactly as png_handle_as_unknown() except that the argument is a 32-bit chunk
* name, not a string. * name, not a string.
*/ */
PNG_EXTERN int png_chunk_unknown_handling PNGARG((png_structp png_ptr, PNG_EXTERN int png_chunk_unknown_handling PNGARG((png_structrp png_ptr,
png_uint_32 chunk_name)); png_uint_32 chunk_name));
#endif #endif
/* Handle the transformations for reading and writing */ /* Handle the transformations for reading and writing */
#ifdef PNG_READ_TRANSFORMS_SUPPORTED #ifdef PNG_READ_TRANSFORMS_SUPPORTED
PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr, PNG_EXTERN void png_do_read_transformations PNGARG((png_structrp png_ptr,
png_row_infop row_info)); png_row_infop row_info));
#endif #endif
#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr, PNG_EXTERN void png_do_write_transformations PNGARG((png_structrp png_ptr,
png_row_infop row_info)); png_row_infop row_info));
#endif #endif
#ifdef PNG_READ_TRANSFORMS_SUPPORTED #ifdef PNG_READ_TRANSFORMS_SUPPORTED
PNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr)); PNG_EXTERN void png_init_read_transformations PNGARG((png_structrp png_ptr));
#endif #endif
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr, PNG_EXTERN void png_push_read_chunk PNGARG((png_structrp png_ptr,
png_infop info_ptr)); png_inforp info_ptr));
PNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr, PNG_EXTERN void png_push_read_sig PNGARG((png_structrp png_ptr,
png_infop info_ptr)); png_inforp info_ptr));
PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr)); PNG_EXTERN void png_push_check_crc PNGARG((png_structrp png_ptr));
PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr, PNG_EXTERN void png_push_crc_skip PNGARG((png_structrp png_ptr,
png_uint_32 length)); png_uint_32 length));
PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr)); PNG_EXTERN void png_push_crc_finish PNGARG((png_structrp png_ptr));
PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr)); PNG_EXTERN void png_push_save_buffer PNGARG((png_structrp png_ptr));
PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr, PNG_EXTERN void png_push_restore_buffer PNGARG((png_structrp png_ptr,
png_bytep buffer, png_size_t buffer_length)); png_bytep buffer, png_size_t buffer_length));
PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr)); PNG_EXTERN void png_push_read_IDAT PNGARG((png_structrp png_ptr));
PNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr, PNG_EXTERN void png_process_IDAT_data PNGARG((png_structrp png_ptr,
png_bytep buffer, png_size_t buffer_length)); png_bytep buffer, png_size_t buffer_length));
PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr)); PNG_EXTERN void png_push_process_row PNGARG((png_structrp png_ptr));
PNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr, PNG_EXTERN void png_push_handle_unknown PNGARG((png_structrp png_ptr,
png_infop info_ptr, png_uint_32 length)); png_inforp info_ptr, png_uint_32 length));
PNG_EXTERN void png_push_have_info PNGARG((png_structp png_ptr, PNG_EXTERN void png_push_have_info PNGARG((png_structrp png_ptr,
png_infop info_ptr)); png_inforp info_ptr));
PNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr, PNG_EXTERN void png_push_have_end PNGARG((png_structrp png_ptr,
png_infop info_ptr)); png_inforp info_ptr));
PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row)); PNG_EXTERN void png_push_have_row PNGARG((png_structrp png_ptr, png_bytep row));
PNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr, PNG_EXTERN void png_push_read_end PNGARG((png_structrp png_ptr,
png_infop info_ptr)); png_inforp info_ptr));
PNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr, PNG_EXTERN void png_process_some_data PNGARG((png_structrp png_ptr,
png_infop info_ptr)); png_inforp info_ptr));
PNG_EXTERN void png_read_push_finish_row PNGARG((png_structp png_ptr)); PNG_EXTERN void png_read_push_finish_row PNGARG((png_structrp png_ptr));
# ifdef PNG_READ_tEXt_SUPPORTED # ifdef PNG_READ_tEXt_SUPPORTED
PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr, PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structrp png_ptr,
png_infop info_ptr, png_uint_32 length)); png_inforp info_ptr, png_uint_32 length));
PNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr, PNG_EXTERN void png_push_read_tEXt PNGARG((png_structrp png_ptr,
png_infop info_ptr)); png_inforp info_ptr));
# endif # endif
# ifdef PNG_READ_zTXt_SUPPORTED # ifdef PNG_READ_zTXt_SUPPORTED
PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr, PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structrp png_ptr,
png_infop info_ptr, png_uint_32 length)); png_inforp info_ptr, png_uint_32 length));
PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr, PNG_EXTERN void png_push_read_zTXt PNGARG((png_structrp png_ptr,
png_infop info_ptr)); png_inforp info_ptr));
# endif # endif
# ifdef PNG_READ_iTXt_SUPPORTED # ifdef PNG_READ_iTXt_SUPPORTED
PNG_EXTERN void png_push_handle_iTXt PNGARG((png_structp png_ptr, PNG_EXTERN void png_push_handle_iTXt PNGARG((png_structrp png_ptr,
png_infop info_ptr, png_uint_32 length)); png_inforp info_ptr, png_uint_32 length));
PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr, PNG_EXTERN void png_push_read_iTXt PNGARG((png_structrp png_ptr,
png_infop info_ptr)); png_inforp info_ptr));
# endif # endif
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
@ -1333,7 +1316,7 @@ PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info,
/* Added at libpng version 1.4.0 */ /* Added at libpng version 1.4.0 */
#ifdef PNG_CHECK_cHRM_SUPPORTED #ifdef PNG_CHECK_cHRM_SUPPORTED
PNG_EXTERN int png_check_cHRM_fixed PNGARG((png_structp png_ptr, PNG_EXTERN int png_check_cHRM_fixed PNGARG((png_structrp png_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 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_blue_x, int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
@ -1372,18 +1355,18 @@ typedef struct png_XYZ
*/ */
PNG_EXTERN int png_xy_from_XYZ PNGARG((png_xy *xy, png_XYZ XYZ)); PNG_EXTERN int png_xy_from_XYZ PNGARG((png_xy *xy, png_XYZ XYZ));
PNG_EXTERN int png_XYZ_from_xy PNGARG((png_XYZ *XYZ, png_xy xy)); PNG_EXTERN int png_XYZ_from_xy PNGARG((png_XYZ *XYZ, png_xy xy));
PNG_EXTERN int png_XYZ_from_xy_checked PNGARG((png_const_structp png_ptr, PNG_EXTERN int png_XYZ_from_xy_checked PNGARG((png_const_structrp png_ptr,
png_XYZ *XYZ, png_xy xy)); png_XYZ *XYZ, png_xy xy));
#endif #endif
/* Added at libpng version 1.4.0 */ /* Added at libpng version 1.4.0 */
PNG_EXTERN void png_check_IHDR PNGARG((png_const_structp png_ptr, PNG_EXTERN void png_check_IHDR PNGARG((png_const_structrp png_ptr,
png_uint_32 width, png_uint_32 height, int bit_depth, png_uint_32 width, png_uint_32 height, int bit_depth,
int color_type, int interlace_type, int compression_type, int color_type, int interlace_type, int compression_type,
int filter_type)); int filter_type));
#if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED) #if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)
PNG_EXTERN PNG_FUNCTION(void, png_fixed_error, (png_const_structp png_ptr, PNG_EXTERN PNG_FUNCTION(void, png_fixed_error, (png_const_structrp png_ptr,
png_const_charp name),PNG_NORETURN); png_const_charp name),PNG_NORETURN);
#endif #endif
@ -1449,7 +1432,7 @@ PNG_EXTERN void png_warning_parameter_unsigned(png_warning_parameters p,
PNG_EXTERN void png_warning_parameter_signed(png_warning_parameters p, PNG_EXTERN void png_warning_parameter_signed(png_warning_parameters p,
int number, int format, png_int_32 value); int number, int format, png_int_32 value);
PNG_EXTERN void png_formatted_warning(png_const_structp png_ptr, PNG_EXTERN void png_formatted_warning(png_const_structrp png_ptr,
png_warning_parameters p, png_const_charp message); png_warning_parameters p, png_const_charp message);
/* 'message' follows the X/Open approach of using @1, @2 to insert /* 'message' follows the X/Open approach of using @1, @2 to insert
* parameters previously supplied using the above functions. Errors in * parameters previously supplied using the above functions. Errors in
@ -1469,12 +1452,12 @@ PNG_EXTERN void png_formatted_warning(png_const_structp png_ptr,
#define PNG_sCAL_MAX_DIGITS (PNG_sCAL_PRECISION+1/*.*/+1/*E*/+10/*exponent*/) #define PNG_sCAL_MAX_DIGITS (PNG_sCAL_PRECISION+1/*.*/+1/*E*/+10/*exponent*/)
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
PNG_EXTERN void png_ascii_from_fp PNGARG((png_structp png_ptr, png_charp ascii, PNG_EXTERN void png_ascii_from_fp PNGARG((png_structrp png_ptr, png_charp ascii,
png_size_t size, double fp, unsigned int precision)); png_size_t size, double fp, unsigned int precision));
#endif /* FLOATING_POINT */ #endif /* FLOATING_POINT */
#ifdef PNG_FIXED_POINT_SUPPORTED #ifdef PNG_FIXED_POINT_SUPPORTED
PNG_EXTERN void png_ascii_from_fixed PNGARG((png_structp png_ptr, PNG_EXTERN void png_ascii_from_fixed PNGARG((png_structrp png_ptr,
png_charp ascii, png_size_t size, png_fixed_point fp)); png_charp ascii, png_size_t size, png_fixed_point fp));
#endif /* FIXED_POINT */ #endif /* FIXED_POINT */
#endif /* READ_sCAL */ #endif /* READ_sCAL */
@ -1594,7 +1577,7 @@ PNG_EXTERN int png_muldiv PNGARG((png_fixed_point_p res, png_fixed_point a,
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED) #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED)
/* Same deal, but issue a warning on overflow and return 0. */ /* Same deal, but issue a warning on overflow and return 0. */
PNG_EXTERN png_fixed_point png_muldiv_warn PNGARG((png_const_structp png_ptr, PNG_EXTERN png_fixed_point png_muldiv_warn PNGARG((png_const_structrp png_ptr,
png_fixed_point a, png_int_32 multiplied_by, png_int_32 divided_by)); png_fixed_point a, png_int_32 multiplied_by, png_int_32 divided_by));
#endif #endif
@ -1621,15 +1604,15 @@ PNG_EXTERN png_fixed_point png_reciprocal2 PNGARG((png_fixed_point a,
* While the input is an 'unsigned' value it must actually be the * While the input is an 'unsigned' value it must actually be the
* correct bit value - 0..255 or 0..65535 as required. * correct bit value - 0..255 or 0..65535 as required.
*/ */
PNG_EXTERN png_uint_16 png_gamma_correct PNGARG((png_structp png_ptr, PNG_EXTERN png_uint_16 png_gamma_correct PNGARG((png_structrp png_ptr,
unsigned int value, png_fixed_point gamma_value)); unsigned int value, png_fixed_point gamma_value));
PNG_EXTERN int png_gamma_significant PNGARG((png_fixed_point gamma_value)); PNG_EXTERN int png_gamma_significant PNGARG((png_fixed_point gamma_value));
PNG_EXTERN png_uint_16 png_gamma_16bit_correct PNGARG((unsigned int value, PNG_EXTERN png_uint_16 png_gamma_16bit_correct PNGARG((unsigned int value,
png_fixed_point gamma_value)); png_fixed_point gamma_value));
PNG_EXTERN png_byte png_gamma_8bit_correct PNGARG((unsigned int value, PNG_EXTERN png_byte png_gamma_8bit_correct PNGARG((unsigned int value,
png_fixed_point gamma_value)); png_fixed_point gamma_value));
PNG_EXTERN void png_destroy_gamma_table(png_structp png_ptr); PNG_EXTERN void png_destroy_gamma_table(png_structrp png_ptr);
PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr, PNG_EXTERN void png_build_gamma_table PNGARG((png_structrp png_ptr,
int bit_depth)); int bit_depth));
#endif #endif

View File

@ -51,7 +51,8 @@ png_create_read_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
int ok = 0; int ok = 0;
/* TODO: why does this happen here on read, but in png_write_IHDR on /* TODO: why does this happen here on read, but in png_write_IHDR on
* write? * write? If it happened there then there would be no error handling case
* here and png_ptr could be a png_structrp.
*/ */
png_ptr->zstream.zalloc = png_zalloc; png_ptr->zstream.zalloc = png_zalloc;
png_ptr->zstream.zfree = png_zfree; png_ptr->zstream.zfree = png_zfree;
@ -115,7 +116,7 @@ png_create_read_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
* read if it is determined that this isn't a valid PNG file. * read if it is determined that this isn't a valid PNG file.
*/ */
void PNGAPI void PNGAPI
png_read_info(png_structp png_ptr, png_infop info_ptr) png_read_info(png_structrp png_ptr, png_inforp info_ptr)
{ {
png_debug(1, "in png_read_info"); png_debug(1, "in png_read_info");
@ -278,7 +279,7 @@ png_read_info(png_structp png_ptr, png_infop info_ptr)
/* Optional call to update the users info_ptr structure */ /* Optional call to update the users info_ptr structure */
void PNGAPI void PNGAPI
png_read_update_info(png_structp png_ptr, png_infop info_ptr) png_read_update_info(png_structrp png_ptr, png_inforp info_ptr)
{ {
png_debug(1, "in png_read_update_info"); png_debug(1, "in png_read_update_info");
@ -301,7 +302,7 @@ png_read_update_info(png_structp png_ptr, png_infop info_ptr)
* If the user doesn't call this, we will do it ourselves. * If the user doesn't call this, we will do it ourselves.
*/ */
void PNGAPI void PNGAPI
png_start_read_image(png_structp png_ptr) png_start_read_image(png_structrp png_ptr)
{ {
png_debug(1, "in png_start_read_image"); png_debug(1, "in png_start_read_image");
@ -312,7 +313,7 @@ png_start_read_image(png_structp png_ptr)
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
void PNGAPI void PNGAPI
png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row) png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row)
{ {
int ret; int ret;
@ -612,7 +613,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
*/ */
void PNGAPI void PNGAPI
png_read_rows(png_structp png_ptr, png_bytepp row, png_read_rows(png_structrp png_ptr, png_bytepp row,
png_bytepp display_row, png_uint_32 num_rows) png_bytepp display_row, png_uint_32 num_rows)
{ {
png_uint_32 i; png_uint_32 i;
@ -667,7 +668,7 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
* [*] png_handle_alpha() does not exist yet, as of this version of libpng * [*] png_handle_alpha() does not exist yet, as of this version of libpng
*/ */
void PNGAPI void PNGAPI
png_read_image(png_structp png_ptr, png_bytepp image) png_read_image(png_structrp png_ptr, png_bytepp image)
{ {
png_uint_32 i, image_height; png_uint_32 i, image_height;
int pass, j; int pass, j;
@ -732,7 +733,7 @@ png_read_image(png_structp png_ptr, png_bytepp image)
* or time information at the end of the file, if info is not NULL. * or time information at the end of the file, if info is not NULL.
*/ */
void PNGAPI void PNGAPI
png_read_end(png_structp png_ptr, png_infop info_ptr) png_read_end(png_structrp png_ptr, png_inforp info_ptr)
{ {
png_debug(1, "in png_read_end"); png_debug(1, "in png_read_end");
@ -873,7 +874,7 @@ png_read_end(png_structp png_ptr, png_infop info_ptr)
/* Free all memory used in the read struct */ /* Free all memory used in the read struct */
static void static void
png_read_destroy(png_structp png_ptr) png_read_destroy(png_structrp png_ptr)
{ {
png_debug(1, "in png_read_destroy"); png_debug(1, "in png_read_destroy");
@ -939,7 +940,7 @@ void PNGAPI
png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
png_infopp end_info_ptr_ptr) png_infopp end_info_ptr_ptr)
{ {
png_structp png_ptr = NULL; png_structrp png_ptr = NULL;
png_debug(1, "in png_destroy_read_struct"); png_debug(1, "in png_destroy_read_struct");
@ -962,7 +963,7 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
} }
void PNGAPI void PNGAPI
png_set_read_status_fn(png_structp png_ptr, png_read_status_ptr read_row_fn) png_set_read_status_fn(png_structrp png_ptr, png_read_status_ptr read_row_fn)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
@ -974,7 +975,7 @@ png_set_read_status_fn(png_structp png_ptr, png_read_status_ptr read_row_fn)
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
#ifdef PNG_INFO_IMAGE_SUPPORTED #ifdef PNG_INFO_IMAGE_SUPPORTED
void PNGAPI void PNGAPI
png_read_png(png_structp png_ptr, png_infop info_ptr, png_read_png(png_structrp png_ptr, png_inforp info_ptr,
int transforms, int transforms,
voidp params) voidp params)
{ {
@ -1208,7 +1209,7 @@ png_image_read_init(png_imagep image)
/* Utility to find the base format of a PNG file from a png_struct. */ /* Utility to find the base format of a PNG file from a png_struct. */
static png_uint_32 static png_uint_32
png_image_format(png_structp png_ptr, png_infop info_ptr) png_image_format(png_structrp png_ptr, png_inforp info_ptr)
{ {
png_uint_32 format = 0; png_uint_32 format = 0;
@ -1235,8 +1236,8 @@ static int
png_image_read_header(png_voidp argument) png_image_read_header(png_voidp argument)
{ {
png_imagep image = png_voidcast(png_imagep, argument); png_imagep image = png_voidcast(png_imagep, argument);
png_structp png_ptr = image->opaque->png_ptr; png_structrp png_ptr = image->opaque->png_ptr;
png_infop info_ptr = image->opaque->info_ptr; png_inforp info_ptr = image->opaque->info_ptr;
png_read_info(png_ptr, info_ptr); png_read_info(png_ptr, info_ptr);
@ -1434,7 +1435,7 @@ png_image_read_composite(png_voidp argument)
png_image_read_control *display = png_voidcast(png_image_read_control*, png_image_read_control *display = png_voidcast(png_image_read_control*,
argument); argument);
png_imagep image = display->image; png_imagep image = display->image;
png_structp png_ptr = image->opaque->png_ptr; png_structrp png_ptr = image->opaque->png_ptr;
png_byte interlace_type = png_ptr->interlaced; png_byte interlace_type = png_ptr->interlaced;
int passes; int passes;
@ -1561,8 +1562,8 @@ png_image_read_background(png_voidp argument)
png_image_read_control *display = png_voidcast(png_image_read_control*, png_image_read_control *display = png_voidcast(png_image_read_control*,
argument); argument);
png_imagep image = display->image; png_imagep image = display->image;
png_structp png_ptr = image->opaque->png_ptr; png_structrp png_ptr = image->opaque->png_ptr;
png_infop info_ptr = image->opaque->info_ptr; png_inforp info_ptr = image->opaque->info_ptr;
png_byte interlace_type = png_ptr->interlaced; png_byte interlace_type = png_ptr->interlaced;
png_uint_32 height = image->height; png_uint_32 height = image->height;
png_uint_32 width = image->width; png_uint_32 width = image->width;
@ -1820,8 +1821,8 @@ png_image_read_end(png_voidp argument)
png_image_read_control *display = png_voidcast(png_image_read_control*, png_image_read_control *display = png_voidcast(png_image_read_control*,
argument); argument);
png_imagep image = display->image; png_imagep image = display->image;
png_structp png_ptr = image->opaque->png_ptr; png_structrp png_ptr = image->opaque->png_ptr;
png_infop info_ptr = image->opaque->info_ptr; png_inforp info_ptr = image->opaque->info_ptr;
png_uint_32 format = image->format; png_uint_32 format = image->format;
int linear = (format & PNG_FORMAT_FLAG_LINEAR) != 0; int linear = (format & PNG_FORMAT_FLAG_LINEAR) != 0;

View File

@ -1,7 +1,7 @@
/* pngrio.c - functions for data input /* pngrio.c - functions for data input
* *
* Last changed in libpng 1.5.0 [January 6, 2011] * Last changed in libpng 1.6.0 [(PENDING RELEASE)]
* Copyright (c) 1998-2011 Glenn Randers-Pehrson * Copyright (c) 1998-2011 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.)
@ -29,7 +29,7 @@
* to read more then 64K on a 16 bit machine. * to read more then 64K on a 16 bit machine.
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length) png_read_data(png_structrp png_ptr, png_bytep data, png_size_t length)
{ {
png_debug1(4, "reading %d bytes", (int)length); png_debug1(4, "reading %d bytes", (int)length);
@ -84,7 +84,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
* be used. * be used.
*/ */
void PNGAPI void PNGAPI
png_set_read_fn(png_structp png_ptr, png_voidp io_ptr, png_set_read_fn(png_structrp png_ptr, png_voidp io_ptr,
png_rw_ptr read_data_fn) png_rw_ptr read_data_fn)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)

View File

@ -22,7 +22,7 @@
/* Set the action on getting a CRC error for an ancillary or critical chunk. */ /* Set the action on getting a CRC error for an ancillary or critical chunk. */
void PNGAPI void PNGAPI
png_set_crc_action(png_structp png_ptr, int crit_action, int ancil_action) png_set_crc_action(png_structrp png_ptr, int crit_action, int ancil_action)
{ {
png_debug(1, "in png_set_crc_action"); png_debug(1, "in png_set_crc_action");
@ -91,7 +91,7 @@ png_set_crc_action(png_structp png_ptr, int crit_action, int ancil_action)
#ifdef PNG_READ_BACKGROUND_SUPPORTED #ifdef PNG_READ_BACKGROUND_SUPPORTED
/* Handle alpha and tRNS via a background color */ /* Handle alpha and tRNS via a background color */
void PNGFAPI void PNGFAPI
png_set_background_fixed(png_structp png_ptr, 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)
{ {
@ -122,7 +122,7 @@ png_set_background_fixed(png_structp png_ptr,
# ifdef PNG_FLOATING_POINT_SUPPORTED # ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI void PNGAPI
png_set_background(png_structp png_ptr, 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)
{ {
@ -138,7 +138,7 @@ png_set_background(png_structp png_ptr,
*/ */
#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED #ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
void PNGAPI void PNGAPI
png_set_scale_16(png_structp png_ptr) png_set_scale_16(png_structrp png_ptr)
{ {
png_debug(1, "in png_set_scale_16"); png_debug(1, "in png_set_scale_16");
@ -152,7 +152,7 @@ png_set_scale_16(png_structp png_ptr)
#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED #ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
/* Chop 16-bit depth files to 8-bit depth */ /* Chop 16-bit depth files to 8-bit depth */
void PNGAPI void PNGAPI
png_set_strip_16(png_structp png_ptr) png_set_strip_16(png_structrp png_ptr)
{ {
png_debug(1, "in png_set_strip_16"); png_debug(1, "in png_set_strip_16");
@ -165,7 +165,7 @@ png_set_strip_16(png_structp png_ptr)
#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED #ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
void PNGAPI void PNGAPI
png_set_strip_alpha(png_structp png_ptr) png_set_strip_alpha(png_structrp png_ptr)
{ {
png_debug(1, "in png_set_strip_alpha"); png_debug(1, "in png_set_strip_alpha");
@ -178,7 +178,7 @@ png_set_strip_alpha(png_structp png_ptr)
#if defined(PNG_READ_ALPHA_MODE_SUPPORTED) || defined(PNG_READ_GAMMA_SUPPORTED) #if defined(PNG_READ_ALPHA_MODE_SUPPORTED) || defined(PNG_READ_GAMMA_SUPPORTED)
static png_fixed_point static png_fixed_point
translate_gamma_flags(png_structp png_ptr, png_fixed_point output_gamma, translate_gamma_flags(png_structrp png_ptr, png_fixed_point output_gamma,
int is_screen) int is_screen)
{ {
/* Check for flag values. The main reason for having the old Mac value as a /* Check for flag values. The main reason for having the old Mac value as a
@ -215,7 +215,7 @@ translate_gamma_flags(png_structp png_ptr, png_fixed_point output_gamma,
# ifdef PNG_FLOATING_POINT_SUPPORTED # ifdef PNG_FLOATING_POINT_SUPPORTED
static png_fixed_point static png_fixed_point
convert_gamma_value(png_structp png_ptr, double output_gamma) convert_gamma_value(png_structrp png_ptr, double output_gamma)
{ {
/* The following silently ignores cases where fixed point (times 100,000) /* The following silently ignores cases where fixed point (times 100,000)
* gamma values are passed to the floating point API. This is safe and it * gamma values are passed to the floating point API. This is safe and it
@ -240,7 +240,7 @@ convert_gamma_value(png_structp png_ptr, double output_gamma)
#ifdef PNG_READ_ALPHA_MODE_SUPPORTED #ifdef PNG_READ_ALPHA_MODE_SUPPORTED
void PNGFAPI void PNGFAPI
png_set_alpha_mode_fixed(png_structp png_ptr, int mode, png_set_alpha_mode_fixed(png_structrp png_ptr, int mode,
png_fixed_point output_gamma) png_fixed_point output_gamma)
{ {
int compose = 0; int compose = 0;
@ -350,7 +350,7 @@ png_set_alpha_mode_fixed(png_structp png_ptr, int mode,
# ifdef PNG_FLOATING_POINT_SUPPORTED # ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI void PNGAPI
png_set_alpha_mode(png_structp png_ptr, int mode, double output_gamma) png_set_alpha_mode(png_structrp png_ptr, int mode, double output_gamma)
{ {
png_set_alpha_mode_fixed(png_ptr, mode, convert_gamma_value(png_ptr, png_set_alpha_mode_fixed(png_ptr, mode, convert_gamma_value(png_ptr,
output_gamma)); output_gamma));
@ -378,7 +378,7 @@ typedef png_dsort * png_dsortp;
typedef png_dsort * * png_dsortpp; typedef png_dsort * * png_dsortpp;
void PNGAPI void PNGAPI
png_set_quantize(png_structp png_ptr, png_colorp palette, png_set_quantize(png_structrp png_ptr, png_colorp palette,
int num_palette, int maximum_colors, png_const_uint_16p histogram, int num_palette, int maximum_colors, png_const_uint_16p histogram,
int full_quantize) int full_quantize)
{ {
@ -766,7 +766,7 @@ png_set_quantize(png_structp png_ptr, png_colorp palette,
#ifdef PNG_READ_GAMMA_SUPPORTED #ifdef PNG_READ_GAMMA_SUPPORTED
void PNGFAPI void PNGFAPI
png_set_gamma_fixed(png_structp png_ptr, png_fixed_point scrn_gamma, png_set_gamma_fixed(png_structrp png_ptr, png_fixed_point scrn_gamma,
png_fixed_point file_gamma) png_fixed_point file_gamma)
{ {
png_debug(1, "in png_set_gamma_fixed"); png_debug(1, "in png_set_gamma_fixed");
@ -805,7 +805,7 @@ png_set_gamma_fixed(png_structp png_ptr, png_fixed_point scrn_gamma,
# ifdef PNG_FLOATING_POINT_SUPPORTED # ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI void PNGAPI
png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma) png_set_gamma(png_structrp png_ptr, double scrn_gamma, double file_gamma)
{ {
png_set_gamma_fixed(png_ptr, convert_gamma_value(png_ptr, scrn_gamma), png_set_gamma_fixed(png_ptr, convert_gamma_value(png_ptr, scrn_gamma),
convert_gamma_value(png_ptr, file_gamma)); convert_gamma_value(png_ptr, file_gamma));
@ -819,7 +819,7 @@ png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma)
* to alpha channels. * to alpha channels.
*/ */
void PNGAPI void PNGAPI
png_set_expand(png_structp png_ptr) png_set_expand(png_structrp png_ptr)
{ {
png_debug(1, "in png_set_expand"); png_debug(1, "in png_set_expand");
@ -850,7 +850,7 @@ png_set_expand(png_structp png_ptr)
/* Expand paletted images to RGB. */ /* Expand paletted images to RGB. */
void PNGAPI void PNGAPI
png_set_palette_to_rgb(png_structp png_ptr) png_set_palette_to_rgb(png_structrp png_ptr)
{ {
png_debug(1, "in png_set_palette_to_rgb"); png_debug(1, "in png_set_palette_to_rgb");
@ -863,7 +863,7 @@ png_set_palette_to_rgb(png_structp png_ptr)
/* Expand grayscale images of less than 8-bit depth to 8 bits. */ /* Expand grayscale images of less than 8-bit depth to 8 bits. */
void PNGAPI void PNGAPI
png_set_expand_gray_1_2_4_to_8(png_structp png_ptr) png_set_expand_gray_1_2_4_to_8(png_structrp png_ptr)
{ {
png_debug(1, "in png_set_expand_gray_1_2_4_to_8"); png_debug(1, "in png_set_expand_gray_1_2_4_to_8");
@ -878,7 +878,7 @@ png_set_expand_gray_1_2_4_to_8(png_structp png_ptr)
/* Expand tRNS chunks to alpha channels. */ /* Expand tRNS chunks to alpha channels. */
void PNGAPI void PNGAPI
png_set_tRNS_to_alpha(png_structp png_ptr) png_set_tRNS_to_alpha(png_structrp png_ptr)
{ {
png_debug(1, "in png_set_tRNS_to_alpha"); png_debug(1, "in png_set_tRNS_to_alpha");
@ -892,7 +892,7 @@ png_set_tRNS_to_alpha(png_structp png_ptr)
* it may not work correctly.) * it may not work correctly.)
*/ */
void PNGAPI void PNGAPI
png_set_expand_16(png_structp png_ptr) png_set_expand_16(png_structrp png_ptr)
{ {
png_debug(1, "in png_set_expand_16"); png_debug(1, "in png_set_expand_16");
@ -909,7 +909,7 @@ png_set_expand_16(png_structp png_ptr)
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED #ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
void PNGAPI void PNGAPI
png_set_gray_to_rgb(png_structp png_ptr) png_set_gray_to_rgb(png_structrp png_ptr)
{ {
png_debug(1, "in png_set_gray_to_rgb"); png_debug(1, "in png_set_gray_to_rgb");
@ -925,7 +925,7 @@ png_set_gray_to_rgb(png_structp png_ptr)
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
void PNGFAPI void PNGFAPI
png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action, png_set_rgb_to_gray_fixed(png_structrp png_ptr, int error_action,
png_fixed_point red, png_fixed_point green) png_fixed_point red, png_fixed_point green)
{ {
png_debug(1, "in png_set_rgb_to_gray"); png_debug(1, "in png_set_rgb_to_gray");
@ -1009,7 +1009,7 @@ png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action,
*/ */
void PNGAPI void PNGAPI
png_set_rgb_to_gray(png_structp png_ptr, int error_action, double red, png_set_rgb_to_gray(png_structrp png_ptr, int error_action, double red,
double green) double green)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
@ -1026,7 +1026,7 @@ png_set_rgb_to_gray(png_structp png_ptr, int error_action, double red,
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
void PNGAPI void PNGAPI
png_set_read_user_transform_fn(png_structp png_ptr, png_user_transform_ptr png_set_read_user_transform_fn(png_structrp png_ptr, png_user_transform_ptr
read_user_transform_fn) read_user_transform_fn)
{ {
png_debug(1, "in png_set_read_user_transform_fn"); png_debug(1, "in png_set_read_user_transform_fn");
@ -1073,7 +1073,7 @@ png_gamma_threshold(png_fixed_point screen_gamma, png_fixed_point file_gamma)
* extracted from 'png_init_read_transformations'. * extracted from 'png_init_read_transformations'.
*/ */
static void /* PRIVATE */ static void /* PRIVATE */
png_init_palette_transformations(png_structp png_ptr) png_init_palette_transformations(png_structrp png_ptr)
{ {
/* Called to handle the (input) palette case. In png_do_read_transformations /* Called to handle the (input) palette case. In png_do_read_transformations
* the first step is to expand the palette if requested, so this code must * the first step is to expand the palette if requested, so this code must
@ -1156,7 +1156,7 @@ png_init_palette_transformations(png_structp png_ptr)
} }
static void /* PRIVATE */ static void /* PRIVATE */
png_init_rgb_transformations(png_structp png_ptr) png_init_rgb_transformations(png_structrp png_ptr)
{ {
/* Added to libpng-1.5.4: check the color type to determine whether there /* Added to libpng-1.5.4: check the color type to determine whether there
* is any alpha or transparency in the image and simply cancel the * is any alpha or transparency in the image and simply cancel the
@ -1241,7 +1241,7 @@ png_init_rgb_transformations(png_structp png_ptr)
} }
void /* PRIVATE */ void /* PRIVATE */
png_init_read_transformations(png_structp png_ptr) png_init_read_transformations(png_structrp png_ptr)
{ {
png_debug(1, "in png_init_read_transformations"); png_debug(1, "in png_init_read_transformations");
@ -1873,7 +1873,7 @@ png_init_read_transformations(png_structp png_ptr)
* assuming the transformations result in valid PNG data. * assuming the transformations result in valid PNG data.
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_read_transform_info(png_structp png_ptr, png_infop info_ptr) png_read_transform_info(png_structrp png_ptr, png_inforp info_ptr)
{ {
png_debug(1, "in png_read_transform_info"); png_debug(1, "in png_read_transform_info");
@ -2073,7 +2073,7 @@ defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
* decide how it fits in with the other transformations here. * decide how it fits in with the other transformations here.
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_do_read_transformations(png_structp png_ptr, png_row_infop row_info) png_do_read_transformations(png_structrp png_ptr, png_row_infop row_info)
{ {
png_debug(1, "in png_do_read_transformations"); png_debug(1, "in png_do_read_transformations");
@ -3213,7 +3213,7 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
* to that used above. * to that used above.
*/ */
int /* PRIVATE */ int /* PRIVATE */
png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row) png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
{ {
int rgb_error = 0; int rgb_error = 0;
@ -3473,7 +3473,7 @@ png_build_grayscale_palette(int bit_depth, png_colorp palette)
* at a gamma of 1.0. Paletted files have already been taken care of. * at a gamma of 1.0. Paletted files have already been taken care of.
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_do_compose(png_row_infop row_info, png_bytep row, png_structp png_ptr) png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
{ {
#ifdef PNG_READ_GAMMA_SUPPORTED #ifdef PNG_READ_GAMMA_SUPPORTED
png_const_bytep gamma_table = png_ptr->gamma_table; png_const_bytep gamma_table = png_ptr->gamma_table;
@ -4185,7 +4185,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structp png_ptr)
* build_gamma_table(). * build_gamma_table().
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_do_gamma(png_row_infop row_info, png_bytep row, png_structp png_ptr) png_do_gamma(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
{ {
png_const_bytep gamma_table = png_ptr->gamma_table; png_const_bytep gamma_table = png_ptr->gamma_table;
png_const_uint_16pp gamma_16_table = png_ptr->gamma_16_table; png_const_uint_16pp gamma_16_table = png_ptr->gamma_16_table;
@ -4386,7 +4386,7 @@ png_do_gamma(png_row_infop row_info, png_bytep row, png_structp png_ptr)
* from_1 tables. * from_1 tables.
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_do_encode_alpha(png_row_infop row_info, png_bytep row, png_structp png_ptr) png_do_encode_alpha(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
{ {
png_uint_32 row_width = row_info->width; png_uint_32 row_width = row_info->width;

View File

@ -21,7 +21,7 @@
#define png_strtod(p,a,b) strtod(a,b) #define png_strtod(p,a,b) strtod(a,b)
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_uint_31(png_const_structp png_ptr, png_const_bytep buf) png_get_uint_31(png_const_structrp png_ptr, png_const_bytep buf)
{ {
png_uint_32 uval = png_get_uint_32(buf); png_uint_32 uval = png_get_uint_32(buf);
@ -40,7 +40,7 @@ png_get_uint_31(png_const_structp png_ptr, png_const_bytep buf)
#define PNG_FIXED_ERROR (-1) #define PNG_FIXED_ERROR (-1)
static png_fixed_point /* PRIVATE */ static png_fixed_point /* PRIVATE */
png_get_fixed_point(png_structp png_ptr, png_const_bytep buf) png_get_fixed_point(png_structrp png_ptr, png_const_bytep buf)
{ {
png_uint_32 uval = png_get_uint_32(buf); png_uint_32 uval = png_get_uint_32(buf);
@ -114,7 +114,7 @@ png_get_uint_16)(png_const_bytep buf)
/* Read and check the PNG file signature */ /* Read and check the PNG file signature */
void /* PRIVATE */ void /* PRIVATE */
png_read_sig(png_structp png_ptr, png_infop info_ptr) png_read_sig(png_structrp png_ptr, png_inforp info_ptr)
{ {
png_size_t num_checked, num_to_check; png_size_t num_checked, num_to_check;
@ -149,7 +149,7 @@ png_read_sig(png_structp png_ptr, png_infop info_ptr)
* Put the type name into png_ptr->chunk_name, and return the length. * Put the type name into png_ptr->chunk_name, and return the length.
*/ */
png_uint_32 /* PRIVATE */ png_uint_32 /* PRIVATE */
png_read_chunk_header(png_structp png_ptr) png_read_chunk_header(png_structrp png_ptr)
{ {
png_byte buf[8]; png_byte buf[8];
png_uint_32 length; png_uint_32 length;
@ -186,7 +186,7 @@ png_read_chunk_header(png_structp png_ptr)
/* Read data, and (optionally) run it through the CRC. */ /* Read data, and (optionally) run it through the CRC. */
void /* PRIVATE */ void /* PRIVATE */
png_crc_read(png_structp png_ptr, png_bytep buf, png_size_t length) png_crc_read(png_structrp png_ptr, png_bytep buf, png_size_t length)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
@ -201,7 +201,7 @@ png_crc_read(png_structp png_ptr, png_bytep buf, png_size_t length)
* Returns '1' if there was a CRC error, '0' otherwise. * Returns '1' if there was a CRC error, '0' otherwise.
*/ */
int /* PRIVATE */ int /* PRIVATE */
png_crc_finish(png_structp png_ptr, png_uint_32 skip) png_crc_finish(png_structrp png_ptr, png_uint_32 skip)
{ {
png_size_t i; png_size_t i;
png_size_t istop = png_ptr->zbuf_size; png_size_t istop = png_ptr->zbuf_size;
@ -241,7 +241,7 @@ png_crc_finish(png_structp png_ptr, png_uint_32 skip)
* the data it has read thus far. * the data it has read thus far.
*/ */
int /* PRIVATE */ int /* PRIVATE */
png_crc_error(png_structp png_ptr) png_crc_error(png_structrp png_ptr)
{ {
png_byte crc_bytes[4]; png_byte crc_bytes[4];
png_uint_32 crc; png_uint_32 crc;
@ -279,7 +279,7 @@ png_crc_error(png_structp png_ptr)
#ifdef PNG_READ_COMPRESSED_TEXT_SUPPORTED #ifdef PNG_READ_COMPRESSED_TEXT_SUPPORTED
static png_size_t static png_size_t
png_inflate(png_structp png_ptr, png_bytep data, png_size_t size, png_inflate(png_structrp png_ptr, png_bytep data, png_size_t size,
png_bytep output, png_size_t output_size) png_bytep output, png_size_t output_size)
{ {
png_size_t count = 0; png_size_t count = 0;
@ -409,7 +409,7 @@ png_inflate(png_structp png_ptr, png_bytep data, png_size_t size,
* trailing part (the malloc area passed in is freed). * trailing part (the malloc area passed in is freed).
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_decompress_chunk(png_structp png_ptr, int comp_type, png_decompress_chunk(png_structrp png_ptr, int comp_type,
png_size_t chunklength, png_size_t chunklength,
png_size_t prefix_size, png_size_t *newlength) png_size_t prefix_size, png_size_t *newlength)
{ {
@ -522,7 +522,7 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
/* Read and check the IDHR chunk */ /* Read and check the IDHR chunk */
void /* PRIVATE */ void /* PRIVATE */
png_handle_IHDR(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_IHDR(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{ {
png_byte buf[13]; png_byte buf[13];
png_uint_32 width, height; png_uint_32 width, height;
@ -597,7 +597,7 @@ png_handle_IHDR(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
/* Read and check the palette */ /* Read and check the palette */
void /* PRIVATE */ void /* PRIVATE */
png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_PLTE(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{ {
png_color palette[PNG_MAX_PALETTE_LENGTH]; png_color palette[PNG_MAX_PALETTE_LENGTH];
int num, i; int num, i;
@ -745,7 +745,7 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
} }
void /* PRIVATE */ void /* PRIVATE */
png_handle_IEND(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_IEND(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{ {
png_debug(1, "in png_handle_IEND"); png_debug(1, "in png_handle_IEND");
@ -768,7 +768,7 @@ png_handle_IEND(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#ifdef PNG_READ_gAMA_SUPPORTED #ifdef PNG_READ_gAMA_SUPPORTED
void /* PRIVATE */ void /* PRIVATE */
png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_gAMA(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{ {
png_fixed_point igamma; png_fixed_point igamma;
png_byte buf[4]; png_byte buf[4];
@ -848,7 +848,7 @@ png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#ifdef PNG_READ_sBIT_SUPPORTED #ifdef PNG_READ_sBIT_SUPPORTED
void /* PRIVATE */ void /* PRIVATE */
png_handle_sBIT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_sBIT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{ {
png_size_t truelen; png_size_t truelen;
png_byte buf[4]; png_byte buf[4];
@ -921,7 +921,7 @@ png_handle_sBIT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#ifdef PNG_READ_cHRM_SUPPORTED #ifdef PNG_READ_cHRM_SUPPORTED
void /* PRIVATE */ void /* PRIVATE */
png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_cHRM(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{ {
png_byte buf[32]; png_byte buf[32];
png_fixed_point x_white, y_white, x_red, y_red, x_green, y_green, x_blue, png_fixed_point x_white, y_white, x_red, y_red, x_green, y_green, x_blue,
@ -1106,7 +1106,7 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#ifdef PNG_READ_sRGB_SUPPORTED #ifdef PNG_READ_sRGB_SUPPORTED
void /* PRIVATE */ void /* PRIVATE */
png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_sRGB(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{ {
int intent; int intent;
png_byte buf[1]; png_byte buf[1];
@ -1234,7 +1234,7 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#ifdef PNG_READ_iCCP_SUPPORTED #ifdef PNG_READ_iCCP_SUPPORTED
void /* PRIVATE */ void /* PRIVATE */
png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
/* Note: this does not properly handle chunks that are > 64K under DOS */ /* Note: this does not properly handle chunks that are > 64K under DOS */
{ {
png_byte compression_type; png_byte compression_type;
@ -1369,7 +1369,7 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#ifdef PNG_READ_sPLT_SUPPORTED #ifdef PNG_READ_sPLT_SUPPORTED
void /* PRIVATE */ void /* PRIVATE */
png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
/* Note: this does not properly handle chunks that are > 64K under DOS */ /* Note: this does not properly handle chunks that are > 64K under DOS */
{ {
png_bytep entry_start; png_bytep entry_start;
@ -1556,7 +1556,7 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#ifdef PNG_READ_tRNS_SUPPORTED #ifdef PNG_READ_tRNS_SUPPORTED
void /* PRIVATE */ void /* PRIVATE */
png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_tRNS(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{ {
png_byte readbuf[PNG_MAX_PALETTE_LENGTH]; png_byte readbuf[PNG_MAX_PALETTE_LENGTH];
@ -1660,7 +1660,7 @@ png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#ifdef PNG_READ_bKGD_SUPPORTED #ifdef PNG_READ_bKGD_SUPPORTED
void /* PRIVATE */ void /* PRIVATE */
png_handle_bKGD(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_bKGD(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{ {
png_size_t truelen; png_size_t truelen;
png_byte buf[6]; png_byte buf[6];
@ -1766,7 +1766,7 @@ png_handle_bKGD(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#ifdef PNG_READ_hIST_SUPPORTED #ifdef PNG_READ_hIST_SUPPORTED
void /* PRIVATE */ void /* PRIVATE */
png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_hIST(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{ {
unsigned int num, i; unsigned int num, i;
png_uint_16 readbuf[PNG_MAX_PALETTE_LENGTH]; png_uint_16 readbuf[PNG_MAX_PALETTE_LENGTH];
@ -1824,7 +1824,7 @@ png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#ifdef PNG_READ_pHYs_SUPPORTED #ifdef PNG_READ_pHYs_SUPPORTED
void /* PRIVATE */ void /* PRIVATE */
png_handle_pHYs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_pHYs(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{ {
png_byte buf[9]; png_byte buf[9];
png_uint_32 res_x, res_y; png_uint_32 res_x, res_y;
@ -1870,7 +1870,7 @@ png_handle_pHYs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#ifdef PNG_READ_oFFs_SUPPORTED #ifdef PNG_READ_oFFs_SUPPORTED
void /* PRIVATE */ void /* PRIVATE */
png_handle_oFFs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_oFFs(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{ {
png_byte buf[9]; png_byte buf[9];
png_int_32 offset_x, offset_y; png_int_32 offset_x, offset_y;
@ -1917,7 +1917,7 @@ png_handle_oFFs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#ifdef PNG_READ_pCAL_SUPPORTED #ifdef PNG_READ_pCAL_SUPPORTED
/* Read the pCAL chunk (described in the PNG Extensions document) */ /* Read the pCAL chunk (described in the PNG Extensions document) */
void /* PRIVATE */ void /* PRIVATE */
png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_pCAL(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{ {
png_int_32 X0, X1; png_int_32 X0, X1;
png_byte type, nparams; png_byte type, nparams;
@ -2061,7 +2061,7 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#ifdef PNG_READ_sCAL_SUPPORTED #ifdef PNG_READ_sCAL_SUPPORTED
/* Read the sCAL chunk */ /* Read the sCAL chunk */
void /* PRIVATE */ void /* PRIVATE */
png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_sCAL(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{ {
png_size_t slength, i; png_size_t slength, i;
int state; int state;
@ -2165,7 +2165,7 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#ifdef PNG_READ_tIME_SUPPORTED #ifdef PNG_READ_tIME_SUPPORTED
void /* PRIVATE */ void /* PRIVATE */
png_handle_tIME(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_tIME(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{ {
png_byte buf[7]; png_byte buf[7];
png_time mod_time; png_time mod_time;
@ -2211,7 +2211,7 @@ png_handle_tIME(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#ifdef PNG_READ_tEXt_SUPPORTED #ifdef PNG_READ_tEXt_SUPPORTED
/* Note: this does not properly handle chunks that are > 64K under DOS */ /* Note: this does not properly handle chunks that are > 64K under DOS */
void /* PRIVATE */ void /* PRIVATE */
png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_tEXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{ {
png_textp text_ptr; png_textp text_ptr;
png_charp key; png_charp key;
@ -2318,7 +2318,7 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#ifdef PNG_READ_zTXt_SUPPORTED #ifdef PNG_READ_zTXt_SUPPORTED
/* Note: this does not correctly handle chunks that are > 64K under DOS */ /* Note: this does not correctly handle chunks that are > 64K under DOS */
void /* PRIVATE */ void /* PRIVATE */
png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_zTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{ {
png_textp text_ptr; png_textp text_ptr;
png_charp text; png_charp text;
@ -2448,7 +2448,7 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#ifdef PNG_READ_iTXt_SUPPORTED #ifdef PNG_READ_iTXt_SUPPORTED
/* Note: this does not correctly handle chunks that are > 64K under DOS */ /* Note: this does not correctly handle chunks that are > 64K under DOS */
void /* PRIVATE */ void /* PRIVATE */
png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_iTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{ {
png_textp text_ptr; png_textp text_ptr;
png_charp key, lang, text, lang_key; png_charp key, lang, text, lang_key;
@ -2622,7 +2622,7 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
* case it will be saved away to be written out later. * case it will be saved away to be written out later.
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{ {
png_uint_32 skip = 0; png_uint_32 skip = 0;
@ -2758,7 +2758,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_check_chunk_name(png_structp png_ptr, png_uint_32 chunk_name) png_check_chunk_name(png_structrp png_ptr, png_uint_32 chunk_name)
{ {
int i; int i;
@ -2783,7 +2783,7 @@ png_check_chunk_name(png_structp png_ptr, png_uint_32 chunk_name)
* 'display' is false only those pixels present in the pass are filled in. * 'display' is false only those pixels present in the pass are filled in.
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_combine_row(png_const_structp png_ptr, png_bytep dp, int display) png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
{ {
unsigned int pixel_depth = png_ptr->transformed_pixel_depth; unsigned int pixel_depth = png_ptr->transformed_pixel_depth;
png_const_bytep sp = png_ptr->row_buf + 1; png_const_bytep sp = png_ptr->row_buf + 1;
@ -3694,7 +3694,7 @@ static int png_have_hwcap(unsigned cap)
#endif /* __linux__ */ #endif /* __linux__ */
static void static void
png_init_filter_functions_neon(png_structp pp, unsigned int bpp) png_init_filter_functions_neon(png_structrp pp, unsigned int bpp)
{ {
#ifdef __linux__ #ifdef __linux__
if (!png_have_hwcap(HWCAP_NEON)) if (!png_have_hwcap(HWCAP_NEON))
@ -3722,7 +3722,7 @@ png_init_filter_functions_neon(png_structp pp, unsigned int bpp)
#endif /* PNG_ARM_NEON */ #endif /* PNG_ARM_NEON */
static void static void
png_init_filter_functions(png_structp pp) png_init_filter_functions(png_structrp pp)
{ {
unsigned int bpp = (pp->pixel_depth + 7) >> 3; unsigned int bpp = (pp->pixel_depth + 7) >> 3;
@ -3742,7 +3742,7 @@ png_init_filter_functions(png_structp pp)
} }
void /* PRIVATE */ void /* PRIVATE */
png_read_filter_row(png_structp pp, png_row_infop row_info, png_bytep row, png_read_filter_row(png_structrp pp, png_row_infop row_info, png_bytep row,
png_const_bytep prev_row, int filter) png_const_bytep prev_row, int filter)
{ {
if (pp->read_filter[0] == NULL) if (pp->read_filter[0] == NULL)
@ -3753,7 +3753,7 @@ png_read_filter_row(png_structp pp, png_row_infop row_info, png_bytep row,
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
void /* PRIVATE */ void /* PRIVATE */
png_read_finish_row(png_structp png_ptr) png_read_finish_row(png_structrp png_ptr)
{ {
#ifdef PNG_READ_INTERLACING_SUPPORTED #ifdef PNG_READ_INTERLACING_SUPPORTED
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
@ -3885,7 +3885,7 @@ png_read_finish_row(png_structp png_ptr)
#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */ #endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
void /* PRIVATE */ void /* PRIVATE */
png_read_start_row(png_structp png_ptr) png_read_start_row(png_structrp png_ptr)
{ {
#ifdef PNG_READ_INTERLACING_SUPPORTED #ifdef PNG_READ_INTERLACING_SUPPORTED
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */

View File

@ -22,7 +22,7 @@
#ifdef PNG_bKGD_SUPPORTED #ifdef PNG_bKGD_SUPPORTED
void PNGAPI void PNGAPI
png_set_bKGD(png_structp png_ptr, png_infop info_ptr, png_set_bKGD(png_structrp png_ptr, png_inforp info_ptr,
png_const_color_16p background) png_const_color_16p background)
{ {
png_debug1(1, "in %s storage function", "bKGD"); png_debug1(1, "in %s storage function", "bKGD");
@ -37,7 +37,7 @@ png_set_bKGD(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_cHRM_SUPPORTED #ifdef PNG_cHRM_SUPPORTED
void PNGFAPI void PNGFAPI
png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr, png_set_cHRM_fixed(png_structrp png_ptr, png_inforp info_ptr,
png_fixed_point white_x, png_fixed_point white_y, png_fixed_point red_x, png_fixed_point white_x, png_fixed_point white_y, png_fixed_point red_x,
png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y, png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y,
png_fixed_point blue_x, png_fixed_point blue_y) png_fixed_point blue_x, png_fixed_point blue_y)
@ -65,7 +65,7 @@ png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
} }
void PNGFAPI void PNGFAPI
png_set_cHRM_XYZ_fixed(png_structp png_ptr, png_infop info_ptr, png_set_cHRM_XYZ_fixed(png_structrp png_ptr, png_inforp info_ptr,
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_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,
@ -99,7 +99,7 @@ png_set_cHRM_XYZ_fixed(png_structp png_ptr, png_infop info_ptr,
# ifdef PNG_FLOATING_POINT_SUPPORTED # ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI void PNGAPI
png_set_cHRM(png_structp png_ptr, png_infop info_ptr, png_set_cHRM(png_structrp png_ptr, png_inforp info_ptr,
double white_x, double white_y, double red_x, double red_y, 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_x, double green_y, double blue_x, double blue_y)
{ {
@ -115,7 +115,7 @@ png_set_cHRM(png_structp png_ptr, png_infop info_ptr,
} }
void PNGAPI void PNGAPI
png_set_cHRM_XYZ(png_structp png_ptr, png_infop info_ptr, double red_X, png_set_cHRM_XYZ(png_structrp png_ptr, png_inforp info_ptr, double red_X,
double red_Y, double red_Z, double green_X, double green_Y, double green_Z, double red_Y, double red_Z, double green_X, double green_Y, double green_Z,
double blue_X, double blue_Y, double blue_Z) double blue_X, double blue_Y, double blue_Z)
{ {
@ -136,7 +136,7 @@ png_set_cHRM_XYZ(png_structp png_ptr, png_infop info_ptr, double red_X,
#ifdef PNG_gAMA_SUPPORTED #ifdef PNG_gAMA_SUPPORTED
void PNGFAPI void PNGFAPI
png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point png_set_gAMA_fixed(png_structrp png_ptr, png_inforp info_ptr, png_fixed_point
file_gamma) file_gamma)
{ {
png_debug1(1, "in %s storage function", "gAMA"); png_debug1(1, "in %s storage function", "gAMA");
@ -164,7 +164,7 @@ png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
# ifdef PNG_FLOATING_POINT_SUPPORTED # ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI void PNGAPI
png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma) png_set_gAMA(png_structrp png_ptr, png_inforp info_ptr, double file_gamma)
{ {
png_set_gAMA_fixed(png_ptr, info_ptr, png_fixed(png_ptr, file_gamma, png_set_gAMA_fixed(png_ptr, info_ptr, png_fixed(png_ptr, file_gamma,
"png_set_gAMA")); "png_set_gAMA"));
@ -174,7 +174,7 @@ png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma)
#ifdef PNG_hIST_SUPPORTED #ifdef PNG_hIST_SUPPORTED
void PNGAPI void PNGAPI
png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_const_uint_16p hist) png_set_hIST(png_structrp png_ptr, png_inforp info_ptr, png_const_uint_16p hist)
{ {
int i; int i;
@ -216,7 +216,7 @@ png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_const_uint_16p hist)
#endif #endif
void PNGAPI void PNGAPI
png_set_IHDR(png_structp png_ptr, png_infop info_ptr, png_set_IHDR(png_structrp png_ptr, png_inforp info_ptr,
png_uint_32 width, png_uint_32 height, int bit_depth, png_uint_32 width, png_uint_32 height, int bit_depth,
int color_type, int interlace_type, int compression_type, int color_type, int interlace_type, int compression_type,
int filter_type) int filter_type)
@ -266,7 +266,7 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_oFFs_SUPPORTED #ifdef PNG_oFFs_SUPPORTED
void PNGAPI void PNGAPI
png_set_oFFs(png_structp png_ptr, png_infop info_ptr, png_set_oFFs(png_structrp png_ptr, png_inforp info_ptr,
png_int_32 offset_x, png_int_32 offset_y, int unit_type) png_int_32 offset_x, png_int_32 offset_y, int unit_type)
{ {
png_debug1(1, "in %s storage function", "oFFs"); png_debug1(1, "in %s storage function", "oFFs");
@ -283,7 +283,7 @@ png_set_oFFs(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_pCAL_SUPPORTED #ifdef PNG_pCAL_SUPPORTED
void PNGAPI void PNGAPI
png_set_pCAL(png_structp png_ptr, png_infop info_ptr, png_set_pCAL(png_structrp png_ptr, png_inforp info_ptr,
png_const_charp purpose, png_int_32 X0, png_int_32 X1, int type, png_const_charp purpose, png_int_32 X0, png_int_32 X1, int type,
int nparams, png_const_charp units, png_charpp params) int nparams, png_const_charp units, png_charpp params)
{ {
@ -375,7 +375,7 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_sCAL_SUPPORTED #ifdef PNG_sCAL_SUPPORTED
void PNGAPI void PNGAPI
png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr, png_set_sCAL_s(png_structrp png_ptr, png_inforp info_ptr,
int unit, png_const_charp swidth, png_const_charp sheight) int unit, png_const_charp swidth, png_const_charp sheight)
{ {
png_size_t lengthw = 0, lengthh = 0; png_size_t lengthw = 0, lengthh = 0;
@ -438,7 +438,7 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
# ifdef PNG_FLOATING_POINT_SUPPORTED # ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI void PNGAPI
png_set_sCAL(png_structp png_ptr, png_infop info_ptr, int unit, double width, png_set_sCAL(png_structrp png_ptr, png_inforp info_ptr, int unit, double width,
double height) double height)
{ {
png_debug1(1, "in %s storage function", "sCAL"); png_debug1(1, "in %s storage function", "sCAL");
@ -468,7 +468,7 @@ png_set_sCAL(png_structp png_ptr, png_infop info_ptr, int unit, double width,
# ifdef PNG_FIXED_POINT_SUPPORTED # ifdef PNG_FIXED_POINT_SUPPORTED
void PNGAPI void PNGAPI
png_set_sCAL_fixed(png_structp png_ptr, png_infop info_ptr, int unit, png_set_sCAL_fixed(png_structrp png_ptr, png_inforp info_ptr, int unit,
png_fixed_point width, png_fixed_point height) png_fixed_point width, png_fixed_point height)
{ {
png_debug1(1, "in %s storage function", "sCAL"); png_debug1(1, "in %s storage function", "sCAL");
@ -497,7 +497,7 @@ png_set_sCAL_fixed(png_structp png_ptr, png_infop info_ptr, int unit,
#ifdef PNG_pHYs_SUPPORTED #ifdef PNG_pHYs_SUPPORTED
void PNGAPI void PNGAPI
png_set_pHYs(png_structp png_ptr, png_infop info_ptr, png_set_pHYs(png_structrp png_ptr, png_inforp info_ptr,
png_uint_32 res_x, png_uint_32 res_y, int unit_type) png_uint_32 res_x, png_uint_32 res_y, int unit_type)
{ {
png_debug1(1, "in %s storage function", "pHYs"); png_debug1(1, "in %s storage function", "pHYs");
@ -513,7 +513,7 @@ png_set_pHYs(png_structp png_ptr, png_infop info_ptr,
#endif #endif
void PNGAPI void PNGAPI
png_set_PLTE(png_structp png_ptr, png_infop info_ptr, png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr,
png_const_colorp palette, int num_palette) png_const_colorp palette, int num_palette)
{ {
@ -558,7 +558,7 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_sBIT_SUPPORTED #ifdef PNG_sBIT_SUPPORTED
void PNGAPI void PNGAPI
png_set_sBIT(png_structp png_ptr, png_infop info_ptr, png_set_sBIT(png_structrp png_ptr, png_inforp info_ptr,
png_const_color_8p sig_bit) png_const_color_8p sig_bit)
{ {
png_debug1(1, "in %s storage function", "sBIT"); png_debug1(1, "in %s storage function", "sBIT");
@ -573,7 +573,7 @@ png_set_sBIT(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_sRGB_SUPPORTED #ifdef PNG_sRGB_SUPPORTED
void PNGAPI void PNGAPI
png_set_sRGB(png_structp png_ptr, png_infop info_ptr, int srgb_intent) png_set_sRGB(png_structrp png_ptr, png_inforp info_ptr, int srgb_intent)
{ {
png_debug1(1, "in %s storage function", "sRGB"); png_debug1(1, "in %s storage function", "sRGB");
@ -585,7 +585,7 @@ png_set_sRGB(png_structp png_ptr, png_infop info_ptr, int srgb_intent)
} }
void PNGAPI void PNGAPI
png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr, png_set_sRGB_gAMA_and_cHRM(png_structrp png_ptr, png_inforp info_ptr,
int srgb_intent) int srgb_intent)
{ {
png_debug1(1, "in %s storage function", "sRGB_gAMA_and_cHRM"); png_debug1(1, "in %s storage function", "sRGB_gAMA_and_cHRM");
@ -614,7 +614,7 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_iCCP_SUPPORTED #ifdef PNG_iCCP_SUPPORTED
void PNGAPI void PNGAPI
png_set_iCCP(png_structp png_ptr, png_infop info_ptr, png_set_iCCP(png_structrp png_ptr, png_inforp info_ptr,
png_const_charp name, int compression_type, png_const_charp name, int compression_type,
png_const_bytep profile, png_uint_32 proflen) png_const_bytep profile, png_uint_32 proflen)
{ {
@ -665,7 +665,7 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_TEXT_SUPPORTED #ifdef PNG_TEXT_SUPPORTED
void PNGAPI void PNGAPI
png_set_text(png_structp png_ptr, png_infop info_ptr, png_const_textp text_ptr, png_set_text(png_structrp png_ptr, png_inforp info_ptr, png_const_textp text_ptr,
int num_text) int num_text)
{ {
int ret; int ret;
@ -676,7 +676,7 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_const_textp text_ptr,
} }
int /* PRIVATE */ int /* PRIVATE */
png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_set_text_2(png_structrp png_ptr, png_inforp info_ptr,
png_const_textp text_ptr, int num_text) png_const_textp text_ptr, int num_text)
{ {
int i; int i;
@ -856,7 +856,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_tIME_SUPPORTED #ifdef PNG_tIME_SUPPORTED
void PNGAPI void PNGAPI
png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_const_timep mod_time) png_set_tIME(png_structrp png_ptr, png_inforp info_ptr, png_const_timep mod_time)
{ {
png_debug1(1, "in %s storage function", "tIME"); png_debug1(1, "in %s storage function", "tIME");
@ -880,7 +880,7 @@ png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_const_timep mod_time)
#ifdef PNG_tRNS_SUPPORTED #ifdef PNG_tRNS_SUPPORTED
void PNGAPI void PNGAPI
png_set_tRNS(png_structp png_ptr, png_infop info_ptr, png_set_tRNS(png_structrp png_ptr, png_inforp info_ptr,
png_const_bytep trans_alpha, int num_trans, png_const_color_16p trans_color) png_const_bytep trans_alpha, int num_trans, png_const_color_16p trans_color)
{ {
png_debug1(1, "in %s storage function", "tRNS"); png_debug1(1, "in %s storage function", "tRNS");
@ -937,8 +937,8 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_sPLT_SUPPORTED #ifdef PNG_sPLT_SUPPORTED
void PNGAPI void PNGAPI
png_set_sPLT(png_structp png_ptr, png_set_sPLT(png_structrp png_ptr,
png_infop info_ptr, png_const_sPLT_tp entries, int nentries) png_inforp info_ptr, png_const_sPLT_tp entries, int nentries)
/* /*
* entries - array of png_sPLT_t structures * entries - array of png_sPLT_t structures
* to be added to the list of palettes * to be added to the list of palettes
@ -1015,8 +1015,8 @@ png_set_sPLT(png_structp png_ptr,
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
void PNGAPI void PNGAPI
png_set_unknown_chunks(png_structp png_ptr, png_set_unknown_chunks(png_structrp png_ptr,
png_infop info_ptr, png_const_unknown_chunkp unknowns, int num_unknowns) png_inforp info_ptr, png_const_unknown_chunkp unknowns, int num_unknowns)
{ {
png_unknown_chunkp np; png_unknown_chunkp np;
int i; int i;
@ -1080,7 +1080,7 @@ png_set_unknown_chunks(png_structp png_ptr,
} }
void PNGAPI void PNGAPI
png_set_unknown_chunk_location(png_structp png_ptr, png_infop info_ptr, png_set_unknown_chunk_location(png_structrp png_ptr, png_inforp info_ptr,
int chunk, int location) int chunk, int location)
{ {
if (png_ptr != NULL && info_ptr != NULL && chunk >= 0 && chunk < if (png_ptr != NULL && info_ptr != NULL && chunk >= 0 && chunk <
@ -1092,7 +1092,7 @@ png_set_unknown_chunk_location(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_MNG_FEATURES_SUPPORTED #ifdef PNG_MNG_FEATURES_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_permit_mng_features (png_structp png_ptr, png_uint_32 mng_features) png_permit_mng_features (png_structrp png_ptr, png_uint_32 mng_features)
{ {
png_debug(1, "in png_permit_mng_features"); png_debug(1, "in png_permit_mng_features");
@ -1108,7 +1108,7 @@ png_permit_mng_features (png_structp png_ptr, png_uint_32 mng_features)
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
void PNGAPI void PNGAPI
png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_const_bytep png_set_keep_unknown_chunks(png_structrp png_ptr, int keep, png_const_bytep
chunk_list, int num_chunks) chunk_list, int num_chunks)
{ {
png_bytep new_list, p; png_bytep new_list, p;
@ -1162,7 +1162,7 @@ png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_const_bytep
#ifdef PNG_READ_USER_CHUNKS_SUPPORTED #ifdef PNG_READ_USER_CHUNKS_SUPPORTED
void PNGAPI void PNGAPI
png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr, png_set_read_user_chunk_fn(png_structrp png_ptr, png_voidp user_chunk_ptr,
png_user_chunk_ptr read_user_chunk_fn) png_user_chunk_ptr read_user_chunk_fn)
{ {
png_debug(1, "in png_set_read_user_chunk_fn"); png_debug(1, "in png_set_read_user_chunk_fn");
@ -1177,7 +1177,7 @@ png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr,
#ifdef PNG_INFO_IMAGE_SUPPORTED #ifdef PNG_INFO_IMAGE_SUPPORTED
void PNGAPI void PNGAPI
png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers) png_set_rows(png_structrp png_ptr, png_inforp info_ptr, png_bytepp row_pointers)
{ {
png_debug1(1, "in %s storage function", "rows"); png_debug1(1, "in %s storage function", "rows");
@ -1195,7 +1195,7 @@ png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers)
#endif #endif
void PNGAPI void PNGAPI
png_set_compression_buffer_size(png_structp png_ptr, png_size_t size) png_set_compression_buffer_size(png_structrp png_ptr, png_size_t size)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
@ -1223,7 +1223,7 @@ png_set_compression_buffer_size(png_structp png_ptr, png_size_t size)
} }
void PNGAPI void PNGAPI
png_set_invalid(png_const_structp png_ptr, png_infop info_ptr, int mask) png_set_invalid(png_const_structrp png_ptr, png_inforp info_ptr, int mask)
{ {
if (png_ptr && info_ptr) if (png_ptr && info_ptr)
info_ptr->valid &= ~mask; info_ptr->valid &= ~mask;
@ -1234,7 +1234,7 @@ png_set_invalid(png_const_structp png_ptr, png_infop info_ptr, int mask)
#ifdef PNG_SET_USER_LIMITS_SUPPORTED #ifdef PNG_SET_USER_LIMITS_SUPPORTED
/* This function was added to libpng 1.2.6 */ /* This function was added to libpng 1.2.6 */
void PNGAPI void PNGAPI
png_set_user_limits (png_structp png_ptr, png_uint_32 user_width_max, png_set_user_limits (png_structrp png_ptr, png_uint_32 user_width_max,
png_uint_32 user_height_max) png_uint_32 user_height_max)
{ {
/* Images with dimensions larger than these limits will be /* Images with dimensions larger than these limits will be
@ -1250,7 +1250,7 @@ png_set_user_limits (png_structp png_ptr, png_uint_32 user_width_max,
/* This function was added to libpng 1.4.0 */ /* This function was added to libpng 1.4.0 */
void PNGAPI void PNGAPI
png_set_chunk_cache_max (png_structp png_ptr, png_set_chunk_cache_max (png_structrp png_ptr,
png_uint_32 user_chunk_cache_max) png_uint_32 user_chunk_cache_max)
{ {
if (png_ptr) if (png_ptr)
@ -1259,7 +1259,7 @@ png_set_chunk_cache_max (png_structp png_ptr,
/* This function was added to libpng 1.4.1 */ /* This function was added to libpng 1.4.1 */
void PNGAPI void PNGAPI
png_set_chunk_malloc_max (png_structp png_ptr, png_set_chunk_malloc_max (png_structrp png_ptr,
png_alloc_size_t user_chunk_malloc_max) png_alloc_size_t user_chunk_malloc_max)
{ {
if (png_ptr) if (png_ptr)
@ -1270,7 +1270,7 @@ png_set_chunk_malloc_max (png_structp png_ptr,
#ifdef PNG_BENIGN_ERRORS_SUPPORTED #ifdef PNG_BENIGN_ERRORS_SUPPORTED
void PNGAPI void PNGAPI
png_set_benign_errors(png_structp png_ptr, int allowed) png_set_benign_errors(png_structrp png_ptr, int allowed)
{ {
png_debug(1, "in png_set_benign_errors"); png_debug(1, "in png_set_benign_errors");

View File

@ -1,7 +1,7 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers) /* pngtrans.c - transforms the data in a row (used by both readers and writers)
* *
* Last changed in libpng 1.5.4 [July 7, 2011] * Last changed in libpng 1.6.0 [(PENDING RELEASE)]
* Copyright (c) 1998-2011 Glenn Randers-Pehrson * Copyright (c) 1998-2011 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.)
@ -18,7 +18,7 @@
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
/* Turn on BGR-to-RGB mapping */ /* Turn on BGR-to-RGB mapping */
void PNGAPI void PNGAPI
png_set_bgr(png_structp png_ptr) png_set_bgr(png_structrp png_ptr)
{ {
png_debug(1, "in png_set_bgr"); png_debug(1, "in png_set_bgr");
@ -32,7 +32,7 @@ png_set_bgr(png_structp png_ptr)
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
/* Turn on 16 bit byte swapping */ /* Turn on 16 bit byte swapping */
void PNGAPI void PNGAPI
png_set_swap(png_structp png_ptr) png_set_swap(png_structrp png_ptr)
{ {
png_debug(1, "in png_set_swap"); png_debug(1, "in png_set_swap");
@ -47,7 +47,7 @@ png_set_swap(png_structp png_ptr)
#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED) #if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
/* Turn on pixel packing */ /* Turn on pixel packing */
void PNGAPI void PNGAPI
png_set_packing(png_structp png_ptr) png_set_packing(png_structrp png_ptr)
{ {
png_debug(1, "in png_set_packing"); png_debug(1, "in png_set_packing");
@ -65,7 +65,7 @@ png_set_packing(png_structp png_ptr)
#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED) #if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
/* Turn on packed pixel swapping */ /* Turn on packed pixel swapping */
void PNGAPI void PNGAPI
png_set_packswap(png_structp png_ptr) png_set_packswap(png_structrp png_ptr)
{ {
png_debug(1, "in png_set_packswap"); png_debug(1, "in png_set_packswap");
@ -79,7 +79,7 @@ png_set_packswap(png_structp png_ptr)
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
void PNGAPI void PNGAPI
png_set_shift(png_structp png_ptr, png_const_color_8p true_bits) png_set_shift(png_structrp png_ptr, png_const_color_8p true_bits)
{ {
png_debug(1, "in png_set_shift"); png_debug(1, "in png_set_shift");
@ -94,7 +94,7 @@ png_set_shift(png_structp png_ptr, png_const_color_8p true_bits)
#if defined(PNG_READ_INTERLACING_SUPPORTED) || \ #if defined(PNG_READ_INTERLACING_SUPPORTED) || \
defined(PNG_WRITE_INTERLACING_SUPPORTED) defined(PNG_WRITE_INTERLACING_SUPPORTED)
int PNGAPI int PNGAPI
png_set_interlace_handling(png_structp png_ptr) png_set_interlace_handling(png_structrp png_ptr)
{ {
png_debug(1, "in png_set_interlace handling"); png_debug(1, "in png_set_interlace handling");
@ -115,7 +115,7 @@ png_set_interlace_handling(png_structp png_ptr)
* that don't like bytes as parameters. * that don't like bytes as parameters.
*/ */
void PNGAPI void PNGAPI
png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc) png_set_filler(png_structrp png_ptr, png_uint_32 filler, int filler_loc)
{ {
png_debug(1, "in png_set_filler"); png_debug(1, "in png_set_filler");
@ -152,7 +152,7 @@ png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
/* Added to libpng-1.2.7 */ /* Added to libpng-1.2.7 */
void PNGAPI void PNGAPI
png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc) png_set_add_alpha(png_structrp png_ptr, png_uint_32 filler, int filler_loc)
{ {
png_debug(1, "in png_set_add_alpha"); png_debug(1, "in png_set_add_alpha");
@ -168,7 +168,7 @@ png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc)
#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \ #if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \
defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
void PNGAPI void PNGAPI
png_set_swap_alpha(png_structp png_ptr) png_set_swap_alpha(png_structrp png_ptr)
{ {
png_debug(1, "in png_set_swap_alpha"); png_debug(1, "in png_set_swap_alpha");
@ -182,7 +182,7 @@ png_set_swap_alpha(png_structp png_ptr)
#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \ #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \
defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
void PNGAPI void PNGAPI
png_set_invert_alpha(png_structp png_ptr) png_set_invert_alpha(png_structrp png_ptr)
{ {
png_debug(1, "in png_set_invert_alpha"); png_debug(1, "in png_set_invert_alpha");
@ -195,7 +195,7 @@ png_set_invert_alpha(png_structp png_ptr)
#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
void PNGAPI void PNGAPI
png_set_invert_mono(png_structp png_ptr) png_set_invert_mono(png_structrp png_ptr)
{ {
png_debug(1, "in png_set_invert_mono"); png_debug(1, "in png_set_invert_mono");
@ -623,7 +623,7 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED #ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
void PNGAPI void PNGAPI
png_set_user_transform_info(png_structp png_ptr, png_voidp png_set_user_transform_info(png_structrp png_ptr, png_voidp
user_transform_ptr, int user_transform_depth, int user_transform_channels) user_transform_ptr, int user_transform_depth, int user_transform_channels)
{ {
png_debug(1, "in png_set_user_transform_info"); png_debug(1, "in png_set_user_transform_info");
@ -643,7 +643,7 @@ png_set_user_transform_info(png_structp png_ptr, png_voidp
*/ */
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED #ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
png_voidp PNGAPI png_voidp PNGAPI
png_get_user_transform_ptr(png_const_structp png_ptr) png_get_user_transform_ptr(png_const_structrp png_ptr)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
return (NULL); return (NULL);
@ -654,7 +654,7 @@ png_get_user_transform_ptr(png_const_structp png_ptr)
#ifdef PNG_USER_TRANSFORM_INFO_SUPPORTED #ifdef PNG_USER_TRANSFORM_INFO_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_current_row_number(png_const_structp png_ptr) png_get_current_row_number(png_const_structrp png_ptr)
{ {
/* See the comments in png.h - this is the sub-image row when reading and /* See the comments in png.h - this is the sub-image row when reading and
* interlaced image. * interlaced image.
@ -666,7 +666,7 @@ png_get_current_row_number(png_const_structp png_ptr)
} }
png_byte PNGAPI png_byte PNGAPI
png_get_current_pass_number(png_const_structp png_ptr) png_get_current_pass_number(png_const_structrp png_ptr)
{ {
if (png_ptr != NULL) if (png_ptr != NULL)
return png_ptr->pass; return png_ptr->pass;

View File

@ -30,7 +30,7 @@
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_write_data(png_structp png_ptr, png_const_bytep data, png_size_t length) png_write_data(png_structrp png_ptr, png_const_bytep data, png_size_t length)
{ {
/* NOTE: write_data_fn must not change the buffer! */ /* NOTE: write_data_fn must not change the buffer! */
if (png_ptr->write_data_fn != NULL ) if (png_ptr->write_data_fn != NULL )
@ -68,7 +68,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
*/ */
#ifdef PNG_WRITE_FLUSH_SUPPORTED #ifdef PNG_WRITE_FLUSH_SUPPORTED
void /* PRIVATE */ void /* PRIVATE */
png_flush(png_structp png_ptr) png_flush(png_structrp png_ptr)
{ {
if (png_ptr->output_flush_fn != NULL) if (png_ptr->output_flush_fn != NULL)
(*(png_ptr->output_flush_fn))(png_ptr); (*(png_ptr->output_flush_fn))(png_ptr);
@ -119,7 +119,7 @@ png_default_flush(png_structp png_ptr)
* *FILE structure. * *FILE structure.
*/ */
void PNGAPI void PNGAPI
png_set_write_fn(png_structp png_ptr, png_voidp io_ptr, png_set_write_fn(png_structrp png_ptr, png_voidp io_ptr,
png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn) png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)

View File

@ -28,7 +28,7 @@
* them in png_write_end(), and compressing them. * them in png_write_end(), and compressing them.
*/ */
void PNGAPI void PNGAPI
png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr) png_write_info_before_PLTE(png_structrp png_ptr, png_inforp info_ptr)
{ {
png_debug(1, "in png_write_info_before_PLTE"); png_debug(1, "in png_write_info_before_PLTE");
@ -122,7 +122,7 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
} }
void PNGAPI void PNGAPI
png_write_info(png_structp png_ptr, png_infop info_ptr) png_write_info(png_structrp png_ptr, png_inforp info_ptr)
{ {
#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED) #if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
int i; int i;
@ -298,7 +298,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
* comments, I suggest writing them here, and compressing them. * comments, I suggest writing them here, and compressing them.
*/ */
void PNGAPI void PNGAPI
png_write_end(png_structp png_ptr, png_infop info_ptr) png_write_end(png_structrp png_ptr, png_inforp info_ptr)
{ {
png_debug(1, "in png_write_end"); png_debug(1, "in png_write_end");
@ -450,7 +450,7 @@ png_create_write_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn),PNG_ALLOCATED) png_error_ptr error_fn, png_error_ptr warn_fn),PNG_ALLOCATED)
{ {
#ifndef PNG_USER_MEM_SUPPORTED #ifndef PNG_USER_MEM_SUPPORTED
png_structp png_ptr = png_create_png_struct(user_png_ver, error_ptr, png_structrp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
error_fn, warn_fn, NULL, NULL, NULL); error_fn, warn_fn, NULL, NULL, NULL);
#else #else
return png_create_write_struct_2(user_png_ver, error_ptr, error_fn, return png_create_write_struct_2(user_png_ver, error_ptr, error_fn,
@ -463,7 +463,7 @@ png_create_write_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
png_malloc_ptr malloc_fn, png_free_ptr free_fn),PNG_ALLOCATED) png_malloc_ptr malloc_fn, png_free_ptr free_fn),PNG_ALLOCATED)
{ {
png_structp png_ptr = png_create_png_struct(user_png_ver, error_ptr, png_structrp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
error_fn, warn_fn, mem_ptr, malloc_fn, free_fn); error_fn, warn_fn, mem_ptr, malloc_fn, free_fn);
#endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_USER_MEM_SUPPORTED */
@ -486,7 +486,7 @@ png_create_write_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
* "write" the image seven times. * "write" the image seven times.
*/ */
void PNGAPI void PNGAPI
png_write_rows(png_structp png_ptr, png_bytepp row, png_write_rows(png_structrp png_ptr, png_bytepp row,
png_uint_32 num_rows) png_uint_32 num_rows)
{ {
png_uint_32 i; /* row counter */ png_uint_32 i; /* row counter */
@ -508,7 +508,7 @@ png_write_rows(png_structp png_ptr, png_bytepp row,
* if you are writing an interlaced image. * if you are writing an interlaced image.
*/ */
void PNGAPI void PNGAPI
png_write_image(png_structp png_ptr, png_bytepp image) png_write_image(png_structrp png_ptr, png_bytepp image)
{ {
png_uint_32 i; /* row index */ png_uint_32 i; /* row index */
int pass, num_pass; /* pass variables */ int pass, num_pass; /* pass variables */
@ -540,7 +540,7 @@ png_write_image(png_structp png_ptr, png_bytepp image)
/* Called by user to write a row of image data */ /* Called by user to write a row of image data */
void PNGAPI void PNGAPI
png_write_row(png_structp png_ptr, png_const_bytep row) png_write_row(png_structrp png_ptr, png_const_bytep row)
{ {
/* 1.5.6: moved from png_struct to be a local structure: */ /* 1.5.6: moved from png_struct to be a local structure: */
png_row_info row_info; png_row_info row_info;
@ -741,7 +741,7 @@ png_write_row(png_structp png_ptr, png_const_bytep row)
#ifdef PNG_WRITE_FLUSH_SUPPORTED #ifdef PNG_WRITE_FLUSH_SUPPORTED
/* Set the automatic flush interval or 0 to turn flushing off */ /* Set the automatic flush interval or 0 to turn flushing off */
void PNGAPI void PNGAPI
png_set_flush(png_structp png_ptr, int nrows) png_set_flush(png_structrp png_ptr, int nrows)
{ {
png_debug(1, "in png_set_flush"); png_debug(1, "in png_set_flush");
@ -753,7 +753,7 @@ png_set_flush(png_structp png_ptr, int nrows)
/* Flush the current output buffers now */ /* Flush the current output buffers now */
void PNGAPI void PNGAPI
png_write_flush(png_structp png_ptr) png_write_flush(png_structrp png_ptr)
{ {
int wrote_IDAT; int wrote_IDAT;
@ -805,12 +805,12 @@ png_write_flush(png_structp png_ptr)
#endif /* PNG_WRITE_FLUSH_SUPPORTED */ #endif /* PNG_WRITE_FLUSH_SUPPORTED */
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED #ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
static void png_reset_filter_heuristics(png_structp png_ptr); /* forward decl */ static void png_reset_filter_heuristics(png_structrp png_ptr); /* forward decl */
#endif #endif
/* Free any memory used in png_ptr struct without freeing the struct itself. */ /* Free any memory used in png_ptr struct without freeing the struct itself. */
static void static void
png_write_destroy(png_structp png_ptr) png_write_destroy(png_structrp png_ptr)
{ {
png_debug(1, "in png_write_destroy"); png_debug(1, "in png_write_destroy");
@ -860,7 +860,7 @@ png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)
if (png_ptr_ptr != NULL) if (png_ptr_ptr != NULL)
{ {
png_structp png_ptr = *png_ptr_ptr; png_structrp png_ptr = *png_ptr_ptr;
if (png_ptr != NULL) /* added in libpng 1.6.0 */ if (png_ptr != NULL) /* added in libpng 1.6.0 */
{ {
@ -875,7 +875,7 @@ png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)
/* Allow the application to select one or more row filters to use. */ /* Allow the application to select one or more row filters to use. */
void PNGAPI void PNGAPI
png_set_filter(png_structp png_ptr, int method, int filters) png_set_filter(png_structrp png_ptr, int method, int filters)
{ {
png_debug(1, "in png_set_filter"); png_debug(1, "in png_set_filter");
@ -1010,7 +1010,7 @@ png_set_filter(png_structp png_ptr, int method, int filters)
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* GRR 970116 */ #ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* GRR 970116 */
/* Convenience reset API. */ /* Convenience reset API. */
static void static void
png_reset_filter_heuristics(png_structp png_ptr) png_reset_filter_heuristics(png_structrp png_ptr)
{ {
/* Clear out any old values in the 'weights' - this must be done because if /* Clear out any old values in the 'weights' - this must be done because if
* the app calls set_filter_heuristics multiple times with different * the app calls set_filter_heuristics multiple times with different
@ -1043,7 +1043,7 @@ png_reset_filter_heuristics(png_structp png_ptr)
} }
static int static int
png_init_filter_heuristics(png_structp png_ptr, int heuristic_method, png_init_filter_heuristics(png_structrp png_ptr, int heuristic_method,
int num_weights) int num_weights)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
@ -1126,7 +1126,7 @@ png_init_filter_heuristics(png_structp png_ptr, int heuristic_method,
/* Provide floating and fixed point APIs */ /* Provide floating and fixed point APIs */
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI void PNGAPI
png_set_filter_heuristics(png_structp png_ptr, int heuristic_method, png_set_filter_heuristics(png_structrp png_ptr, int heuristic_method,
int num_weights, png_const_doublep filter_weights, int num_weights, png_const_doublep filter_weights,
png_const_doublep filter_costs) png_const_doublep filter_costs)
{ {
@ -1181,7 +1181,7 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
#ifdef PNG_FIXED_POINT_SUPPORTED #ifdef PNG_FIXED_POINT_SUPPORTED
void PNGAPI void PNGAPI
png_set_filter_heuristics_fixed(png_structp png_ptr, int heuristic_method, png_set_filter_heuristics_fixed(png_structrp png_ptr, int heuristic_method,
int num_weights, png_const_fixed_point_p filter_weights, int num_weights, png_const_fixed_point_p filter_weights,
png_const_fixed_point_p filter_costs) png_const_fixed_point_p filter_costs)
{ {
@ -1247,7 +1247,7 @@ png_set_filter_heuristics_fixed(png_structp png_ptr, int heuristic_method,
#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */ #endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */
void PNGAPI void PNGAPI
png_set_compression_level(png_structp png_ptr, int level) png_set_compression_level(png_structrp png_ptr, int level)
{ {
png_debug(1, "in png_set_compression_level"); png_debug(1, "in png_set_compression_level");
@ -1259,7 +1259,7 @@ png_set_compression_level(png_structp png_ptr, int level)
} }
void PNGAPI void PNGAPI
png_set_compression_mem_level(png_structp png_ptr, int mem_level) png_set_compression_mem_level(png_structrp png_ptr, int mem_level)
{ {
png_debug(1, "in png_set_compression_mem_level"); png_debug(1, "in png_set_compression_mem_level");
@ -1271,7 +1271,7 @@ png_set_compression_mem_level(png_structp png_ptr, int mem_level)
} }
void PNGAPI void PNGAPI
png_set_compression_strategy(png_structp png_ptr, int strategy) png_set_compression_strategy(png_structrp png_ptr, int strategy)
{ {
png_debug(1, "in png_set_compression_strategy"); png_debug(1, "in png_set_compression_strategy");
@ -1286,7 +1286,7 @@ png_set_compression_strategy(png_structp png_ptr, int strategy)
* smaller value of window_bits if it can do so safely. * smaller value of window_bits if it can do so safely.
*/ */
void PNGAPI void PNGAPI
png_set_compression_window_bits(png_structp png_ptr, int window_bits) png_set_compression_window_bits(png_structrp png_ptr, int window_bits)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
@ -1311,7 +1311,7 @@ png_set_compression_window_bits(png_structp png_ptr, int window_bits)
} }
void PNGAPI void PNGAPI
png_set_compression_method(png_structp png_ptr, int method) png_set_compression_method(png_structrp png_ptr, int method)
{ {
png_debug(1, "in png_set_compression_method"); png_debug(1, "in png_set_compression_method");
@ -1328,7 +1328,7 @@ png_set_compression_method(png_structp png_ptr, int method)
/* The following were added to libpng-1.5.4 */ /* The following were added to libpng-1.5.4 */
#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED #ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
void PNGAPI void PNGAPI
png_set_text_compression_level(png_structp png_ptr, int level) png_set_text_compression_level(png_structrp png_ptr, int level)
{ {
png_debug(1, "in png_set_text_compression_level"); png_debug(1, "in png_set_text_compression_level");
@ -1340,7 +1340,7 @@ png_set_text_compression_level(png_structp png_ptr, int level)
} }
void PNGAPI void PNGAPI
png_set_text_compression_mem_level(png_structp png_ptr, int mem_level) png_set_text_compression_mem_level(png_structrp png_ptr, int mem_level)
{ {
png_debug(1, "in png_set_text_compression_mem_level"); png_debug(1, "in png_set_text_compression_mem_level");
@ -1352,7 +1352,7 @@ png_set_text_compression_mem_level(png_structp png_ptr, int mem_level)
} }
void PNGAPI void PNGAPI
png_set_text_compression_strategy(png_structp png_ptr, int strategy) png_set_text_compression_strategy(png_structrp png_ptr, int strategy)
{ {
png_debug(1, "in png_set_text_compression_strategy"); png_debug(1, "in png_set_text_compression_strategy");
@ -1367,7 +1367,7 @@ png_set_text_compression_strategy(png_structp png_ptr, int strategy)
* smaller value of window_bits if it can do so safely. * smaller value of window_bits if it can do so safely.
*/ */
void PNGAPI void PNGAPI
png_set_text_compression_window_bits(png_structp png_ptr, int window_bits) png_set_text_compression_window_bits(png_structrp png_ptr, int window_bits)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
@ -1392,7 +1392,7 @@ png_set_text_compression_window_bits(png_structp png_ptr, int window_bits)
} }
void PNGAPI void PNGAPI
png_set_text_compression_method(png_structp png_ptr, int method) png_set_text_compression_method(png_structrp png_ptr, int method)
{ {
png_debug(1, "in png_set_text_compression_method"); png_debug(1, "in png_set_text_compression_method");
@ -1409,7 +1409,7 @@ png_set_text_compression_method(png_structp png_ptr, int method)
/* end of API added to libpng-1.5.4 */ /* end of API added to libpng-1.5.4 */
void PNGAPI void PNGAPI
png_set_write_status_fn(png_structp png_ptr, png_write_status_ptr write_row_fn) png_set_write_status_fn(png_structrp png_ptr, png_write_status_ptr write_row_fn)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
@ -1419,7 +1419,7 @@ png_set_write_status_fn(png_structp png_ptr, png_write_status_ptr write_row_fn)
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED #ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
void PNGAPI void PNGAPI
png_set_write_user_transform_fn(png_structp png_ptr, png_user_transform_ptr png_set_write_user_transform_fn(png_structrp png_ptr, png_user_transform_ptr
write_user_transform_fn) write_user_transform_fn)
{ {
png_debug(1, "in png_set_write_user_transform_fn"); png_debug(1, "in png_set_write_user_transform_fn");
@ -1435,7 +1435,7 @@ png_set_write_user_transform_fn(png_structp png_ptr, png_user_transform_ptr
#ifdef PNG_INFO_IMAGE_SUPPORTED #ifdef PNG_INFO_IMAGE_SUPPORTED
void PNGAPI void PNGAPI
png_write_png(png_structp png_ptr, png_infop info_ptr, png_write_png(png_structrp png_ptr, png_inforp info_ptr,
int transforms, voidp params) int transforms, voidp params)
{ {
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
@ -1585,7 +1585,7 @@ png_write_image_16bit(png_voidp argument)
png_image_write_control *display = png_voidcast(png_image_write_control*, png_image_write_control *display = png_voidcast(png_image_write_control*,
argument); argument);
png_imagep image = display->image; png_imagep image = display->image;
png_structp png_ptr = image->opaque->png_ptr; png_structrp png_ptr = image->opaque->png_ptr;
png_const_uint_16p input_row = png_voidcast(png_const_uint_16p, png_const_uint_16p input_row = png_voidcast(png_const_uint_16p,
display->first_row); display->first_row);
@ -1689,7 +1689,7 @@ png_write_image_8bit(png_voidp argument)
png_image_write_control *display = png_voidcast(png_image_write_control*, png_image_write_control *display = png_voidcast(png_image_write_control*,
argument); argument);
png_imagep image = display->image; png_imagep image = display->image;
png_structp png_ptr = image->opaque->png_ptr; png_structrp png_ptr = image->opaque->png_ptr;
png_const_uint_16p input_row = png_voidcast(png_const_uint_16p, png_const_uint_16p input_row = png_voidcast(png_const_uint_16p,
display->first_row); display->first_row);
@ -1826,8 +1826,8 @@ png_image_write_main(png_voidp argument)
png_image_write_control *display = png_voidcast(png_image_write_control*, png_image_write_control *display = png_voidcast(png_image_write_control*,
argument); argument);
png_imagep image = display->image; png_imagep image = display->image;
png_structp png_ptr = image->opaque->png_ptr; png_structrp png_ptr = image->opaque->png_ptr;
png_infop info_ptr = image->opaque->info_ptr; png_inforp info_ptr = image->opaque->info_ptr;
png_uint_32 format = image->format; png_uint_32 format = image->format;
int linear = (format & PNG_FORMAT_FLAG_LINEAR) != 0; /* input */ int linear = (format & PNG_FORMAT_FLAG_LINEAR) != 0; /* input */

View File

@ -1,7 +1,7 @@
/* pngwtran.c - transforms the data in a row for PNG writers /* pngwtran.c - transforms the data in a row for PNG writers
* *
* Last changed in libpng 1.5.6 [November 3, 2011] * Last changed in libpng 1.6.0 [(PENDING RELEASE)]
* Copyright (c) 1998-2011 Glenn Randers-Pehrson * Copyright (c) 1998-2011 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.)
@ -20,7 +20,7 @@
* transformations is significant. * transformations is significant.
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_do_write_transformations(png_structp png_ptr, png_row_infop row_info) png_do_write_transformations(png_structrp png_ptr, png_row_infop row_info)
{ {
png_debug(1, "in png_do_write_transformations"); png_debug(1, "in png_do_write_transformations");

View File

@ -1,7 +1,7 @@
/* pngwutil.c - utilities to write a PNG file /* pngwutil.c - utilities to write a PNG file
* *
* Last changed in libpng 1.5.6 [November 3, 2011] * Last changed in libpng 1.6.0 [(PENDING RELEASE)]
* Copyright (c) 1998-2011 Glenn Randers-Pehrson * Copyright (c) 1998-2011 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.)
@ -65,7 +65,7 @@ png_save_uint_16(png_bytep buf, unsigned int i)
* bytes have already been written. * bytes have already been written.
*/ */
void PNGAPI void PNGAPI
png_write_sig(png_structp png_ptr) png_write_sig(png_structrp png_ptr)
{ {
png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10}; png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
@ -87,7 +87,7 @@ png_write_sig(png_structp png_ptr)
* passing in png_write_chunk_data(). * passing in png_write_chunk_data().
*/ */
static void static void
png_write_chunk_header(png_structp png_ptr, png_uint_32 chunk_name, png_write_chunk_header(png_structrp png_ptr, png_uint_32 chunk_name,
png_uint_32 length) png_uint_32 length)
{ {
png_byte buf[8]; png_byte buf[8];
@ -129,7 +129,7 @@ png_write_chunk_header(png_structp png_ptr, png_uint_32 chunk_name,
} }
void PNGAPI void PNGAPI
png_write_chunk_start(png_structp png_ptr, png_const_bytep chunk_string, png_write_chunk_start(png_structrp png_ptr, png_const_bytep chunk_string,
png_uint_32 length) png_uint_32 length)
{ {
png_write_chunk_header(png_ptr, PNG_CHUNK_FROM_STRING(chunk_string), length); png_write_chunk_header(png_ptr, PNG_CHUNK_FROM_STRING(chunk_string), length);
@ -141,7 +141,7 @@ png_write_chunk_start(png_structp png_ptr, png_const_bytep chunk_string,
* given to png_write_chunk_header(). * given to png_write_chunk_header().
*/ */
void PNGAPI void PNGAPI
png_write_chunk_data(png_structp png_ptr, png_const_bytep data, png_write_chunk_data(png_structrp png_ptr, png_const_bytep data,
png_size_t length) png_size_t length)
{ {
/* Write the data, and run the CRC over it */ /* Write the data, and run the CRC over it */
@ -161,7 +161,7 @@ png_write_chunk_data(png_structp png_ptr, png_const_bytep data,
/* Finish a chunk started with png_write_chunk_header(). */ /* Finish a chunk started with png_write_chunk_header(). */
void PNGAPI void PNGAPI
png_write_chunk_end(png_structp png_ptr) png_write_chunk_end(png_structrp png_ptr)
{ {
png_byte buf[4]; png_byte buf[4];
@ -190,7 +190,7 @@ png_write_chunk_end(png_structp png_ptr)
* functions instead. * functions instead.
*/ */
static void static void
png_write_complete_chunk(png_structp png_ptr, png_uint_32 chunk_name, png_write_complete_chunk(png_structrp png_ptr, png_uint_32 chunk_name,
png_const_bytep data, png_size_t length) png_const_bytep data, png_size_t length)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
@ -207,7 +207,7 @@ png_write_complete_chunk(png_structp png_ptr, png_uint_32 chunk_name,
/* This is the API that calls the internal function above. */ /* This is the API that calls the internal function above. */
void PNGAPI void PNGAPI
png_write_chunk(png_structp png_ptr, png_const_bytep chunk_string, png_write_chunk(png_structrp png_ptr, png_const_bytep chunk_string,
png_const_bytep data, png_size_t length) png_const_bytep data, png_size_t length)
{ {
png_write_complete_chunk(png_ptr, PNG_CHUNK_FROM_STRING(chunk_string), data, png_write_complete_chunk(png_ptr, PNG_CHUNK_FROM_STRING(chunk_string), data,
@ -216,7 +216,7 @@ png_write_chunk(png_structp png_ptr, png_const_bytep chunk_string,
/* Initialize the compressor for the appropriate type of compression. */ /* Initialize the compressor for the appropriate type of compression. */
static void static void
png_zlib_claim(png_structp png_ptr, png_uint_32 state) png_zlib_claim(png_structrp png_ptr, png_uint_32 state)
{ {
if (!(png_ptr->zlib_state & PNG_ZLIB_IN_USE)) if (!(png_ptr->zlib_state & PNG_ZLIB_IN_USE))
{ {
@ -305,7 +305,7 @@ png_zlib_claim(png_structp png_ptr, png_uint_32 state)
* error but will not fail. * error but will not fail.
*/ */
static void static void
png_zlib_release(png_structp png_ptr) png_zlib_release(png_structrp png_ptr)
{ {
if (png_ptr->zlib_state & PNG_ZLIB_IN_USE) if (png_ptr->zlib_state & PNG_ZLIB_IN_USE)
{ {
@ -374,7 +374,7 @@ typedef struct
/* Compress given text into storage in the png_ptr structure */ /* Compress given text into storage in the png_ptr structure */
static int /* PRIVATE */ static int /* PRIVATE */
png_text_compress(png_structp png_ptr, png_text_compress(png_structrp png_ptr,
png_const_charp text, png_size_t text_len, int compression, png_const_charp text, png_size_t text_len, int compression,
compression_state *comp) compression_state *comp)
{ {
@ -569,7 +569,7 @@ png_text_compress(png_structp png_ptr,
/* Ship the compressed text out via chunk writes */ /* Ship the compressed text out via chunk writes */
static void /* PRIVATE */ static void /* PRIVATE */
png_write_compressed_data_out(png_structp png_ptr, compression_state *comp) png_write_compressed_data_out(png_structrp png_ptr, compression_state *comp)
{ {
int i; int i;
@ -673,7 +673,7 @@ png_write_compressed_data_out(png_structp png_ptr, compression_state *comp)
* information being correct. * information being correct.
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height, png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height,
int bit_depth, int color_type, int compression_type, int filter_type, int bit_depth, int color_type, int compression_type, int filter_type,
int interlace_type) int interlace_type)
{ {
@ -892,7 +892,7 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
* structure. * structure.
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_write_PLTE(png_structp png_ptr, png_const_colorp palette, png_write_PLTE(png_structrp png_ptr, png_const_colorp palette,
png_uint_32 num_pal) png_uint_32 num_pal)
{ {
png_uint_32 i; png_uint_32 i;
@ -962,7 +962,7 @@ png_write_PLTE(png_structp png_ptr, png_const_colorp palette,
/* Write an IDAT chunk */ /* Write an IDAT chunk */
void /* PRIVATE */ void /* PRIVATE */
png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length) png_write_IDAT(png_structrp png_ptr, png_bytep data, png_size_t length)
{ {
png_debug(1, "in png_write_IDAT"); png_debug(1, "in png_write_IDAT");
@ -1047,7 +1047,7 @@ png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length)
/* Write an IEND chunk */ /* Write an IEND chunk */
void /* PRIVATE */ void /* PRIVATE */
png_write_IEND(png_structp png_ptr) png_write_IEND(png_structrp png_ptr)
{ {
png_debug(1, "in png_write_IEND"); png_debug(1, "in png_write_IEND");
@ -1058,7 +1058,7 @@ png_write_IEND(png_structp png_ptr)
#ifdef PNG_WRITE_gAMA_SUPPORTED #ifdef PNG_WRITE_gAMA_SUPPORTED
/* Write a gAMA chunk */ /* Write a gAMA chunk */
void /* PRIVATE */ void /* PRIVATE */
png_write_gAMA_fixed(png_structp png_ptr, png_fixed_point file_gamma) png_write_gAMA_fixed(png_structrp png_ptr, png_fixed_point file_gamma)
{ {
png_byte buf[4]; png_byte buf[4];
@ -1073,7 +1073,7 @@ png_write_gAMA_fixed(png_structp png_ptr, png_fixed_point file_gamma)
#ifdef PNG_WRITE_sRGB_SUPPORTED #ifdef PNG_WRITE_sRGB_SUPPORTED
/* Write a sRGB chunk */ /* Write a sRGB chunk */
void /* PRIVATE */ void /* PRIVATE */
png_write_sRGB(png_structp png_ptr, int srgb_intent) png_write_sRGB(png_structrp png_ptr, int srgb_intent)
{ {
png_byte buf[1]; png_byte buf[1];
@ -1091,7 +1091,7 @@ png_write_sRGB(png_structp png_ptr, int srgb_intent)
#ifdef PNG_WRITE_iCCP_SUPPORTED #ifdef PNG_WRITE_iCCP_SUPPORTED
/* Write an iCCP chunk */ /* Write an iCCP chunk */
void /* PRIVATE */ void /* PRIVATE */
png_write_iCCP(png_structp png_ptr, png_const_charp name, int compression_type, png_write_iCCP(png_structrp png_ptr, png_const_charp name, int compression_type,
png_const_charp profile, int profile_len) png_const_charp profile, int profile_len)
{ {
png_size_t name_len; png_size_t name_len;
@ -1176,7 +1176,7 @@ png_write_iCCP(png_structp png_ptr, png_const_charp name, int compression_type,
#ifdef PNG_WRITE_sPLT_SUPPORTED #ifdef PNG_WRITE_sPLT_SUPPORTED
/* Write a sPLT chunk */ /* Write a sPLT chunk */
void /* PRIVATE */ void /* PRIVATE */
png_write_sPLT(png_structp png_ptr, png_const_sPLT_tp spalette) png_write_sPLT(png_structrp png_ptr, png_const_sPLT_tp spalette)
{ {
png_size_t name_len; png_size_t name_len;
png_charp new_name; png_charp new_name;
@ -1260,7 +1260,7 @@ png_write_sPLT(png_structp png_ptr, png_const_sPLT_tp spalette)
#ifdef PNG_WRITE_sBIT_SUPPORTED #ifdef PNG_WRITE_sBIT_SUPPORTED
/* Write the sBIT chunk */ /* Write the sBIT chunk */
void /* PRIVATE */ void /* PRIVATE */
png_write_sBIT(png_structp png_ptr, png_const_color_8p sbit, int color_type) png_write_sBIT(png_structrp png_ptr, png_const_color_8p sbit, int color_type)
{ {
png_byte buf[4]; png_byte buf[4];
png_size_t size; png_size_t size;
@ -1319,7 +1319,7 @@ png_write_sBIT(png_structp png_ptr, png_const_color_8p sbit, int color_type)
#ifdef PNG_WRITE_cHRM_SUPPORTED #ifdef PNG_WRITE_cHRM_SUPPORTED
/* Write the cHRM chunk */ /* Write the cHRM chunk */
void /* PRIVATE */ void /* PRIVATE */
png_write_cHRM_fixed(png_structp png_ptr, png_fixed_point white_x, png_write_cHRM_fixed(png_structrp png_ptr, png_fixed_point white_x,
png_fixed_point white_y, png_fixed_point red_x, png_fixed_point red_y, png_fixed_point white_y, png_fixed_point red_x, png_fixed_point red_y,
png_fixed_point green_x, png_fixed_point green_y, png_fixed_point blue_x, png_fixed_point green_x, png_fixed_point green_y, png_fixed_point blue_x,
png_fixed_point blue_y) png_fixed_point blue_y)
@ -1354,7 +1354,7 @@ png_write_cHRM_fixed(png_structp png_ptr, png_fixed_point white_x,
#ifdef PNG_WRITE_tRNS_SUPPORTED #ifdef PNG_WRITE_tRNS_SUPPORTED
/* Write the tRNS chunk */ /* Write the tRNS chunk */
void /* PRIVATE */ void /* PRIVATE */
png_write_tRNS(png_structp png_ptr, png_const_bytep trans_alpha, png_write_tRNS(png_structrp png_ptr, png_const_bytep trans_alpha,
png_const_color_16p tran, int num_trans, int color_type) png_const_color_16p tran, int num_trans, int color_type)
{ {
png_byte buf[6]; png_byte buf[6];
@ -1418,7 +1418,7 @@ png_write_tRNS(png_structp png_ptr, png_const_bytep trans_alpha,
#ifdef PNG_WRITE_bKGD_SUPPORTED #ifdef PNG_WRITE_bKGD_SUPPORTED
/* Write the background chunk */ /* Write the background chunk */
void /* PRIVATE */ void /* PRIVATE */
png_write_bKGD(png_structp png_ptr, png_const_color_16p back, int color_type) png_write_bKGD(png_structrp png_ptr, png_const_color_16p back, int color_type)
{ {
png_byte buf[6]; png_byte buf[6];
@ -1480,7 +1480,7 @@ png_write_bKGD(png_structp png_ptr, png_const_color_16p back, int color_type)
#ifdef PNG_WRITE_hIST_SUPPORTED #ifdef PNG_WRITE_hIST_SUPPORTED
/* Write the histogram */ /* Write the histogram */
void /* PRIVATE */ void /* PRIVATE */
png_write_hIST(png_structp png_ptr, png_const_uint_16p hist, int num_hist) png_write_hIST(png_structrp png_ptr, png_const_uint_16p hist, int num_hist)
{ {
int i; int i;
png_byte buf[3]; png_byte buf[3];
@ -1521,7 +1521,7 @@ png_write_hIST(png_structp png_ptr, png_const_uint_16p hist, int num_hist)
* static keywords without having to have duplicate copies of the strings. * static keywords without having to have duplicate copies of the strings.
*/ */
png_size_t /* PRIVATE */ png_size_t /* PRIVATE */
png_check_keyword(png_structp png_ptr, png_const_charp key, png_charpp new_key) png_check_keyword(png_structrp png_ptr, png_const_charp key, png_charpp new_key)
{ {
png_size_t key_len; png_size_t key_len;
png_const_charp ikp; png_const_charp ikp;
@ -1643,7 +1643,7 @@ png_check_keyword(png_structp png_ptr, png_const_charp key, png_charpp new_key)
#ifdef PNG_WRITE_tEXt_SUPPORTED #ifdef PNG_WRITE_tEXt_SUPPORTED
/* Write a tEXt chunk */ /* Write a tEXt chunk */
void /* PRIVATE */ void /* PRIVATE */
png_write_tEXt(png_structp png_ptr, png_const_charp key, png_const_charp text, png_write_tEXt(png_structrp png_ptr, png_const_charp key, png_const_charp text,
png_size_t text_len) png_size_t text_len)
{ {
png_size_t key_len; png_size_t key_len;
@ -1684,7 +1684,7 @@ png_write_tEXt(png_structp png_ptr, png_const_charp key, png_const_charp text,
#ifdef PNG_WRITE_zTXt_SUPPORTED #ifdef PNG_WRITE_zTXt_SUPPORTED
/* Write a compressed text chunk */ /* Write a compressed text chunk */
void /* PRIVATE */ void /* PRIVATE */
png_write_zTXt(png_structp png_ptr, png_const_charp key, png_const_charp text, png_write_zTXt(png_structrp png_ptr, png_const_charp key, png_const_charp text,
png_size_t text_len, int compression) png_size_t text_len, int compression)
{ {
png_size_t key_len; png_size_t key_len;
@ -1746,7 +1746,7 @@ png_write_zTXt(png_structp png_ptr, png_const_charp key, png_const_charp text,
#ifdef PNG_WRITE_iTXt_SUPPORTED #ifdef PNG_WRITE_iTXt_SUPPORTED
/* Write an iTXt chunk */ /* Write an iTXt chunk */
void /* PRIVATE */ void /* PRIVATE */
png_write_iTXt(png_structp png_ptr, int compression, png_const_charp key, png_write_iTXt(png_structrp png_ptr, int compression, png_const_charp key,
png_const_charp lang, png_const_charp lang_key, png_const_charp text) png_const_charp lang, png_const_charp lang_key, png_const_charp text)
{ {
png_size_t lang_len, key_len, lang_key_len, text_len; png_size_t lang_len, key_len, lang_key_len, text_len;
@ -1839,7 +1839,7 @@ png_write_iTXt(png_structp png_ptr, int compression, png_const_charp key,
#ifdef PNG_WRITE_oFFs_SUPPORTED #ifdef PNG_WRITE_oFFs_SUPPORTED
/* Write the oFFs chunk */ /* Write the oFFs chunk */
void /* PRIVATE */ void /* PRIVATE */
png_write_oFFs(png_structp png_ptr, png_int_32 x_offset, png_int_32 y_offset, png_write_oFFs(png_structrp png_ptr, png_int_32 x_offset, png_int_32 y_offset,
int unit_type) int unit_type)
{ {
png_byte buf[9]; png_byte buf[9];
@ -1859,7 +1859,7 @@ png_write_oFFs(png_structp png_ptr, png_int_32 x_offset, png_int_32 y_offset,
#ifdef PNG_WRITE_pCAL_SUPPORTED #ifdef PNG_WRITE_pCAL_SUPPORTED
/* Write the pCAL chunk (described in the PNG extensions document) */ /* Write the pCAL chunk (described in the PNG extensions document) */
void /* PRIVATE */ void /* PRIVATE */
png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0, png_write_pCAL(png_structrp png_ptr, png_charp purpose, png_int_32 X0,
png_int_32 X1, int type, int nparams, png_const_charp units, png_int_32 X1, int type, int nparams, png_const_charp units,
png_charpp params) png_charpp params)
{ {
@ -1919,7 +1919,7 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0,
#ifdef PNG_WRITE_sCAL_SUPPORTED #ifdef PNG_WRITE_sCAL_SUPPORTED
/* Write the sCAL chunk */ /* Write the sCAL chunk */
void /* PRIVATE */ void /* PRIVATE */
png_write_sCAL_s(png_structp png_ptr, int unit, png_const_charp width, png_write_sCAL_s(png_structrp png_ptr, int unit, png_const_charp width,
png_const_charp height) png_const_charp height)
{ {
png_byte buf[64]; png_byte buf[64];
@ -1949,7 +1949,7 @@ png_write_sCAL_s(png_structp png_ptr, int unit, png_const_charp width,
#ifdef PNG_WRITE_pHYs_SUPPORTED #ifdef PNG_WRITE_pHYs_SUPPORTED
/* Write the pHYs chunk */ /* Write the pHYs chunk */
void /* PRIVATE */ void /* PRIVATE */
png_write_pHYs(png_structp png_ptr, png_uint_32 x_pixels_per_unit, png_write_pHYs(png_structrp png_ptr, png_uint_32 x_pixels_per_unit,
png_uint_32 y_pixels_per_unit, png_uint_32 y_pixels_per_unit,
int unit_type) int unit_type)
{ {
@ -1973,7 +1973,7 @@ png_write_pHYs(png_structp png_ptr, png_uint_32 x_pixels_per_unit,
* or png_convert_from_time_t(), or fill in the structure yourself. * or png_convert_from_time_t(), or fill in the structure yourself.
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_write_tIME(png_structp png_ptr, png_const_timep mod_time) png_write_tIME(png_structrp png_ptr, png_const_timep mod_time)
{ {
png_byte buf[7]; png_byte buf[7];
@ -2000,7 +2000,7 @@ png_write_tIME(png_structp png_ptr, png_const_timep mod_time)
/* Initializes the row writing capability of libpng */ /* Initializes the row writing capability of libpng */
void /* PRIVATE */ void /* PRIVATE */
png_write_start_row(png_structp png_ptr) png_write_start_row(png_structrp png_ptr)
{ {
#ifdef PNG_WRITE_INTERLACING_SUPPORTED #ifdef PNG_WRITE_INTERLACING_SUPPORTED
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
@ -2110,7 +2110,7 @@ png_write_start_row(png_structp png_ptr)
/* Internal use only. Called when finished processing a row of data. */ /* Internal use only. Called when finished processing a row of data. */
void /* PRIVATE */ void /* PRIVATE */
png_write_finish_row(png_structp png_ptr) png_write_finish_row(png_structrp png_ptr)
{ {
#ifdef PNG_WRITE_INTERLACING_SUPPORTED #ifdef PNG_WRITE_INTERLACING_SUPPORTED
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
@ -2414,7 +2414,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
* been specified by the application, and then writes the row out with the * been specified by the application, and then writes the row out with the
* chosen filter. * chosen filter.
*/ */
static void png_write_filtered_row(png_structp png_ptr, png_bytep filtered_row, static void png_write_filtered_row(png_structrp png_ptr, png_bytep filtered_row,
png_size_t row_bytes); png_size_t row_bytes);
#define PNG_MAXSUM (((png_uint_32)(-1)) >> 1) #define PNG_MAXSUM (((png_uint_32)(-1)) >> 1)
@ -2422,7 +2422,7 @@ static void png_write_filtered_row(png_structp png_ptr, png_bytep filtered_row,
#define PNG_LOMASK ((png_uint_32)0xffffL) #define PNG_LOMASK ((png_uint_32)0xffffL)
#define PNG_HIMASK ((png_uint_32)(~PNG_LOMASK >> PNG_HISHIFT)) #define PNG_HIMASK ((png_uint_32)(~PNG_LOMASK >> PNG_HISHIFT))
void /* PRIVATE */ void /* PRIVATE */
png_write_find_filter(png_structp png_ptr, png_row_infop row_info) png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
{ {
png_bytep best_row; png_bytep best_row;
#ifdef PNG_WRITE_FILTER_SUPPORTED #ifdef PNG_WRITE_FILTER_SUPPORTED
@ -3093,7 +3093,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
/* Do the actual writing of a previously filtered row. */ /* Do the actual writing of a previously filtered row. */
static void static void
png_write_filtered_row(png_structp png_ptr, png_bytep filtered_row, png_write_filtered_row(png_structrp png_ptr, png_bytep filtered_row,
png_size_t avail/*includes filter byte*/) png_size_t avail/*includes filter byte*/)
{ {
png_debug(1, "in png_write_filtered_row"); png_debug(1, "in png_write_filtered_row");