| OLD | NEW |
| 1 | 1 |
| 2 /* png.c - location for general purpose libpng functions | 2 /* png.c - location for general purpose libpng functions |
| 3 * | 3 * |
| 4 * Last changed in libpng 1.2.43 [February 25, 2010] | 4 * Last changed in libpng 1.2.51 [February 6, 2014] |
| 5 * Copyright (c) 1998-2010 Glenn Randers-Pehrson | 5 * Copyright (c) 1998-2014 Glenn Randers-Pehrson |
| 6 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) | 6 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) |
| 7 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) | 7 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) |
| 8 * | 8 * |
| 9 * This code is released under the libpng license. | 9 * This code is released under the libpng license. |
| 10 * For conditions of distribution and use, see the disclaimer | 10 * For conditions of distribution and use, see the disclaimer |
| 11 * and license in png.h | 11 * and license in png.h |
| 12 */ | 12 */ |
| 13 | 13 |
| 14 #define PNG_INTERNAL | 14 #define PNG_INTERNAL |
| 15 #define PNG_NO_EXTERN | 15 #define PNG_NO_EXTERN |
| 16 #define PNG_NO_PEDANTIC_WARNINGS | 16 #define PNG_NO_PEDANTIC_WARNINGS |
| 17 #include "png.h" | 17 #include "png.h" |
| 18 | 18 |
| 19 /* Generate a compiler error if there is an old png.h in the search path. */ | 19 /* Generate a compiler error if there is an old png.h in the search path. */ |
| 20 typedef version_1_2_45 Your_png_h_is_not_version_1_2_45; | 20 typedef version_1_2_52 Your_png_h_is_not_version_1_2_52; |
| 21 | 21 |
| 22 /* Version information for C files. This had better match the version | 22 /* Version information for C files. This had better match the version |
| 23 * string defined in png.h. | 23 * string defined in png.h. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifdef PNG_USE_GLOBAL_ARRAYS | 26 #ifdef PNG_USE_GLOBAL_ARRAYS |
| 27 /* png_libpng_ver was changed to a function in version 1.0.5c */ | 27 /* png_libpng_ver was changed to a function in version 1.0.5c */ |
| 28 PNG_CONST char png_libpng_ver[18] = PNG_LIBPNG_VER_STRING; | 28 PNG_CONST char png_libpng_ver[18] = PNG_LIBPNG_VER_STRING; |
| 29 | 29 |
| 30 #ifdef PNG_READ_SUPPORTED | 30 #ifdef PNG_READ_SUPPORTED |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 #endif /* _WIN32_WCE */ | 711 #endif /* _WIN32_WCE */ |
| 712 return ((png_charp)png_ptr->time_buffer); | 712 return ((png_charp)png_ptr->time_buffer); |
| 713 } | 713 } |
| 714 #endif /* PNG_TIME_RFC1123_SUPPORTED */ | 714 #endif /* PNG_TIME_RFC1123_SUPPORTED */ |
| 715 | 715 |
| 716 #endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */ | 716 #endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */ |
| 717 | 717 |
| 718 png_charp PNGAPI | 718 png_charp PNGAPI |
| 719 png_get_copyright(png_structp png_ptr) | 719 png_get_copyright(png_structp png_ptr) |
| 720 { | 720 { |
| 721 png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */ | 721 PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */ |
| 722 #ifdef PNG_STRING_COPYRIGHT | 722 #ifdef PNG_STRING_COPYRIGHT |
| 723 return PNG_STRING_COPYRIGHT | 723 return PNG_STRING_COPYRIGHT |
| 724 #else | 724 #else |
| 725 #ifdef __STDC__ | 725 #ifdef __STDC__ |
| 726 return ((png_charp) PNG_STRING_NEWLINE \ | 726 return ((png_charp) PNG_STRING_NEWLINE \ |
| 727 "libpng version 1.2.45 - July 7, 2011" PNG_STRING_NEWLINE \ | 727 "libpng version 1.2.52 - November 20, 2014" PNG_STRING_NEWLINE \ |
| 728 "Copyright (c) 1998-2010 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ | 728 "Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ |
| 729 "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ | 729 "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ |
| 730 "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ | 730 "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ |
| 731 PNG_STRING_NEWLINE); | 731 PNG_STRING_NEWLINE); |
| 732 #else | 732 #else |
| 733 return ((png_charp) "libpng version 1.2.45 - July 7, 2011\ | 733 return ((png_charp) "libpng version 1.2.52 - November 20, 2014\ |
| 734 Copyright (c) 1998-2010 Glenn Randers-Pehrson\ | 734 Copyright (c) 1998-2014 Glenn Randers-Pehrson\ |
| 735 Copyright (c) 1996-1997 Andreas Dilger\ | 735 Copyright (c) 1996-1997 Andreas Dilger\ |
| 736 Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."); | 736 Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."); |
| 737 #endif | 737 #endif |
| 738 #endif | 738 #endif |
| 739 } | 739 } |
| 740 | 740 |
| 741 /* The following return the library version as a short string in the | 741 /* The following return the library version as a short string in the |
| 742 * format 1.0.0 through 99.99.99zz. To get the version of *.h files | 742 * format 1.0.0 through 99.99.99zz. To get the version of *.h files |
| 743 * used with your application, print out PNG_LIBPNG_VER_STRING, which | 743 * used with your application, print out PNG_LIBPNG_VER_STRING, which |
| 744 * is defined in png.h. | 744 * is defined in png.h. |
| 745 * Note: now there is no difference between png_get_libpng_ver() and | 745 * Note: now there is no difference between png_get_libpng_ver() and |
| 746 * png_get_header_ver(). Due to the version_nn_nn_nn typedef guard, | 746 * png_get_header_ver(). Due to the version_nn_nn_nn typedef guard, |
| 747 * it is guaranteed that png.c uses the correct version of png.h. | 747 * it is guaranteed that png.c uses the correct version of png.h. |
| 748 */ | 748 */ |
| 749 png_charp PNGAPI | 749 png_charp PNGAPI |
| 750 png_get_libpng_ver(png_structp png_ptr) | 750 png_get_libpng_ver(png_structp png_ptr) |
| 751 { | 751 { |
| 752 /* Version of *.c files used when building libpng */ | 752 /* Version of *.c files used when building libpng */ |
| 753 png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */ | 753 PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */ |
| 754 return ((png_charp) PNG_LIBPNG_VER_STRING); | 754 return ((png_charp) PNG_LIBPNG_VER_STRING); |
| 755 } | 755 } |
| 756 | 756 |
| 757 png_charp PNGAPI | 757 png_charp PNGAPI |
| 758 png_get_header_ver(png_structp png_ptr) | 758 png_get_header_ver(png_structp png_ptr) |
| 759 { | 759 { |
| 760 /* Version of *.h files used when building libpng */ | 760 /* Version of *.h files used when building libpng */ |
| 761 png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */ | 761 PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */ |
| 762 return ((png_charp) PNG_LIBPNG_VER_STRING); | 762 return ((png_charp) PNG_LIBPNG_VER_STRING); |
| 763 } | 763 } |
| 764 | 764 |
| 765 png_charp PNGAPI | 765 png_charp PNGAPI |
| 766 png_get_header_version(png_structp png_ptr) | 766 png_get_header_version(png_structp png_ptr) |
| 767 { | 767 { |
| 768 /* Returns longer string containing both version and date */ | 768 /* Returns longer string containing both version and date */ |
| 769 png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */ | 769 PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */ |
| 770 #ifdef __STDC__ | 770 #ifdef __STDC__ |
| 771 return ((png_charp) PNG_HEADER_VERSION_STRING | 771 return ((png_charp) PNG_HEADER_VERSION_STRING |
| 772 #ifndef PNG_READ_SUPPORTED | 772 #ifndef PNG_READ_SUPPORTED |
| 773 " (NO READ SUPPORT)" | 773 " (NO READ SUPPORT)" |
| 774 #endif | 774 #endif |
| 775 PNG_STRING_NEWLINE); | 775 PNG_STRING_NEWLINE); |
| 776 #else | 776 #else |
| 777 return ((png_charp) PNG_HEADER_VERSION_STRING); | 777 return ((png_charp) PNG_HEADER_VERSION_STRING); |
| 778 #endif | 778 #endif |
| 779 } | 779 } |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 png_warning(png_ptr, "Invalid image width in IHDR"); | 1002 png_warning(png_ptr, "Invalid image width in IHDR"); |
| 1003 error = 1; | 1003 error = 1; |
| 1004 } | 1004 } |
| 1005 | 1005 |
| 1006 if ( height > PNG_UINT_31_MAX) | 1006 if ( height > PNG_UINT_31_MAX) |
| 1007 { | 1007 { |
| 1008 png_warning(png_ptr, "Invalid image height in IHDR"); | 1008 png_warning(png_ptr, "Invalid image height in IHDR"); |
| 1009 error = 1; | 1009 error = 1; |
| 1010 } | 1010 } |
| 1011 | 1011 |
| 1012 if ( width > (PNG_UINT_32_MAX | |
| 1013 >> 3) /* 8-byte RGBA pixels */ | |
| 1014 - 64 /* bigrowbuf hack */ | |
| 1015 - 1 /* filter byte */ | |
| 1016 - 7*8 /* rounding of width to multiple of 8 pixels */ | |
| 1017 - 8) /* extra max_pixel_depth pad */ | |
| 1018 png_warning(png_ptr, "Width is too large for libpng to process pixels"); | |
| 1019 | |
| 1020 /* Check other values */ | 1012 /* Check other values */ |
| 1021 if (bit_depth != 1 && bit_depth != 2 && bit_depth != 4 && | 1013 if (bit_depth != 1 && bit_depth != 2 && bit_depth != 4 && |
| 1022 bit_depth != 8 && bit_depth != 16) | 1014 bit_depth != 8 && bit_depth != 16) |
| 1023 { | 1015 { |
| 1024 png_warning(png_ptr, "Invalid bit depth in IHDR"); | 1016 png_warning(png_ptr, "Invalid bit depth in IHDR"); |
| 1025 error = 1; | 1017 error = 1; |
| 1026 } | 1018 } |
| 1027 | 1019 |
| 1028 if (color_type < 0 || color_type == 1 || | 1020 if (color_type < 0 || color_type == 1 || |
| 1029 color_type == 5 || color_type > 6) | 1021 color_type == 5 || color_type > 6) |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1091 { | 1083 { |
| 1092 png_warning(png_ptr, "Unknown filter method in IHDR"); | 1084 png_warning(png_ptr, "Unknown filter method in IHDR"); |
| 1093 error = 1; | 1085 error = 1; |
| 1094 } | 1086 } |
| 1095 #endif | 1087 #endif |
| 1096 | 1088 |
| 1097 if (error == 1) | 1089 if (error == 1) |
| 1098 png_error(png_ptr, "Invalid IHDR data"); | 1090 png_error(png_ptr, "Invalid IHDR data"); |
| 1099 } | 1091 } |
| 1100 #endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */ | 1092 #endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */ |
| OLD | NEW |