From f98726ae984f68e2f2ae13cd65f0a4c810bdb512 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Fri, 19 Feb 2010 09:54:53 -0600 Subject: [PATCH] [devel] Added exported png_longjmp() function. --- ANNOUNCE | 1 + CHANGES | 1 + contrib/gregbook/readpng2.c | 2 +- contrib/gregbook/writepng.c | 2 +- libpng-1.5.0beta07.txt | 6 +++--- libpng.3 | 18 +++++++++++------- png.h | 16 +++++++++++----- pngerror.c | 17 +++++++++++------ 8 files changed, 40 insertions(+), 23 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 5a49f37af..eab158c17 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -58,6 +58,7 @@ version 1.5.0beta07 [February 19, 2010] wherever png_snprintf() is used to construct error and warning messages. Noted in scripts/makefile.mingw that it expects to be run under MSYS. Removed obsolete unused MMX-querying support from contrib/gregbook + Added exported png_longjmp() function. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index 76501ca41..480dc7981 100644 --- a/CHANGES +++ b/CHANGES @@ -2534,6 +2534,7 @@ version 1.5.0beta07 [February 19, 2010] Changed #ifdef PNG_NO_STDIO_SUPPORTED to #ifdef PNG_NO_CONSOLE_IO_SUPPORTED wherever png_snprintf() is used to construct error and warning messages. Removed obsolete unused MMX-querying support from contrib/gregbook + Added exported png_longjmp() function. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/contrib/gregbook/readpng2.c b/contrib/gregbook/readpng2.c index eb53030a6..5dd6d7c4f 100644 --- a/contrib/gregbook/readpng2.c +++ b/contrib/gregbook/readpng2.c @@ -480,5 +480,5 @@ static void readpng2_error_handler(png_structp png_ptr, png_const_charp msg) exit(99); } - longjmp(mainprog_ptr->jmpbuf, 1); + png_longjmp(mainprog_ptr, 1); } diff --git a/contrib/gregbook/writepng.c b/contrib/gregbook/writepng.c index e6d81ea40..7b32aad68 100644 --- a/contrib/gregbook/writepng.c +++ b/contrib/gregbook/writepng.c @@ -388,5 +388,5 @@ static void writepng_error_handler(png_structp png_ptr, png_const_charp msg) exit(99); } - longjmp(mainprog_ptr->jmpbuf, 1); + png_longjmp(mainprog_ptr, 1); } diff --git a/libpng-1.5.0beta07.txt b/libpng-1.5.0beta07.txt index 73e49d994..1f62b180a 100644 --- a/libpng-1.5.0beta07.txt +++ b/libpng-1.5.0beta07.txt @@ -1,6 +1,6 @@ libpng.txt - A description on how to use and modify libpng - libpng version 1.5.0beta07 - February 14, 2010 + libpng version 1.5.0beta07 - February 19, 2010 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2009 Glenn Randers-Pehrson @@ -11,7 +11,7 @@ libpng.txt - A description on how to use and modify libpng Based on: - libpng versions 0.97, January 1998, through 1.5.0beta07 - February 14, 2010 + libpng versions 0.97, January 1998, through 1.5.0beta07 - February 19, 2010 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2009 Glenn Randers-Pehrson @@ -3245,7 +3245,7 @@ Other rules can be inferred by inspecting the libpng source. XIII. Y2K Compliance in libpng -February 14, 2010 +February 19, 2010 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. diff --git a/libpng.3 b/libpng.3 index a411801b7..28d369660 100644 --- a/libpng.3 +++ b/libpng.3 @@ -1,4 +1,4 @@ -.TH LIBPNG 3 "February 14, 2010" +.TH LIBPNG 3 "February 19, 2010" .SH NAME libpng \- Portable Network Graphics (PNG) Reference Library 1.5.0beta07 .SH SYNOPSIS @@ -338,6 +338,10 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.5.0beta07 \fI\fB +\fBvoid png_longjmp (png_structp \fP\fIpng_ptr\fP\fB, int \fIval\fP\fB);\fP + +\fI\fB + \fBpng_voidp png_malloc (png_structp \fP\fIpng_ptr\fP\fB, png_alloc_size_t \fIsize\fP\fB);\fP \fI\fB @@ -785,7 +789,7 @@ Following is a copy of the libpng.txt file that accompanies libpng. .SH LIBPNG.TXT libpng.txt - A description on how to use and modify libpng - libpng version 1.5.0beta07 - February 14, 2010 + libpng version 1.5.0beta07 - February 19, 2010 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2009 Glenn Randers-Pehrson @@ -796,7 +800,7 @@ libpng.txt - A description on how to use and modify libpng Based on: - libpng versions 0.97, January 1998, through 1.5.0beta07 - February 14, 2010 + libpng versions 0.97, January 1998, through 1.5.0beta07 - February 19, 2010 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2009 Glenn Randers-Pehrson @@ -4030,7 +4034,7 @@ Other rules can be inferred by inspecting the libpng source. .SH XIII. Y2K Compliance in libpng -February 14, 2010 +February 19, 2010 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. @@ -4268,7 +4272,7 @@ possible without all of you. Thanks to Frank J. T. Wojcik for helping with the documentation. -Libpng version 1.5.0beta07 - February 14, 2010: +Libpng version 1.5.0beta07 - February 19, 2010: Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net). @@ -4291,7 +4295,7 @@ this sentence. This code is released under the libpng license. -libpng versions 1.2.6, August 15, 2004, through 1.5.0beta07, February 14, 2010, are +libpng versions 1.2.6, August 15, 2004, through 1.5.0beta07, February 19, 2010, are Copyright (c) 2004,2006-2007 Glenn Randers-Pehrson, and are distributed according to the same disclaimer and license as libpng-1.2.5 with the following individual added to the list of Contributing Authors @@ -4390,7 +4394,7 @@ certification mark of the Open Source Initiative. Glenn Randers-Pehrson glennrp at users.sourceforge.net -February 14, 2010 +February 19, 2010 .\" end of man page diff --git a/png.h b/png.h index ff73f1916..01bb32d8b 100644 --- a/png.h +++ b/png.h @@ -1,7 +1,7 @@ /* png.h - header file for PNG reference library * - * libpng version 1.5.0beta07 - February 14, 2010 + * libpng version 1.5.0beta07 - February 19, 2010 * Copyright (c) 1998-2010 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -11,7 +11,7 @@ * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.5.0beta07 - February 14, 2010: Glenn + * libpng versions 0.97, January 1998, through 1.5.0beta07 - February 19, 2010: Glenn * See also "Contributing Authors", below. * * Note about libpng version numbers: @@ -169,7 +169,7 @@ * * This code is released under the libpng license. * - * libpng versions 1.2.6, August 15, 2004, through 1.5.0beta07, February 14, 2010, are + * libpng versions 1.2.6, August 15, 2004, through 1.5.0beta07, February 19, 2010, are * Copyright (c) 2004, 2006-2010 Glenn Randers-Pehrson, and are * distributed according to the same disclaimer and license as libpng-1.2.5 * with the following individual added to the list of Contributing Authors: @@ -281,7 +281,7 @@ * Y2K compliance in libpng: * ========================= * - * February 14, 2010 + * February 19, 2010 * * Since the PNG Development group is an ad-hoc body, we can't make * an official declaration. @@ -345,7 +345,7 @@ /* Version information for png.h - this should match the version in png.c */ #define PNG_LIBPNG_VER_STRING "1.5.0beta07" #define PNG_HEADER_VERSION_STRING \ - " libpng version 1.5.0beta07 - February 14, 2010\n" + " libpng version 1.5.0beta07 - February 19, 2010\n" #define PNG_LIBPNG_VER_SONUM 15 #define PNG_LIBPNG_VER_DLLNUM 15 @@ -863,6 +863,12 @@ extern PNG_EXPORT(jmp_buf*, png_set_longjmp_fn) # define png_jmpbuf(png_ptr) \ (LIBPNG_WAS_COMPILED_WITH__PNG_NO_SETJMP) #endif +/* This function should be used by libpng applications in place of + * longjmp(png_ptr->jmpbuf, val). If longjmp_fn() has been set, it + * will use it; otherwise it will call PNG_ABORT(). This function was + * added in libpng-1.5.0. + */ +extern PNG_EXPORT(void, png_longjmp) PNGARG((png_structp png_ptr, int val)); /* Reset the compression stream */ extern PNG_EXPORT(int,png_reset_zstream) PNGARG((png_structp png_ptr)); diff --git a/pngerror.c b/pngerror.c index fa926d294..f5f7b06ee 100644 --- a/pngerror.c +++ b/pngerror.c @@ -1,7 +1,7 @@ /* pngerror.c - stub functions for i/o and memory allocation * - * Last changed in libpng 1.5.0 [February 14, 2010] + * Last changed in libpng 1.5.0 [February 19, 2010] * Copyright (c) 1998-2010 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -289,7 +289,15 @@ png_default_error(png_structp png_ptr, png_const_charp error_message) fprintf(stderr, PNG_STRING_NEWLINE); } #endif + png_longjmp(png_ptr, 1); +#ifndef PNG_CONSOLE_IO_SUPPORTED + error_message = error_message; /* Make compiler happy */ +#endif +} +void PNGAPI +png_longjmp(png_structp png_ptr, int val) +{ #ifdef PNG_SETJMP_SUPPORTED if (png_ptr && png_ptr->longjmp_fn) { @@ -297,18 +305,15 @@ png_default_error(png_structp png_ptr, png_const_charp error_message) { jmp_buf jmpbuf; png_memcpy(jmpbuf, png_ptr->jmpbuf, png_sizeof(jmp_buf)); - png_ptr->longjmp_fn(jmpbuf, 1); + png_ptr->longjmp_fn(jmpbuf, val); } # else - png_ptr->longjmp_fn(png_ptr->jmpbuf, 1); + png_ptr->longjmp_fn(png_ptr->jmpbuf, val); # endif } #endif /* Here if not setjmp support or if png_ptr is null. */ PNG_ABORT(); -#ifndef PNG_CONSOLE_IO_SUPPORTED - error_message = error_message; /* Make compiler happy */ -#endif } #ifdef PNG_WARNINGS_SUPPORTED