[master] Imported from libpng-1.4.0.tar

This commit is contained in:
Glenn Randers-Pehrson
2010-01-02 23:05:45 -06:00
parent 115817d118
commit 7e3a82cd9c
130 changed files with 4698 additions and 8343 deletions

View File

@@ -1,8 +1,8 @@
/* pngerror.c - stub functions for i/o and memory allocation
*
* Last changed in libpng 1.2.41 [December 3, 2009]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* Last changed in libpng 1.4.0 [January 3, 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.)
*
@@ -16,10 +16,10 @@
* at each function.
*/
#define PNG_INTERNAL
#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#include "pngpriv.h"
static void /* PRIVATE */
png_default_error PNGARG((png_structp png_ptr,
@@ -230,6 +230,22 @@ png_chunk_benign_error(png_structp png_ptr, png_const_charp error_message)
#endif
#endif /* PNG_READ_SUPPORTED */
#ifdef PNG_SETJMP_SUPPORTED
/* This API only exists if ANSI-C style error handling is used,
* otherwise it is necessary for png_default_error to be overridden.
*/
jmp_buf* PNGAPI
png_set_longjmp_fn(png_structp png_ptr, png_longjmp_ptr longjmp_fn,
size_t jmp_buf_size)
{
if (png_ptr == NULL || jmp_buf_size != png_sizeof(jmp_buf))
return NULL;
png_ptr->longjmp_fn = longjmp_fn;
return &png_ptr->jmpbuf;
}
#endif
/* This is the default error handling function. Note that replacements for
* this function MUST NOT RETURN, or the program will likely crash. This
* function is used by default, or if the program supplies NULL for the
@@ -274,16 +290,16 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
#endif
#ifdef PNG_SETJMP_SUPPORTED
if (png_ptr)
if (png_ptr && png_ptr->longjmp_fn)
{
# ifdef USE_FAR_KEYWORD
{
jmp_buf jmpbuf;
png_memcpy(jmpbuf, png_ptr->jmpbuf, png_sizeof(jmp_buf));
longjmp(jmpbuf,1);
png_ptr->longjmp_fn(jmpbuf, 1);
}
# else
longjmp(png_ptr->jmpbuf, 1);
png_ptr->longjmp_fn(png_ptr->jmpbuf, 1);
# endif
}
#endif