11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * version 2 for more details (a copy is included in the LICENSE file that 14 * accompanied this code). 15 * 16 * You should have received a copy of the GNU General Public License version 17 * 2 along with this work; if not, write to the Free Software Foundation, 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 * 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * questions. 23 */ 24 25 /* pngget.c - retrieval of values from info struct 26 * 27 * This file is available under and governed by the GNU General Public 28 * License version 2 only, as published by the Free Software Foundation. 29 * However, the following notice accompanied the original version of this 30 * file and, per its terms, should not be removed: 31 32 * Last changed in libpng 1.6.26 [October 20, 2016] 33 * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson 34 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) 35 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) 36 * 37 * This code is released under the libpng license. 38 * For conditions of distribution and use, see the disclaimer 39 * and license in png.h 40 * 41 */ 42 43 #include "pngpriv.h" 44 45 #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) 46 47 png_uint_32 PNGAPI 48 png_get_valid(png_const_structrp png_ptr, png_const_inforp info_ptr, 49 png_uint_32 flag) 50 { 51 if (png_ptr != NULL && info_ptr != NULL) 52 return(info_ptr->valid & flag); 53 778 /* This is somewhat irrelevant since the profile data returned has 779 * actually been uncompressed. 780 */ 781 *compression_type = PNG_COMPRESSION_TYPE_BASE; 782 return (PNG_INFO_iCCP); 783 } 784 785 return (0); 786 } 787 #endif 788 789 #ifdef PNG_sPLT_SUPPORTED 790 int PNGAPI 791 png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr, 792 png_sPLT_tpp spalettes) 793 { 794 if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL) 795 { 796 *spalettes = info_ptr->splt_palettes; 797 return info_ptr->splt_palettes_num; 798 } 799 800 return (0); 801 } 802 #endif 803 804 #ifdef PNG_hIST_SUPPORTED 805 png_uint_32 PNGAPI 806 png_get_hIST(png_const_structrp png_ptr, png_inforp info_ptr, 807 png_uint_16p *hist) 808 { 809 png_debug1(1, "in %s retrieval function", "hIST"); 810 811 if (png_ptr != NULL && info_ptr != NULL && 812 (info_ptr->valid & PNG_INFO_hIST) != 0 && hist != NULL) 813 { 814 *hist = info_ptr->hist; 815 return (PNG_INFO_hIST); 816 } 817 | 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * version 2 for more details (a copy is included in the LICENSE file that 14 * accompanied this code). 15 * 16 * You should have received a copy of the GNU General Public License version 17 * 2 along with this work; if not, write to the Free Software Foundation, 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 * 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * questions. 23 */ 24 25 /* pngget.c - retrieval of values from info struct 26 * 27 * This file is available under and governed by the GNU General Public 28 * License version 2 only, as published by the Free Software Foundation. 29 * However, the following notice accompanied the original version of this 30 * file and, per its terms, should not be removed: 31 * 32 * Last changed in libpng 1.6.32 [August 24, 2017] 33 * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson 34 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) 35 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) 36 * 37 * This code is released under the libpng license. 38 * For conditions of distribution and use, see the disclaimer 39 * and license in png.h 40 * 41 */ 42 43 #include "pngpriv.h" 44 45 #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) 46 47 png_uint_32 PNGAPI 48 png_get_valid(png_const_structrp png_ptr, png_const_inforp info_ptr, 49 png_uint_32 flag) 50 { 51 if (png_ptr != NULL && info_ptr != NULL) 52 return(info_ptr->valid & flag); 53 778 /* This is somewhat irrelevant since the profile data returned has 779 * actually been uncompressed. 780 */ 781 *compression_type = PNG_COMPRESSION_TYPE_BASE; 782 return (PNG_INFO_iCCP); 783 } 784 785 return (0); 786 } 787 #endif 788 789 #ifdef PNG_sPLT_SUPPORTED 790 int PNGAPI 791 png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr, 792 png_sPLT_tpp spalettes) 793 { 794 if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL) 795 { 796 *spalettes = info_ptr->splt_palettes; 797 return info_ptr->splt_palettes_num; 798 } 799 800 return (0); 801 } 802 #endif 803 804 #ifdef PNG_eXIf_SUPPORTED 805 png_uint_32 PNGAPI 806 png_get_eXIf(png_const_structrp png_ptr, png_inforp info_ptr, 807 png_bytep *exif) 808 { 809 png_warning(png_ptr, "png_get_eXIf does not work; use png_get_eXIf_1"); 810 PNG_UNUSED(info_ptr) 811 PNG_UNUSED(exif) 812 return 0; 813 } 814 815 png_uint_32 PNGAPI 816 png_get_eXIf_1(png_const_structrp png_ptr, png_const_inforp info_ptr, 817 png_uint_32 *num_exif, png_bytep *exif) 818 { 819 png_debug1(1, "in %s retrieval function", "eXIf"); 820 821 if (png_ptr != NULL && info_ptr != NULL && 822 (info_ptr->valid & PNG_INFO_eXIf) != 0 && exif != NULL) 823 { 824 *num_exif = info_ptr->num_exif; 825 *exif = info_ptr->exif; 826 return (PNG_INFO_eXIf); 827 } 828 829 return (0); 830 } 831 #endif 832 833 #ifdef PNG_hIST_SUPPORTED 834 png_uint_32 PNGAPI 835 png_get_hIST(png_const_structrp png_ptr, png_inforp info_ptr, 836 png_uint_16p *hist) 837 { 838 png_debug1(1, "in %s retrieval function", "hIST"); 839 840 if (png_ptr != NULL && info_ptr != NULL && 841 (info_ptr->valid & PNG_INFO_hIST) != 0 && hist != NULL) 842 { 843 *hist = info_ptr->hist; 844 return (PNG_INFO_hIST); 845 } 846 |