diff --git a/ANNOUNCE b/ANNOUNCE index fabf2c15c..6212c98d9 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -76,6 +76,7 @@ Version 1.7.0alpha03 [December 17, 2012] links and tests against zlib with a prefix; tests have been clarified; and irrelevant or obsolete things (as defined by the autotools man page) have been removed. + Documented new PNG_ABORT behavior in the manual and commentary in pngerror.c Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index b5dad4689..f83b0b700 100644 --- a/CHANGES +++ b/CHANGES @@ -4361,6 +4361,7 @@ Version 1.7.0alpha03 [December 17, 2012] links and tests against zlib with a prefix; tests have been clarified; and irrelevant or obsolete things (as defined by the autotools man page) have been removed. + Documented new PNG_ABORT behavior in the manual and commentary in pngerror.c 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 37049abf3..004f6a23b 100644 --- a/libpng-manual.txt +++ b/libpng-manual.txt @@ -432,7 +432,7 @@ If you would rather avoid the complexity of setjmp/longjmp issues, you can compile libpng with PNG_NO_SETJMP, in which case errors will result in a call to PNG_ABORT() which defaults to abort(). -You can #define PNG_ABORT() to a function that does something +You can #define PNG_ABORT to a function or other C code that does something more useful than abort(), as long as your function does not return. @@ -2562,9 +2562,9 @@ section below for more information on the libpng error handling. If you would rather avoid the complexity of setjmp/longjmp issues, you can compile libpng with PNG_NO_SETJMP, in which case -errors will result in a call to PNG_ABORT() which defaults to abort(). +errors will result in a call to PNG_ABORT which defaults to abort(). -You can #define PNG_ABORT() to a function that does something +You can #define PNG_ABORT to a function or other C code that does something more useful than abort(), as long as your function does not return. @@ -3943,7 +3943,7 @@ Error handling in libpng is done through png_error() and png_warning(). Errors handled through png_error() are fatal, meaning that png_error() should never return to its caller. Currently, this is handled via setjmp() and longjmp() (unless you have compiled libpng with -PNG_NO_SETJMP, in which case it is handled via PNG_ABORT()), +PNG_NO_SETJMP, in which case it is handled via PNG_ABORT), but you could change this to do things like exit() if you should wish, as long as your function does not return. @@ -4977,6 +4977,25 @@ Some functions that were deprecated in libpng-1.6.0 were removed: png_malloc_default(), and png_free_default(). +The PNG_ABORT() macro was changed to PNG_ABORT, and the default is now +"abort()" for all platforms (previously it was "ExitProcess(0)" on +Windows platforms). Starting with libpng-1.7.0 you have to define +PNG_ABORT instead of PNG_ABORT(), e.g., + + #if PNGCRUSH_LIBPNG_VER >= 10700 + # ifdef _WINDOWS_ + # define PNG_ABORT ExitProcess(0); + # else + # define PNG_ABORT abort(); + # endif + #else + # ifdef _WINDOWS_ + # define PNG_ABORT() ExitProcess(0) + # else + # define PNG_ABORT() abort() + # endif + #endif + The 8-bit compose and rgb_to_grayscale operations were made more accurate. While these did not introduce API incompatibility, there may be differences in unit test results. diff --git a/libpng.3 b/libpng.3 index 3952c89c1..1d2878a42 100644 --- a/libpng.3 +++ b/libpng.3 @@ -1409,7 +1409,7 @@ If you would rather avoid the complexity of setjmp/longjmp issues, you can compile libpng with PNG_NO_SETJMP, in which case errors will result in a call to PNG_ABORT() which defaults to abort(). -You can #define PNG_ABORT() to a function that does something +You can #define PNG_ABORT to a function or other C code that does something more useful than abort(), as long as your function does not return. @@ -3539,9 +3539,9 @@ section below for more information on the libpng error handling. If you would rather avoid the complexity of setjmp/longjmp issues, you can compile libpng with PNG_NO_SETJMP, in which case -errors will result in a call to PNG_ABORT() which defaults to abort(). +errors will result in a call to PNG_ABORT which defaults to abort(). -You can #define PNG_ABORT() to a function that does something +You can #define PNG_ABORT to a function or other C code that does something more useful than abort(), as long as your function does not return. @@ -4920,7 +4920,7 @@ Error handling in libpng is done through png_error() and png_warning(). Errors handled through png_error() are fatal, meaning that png_error() should never return to its caller. Currently, this is handled via setjmp() and longjmp() (unless you have compiled libpng with -PNG_NO_SETJMP, in which case it is handled via PNG_ABORT()), +PNG_NO_SETJMP, in which case it is handled via PNG_ABORT), but you could change this to do things like exit() if you should wish, as long as your function does not return. @@ -5955,6 +5955,25 @@ Some functions that were deprecated in libpng-1.6.0 were removed: png_malloc_default(), and png_free_default(). +The PNG_ABORT() macro was changed to PNG_ABORT, and the default is now +"abort()" for all platforms (previously it was "ExitProcess(0)" on +Windows platforms). Starting with libpng-1.7.0 you have to define +PNG_ABORT instead of PNG_ABORT(), e.g., + + #if PNGCRUSH_LIBPNG_VER >= 10700 + # ifdef _WINDOWS_ + # define PNG_ABORT ExitProcess(0); + # else + # define PNG_ABORT abort(); + # endif + #else + # ifdef _WINDOWS_ + # define PNG_ABORT() ExitProcess(0) + # else + # define PNG_ABORT() abort() + # endif + #endif + The 8-bit compose and rgb_to_grayscale operations were made more accurate. While these did not introduce API incompatibility, there may be differences in unit test results. diff --git a/pngerror.c b/pngerror.c index bbc78fd5a..9e904d449 100644 --- a/pngerror.c +++ b/pngerror.c @@ -748,10 +748,10 @@ png_longjmp,(png_const_structrp png_ptr, int val),PNG_NORETURN) png_ptr->longjmp_fn(*png_ptr->jmp_buf_ptr, val); #endif - /* It is an error if control reaches this point, because png_longjmp must not - * return the only choice is to terminate the whole process (or maybe - * thread), to do this the ANSI-C abort() function is used unless a different - * method is implemented by overriding the default configuration setting for + /* If control reaches this point, png_longjmp() must not return. The only + * choice is to terminate the whole process (or maybe the thread); to do + * this the ANSI-C abort() function is used unless a different method is + * implemented by overriding the default configuration setting for * PNG_ABORT (see scripts/pnglibconf.dfa). * * API change: prior to 1.7.0 PNG_ABORT was invoked as a function type macro