diff options
Diffstat (limited to 'png/pngconf.h')
| -rw-r--r-- | png/pngconf.h | 172 |
1 files changed, 106 insertions, 66 deletions
diff --git a/png/pngconf.h b/png/pngconf.h index 6167301d5..bf109a381 100644 --- a/png/pngconf.h +++ b/png/pngconf.h @@ -1,8 +1,9 @@ + /* pngconf.h - machine configurable file for libpng * - * libpng 1.2.1 - December 12, 2001 + * libpng version 1.2.6 - August 15, 2004 * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2001 Glenn Randers-Pehrson + * Copyright (c) 1998-2004 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,6 +17,10 @@ #ifndef PNGCONF_H #define PNGCONF_H +#ifdef PNG_USER_CONFIG +#include "pngusr.h" +#endif + /* This is the size of the compression buffer, and thus the size of * an IDAT chunk. Make this whatever size you feel is best for your * machine. One of these will be allocated per png_struct. When this @@ -47,7 +52,7 @@ /* Enabled by default in 1.2.0. You can disable this if you don't need to support PNGs that are embedded in MNG datastreams */ -#ifndef PNG_NO_MNG_FEATURES +#if !defined(PNG_1_0_X) && !defined(PNG_NO_MNG_FEATURES) # ifndef PNG_MNG_FEATURES_SUPPORTED # define PNG_MNG_FEATURES_SUPPORTED # endif @@ -78,12 +83,12 @@ * (no define) -- building static library, or building an * application and linking to the static lib * 'Cygwin' defines/defaults: - * PNG_BUILD_DLL -- building the dll - * (no define) -- building an application, linking to the dll - * PNG_STATIC -- building the static lib, or building an application - * that links to the static lib. - * ALL_STATIC -- building various static libs, or building an application - * that links to the static libs. + * PNG_BUILD_DLL -- (ignored) building the dll + * (no define) -- (ignored) building an application, linking to the dll + * PNG_STATIC -- (ignored) building the static lib, or building an + * application that links to the static lib. + * ALL_STATIC -- (ignored) building various static libs, or building an + * application that links to the static libs. * Thus, * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and * this bit of #ifdefs will define the 'correct' config variables based on @@ -94,7 +99,15 @@ * ALL_STATIC (since we can't #undef something outside our namespace) * PNG_BUILD_DLL * PNG_STATIC - * (nothing) == PNG_USE_DLL + * (nothing) == PNG_USE_DLL + * + * CYGWIN (2002-01-20): The preceding is now obsolete. With the advent + * of auto-import in binutils, we no longer need to worry about + * __declspec(dllexport) / __declspec(dllimport) and friends. Therefore, + * we don't need to worry about PNG_STATIC or ALL_STATIC when it comes + * to __declspec() stuff. However, we DO need to worry about + * PNG_BUILD_DLL and PNG_STATIC because those change some defaults + * such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed. */ #if defined(__CYGWIN__) # if defined(ALL_STATIC) @@ -244,13 +257,11 @@ # undef _BSD_SOURCE # endif # ifdef _SETJMP_H -/* Explanation added by debian maintainer Philippe Troin <phil@fifi.org>. - There are two versions of setjmp, depending wether or not we compile for - BSD. They are incompatible and can cause crashes. The PNG people force - here a unique behavior for setjmp. It you get the error below, - then include <png.h> before <setjmp.h>. -*/ -#error png.h already includes setjmp.h with some additional fixup. + /* If you encounter a compiler error here, see the explanation + * near the end of INSTALL. + */ + __png.h__ already includes setjmp.h; + __dont__ include it again.; # endif # endif /* __linux__ */ @@ -314,15 +325,13 @@ # define PNG_ALWAYS_EXTERN #endif -/* For some reason, Borland C++ defines memcmp, etc. in mem.h, not - * stdlib.h like it should (I think). Or perhaps this is a C++ - * "feature"? - */ -#ifdef __TURBOC__ +/* This provides the non-ANSI (far) memory allocation routines. */ +#if defined(__TURBOC__) && defined(__MSDOS__) # include <mem.h> -# include "alloc.h" +# include <alloc.h> #endif +/* I have no idea why is this necessary... */ #if defined(_MSC_VER) && (defined(WIN32) || defined(_Windows) || \ defined(_WINDOWS) || defined(_WIN32) || defined(__WIN32__)) # include <malloc.h> @@ -596,9 +605,11 @@ # define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED #endif +#ifndef PNG_1_0_X #ifndef PNG_NO_ERROR_NUMBERS #define PNG_ERROR_NUMBERS_SUPPORTED #endif +#endif /* PNG_1_0_X */ #ifndef PNG_NO_WRITE_FLUSH # define PNG_WRITE_FLUSH_SUPPORTED @@ -652,9 +663,30 @@ #define PNG_THREAD_UNSAFE_OK */ +#if !defined(PNG_1_0_X) #if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED) # define PNG_USER_MEM_SUPPORTED #endif +#endif /* PNG_1_0_X */ + +/* Added at libpng-1.2.6 */ +#if !defined(PNG_1_0_X) +#ifndef PNG_SET_USER_LIMITS_SUPPORTED +#if !defined(PNG_NO_SET_USER_LIMITS) && !defined(PNG_SET_USER_LIMITS_SUPPORTED) +# define PNG_SET_USER_LIMITS_SUPPORTED +#endif +#endif +#endif /* PNG_1_0_X */ + +/* Added at libpng-1.0.16 and 1.2.6. To accept all valid PNGS no matter + * how large, set these limits to 0x7fffffffL + */ +#ifndef PNG_USER_WIDTH_MAX +# define PNG_USER_WIDTH_MAX 1000000L +#endif +#ifndef PNG_USER_HEIGHT_MAX +# define PNG_USER_HEIGHT_MAX 1000000L +#endif /* These are currently experimental features, define them if you want */ @@ -670,10 +702,8 @@ /* This is only for PowerPC big-endian and 680x0 systems */ /* some testing */ /* -#ifdef PNG_READ_SUPPORTED -# ifndef PNG_PNG_READ_BIG_ENDIAN_SUPPORTED -# define PNG_READ_BIG_ENDIAN_SUPPORTED -# endif +#ifndef PNG_READ_BIG_ENDIAN_SUPPORTED +# define PNG_READ_BIG_ENDIAN_SUPPORTED #endif */ @@ -981,7 +1011,13 @@ typedef unsigned char png_byte; /* This is usually size_t. It is typedef'ed just in case you need it to change (I'm not sure if you will or not, so I thought I'd be safe) */ -typedef size_t png_size_t; +#ifdef PNG_SIZE_T + typedef PNG_SIZE_T png_size_t; +# define png_sizeof(x) png_convert_size(sizeof (x)) +#else + typedef size_t png_size_t; +# define png_sizeof(x) sizeof (x) +#endif /* The following is needed for medium model support. It cannot be in the * PNG_INTERNAL section. Needs modification for other compilers besides @@ -1150,10 +1186,21 @@ typedef z_stream FAR * png_zstreamp; # endif #endif +#if defined(__CYGWIN__) +# undef PNGAPI +# define PNGAPI __cdecl +# undef PNG_IMPEXP +# define PNG_IMPEXP +#endif -#ifndef PNGAPI +/* 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. + */ -#if defined(__MINGW32__) || defined(__CYGWIN__) && !defined(PNG_MODULEDEF) +#if defined(__MINGW32__) && !defined(PNG_MODULEDEF) # ifndef PNG_NO_MODULEDEF # define PNG_NO_MODULEDEF # endif @@ -1165,13 +1212,14 @@ typedef z_stream FAR * png_zstreamp; #if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \ (( defined(_Windows) || defined(_WINDOWS) || \ - defined(WIN32) || defined(_WIN32) || defined(__WIN32__) \ - ) && !defined(__CYGWIN__)) + defined(WIN32) || defined(_WIN32) || defined(__WIN32__) )) -# if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800)) -# define PNGAPI __cdecl -# else -# define PNGAPI _cdecl +# ifndef PNGAPI +# if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800)) +# define PNGAPI __cdecl +# else +# define PNGAPI _cdecl +# endif # endif # if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \ @@ -1193,8 +1241,8 @@ typedef z_stream FAR * png_zstreamp; # if defined(PNG_BUILD_DLL) # define PNG_IMPEXP __export # else -# define PNG_IMPEXP /*__import*/ /* doesn't exist AFAIK in - VC++*/ +# define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in + VC++ */ # endif /* Exists in Borland C++ for C++ classes (== huge) */ # endif @@ -1209,24 +1257,14 @@ typedef z_stream FAR * png_zstreamp; # endif # endif /* PNG_IMPEXP */ #else /* !(DLL || non-cygwin WINDOWS) */ -# if defined(__CYGWIN__) && !defined(PNG_DLL) -# if !defined(PNG_IMPEXP) -# define PNG_IMPEXP -# endif -# define PNGAPI __cdecl -# else -# if (defined(__IBMC__) || defined(IBMCPP__)) && defined(__OS2__) -# define PNGAPI _System -# define PNG_IMPEXP -# else +# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__) +# ifndef PNGAPI +# define PNGAPI _System +# endif +# else # if 0 /* ... other platforms, with other meanings */ -# else -# define PNGAPI -# define PNG_IMPEXP # endif -# endif -# endif -#endif +# endif #endif #ifndef PNGAPI @@ -1267,28 +1305,30 @@ typedef z_stream FAR * png_zstreamp; # define NOCHECK 0 # define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK)) # define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK)) -# define png_strcpy _fstrcpy -# define png_strlen _fstrlen -# define png_memcmp _fmemcmp /* SJT: added */ -# define png_memcpy _fmemcpy -# define png_memset _fmemset +# define png_strcpy _fstrcpy +# define png_strncpy _fstrncpy /* Added to v 1.2.6 */ +# define png_strlen _fstrlen +# define png_memcmp _fmemcmp /* SJT: added */ +# define png_memcpy _fmemcpy +# define png_memset _fmemset #else /* use the usual functions */ # define CVT_PTR(ptr) (ptr) # define CVT_PTR_NOCHECK(ptr) (ptr) -# define png_strcpy strcpy -# define png_strlen strlen -# define png_memcmp memcmp /* SJT: added */ -# define png_memcpy memcpy -# define png_memset memset +# define png_strcpy strcpy +# define png_strncpy strncpy /* Added to v 1.2.6 */ +# define png_strlen strlen +# define png_memcmp memcmp /* SJT: added */ +# define png_memcpy memcpy +# define png_memset memset #endif /* End of memory model independent support */ /* Just a little check that someone hasn't tried to define something * contradictory. */ -#if (PNG_ZBUF_SIZE > 65536) && defined(PNG_MAX_MALLOC_64K) +#if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K) # undef PNG_ZBUF_SIZE -# define PNG_ZBUF_SIZE 65536 +# define PNG_ZBUF_SIZE 65536L #endif #ifdef PNG_READ_SUPPORTED |
