[master] Ported cosmetic changes in pngpread.c and pngrtran.c

from libpng-1.4.0beta87.
This commit is contained in:
Glenn Randers-Pehrson 2009-10-12 13:41:14 -05:00
parent 77a9f59487
commit 51a32d64d8
2 changed files with 66 additions and 64 deletions

View File

@ -70,7 +70,7 @@ png_process_some_data(png_structp png_ptr, png_infop info_ptr)
break;
}
#if defined(PNG_READ_tEXt_SUPPORTED)
#ifdef PNG_READ_tEXt_SUPPORTED
case PNG_READ_tEXt_MODE:
{
png_push_read_tEXt(png_ptr, info_ptr);
@ -78,7 +78,7 @@ png_process_some_data(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_zTXt_SUPPORTED)
#ifdef PNG_READ_zTXt_SUPPORTED
case PNG_READ_zTXt_MODE:
{
png_push_read_zTXt(png_ptr, info_ptr);
@ -86,7 +86,7 @@ png_process_some_data(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_iTXt_SUPPORTED)
#ifdef PNG_READ_iTXt_SUPPORTED
case PNG_READ_iTXt_MODE:
{
png_push_read_iTXt(png_ptr, info_ptr);
@ -154,58 +154,59 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
PNG_CONST PNG_IDAT;
PNG_CONST PNG_IEND;
PNG_CONST PNG_PLTE;
#if defined(PNG_READ_bKGD_SUPPORTED)
#ifdef PNG_READ_bKGD_SUPPORTED
PNG_CONST PNG_bKGD;
#endif
#if defined(PNG_READ_cHRM_SUPPORTED)
#ifdef PNG_READ_cHRM_SUPPORTED
PNG_CONST PNG_cHRM;
#endif
#if defined(PNG_READ_gAMA_SUPPORTED)
#ifdef PNG_READ_gAMA_SUPPORTED
PNG_CONST PNG_gAMA;
#endif
#if defined(PNG_READ_hIST_SUPPORTED)
#ifdef PNG_READ_hIST_SUPPORTED
PNG_CONST PNG_hIST;
#endif
#if defined(PNG_READ_iCCP_SUPPORTED)
#ifdef PNG_READ_iCCP_SUPPORTED
PNG_CONST PNG_iCCP;
#endif
#if defined(PNG_READ_iTXt_SUPPORTED)
#ifdef PNG_READ_iTXt_SUPPORTED
PNG_CONST PNG_iTXt;
#endif
#if defined(PNG_READ_oFFs_SUPPORTED)
#ifdef PNG_READ_oFFs_SUPPORTED
PNG_CONST PNG_oFFs;
#endif
#if defined(PNG_READ_pCAL_SUPPORTED)
#ifdef PNG_READ_pCAL_SUPPORTED
PNG_CONST PNG_pCAL;
#endif
#if defined(PNG_READ_pHYs_SUPPORTED)
#ifdef PNG_READ_pHYs_SUPPORTED
PNG_CONST PNG_pHYs;
#endif
#if defined(PNG_READ_sBIT_SUPPORTED)
#ifdef PNG_READ_sBIT_SUPPORTED
PNG_CONST PNG_sBIT;
#endif
#if defined(PNG_READ_sCAL_SUPPORTED)
#ifdef PNG_READ_sCAL_SUPPORTED
PNG_CONST PNG_sCAL;
#endif
#if defined(PNG_READ_sRGB_SUPPORTED)
#ifdef PNG_READ_sRGB_SUPPORTED
PNG_CONST PNG_sRGB;
#endif
#if defined(PNG_READ_sPLT_SUPPORTED)
#ifdef PNG_READ_sPLT_SUPPORTED
PNG_CONST PNG_sPLT;
#endif
#if defined(PNG_READ_tEXt_SUPPORTED)
#ifdef PNG_READ_tEXt_SUPPORTED
PNG_CONST PNG_tEXt;
#endif
#if defined(PNG_READ_tIME_SUPPORTED)
#ifdef PNG_READ_tIME_SUPPORTED
PNG_CONST PNG_tIME;
#endif
#if defined(PNG_READ_tRNS_SUPPORTED)
#ifdef PNG_READ_tRNS_SUPPORTED
PNG_CONST PNG_tRNS;
#endif
#if defined(PNG_READ_zTXt_SUPPORTED)
#ifdef PNG_READ_zTXt_SUPPORTED
PNG_CONST PNG_zTXt;
#endif
#endif /* PNG_USE_LOCAL_ARRAYS */
/* First we make sure we have enough data for the 4 byte chunk name
* and the 4 byte chunk length before proceeding with decoding the
* chunk data. To fully decode each of these chunks, we also make
@ -334,7 +335,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
return;
}
#if defined(PNG_READ_gAMA_SUPPORTED)
#ifdef PNG_READ_gAMA_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_gAMA, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -347,7 +348,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_sBIT_SUPPORTED)
#ifdef PNG_READ_sBIT_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_sBIT, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -360,7 +361,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_cHRM_SUPPORTED)
#ifdef PNG_READ_cHRM_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_cHRM, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -373,7 +374,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_sRGB_SUPPORTED)
#ifdef PNG_READ_sRGB_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_sRGB, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -386,7 +387,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_iCCP_SUPPORTED)
#ifdef PNG_READ_iCCP_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_iCCP, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -399,7 +400,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_sPLT_SUPPORTED)
#ifdef PNG_READ_sPLT_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_sPLT, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -412,7 +413,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_tRNS_SUPPORTED)
#ifdef PNG_READ_tRNS_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_tRNS, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -425,7 +426,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_bKGD_SUPPORTED)
#ifdef PNG_READ_bKGD_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_bKGD, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -438,7 +439,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_hIST_SUPPORTED)
#ifdef PNG_READ_hIST_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_hIST, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -451,7 +452,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_pHYs_SUPPORTED)
#ifdef PNG_READ_pHYs_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_pHYs, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -464,7 +465,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_oFFs_SUPPORTED)
#ifdef PNG_READ_oFFs_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_oFFs, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -477,7 +478,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_pCAL_SUPPORTED)
#ifdef PNG_READ_pCAL_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_pCAL, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -490,7 +491,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_sCAL_SUPPORTED)
#ifdef PNG_READ_sCAL_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_sCAL, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -503,7 +504,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_tIME_SUPPORTED)
#ifdef PNG_READ_tIME_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_tIME, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -516,7 +517,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_tEXt_SUPPORTED)
#ifdef PNG_READ_tEXt_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_tEXt, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -529,7 +530,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_zTXt_SUPPORTED)
#ifdef PNG_READ_zTXt_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_zTXt, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -542,7 +543,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_iTXt_SUPPORTED)
#ifdef PNG_READ_iTXt_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_iTXt, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -859,7 +860,7 @@ png_process_IDAT_data(png_structp png_ptr, png_bytep buffer,
if (!(png_ptr->zstream.avail_out))
{
if ((
#if defined(PNG_READ_INTERLACING_SUPPORTED)
#ifdef PNG_READ_INTERLACING_SUPPORTED
png_ptr->interlaced && png_ptr->pass > 6) ||
(!png_ptr->interlaced &&
#endif
@ -902,7 +903,7 @@ png_push_process_row(png_structp png_ptr)
if (png_ptr->transformations || (png_ptr->flags&PNG_FLAG_STRIP_ALPHA))
png_do_read_transformations(png_ptr);
#if defined(PNG_READ_INTERLACING_SUPPORTED)
#ifdef PNG_READ_INTERLACING_SUPPORTED
/* Blow up interlaced rows to full size */
if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE))
{
@ -1114,7 +1115,7 @@ png_read_push_finish_row(png_structp png_ptr)
if (png_ptr->row_number < png_ptr->num_rows)
return;
#if defined(PNG_READ_INTERLACING_SUPPORTED)
#ifdef PNG_READ_INTERLACING_SUPPORTED
if (png_ptr->interlaced)
{
png_ptr->row_number = 0;
@ -1155,7 +1156,7 @@ png_read_push_finish_row(png_structp png_ptr)
#endif /* PNG_READ_INTERLACING_SUPPORTED */
}
#if defined(PNG_READ_tEXt_SUPPORTED)
#ifdef PNG_READ_tEXt_SUPPORTED
void /* PRIVATE */
png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
length)
@ -1218,7 +1219,7 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
png_push_crc_finish(png_ptr);
#if defined(PNG_MAX_MALLOC_64K)
#ifdef PNG_MAX_MALLOC_64K
if (png_ptr->skip_length)
return;
#endif
@ -1253,7 +1254,7 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_zTXt_SUPPORTED)
#ifdef PNG_READ_zTXt_SUPPORTED
void /* PRIVATE */
png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
length)
@ -1454,7 +1455,7 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_iTXt_SUPPORTED)
#ifdef PNG_READ_iTXt_SUPPORTED
void /* PRIVATE */
png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
length)
@ -1521,7 +1522,7 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
png_push_crc_finish(png_ptr);
#if defined(PNG_MAX_MALLOC_64K)
#ifdef PNG_MAX_MALLOC_64K
if (png_ptr->skip_length)
return;
#endif
@ -1587,10 +1588,10 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
if (!(png_ptr->chunk_name[0] & 0x20))
{
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
PNG_HANDLE_CHUNK_ALWAYS
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
&& png_ptr->read_user_chunk_fn == NULL
#endif
)
@ -1600,7 +1601,7 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
info_ptr = info_ptr; /* To quiet some compiler warnings */
}
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
if (png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS)
{
#ifdef PNG_MAX_MALLOC_64K
@ -1629,7 +1630,7 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length);
}
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
if (png_ptr->read_user_chunk_fn != NULL)
{
/* Callback to user unknown chunk handler */
@ -1694,6 +1695,7 @@ png_progressive_combine_row (png_structp png_ptr,
PNG_CONST int FARDATA png_pass_dsp_mask[7] =
{0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff};
#endif
if (png_ptr == NULL)
return;

View File

@ -745,7 +745,7 @@ void /* PRIVATE */
png_init_read_transformations(png_structp png_ptr)
{
png_debug(1, "in png_init_read_transformations");
#if defined(PNG_USELESS_TESTS_SUPPORTED)
#ifdef PNG_USELESS_TESTS_SUPPORTED
if (png_ptr != NULL)
#endif
{
@ -1550,7 +1550,7 @@ void /* PRIVATE */
png_do_unpack(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_unpack");
#if defined(PNG_USELESS_TESTS_SUPPORTED)
#ifdef PNG_USELESS_TESTS_SUPPORTED
if (row != NULL && row_info != NULL && row_info->bit_depth < 8)
#else
if (row_info->bit_depth < 8)
@ -1643,7 +1643,7 @@ png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits)
{
png_debug(1, "in png_do_unshift");
if (
#if defined(PNG_USELESS_TESTS_SUPPORTED)
#ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL && sig_bits != NULL &&
#endif
row_info->color_type != PNG_COLOR_TYPE_PALETTE)
@ -1751,7 +1751,7 @@ void /* PRIVATE */
png_do_chop(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_chop");
#if defined(PNG_USELESS_TESTS_SUPPORTED)
#ifdef PNG_USELESS_TESTS_SUPPORTED
if (row != NULL && row_info != NULL && row_info->bit_depth == 16)
#else
if (row_info->bit_depth == 16)
@ -1808,7 +1808,7 @@ void /* PRIVATE */
png_do_read_swap_alpha(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_read_swap_alpha");
#if defined(PNG_USELESS_TESTS_SUPPORTED)
#ifdef PNG_USELESS_TESTS_SUPPORTED
if (row != NULL && row_info != NULL)
#endif
{
@ -1900,7 +1900,7 @@ void /* PRIVATE */
png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_read_invert_alpha");
#if defined(PNG_USELESS_TESTS_SUPPORTED)
#ifdef PNG_USELESS_TESTS_SUPPORTED
if (row != NULL && row_info != NULL)
#endif
{
@ -2007,7 +2007,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
png_debug(1, "in png_do_read_filler");
if (
#if defined(PNG_USELESS_TESTS_SUPPORTED)
#ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL &&
#endif
row_info->color_type == PNG_COLOR_TYPE_GRAY)
@ -2179,7 +2179,7 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
png_debug(1, "in png_do_gray_to_rgb");
if (row_info->bit_depth >= 8 &&
#if defined(PNG_USELESS_TESTS_SUPPORTED)
#ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL &&
#endif
!(row_info->color_type & PNG_COLOR_MASK_COLOR))
@ -2285,7 +2285,7 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row)
png_debug(1, "in png_do_rgb_to_gray");
if (
#if defined(PNG_USELESS_TESTS_SUPPORTED)
#ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL &&
#endif
(row_info->color_type & PNG_COLOR_MASK_COLOR))
@ -2766,7 +2766,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
png_debug(1, "in png_do_background");
if (background != NULL &&
#if defined(PNG_USELESS_TESTS_SUPPORTED)
#ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL &&
#endif
(!(row_info->color_type & PNG_COLOR_MASK_ALPHA) ||
@ -3455,7 +3455,7 @@ png_do_gamma(png_row_infop row_info, png_bytep row,
png_debug(1, "in png_do_gamma");
if (
#if defined(PNG_USELESS_TESTS_SUPPORTED)
#ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL &&
#endif
((row_info->bit_depth <= 8 && gamma_table != NULL) ||
@ -3643,7 +3643,7 @@ png_do_expand_palette(png_row_infop row_info, png_bytep row,
png_debug(1, "in png_do_expand_palette");
if (
#if defined(PNG_USELESS_TESTS_SUPPORTED)
#ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL &&
#endif
row_info->color_type == PNG_COLOR_TYPE_PALETTE)
@ -3788,7 +3788,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
png_uint_32 row_width=row_info->width;
png_debug(1, "in png_do_expand");
#if defined(PNG_USELESS_TESTS_SUPPORTED)
#ifdef PNG_USELESS_TESTS_SUPPORTED
if (row != NULL && row_info != NULL)
#endif
{
@ -3999,7 +3999,7 @@ png_do_dither(png_row_infop row_info, png_bytep row,
png_uint_32 row_width=row_info->width;
png_debug(1, "in png_do_dither");
#if defined(PNG_USELESS_TESTS_SUPPORTED)
#ifdef PNG_USELESS_TESTS_SUPPORTED
if (row != NULL && row_info != NULL)
#endif
{
@ -4321,7 +4321,7 @@ png_do_read_intrapixel(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_read_intrapixel");
if (
#if defined(PNG_USELESS_TESTS_SUPPORTED)
#ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL &&
#endif
(row_info->color_type & PNG_COLOR_MASK_COLOR))