18#ifdef PNG_READ_SUPPORTED
23#define LZ77Min (2U+5U+4U)
25#ifdef PNG_READ_INTERLACING_SUPPORTED
29static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
31static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
33static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
35static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
46 png_error(
png_ptr,
"PNG unsigned integer out of range");
51#ifdef PNG_READ_INT_FUNCTIONS_SUPPORTED
83 if ((uval & 0x80000000) == 0)
84 return (png_int_32)uval;
86 uval = (uval ^ 0xffffffff) + 1;
87 if ((uval & 0x80000000) == 0)
88 return -(png_int_32)uval;
106 ((
unsigned int)(*
buf) << 8) +
107 ((
unsigned int)(*(
buf + 1)));
109 return (png_uint_16)
val;
118 size_t num_checked, num_to_check;
124 num_checked =
png_ptr->sig_bytes;
125 num_to_check = 8 - num_checked;
127#ifdef PNG_IO_STATE_SUPPORTED
132 png_read_data(
png_ptr, &(
info_ptr->signature[num_checked]), num_to_check);
135 if (png_sig_cmp(
info_ptr->signature, num_checked, num_to_check) != 0)
137 if (num_checked < 4 &&
138 png_sig_cmp(
info_ptr->signature, num_checked, num_to_check - 4) != 0)
139 png_error(
png_ptr,
"Not a PNG file");
141 png_error(
png_ptr,
"PNG file corrupted by ASCII conversion");
161 name &= ~PNG_U32(32,32,0,32);
162 t = (
name & ~0x1f1f1f1fU) ^ 0x40404040U;
176 return (
t & 0xe0e0e0e0U) == 0
U;
188#ifdef PNG_IO_STATE_SUPPORTED
204 png_debug2(0,
"Reading chunk typeid = 0x%lx, length = %lu",
211 png_chunk_error(
png_ptr,
"bad header (invalid length)");
214 if (!check_chunk_name(chunk_name))
215 png_chunk_error(
png_ptr,
"bad header (invalid type)");
217#ifdef PNG_IO_STATE_SUPPORTED
241 png_byte crc_bytes[4];
284#ifdef PNG_IO_STATE_SUPPORTED
289 png_read_data(
png_ptr, crc_bytes, 4);
313 int handle_as_ancillary)
323 len = (
sizeof tmpbuf);
336 if (handle_as_ancillary &&
338 handle_as_ancillary = 0;
342 if (png_crc_error(
png_ptr, handle_as_ancillary) != 0)
348 png_chunk_warning(
png_ptr,
"CRC error");
351 png_chunk_error(
png_ptr,
"CRC error");
365#if defined(PNG_READ_iCCP_SUPPORTED) || defined(PNG_READ_iTXt_SUPPORTED) ||\
366 defined(PNG_READ_pCAL_SUPPORTED) || defined(PNG_READ_sCAL_SUPPORTED) ||\
367 defined(PNG_READ_sPLT_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) ||\
368 defined(PNG_READ_zTXt_SUPPORTED) || defined(PNG_READ_eXIf_SUPPORTED) ||\
369 defined(PNG_SEQUENTIAL_READ_SUPPORTED)
396# ifndef PNG_NO_MEMZERO
425 (
void)png_safecat(
msg, (
sizeof msg), 4,
" using zstream");
449#if ZLIB_VERNUM >= 0x1240
452# if defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_MAXIMUM_INFLATE_WINDOW)
474 png_ptr->zstream.avail_out = 0;
478#if ZLIB_VERNUM >= 0x1240
487#if ZLIB_VERNUM >= 0x1240
497#ifdef PNG_DISABLE_ADLER32_CHECK_SUPPORTED
517#if ZLIB_VERNUM >= 0x1240
529 if ((*
png_ptr->zstream.next_in >> 4) > 7)
531 png_ptr->zstream.msg =
"invalid window size (libpng)";
542#ifdef PNG_READ_COMPRESSED_TEXT_SUPPORTED
543#if defined(PNG_READ_zTXt_SUPPORTED) || defined (PNG_READ_iTXt_SUPPORTED)
578 png_ptr->zstream.avail_out = 0;
584 png_ptr->zstream.next_out = output;
599 avail_in +=
png_ptr->zstream.avail_in;
603 if (avail_in <
avail)
610 avail_out +=
png_ptr->zstream.avail_out;
619 png_ptr->zstream.next_out = local_buffer;
620 if ((
sizeof local_buffer) <
avail)
621 avail = (
sizeof local_buffer);
624 if (avail_out <
avail)
645 avail_in +=
png_ptr->zstream.avail_in;
646 avail_out +=
png_ptr->zstream.avail_out;
652 *output_size_ptr -= avail_out;
655 *input_size_ptr -= avail_in;
701 if (
limit < *newlength)
712 png_ptr->read_buffer + prefix_size, &lzsize,
742 png_ptr->read_buffer + prefix_size, &lzsize,
743 text + prefix_size, newlength);
750 text[prefix_size + *newlength] = 0;
788 chunklength - prefix_size != lzsize)
789 png_chunk_benign_error(
png_ptr,
"extra compressed data");
831#ifdef PNG_READ_iCCP_SUPPORTED
845 png_ptr->zstream.next_out = next_out;
846 png_ptr->zstream.avail_out = 0;
850 if (
png_ptr->zstream.avail_in == 0)
852 if (read_size > *chunk_bytes)
853 read_size = (
uInt)*chunk_bytes;
854 *chunk_bytes -= read_size;
860 png_ptr->zstream.avail_in = read_size;
863 if (
png_ptr->zstream.avail_out == 0)
883 png_ptr->zstream.avail_out = 0;
905 int bit_depth, color_type, compression_type, filter_type;
921 compression_type =
buf[10];
922 filter_type =
buf[11];
923 interlace_type =
buf[12];
928 png_ptr->bit_depth = (png_byte)bit_depth;
929 png_ptr->interlaced = (png_byte)interlace_type;
930 png_ptr->color_type = (png_byte)color_type;
931#ifdef PNG_MNG_FEATURES_SUPPORTED
932 png_ptr->filter_type = (png_byte)filter_type;
934 png_ptr->compression_type = (png_byte)compression_type;
969 color_type, interlace_type, compression_type, filter_type);
999 errmsg =
"ignored in grayscale PNG";
1026 const unsigned max_palette_length =
1033 const unsigned num = (
length > 3U*max_palette_length) ?
1095#define png_handle_IDAT NULL
1105 png_chunk_benign_error(
png_ptr,
"invalid");
1113#ifdef PNG_READ_gAMA_SUPPORTED
1124 if (png_crc_finish(
png_ptr, 0) != 0)
1131 png_chunk_benign_error(
png_ptr,
"invalid");
1137#ifdef PNG_READ_GAMMA_SUPPORTED
1141 if (
png_ptr->chunk_gamma == 0)
1149# define png_handle_gAMA NULL
1152#ifdef PNG_READ_sBIT_SUPPORTED
1156 unsigned int truelen,
i;
1157 png_byte sample_depth;
1171 sample_depth =
png_ptr->bit_depth;
1177 png_chunk_benign_error(
png_ptr,
"bad length");
1184 if (png_crc_finish(
png_ptr, 0) != 0)
1187 for (
i=0;
i<truelen; ++
i)
1189 if (
buf[
i] == 0 ||
buf[
i] > sample_depth)
1191 png_chunk_benign_error(
png_ptr,
"invalid");
1217# define png_handle_sBIT NULL
1220#ifdef PNG_READ_cHRM_SUPPORTED
1225 if ((uval & 0x80000000) == 0)
1226 return (png_int_32)uval;
1228 uval = (uval ^ 0xffffffff) + 1;
1229 if ((uval & 0x80000000) == 0)
1230 return -(png_int_32)uval;
1250 if (png_crc_finish(
png_ptr, 0) != 0)
1264 png_chunk_benign_error(
png_ptr,
"invalid");
1276# ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
1290# define png_handle_cHRM NULL
1293#ifdef PNG_READ_sRGB_SUPPORTED
1301 png_crc_read(
png_ptr, &intent, 1);
1303 if (png_crc_finish(
png_ptr, 0) != 0)
1313 png_chunk_benign_error(
png_ptr,
"invalid");
1322#ifdef PNG_READ_GAMMA_SUPPORTED
1335# define png_handle_sRGB NULL
1338#ifdef PNG_READ_iCCP_SUPPORTED
1353 uInt read_length, keyword_length;
1360 if (read_length >
length)
1369 png_chunk_benign_error(
png_ptr,
"too short");
1374 while (keyword_length < 80 && keyword_length < read_length &&
1379 if (keyword_length >= 1 && keyword_length <= 79)
1384 if (keyword_length+1 < read_length &&
1387 read_length -= keyword_length+2;
1391 Byte profile_header[132]={0};
1396 png_ptr->zstream.avail_in = read_length;
1398 (
sizeof local_buffer), &
length, profile_header, &
size,
1414 profile_header,
png_ptr->color_type) != 0)
1429 (
sizeof profile_header));
1431 size = 12 * tag_count;
1434 (
sizeof local_buffer), &
length,
1442 if (png_icc_check_tag_table(
png_ptr,
1448 size = profile_length - (
sizeof profile_header)
1452 (
sizeof local_buffer), &
length,
1453 profile + (
sizeof profile_header) +
1454 12 * tag_count, &
size, 1);
1458 errmsg =
"extra compressed data";
1469 "extra compressed data");
1497 errmsg =
"out of memory";
1521 errmsg =
"out of memory";
1542 errmsg =
"bad compression method";
1559# define png_handle_iCCP NULL
1562#ifdef PNG_READ_sPLT_SUPPORTED
1578#ifdef PNG_USER_LIMITS_SUPPORTED
1579 if (
png_ptr->user_chunk_cache_max != 0)
1581 if (
png_ptr->user_chunk_cache_max == 1)
1587 if (--
png_ptr->user_chunk_cache_max == 1)
1589 png_warning(
png_ptr,
"No space in chunk cache for sPLT");
1600 png_chunk_benign_error(
png_ptr,
"out of memory");
1616 for (entry_start =
buffer; *entry_start; entry_start++)
1622 if (length < 2U || entry_start >
buffer + (
length - 2U))
1624 png_warning(
png_ptr,
"malformed sPLT chunk");
1628 new_palette.
depth = *entry_start++;
1629 entry_size = (new_palette.
depth == 8 ? 6 : 10);
1636 if ((data_length % (
unsigned int)entry_size) != 0)
1638 png_warning(
png_ptr,
"sPLT chunk has bad length");
1642 dl = (
png_uint_32)(data_length / (
unsigned int)entry_size);
1647 png_warning(
png_ptr,
"sPLT chunk too long");
1651 new_palette.
nentries = (png_int_32)(data_length / (
unsigned int)entry_size);
1658 png_warning(
png_ptr,
"sPLT chunk requires too much memory");
1666 if (new_palette.
depth == 8)
1668 pp->
red = *entry_start++;
1669 pp->
green = *entry_start++;
1670 pp->
blue = *entry_start++;
1671 pp->
alpha = *entry_start++;
1694# define png_handle_sPLT NULL
1697#ifdef PNG_READ_tRNS_SUPPORTED
1712 png_chunk_benign_error(
png_ptr,
"invalid");
1728 png_chunk_benign_error(
png_ptr,
"invalid");
1744 png_chunk_benign_error(
png_ptr,
"out of place");
1753 png_chunk_benign_error(
png_ptr,
"invalid");
1764 png_chunk_benign_error(
png_ptr,
"invalid with alpha channel");
1768 if (png_crc_finish(
png_ptr, 0) != 0)
1783# define png_handle_tRNS NULL
1786#ifdef PNG_READ_bKGD_SUPPORTED
1790 unsigned int truelen;
1801 png_chunk_benign_error(
png_ptr,
"out of place");
1817 png_chunk_benign_error(
png_ptr,
"invalid");
1823 if (png_crc_finish(
png_ptr, 0) != 0)
1839 png_chunk_benign_error(
png_ptr,
"invalid index");
1849 background.
red = background.
green = background.
blue = 0;
1851 background.
gray = 0;
1858 if (
buf[0] != 0 ||
buf[1] >= (
unsigned int)(1 <<
png_ptr->bit_depth))
1860 png_chunk_benign_error(
png_ptr,
"invalid gray level");
1865 background.
index = 0;
1876 if (
buf[0] != 0 ||
buf[2] != 0 ||
buf[4] != 0)
1878 png_chunk_benign_error(
png_ptr,
"invalid color");
1883 background.
index = 0;
1887 background.
gray = 0;
1894# define png_handle_bKGD NULL
1897#ifdef PNG_READ_cICP_SUPPORTED
1907 if (png_crc_finish(
png_ptr, 0) != 0)
1913# ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
1920#ifdef PNG_READ_GAMMA_SUPPORTED
1933# define png_handle_cICP NULL
1936#ifdef PNG_READ_cLLI_SUPPORTED
1946 if (png_crc_finish(
png_ptr, 0) != 0)
1956# define png_handle_cLLI NULL
1959#ifdef PNG_READ_mDCV_SUPPORTED
1970 if (png_crc_finish(
png_ptr, 0) != 0)
1995 chromaticities.
redx, chromaticities.
redy,
2002# ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
2003 png_ptr->chromaticities = chromaticities;
2010# define png_handle_mDCV NULL
2013#ifdef PNG_READ_eXIf_SUPPORTED
2026 png_chunk_benign_error(
png_ptr,
"out of memory");
2032 if (png_crc_finish(
png_ptr, 0) != 0)
2045 png_chunk_benign_error(
png_ptr,
"invalid");
2054# define png_handle_eXIf NULL
2057#ifdef PNG_READ_hIST_SUPPORTED
2061 unsigned int num,
i;
2079 png_chunk_benign_error(
png_ptr,
"invalid");
2083 for (
i = 0;
i <
num;
i++)
2091 if (png_crc_finish(
png_ptr, 0) != 0)
2098# define png_handle_hIST NULL
2101#ifdef PNG_READ_pHYs_SUPPORTED
2113 if (png_crc_finish(
png_ptr, 0) != 0)
2124# define png_handle_pHYs NULL
2127#ifdef PNG_READ_oFFs_SUPPORTED
2132 png_int_32 offset_x, offset_y;
2139 if (png_crc_finish(
png_ptr, 0) != 0)
2150# define png_handle_oFFs NULL
2153#ifdef PNG_READ_pCAL_SUPPORTED
2159 png_byte
type, nparams;
2165 png_debug1(2,
"Allocating and reading pCAL chunk data (%u bytes)",
2173 png_chunk_benign_error(
png_ptr,
"out of memory");
2179 if (png_crc_finish(
png_ptr, 0) != 0)
2184 png_debug(3,
"Finding end of pCAL purpose string");
2193 if (endptr -
buf <= 12)
2195 png_chunk_benign_error(
png_ptr,
"invalid");
2199 png_debug(3,
"Reading pCAL X0, X1, type, nparams, and units");
2206 png_debug(3,
"Checking pCAL equation type and number of parameters");
2215 png_chunk_benign_error(
png_ptr,
"invalid parameter count");
2221 png_chunk_benign_error(
png_ptr,
"unrecognized equation type");
2227 png_debug(3,
"Allocating pCAL parameters array");
2234 png_chunk_benign_error(
png_ptr,
"out of memory");
2239 for (
i = 0;
i < nparams;
i++)
2252 png_chunk_benign_error(
png_ptr,
"invalid data");
2270# define png_handle_pCAL NULL
2273#ifdef PNG_READ_sCAL_SUPPORTED
2283 png_debug1(2,
"Allocating and reading sCAL chunk data (%u bytes)",
2291 png_chunk_benign_error(
png_ptr,
"out of memory");
2298 if (png_crc_finish(
png_ptr, 0) != 0)
2304 png_chunk_benign_error(
png_ptr,
"invalid unit");
2316 png_chunk_benign_error(
png_ptr,
"bad width format");
2318 else if (PNG_FP_IS_POSITIVE(
state) == 0)
2319 png_chunk_benign_error(
png_ptr,
"non-positive width");
2328 png_chunk_benign_error(
png_ptr,
"bad height format");
2330 else if (PNG_FP_IS_POSITIVE(
state) == 0)
2331 png_chunk_benign_error(
png_ptr,
"non-positive height");
2345# define png_handle_sCAL NULL
2348#ifdef PNG_READ_tIME_SUPPORTED
2366 if (png_crc_finish(
png_ptr, 0) != 0)
2381# define png_handle_tIME NULL
2384#ifdef PNG_READ_tEXt_SUPPORTED
2397#ifdef PNG_USER_LIMITS_SUPPORTED
2398 if (
png_ptr->user_chunk_cache_max != 0)
2400 if (
png_ptr->user_chunk_cache_max == 1)
2406 if (--
png_ptr->user_chunk_cache_max == 1)
2409 png_chunk_benign_error(
png_ptr,
"no space in chunk cache");
2420 png_chunk_benign_error(
png_ptr,
"out of memory");
2449 png_chunk_benign_error(
png_ptr,
"out of memory");
2453# define png_handle_tEXt NULL
2456#ifdef PNG_READ_zTXt_SUPPORTED
2467#ifdef PNG_USER_LIMITS_SUPPORTED
2468 if (
png_ptr->user_chunk_cache_max != 0)
2470 if (
png_ptr->user_chunk_cache_max == 1)
2476 if (--
png_ptr->user_chunk_cache_max == 1)
2479 png_chunk_benign_error(
png_ptr,
"no space in chunk cache");
2494 png_chunk_benign_error(
png_ptr,
"out of memory");
2500 if (png_crc_finish(
png_ptr, 0) != 0)
2504 for (keyword_length = 0;
2505 keyword_length <
length &&
buffer[keyword_length] != 0;
2509 if (keyword_length > 79 || keyword_length < 1)
2516 else if (keyword_length + 3 >
length)
2520 errmsg =
"unknown compression type";
2536 errmsg=
"Read failure in png_handle_zTXt";
2544 buffer[uncompressed_length+(keyword_length+2)] = 0;
2549 text.text_length = uncompressed_length;
2550 text.itxt_length = 0;
2557 errmsg =
"out of memory";
2569# define png_handle_zTXt NULL
2572#ifdef PNG_READ_iTXt_SUPPORTED
2583#ifdef PNG_USER_LIMITS_SUPPORTED
2584 if (
png_ptr->user_chunk_cache_max != 0)
2586 if (
png_ptr->user_chunk_cache_max == 1)
2592 if (--
png_ptr->user_chunk_cache_max == 1)
2595 png_chunk_benign_error(
png_ptr,
"no space in chunk cache");
2606 png_chunk_benign_error(
png_ptr,
"out of memory");
2612 if (png_crc_finish(
png_ptr, 0) != 0)
2616 for (prefix_length=0;
2622 if (prefix_length > 79 || prefix_length < 1)
2629 else if (prefix_length + 5 >
length)
2632 else if (
buffer[prefix_length+1] == 0 ||
2633 (
buffer[prefix_length+1] == 1 &&
2636 int compressed =
buffer[prefix_length+1] != 0;
2637 png_uint_32 language_offset, translated_keyword_offset;
2642 language_offset = prefix_length;
2644 for (; prefix_length <
length &&
buffer[prefix_length] != 0;
2649 translated_keyword_offset = ++prefix_length;
2651 for (; prefix_length <
length &&
buffer[prefix_length] != 0;
2662 if (compressed == 0 && prefix_length <=
length)
2663 uncompressed_length =
length - prefix_length;
2665 else if (compressed != 0 && prefix_length <
length)
2688 buffer[uncompressed_length+prefix_length] = 0;
2690 if (compressed == 0)
2700 text.text_length = 0;
2701 text.itxt_length = uncompressed_length;
2706 errmsg =
"out of memory";
2711 errmsg =
"bad compression info";
2718# define png_handle_iTXt NULL
2721#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
2757 png_chunk_benign_error(
png_ptr,
"unknown chunk exceeds memory limits");
2780#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
2792# ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
2793# ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
2802# ifdef PNG_READ_USER_CHUNKS_SUPPORTED
2824 png_chunk_error(
png_ptr,
"error in user chunk");
2841# ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
2844 png_chunk_warning(
png_ptr,
"Saving unknown chunk:");
2846 "forcing save of an unhandled chunk;"
2847 " please call png_set_keep_unknown_chunks");
2871# ifdef PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
2879 keep =
png_ptr->unknown_default;
2893# ifndef PNG_READ_USER_CHUNKS_SUPPORTED
2894# error no method to support READ_UNKNOWN_CHUNKS
2911# ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
2919# ifdef PNG_USER_LIMITS_SUPPORTED
2920 switch (
png_ptr->user_chunk_cache_max)
2923 png_ptr->user_chunk_cache_max = 1;
2924 png_chunk_benign_error(
png_ptr,
"no space in chunk cache");
2933 --(
png_ptr->user_chunk_cache_max);
2943# ifdef PNG_USER_LIMITS_SUPPORTED
2969 png_chunk_error(
png_ptr,
"unhandled critical chunk");
2983#define png_handle_acTL NULL
2984#define png_handle_fcTL NULL
2985#define png_handle_fdAT NULL
3034# define NoCheck 0x801U
3035# define Limit 0x802U
3036# define LKMin 3U+LZ77Min
3038#define hIHDR PNG_HAVE_IHDR
3039#define hPLTE PNG_HAVE_PLTE
3040#define hIDAT PNG_HAVE_IDAT
3047#define hCOL (PNG_HAVE_PLTE|PNG_HAVE_IDAT)
3049#define aIDAT PNG_AFTER_IDAT
3053# define CDIHDR 13U, 13U, hIHDR, 0, 0
3054# define CDPLTE NoCheck, 0U, 0, hIHDR, 1
3058# define CDIDAT NoCheck, 0U, aIDAT, hIHDR, 1
3059# define CDIEND NoCheck, 0U, 0, aIDAT, 0
3061# define CDtRNS 256U, 0U, hIDAT, hIHDR, 0
3062# define CDcHRM 32U, 32U, hCOL, hIHDR, 0
3063# define CDgAMA 4U, 4U, hCOL, hIHDR, 0
3064# define CDiCCP NoCheck, LKMin, hCOL, hIHDR, 0
3065# define CDsBIT 4U, 1U, hCOL, hIHDR, 0
3066# define CDsRGB 1U, 1U, hCOL, hIHDR, 0
3067# define CDcICP 4U, 4U, hCOL, hIHDR, 0
3068# define CDmDCV 24U, 24U, hCOL, hIHDR, 0
3069# define CDeXIf Limit, 4U, 0, hIHDR, 0
3070# define CDcLLI 8U, 8U, hCOL, hIHDR, 0
3071# define CDtEXt NoCheck, 2U, 0, hIHDR, 1
3073# define CDzTXt Limit, LKMin, 0, hIHDR, 1
3074# define CDiTXt NoCheck, 6U, 0, hIHDR, 1
3076# define CDbKGD 6U, 1U, hIDAT, hIHDR, 0
3077# define CDhIST 1024U, 0U, hPLTE, hIHDR, 0
3078# define CDpHYs 9U, 9U, hIDAT, hIHDR, 0
3079# define CDsPLT NoCheck, 3U, hIDAT, hIHDR, 1
3081# define CDtIME 7U, 7U, 0, hIHDR, 0
3082# define CDacTL 8U, 8U, hIDAT, hIHDR, 0
3083# define CDfcTL 25U, 26U, 0, hIHDR, 1
3084# define CDfdAT Limit, 4U, hIDAT, hIHDR, 1
3086# define CDoFFs 9U, 9U, hIDAT, hIHDR, 0
3087# define CDpCAL NoCheck, 14U, hIDAT, hIHDR, 0
3089# define CDsCAL Limit, 4U, hIDAT, hIHDR, 0
3092# define PNG_CHUNK(cHNK, index) { png_handle_ ## cHNK, CD ## cHNK },
3107# define PNG_CHUNK(cHNK, index)\
3108 case png_ ## cHNK: return PNG_INDEX_ ## cHNK;
3125 const png_index chunk_index = png_chunk_index_from_name(chunk_name);
3138 handled = png_handle_unknown(
3145 else if (chunk_index != PNG_INDEX_IHDR &&
3147 png_chunk_error(
png_ptr,
"missing IHDR");
3150 else if (((
png_ptr->mode & read_chunks[chunk_index].pos_before) != 0) ||
3151 ((
png_ptr->mode & read_chunks[chunk_index].pos_after) !=
3152 read_chunks[chunk_index].pos_after))
3160 else if (read_chunks[chunk_index].multiple == 0 &&
3166 else if (
length < read_chunks[chunk_index].min_length)
3177 unsigned max_length = read_chunks[chunk_index].max_length;
3189 errmsg =
"length exceeds libpng limit";
3193 if (
length <= max_length)
3201 handled = read_chunks[chunk_index].handler(
3241 unsigned int pixel_depth =
png_ptr->transformed_pixel_depth;
3246 png_byte end_byte = 0;
3247 unsigned int end_mask;
3254 if (pixel_depth == 0)
3255 png_error(
png_ptr,
"internal row logic error");
3263 png_error(
png_ptr,
"internal row size calculation error");
3267 png_error(
png_ptr,
"internal row width error");
3273 end_mask = (pixel_depth * row_width) & 7;
3277 end_ptr = dp +
PNG_ROWBYTES(pixel_depth, row_width) - 1;
3278 end_byte = *end_ptr;
3279# ifdef PNG_READ_PACKSWAP_SUPPORTED
3282 end_mask = (
unsigned int)(0xff << end_mask);
3286 end_mask = 0xff >> end_mask;
3296#ifdef PNG_READ_INTERLACING_SUPPORTED
3297 if (
png_ptr->interlaced != 0 &&
3309 if (pixel_depth < 8)
3348# if PNG_USE_COMPILE_TIME_MASKS
3349# define PNG_LSR(x,s) ((x)>>((s) & 0x1f))
3350# define PNG_LSL(x,s) ((x)<<((s) & 0x1f))
3352# define PNG_LSR(x,s) ((x)>>(s))
3353# define PNG_LSL(x,s) ((x)<<(s))
3355# define S_COPY(p,x) (((p)<4 ? PNG_LSR(0x80088822,(3-(p))*8+(7-(x))) :\
3356 PNG_LSR(0xaa55ff00,(7-(p))*8+(7-(x)))) & 1)
3357# define B_COPY(p,x) (((p)<4 ? PNG_LSR(0xff0fff33,(3-(p))*8+(7-(x))) :\
3358 PNG_LSR(0xff55ff00,(7-(p))*8+(7-(x)))) & 1)
3366# define PIXEL_MASK(p,x,d,s) \
3367 (PNG_LSL(((PNG_LSL(1U,(d)))-1),(((x)*(d))^((s)?8-(d):0))))
3371# define S_MASKx(p,x,d,s) (S_COPY(p,x)?PIXEL_MASK(p,x,d,s):0)
3372# define B_MASKx(p,x,d,s) (B_COPY(p,x)?PIXEL_MASK(p,x,d,s):0)
3378# define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
3380# define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
3381 S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
3382 S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
3384# define B_MASK(p,d,s) MASK_EXPAND(B_MASKx(p,0,d,s) + B_MASKx(p,1,d,s) +\
3385 B_MASKx(p,2,d,s) + B_MASKx(p,3,d,s) + B_MASKx(p,4,d,s) +\
3386 B_MASKx(p,5,d,s) + B_MASKx(p,6,d,s) + B_MASKx(p,7,d,s), d)
3388#if PNG_USE_COMPILE_TIME_MASKS
3394# define S_MASKS(d,s) { S_MASK(0,d,s), S_MASK(1,d,s), S_MASK(2,d,s),\
3395 S_MASK(3,d,s), S_MASK(4,d,s), S_MASK(5,d,s) }
3397# define B_MASKS(d,s) { B_MASK(1,d,s), B_MASK(3,d,s), B_MASK(5,d,s) }
3399# define DEPTH_INDEX(d) ((d)==1?0:((d)==2?1:2))
3407 { S_MASKS(1,0), S_MASKS(2,0), S_MASKS(4,0) },
3409 { S_MASKS(1,1), S_MASKS(2,1), S_MASKS(4,1) }
3418 { B_MASKS(1,0), B_MASKS(2,0), B_MASKS(4,0) },
3420 { B_MASKS(1,1), B_MASKS(2,1), B_MASKS(4,1) }
3423# define MASK(pass,depth,display,png)\
3424 ((display)?display_mask[png][DEPTH_INDEX(depth)][pass>>1]:\
3425 row_mask[png][DEPTH_INDEX(depth)][pass])
3431# define MASK(pass,depth,display,png)\
3432 ((display)?B_MASK(pass,depth,png):S_MASK(pass,depth,png))
3443# ifdef PNG_READ_PACKSWAP_SUPPORTED
3460 mask = (
m >> 8) | (
m << 24);
3466 *dp = (png_byte)((*dp & ~
m) | (*
sp &
m));
3475 if (row_width <= pixels_per_byte)
3478 row_width -= pixels_per_byte;
3486 unsigned int bytes_to_copy, bytes_to_jump;
3489 if (pixel_depth & 7)
3490 png_error(
png_ptr,
"invalid user transform pixel depth");
3493 row_width *= pixel_depth;
3514 bytes_to_copy = (1<<((6-
pass)>>1)) * pixel_depth;
3517 if (bytes_to_copy > row_width)
3518 bytes_to_copy = (
unsigned int)row_width;
3522 bytes_to_copy = pixel_depth;
3535 switch (bytes_to_copy)
3542 if (row_width <= bytes_to_jump)
3545 dp += bytes_to_jump;
3546 sp += bytes_to_jump;
3547 row_width -= bytes_to_jump;
3556 dp[0] =
sp[0]; dp[1] =
sp[1];
3558 if (row_width <= bytes_to_jump)
3561 sp += bytes_to_jump;
3562 dp += bytes_to_jump;
3563 row_width -= bytes_to_jump;
3565 while (row_width > 1);
3577 dp[0] =
sp[0]; dp[1] =
sp[1]; dp[2] =
sp[2];
3579 if (row_width <= bytes_to_jump)
3582 sp += bytes_to_jump;
3583 dp += bytes_to_jump;
3584 row_width -= bytes_to_jump;
3588#if PNG_ALIGN_TYPE != PNG_ALIGN_NONE
3594 if (bytes_to_copy < 16 &&
3597 bytes_to_copy % (
sizeof (png_uint_16)) == 0 &&
3598 bytes_to_jump % (
sizeof (png_uint_16)) == 0)
3611 size_t skip = (bytes_to_jump-bytes_to_copy) /
3616 size_t c = bytes_to_copy;
3624 if (row_width <= bytes_to_jump)
3629 row_width -= bytes_to_jump;
3631 while (bytes_to_copy <= row_width);
3641 while (--row_width > 0);
3653 size_t skip = (bytes_to_jump-bytes_to_copy) /
3654 (
sizeof (png_uint_16));
3658 size_t c = bytes_to_copy;
3662 c -= (
sizeof (png_uint_16));
3666 if (row_width <= bytes_to_jump)
3671 row_width -= bytes_to_jump;
3673 while (bytes_to_copy <= row_width);
3680 while (--row_width > 0);
3691 if (row_width <= bytes_to_jump)
3694 sp += bytes_to_jump;
3695 dp += bytes_to_jump;
3696 row_width -= bytes_to_jump;
3697 if (bytes_to_copy > row_width)
3698 bytes_to_copy = (
unsigned int)row_width;
3717 if (end_ptr !=
NULL)
3718 *end_ptr = (png_byte)((end_byte & end_mask) | (*end_ptr & ~end_mask));
3721#ifdef PNG_READ_INTERLACING_SUPPORTED
3726 png_debug(1,
"in png_do_read_interlace");
3731 final_width = row_info->
width * png_pass_inc[
pass];
3739 unsigned int sshift, dshift;
3740 unsigned int s_start, s_end;
3742 int jstop = (
int)png_pass_inc[
pass];
3747#ifdef PNG_READ_PACKSWAP_SUPPORTED
3750 sshift = ((row_info->
width + 7) & 0x07);
3751 dshift = ((final_width + 7) & 0x07);
3760 sshift = 7 - ((row_info->
width + 7) & 0x07);
3761 dshift = 7 - ((final_width + 7) & 0x07);
3767 for (
i = 0;
i < row_info->
width;
i++)
3769 v = (png_byte)((*
sp >> sshift) & 0x01);
3770 for (
j = 0;
j < jstop;
j++)
3772 unsigned int tmp = *dp & (0x7f7f >> (7 - dshift));
3773 tmp |= (
unsigned int)(
v << dshift);
3774 *dp = (png_byte)(tmp & 0xff);
3776 if (dshift == s_end)
3783 dshift = (
unsigned int)((
int)dshift + s_inc);
3786 if (sshift == s_end)
3793 sshift = (
unsigned int)((
int)sshift + s_inc);
3802 unsigned int sshift, dshift;
3803 unsigned int s_start, s_end;
3805 int jstop = (
int)png_pass_inc[
pass];
3808#ifdef PNG_READ_PACKSWAP_SUPPORTED
3811 sshift = (((row_info->
width + 3) & 0x03) << 1);
3812 dshift = (((final_width + 3) & 0x03) << 1);
3821 sshift = ((3 - ((row_info->
width + 3) & 0x03)) << 1);
3822 dshift = ((3 - ((final_width + 3) & 0x03)) << 1);
3828 for (
i = 0;
i < row_info->
width;
i++)
3833 v = (png_byte)((*
sp >> sshift) & 0x03);
3834 for (
j = 0;
j < jstop;
j++)
3836 unsigned int tmp = *dp & (0x3f3f >> (6 - dshift));
3837 tmp |= (
unsigned int)(
v << dshift);
3838 *dp = (png_byte)(tmp & 0xff);
3840 if (dshift == s_end)
3847 dshift = (
unsigned int)((
int)dshift + s_inc);
3850 if (sshift == s_end)
3857 sshift = (
unsigned int)((
int)sshift + s_inc);
3866 unsigned int sshift, dshift;
3867 unsigned int s_start, s_end;
3870 int jstop = (
int)png_pass_inc[
pass];
3872#ifdef PNG_READ_PACKSWAP_SUPPORTED
3875 sshift = (((row_info->
width + 1) & 0x01) << 2);
3876 dshift = (((final_width + 1) & 0x01) << 2);
3885 sshift = ((1 - ((row_info->
width + 1) & 0x01)) << 2);
3886 dshift = ((1 - ((final_width + 1) & 0x01)) << 2);
3892 for (
i = 0;
i < row_info->
width;
i++)
3894 png_byte
v = (png_byte)((*
sp >> sshift) & 0x0f);
3897 for (
j = 0;
j < jstop;
j++)
3899 unsigned int tmp = *dp & (0xf0f >> (4 - dshift));
3900 tmp |= (
unsigned int)(
v << dshift);
3901 *dp = (png_byte)(tmp & 0xff);
3903 if (dshift == s_end)
3910 dshift = (
unsigned int)((
int)dshift + s_inc);
3913 if (sshift == s_end)
3920 sshift = (
unsigned int)((
int)sshift + s_inc);
3927 size_t pixel_bytes = (row_info->
pixel_depth >> 3);
3934 int jstop = (
int)png_pass_inc[
pass];
3937 for (
i = 0;
i < row_info->
width;
i++)
3944 for (
j = 0;
j < jstop;
j++)
3956 row_info->
width = final_width;
3959#ifndef PNG_READ_PACKSWAP_SUPPORTED
3976 for (
i =
bpp;
i < istop;
i++)
3978 *rp = (png_byte)(((
int)(*rp) + (
int)(*(rp-
bpp))) & 0xff);
3992 for (
i = 0;
i < istop;
i++)
3994 *rp = (png_byte)(((
int)(*rp) + (
int)(*pp++)) & 0xff);
4009 for (
i = 0;
i <
bpp;
i++)
4011 *rp = (png_byte)(((
int)(*rp) +
4012 ((
int)(*pp++) / 2 )) & 0xff);
4017 for (
i = 0;
i < istop;
i++)
4019 *rp = (png_byte)(((
int)(*rp) +
4020 (
int)(*pp++ + *(rp-
bpp)) / 2 ) & 0xff);
4036 *
row++ = (png_byte)
a;
4039 while (
row < rp_end)
4041 int b,
pa, pb, pc,
p;
4054 pa =
p < 0 ? -
p :
p;
4055 pb = pc < 0 ? -pc : pc;
4056 pc = (
p + pc) < 0 ? -(
p + pc) :
p + pc;
4073 *
row++ = (png_byte)
a;
4087 while (
row < rp_end)
4089 int a = *
row + *prev_row++;
4090 *
row++ = (png_byte)
a;
4096 while (
row < rp_end)
4098 int a,
b,
c,
pa, pb, pc,
p;
4100 c = *(prev_row -
bpp);
4112 pa =
p < 0 ? -
p :
p;
4113 pb = pc < 0 ? -pc : pc;
4114 pc = (
p + pc) < 0 ? -(
p + pc) :
p + pc;
4124 *
row++ = (png_byte)
a;
4140 unsigned int bpp = (pp->pixel_depth + 7) >> 3;
4147 png_read_filter_row_paeth_1byte_pixel;
4150 png_read_filter_row_paeth_multibyte_pixel;
4152#ifdef PNG_FILTER_OPTIMIZATIONS
4161 PNG_FILTER_OPTIMIZATIONS(pp,
bpp);
4175 if (pp->read_filter[0] ==
NULL)
4176 png_init_filter_functions(pp);
4178 pp->read_filter[
filter-1](row_info,
row, prev_row);
4182#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
4188 png_ptr->zstream.next_out = output;
4189 png_ptr->zstream.avail_out = 0;
4199 if (
png_ptr->zstream.avail_in == 0)
4204 while (
png_ptr->idat_size == 0)
4213 png_error(
png_ptr,
"Not enough image data");
4216 avail_in =
png_ptr->IDAT_read_size;
4218 if (avail_in > png_chunk_max(
png_ptr))
4221 if (avail_in >
png_ptr->idat_size)
4234 png_chunk_error(
png_ptr,
"out of memory");
4237 png_ptr->idat_size -= avail_in;
4240 png_ptr->zstream.avail_in = avail_in;
4248 if (
out > avail_out)
4257 png_ptr->zstream.next_out = tmpbuf;
4258 png_ptr->zstream.avail_out = (
sizeof tmpbuf);
4272 avail_out +=
png_ptr->zstream.avail_out;
4275 avail_out += (
sizeof tmpbuf) -
png_ptr->zstream.avail_out;
4277 png_ptr->zstream.avail_out = 0;
4288 png_chunk_benign_error(
png_ptr,
"Extra compressed data");
4305 }
while (avail_out > 0);
4313 png_error(
png_ptr,
"Not enough image data");
4316 png_chunk_benign_error(
png_ptr,
"Too much image data");
4354 png_ptr->zstream.avail_in = 0;
4393 png_pass_inc[
png_ptr->pass] - 1 -
4394 png_pass_start[
png_ptr->pass]) /
4400 png_pass_yinc[
png_ptr->pass] - 1 -
4401 png_pass_ystart[
png_ptr->pass]) /
4415 png_read_finish_IDAT(
png_ptr);
4422 unsigned int max_pixel_depth;
4427#ifdef PNG_READ_TRANSFORMS_SUPPORTED
4428 png_init_read_transformations(
png_ptr);
4434 png_pass_ystart[0]) / png_pass_yinc[0];
4440 png_pass_inc[
png_ptr->pass] - 1 -
4441 png_pass_start[
png_ptr->pass]) /
4451 max_pixel_depth = (
unsigned int)
png_ptr->pixel_depth;
4465 max_pixel_depth = 8;
4468#ifdef PNG_READ_EXPAND_SUPPORTED
4474 max_pixel_depth = 32;
4477 max_pixel_depth = 24;
4482 if (max_pixel_depth < 8)
4483 max_pixel_depth = 8;
4486 max_pixel_depth *= 2;
4493 max_pixel_depth *= 4;
4494 max_pixel_depth /= 3;
4500#ifdef PNG_READ_EXPAND_16_SUPPORTED
4503# ifdef PNG_READ_EXPAND_SUPPORTED
4510 max_pixel_depth *= 2;
4514 png_ptr->transformations &= ~PNG_EXPAND_16;
4518#ifdef PNG_READ_FILLER_SUPPORTED
4523 if (max_pixel_depth <= 8)
4524 max_pixel_depth = 16;
4527 max_pixel_depth = 32;
4533 if (max_pixel_depth <= 32)
4534 max_pixel_depth = 32;
4537 max_pixel_depth = 64;
4542#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
4555 if (max_pixel_depth <= 16)
4556 max_pixel_depth = 32;
4559 max_pixel_depth = 64;
4564 if (max_pixel_depth <= 8)
4567 max_pixel_depth = 32;
4570 max_pixel_depth = 24;
4574 max_pixel_depth = 64;
4577 max_pixel_depth = 48;
4582#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) && \
4583defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
4586 unsigned int user_pixel_depth =
png_ptr->user_transform_depth *
4587 png_ptr->user_transform_channels;
4589 if (user_pixel_depth > max_pixel_depth)
4590 max_pixel_depth = user_pixel_depth;
4597 png_ptr->maximum_pixel_depth = (png_byte)max_pixel_depth;
4598 png_ptr->transformed_pixel_depth = 0;
4608 1 + ((max_pixel_depth + 7) >> 3U);
4610#ifdef PNG_MAX_MALLOC_64K
4612 png_error(
png_ptr,
"This image requires a row greater than 64KB");
4615 if (row_bytes + 48 >
png_ptr->old_big_row_buf_size)
4629#ifdef PNG_ALIGNED_MEMORY_SUPPORTED
4651 png_ptr->old_big_row_buf_size = row_bytes + 48;
4654#ifdef PNG_MAX_MALLOC_64K
4655 if (
png_ptr->rowbytes > 65535)
4656 png_error(
png_ptr,
"This image requires a row greater than 64KB");
4660 png_error(
png_ptr,
"Row has too many bytes to allocate in memory");
4680 png_ptr->read_buffer_size = 0;
EXPORT int errmsg(char *msg, va_alist)
static int inflateReset2(z_streamp strm, int windowBits)
static int inflateReset(z_streamp strm)
int inflate(z_streamp strm, int flush)
UINT(* handler)(MSIPACKAGE *)
void CDECL terminate(void)
_ACRTIMP size_t __cdecl strlen(const char *)
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
GLuint GLuint GLsizei GLenum type
GLint GLint GLsizei GLsizei height
GLint GLint GLsizei width
GLboolean GLboolean GLboolean b
GLenum const GLfloat * params
GLenum GLuint GLenum GLsizei const GLchar * buf
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
GLuint GLsizei GLsizei * length
GLboolean GLboolean GLboolean GLboolean a
GLenum GLenum GLenum input
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
#define memcpy(s1, s2, n)
#define PNG_COLOR_TYPE_RGB
#define PNG_COLOR_TYPE_RGB_ALPHA
#define PNG_COLOR_TYPE_GRAY_ALPHA
#define PNG_COLOR_TYPE_GRAY
#define PNG_COLOR_TYPE_PALETTE
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK ULONG PVOID ULONG PVOID ULONG out_size
static unsigned(__cdecl *hash_bstr)(bstr_t s)
#define png_get_uint_16(buf)
#define PNG_MAXIMUM_INFLATE_WINDOW
#define PNG_HANDLE_CHUNK_IF_SAFE
#define png_get_int_32(buf)
#define PNG_MAX_PALETTE_LENGTH
#define PNG_ITXT_COMPRESSION_NONE
png_const_structrp png_const_inforp png_uint_32p png_uint_32p maximum_frame_average_light_level_scaled_by_10000 png_set_cLLI_fixed
#define PNG_EQUATION_ARBITRARY
#define PNG_TEXT_COMPRESSION_zTXt
#define PNG_EQUATION_BASE_E
#define PNG_PASS_START_COL(pass)
#define PNG_TEXT_COMPRESSION_NONE
#define PNG_EQUATION_LAST
#define PNG_FILTER_VALUE_AVG
png_sPLT_entry * png_sPLT_entryp
#define PNG_COLOR_MASK_COLOR
png_const_structrp png_const_inforp png_fixed_point *int_file_gamma png_set_gAMA_fixed
#define PNG_FILTER_VALUE_LAST
#define PNG_FILTER_VALUE_UP
struct png_sPLT_entry_struct png_sPLT_entry
#define PNG_IO_CHUNK_DATA
png_const_structrp png_const_inforp png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_uint_32p png_uint_32p mastering_display_minimum_luminance_scaled_by_10000 png_set_mDCV_fixed
#define png_get_uint_32(buf)
#define PNG_HANDLE_CHUNK_NEVER
#define PNG_HANDLE_CHUNK_ALWAYS
const png_struct *PNG_RESTRICT png_const_structrp
#define PNG_EQUATION_HYPERBOLIC
#define PNG_FILTER_VALUE_PAETH
#define PNG_FILTER_VALUE_NONE
png_info *PNG_RESTRICT png_inforp
#define PNG_PASS_COL_OFFSET(pass)
#define PNG_EQUATION_LINEAR
#define PNG_COMPRESSION_TYPE_BASE
#define PNG_FILTER_VALUE_SUB
#define PNG_HANDLE_CHUNK_AS_DEFAULT
png_struct *PNG_RESTRICT png_structrp
png_const_structrp png_const_inforp info_ptr
#define PNG_ITXT_COMPRESSION_zTXt
png_int_32 png_fixed_point
const png_byte * png_const_bytep
const png_uint_16 * png_const_uint_16p
png_uint_16 * png_uint_16p
png_uint_32 * png_uint_32p
const png_uint_32 * png_const_uint_32p
const char * png_const_charp
#define png_debug2(l, m, p1, p2)
#define png_debug1(l, m, p1)
#define PNG_INFLATE_BUF_SIZE
#define PNG_READ_EXPAND_SUPPORTED
#define PNG_READ_PACK_SUPPORTED
#define PNG_READ_FILLER_SUPPORTED
#define PNG_UNEXPECTED_ZLIB_RETURN
#define PNG_UNUSED(param)
#define PNG_HAVE_PNG_SIGNATURE
#define PNG_ROWBYTES(pixel_bits, width)
#define PNG_FLAG_CRC_CRITICAL_USE
#define PNG_FLAG_CRC_ANCILLARY_USE
#define png_app_error(pp, s)
#define png_app_warning(pp, s)
#define PNG_FLAG_BENIGN_ERRORS_WARN
#define PNG_FLAG_CRC_ANCILLARY_NOWARN
#define PNG_INFLATE(pp, flush)
#define PNG_USER_TRANSFORM
#define png_aligncastconst(type, value)
#define png_aligncast(type, value)
#define PNG_FLAG_CRC_ANCILLARY_MASK
#define PNG_U32(b1, b2, b3, b4)
#define PNG_CSTRING_FROM_CHUNK(s, c)
#define PNG_FLAG_CRC_CRITICAL_IGNORE
#define PNG_CHUNK_FROM_STRING(s)
#define PNG_FLAG_ZSTREAM_ENDED
#define PNG_FLAG_ZSTREAM_INITIALIZED
#define PNG_GAMMA_sRGB_INVERSE
#define png_isaligned(ptr, type)
#define PNG_FLAG_ROW_INIT
#define PNG_CHUNK_CRITICAL(c)
#define PNG_CHUNK_ANCILLARY(c)
#define png_voidcast(type, value)
#define PNG_STRING_FROM_CHUNK(s, c)
#define png_has_chunk(png_ptr, cHNK)
#define PNGZ_INPUT_CAST(b)
#define png_file_add_chunk(pnt_ptr, i)
#define png_file_has_chunk(png_ptr, i)
#define inflateInit2(strm, windowBits)
#define inflateInit(strm)
int ZEXPORT inflateValidate(z_streamp strm, int check)
wchar_t const *const size_t const buffer_size
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
_In_ LONG _In_ LONG Limit