mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-11-22 15:02:20 +00:00
[CHG] libpng updated to version 1.4.4
This commit is contained in:
parent
d7e04f987f
commit
d8cbc89741
7 changed files with 357 additions and 348 deletions
|
@ -17,7 +17,7 @@
|
|||
#include "pngpriv.h"
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef version_1_4_3 Your_png_h_is_not_version_1_4_3;
|
||||
typedef version_1_4_4 Your_png_h_is_not_version_1_4_4;
|
||||
|
||||
/* Version information for C files. This had better match the version
|
||||
* string defined in png.h.
|
||||
|
@ -551,13 +551,13 @@ png_get_copyright(png_structp png_ptr)
|
|||
#else
|
||||
#ifdef __STDC__
|
||||
return ((png_charp) PNG_STRING_NEWLINE \
|
||||
"libpng version 1.4.3 - June 26, 2010" PNG_STRING_NEWLINE \
|
||||
"libpng version 1.4.4 - September 23, 2010" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1998-2010 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
||||
PNG_STRING_NEWLINE);
|
||||
#else
|
||||
return ((png_charp) "libpng version 1.4.3 - June 26, 2010\
|
||||
return ((png_charp) "libpng version 1.4.4 - September 23, 2010\
|
||||
Copyright (c) 1998-2010 Glenn Randers-Pehrson\
|
||||
Copyright (c) 1996-1997 Andreas Dilger\
|
||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.");
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngconf.h - machine configurable file for libpng
|
||||
*
|
||||
* libpng version 1.4.3 - June 26, 2010
|
||||
* libpng version 1.4.4 - September 23, 2010
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
|
@ -44,14 +44,14 @@
|
|||
* includes the resource compiler for Windows DLL configurations.
|
||||
*/
|
||||
#ifdef PNG_USER_CONFIG
|
||||
# include "pngusr.h"
|
||||
# ifndef PNG_USER_PRIVATEBUILD
|
||||
# define PNG_USER_PRIVATEBUILD
|
||||
# endif
|
||||
# include "pngusr.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If you create a private DLL you need to define in "pngusr.h" the followings:
|
||||
* If you create a private DLL you should define in "pngusr.h" the following:
|
||||
* #define PNG_USER_PRIVATEBUILD <Describes by whom and why this version of
|
||||
* the DLL was built>
|
||||
* e.g. #define PNG_USER_PRIVATEBUILD "Build by MyCompany for xyz reasons."
|
||||
|
@ -59,7 +59,7 @@
|
|||
* distinguish your DLL from those of the official release. These
|
||||
* correspond to the trailing letters that come after the version
|
||||
* number and must match your private DLL name>
|
||||
* e.g. // private DLL "libpng13gx.dll"
|
||||
* e.g. // private DLL "libpng14gx.dll"
|
||||
* #define PNG_USER_DLLFNAME_POSTFIX "gx"
|
||||
*
|
||||
* The following macros are also at your disposal if you want to complete the
|
||||
|
@ -269,11 +269,19 @@
|
|||
* #define PNG_NO_STDIO
|
||||
*/
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
# define PNG_NO_CONSOLE_IO
|
||||
# define PNG_NO_STDIO
|
||||
# define PNG_NO_TIME_RFC1123
|
||||
# ifdef PNG_DEBUG
|
||||
# undef PNG_DEBUG
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(PNG_NO_STDIO) && !defined(PNG_STDIO_SUPPORTED)
|
||||
# define PNG_STDIO_SUPPORTED
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef PNG_BUILD_DLL
|
||||
# if !defined(PNG_CONSOLE_IO_SUPPORTED) && !defined(PNG_NO_CONSOLE_IO)
|
||||
# define PNG_NO_CONSOLE_IO
|
||||
|
@ -439,7 +447,7 @@
|
|||
|
||||
/* The following uses const char * instead of char * for error
|
||||
* and warning message functions, so some compilers won't complain.
|
||||
* If you do not want to use const, define PNG_NO_CONST here.
|
||||
* If you do not want to use const, define PNG_NO_CONST.
|
||||
*/
|
||||
|
||||
#ifndef PNG_CONST
|
||||
|
@ -454,8 +462,10 @@
|
|||
* library that you will not be using. I wish I could figure out how to
|
||||
* automate this, but I can't do that without making it seriously hard
|
||||
* on the users. So if you are not using an ability, change the #define
|
||||
* to and #undef, and that part of the library will not be compiled. If
|
||||
* your linker can't find a function, you may want to make sure the
|
||||
* to an #undef, or pass in PNG_NO_feature and that part of the library
|
||||
* will not be compiled.
|
||||
|
||||
* If your linker can't find a function, you may want to make sure the
|
||||
* ability is defined here. Some of these depend upon some others being
|
||||
* defined. I haven't figured out all the interactions here, so you may
|
||||
* have to experiment awhile to get everything to compile. If you are
|
||||
|
@ -1114,7 +1124,7 @@ typedef unsigned char png_byte;
|
|||
#else
|
||||
typedef size_t png_size_t;
|
||||
#endif
|
||||
#define png_sizeof(x) sizeof(x)
|
||||
#define png_sizeof(x) (sizeof (x))
|
||||
|
||||
/* The following is needed for medium model support. It cannot be in the
|
||||
* pngpriv.h header. Needs modification for other compilers besides
|
||||
|
@ -1236,6 +1246,13 @@ typedef char FAR * FAR * FAR * png_charppp;
|
|||
# define PNG_DLL
|
||||
#endif
|
||||
|
||||
/* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall",
|
||||
* you may get warnings regarding the linkage of png_zalloc and png_zfree.
|
||||
* Don't ignore those warnings; you must also reset the default calling
|
||||
* convention in your compiler to match your PNGAPI, and you must build
|
||||
* zlib and your applications the same way you build libpng.
|
||||
*/
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
# undef PNGAPI
|
||||
# define PNGAPI __cdecl
|
||||
|
@ -1243,14 +1260,11 @@ typedef char FAR * FAR * FAR * png_charppp;
|
|||
# define PNG_IMPEXP
|
||||
#endif
|
||||
|
||||
#define PNG_USE_LOCAL_ARRAYS /* Not used in libpng, defined for legacy apps */
|
||||
|
||||
/* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall",
|
||||
* you may get warnings regarding the linkage of png_zalloc and png_zfree.
|
||||
* Don't ignore those warnings; you must also reset the default calling
|
||||
* convention in your compiler to match your PNGAPI, and you must build
|
||||
* zlib and your applications the same way you build libpng.
|
||||
*/
|
||||
#ifdef __WATCOMC__
|
||||
# ifndef PNGAPI
|
||||
# define PNGAPI
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__MINGW32__) && !defined(PNG_MODULEDEF)
|
||||
# ifndef PNG_NO_MODULEDEF
|
||||
|
@ -1335,6 +1349,8 @@ typedef char FAR * FAR * FAR * png_charppp;
|
|||
# define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol
|
||||
#endif
|
||||
|
||||
#define PNG_USE_LOCAL_ARRAYS /* Not used in libpng, defined for legacy apps */
|
||||
|
||||
/* Support for compiler specific function attributes. These are used
|
||||
* so that where compiler support is available incorrect use of API
|
||||
* functions in png.h will generate compiler warnings.
|
||||
|
@ -1412,7 +1428,7 @@ typedef char FAR * FAR * FAR * png_charppp;
|
|||
|
||||
/* memory model/platform independent fns */
|
||||
#ifndef PNG_ABORT
|
||||
# ifdef _WINDOWS_
|
||||
# if (defined(_Windows) || defined(_WINDOWS) || defined(_WINDOWS_))
|
||||
# define PNG_ABORT() ExitProcess(0)
|
||||
# else
|
||||
# define PNG_ABORT() abort()
|
||||
|
@ -1433,7 +1449,8 @@ typedef char FAR * FAR * FAR * png_charppp;
|
|||
# define png_memset _fmemset
|
||||
# define png_sprintf sprintf
|
||||
#else
|
||||
# ifdef _WINDOWS_ /* Favor Windows over C runtime fns */
|
||||
# if (defined(_Windows) || defined(_WINDOWS) || defined(_WINDOWS_))
|
||||
# /* Favor Windows over C runtime fns */
|
||||
# define CVT_PTR(ptr) (ptr)
|
||||
# define CVT_PTR_NOCHECK(ptr) (ptr)
|
||||
# define png_strcpy lstrcpyA
|
||||
|
@ -1453,7 +1470,10 @@ typedef char FAR * FAR * FAR * png_charppp;
|
|||
# define png_memcpy memcpy
|
||||
# define png_memset memset
|
||||
# define png_sprintf sprintf
|
||||
# ifndef PNG_NO_SNPRINTF
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef PNG_NO_SNPRINTF
|
||||
# ifdef _MSC_VER
|
||||
# define png_snprintf _snprintf /* Added to v 1.2.19 */
|
||||
# define png_snprintf2 _snprintf
|
||||
|
@ -1463,19 +1483,17 @@ typedef char FAR * FAR * FAR * png_charppp;
|
|||
# define png_snprintf2 snprintf
|
||||
# define png_snprintf6 snprintf
|
||||
# endif
|
||||
# else
|
||||
#else
|
||||
/* You don't have or don't want to use snprintf(). Caution: Using
|
||||
* sprintf instead of snprintf exposes your application to accidental
|
||||
* or malevolent buffer overflows. If you don't have snprintf()
|
||||
* as a general rule you should provide one (you can get one from
|
||||
* Portable OpenSSH).
|
||||
*/
|
||||
# define png_snprintf(s1,n,fmt,x1) sprintf(s1,fmt,x1)
|
||||
# define png_snprintf2(s1,n,fmt,x1,x2) sprintf(s1,fmt,x1,x2)
|
||||
# define png_snprintf(s1,n,fmt,x1) png_sprintf(s1,fmt,x1)
|
||||
# define png_snprintf2(s1,n,fmt,x1,x2) png_sprintf(s1,fmt,x1,x2)
|
||||
# define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \
|
||||
sprintf(s1,fmt,x1,x2,x3,x4,x5,x6)
|
||||
# endif
|
||||
# endif
|
||||
png_sprintf(s1,fmt,x1,x2,x3,x4,x5,x6)
|
||||
#endif
|
||||
|
||||
/* png_alloc_size_t is guaranteed to be no smaller than png_size_t,
|
||||
|
@ -1488,22 +1506,19 @@ typedef char FAR * FAR * FAR * png_charppp;
|
|||
* to encounter practical situations that require such conversions.
|
||||
*/
|
||||
#if defined(__TURBOC__) && !defined(__FLAT__)
|
||||
# define png_mem_alloc farmalloc
|
||||
# define png_mem_free farfree
|
||||
typedef unsigned long png_alloc_size_t;
|
||||
#else
|
||||
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
||||
# define png_mem_alloc(s) halloc(s, 1)
|
||||
# define png_mem_free hfree
|
||||
typedef unsigned long png_alloc_size_t;
|
||||
# else
|
||||
# if defined(_WINDOWS_) && (!defined(INT_MAX) || INT_MAX <= 0x7ffffffeL)
|
||||
# define png_mem_alloc(s) HeapAlloc(GetProcessHeap(), 0, s)
|
||||
# define png_mem_free(p) HeapFree(GetProcessHeap(), 0, p)
|
||||
/* This is an attempt to detect an old Windows system where (int) is
|
||||
* actually 16 bits, in that case png_malloc must have an argument with a
|
||||
* bigger size to accomodate the requirements of the library.
|
||||
*/
|
||||
# if (defined(_Windows) || defined(_WINDOWS) || defined(_WINDOWS_)) && \
|
||||
(!defined(INT_MAX) || INT_MAX <= 0x7ffffffeL)
|
||||
typedef DWORD png_alloc_size_t;
|
||||
# else
|
||||
# define png_mem_alloc malloc
|
||||
# define png_mem_free free
|
||||
typedef png_size_t png_alloc_size_t;
|
||||
# endif
|
||||
# endif
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngpriv.h - private declarations for use inside libpng
|
||||
*
|
||||
* libpng version 1.4.3 - June 26, 2010
|
||||
* libpng version 1.4.4 - September 23, 2010
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
|
@ -28,14 +28,16 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef PNG_EXTERN
|
||||
/* The functions exported by PNG_EXTERN are internal functions, which
|
||||
* aren't usually used outside the library (as far as I know), so it is
|
||||
* debatable if they should be exported at all. In the future, when it
|
||||
* is possible to have run-time registry of chunk-handling functions,
|
||||
* some of these will be made available again.
|
||||
#define PNG_EXTERN extern
|
||||
# define PNG_EXTERN extern
|
||||
*/
|
||||
#define PNG_EXTERN
|
||||
# define PNG_EXTERN
|
||||
#endif
|
||||
|
||||
/* Other defines specific to compilers can go here. Try to keep
|
||||
* them inside an appropriate ifdef/endif pair for portability.
|
||||
|
@ -75,10 +77,6 @@
|
|||
#if defined(WIN32) || defined(_Windows) || defined(_WINDOWS) || \
|
||||
defined(_WIN32) || defined(__WIN32__)
|
||||
# include <windows.h> /* defines _WINDOWS_ macro */
|
||||
/* I have no idea why is this necessary... */
|
||||
# ifdef _MSC_VER
|
||||
# include <malloc.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Various modes of operation. Note that after an init, mode is set to
|
||||
|
@ -672,7 +670,7 @@ PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr,
|
|||
#endif
|
||||
|
||||
#ifdef PNG_READ_iCCP_SUPPORTED
|
||||
extern void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr,
|
||||
PNG_EXTERN void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr,
|
||||
png_uint_32 length));
|
||||
#endif /* PNG_READ_iCCP_SUPPORTED */
|
||||
|
||||
|
@ -707,7 +705,7 @@ PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
|
|||
#endif
|
||||
|
||||
#ifdef PNG_READ_sPLT_SUPPORTED
|
||||
extern void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr,
|
||||
PNG_EXTERN void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr,
|
||||
png_uint_32 length));
|
||||
#endif /* PNG_READ_sPLT_SUPPORTED */
|
||||
|
||||
|
@ -828,14 +826,14 @@ PNG_EXTERN void png_check_IHDR PNGARG((png_structp png_ptr,
|
|||
int filter_type));
|
||||
|
||||
/* Free all memory used by the read (old method - NOT DLL EXPORTED) */
|
||||
extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr,
|
||||
PNG_EXTERN void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr,
|
||||
png_infop end_info_ptr));
|
||||
|
||||
/* Free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */
|
||||
extern void png_write_destroy PNGARG((png_structp png_ptr));
|
||||
PNG_EXTERN void png_write_destroy PNGARG((png_structp png_ptr));
|
||||
|
||||
#ifdef USE_FAR_KEYWORD /* memory model conversion function */
|
||||
extern void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr,
|
||||
PNG_EXTERN void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr,
|
||||
int check));
|
||||
#endif /* USE_FAR_KEYWORD */
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.4.3 [June 26, 2010]
|
||||
* Last changed in libpng 1.4.4 [August 26, 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.)
|
||||
|
@ -30,38 +30,41 @@ png_get_uint_31(png_structp png_ptr, png_bytep buf)
|
|||
}
|
||||
#ifndef PNG_USE_READ_MACROS
|
||||
/* Grab an unsigned 32-bit integer from a buffer in big-endian format. */
|
||||
png_uint_32 PNGAPI
|
||||
png_get_uint_32(png_bytep buf)
|
||||
png_uint_32 (PNGAPI
|
||||
png_get_uint_32)(png_bytep buf)
|
||||
{
|
||||
png_uint_32 i = ((png_uint_32)(*buf) << 24) +
|
||||
png_uint_32 i =
|
||||
((png_uint_32)(*(buf )) << 24) +
|
||||
((png_uint_32)(*(buf + 1)) << 16) +
|
||||
((png_uint_32)(*(buf + 2)) << 8) +
|
||||
(png_uint_32)(*(buf + 3));
|
||||
((png_uint_32)(*(buf + 3)) ) ;
|
||||
|
||||
return (i);
|
||||
}
|
||||
|
||||
/* Grab a signed 32-bit integer from a buffer in big-endian format. The
|
||||
* data is stored in the PNG file in two's complement format, and it is
|
||||
* assumed that the machine format for signed integers is the same.
|
||||
* data is stored in the PNG file in two's complement format and there
|
||||
* is no guarantee that a 'png_int_32' is exactly 32 bits, therefore
|
||||
* the following code does a two's complement to native conversion.
|
||||
*/
|
||||
png_int_32 PNGAPI
|
||||
png_get_int_32(png_bytep buf)
|
||||
png_int_32 (PNGAPI
|
||||
png_get_int_32)(png_bytep buf)
|
||||
{
|
||||
png_int_32 i = ((png_int_32)(*buf) << 24) +
|
||||
((png_int_32)(*(buf + 1)) << 16) +
|
||||
((png_int_32)(*(buf + 2)) << 8) +
|
||||
(png_int_32)(*(buf + 3));
|
||||
png_uint_32 u = png_get_uint_32(buf);
|
||||
if ((u & 0x80000000) == 0) /* non-negative */
|
||||
return u;
|
||||
|
||||
return (i);
|
||||
u = (u ^ 0xffffffff) + 1; /* 2's complement: -x = ~x+1 */
|
||||
return -(png_int_32)u;
|
||||
}
|
||||
|
||||
/* Grab an unsigned 16-bit integer from a buffer in big-endian format. */
|
||||
png_uint_16 PNGAPI
|
||||
png_get_uint_16(png_bytep buf)
|
||||
png_uint_16 (PNGAPI
|
||||
png_get_uint_16)(png_bytep buf)
|
||||
{
|
||||
png_uint_16 i = (png_uint_16)(((png_uint_16)(*buf) << 8) +
|
||||
(png_uint_16)(*(buf + 1)));
|
||||
png_uint_16 i =
|
||||
((png_uint_32)(*buf) << 8) +
|
||||
((png_uint_32)(*(buf + 1)));
|
||||
|
||||
return (i);
|
||||
}
|
||||
|
@ -1128,12 +1131,13 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
|
||||
if (profile_size > profile_length)
|
||||
{
|
||||
#ifdef PNG_STDIO_SUPPORTED
|
||||
char umsg[50];
|
||||
#endif
|
||||
png_free(png_ptr, png_ptr->chunkdata);
|
||||
png_ptr->chunkdata = NULL;
|
||||
png_warning(png_ptr, "Ignoring truncated iCCP profile");
|
||||
#ifdef PNG_STDIO_SUPPORTED
|
||||
{
|
||||
char umsg[50];
|
||||
|
||||
png_snprintf(umsg, 50, "declared profile size = %lu",
|
||||
(unsigned long)profile_size);
|
||||
|
@ -1141,7 +1145,6 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
png_snprintf(umsg, 50, "actual profile length = %lu",
|
||||
(unsigned long)profile_length);
|
||||
png_warning(png_ptr, umsg);
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
@ -1875,9 +1878,6 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
png_warning(png_ptr, "malformed height string in sCAL chunk");
|
||||
png_free(png_ptr, png_ptr->chunkdata);
|
||||
png_ptr->chunkdata = NULL;
|
||||
#if defined(PNG_FIXED_POINT_SUPPORTED) && !defined(PNG_FLOATING_POINT_SUPPORTED)
|
||||
png_free(png_ptr, swidth);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
#else
|
||||
|
@ -1888,9 +1888,7 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
png_warning(png_ptr, "Out of memory while processing sCAL chunk height");
|
||||
png_free(png_ptr, png_ptr->chunkdata);
|
||||
png_ptr->chunkdata = NULL;
|
||||
#if defined(PNG_FIXED_POINT_SUPPORTED) && !defined(PNG_FLOATING_POINT_SUPPORTED)
|
||||
png_free(png_ptr, swidth);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
png_memcpy(sheight, ep, png_strlen(ep));
|
||||
|
|
Loading…
Reference in a new issue