[master] Converted all PNG_NO_* tests to PNG_*_SUPPORTED

everywhere except pngconf.h as in libpng-1.4.0beta78 and later.
This commit is contained in:
Glenn Randers-Pehrson 2009-10-18 14:30:53 -05:00
parent 4560de58f4
commit 5d398a69fb
12 changed files with 68 additions and 64 deletions

View File

@ -70,6 +70,8 @@ version 1.2.41beta05 [October 17, 2009]
version 1.2.41beta06 [October 18, 2009]
Restored PNG_USE_LOCAL_ARRAYS code in pngread.c that was inadvertently
deleted in libpng-1.2.41beta05.
Converted all PNG_NO_* tests to PNG_*_SUPPORTED everywhere except pngconf.h
as in libpng-1.4.0beta78 and later.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net

View File

@ -2500,6 +2500,8 @@ version 1.2.41beta05 [October 17, 2009]
version 1.2.41beta06 [October 18, 2009]
Restored PNG_USE_LOCAL_ARRAYS code in pngread.c that was inadvertently
deleted in libpng-1.2.41beta05.
Converted all PNG_NO_* tests to PNG_*_SUPPORTED everywhere except pngconf.h
as in libpng-1.4.0beta78 and later.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

6
png.c
View File

@ -641,7 +641,7 @@ png_get_io_ptr(png_structp png_ptr)
}
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#ifndef PNG_NO_STDIO
#ifdef PNG_STDIO_SUPPORTED
/* Initialize the default input/output functions for the PNG file. If you
* use your own read or write routines, you can call either png_set_read_fn()
* or png_set_write_fn() instead of png_init_io(). If you have defined
@ -823,7 +823,7 @@ png_convert_size(size_t size)
/* Added at libpng version 1.2.34 and 1.4.0 (moved from pngset.c) */
#ifdef PNG_cHRM_SUPPORTED
#ifndef PNG_NO_CHECK_cHRM
#ifdef PNG_CHECK_cHRM_SUPPORTED
/*
* Multiply two 32-bit numbers, V1 and V2, using 32-bit
@ -934,7 +934,7 @@ png_check_cHRM_fixed(png_structp png_ptr,
return ret;
}
#endif /* PNG_NO_CHECK_cHRM */
#endif /* PNG_CHECK_cHRM_SUPPORTED */
#endif /* PNG_cHRM_SUPPORTED */
void /* PRIVATE */

View File

@ -1,7 +1,7 @@
/* pngerror.c - stub functions for i/o and memory allocation
*
* Last changed in libpng 1.2.37 [June 4, 2009]
* Last changed in libpng 1.2.41 [October 18, 2009]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -23,7 +23,7 @@
static void /* PRIVATE */
png_default_error PNGARG((png_structp png_ptr,
png_const_charp error_message));
#ifndef PNG_NO_WARNINGS
#ifdef PNG_WARNINGS_SUPPORTED
static void /* PRIVATE */
png_default_warning PNGARG((png_structp png_ptr,
png_const_charp warning_message));
@ -34,7 +34,7 @@ png_default_warning PNGARG((png_structp png_ptr,
* you should supply a replacement error function and use png_set_error_fn()
* to replace the error function at run-time.
*/
#ifndef PNG_NO_ERROR_TEXT
#ifdef PNG_ERROR_TEXT_SUPPORTED
void PNGAPI
png_error(png_structp png_ptr, png_const_charp error_message)
{
@ -95,7 +95,7 @@ png_err(png_structp png_ptr)
}
#endif /* PNG_ERROR_TEXT_SUPPORTED */
#ifndef PNG_NO_WARNINGS
#ifdef PNG_WARNINGS_SUPPORTED
/* This function is called whenever there is a non-fatal error. This function
* should not be changed. If there is a need to handle warnings differently,
* you should supply a replacement warning function and use
@ -141,7 +141,7 @@ static PNG_CONST char png_digit[16] = {
};
#define PNG_MAX_ERROR_TEXT 64
#if !defined(PNG_NO_WARNINGS) || !defined(PNG_NO_ERROR_TEXT)
#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED)
static void /* PRIVATE */
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
error_message)
@ -191,7 +191,7 @@ png_chunk_error(png_structp png_ptr, png_const_charp error_message)
#endif /* PNG_READ_SUPPORTED */
#endif /* PNG_WARNINGS_SUPPORTED || PNG_ERROR_TEXT_SUPPORTED */
#ifndef PNG_NO_WARNINGS
#ifdef PNG_WARNINGS_SUPPORTED
void PNGAPI
png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
{
@ -215,7 +215,7 @@ png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
static void /* PRIVATE */
png_default_error(png_structp png_ptr, png_const_charp error_message)
{
#ifndef PNG_NO_CONSOLE_IO
#ifdef PNG_CONSOLE_IO_SUPPORTED
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
if (*error_message == '#')
{
@ -266,12 +266,12 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
#else
PNG_ABORT();
#endif
#ifdef PNG_NO_CONSOLE_IO
#ifndef PNG_CONSOLE_IO_SUPPORTED
error_message = error_message; /* Make compiler happy */
#endif
}
#ifndef PNG_NO_WARNINGS
#ifdef PNG_WARNINGS_SUPPORTED
/* This function is called when there is a warning, but the library thinks
* it can continue anyway. Replacement functions don't have to do anything
* here if you don't want them to. In the default configuration, png_ptr is
@ -280,7 +280,7 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
static void /* PRIVATE */
png_default_warning(png_structp png_ptr, png_const_charp warning_message)
{
#ifndef PNG_NO_CONSOLE_IO
#ifdef PNG_CONSOLE_IO_SUPPORTED
# ifdef PNG_ERROR_NUMBERS_SUPPORTED
if (*warning_message == '#')
{

View File

@ -120,7 +120,7 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
(user_png_ver[0] == '1' && user_png_ver[2] != png_libpng_ver[2]) ||
(user_png_ver[0] == '0' && user_png_ver[2] < '9'))
{
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
#if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE)
char msg[80];
if (user_png_ver)
{
@ -204,7 +204,7 @@ png_read_init_2(png_structp png_ptr, png_const_charp user_png_ver,
/* We only come here via pre-1.0.12-compiled applications */
if (png_ptr == NULL)
return;
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
#if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE)
if (png_sizeof(png_struct) > png_struct_size ||
png_sizeof(png_info) > png_info_size)
{
@ -326,7 +326,7 @@ png_read_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
png_set_read_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL);
}
#ifndef PNG_NO_SEQUENTIAL_READ
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
/* Read the information before the actual image data. This has been
* changed in v0.90 to allow reading a file that already has the magic
* bytes read from the stream. You can tell libpng how many bytes have
@ -560,7 +560,7 @@ png_read_update_info(png_structp png_ptr, png_infop info_ptr)
png_read_transform_info(png_ptr, info_ptr);
}
#ifndef PNG_NO_SEQUENTIAL_READ
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
/* Initialize palette, background, etc, after transformations
* are set, but before any reading takes place. This allows
* the user to obtain a gamma-corrected palette, for example.
@ -578,7 +578,7 @@ png_start_read_image(png_structp png_ptr)
}
#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
#ifndef PNG_NO_SEQUENTIAL_READ
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
void PNGAPI
png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
{
@ -810,7 +810,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
}
#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
#ifndef PNG_NO_SEQUENTIAL_READ
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
/* Read one or more rows of image data. If the image is interlaced,
* and png_set_interlace_handling() has been called, the rows need to
* contain the contents of the rows from the previous pass. If the
@ -874,7 +874,7 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
}
#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
#ifndef PNG_NO_SEQUENTIAL_READ
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
/* Read the entire image. If the image has an alpha channel or a tRNS
* chunk, and you have called png_handle_alpha()[*], you will need to
* initialize the image to the current image that PNG will be overlaying.
@ -924,7 +924,7 @@ png_read_image(png_structp png_ptr, png_bytepp image)
}
#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
#ifndef PNG_NO_SEQUENTIAL_READ
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
/* Read the end of the PNG file. Will not read past the end of the
* file, will verify the end is accurate, and will read any comments
* or time information at the end of the file, if info is not NULL.
@ -1331,7 +1331,7 @@ png_set_read_status_fn(png_structp png_ptr, png_read_status_ptr read_row_fn)
}
#ifndef PNG_NO_SEQUENTIAL_READ
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
#ifdef PNG_INFO_IMAGE_SUPPORTED
void PNGAPI
png_read_png(png_structp png_ptr, png_infop info_ptr,

View File

@ -39,7 +39,7 @@ png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
png_error(png_ptr, "Call to NULL read function");
}
#ifndef PNG_NO_STDIO
#ifdef PNG_STDIO_SUPPORTED
/* This is the function that does the actual reading of data. If you are
* not reading from a standard C stream, you should create a replacement
* read_data function and use it at run time with png_set_read_fn(), rather
@ -152,7 +152,7 @@ png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
return;
png_ptr->io_ptr = io_ptr;
#ifndef PNG_NO_STDIO
#ifdef PNG_STDIO_SUPPORTED
if (read_data_fn != NULL)
png_ptr->read_data_fn = read_data_fn;
else

View File

@ -331,7 +331,7 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
}
if (ret != Z_STREAM_END)
{
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
#if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE)
char umsg[52];
if (ret == Z_BUF_ERROR)
@ -378,7 +378,7 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
}
else /* if (comp_type != PNG_COMPRESSION_TYPE_BASE) */
{
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
#if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE)
char umsg[50];
png_snprintf(umsg, 50, "Unknown zTXt compression type %d", comp_type);
@ -473,7 +473,7 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
png_color palette[PNG_MAX_PALETTE_LENGTH];
int num, i;
#ifndef PNG_NO_POINTER_INDEXING
#ifdef PNG_POINTER_INDEXING_SUPPORTED
png_colorp pal_ptr;
#endif
@ -526,7 +526,7 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
num = (int)length / 3;
#ifndef PNG_NO_POINTER_INDEXING
#ifdef PNG_POINTER_INDEXING_SUPPORTED
for (i = 0, pal_ptr = palette; i < num; i++, pal_ptr++)
{
png_byte buf[3];
@ -692,7 +692,7 @@ png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
png_warning(png_ptr,
"Ignoring incorrect gAMA value when sRGB is also present");
#ifndef PNG_NO_CONSOLE_IO
#ifdef PNG_CONSOLE_IO_SUPPORTED
fprintf(stderr, "gamma = (%d/100000)", (int)igamma);
#endif
return;
@ -872,7 +872,7 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
png_warning(png_ptr,
"Ignoring incorrect cHRM value when sRGB is also present");
#ifndef PNG_NO_CONSOLE_IO
#ifdef PNG_CONSOLE_IO_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
fprintf(stderr, "wx=%f, wy=%f, rx=%f, ry=%f\n",
white_x, white_y, red_x, red_y);
@ -964,7 +964,7 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
png_warning(png_ptr,
"Ignoring incorrect gAMA value when sRGB is also present");
#ifndef PNG_NO_CONSOLE_IO
#ifdef PNG_CONSOLE_IO_SUPPORTED
# ifdef PNG_FIXED_POINT_SUPPORTED
fprintf(stderr, "incorrect gamma=(%d/100000)\n",
(int)png_ptr->int_gamma);
@ -1127,7 +1127,7 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
png_bytep entry_start;
png_sPLT_t new_palette;
#ifndef PNG_NO_POINTER_INDEXING
#ifdef PNG_POINTER_INDEXING_SUPPORTED
png_sPLT_entryp pp;
#endif
int data_length, entry_size, i;
@ -1210,7 +1210,7 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
return;
}
#ifndef PNG_NO_POINTER_INDEXING
#ifdef PNG_POINTER_INDEXING_SUPPORTED
for (i = 0; i < new_palette.nentries; i++)
{
pp = new_palette.entries + i;
@ -2909,7 +2909,7 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
}
}
#ifndef PNG_NO_SEQUENTIAL_READ
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
void /* PRIVATE */
png_read_finish_row(png_structp png_ptr)
{
@ -3039,7 +3039,7 @@ png_read_finish_row(png_structp png_ptr)
png_ptr->mode |= PNG_AFTER_IDAT;
}
#endif /* PNG_NO_SEQUENTIAL_READ */
#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
void /* PRIVATE */
png_read_start_row(png_structp png_ptr)

View File

@ -80,7 +80,7 @@ png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
if (png_ptr == NULL || info_ptr == NULL)
return;
#ifndef PNG_NO_CHECK_cHRM
#ifdef PNG_CHECK_cHRM_SUPPORTED
if (png_check_cHRM_fixed(png_ptr,
white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y))
#endif

View File

@ -54,7 +54,7 @@
# define FCLOSE(file) fclose(file)
#endif
#ifdef PNG_NO_STDIO
#ifndef PNG_STDIO_SUPPORTED
# ifdef _WIN32_WCE
typedef HANDLE png_FILE_p;
# else
@ -297,7 +297,7 @@ count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data)
static int wrote_question = 0;
#ifdef PNG_NO_STDIO
#ifndef PNG_STDIO_SUPPORTED
/* START of code to validate stdio-free compilation */
/* These copies of the default read/write functions come from pngrio.c and
* pngwio.c. They allow "don't include stdio" testing of the library.
@ -742,7 +742,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_create_read_struct(PNG_LIBPNG_VER_STRING, png_voidp_NULL,
png_error_ptr_NULL, png_error_ptr_NULL);
#endif
#ifdef PNG_NO_STDIO
#ifndef PNG_STDIO_SUPPORTED
png_set_error_fn(read_ptr, (png_voidp)inname, pngtest_error,
pngtest_warning);
#endif
@ -767,7 +767,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_create_write_struct(PNG_LIBPNG_VER_STRING, png_voidp_NULL,
png_error_ptr_NULL, png_error_ptr_NULL);
#endif
#ifdef PNG_NO_STDIO
#ifndef PNG_STDIO_SUPPORTED
png_set_error_fn(write_ptr, (png_voidp)inname, pngtest_error,
pngtest_warning);
#endif
@ -829,7 +829,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif
png_debug(0, "Initializing input and output streams");
#ifndef PNG_NO_STDIO
#ifdef PNG_STDIO_SUPPORTED
png_init_io(read_ptr, fpin);
# ifdef PNG_WRITE_SUPPORTED
png_init_io(write_ptr, fpout);

View File

@ -38,7 +38,7 @@ png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
png_error(png_ptr, "Call to NULL write function");
}
#ifndef PNG_NO_STDIO
#ifdef PNG_STDIO_SUPPORTED
/* This is the function that does the actual writing of data. If you are
* not writing to a standard C stream, you should create a replacement
* write_data function and use it at run time with png_set_write_fn(), rather
@ -137,7 +137,7 @@ png_flush(png_structp png_ptr)
(*(png_ptr->output_flush_fn))(png_ptr);
}
#ifndef PNG_NO_STDIO
#ifdef PNG_STDIO_SUPPORTED
void PNGAPI
png_default_flush(png_structp png_ptr)
{
@ -192,7 +192,7 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
png_ptr->io_ptr = io_ptr;
#ifndef PNG_NO_STDIO
#ifdef PNG_STDIO_SUPPORTED
if (write_data_fn != NULL)
png_ptr->write_data_fn = write_data_fn;
@ -203,7 +203,7 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
#endif
#ifdef PNG_WRITE_FLUSH_SUPPORTED
#ifndef PNG_NO_STDIO
#ifdef PNG_STDIO_SUPPORTED
if (output_flush_fn != NULL)
png_ptr->output_flush_fn = output_flush_fn;

View File

@ -189,7 +189,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
#ifdef PNG_sCAL_SUPPORTED
if (info_ptr->valid & PNG_INFO_sCAL)
#ifdef PNG_WRITE_sCAL_SUPPORTED
#if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO)
#if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_STDIO_SUPPORTED)
png_write_sCAL(png_ptr, (int)info_ptr->scal_unit,
info_ptr->scal_pixel_width, info_ptr->scal_pixel_height);
#else /* !FLOATING_POINT */
@ -546,7 +546,7 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
(user_png_ver[0] == '1' && user_png_ver[2] != png_libpng_ver[2]) ||
(user_png_ver[0] == '0' && user_png_ver[2] < '9'))
{
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
#if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE)
char msg[80];
if (user_png_ver)
{
@ -615,7 +615,7 @@ png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver,
{
/* We only come here via pre-1.0.12-compiled applications */
if (png_ptr == NULL) return;
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
#if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE)
if (png_sizeof(png_struct) > png_struct_size ||
png_sizeof(png_info) > png_info_size)
{
@ -1123,7 +1123,7 @@ png_write_destroy(png_structp png_ptr)
/* Free our memory. png_free checks NULL for us. */
png_free(png_ptr, png_ptr->zbuf);
png_free(png_ptr, png_ptr->row_buf);
#ifndef PNG_NO_WRITE_FILTER
#ifdef PNG_WRITE_FILTER_SUPPORTED
png_free(png_ptr, png_ptr->prev_row);
png_free(png_ptr, png_ptr->sub_row);
png_free(png_ptr, png_ptr->up_row);
@ -1186,14 +1186,14 @@ png_set_filter(png_structp png_ptr, int method, int filters)
{
switch (filters & (PNG_ALL_FILTERS | 0x07))
{
#ifndef PNG_NO_WRITE_FILTER
#ifdef PNG_WRITE_FILTER_SUPPORTED
case 5:
case 6:
case 7: png_warning(png_ptr, "Unknown row filter for method 0");
#endif /* PNG_WRITE_FILTER_SUPPORTED */
case PNG_FILTER_VALUE_NONE:
png_ptr->do_filter = PNG_FILTER_NONE; break;
#ifndef PNG_NO_WRITE_FILTER
#ifdef PNG_WRITE_FILTER_SUPPORTED
case PNG_FILTER_VALUE_SUB:
png_ptr->do_filter = PNG_FILTER_SUB; break;
case PNG_FILTER_VALUE_UP:
@ -1219,7 +1219,7 @@ png_set_filter(png_structp png_ptr, int method, int filters)
*/
if (png_ptr->row_buf != NULL)
{
#ifndef PNG_NO_WRITE_FILTER
#ifdef PNG_WRITE_FILTER_SUPPORTED
if ((png_ptr->do_filter & PNG_FILTER_SUB) && png_ptr->sub_row == NULL)
{
png_ptr->sub_row = (png_bytep)png_malloc(png_ptr,

View File

@ -192,7 +192,7 @@ png_text_compress(png_structp png_ptr,
if (compression >= PNG_TEXT_COMPRESSION_LAST)
{
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
#if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE)
char msg[50];
png_snprintf(msg, 50, "Unknown compression type %d", compression);
png_warning(png_ptr, msg);
@ -607,7 +607,7 @@ png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal)
png_write_chunk_start(png_ptr, (png_bytep)png_PLTE,
(png_uint_32)(num_pal * 3));
#ifndef PNG_NO_POINTER_INDEXING
#ifdef PNG_POINTER_INDEXING_SUPPORTED
for (i = 0, pal_ptr = palette; i < num_pal; i++, pal_ptr++)
{
buf[0] = pal_ptr->red;
@ -853,7 +853,7 @@ png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette)
int entry_size = (spalette->depth == 8 ? 6 : 10);
int palette_size = entry_size * spalette->nentries;
png_sPLT_entryp ep;
#ifdef PNG_NO_POINTER_INDEXING
#ifndef PNG_POINTER_INDEXING_SUPPORTED
int i;
#endif
@ -870,7 +870,7 @@ png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette)
png_write_chunk_data(png_ptr, (png_bytep)&spalette->depth, (png_size_t)1);
/* Loop through each palette entry, writing appropriately */
#ifndef PNG_NO_POINTER_INDEXING
#ifdef PNG_POINTER_INDEXING_SUPPORTED
for (ep = spalette->entries; ep<spalette->entries + spalette->nentries; ep++)
{
if (spalette->depth == 8)
@ -1004,7 +1004,7 @@ png_write_cHRM(png_structp png_ptr, double white_x, double white_y,
int_blue_x = (png_uint_32)(blue_x * 100000.0 + 0.5);
int_blue_y = (png_uint_32)(blue_y * 100000.0 + 0.5);
#ifndef PNG_NO_CHECK_cHRM
#ifdef PNG_CHECK_cHRM_SUPPORTED
if (png_check_cHRM_fixed(png_ptr, int_white_x, int_white_y,
int_red_x, int_red_y, int_green_x, int_green_y, int_blue_x, int_blue_y))
#endif
@ -1042,7 +1042,7 @@ png_write_cHRM_fixed(png_structp png_ptr, png_fixed_point white_x,
png_debug(1, "in png_write_cHRM");
/* Each value is saved in 1/100,000ths */
#ifndef PNG_NO_CHECK_cHRM
#ifdef PNG_CHECK_cHRM_SUPPORTED
if (png_check_cHRM_fixed(png_ptr, white_x, white_y, red_x, red_y,
green_x, green_y, blue_x, blue_y))
#endif
@ -1253,7 +1253,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
if ((png_byte)*kp < 0x20 ||
((png_byte)*kp > 0x7E && (png_byte)*kp < 0xA1))
{
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
#if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE)
char msg[40];
png_snprintf(msg, 40,
@ -1618,7 +1618,7 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0,
#ifdef PNG_WRITE_sCAL_SUPPORTED
/* Write the sCAL chunk */
#if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO)
#if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_STDIO_SUPPORTED)
void /* PRIVATE */
png_write_sCAL(png_structp png_ptr, int unit, double width, double height)
{
@ -1780,7 +1780,7 @@ png_write_start_row(png_structp png_ptr)
(png_uint_32)buf_size);
png_ptr->row_buf[0] = PNG_FILTER_VALUE_NONE;
#ifndef PNG_NO_WRITE_FILTER
#ifdef PNG_WRITE_FILTER_SUPPORTED
/* Set up filtering buffer, if using this filter */
if (png_ptr->do_filter & PNG_FILTER_SUB)
{
@ -2140,7 +2140,7 @@ void /* PRIVATE */
png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
{
png_bytep best_row;
#ifndef PNG_NO_WRITE_FILTER
#ifdef PNG_WRITE_FILTER_SUPPORTED
png_bytep prev_row, row_buf;
png_uint_32 mins, bpp;
png_byte filter_to_do = png_ptr->do_filter;
@ -2157,7 +2157,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
prev_row = png_ptr->prev_row;
#endif
best_row = png_ptr->row_buf;
#ifndef PNG_NO_WRITE_FILTER
#ifdef PNG_WRITE_FILTER_SUPPORTED
row_buf = best_row;
mins = PNG_MAXSUM;
@ -2738,7 +2738,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
png_write_filtered_row(png_ptr, best_row);
#ifndef PNG_NO_WRITE_FILTER
#ifdef PNG_WRITE_FILTER_SUPPORTED
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
/* Save the type of filter we picked this time for future calculations */
if (png_ptr->num_prev_filters > 0)