Ticket #1249: libpng.diff
File libpng.diff, 76.9 KB (added by , 17 years ago) |
---|
-
src/libs/png/pngerror.c
1 1 2 2 /* pngerror.c - stub functions for i/o and memory allocation 3 3 * 4 * Last changed in libpng 1.2. 9 April 14, 20064 * Last changed in libpng 1.2.13 November 13, 2006 5 5 * For conditions of distribution and use, see copyright notice in png.h 6 6 * Copyright (c) 1998-2006 Glenn Randers-Pehrson 7 7 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) … … 113 113 * if the character is invalid. 114 114 */ 115 115 #define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97)) 116 static PNG_CONST char png_digit[16] = {116 const static PNG_CONST char png_digit[16] = { 117 117 '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 118 118 'A', 'B', 'C', 'D', 'E', 'F' 119 119 }; … … 157 157 char msg[18+64]; 158 158 if (png_ptr == NULL) 159 159 png_error(png_ptr, error_message); 160 png_format_buffer(png_ptr, msg, error_message); 161 png_error(png_ptr, msg); 160 else 161 { 162 png_format_buffer(png_ptr, msg, error_message); 163 png_error(png_ptr, msg); 164 } 162 165 } 163 166 164 167 void PNGAPI … … 167 170 char msg[18+64]; 168 171 if (png_ptr == NULL) 169 172 png_warning(png_ptr, warning_message); 170 png_format_buffer(png_ptr, msg, warning_message); 171 png_warning(png_ptr, msg); 173 else 174 { 175 png_format_buffer(png_ptr, msg, warning_message); 176 png_warning(png_ptr, msg); 177 } 172 178 } 173 179 174 180 /* This is the default error handling function. Note that replacements for … … 206 212 #endif 207 213 208 214 #ifdef PNG_SETJMP_SUPPORTED 215 if (png_ptr) 216 { 209 217 # ifdef USE_FAR_KEYWORD 210 218 { 211 219 jmp_buf jmpbuf; … … 214 222 } 215 223 # else 216 224 longjmp(png_ptr->jmpbuf, 1); 217 # endif 225 # endif 226 } 218 227 #else 219 /* make compiler happy */ ;220 if (png_ptr)221 228 PNG_ABORT(); 222 229 #endif 223 230 #ifdef PNG_NO_CONSOLE_IO -
src/libs/png/pngrio.c
1 1 2 2 /* pngrio.c - functions for data input 3 3 * 4 * Last changed in libpng 1.2. 9 April 14, 20064 * Last changed in libpng 1.2.13 November 13, 2006 5 5 * For conditions of distribution and use, see copyright notice in png.h 6 6 * Copyright (c) 1998-2006 Glenn Randers-Pehrson 7 7 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) … … 46 46 { 47 47 png_size_t check; 48 48 49 if(png_ptr == NULL) return; 49 50 /* fread() returns 0 on error, so it is OK to store this in a png_size_t 50 51 * instead of an int, which is what fread() actually returns. 51 52 */ … … 76 77 png_byte *n_data; 77 78 png_FILE_p io_ptr; 78 79 80 if(png_ptr == NULL) return; 79 81 /* Check if data really is near. If so, use usual code. */ 80 82 n_data = (png_byte *)CVT_PTR_NOCHECK(data); 81 83 io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr); … … 136 138 png_set_read_fn(png_structp png_ptr, png_voidp io_ptr, 137 139 png_rw_ptr read_data_fn) 138 140 { 141 if(png_ptr == NULL) return; 139 142 png_ptr->io_ptr = io_ptr; 140 143 141 144 #if !defined(PNG_NO_STDIO) -
src/libs/png/pngwrite.c
1 1 2 2 /* pngwrite.c - general routines to write a PNG file 3 3 * 4 * Last changed in libpng 1.2. 9 April 14, 20064 * Last changed in libpng 1.2.15 January 5, 2007 5 5 * For conditions of distribution and use, see copyright notice in png.h 6 * Copyright (c) 1998-200 6Glenn Randers-Pehrson6 * Copyright (c) 1998-2007 Glenn Randers-Pehrson 7 7 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) 8 8 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) 9 9 */ … … 461 461 462 462 #if !defined(PNG_1_0_X) 463 463 #ifdef PNG_ASSEMBLER_CODE_SUPPORTED 464 #ifdef PNG_MMX_CODE_SUPPORTED 464 465 png_init_mmx_flags(png_ptr); /* 1.2.0 addition */ 465 466 #endif 467 #endif 466 468 #endif /* PNG_1_0_X */ 467 469 468 470 /* added at libpng-1.2.6 */ … … 576 578 png_size_t png_struct_size, png_size_t png_info_size) 577 579 { 578 580 /* We only come here via pre-1.0.12-compiled applications */ 581 if(png_ptr == NULL) return; 579 582 #if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE) 580 583 if(png_sizeof(png_struct) > png_struct_size || 581 584 png_sizeof(png_info) > png_info_size) … … 670 673 671 674 #if !defined(PNG_1_0_X) 672 675 #ifdef PNG_ASSEMBLER_CODE_SUPPORTED 676 #ifdef PNG_MMX_CODE_SUPPORTED 673 677 png_init_mmx_flags(png_ptr); /* 1.2.0 addition */ 674 678 #endif 679 #endif 675 680 #endif /* PNG_1_0_X */ 676 681 677 682 #ifdef PNG_SETJMP_SUPPORTED -
src/libs/png/pngpread.c
1 1 2 2 /* pngpread.c - read a png file in push mode 3 3 * 4 * Last changed in libpng 1.2.1 1 - June 7, 20044 * Last changed in libpng 1.2.17 May 15, 2007 5 5 * For conditions of distribution and use, see copyright notice in png.h 6 * Copyright (c) 1998-200 6Glenn Randers-Pehrson6 * Copyright (c) 1998-2007 Glenn Randers-Pehrson 7 7 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) 8 8 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) 9 9 */ … … 28 28 png_process_data(png_structp png_ptr, png_infop info_ptr, 29 29 png_bytep buffer, png_size_t buffer_size) 30 30 { 31 if(png_ptr == NULL) return; 31 32 png_push_restore_buffer(png_ptr, buffer, buffer_size); 32 33 33 34 while (png_ptr->buffer_size) … … 42 43 void /* PRIVATE */ 43 44 png_process_some_data(png_structp png_ptr, png_infop info_ptr) 44 45 { 46 if(png_ptr == NULL) return; 45 47 switch (png_ptr->process_mode) 46 48 { 47 49 case PNG_READ_SIG_MODE: … … 561 563 { 562 564 png_bytep ptr; 563 565 566 if(png_ptr == NULL) return; 564 567 ptr = buffer; 565 568 if (png_ptr->save_buffer_size) 566 569 { … … 1485 1488 #if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) 1486 1489 if (png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS) 1487 1490 { 1488 png_unknown_chunk chunk;1489 1490 1491 #ifdef PNG_MAX_MALLOC_64K 1491 1492 if (length > (png_uint_32)65535L) 1492 1493 { … … 1495 1496 length = (png_uint_32)65535L; 1496 1497 } 1497 1498 #endif 1498 1499 png_strcpy((png_charp)chunk.name,(png_charp)png_ptr->chunk_name);1500 chunk.data = (png_bytep)png_malloc(png_ptr, length);1501 png_ crc_read(png_ptr, chunk.data, length);1502 chunk.size = length;1499 png_strcpy((png_charp)png_ptr->unknown_chunk.name, 1500 (png_charp)png_ptr->chunk_name); 1501 png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr, length); 1502 png_ptr->unknown_chunk.size = (png_size_t)length; 1503 png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length); 1503 1504 #if defined(PNG_READ_USER_CHUNKS_SUPPORTED) 1504 1505 if(png_ptr->read_user_chunk_fn != NULL) 1505 1506 { 1506 1507 /* callback to user unknown chunk handler */ 1507 if ((*(png_ptr->read_user_chunk_fn)) (png_ptr, &chunk) <= 0) 1508 int ret; 1509 ret = (*(png_ptr->read_user_chunk_fn)) 1510 (png_ptr, &png_ptr->unknown_chunk); 1511 if (ret < 0) 1512 png_chunk_error(png_ptr, "error in user chunk"); 1513 if (ret == 0) 1508 1514 { 1509 1515 if (!(png_ptr->chunk_name[0] & 0x20)) 1510 1516 if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) != 1511 1517 PNG_HANDLE_CHUNK_ALWAYS) 1512 1518 png_chunk_error(png_ptr, "unknown critical chunk"); 1519 png_set_unknown_chunks(png_ptr, info_ptr, 1520 &png_ptr->unknown_chunk, 1); 1513 1521 } 1514 png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1);1515 1522 } 1516 else 1523 #else 1524 png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1); 1517 1525 #endif 1518 png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1);1519 png_ free(png_ptr, chunk.data);1526 png_free(png_ptr, png_ptr->unknown_chunk.data); 1527 png_ptr->unknown_chunk.data = NULL; 1520 1528 } 1521 1529 else 1522 1530 #endif … … 1554 1562 const int FARDATA png_pass_dsp_mask[7] = 1555 1563 {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff}; 1556 1564 #endif 1565 if(png_ptr == NULL) return; 1557 1566 if (new_row != NULL) /* new_row must == png_ptr->row_buf here. */ 1558 1567 png_combine_row(png_ptr, old_row, png_pass_dsp_mask[png_ptr->pass]); 1559 1568 } … … 1563 1572 png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn, 1564 1573 png_progressive_end_ptr end_fn) 1565 1574 { 1575 if(png_ptr == NULL) return; 1566 1576 png_ptr->info_fn = info_fn; 1567 1577 png_ptr->row_fn = row_fn; 1568 1578 png_ptr->end_fn = end_fn; … … 1573 1583 png_voidp PNGAPI 1574 1584 png_get_progressive_ptr(png_structp png_ptr) 1575 1585 { 1586 if(png_ptr == NULL) return (NULL); 1576 1587 return png_ptr->io_ptr; 1577 1588 } 1578 1589 #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ -
src/libs/png/pngset.c
1 1 2 2 /* pngset.c - storage of image information into info struct 3 3 * 4 * Last changed in libpng 1.2. 9 April 14, 20064 * Last changed in libpng 1.2.17 May 15, 2007 5 5 * For conditions of distribution and use, see copyright notice in png.h 6 * Copyright (c) 1998-200 6Glenn Randers-Pehrson6 * Copyright (c) 1998-2007 Glenn Randers-Pehrson 7 7 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) 8 8 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) 9 9 * … … 877 877 textp->itxt_length = 0; 878 878 #endif 879 879 } 880 #if 0 /* appears to be redundant; */ 880 881 info_ptr->text[info_ptr->num_text]= *textp; 882 #endif 881 883 info_ptr->num_text++; 882 884 png_debug1(3, "transferred text chunk %d\n", info_ptr->num_text); 883 885 } … … 976 978 /* TODO: use png_malloc_warn */ 977 979 png_strcpy(to->name, from->name); 978 980 to->entries = (png_sPLT_entryp)png_malloc(png_ptr, 979 from->nentries * png_sizeof(png_sPLT_ t));981 from->nentries * png_sizeof(png_sPLT_entry)); 980 982 /* TODO: use png_malloc_warn */ 981 983 png_memcpy(to->entries, from->entries, 982 from->nentries * png_sizeof(png_sPLT_ t));984 from->nentries * png_sizeof(png_sPLT_entry)); 983 985 to->nentries = from->nentries; 984 986 to->depth = from->depth; 985 987 } … … 1191 1193 void PNGAPI 1192 1194 png_set_asm_flags (png_structp png_ptr, png_uint_32 asm_flags) 1193 1195 { 1196 #ifdef PNG_MMX_CODE_SUPPORTED 1194 1197 png_uint_32 settable_asm_flags; 1195 1198 png_uint_32 settable_mmx_flags; 1196 1199 #endif 1197 1200 if (png_ptr == NULL) 1198 1201 return; 1202 #ifdef PNG_MMX_CODE_SUPPORTED 1199 1203 1200 1204 settable_mmx_flags = 1201 #ifdef PNG_HAVE_ ASSEMBLER_COMBINE_ROW1205 #ifdef PNG_HAVE_MMX_COMBINE_ROW 1202 1206 PNG_ASM_FLAG_MMX_READ_COMBINE_ROW | 1203 1207 #endif 1204 #ifdef PNG_HAVE_ ASSEMBLER_READ_INTERLACE1208 #ifdef PNG_HAVE_MMX_READ_INTERLACE 1205 1209 PNG_ASM_FLAG_MMX_READ_INTERLACE | 1206 1210 #endif 1207 #ifdef PNG_HAVE_ ASSEMBLER_READ_FILTER_ROW1211 #ifdef PNG_HAVE_MMX_READ_FILTER_ROW 1208 1212 PNG_ASM_FLAG_MMX_READ_FILTER_SUB | 1209 1213 PNG_ASM_FLAG_MMX_READ_FILTER_UP | 1210 1214 PNG_ASM_FLAG_MMX_READ_FILTER_AVG | … … 1224 1228 } 1225 1229 1226 1230 /* we're replacing the settable bits with those passed in by the user, 1227 * so first zero them out of the master copy, then logical-OR in the1231 * so first zero them out of the master copy, then bitwise-OR in the 1228 1232 * allowed subset that was requested */ 1229 1233 1230 1234 png_ptr->asm_flags &= ~settable_asm_flags; /* zero them */ 1231 1235 png_ptr->asm_flags |= (asm_flags & settable_asm_flags); /* set them */ 1236 #endif /* ?PNG_MMX_CODE_SUPPORTED */ 1232 1237 } 1233 #endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */1234 1238 1235 #ifdef PNG_ASSEMBLER_CODE_SUPPORTED1236 1239 /* this function was added to libpng 1.2.0 */ 1237 1240 void PNGAPI 1238 1241 png_set_mmx_thresholds (png_structp png_ptr, … … 1241 1244 { 1242 1245 if (png_ptr == NULL) 1243 1246 return; 1247 #ifdef PNG_MMX_CODE_SUPPORTED 1244 1248 png_ptr->mmx_bitdepth_threshold = mmx_bitdepth_threshold; 1245 1249 png_ptr->mmx_rowbytes_threshold = mmx_rowbytes_threshold; 1250 #endif /* ?PNG_MMX_CODE_SUPPORTED */ 1246 1251 } 1247 1252 #endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */ 1248 1253 … … 1256 1261 * rejected by png_set_IHDR(). To accept any PNG datastream 1257 1262 * regardless of dimensions, set both limits to 0x7ffffffL. 1258 1263 */ 1264 if(png_ptr == NULL) return; 1259 1265 png_ptr->user_width_max = user_width_max; 1260 1266 png_ptr->user_height_max = user_height_max; 1261 1267 } -
src/libs/png/LICENSE
8 8 If you modify libpng you may insert additional notices immediately following 9 9 this sentence. 10 10 11 libpng versions 1.2.6, August 15, 2004, through 1.2.1 2, June 27, 2006, are12 Copyright (c) 2004, 2006 Glenn Randers-Pehrson, and are11 libpng versions 1.2.6, August 15, 2004, through 1.2.18, May 15, 2007, are 12 Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are 13 13 distributed according to the same disclaimer and license as libpng-1.2.5 14 14 with the following individual added to the list of Contributing Authors 15 15 … … 106 106 107 107 Glenn Randers-Pehrson 108 108 glennrp at users.sourceforge.net 109 June 27, 2006 109 May 15, 2007 -
src/libs/png/pngwio.c
1 1 2 2 /* pngwio.c - functions for data output 3 3 * 4 * Last changed in libpng 1.2. 3 - May 21, 20024 * Last changed in libpng 1.2.13 November 13, 2006 5 5 * For conditions of distribution and use, see copyright notice in png.h 6 6 * Copyright (c) 1998-2002 Glenn Randers-Pehrson 7 7 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) … … 45 45 { 46 46 png_uint_32 check; 47 47 48 if(png_ptr == NULL) return; 48 49 #if defined(_WIN32_WCE) 49 50 if ( !WriteFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) ) 50 51 check = 0; … … 70 71 png_byte *near_data; /* Needs to be "png_byte *" instead of "png_bytep" */ 71 72 png_FILE_p io_ptr; 72 73 74 if(png_ptr == NULL) return; 73 75 /* Check if data really is near. If so, use usual code. */ 74 76 near_data = (png_byte *)CVT_PTR_NOCHECK(data); 75 77 io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr); … … 131 133 { 132 134 #if !defined(_WIN32_WCE) 133 135 png_FILE_p io_ptr; 136 #endif 137 if(png_ptr == NULL) return; 138 #if !defined(_WIN32_WCE) 134 139 io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr)); 135 140 if (io_ptr != NULL) 136 141 fflush(io_ptr); … … 165 170 png_set_write_fn(png_structp png_ptr, png_voidp io_ptr, 166 171 png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn) 167 172 { 173 if(png_ptr == NULL) return; 168 174 png_ptr->io_ptr = io_ptr; 169 175 170 176 #if !defined(PNG_NO_STDIO) -
src/libs/png/pngrutil.c
1 1 2 2 /* pngrutil.c - utilities to read a PNG file 3 3 * 4 * Last changed in libpng 1.2.1 1 June 4, 20064 * Last changed in libpng 1.2.17 May 15, 2007 5 5 * For conditions of distribution and use, see copyright notice in png.h 6 * Copyright (c) 1998-200 6Glenn Randers-Pehrson6 * Copyright (c) 1998-2007 Glenn Randers-Pehrson 7 7 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) 8 8 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) 9 9 * … … 16 16 17 17 #if defined(PNG_READ_SUPPORTED) 18 18 19 #if defined(_WIN32_WCE) 19 #ifdef PNG_FLOATING_POINT_SUPPORTED 20 # if defined(_WIN32_WCE) 20 21 /* strtod() function is not supported on WindowsCE */ 21 # ifdef PNG_FLOATING_POINT_SUPPORTED 22 __inline double strtod(const char *nptr, char **endptr) 22 __inline double png_strtod(png_structp png_ptr, const char *nptr, char **endptr) 23 23 { 24 24 double result = 0; 25 25 int len; 26 26 wchar_t *str, *end; 27 27 28 28 len = MultiByteToWideChar(CP_ACP, 0, nptr, -1, NULL, 0); 29 str = (wchar_t *) malloc(len * sizeof(wchar_t));29 str = (wchar_t *)png_malloc(png_ptr, len * sizeof(wchar_t)); 30 30 if ( NULL != str ) 31 31 { 32 32 MultiByteToWideChar(CP_ACP, 0, nptr, -1, str, len); 33 33 result = wcstod(str, &end); 34 34 len = WideCharToMultiByte(CP_ACP, 0, end, -1, NULL, 0, NULL, NULL); 35 35 *endptr = (char *)nptr + (png_strlen(nptr) - len + 1); 36 free(str);36 png_free(str); 37 37 } 38 38 return result; 39 39 } 40 # else 41 # define png_strtod(p,a,b) strtod(a,b) 40 42 # endif 41 43 #endif 42 44 … … 90 92 void /* PRIVATE */ 91 93 png_crc_read(png_structp png_ptr, png_bytep buf, png_size_t length) 92 94 { 95 if(png_ptr == NULL) return; 93 96 png_read_data(png_ptr, buf, length); 94 97 png_calculate_crc(png_ptr, buf, length); 95 98 } … … 178 181 png_charp chunkdata, png_size_t chunklength, 179 182 png_size_t prefix_size, png_size_t *newlength) 180 183 { 181 static char msg[] = "Error decoding compressed text";184 const static char msg[] = "Error decoding compressed text"; 182 185 png_charp text; 183 186 png_size_t text_size; 184 187 … … 1311 1314 } 1312 1315 1313 1316 if (png_crc_finish(png_ptr, 0)) 1317 { 1318 png_ptr->num_trans = 0; 1314 1319 return; 1320 } 1315 1321 1316 1322 png_set_tRNS(png_ptr, info_ptr, readbuf, png_ptr->num_trans, 1317 1323 &(png_ptr->trans_values)); … … 1730 1736 ep = buffer + 1; /* skip unit byte */ 1731 1737 1732 1738 #ifdef PNG_FLOATING_POINT_SUPPORTED 1733 width = strtod(ep, &vp);1739 width = png_strtod(png_ptr, ep, &vp); 1734 1740 if (*vp) 1735 1741 { 1736 1742 png_warning(png_ptr, "malformed width string in sCAL chunk"); … … 1753 1759 ep++; 1754 1760 1755 1761 #ifdef PNG_FLOATING_POINT_SUPPORTED 1756 height = strtod(ep, &vp);1762 height = png_strtod(png_ptr, ep, &vp); 1757 1763 if (*vp) 1758 1764 { 1759 1765 png_warning(png_ptr, "malformed height string in sCAL chunk"); … … 2170 2176 if ((png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS) || 2171 2177 (png_ptr->read_user_chunk_fn != NULL)) 2172 2178 { 2173 png_unknown_chunk chunk;2174 2175 2179 #ifdef PNG_MAX_MALLOC_64K 2176 2180 if (length > (png_uint_32)65535L) 2177 2181 { … … 2180 2184 length = (png_uint_32)65535L; 2181 2185 } 2182 2186 #endif 2183 png_strcpy((png_charp)chunk.name, (png_charp)png_ptr->chunk_name); 2184 chunk.data = (png_bytep)png_malloc(png_ptr, length); 2185 chunk.size = (png_size_t)length; 2186 png_crc_read(png_ptr, (png_bytep)chunk.data, length); 2187 png_strcpy((png_charp)png_ptr->unknown_chunk.name, 2188 (png_charp)png_ptr->chunk_name); 2189 png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr, length); 2190 png_ptr->unknown_chunk.size = (png_size_t)length; 2191 png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length); 2187 2192 #if defined(PNG_READ_USER_CHUNKS_SUPPORTED) 2188 2193 if(png_ptr->read_user_chunk_fn != NULL) 2189 2194 { 2190 2195 /* callback to user unknown chunk handler */ 2191 if ((*(png_ptr->read_user_chunk_fn)) (png_ptr, &chunk) <= 0) 2196 int ret; 2197 ret = (*(png_ptr->read_user_chunk_fn)) 2198 (png_ptr, &png_ptr->unknown_chunk); 2199 if (ret < 0) 2200 png_chunk_error(png_ptr, "error in user chunk"); 2201 if (ret == 0) 2192 2202 { 2193 2203 if (!(png_ptr->chunk_name[0] & 0x20)) 2194 2204 if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) != 2195 2205 PNG_HANDLE_CHUNK_ALWAYS) 2196 {2197 png_free(png_ptr, chunk.data);2198 2206 png_chunk_error(png_ptr, "unknown critical chunk"); 2199 }2200 png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1);2207 png_set_unknown_chunks(png_ptr, info_ptr, 2208 &png_ptr->unknown_chunk, 1); 2201 2209 } 2202 2210 } 2203 else 2211 #else 2212 png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1); 2204 2213 #endif 2205 png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1);2206 png_ free(png_ptr, chunk.data);2214 png_free(png_ptr, png_ptr->unknown_chunk.data); 2215 png_ptr->unknown_chunk.data = NULL; 2207 2216 } 2208 2217 else 2209 2218 #endif … … 2246 2255 a zero indicates the pixel is to be skipped. This is in addition 2247 2256 to any alpha or transparency value associated with the pixel. If 2248 2257 you want all pixels to be combined, pass 0xff (255) in mask. */ 2249 #ifndef PNG_HAVE_ ASSEMBLER_COMBINE_ROW2258 #ifndef PNG_HAVE_MMX_COMBINE_ROW 2250 2259 void /* PRIVATE */ 2251 2260 png_combine_row(png_structp png_ptr, png_bytep row, int mask) 2252 2261 { … … 2447 2456 } 2448 2457 } 2449 2458 } 2450 #endif /* !PNG_HAVE_ ASSEMBLER_COMBINE_ROW */2459 #endif /* !PNG_HAVE_MMX_COMBINE_ROW */ 2451 2460 2452 2461 #ifdef PNG_READ_INTERLACING_SUPPORTED 2453 #ifndef PNG_HAVE_ ASSEMBLER_READ_INTERLACE /* else in pngvcrd.c, pnggccrd.c */2462 #ifndef PNG_HAVE_MMX_READ_INTERLACE /* else in pngvcrd.c, pnggccrd.c */ 2454 2463 /* OLD pre-1.0.9 interface: 2455 2464 void png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, 2456 2465 png_uint_32 transformations) … … 2676 2685 return; 2677 2686 #endif 2678 2687 } 2679 #endif /* !PNG_HAVE_ ASSEMBLER_READ_INTERLACE */2688 #endif /* !PNG_HAVE_MMX_READ_INTERLACE */ 2680 2689 #endif /* PNG_READ_INTERLACING_SUPPORTED */ 2681 2690 2682 #ifndef PNG_HAVE_ ASSEMBLER_READ_FILTER_ROW2691 #ifndef PNG_HAVE_MMX_READ_FILTER_ROW 2683 2692 void /* PRIVATE */ 2684 2693 png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row, 2685 2694 png_bytep prev_row, int filter) … … 2802 2811 break; 2803 2812 } 2804 2813 } 2805 #endif /* !PNG_HAVE_ ASSEMBLER_READ_FILTER_ROW */2814 #endif /* !PNG_HAVE_MMX_READ_FILTER_ROW */ 2806 2815 2807 2816 void /* PRIVATE */ 2808 2817 png_read_finish_row(png_structp png_ptr) … … 3104 3113 if ((png_uint_32)png_ptr->rowbytes + 1 > (png_uint_32)65536L) 3105 3114 png_error(png_ptr, "This image requires a row greater than 64KB"); 3106 3115 #endif 3107 if ((png_uint_32)png_ptr->rowbytes > PNG_SIZE_MAX - 1)3116 if ((png_uint_32)png_ptr->rowbytes > (png_uint_32)(PNG_SIZE_MAX - 1)) 3108 3117 png_error(png_ptr, "Row has too many bytes to allocate in memory."); 3109 3118 png_ptr->prev_row = (png_bytep)png_malloc(png_ptr, (png_uint_32)( 3110 3119 png_ptr->rowbytes + 1)); -
src/libs/png/pngwutil.c
1 1 2 2 /* pngwutil.c - utilities to write a PNG file 3 3 * 4 * Last changed in libpng 1.2.1 1 June 4, 20064 * Last changed in libpng 1.2.15 January 5, 2007 5 5 * For conditions of distribution and use, see copyright notice in png.h 6 * Copyright (c) 1998-200 6Glenn Randers-Pehrson6 * Copyright (c) 1998-2007 Glenn Randers-Pehrson 7 7 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) 8 8 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) 9 9 */ … … 62 62 png_write_chunk(png_structp png_ptr, png_bytep chunk_name, 63 63 png_bytep data, png_size_t length) 64 64 { 65 if(png_ptr == NULL) return; 65 66 png_write_chunk_start(png_ptr, chunk_name, (png_uint_32)length); 66 67 png_write_chunk_data(png_ptr, data, length); 67 68 png_write_chunk_end(png_ptr); … … 77 78 { 78 79 png_byte buf[4]; 79 80 png_debug2(0, "Writing %s chunk (%lu bytes)\n", chunk_name, length); 81 if(png_ptr == NULL) return; 80 82 81 83 /* write the length */ 82 84 png_save_uint_32(buf, length); … … 98 100 png_write_chunk_data(png_structp png_ptr, png_bytep data, png_size_t length) 99 101 { 100 102 /* write the data, and run the CRC over it */ 103 if(png_ptr == NULL) return; 101 104 if (data != NULL && length > 0) 102 105 { 103 106 png_calculate_crc(png_ptr, data, length); … … 111 114 { 112 115 png_byte buf[4]; 113 116 117 if(png_ptr == NULL) return; 118 114 119 /* write the crc */ 115 120 png_save_uint_32(buf, png_ptr->crc); 116 121 … … 518 523 png_ptr->zlib_window_bits = 15; 519 524 if (!(png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_METHOD)) 520 525 png_ptr->zlib_method = 8; 521 deflateInit2(&png_ptr->zstream, png_ptr->zlib_level,526 if (deflateInit2(&png_ptr->zstream, png_ptr->zlib_level, 522 527 png_ptr->zlib_method, png_ptr->zlib_window_bits, 523 png_ptr->zlib_mem_level, png_ptr->zlib_strategy); 528 png_ptr->zlib_mem_level, png_ptr->zlib_strategy) != Z_OK) 529 png_error(png_ptr, "zlib failed to initialize compressor"); 524 530 png_ptr->zstream.next_out = png_ptr->zbuf; 525 531 png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; 526 532 /* libpng is not interested in zstream.data_type */ … … 728 734 png_size_t name_len; 729 735 png_charp new_name; 730 736 compression_state comp; 737 int embedded_profile_len = 0; 731 738 732 739 png_debug(1, "in png_write_iCCP\n"); 733 740 … … 750 757 if (profile == NULL) 751 758 profile_len = 0; 752 759 760 if (profile_len > 3) 761 embedded_profile_len = 762 ((*( (png_bytep)profile ))<<24) | 763 ((*( (png_bytep)profile+1))<<16) | 764 ((*( (png_bytep)profile+2))<< 8) | 765 ((*( (png_bytep)profile+3)) ); 766 767 if (profile_len < embedded_profile_len) 768 { 769 png_warning(png_ptr, 770 "Embedded profile length too large in iCCP chunk"); 771 return; 772 } 773 774 if (profile_len > embedded_profile_len) 775 { 776 png_warning(png_ptr, 777 "Truncating profile to actual length in iCCP chunk"); 778 profile_len = embedded_profile_len; 779 } 780 753 781 if (profile_len) 754 782 profile_len = png_text_compress(png_ptr, profile, (png_size_t)profile_len, 755 783 PNG_COMPRESSION_TYPE_BASE, &comp); -
src/libs/png/pngread.c
1 1 2 2 /* pngread.c - read a PNG file 3 3 * 4 * Last changed in libpng 1.2.1 1 June 7, 20064 * Last changed in libpng 1.2.15 January 5, 2007 5 5 * For conditions of distribution and use, see copyright notice in png.h 6 * Copyright (c) 1998-200 6Glenn Randers-Pehrson6 * Copyright (c) 1998-2007 Glenn Randers-Pehrson 7 7 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) 8 8 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) 9 9 * … … 56 56 return (NULL); 57 57 58 58 #if !defined(PNG_1_0_X) 59 #ifdef PNG_ ASSEMBLER_CODE_SUPPORTED59 #ifdef PNG_MMX_CODE_SUPPORTED 60 60 png_init_mmx_flags(png_ptr); /* 1.2.0 addition */ 61 61 #endif 62 62 #endif /* PNG_1_0_X */ … … 188 188 png_size_t png_struct_size, png_size_t png_info_size) 189 189 { 190 190 /* We only come here via pre-1.0.12-compiled applications */ 191 if(png_ptr == NULL) return; 191 192 #if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE) 192 193 if(png_sizeof(png_struct) > png_struct_size || 193 194 png_sizeof(png_info) > png_info_size) … … 239 240 240 241 png_structp png_ptr=*ptr_ptr; 241 242 243 if(png_ptr == NULL) return; 244 242 245 do 243 246 { 244 247 if(user_png_ver[i] != png_libpng_ver[i]) … … 317 320 void PNGAPI 318 321 png_read_info(png_structp png_ptr, png_infop info_ptr) 319 322 { 323 if(png_ptr == NULL) return; 320 324 png_debug(1, "in png_read_info\n"); 321 325 /* If we haven't checked all of the PNG signature bytes, do so now. */ 322 326 if (png_ptr->sig_bytes < 8) … … 533 537 png_read_update_info(png_structp png_ptr, png_infop info_ptr) 534 538 { 535 539 png_debug(1, "in png_read_update_info\n"); 540 if(png_ptr == NULL) return; 536 541 if (!(png_ptr->flags & PNG_FLAG_ROW_INIT)) 537 542 png_read_start_row(png_ptr); 538 543 else … … 551 556 png_start_read_image(png_structp png_ptr) 552 557 { 553 558 png_debug(1, "in png_start_read_image\n"); 559 if(png_ptr == NULL) return; 554 560 if (!(png_ptr->flags & PNG_FLAG_ROW_INIT)) 555 561 png_read_start_row(png_ptr); 556 562 } … … 566 572 const int png_pass_mask[7] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff}; 567 573 #endif 568 574 int ret; 575 if(png_ptr == NULL) return; 569 576 png_debug2(1, "in png_read_row (row %lu, pass %d)\n", 570 577 png_ptr->row_number, png_ptr->pass); 571 578 if (!(png_ptr->flags & PNG_FLAG_ROW_INIT)) … … 824 831 png_bytepp dp; 825 832 826 833 png_debug(1, "in png_read_rows\n"); 834 if(png_ptr == NULL) return; 827 835 rp = row; 828 836 dp = display_row; 829 837 if (rp != NULL && dp != NULL) … … 872 880 png_bytepp rp; 873 881 874 882 png_debug(1, "in png_read_image\n"); 883 if(png_ptr == NULL) return; 875 884 876 885 #ifdef PNG_READ_INTERLACING_SUPPORTED 877 886 pass = png_set_interlace_handling(png_ptr); … … 910 919 png_uint_32 length; 911 920 912 921 png_debug(1, "in png_read_end\n"); 922 if(png_ptr == NULL) return; 913 923 png_crc_finish(png_ptr, 0); /* Finish off CRC from last IDAT chunk */ 914 924 915 925 do … … 1300 1310 void PNGAPI 1301 1311 png_set_read_status_fn(png_structp png_ptr, png_read_status_ptr read_row_fn) 1302 1312 { 1313 if(png_ptr == NULL) return; 1303 1314 png_ptr->read_row_fn = read_row_fn; 1304 1315 } 1305 1316 … … 1313 1324 { 1314 1325 int row; 1315 1326 1327 if(png_ptr == NULL) return; 1316 1328 #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) 1317 1329 /* invert the alpha channel from opacity to transparency 1318 1330 */ -
src/libs/png/pngmem.c
1 1 2 2 /* pngmem.c - stub functions for memory allocation 3 3 * 4 * Last changed in libpng 1.2. 9 April 14, 20064 * Last changed in libpng 1.2.13 November 13, 2006 5 5 * For conditions of distribution and use, see copyright notice in png.h 6 6 * Copyright (c) 1998-2006 Glenn Randers-Pehrson 7 7 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) … … 137 137 png_voidp ret; 138 138 #endif /* PNG_USER_MEM_SUPPORTED */ 139 139 140 if (png_ptr == NULL || size == 0) 141 return (NULL); 142 140 143 #ifdef PNG_MAX_MALLOC_64K 141 144 if (size > (png_uint_32)65536L) 142 145 { … … 290 293 { 291 294 #endif /* PNG_USER_MEM_SUPPORTED */ 292 295 296 if(png_ptr == NULL) return; 297 293 298 if (png_ptr->offset_table != NULL) 294 299 { 295 300 int i; … … 536 541 png_malloc_warn(png_structp png_ptr, png_uint_32 size) 537 542 { 538 543 png_voidp ptr; 539 png_uint_32 save_flags=png_ptr->flags; 544 png_uint_32 save_flags; 545 if(png_ptr == NULL) return (NULL); 540 546 547 save_flags=png_ptr->flags; 541 548 png_ptr->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK; 542 549 ptr = (png_voidp)png_malloc((png_structp)png_ptr, size); 543 550 png_ptr->flags=save_flags; … … 580 587 png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr 581 588 malloc_fn, png_free_ptr free_fn) 582 589 { 590 if(png_ptr != NULL) { 583 591 png_ptr->mem_ptr = mem_ptr; 584 592 png_ptr->malloc_fn = malloc_fn; 585 593 png_ptr->free_fn = free_fn; 594 } 586 595 } 587 596 588 597 /* This function returns a pointer to the mem_ptr associated with the user … … 592 601 png_voidp PNGAPI 593 602 png_get_mem_ptr(png_structp png_ptr) 594 603 { 604 if(png_ptr == NULL) return (NULL); 595 605 return ((png_voidp)png_ptr->mem_ptr); 596 606 } 597 607 #endif /* PNG_USER_MEM_SUPPORTED */ -
src/libs/png/pngget.c
1 1 2 2 /* pngget.c - retrieval of values from info struct 3 3 * 4 * Last changed in libpng 1.2. 9 April 14, 20064 * Last changed in libpng 1.2.15 January 5, 2007 5 5 * For conditions of distribution and use, see copyright notice in png.h 6 * Copyright (c) 1998-200 6Glenn Randers-Pehrson6 * Copyright (c) 1998-2007 Glenn Randers-Pehrson 7 7 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) 8 8 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) 9 9 */ … … 829 829 } 830 830 #endif 831 831 832 #ifdef PNG_ASSEMBLER_CODE_SUPPORTED 832 833 #ifndef PNG_1_0_X 833 #ifdef PNG_ASSEMBLER_CODE_SUPPORTED834 834 /* this function was added to libpng 1.2.0 and should exist by default */ 835 835 png_uint_32 PNGAPI 836 836 png_get_asm_flags (png_structp png_ptr) 837 837 { 838 #ifdef PNG_MMX_CODE_SUPPORTED 838 839 return (png_uint_32)(png_ptr? png_ptr->asm_flags : 0L); 840 #else 841 return (png_ptr? 0L: 0L); 842 #endif 839 843 } 840 844 841 845 /* this function was added to libpng 1.2.0 and should exist by default */ 842 846 png_uint_32 PNGAPI 843 847 png_get_asm_flagmask (int flag_select) 844 848 { 849 #ifdef PNG_MMX_CODE_SUPPORTED 845 850 png_uint_32 settable_asm_flags = 0; 846 851 847 852 if (flag_select & PNG_SELECT_READ) … … 862 867 #endif /* 0 */ 863 868 864 869 return settable_asm_flags; /* _theoretically_ settable capabilities only */ 870 #else 871 return (0L); 872 #endif /* PNG_MMX_CODE_SUPPORTED */ 865 873 } 866 #endif /* PNG_ASSEMBLER_CODE_SUPPORTED */867 874 868 875 869 #if defined(PNG_ASSEMBLER_CODE_SUPPORTED)870 876 /* GRR: could add this: && defined(PNG_MMX_CODE_SUPPORTED) */ 871 877 /* this function was added to libpng 1.2.0 */ 872 878 png_uint_32 PNGAPI 873 879 png_get_mmx_flagmask (int flag_select, int *compilerID) 874 880 { 881 #if defined(PNG_MMX_CODE_SUPPORTED) 875 882 png_uint_32 settable_mmx_flags = 0; 876 883 877 884 if (flag_select & PNG_SELECT_READ) … … 902 909 } 903 910 904 911 return settable_mmx_flags; /* _theoretically_ settable capabilities only */ 912 #else 913 return (0L); 914 #endif /* ?PNG_MMX_CODE_SUPPORTED */ 905 915 } 906 916 907 917 /* this function was added to libpng 1.2.0 */ 908 918 png_byte PNGAPI 909 919 png_get_mmx_bitdepth_threshold (png_structp png_ptr) 910 920 { 921 #if defined(PNG_MMX_CODE_SUPPORTED) 911 922 return (png_byte)(png_ptr? png_ptr->mmx_bitdepth_threshold : 0); 923 #else 924 return (png_ptr? 0: 0); 925 #endif /* ?PNG_MMX_CODE_SUPPORTED */ 912 926 } 913 927 914 928 /* this function was added to libpng 1.2.0 */ 915 929 png_uint_32 PNGAPI 916 930 png_get_mmx_rowbytes_threshold (png_structp png_ptr) 917 931 { 932 #if defined(PNG_MMX_CODE_SUPPORTED) 918 933 return (png_uint_32)(png_ptr? png_ptr->mmx_rowbytes_threshold : 0L); 934 #else 935 return (png_ptr? 0L: 0L); 936 #endif /* ?PNG_MMX_CODE_SUPPORTED */ 919 937 } 938 #endif /* ?PNG_1_0_X */ 920 939 #endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */ 921 #endif /* ?PNG_1_0_X */922 940 923 941 #ifdef PNG_SET_USER_LIMITS_SUPPORTED 924 942 /* these functions were added to libpng 1.2.6 */ -
src/libs/png/png.c
1 1 2 2 /* png.c - location for general purpose libpng functions 3 3 * 4 * Last changed in libpng 1.2. 9 April 14, 20064 * Last changed in libpng 1.2.17 May 15, 2007 5 5 * For conditions of distribution and use, see copyright notice in png.h 6 * Copyright (c) 1998-200 6Glenn Randers-Pehrson6 * Copyright (c) 1998-2007 Glenn Randers-Pehrson 7 7 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) 8 8 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) 9 9 */ … … 13 13 #include "png.h" 14 14 15 15 /* Generate a compiler error if there is an old png.h in the search path. */ 16 typedef version_1_2_1 2 Your_png_h_is_not_version_1_2_12;16 typedef version_1_2_18 Your_png_h_is_not_version_1_2_18; 17 17 18 18 /* Version information for C files. This had better match the version 19 19 * string defined in png.h. */ … … 68 68 const int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2}; 69 69 70 70 /* width of interlace block (used in assembler routines only) */ 71 #ifdef PNG_HAVE_ ASSEMBLER_COMBINE_ROW71 #ifdef PNG_HAVE_MMX_COMBINE_ROW 72 72 const int FARDATA png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; 73 73 #endif 74 74 … … 97 97 void PNGAPI 98 98 png_set_sig_bytes(png_structp png_ptr, int num_bytes) 99 99 { 100 if(png_ptr == NULL) return; 100 101 png_debug(1, "in png_set_sig_bytes\n"); 101 102 if (num_bytes > 8) 102 103 png_error(png_ptr, "Too many bytes for PNG signature."); … … 153 154 png_zalloc(voidpf png_ptr, uInt items, uInt size) 154 155 { 155 156 png_voidp ptr; 156 png_structp p= png_ptr;157 png_structp p=(png_structp)png_ptr; 157 158 png_uint_32 save_flags=p->flags; 158 159 png_uint_32 num_bytes; 159 160 161 if(png_ptr == NULL) return (NULL); 160 162 if (items > PNG_UINT_32_MAX/size) 161 163 { 162 png_warning (p ng_ptr, "Potential overflow in png_zalloc()");164 png_warning (p, "Potential overflow in png_zalloc()"); 163 165 return (NULL); 164 166 } 165 167 num_bytes = (png_uint_32)items * size; … … 266 268 png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr) 267 269 { 268 270 png_infop info_ptr = NULL; 271 if(png_ptr == NULL) return; 269 272 270 273 png_debug(1, "in png_destroy_info_struct\n"); 271 274 if (info_ptr_ptr != NULL) … … 304 307 { 305 308 png_infop info_ptr = *ptr_ptr; 306 309 310 if(info_ptr == NULL) return; 311 307 312 png_debug(1, "in png_info_init_3\n"); 308 313 309 314 if(png_sizeof(png_info) > png_info_struct_size) … … 485 490 #endif 486 491 487 492 #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) 493 if(png_ptr->unknown_chunk.data) 494 { 495 png_free(png_ptr, png_ptr->unknown_chunk.data); 496 png_ptr->unknown_chunk.data = NULL; 497 } 488 498 #ifdef PNG_FREE_ME_SUPPORTED 489 499 if ((mask & PNG_FREE_UNKN) & info_ptr->free_me) 490 500 #else … … 611 621 png_voidp PNGAPI 612 622 png_get_io_ptr(png_structp png_ptr) 613 623 { 624 if(png_ptr == NULL) return (NULL); 614 625 return (png_ptr->io_ptr); 615 626 } 616 627 … … 626 637 png_init_io(png_structp png_ptr, png_FILE_p fp) 627 638 { 628 639 png_debug(1, "in png_init_io\n"); 640 if(png_ptr == NULL) return; 629 641 png_ptr->io_ptr = (png_voidp)fp; 630 642 } 631 643 #endif … … 641 653 {"Jan", "Feb", "Mar", "Apr", "May", "Jun", 642 654 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; 643 655 656 if(png_ptr == NULL) return (NULL); 644 657 if (png_ptr->time_buffer == NULL) 645 658 { 646 659 png_ptr->time_buffer = (png_charp)png_malloc(png_ptr, (png_uint_32)(29* … … 693 706 png_get_copyright(png_structp png_ptr) 694 707 { 695 708 if (&png_ptr != NULL) /* silence compiler warning about unused png_ptr */ 696 return ((png_charp) "\n libpng version 1.2.1 2 - June 27, 2006\n\697 Copyright (c) 1998-200 6Glenn Randers-Pehrson\n\709 return ((png_charp) "\n libpng version 1.2.18 - May 15, 2007\n\ 710 Copyright (c) 1998-2007 Glenn Randers-Pehrson\n\ 698 711 Copyright (c) 1996-1997 Andreas Dilger\n\ 699 712 Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n"); 700 713 return ((png_charp) ""); … … 757 770 int PNGAPI 758 771 png_reset_zstream(png_structp png_ptr) 759 772 { 773 if (png_ptr == NULL) return Z_STREAM_ERROR; 760 774 return (inflateReset(&png_ptr->zstream)); 761 775 } 762 776 #endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */ … … 770 784 } 771 785 772 786 773 #if defined(PNG_READ_SUPPORTED) 787 #if defined(PNG_READ_SUPPORTED) && defined(PNG_ASSEMBLER_CODE_SUPPORTED) 774 788 #if !defined(PNG_1_0_X) 775 #if defined(PNG_ASSEMBLER_CODE_SUPPORTED) 776 /* GRR: could add this: && defined(PNG_MMX_CODE_SUPPORTED) */ 789 #if defined(PNG_MMX_CODE_SUPPORTED) 777 790 /* this INTERNAL function was added to libpng 1.2.0 */ 778 791 void /* PRIVATE */ 779 792 png_init_mmx_flags (png_structp png_ptr) 780 793 { 794 if(png_ptr == NULL) return; 781 795 png_ptr->mmx_rowbytes_threshold = 0; 782 796 png_ptr->mmx_bitdepth_threshold = 0; 783 797 … … 787 801 788 802 if (png_mmx_support() > 0) { 789 803 png_ptr->asm_flags |= PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU 790 # ifdef PNG_HAVE_ ASSEMBLER_COMBINE_ROW804 # ifdef PNG_HAVE_MMX_COMBINE_ROW 791 805 | PNG_ASM_FLAG_MMX_READ_COMBINE_ROW 792 806 # endif 793 # ifdef PNG_HAVE_ ASSEMBLER_READ_INTERLACE807 # ifdef PNG_HAVE_MMX_READ_INTERLACE 794 808 | PNG_ASM_FLAG_MMX_READ_INTERLACE 795 809 # endif 796 # ifndef PNG_HAVE_ ASSEMBLER_READ_FILTER_ROW810 # ifndef PNG_HAVE_MMX_READ_FILTER_ROW 797 811 ; 798 812 # else 799 813 | PNG_ASM_FLAG_MMX_READ_FILTER_SUB … … 810 824 | PNG_MMX_WRITE_FLAGS ); 811 825 } 812 826 813 # else /* !( (PNGVCRD || PNGGCCRD) && PNG_ASSEMBLER_CODE_SUPPORTED)) */827 # else /* !(PNGVCRD || PNGGCCRD) */ 814 828 815 829 /* clear all MMX flags; no support is compiled in */ 816 830 png_ptr->asm_flags &= ~( PNG_MMX_FLAGS ); … … 818 832 # endif /* ?(PNGVCRD || PNGGCCRD) */ 819 833 } 820 834 821 #endif /* !(PNG_ ASSEMBLER_CODE_SUPPORTED) */835 #endif /* !(PNG_MMX_CODE_SUPPORTED) */ 822 836 823 837 /* this function was added to libpng 1.2.0 */ 824 838 #if !defined(PNG_USE_PNGGCCRD) && \ 825 !(defined(PNG_ ASSEMBLER_CODE_SUPPORTED) && defined(PNG_USE_PNGVCRD))839 !(defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_USE_PNGVCRD)) 826 840 int PNGAPI 827 841 png_mmx_support(void) 828 842 { 829 843 return -1; 830 844 } 831 845 #endif 832 #endif /* PNG_1_0_X */846 #endif /* PNG_1_0_X && PNG_ASSEMBLER_CODE_SUPPORTED */ 833 847 #endif /* PNG_READ_SUPPORTED */ 834 848 835 849 #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) -
src/libs/png/Jamfile
3 3 SetSubDirSupportedPlatformsBeOSCompatible ; 4 4 AddSubDirSupportedPlatforms libbe_test ; 5 5 6 UseLibraryHeaders zlib ;6 UseLibraryHeaders png zlib ; 7 7 8 local shared_files = 8 local shared_files = 9 9 png.c 10 10 pngerror.c 11 11 pnggccrd.c -
src/libs/png/pnggccrd.c
7 7 * and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm 8 8 * for Intel's performance analysis of the MMX vs. non-MMX code. 9 9 * 10 * Last changed in libpng 1.2. 9 April 14, 200610 * Last changed in libpng 1.2.15 January 5, 2007 11 11 * For conditions of distribution and use, see copyright notice in png.h 12 * Copyright (c) 1998-200 6Glenn Randers-Pehrson12 * Copyright (c) 1998-2007 Glenn Randers-Pehrson 13 13 * Copyright (c) 1998, Intel Corporation 14 14 * 15 15 * Based on MSVC code contributed by Nirav Chhatrapati, Intel Corp., 1998. … … 245 245 #define PNG_INTERNAL 246 246 #include "png.h" 247 247 248 #if defined(PNG_ USE_PNGGCCRD)248 #if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_USE_PNGGCCRD) 249 249 250 250 int PNGAPI png_mmx_support(void); 251 251 252 252 #ifdef PNG_USE_LOCAL_ARRAYS 253 static constint FARDATA png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};254 static constint FARDATA png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};255 static constint FARDATA png_pass_width[7] = {8, 4, 4, 2, 2, 1, 1};253 const static int FARDATA png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; 254 const static int FARDATA png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; 255 const static int FARDATA png_pass_width[7] = {8, 4, 4, 2, 2, 1, 1}; 256 256 #endif 257 257 258 #if defined(PNG_ ASSEMBLER_CODE_SUPPORTED)258 #if defined(PNG_MMX_CODE_SUPPORTED) 259 259 /* djgpp, Win32, Cygwin, and OS2 add their own underscores to global variables, 260 260 * so define them without: */ 261 261 #if defined(__DJGPP__) || defined(WIN32) || defined(__CYGWIN__) || \ … … 311 311 static int _unmask; 312 312 #endif 313 313 314 static unsigned long long _mask8_0 = 0x0102040810204080LL;314 const static unsigned long long _mask8_0 = 0x0102040810204080LL; 315 315 316 static unsigned long long _mask16_1 = 0x0101020204040808LL;317 static unsigned long long _mask16_0 = 0x1010202040408080LL;316 const static unsigned long long _mask16_1 = 0x0101020204040808LL; 317 const static unsigned long long _mask16_0 = 0x1010202040408080LL; 318 318 319 static unsigned long long _mask24_2 = 0x0101010202020404LL;320 static unsigned long long _mask24_1 = 0x0408080810101020LL;321 static unsigned long long _mask24_0 = 0x2020404040808080LL;319 const static unsigned long long _mask24_2 = 0x0101010202020404LL; 320 const static unsigned long long _mask24_1 = 0x0408080810101020LL; 321 const static unsigned long long _mask24_0 = 0x2020404040808080LL; 322 322 323 static unsigned long long _mask32_3 = 0x0101010102020202LL;324 static unsigned long long _mask32_2 = 0x0404040408080808LL;325 static unsigned long long _mask32_1 = 0x1010101020202020LL;326 static unsigned long long _mask32_0 = 0x4040404080808080LL;323 const static unsigned long long _mask32_3 = 0x0101010102020202LL; 324 const static unsigned long long _mask32_2 = 0x0404040408080808LL; 325 const static unsigned long long _mask32_1 = 0x1010101020202020LL; 326 const static unsigned long long _mask32_0 = 0x4040404080808080LL; 327 327 328 static unsigned long long _mask48_5 = 0x0101010101010202LL;329 static unsigned long long _mask48_4 = 0x0202020204040404LL;330 static unsigned long long _mask48_3 = 0x0404080808080808LL;331 static unsigned long long _mask48_2 = 0x1010101010102020LL;332 static unsigned long long _mask48_1 = 0x2020202040404040LL;333 static unsigned long long _mask48_0 = 0x4040808080808080LL;328 const static unsigned long long _mask48_5 = 0x0101010101010202LL; 329 const static unsigned long long _mask48_4 = 0x0202020204040404LL; 330 const static unsigned long long _mask48_3 = 0x0404080808080808LL; 331 const static unsigned long long _mask48_2 = 0x1010101010102020LL; 332 const static unsigned long long _mask48_1 = 0x2020202040404040LL; 333 const static unsigned long long _mask48_0 = 0x4040808080808080LL; 334 334 335 static unsigned long long _const4 = 0x0000000000FFFFFFLL;336 // static unsigned long long _const5 = 0x000000FFFFFF0000LL; // NOT USED337 static unsigned long long _const6 = 0x00000000000000FFLL;335 const static unsigned long long _const4 = 0x0000000000FFFFFFLL; 336 //const static unsigned long long _const5 = 0x000000FFFFFF0000LL; // NOT USED 337 const static unsigned long long _const6 = 0x00000000000000FFLL; 338 338 339 339 // These are used in the row-filter routines and should/would be local 340 340 // variables if not for gcc addressing limitations. … … 378 378 _mask48_1 = _mask48_1; 379 379 _mask48_0 = _mask48_0; 380 380 } 381 #endif /* PNG_ ASSEMBLER_CODE_SUPPORTED */381 #endif /* PNG_MMX_CODE_SUPPORTED */ 382 382 383 383 384 384 static int _mmx_supported = 2; … … 389 389 /* */ 390 390 /*===========================================================================*/ 391 391 392 #if defined(PNG_HAVE_ ASSEMBLER_COMBINE_ROW)392 #if defined(PNG_HAVE_MMX_COMBINE_ROW) 393 393 394 394 #define BPP2 2 395 395 #define BPP3 3 /* bytes per pixel (a.k.a. pixel_bytes) */ … … 416 416 { 417 417 png_debug(1, "in png_combine_row (pnggccrd.c)\n"); 418 418 419 #if defined(PNG_ ASSEMBLER_CODE_SUPPORTED)419 #if defined(PNG_MMX_CODE_SUPPORTED) 420 420 if (_mmx_supported == 2) { 421 421 #if !defined(PNG_1_0_X) 422 422 /* this should have happened in png_init_mmx_flags() already */ … … 607 607 png_bytep srcptr; 608 608 png_bytep dstptr; 609 609 610 #if defined(PNG_ ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)610 #if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) 611 611 #if !defined(PNG_1_0_X) 612 612 if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) 613 613 /* && _mmx_supported */ ) … … 700 700 ); 701 701 } 702 702 else /* mmx _not supported - Use modified C routine */ 703 #endif /* PNG_ ASSEMBLER_CODE_SUPPORTED */703 #endif /* PNG_MMX_CODE_SUPPORTED */ 704 704 { 705 705 register png_uint_32 i; 706 706 png_uint_32 initial_val = png_pass_start[png_ptr->pass]; … … 745 745 png_bytep srcptr; 746 746 png_bytep dstptr; 747 747 748 #if defined(PNG_ ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)748 #if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) 749 749 #if !defined(PNG_1_0_X) 750 750 if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) 751 751 /* && _mmx_supported */ ) … … 854 854 ); 855 855 } 856 856 else /* mmx _not supported - Use modified C routine */ 857 #endif /* PNG_ ASSEMBLER_CODE_SUPPORTED */857 #endif /* PNG_MMX_CODE_SUPPORTED */ 858 858 { 859 859 register png_uint_32 i; 860 860 png_uint_32 initial_val = BPP2 * png_pass_start[png_ptr->pass]; … … 898 898 png_bytep srcptr; 899 899 png_bytep dstptr; 900 900 901 #if defined(PNG_ ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)901 #if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) 902 902 #if !defined(PNG_1_0_X) 903 903 if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) 904 904 /* && _mmx_supported */ ) … … 1022 1022 ); 1023 1023 } 1024 1024 else /* mmx _not supported - Use modified C routine */ 1025 #endif /* PNG_ ASSEMBLER_CODE_SUPPORTED */1025 #endif /* PNG_MMX_CODE_SUPPORTED */ 1026 1026 { 1027 1027 register png_uint_32 i; 1028 1028 png_uint_32 initial_val = BPP3 * png_pass_start[png_ptr->pass]; … … 1066 1066 png_bytep srcptr; 1067 1067 png_bytep dstptr; 1068 1068 1069 #if defined(PNG_ ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)1069 #if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) 1070 1070 #if !defined(PNG_1_0_X) 1071 1071 if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) 1072 1072 /* && _mmx_supported */ ) … … 1197 1197 ); 1198 1198 } 1199 1199 else /* mmx _not supported - Use modified C routine */ 1200 #endif /* PNG_ ASSEMBLER_CODE_SUPPORTED */1200 #endif /* PNG_MMX_CODE_SUPPORTED */ 1201 1201 { 1202 1202 register png_uint_32 i; 1203 1203 png_uint_32 initial_val = BPP4 * png_pass_start[png_ptr->pass]; … … 1241 1241 png_bytep srcptr; 1242 1242 png_bytep dstptr; 1243 1243 1244 #if defined(PNG_ ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)1244 #if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) 1245 1245 #if !defined(PNG_1_0_X) 1246 1246 if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) 1247 1247 /* && _mmx_supported */ ) … … 1389 1389 ); 1390 1390 } 1391 1391 else /* mmx _not supported - Use modified C routine */ 1392 #endif /* PNG_ ASSEMBLER_CODE_SUPPORTED */1392 #endif /* PNG_MMX_CODE_SUPPORTED */ 1393 1393 { 1394 1394 register png_uint_32 i; 1395 1395 png_uint_32 initial_val = BPP6 * png_pass_start[png_ptr->pass]; … … 1480 1480 1481 1481 } /* end png_combine_row() */ 1482 1482 1483 #endif /* PNG_HAVE_ ASSEMBLER_COMBINE_ROW */1483 #endif /* PNG_HAVE_MMX_COMBINE_ROW */ 1484 1484 1485 1485 1486 1486 … … 1492 1492 /*===========================================================================*/ 1493 1493 1494 1494 #if defined(PNG_READ_INTERLACING_SUPPORTED) 1495 #if defined(PNG_HAVE_ ASSEMBLER_READ_INTERLACE)1495 #if defined(PNG_HAVE_MMX_READ_INTERLACE) 1496 1496 1497 1497 /* png_do_read_interlace() is called after any 16-bit to 8-bit conversion 1498 1498 * has taken place. [GRR: what other steps come before and/or after?] … … 1510 1510 1511 1511 png_debug(1, "in png_do_read_interlace (pnggccrd.c)\n"); 1512 1512 1513 #if defined(PNG_ ASSEMBLER_CODE_SUPPORTED)1513 #if defined(PNG_MMX_CODE_SUPPORTED) 1514 1514 if (_mmx_supported == 2) { 1515 1515 #if !defined(PNG_1_0_X) 1516 1516 /* this should have happened in png_init_mmx_flags() already */ … … 1723 1723 1724 1724 /* New code by Nirav Chhatrapati - Intel Corporation */ 1725 1725 1726 #if defined(PNG_ ASSEMBLER_CODE_SUPPORTED)1726 #if defined(PNG_MMX_CODE_SUPPORTED) 1727 1727 #if !defined(PNG_1_0_X) 1728 1728 if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_INTERLACE) 1729 1729 /* && _mmx_supported */ ) … … 2628 2628 /* GRR 19991007: does it? or should pixel_bytes in each 2629 2629 * block be replaced with immediate value (e.g., 1)? */ 2630 2630 /* GRR 19991017: replaced with constants in each case */ 2631 #endif /* PNG_ ASSEMBLER_CODE_SUPPORTED */2631 #endif /* PNG_MMX_CODE_SUPPORTED */ 2632 2632 { 2633 2633 if (pixel_bytes == 1) 2634 2634 { … … 2753 2753 2754 2754 } /* end png_do_read_interlace() */ 2755 2755 2756 #endif /* PNG_HAVE_ ASSEMBLER_READ_INTERLACE */2756 #endif /* PNG_HAVE_MMX_READ_INTERLACE */ 2757 2757 #endif /* PNG_READ_INTERLACING_SUPPORTED */ 2758 2758 2759 2759 2760 2760 2761 #if defined(PNG_HAVE_ ASSEMBLER_READ_FILTER_ROW)2762 #if defined(PNG_ ASSEMBLER_CODE_SUPPORTED)2761 #if defined(PNG_HAVE_MMX_READ_FILTER_ROW) 2762 #if defined(PNG_MMX_CODE_SUPPORTED) 2763 2763 2764 2764 // These variables are utilized in the functions below. They are declared 2765 2765 // globally here to ensure alignment on 8-byte boundaries. … … 5066 5066 5067 5067 } // end of png_read_filter_row_mmx_up() 5068 5068 5069 #endif /* PNG_ ASSEMBLER_CODE_SUPPORTED */5069 #endif /* PNG_MMX_CODE_SUPPORTED */ 5070 5070 5071 5071 5072 5072 … … 5088 5088 char filnm[10]; 5089 5089 #endif 5090 5090 5091 #if defined(PNG_ ASSEMBLER_CODE_SUPPORTED)5091 #if defined(PNG_MMX_CODE_SUPPORTED) 5092 5092 /* GRR: these are superseded by png_ptr->asm_flags: */ 5093 5093 #define UseMMX_sub 1 // GRR: converted 20000730 5094 5094 #define UseMMX_up 1 // GRR: converted 20000729 … … 5102 5102 #endif 5103 5103 png_mmx_support(); 5104 5104 } 5105 #endif /* PNG_ ASSEMBLER_CODE_SUPPORTED */5105 #endif /* PNG_MMX_CODE_SUPPORTED */ 5106 5106 5107 5107 #ifdef PNG_DEBUG 5108 5108 png_debug(1, "in png_read_filter_row (pnggccrd.c)\n"); … … 5111 5111 case 0: sprintf(filnm, "none"); 5112 5112 break; 5113 5113 case 1: sprintf(filnm, "sub-%s", 5114 #if defined(PNG_ ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)5114 #if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) 5115 5115 #if !defined(PNG_1_0_X) 5116 5116 (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB)? "MMX" : 5117 5117 #endif … … 5119 5119 "x86"); 5120 5120 break; 5121 5121 case 2: sprintf(filnm, "up-%s", 5122 #ifdef PNG_ ASSEMBLER_CODE_SUPPORTED5122 #ifdef PNG_MMX_CODE_SUPPORTED 5123 5123 #if !defined(PNG_1_0_X) 5124 5124 (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP)? "MMX" : 5125 5125 #endif … … 5127 5127 "x86"); 5128 5128 break; 5129 5129 case 3: sprintf(filnm, "avg-%s", 5130 #if defined(PNG_ ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)5130 #if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) 5131 5131 #if !defined(PNG_1_0_X) 5132 5132 (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG)? "MMX" : 5133 5133 #endif … … 5135 5135 "x86"); 5136 5136 break; 5137 5137 case 4: sprintf(filnm, "Paeth-%s", 5138 #if defined(PNG_ ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)5138 #if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) 5139 5139 #if !defined(PNG_1_0_X) 5140 5140 (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH)? "MMX": 5141 5141 #endif … … 5158 5158 break; 5159 5159 5160 5160 case PNG_FILTER_VALUE_SUB: 5161 #if defined(PNG_ ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)5161 #if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) 5162 5162 #if !defined(PNG_1_0_X) 5163 5163 if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB) && 5164 5164 (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) && … … 5170 5170 png_read_filter_row_mmx_sub(row_info, row); 5171 5171 } 5172 5172 else 5173 #endif /* PNG_ ASSEMBLER_CODE_SUPPORTED */5173 #endif /* PNG_MMX_CODE_SUPPORTED */ 5174 5174 { 5175 5175 png_uint_32 i; 5176 5176 png_uint_32 istop = row_info->rowbytes; … … 5187 5187 break; 5188 5188 5189 5189 case PNG_FILTER_VALUE_UP: 5190 #if defined(PNG_ ASSEMBLER_CODE_SUPPORTED)5190 #if defined(PNG_MMX_CODE_SUPPORTED) 5191 5191 #if !defined(PNG_1_0_X) 5192 5192 if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP) && 5193 5193 (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) && … … 5199 5199 png_read_filter_row_mmx_up(row_info, row, prev_row); 5200 5200 } 5201 5201 else 5202 #endif /* PNG_ ASSEMBLER_CODE_SUPPORTED */5202 #endif /* PNG_MMX_CODE_SUPPORTED */ 5203 5203 { 5204 5204 png_uint_32 i; 5205 5205 png_uint_32 istop = row_info->rowbytes; … … 5215 5215 break; 5216 5216 5217 5217 case PNG_FILTER_VALUE_AVG: 5218 #if defined(PNG_ ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)5218 #if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) 5219 5219 #if !defined(PNG_1_0_X) 5220 5220 if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG) && 5221 5221 (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) && … … 5227 5227 png_read_filter_row_mmx_avg(row_info, row, prev_row); 5228 5228 } 5229 5229 else 5230 #endif /* PNG_ ASSEMBLER_CODE_SUPPORTED */5230 #endif /* PNG_MMX_CODE_SUPPORTED */ 5231 5231 { 5232 5232 png_uint_32 i; 5233 5233 png_bytep rp = row; … … 5253 5253 break; 5254 5254 5255 5255 case PNG_FILTER_VALUE_PAETH: 5256 #if defined(PNG_ ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)5256 #if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) 5257 5257 #if !defined(PNG_1_0_X) 5258 5258 if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH) && 5259 5259 (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) && … … 5265 5265 png_read_filter_row_mmx_paeth(row_info, row, prev_row); 5266 5266 } 5267 5267 else 5268 #endif /* PNG_ ASSEMBLER_CODE_SUPPORTED */5268 #endif /* PNG_MMX_CODE_SUPPORTED */ 5269 5269 { 5270 5270 png_uint_32 i; 5271 5271 png_bytep rp = row; … … 5326 5326 } 5327 5327 } 5328 5328 5329 #endif /* PNG_HAVE_ ASSEMBLER_READ_FILTER_ROW */5329 #endif /* PNG_HAVE_MMX_READ_FILTER_ROW */ 5330 5330 5331 5331 5332 5332 /*===========================================================================*/ -
src/libs/png/pngrtran.c
1 1 2 2 /* pngrtran.c - transforms the data in a row for PNG readers 3 3 * 4 * Last changed in libpng 1.2.1 1 June 15, 20064 * Last changed in libpng 1.2.15 January 5, 2007 5 5 * For conditions of distribution and use, see copyright notice in png.h 6 * Copyright (c) 1998-200 6Glenn Randers-Pehrson6 * Copyright (c) 1998-2007 Glenn Randers-Pehrson 7 7 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) 8 8 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) 9 9 * … … 24 24 { 25 25 png_debug(1, "in png_set_crc_action\n"); 26 26 /* Tell libpng how we react to CRC errors in critical chunks */ 27 if(png_ptr == NULL) return; 27 28 switch (crit_action) 28 29 { 29 30 case PNG_CRC_NO_CHANGE: /* leave setting as is */ … … 80 81 int need_expand, double background_gamma) 81 82 { 82 83 png_debug(1, "in png_set_background\n"); 84 if(png_ptr == NULL) return; 83 85 if (background_gamma_code == PNG_BACKGROUND_GAMMA_UNKNOWN) 84 86 { 85 87 png_warning(png_ptr, "Application must supply a known background gamma"); … … 92 94 png_ptr->background_gamma = (float)background_gamma; 93 95 png_ptr->background_gamma_type = (png_byte)(background_gamma_code); 94 96 png_ptr->transformations |= (need_expand ? PNG_BACKGROUND_EXPAND : 0); 95 96 /* Note: if need_expand is set and color_type is either RGB or RGB_ALPHA97 * (in which case need_expand is superfluous anyway), the background color98 * might actually be gray yet not be flagged as such. This is not a problem99 * for the current code, which uses PNG_BACKGROUND_IS_GRAY only to100 * decide when to do the png_do_gray_to_rgb() transformation.101 */102 if ((need_expand && !(png_ptr->color_type & PNG_COLOR_MASK_COLOR)) ||103 (!need_expand && background_color->red == background_color->green &&104 background_color->red == background_color->blue))105 png_ptr->mode |= PNG_BACKGROUND_IS_GRAY;106 97 } 107 98 #endif 108 99 … … 112 103 png_set_strip_16(png_structp png_ptr) 113 104 { 114 105 png_debug(1, "in png_set_strip_16\n"); 106 if(png_ptr == NULL) return; 115 107 png_ptr->transformations |= PNG_16_TO_8; 116 108 } 117 109 #endif … … 121 113 png_set_strip_alpha(png_structp png_ptr) 122 114 { 123 115 png_debug(1, "in png_set_strip_alpha\n"); 116 if(png_ptr == NULL) return; 124 117 png_ptr->flags |= PNG_FLAG_STRIP_ALPHA; 125 118 } 126 119 #endif … … 150 143 int full_dither) 151 144 { 152 145 png_debug(1, "in png_set_dither\n"); 146 if(png_ptr == NULL) return; 153 147 png_ptr->transformations |= PNG_DITHER; 154 148 155 149 if (!full_dither) … … 533 527 png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma) 534 528 { 535 529 png_debug(1, "in png_set_gamma\n"); 530 if(png_ptr == NULL) return; 536 531 if ((fabs(scrn_gamma * file_gamma - 1.0) > PNG_GAMMA_THRESHOLD) || 537 532 (png_ptr->color_type & PNG_COLOR_MASK_ALPHA) || 538 533 (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)) … … 551 546 png_set_expand(png_structp png_ptr) 552 547 { 553 548 png_debug(1, "in png_set_expand\n"); 549 if(png_ptr == NULL) return; 554 550 png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS); 555 551 } 556 552 … … 576 572 png_set_palette_to_rgb(png_structp png_ptr) 577 573 { 578 574 png_debug(1, "in png_set_palette_to_rgb\n"); 575 if(png_ptr == NULL) return; 579 576 png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS); 580 577 } 581 578 … … 585 582 png_set_expand_gray_1_2_4_to_8(png_structp png_ptr) 586 583 { 587 584 png_debug(1, "in png_set_expand_gray_1_2_4_to_8\n"); 588 png_ptr->transformations |= PNG_EXPAND_tRNS; 585 if(png_ptr == NULL) return; 586 png_ptr->transformations |= PNG_EXPAND; 589 587 } 590 588 #endif 591 589 … … 596 594 png_set_gray_1_2_4_to_8(png_structp png_ptr) 597 595 { 598 596 png_debug(1, "in png_set_gray_1_2_4_to_8\n"); 597 if(png_ptr == NULL) return; 599 598 png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS); 600 599 } 601 600 #endif … … 631 630 { 632 631 int red_fixed = (int)((float)red*100000.0 + 0.5); 633 632 int green_fixed = (int)((float)green*100000.0 + 0.5); 633 if(png_ptr == NULL) return; 634 634 png_set_rgb_to_gray_fixed(png_ptr, error_action, red_fixed, green_fixed); 635 635 } 636 636 #endif … … 640 640 png_fixed_point red, png_fixed_point green) 641 641 { 642 642 png_debug(1, "in png_set_rgb_to_gray\n"); 643 if(png_ptr == NULL) return; 643 644 switch(error_action) 644 645 { 645 646 case 1: png_ptr->transformations |= PNG_RGB_TO_GRAY; … … 690 691 read_user_transform_fn) 691 692 { 692 693 png_debug(1, "in png_set_read_user_transform_fn\n"); 694 if(png_ptr == NULL) return; 693 695 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) 694 696 png_ptr->transformations |= PNG_USER_TRANSFORM; 695 697 png_ptr->read_user_transform_fn = read_user_transform_fn; … … 719 721 #endif 720 722 721 723 #if defined(PNG_READ_EXPAND_SUPPORTED) && defined(PNG_READ_BACKGROUND_SUPPORTED) 724 725 #if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) 726 /* Detect gray background and attempt to enable optimization 727 * for gray --> RGB case */ 728 /* Note: if PNG_BACKGROUND_EXPAND is set and color_type is either RGB or 729 * RGB_ALPHA (in which case need_expand is superfluous anyway), the 730 * background color might actually be gray yet not be flagged as such. 731 * This is not a problem for the current code, which uses 732 * PNG_BACKGROUND_IS_GRAY only to decide when to do the 733 * png_do_gray_to_rgb() transformation. 734 */ 722 735 if ((png_ptr->transformations & PNG_BACKGROUND_EXPAND) && 736 !(color_type & PNG_COLOR_MASK_COLOR)) 737 { 738 png_ptr->mode |= PNG_BACKGROUND_IS_GRAY; 739 } else if ((png_ptr->transformations & PNG_BACKGROUND) && 740 !(png_ptr->transformations & PNG_BACKGROUND_EXPAND) && 741 (png_ptr->transformations & PNG_GRAY_TO_RGB) && 742 png_ptr->background.red == png_ptr->background.green && 743 png_ptr->background.red == png_ptr->background.blue) 744 { 745 png_ptr->mode |= PNG_BACKGROUND_IS_GRAY; 746 png_ptr->background.gray = png_ptr->background.red; 747 } 748 #endif 749 750 if ((png_ptr->transformations & PNG_BACKGROUND_EXPAND) && 723 751 (png_ptr->transformations & PNG_EXPAND)) 724 752 { 725 753 if (!(color_type & PNG_COLOR_MASK_COLOR)) /* i.e., GRAY or GRAY_ALPHA */ … … 1265 1293 if(rgb_error) 1266 1294 { 1267 1295 png_ptr->rgb_to_gray_status=1; 1268 if(png_ptr->transformations ==PNG_RGB_TO_GRAY_WARN)1296 if(png_ptr->transformations & PNG_RGB_TO_GRAY_WARN) 1269 1297 png_warning(png_ptr, "png_do_rgb_to_gray found nongray pixel"); 1270 if(png_ptr->transformations ==PNG_RGB_TO_GRAY_ERR)1298 if(png_ptr->transformations & PNG_RGB_TO_GRAY_ERR) 1271 1299 png_error(png_ptr, "png_do_rgb_to_gray found nongray pixel"); 1272 1300 } 1273 1301 } … … 3937 3965 3938 3966 #ifdef PNG_FLOATING_POINT_SUPPORTED 3939 3967 #if defined(PNG_READ_GAMMA_SUPPORTED) 3940 static int png_gamma_shift[] =3968 const static int png_gamma_shift[] = 3941 3969 {0x10, 0x21, 0x42, 0x84, 0x110, 0x248, 0x550, 0xff0, 0x00}; 3942 3970 3943 3971 /* We build the 8- or 16-bit gamma tables here. Note that for 16-bit -
src/libs/png/pngtrans.c
1 1 2 2 /* pngtrans.c - transforms the data in a row (used by both readers and writers) 3 3 * 4 * Last changed in libpng 1.2. 9 April 14, 20064 * Last changed in libpng 1.2.13 November 13, 2006 5 5 * For conditions of distribution and use, see copyright notice in png.h 6 6 * Copyright (c) 1998-2006 Glenn Randers-Pehrson 7 7 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) … … 18 18 png_set_bgr(png_structp png_ptr) 19 19 { 20 20 png_debug(1, "in png_set_bgr\n"); 21 if(png_ptr == NULL) return; 21 22 png_ptr->transformations |= PNG_BGR; 22 23 } 23 24 #endif … … 28 29 png_set_swap(png_structp png_ptr) 29 30 { 30 31 png_debug(1, "in png_set_swap\n"); 32 if(png_ptr == NULL) return; 31 33 if (png_ptr->bit_depth == 16) 32 34 png_ptr->transformations |= PNG_SWAP_BYTES; 33 35 } … … 39 41 png_set_packing(png_structp png_ptr) 40 42 { 41 43 png_debug(1, "in png_set_packing\n"); 44 if(png_ptr == NULL) return; 42 45 if (png_ptr->bit_depth < 8) 43 46 { 44 47 png_ptr->transformations |= PNG_PACK; … … 53 56 png_set_packswap(png_structp png_ptr) 54 57 { 55 58 png_debug(1, "in png_set_packswap\n"); 59 if(png_ptr == NULL) return; 56 60 if (png_ptr->bit_depth < 8) 57 61 png_ptr->transformations |= PNG_PACKSWAP; 58 62 } … … 63 67 png_set_shift(png_structp png_ptr, png_color_8p true_bits) 64 68 { 65 69 png_debug(1, "in png_set_shift\n"); 70 if(png_ptr == NULL) return; 66 71 png_ptr->transformations |= PNG_SHIFT; 67 72 png_ptr->shift = *true_bits; 68 73 } … … 74 79 png_set_interlace_handling(png_structp png_ptr) 75 80 { 76 81 png_debug(1, "in png_set_interlace handling\n"); 77 if (png_ptr ->interlaced)82 if (png_ptr && png_ptr->interlaced) 78 83 { 79 84 png_ptr->transformations |= PNG_INTERLACE; 80 85 return (7); … … 94 99 png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc) 95 100 { 96 101 png_debug(1, "in png_set_filler\n"); 102 if(png_ptr == NULL) return; 97 103 png_ptr->transformations |= PNG_FILLER; 98 104 png_ptr->filler = (png_byte)filler; 99 105 if (filler_loc == PNG_FILLER_AFTER) … … 126 132 png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc) 127 133 { 128 134 png_debug(1, "in png_set_add_alpha\n"); 135 if(png_ptr == NULL) return; 129 136 png_set_filler(png_ptr, filler, filler_loc); 130 137 png_ptr->transformations |= PNG_ADD_ALPHA; 131 138 } … … 139 146 png_set_swap_alpha(png_structp png_ptr) 140 147 { 141 148 png_debug(1, "in png_set_swap_alpha\n"); 149 if(png_ptr == NULL) return; 142 150 png_ptr->transformations |= PNG_SWAP_ALPHA; 143 151 } 144 152 #endif … … 149 157 png_set_invert_alpha(png_structp png_ptr) 150 158 { 151 159 png_debug(1, "in png_set_invert_alpha\n"); 160 if(png_ptr == NULL) return; 152 161 png_ptr->transformations |= PNG_INVERT_ALPHA; 153 162 } 154 163 #endif … … 158 167 png_set_invert_mono(png_structp png_ptr) 159 168 { 160 169 png_debug(1, "in png_set_invert_mono\n"); 170 if(png_ptr == NULL) return; 161 171 png_ptr->transformations |= PNG_INVERT_MONO; 162 172 } 163 173 … … 242 252 #endif 243 253 244 254 #if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED) 245 static PNG_CONST png_byte onebppswaptable[256] = {255 const static PNG_CONST png_byte onebppswaptable[256] = { 246 256 0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0, 247 257 0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0, 248 258 0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8, … … 277 287 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF 278 288 }; 279 289 280 static PNG_CONST png_byte twobppswaptable[256] = {290 const static PNG_CONST png_byte twobppswaptable[256] = { 281 291 0x00, 0x40, 0x80, 0xC0, 0x10, 0x50, 0x90, 0xD0, 282 292 0x20, 0x60, 0xA0, 0xE0, 0x30, 0x70, 0xB0, 0xF0, 283 293 0x04, 0x44, 0x84, 0xC4, 0x14, 0x54, 0x94, 0xD4, … … 312 322 0x2F, 0x6F, 0xAF, 0xEF, 0x3F, 0x7F, 0xBF, 0xFF 313 323 }; 314 324 315 static PNG_CONST png_byte fourbppswaptable[256] = {325 const static PNG_CONST png_byte fourbppswaptable[256] = { 316 326 0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 317 327 0x80, 0x90, 0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0, 318 328 0x01, 0x11, 0x21, 0x31, 0x41, 0x51, 0x61, 0x71, … … 621 631 user_transform_ptr, int user_transform_depth, int user_transform_channels) 622 632 { 623 633 png_debug(1, "in png_set_user_transform_info\n"); 634 if(png_ptr == NULL) return; 624 635 #if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) 625 636 png_ptr->user_transform_ptr = user_transform_ptr; 626 637 png_ptr->user_transform_depth = (png_byte)user_transform_depth; … … 642 653 png_get_user_transform_ptr(png_structp png_ptr) 643 654 { 644 655 #if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) 656 if (png_ptr == NULL) return (NULL); 645 657 return ((png_voidp)png_ptr->user_transform_ptr); 646 658 #else 647 if(png_ptr)648 return (NULL);649 659 return (NULL); 650 660 #endif 651 661 } -
headers/libs/png/pngconf.h
1 1 2 2 /* pngconf.h - machine configurable file for libpng 3 3 * 4 * libpng version 1.2.1 2 - June 27, 20064 * libpng version 1.2.18 - May 15, 2007 5 5 * For conditions of distribution and use, see copyright notice in png.h 6 * Copyright (c) 1998-200 5Glenn Randers-Pehrson6 * Copyright (c) 1998-2007 Glenn Randers-Pehrson 7 7 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) 8 8 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) 9 9 */ … … 721 721 #endif 722 722 723 723 /* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0 724 even when PNG_USE_PNGVCRD or PNG_USE_PNGGCCRD is not defined */ 724 * even when PNG_USE_PNGVCRD or PNG_USE_PNGGCCRD is not defined. 725 * 726 * PNG_NO_ASSEMBLER_CODE disables use of all assembler code and optimized C, 727 * and removes or includes several functions in the API. 728 * 729 * PNG_NO_MMX_CODE disables the use of MMX code without changing the API. 730 * When MMX code is off, then optimized C replacement functions are used. 731 */ 725 732 #if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE) 726 733 # ifndef PNG_ASSEMBLER_CODE_SUPPORTED 727 734 # define PNG_ASSEMBLER_CODE_SUPPORTED 728 735 # endif 736 # if defined(XP_MACOSX) && !defined(PNG_NO_MMX_CODE) 737 /* work around Intel-Mac compiler bug */ 738 # define PNG_NO_MMX_CODE 739 # endif 729 740 # if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE) && \ 730 741 defined(__MMX__) 731 742 # define PNG_MMX_CODE_SUPPORTED … … 1447 1458 * MMX will be detected at run time and used if present. 1448 1459 */ 1449 1460 #ifdef PNG_USE_PNGVCRD 1450 # define PNG_HAVE_ ASSEMBLER_COMBINE_ROW1451 # define PNG_HAVE_ ASSEMBLER_READ_INTERLACE1452 # define PNG_HAVE_ ASSEMBLER_READ_FILTER_ROW1461 # define PNG_HAVE_MMX_COMBINE_ROW 1462 # define PNG_HAVE_MMX_READ_INTERLACE 1463 # define PNG_HAVE_MMX_READ_FILTER_ROW 1453 1464 #endif 1454 1465 1455 1466 /* Set this in the makefile for gcc/as on Pentium, not here. */ … … 1457 1468 * MMX will be detected at run time and used if present. 1458 1469 */ 1459 1470 #ifdef PNG_USE_PNGGCCRD 1460 # define PNG_HAVE_ ASSEMBLER_COMBINE_ROW1461 # define PNG_HAVE_ ASSEMBLER_READ_INTERLACE1462 # define PNG_HAVE_ ASSEMBLER_READ_FILTER_ROW1471 # define PNG_HAVE_MMX_COMBINE_ROW 1472 # define PNG_HAVE_MMX_READ_INTERLACE 1473 # define PNG_HAVE_MMX_READ_FILTER_ROW 1463 1474 #endif 1464 1475 /* - see pnggccrd.c for info about what is currently enabled */ 1465 1476 -
headers/libs/png/png.h
1 1 2 2 /* png.h - header file for PNG reference library 3 3 * 4 * libpng version 1.2.1 2 - June 27, 20065 * Copyright (c) 1998-200 6Glenn Randers-Pehrson4 * libpng version 1.2.18 - May 15, 2007 5 * Copyright (c) 1998-2007 Glenn Randers-Pehrson 6 6 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) 7 7 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) 8 8 * 9 9 * Authors and maintainers: 10 10 * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat 11 11 * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger 12 * libpng versions 0.97, January 1998, through 1.2.1 2 - June 27, 2006: Glenn12 * libpng versions 0.97, January 1998, through 1.2.18 - May 15, 2007: Glenn 13 13 * See also "Contributing Authors", below. 14 14 * 15 15 * Note about libpng version numbers: … … 126 126 * 1.2.11 13 10211 12.so.0.11[.0] 127 127 * 1.0.20 10 10020 10.so.0.20[.0] 128 128 * 1.2.12 13 10212 12.so.0.12[.0] 129 * 1.2.13beta1 13 10213 12.so.0.13[.0] 130 * 1.0.21 10 10021 10.so.0.21[.0] 131 * 1.2.13 13 10213 12.so.0.13[.0] 132 * 1.2.14beta1-2 13 10214 12.so.0.14[.0] 133 * 1.0.22rc1 10 10022 10.so.0.22[.0] 134 * 1.2.14rc1 13 10214 12.so.0.14[.0] 135 * 1.0.22 10 10022 10.so.0.22[.0] 136 * 1.2.14 13 10214 12.so.0.14[.0] 137 * 1.2.15beta1-6 13 10215 12.so.0.15[.0] 138 * 1.0.23rc1-5 10 10023 10.so.0.23[.0] 139 * 1.2.15rc1-5 13 10215 12.so.0.15[.0] 140 * 1.0.23 10 10023 10.so.0.23[.0] 141 * 1.2.15 13 10215 12.so.0.15[.0] 142 * 1.2.16beta1-2 13 10216 12.so.0.16[.0] 143 * 1.2.16rc1 13 10216 12.so.0.16[.0] 144 * 1.0.24 10 10024 10.so.0.24[.0] 145 * 1.2.16 13 10216 12.so.0.16[.0] 146 * 1.2.17beta1-2 13 10217 12.so.0.17[.0] 147 * 1.0.25rc1 10 10025 10.so.0.25[.0] 148 * 1.2.17rc1-3 13 10217 12.so.0.17[.0] 149 * 1.0.25 10 10025 10.so.0.25[.0] 150 * 1.2.17 13 10217 12.so.0.17[.0] 151 * 1.0.26 10 10026 10.so.0.26[.0] 152 * 1.2.18 13 10218 12.so.0.18[.0] 129 153 * 130 154 * Henceforth the source version will match the shared-library major 131 155 * and minor numbers; the shared-library major version number will be … … 155 179 * If you modify libpng you may insert additional notices immediately following 156 180 * this sentence. 157 181 * 158 * libpng versions 1.2.6, August 15, 2004, through 1.2.1 2, June 27, 2006, are159 * Copyright (c) 2004, 2006 Glenn Randers-Pehrson, and are182 * libpng versions 1.2.6, August 15, 2004, through 1.2.18, May 15, 2007, are 183 * Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are 160 184 * distributed according to the same disclaimer and license as libpng-1.2.5 161 185 * with the following individual added to the list of Contributing Authors: 162 186 * … … 267 291 * Y2K compliance in libpng: 268 292 * ========================= 269 293 * 270 * June 27, 2006294 * May 15, 2007 271 295 * 272 296 * Since the PNG Development group is an ad-hoc body, we can't make 273 297 * an official declaration. 274 298 * 275 299 * This is your unofficial assurance that libpng from version 0.71 and 276 * upward through 1.2.1 2are Y2K compliant. It is my belief that earlier300 * upward through 1.2.18 are Y2K compliant. It is my belief that earlier 277 301 * versions were also Y2K compliant. 278 302 * 279 303 * Libpng only has three year fields. One is a 2-byte unsigned integer … … 329 353 */ 330 354 331 355 /* Version information for png.h - this should match the version in png.c */ 332 #define PNG_LIBPNG_VER_STRING "1.2.1 2"356 #define PNG_LIBPNG_VER_STRING "1.2.18" 333 357 #define PNG_HEADER_VERSION_STRING \ 334 " libpng version 1.2.1 2 - June 27, 2006(header)\n"358 " libpng version 1.2.18 - May 15, 2007 (header)\n" 335 359 336 360 #define PNG_LIBPNG_VER_SONUM 0 337 361 #define PNG_LIBPNG_VER_DLLNUM 13 … … 339 363 /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ 340 364 #define PNG_LIBPNG_VER_MAJOR 1 341 365 #define PNG_LIBPNG_VER_MINOR 2 342 #define PNG_LIBPNG_VER_RELEASE 1 2366 #define PNG_LIBPNG_VER_RELEASE 18 343 367 /* This should match the numeric part of the final component of 344 368 * PNG_LIBPNG_VER_STRING, omitting any leading zero: */ 345 369 … … 367 391 * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only 368 392 * version 1.0.0 was mis-numbered 100 instead of 10000). From 369 393 * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */ 370 #define PNG_LIBPNG_VER 1021 2 /* 1.2.12*/394 #define PNG_LIBPNG_VER 10218 /* 1.2.18 */ 371 395 372 396 #ifndef PNG_VERSION_INFO_ONLY 373 397 /* include the compression library's header */ … … 1334 1358 #endif 1335 1359 1336 1360 /* New members added in libpng-1.2.0 */ 1337 #if !defined(PNG_1_0_X) && defined(PNG_ASSEMBLER_CODE_SUPPORTED) 1361 #if defined(PNG_ASSEMBLER_CODE_SUPPORTED) 1362 # if !defined(PNG_1_0_X) 1363 # if defined(PNG_MMX_CODE_SUPPORTED) 1338 1364 png_byte mmx_bitdepth_threshold; 1339 1365 png_uint_32 mmx_rowbytes_threshold; 1366 # endif 1340 1367 png_uint_32 asm_flags; 1368 # endif 1341 1369 #endif 1342 1370 1343 1371 /* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */ … … 1367 1395 png_uint_32 user_height_max; 1368 1396 #endif 1369 1397 1398 /* New member added in libpng-1.0.25 and 1.2.17 */ 1399 #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) 1400 /* storage for unknown chunk that the library doesn't recognize. */ 1401 png_unknown_chunk unknown_chunk; 1402 #endif 1370 1403 }; 1371 1404 1372 1405 1373 1406 /* This triggers a compiler error in png.c, if png.c and png.h 1374 1407 * do not agree upon the version number. 1375 1408 */ 1376 typedef png_structp version_1_2_1 2;1409 typedef png_structp version_1_2_18; 1377 1410 1378 1411 typedef png_struct FAR * FAR * png_structpp; 1379 1412 … … 2369 2402 handling or default unknown chunk handling is not desired. Any chunks not 2370 2403 listed will be handled in the default manner. The IHDR and IEND chunks 2371 2404 must not be listed. 2372 keep = 0: follow default behav our2405 keep = 0: follow default behaviour 2373 2406 = 1: do not keep 2374 2407 = 2: keep only if safe-to-copy 2375 2408 = 3: keep even if unsafe-to-copy … … 2479 2512 2480 2513 /* Added to version 1.2.0 */ 2481 2514 #if defined(PNG_ASSEMBLER_CODE_SUPPORTED) 2515 #if defined(PNG_MMX_CODE_SUPPORTED) 2482 2516 #define PNG_ASM_FLAG_MMX_SUPPORT_COMPILED 0x01 /* not user-settable */ 2483 2517 #define PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU 0x02 /* not user-settable */ 2484 2518 #define PNG_ASM_FLAG_MMX_READ_COMBINE_ROW 0x04 … … 2504 2538 2505 2539 #define PNG_SELECT_READ 1 2506 2540 #define PNG_SELECT_WRITE 2 2541 #endif /* PNG_MMX_CODE_SUPPORTED */ 2507 2542 2508 2543 #if !defined(PNG_1_0_X) 2509 2544 /* pngget.c */ … … 2536 2571 png_uint_32 mmx_rowbytes_threshold)); 2537 2572 2538 2573 #endif /* PNG_1_0_X */ 2539 #endif /* PNG_ASSEMBLER_CODE_SUPPORTED */2540 2574 2541 2575 #if !defined(PNG_1_0_X) 2542 2576 /* png.c, pnggccrd.c, or pngvcrd.c */ 2543 2577 extern PNG_EXPORT(int,png_mmx_support) PNGARG((void)); 2578 #endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ 2544 2579 2545 2580 /* Strip the prepended error numbers ("#nnn ") from error and warning 2546 2581 * messages before passing them to the error or warning handler. */ … … 2648 2683 * be found in the files where the functions are located. 2649 2684 */ 2650 2685 2651 #if defined(PNG_INTERNAL)2652 2686 2653 /* Various modes of operation . Note that after an init, mode is set to2654 * zero automatically when the structure is created.2687 /* Various modes of operation, that are visible to applications because 2688 * they are used for unknown chunk location. 2655 2689 */ 2656 2690 #define PNG_HAVE_IHDR 0x01 2657 2691 #define PNG_HAVE_PLTE 0x02 2658 2692 #define PNG_HAVE_IDAT 0x04 2659 2693 #define PNG_AFTER_IDAT 0x08 /* Have complete zlib datastream */ 2660 2694 #define PNG_HAVE_IEND 0x10 2695 2696 #if defined(PNG_INTERNAL) 2697 2698 /* More modes of operation. Note that after an init, mode is set to 2699 * zero automatically when the structure is created. 2700 */ 2661 2701 #define PNG_HAVE_gAMA 0x20 2662 2702 #define PNG_HAVE_cHRM 0x40 2663 2703 #define PNG_HAVE_sRGB 0x80 … … 3442 3482 #endif 3443 3483 3444 3484 #if defined(PNG_ASSEMBLER_CODE_SUPPORTED) 3485 #if defined(PNG_MMX_CODE_SUPPORTED) 3445 3486 /* png.c */ /* PRIVATE */ 3446 3487 PNG_EXTERN void png_init_mmx_flags PNGARG((png_structp png_ptr)); 3447 3488 #endif 3489 #endif 3448 3490 3449 3491 #if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED) 3450 3492 PNG_EXTERN png_uint_32 png_get_pixels_per_inch PNGARG((png_structp png_ptr,