From 7c709f039f7ff3cc92eea03af0660a171ef0673d Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Wed, 2 Aug 2017 16:48:11 -0500 Subject: [PATCH] [libpng16] Restored png_get_eXIf() and png_set_eXIf() to maintain API compatability. --- ANNOUNCE | 21 +++++++++++++-------- CHANGES | 5 +++++ libpng-manual.txt | 10 +++++++--- libpng.3 | 20 ++++++++++++++------ png.h | 26 +++++++++++++++----------- pngget.c | 8 ++++++++ pngset.c | 8 ++++++++ pngtest.c | 13 +++++++------ scripts/symbols.def | 8 +++++--- 9 files changed, 82 insertions(+), 37 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 2054a0075..79d6445f8 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,4 +1,4 @@ -Libpng 1.6.32beta04 - August 2, 2017 +Libpng 1.6.32beta05 - August 2, 2017 This is not intended to be a public release. It will be replaced within a few weeks by a public version or by another test version. @@ -8,20 +8,20 @@ Files available for download: Source files with LF line endings (for Unix/Linux) and with a "configure" script - 1.6.32beta04.tar.xz (LZMA-compressed, recommended) - 1.6.32beta04.tar.gz + 1.6.32beta05.tar.xz (LZMA-compressed, recommended) + 1.6.32beta05.tar.gz Source files with CRLF line endings (for Windows), without the "configure" script - lp1632b04.7z (LZMA-compressed, recommended) - lp1632b04.zip + lp1632b05.7z (LZMA-compressed, recommended) + lp1632b05.zip Other information: - 1.6.32beta04-README.txt - 1.6.32beta04-LICENSE.txt - libpng-1.6.32beta04-*.asc (armored detached GPG signatures) + 1.6.32beta05-README.txt + 1.6.32beta05-LICENSE.txt + libpng-1.6.32beta05-*.asc (armored detached GPG signatures) Changes since the last public release (1.6.31): @@ -45,6 +45,11 @@ Version 1.6.32beta03 [August 2, 2017] (Bug report from the OSS-fuzz project). Version 1.6.32beta04 [August 2, 2017] + Replaced local eXIf_buf with info_ptr-eXIf_buf in png_handle_eXIf(). + Update libpng.3 and libpng-manual.txt about eXIf functions. + +Version 1.6.32beta05 [August 2, 2017] + Restored png_get_eXIf() and png_set_eXIf() to maintain API compatability. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index 295572047..d6b3e2436 100644 --- a/CHANGES +++ b/CHANGES @@ -5928,6 +5928,11 @@ Version 1.6.32beta03 [August 2, 2017] (Bug report from the OSS-fuzz project). Version 1.6.32beta04 [August 2, 2017] + Replaced local eXIf_buf with info_ptr-eXIf_buf in png_handle_eXIf(). + Update libpng.3 and libpng-manual.txt about eXIf functions. + +Version 1.6.32beta05 [August 2, 2017] + Restored png_get_eXIf() and png_set_eXIf() to maintain API compatability. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/libpng-manual.txt b/libpng-manual.txt index 11c3b1ec3..b3aa92328 100644 --- a/libpng-manual.txt +++ b/libpng-manual.txt @@ -1,6 +1,6 @@ libpng-manual.txt - A description on how to use and modify libpng - libpng version 1.6.32beta04 - August 2, 2017 + libpng version 1.6.32beta05 - August 2, 2017 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2017 Glenn Randers-Pehrson @@ -11,7 +11,7 @@ libpng-manual.txt - A description on how to use and modify libpng Based on: - libpng versions 0.97, January 1998, through 1.6.32beta04 - August 2, 2017 + libpng versions 0.97, January 1998, through 1.6.32beta05 - August 2, 2017 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2017 Glenn Randers-Pehrson @@ -1453,6 +1453,8 @@ png_set_rgb_to_gray()). the single transparent color for non-paletted images (PNG_INFO_tRNS) + png_get_eXIf(png_ptr, info_ptr, &exif); + png_get_eXIf_1(png_ptr, info_ptr, &num_exif, &exif); (PNG_INFO_eXIf) @@ -3103,6 +3105,8 @@ width, height, bit_depth, and color_type must be the same in each call. single transparent color for non-paletted images (PNG_INFO_tRNS) + png_set_eXIf(png_ptr, info_ptr, exif); + png_set_eXIf_1(png_ptr, info_ptr, num_exif, exif); exif - Exif profile (array of @@ -5404,7 +5408,7 @@ Since the PNG Development group is an ad-hoc body, we can't make an official declaration. This is your unofficial assurance that libpng from version 0.71 and -upward through 1.6.32beta04 are Y2K compliant. It is my belief that earlier +upward through 1.6.32beta05 are Y2K compliant. It is my belief that earlier versions were also Y2K compliant. Libpng only has two year fields. One is a 2-byte unsigned integer diff --git a/libpng.3 b/libpng.3 index 3c856d2c2..e1bfe9cad 100644 --- a/libpng.3 +++ b/libpng.3 @@ -1,6 +1,6 @@ .TH LIBPNG 3 "August 2, 2017" .SH NAME -libpng \- Portable Network Graphics (PNG) Reference Library 1.6.32beta04 +libpng \- Portable Network Graphics (PNG) Reference Library 1.6.32beta05 .SH SYNOPSIS \fB #include \fP @@ -97,6 +97,8 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.6.32beta04 \fBpng_byte png_get_header_version (png_const_structp \fIpng_ptr\fP\fB);\fP +\fBpng_uint_32 png_get_eXIf (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fI*exif\fP\fB);\fP + \fBpng_uint_32 png_get_eXIf_1 (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fP\fInum_exif\fP\fB, png_bytep \fI*exif\fP\fB);\fP \fBpng_uint_32 png_get_hIST (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_uint_16p \fI*hist\fP\fB);\fP @@ -349,6 +351,8 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.6.32beta04 \fBvoid png_set_gray_to_rgb (png_structp \fIpng_ptr\fP\fB);\fP +\fBvoid png_set_eXIf (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fIexif\fP\fB);\fP + \fBvoid png_set_eXIf_1 (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fP\fInum_exif\fP\fB, png_bytep \fIexif\fP\fB);\fP \fBvoid png_set_hIST (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_16p \fIhist\fP\fB);\fP @@ -514,7 +518,7 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng. .SH LIBPNG.TXT libpng-manual.txt - A description on how to use and modify libpng - libpng version 1.6.32beta04 - August 2, 2017 + libpng version 1.6.32beta05 - August 2, 2017 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2017 Glenn Randers-Pehrson @@ -525,7 +529,7 @@ libpng-manual.txt - A description on how to use and modify libpng Based on: - libpng versions 0.97, January 1998, through 1.6.32beta04 - August 2, 2017 + libpng versions 0.97, January 1998, through 1.6.32beta05 - August 2, 2017 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2017 Glenn Randers-Pehrson @@ -1967,6 +1971,8 @@ png_set_rgb_to_gray()). the single transparent color for non-paletted images (PNG_INFO_tRNS) + png_get_eXIf(png_ptr, info_ptr, &exif); + png_get_eXIf_1(png_ptr, info_ptr, &num_exif, &exif); (PNG_INFO_eXIf) @@ -3617,6 +3623,8 @@ width, height, bit_depth, and color_type must be the same in each call. single transparent color for non-paletted images (PNG_INFO_tRNS) + png_set_eXIf(png_ptr, info_ptr, exif); + png_set_eXIf_1(png_ptr, info_ptr, num_exif, exif); exif - Exif profile (array of @@ -5918,7 +5926,7 @@ Since the PNG Development group is an ad-hoc body, we can't make an official declaration. This is your unofficial assurance that libpng from version 0.71 and -upward through 1.6.32beta04 are Y2K compliant. It is my belief that earlier +upward through 1.6.32beta05 are Y2K compliant. It is my belief that earlier versions were also Y2K compliant. Libpng only has two year fields. One is a 2-byte unsigned integer @@ -6076,7 +6084,7 @@ possible without all of you. Thanks to Frank J. T. Wojcik for helping with the documentation. -Libpng version 1.6.32beta04 - August 2, 2017: +Libpng version 1.6.32beta05 - August 2, 2017: Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net). @@ -6101,7 +6109,7 @@ this sentence. This code is released under the libpng license. -libpng versions 1.0.7, July 1, 2000 through 1.6.32beta04, August 2, 2017 are +libpng versions 1.0.7, July 1, 2000 through 1.6.32beta05, August 2, 2017 are Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are derived from libpng-1.0.6, and are distributed according to the same disclaimer and license as libpng-1.0.6 with the following individuals diff --git a/png.h b/png.h index 257d02734..63cc603e5 100644 --- a/png.h +++ b/png.h @@ -1,7 +1,7 @@ /* png.h - header file for PNG reference library * - * libpng version 1.6.32beta04, August 2, 2017 + * libpng version 1.6.32beta05, August 2, 2017 * * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -12,7 +12,7 @@ * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.6.32beta04, August 2, 2017: + * libpng versions 0.97, January 1998, through 1.6.32beta05, August 2, 2017: * Glenn Randers-Pehrson. * See also "Contributing Authors", below. */ @@ -25,7 +25,7 @@ * * This code is released under the libpng license. * - * libpng versions 1.0.7, July 1, 2000 through 1.6.32beta04, August 2, 2017 are + * libpng versions 1.0.7, July 1, 2000 through 1.6.32beta05, August 2, 2017 are * Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are * derived from libpng-1.0.6, and are distributed according to the same * disclaimer and license as libpng-1.0.6 with the following individuals @@ -247,7 +247,7 @@ * an official declaration. * * This is your unofficial assurance that libpng from version 0.71 and - * upward through 1.6.32beta04 are Y2K compliant. It is my belief that + * upward through 1.6.32beta05 are Y2K compliant. It is my belief that * earlier versions were also Y2K compliant. * * Libpng only has two year fields. One is a 2-byte unsigned integer @@ -309,8 +309,8 @@ */ /* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.6.32beta04" -#define PNG_HEADER_VERSION_STRING " libpng version 1.6.32beta04 - August 2, 2017\n" +#define PNG_LIBPNG_VER_STRING "1.6.32beta05" +#define PNG_HEADER_VERSION_STRING " libpng version 1.6.32beta05 - August 2, 2017\n" #define PNG_LIBPNG_VER_SONUM 16 #define PNG_LIBPNG_VER_DLLNUM 16 @@ -324,7 +324,7 @@ * PNG_LIBPNG_VER_STRING, omitting any leading zero: */ -#define PNG_LIBPNG_VER_BUILD 04 +#define PNG_LIBPNG_VER_BUILD 05 /* Release Status */ #define PNG_LIBPNG_BUILD_ALPHA 1 @@ -459,7 +459,7 @@ extern "C" { /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ -typedef char* png_libpng_version_1_6_32beta04; +typedef char* png_libpng_version_1_6_32beta05; /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. * @@ -2010,9 +2010,13 @@ PNG_FIXED_EXPORT(233, void, png_set_cHRM_XYZ_fixed, (png_const_structrp png_ptr, #endif #ifdef PNG_eXIf_SUPPORTED -PNG_EXPORT(246, png_uint_32, png_get_eXIf_1, (png_const_structrp png_ptr, +PNG_EXPORT(246, png_uint_32, png_get_eXIf, (png_const_structrp png_ptr, + png_inforp info_ptr, png_bytep *exif)); +PNG_EXPORT(247, void, png_set_eXIf, (png_const_structrp png_ptr, + png_inforp info_ptr, const png_bytep exif)); +PNG_EXPORT(248, png_uint_32, png_get_eXIf_1, (png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 *num_exif, png_bytep *exif)); -PNG_EXPORT(247, void, png_set_eXIf_1, (png_const_structrp png_ptr, +PNG_EXPORT(249, void, png_set_eXIf_1, (png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 num_exif, const png_bytep exif)); #endif @@ -3259,7 +3263,7 @@ PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option, * one to use is one more than this.) */ #ifdef PNG_EXPORT_LAST_ORDINAL - PNG_EXPORT_LAST_ORDINAL(247); + PNG_EXPORT_LAST_ORDINAL(249); #endif #ifdef __cplusplus diff --git a/pngget.c b/pngget.c index b9771e61a..1f85f6c74 100644 --- a/pngget.c +++ b/pngget.c @@ -774,6 +774,14 @@ png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr, #endif #ifdef PNG_eXIf_SUPPORTED +png_uint_32 PNGAPI +png_get_eXIf(png_const_structrp png_ptr, png_inforp info_ptr, + png_bytep *exif) +{ + png_uint_32 num_exif = (png_uint_32) strlen((char *) exif); + return (png_get_eXIf_1(png_ptr, info_ptr, &num_exif, exif)); +} + png_uint_32 PNGAPI png_get_eXIf_1(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 *num_exif, png_bytep *exif) diff --git a/pngset.c b/pngset.c index 55a0e5c91..49fc2bb10 100644 --- a/pngset.c +++ b/pngset.c @@ -135,6 +135,14 @@ png_set_cHRM_XYZ(png_const_structrp png_ptr, png_inforp info_ptr, double red_X, #endif /* cHRM */ #ifdef PNG_eXIf_SUPPORTED +void PNGAPI +png_set_eXIf(png_const_structrp png_ptr, png_inforp info_ptr, + const png_bytep eXIf_buf) +{ + png_set_eXIf_1(png_ptr, info_ptr, (png_uint_32)strlen((char *)eXIf_buf), + (const png_bytep) eXIf_buf); +} + void PNGAPI png_set_eXIf_1(png_const_structrp png_ptr, png_inforp info_ptr, const png_uint_32 num_exif, const png_bytep eXIf_buf) diff --git a/pngtest.c b/pngtest.c index 64d5da86b..50d27ea44 100644 --- a/pngtest.c +++ b/pngtest.c @@ -1201,15 +1201,16 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) #ifdef PNG_READ_eXIf_SUPPORTED { png_bytep exif=NULL; - png_uint_32 exif_length; + size_t exif_length; - if (png_get_eXIf_1(read_ptr, read_info_ptr, &exif_length, &exif) != 0) + if (png_get_eXIf(read_ptr, read_info_ptr, &exif) != 0) { + exif_length=strlen((const char *)exif); if (exif_length > 1) - printf(" eXIf type %c%c, %d bytes\n",exif[0],exif[1], - (int)exif_length); + printf(" eXIf type %c%c, %lu bytes\n",exif[0],exif[1], + exif_length); # ifdef PNG_WRITE_eXIf_SUPPORTED - png_set_eXIf_1(write_ptr, write_info_ptr, exif_length, exif); + png_set_eXIf(write_ptr, write_info_ptr, exif); # endif } } @@ -2130,4 +2131,4 @@ main(void) #endif /* Generate a compiler error if there is an old png.h in the search path. */ -typedef png_libpng_version_1_6_32beta04 Your_png_h_is_not_version_1_6_32beta04; +typedef png_libpng_version_1_6_32beta05 Your_png_h_is_not_version_1_6_32beta05; diff --git a/scripts/symbols.def b/scripts/symbols.def index 03deb447d..a5fcb1034 100644 --- a/scripts/symbols.def +++ b/scripts/symbols.def @@ -1,4 +1,4 @@ -;Version 1.6.32beta04 +;Version 1.6.32beta05 ;-------------------------------------------------------------- ; LIBPNG symbol list as a Win32 DEF file ; Contains all the symbols that can be exported from libpng @@ -250,5 +250,7 @@ EXPORTS png_get_palette_max @243 png_set_option @244 png_image_write_to_memory @245 - png_get_eXIf_1 @246 - png_set_eXIf_1 @247 + png_get_eXIf @246 + png_set_eXIf @247 + png_get_eXIf_1 @248 + png_set_eXIf_1 @249 -- GitLab