jpayne@69: jpayne@69: /* pngconf.h - machine-configurable file for libpng jpayne@69: * jpayne@69: * libpng version 1.6.43 jpayne@69: * jpayne@69: * Copyright (c) 2018-2024 Cosmin Truta jpayne@69: * Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson jpayne@69: * Copyright (c) 1996-1997 Andreas Dilger jpayne@69: * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. jpayne@69: * jpayne@69: * This code is released under the libpng license. jpayne@69: * For conditions of distribution and use, see the disclaimer jpayne@69: * and license in png.h jpayne@69: * jpayne@69: * Any machine specific code is near the front of this file, so if you jpayne@69: * are configuring libpng for a machine, you may want to read the section jpayne@69: * starting here down to where it starts to typedef png_color, png_text, jpayne@69: * and png_info. jpayne@69: */ jpayne@69: jpayne@69: #ifndef PNGCONF_H jpayne@69: #define PNGCONF_H jpayne@69: jpayne@69: #ifndef PNG_BUILDING_SYMBOL_TABLE /* else includes may cause problems */ jpayne@69: jpayne@69: /* From libpng 1.6.0 libpng requires an ANSI X3.159-1989 ("ISOC90") compliant C jpayne@69: * compiler for correct compilation. The following header files are required by jpayne@69: * the standard. If your compiler doesn't provide these header files, or they jpayne@69: * do not match the standard, you will need to provide/improve them. jpayne@69: */ jpayne@69: #include jpayne@69: #include jpayne@69: jpayne@69: /* Library header files. These header files are all defined by ISOC90; libpng jpayne@69: * expects conformant implementations, however, an ISOC90 conformant system need jpayne@69: * not provide these header files if the functionality cannot be implemented. jpayne@69: * In this case it will be necessary to disable the relevant parts of libpng in jpayne@69: * the build of pnglibconf.h. jpayne@69: * jpayne@69: * Prior to 1.6.0 string.h was included here; the API changes in 1.6.0 to not jpayne@69: * include this unnecessary header file. jpayne@69: */ jpayne@69: jpayne@69: #ifdef PNG_STDIO_SUPPORTED jpayne@69: /* Required for the definition of FILE: */ jpayne@69: # include jpayne@69: #endif jpayne@69: jpayne@69: #ifdef PNG_SETJMP_SUPPORTED jpayne@69: /* Required for the definition of jmp_buf and the declaration of longjmp: */ jpayne@69: # include jpayne@69: #endif jpayne@69: jpayne@69: #ifdef PNG_CONVERT_tIME_SUPPORTED jpayne@69: /* Required for struct tm: */ jpayne@69: # include jpayne@69: #endif jpayne@69: jpayne@69: #endif /* PNG_BUILDING_SYMBOL_TABLE */ jpayne@69: jpayne@69: /* Prior to 1.6.0, it was possible to turn off 'const' in declarations, jpayne@69: * using PNG_NO_CONST. This is no longer supported. jpayne@69: */ jpayne@69: #define PNG_CONST const /* backward compatibility only */ jpayne@69: jpayne@69: /* This controls optimization of the reading of 16-bit and 32-bit jpayne@69: * values from PNG files. It can be set on a per-app-file basis: it jpayne@69: * just changes whether a macro is used when the function is called. jpayne@69: * The library builder sets the default; if read functions are not jpayne@69: * built into the library the macro implementation is forced on. jpayne@69: */ jpayne@69: #ifndef PNG_READ_INT_FUNCTIONS_SUPPORTED jpayne@69: # define PNG_USE_READ_MACROS jpayne@69: #endif jpayne@69: #if !defined(PNG_NO_USE_READ_MACROS) && !defined(PNG_USE_READ_MACROS) jpayne@69: # if PNG_DEFAULT_READ_MACROS jpayne@69: # define PNG_USE_READ_MACROS jpayne@69: # endif jpayne@69: #endif jpayne@69: jpayne@69: /* COMPILER SPECIFIC OPTIONS. jpayne@69: * jpayne@69: * These options are provided so that a variety of difficult compilers jpayne@69: * can be used. Some are fixed at build time (e.g. PNG_API_RULE jpayne@69: * below) but still have compiler specific implementations, others jpayne@69: * may be changed on a per-file basis when compiling against libpng. jpayne@69: */ jpayne@69: jpayne@69: /* The PNGARG macro was used in versions of libpng prior to 1.6.0 to protect jpayne@69: * against legacy (pre ISOC90) compilers that did not understand function jpayne@69: * prototypes. It is not required for modern C compilers. jpayne@69: */ jpayne@69: #ifndef PNGARG jpayne@69: # define PNGARG(arglist) arglist jpayne@69: #endif jpayne@69: jpayne@69: /* Function calling conventions. jpayne@69: * ============================= jpayne@69: * Normally it is not necessary to specify to the compiler how to call jpayne@69: * a function - it just does it - however on x86 systems derived from jpayne@69: * Microsoft and Borland C compilers ('IBM PC', 'DOS', 'Windows' systems jpayne@69: * and some others) there are multiple ways to call a function and the jpayne@69: * default can be changed on the compiler command line. For this reason jpayne@69: * libpng specifies the calling convention of every exported function and jpayne@69: * every function called via a user supplied function pointer. This is jpayne@69: * done in this file by defining the following macros: jpayne@69: * jpayne@69: * PNGAPI Calling convention for exported functions. jpayne@69: * PNGCBAPI Calling convention for user provided (callback) functions. jpayne@69: * PNGCAPI Calling convention used by the ANSI-C library (required jpayne@69: * for longjmp callbacks and sometimes used internally to jpayne@69: * specify the calling convention for zlib). jpayne@69: * jpayne@69: * These macros should never be overridden. If it is necessary to jpayne@69: * change calling convention in a private build this can be done jpayne@69: * by setting PNG_API_RULE (which defaults to 0) to one of the values jpayne@69: * below to select the correct 'API' variants. jpayne@69: * jpayne@69: * PNG_API_RULE=0 Use PNGCAPI - the 'C' calling convention - throughout. jpayne@69: * This is correct in every known environment. jpayne@69: * PNG_API_RULE=1 Use the operating system convention for PNGAPI and jpayne@69: * the 'C' calling convention (from PNGCAPI) for jpayne@69: * callbacks (PNGCBAPI). This is no longer required jpayne@69: * in any known environment - if it has to be used jpayne@69: * please post an explanation of the problem to the jpayne@69: * libpng mailing list. jpayne@69: * jpayne@69: * These cases only differ if the operating system does not use the C jpayne@69: * calling convention, at present this just means the above cases jpayne@69: * (x86 DOS/Windows systems) and, even then, this does not apply to jpayne@69: * Cygwin running on those systems. jpayne@69: * jpayne@69: * Note that the value must be defined in pnglibconf.h so that what jpayne@69: * the application uses to call the library matches the conventions jpayne@69: * set when building the library. jpayne@69: */ jpayne@69: jpayne@69: /* Symbol export jpayne@69: * ============= jpayne@69: * When building a shared library it is almost always necessary to tell jpayne@69: * the compiler which symbols to export. The png.h macro 'PNG_EXPORT' jpayne@69: * is used to mark the symbols. On some systems these symbols can be jpayne@69: * extracted at link time and need no special processing by the compiler, jpayne@69: * on other systems the symbols are flagged by the compiler and just jpayne@69: * the declaration requires a special tag applied (unfortunately) in a jpayne@69: * compiler dependent way. Some systems can do either. jpayne@69: * jpayne@69: * A small number of older systems also require a symbol from a DLL to jpayne@69: * be flagged to the program that calls it. This is a problem because jpayne@69: * we do not know in the header file included by application code that jpayne@69: * the symbol will come from a shared library, as opposed to a statically jpayne@69: * linked one. For this reason the application must tell us by setting jpayne@69: * the magic flag PNG_USE_DLL to turn on the special processing before jpayne@69: * it includes png.h. jpayne@69: * jpayne@69: * Four additional macros are used to make this happen: jpayne@69: * jpayne@69: * PNG_IMPEXP The magic (if any) to cause a symbol to be exported from jpayne@69: * the build or imported if PNG_USE_DLL is set - compiler jpayne@69: * and system specific. jpayne@69: * jpayne@69: * PNG_EXPORT_TYPE(type) A macro that pre or appends PNG_IMPEXP to jpayne@69: * 'type', compiler specific. jpayne@69: * jpayne@69: * PNG_DLL_EXPORT Set to the magic to use during a libpng build to jpayne@69: * make a symbol exported from the DLL. Not used in the jpayne@69: * public header files; see pngpriv.h for how it is used jpayne@69: * in the libpng build. jpayne@69: * jpayne@69: * PNG_DLL_IMPORT Set to the magic to force the libpng symbols to come jpayne@69: * from a DLL - used to define PNG_IMPEXP when jpayne@69: * PNG_USE_DLL is set. jpayne@69: */ jpayne@69: jpayne@69: /* System specific discovery. jpayne@69: * ========================== jpayne@69: * This code is used at build time to find PNG_IMPEXP, the API settings jpayne@69: * and PNG_EXPORT_TYPE(), it may also set a macro to indicate the DLL jpayne@69: * import processing is possible. On Windows systems it also sets jpayne@69: * compiler-specific macros to the values required to change the calling jpayne@69: * conventions of the various functions. jpayne@69: */ jpayne@69: #if defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || \ jpayne@69: defined(__CYGWIN__) jpayne@69: /* Windows system (DOS doesn't support DLLs). Includes builds under Cygwin or jpayne@69: * MinGW on any architecture currently supported by Windows. Also includes jpayne@69: * Watcom builds but these need special treatment because they are not jpayne@69: * compatible with GCC or Visual C because of different calling conventions. jpayne@69: */ jpayne@69: # if PNG_API_RULE == 2 jpayne@69: /* If this line results in an error, either because __watcall is not jpayne@69: * understood or because of a redefine just below you cannot use *this* jpayne@69: * build of the library with the compiler you are using. *This* build was jpayne@69: * build using Watcom and applications must also be built using Watcom! jpayne@69: */ jpayne@69: # define PNGCAPI __watcall jpayne@69: # endif jpayne@69: jpayne@69: # if defined(__GNUC__) || (defined(_MSC_VER) && (_MSC_VER >= 800)) jpayne@69: # define PNGCAPI __cdecl jpayne@69: # if PNG_API_RULE == 1 jpayne@69: /* If this line results in an error __stdcall is not understood and jpayne@69: * PNG_API_RULE should not have been set to '1'. jpayne@69: */ jpayne@69: # define PNGAPI __stdcall jpayne@69: # endif jpayne@69: # else jpayne@69: /* An older compiler, or one not detected (erroneously) above, jpayne@69: * if necessary override on the command line to get the correct jpayne@69: * variants for the compiler. jpayne@69: */ jpayne@69: # ifndef PNGCAPI jpayne@69: # define PNGCAPI _cdecl jpayne@69: # endif jpayne@69: # if PNG_API_RULE == 1 && !defined(PNGAPI) jpayne@69: # define PNGAPI _stdcall jpayne@69: # endif jpayne@69: # endif /* compiler/api */ jpayne@69: jpayne@69: /* NOTE: PNGCBAPI always defaults to PNGCAPI. */ jpayne@69: jpayne@69: # if defined(PNGAPI) && !defined(PNG_USER_PRIVATEBUILD) jpayne@69: # error "PNG_USER_PRIVATEBUILD must be defined if PNGAPI is changed" jpayne@69: # endif jpayne@69: jpayne@69: # if (defined(_MSC_VER) && _MSC_VER < 800) ||\ jpayne@69: (defined(__BORLANDC__) && __BORLANDC__ < 0x500) jpayne@69: /* older Borland and MSC jpayne@69: * compilers used '__export' and required this to be after jpayne@69: * the type. jpayne@69: */ jpayne@69: # ifndef PNG_EXPORT_TYPE jpayne@69: # define PNG_EXPORT_TYPE(type) type PNG_IMPEXP jpayne@69: # endif jpayne@69: # define PNG_DLL_EXPORT __export jpayne@69: # else /* newer compiler */ jpayne@69: # define PNG_DLL_EXPORT __declspec(dllexport) jpayne@69: # ifndef PNG_DLL_IMPORT jpayne@69: # define PNG_DLL_IMPORT __declspec(dllimport) jpayne@69: # endif jpayne@69: # endif /* compiler */ jpayne@69: jpayne@69: #else /* !Windows */ jpayne@69: # if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__) jpayne@69: # define PNGAPI _System jpayne@69: # else /* !Windows/x86 && !OS/2 */ jpayne@69: /* Use the defaults, or define PNG*API on the command line (but jpayne@69: * this will have to be done for every compile!) jpayne@69: */ jpayne@69: # endif /* other system, !OS/2 */ jpayne@69: #endif /* !Windows/x86 */ jpayne@69: jpayne@69: /* Now do all the defaulting . */ jpayne@69: #ifndef PNGCAPI jpayne@69: # define PNGCAPI jpayne@69: #endif jpayne@69: #ifndef PNGCBAPI jpayne@69: # define PNGCBAPI PNGCAPI jpayne@69: #endif jpayne@69: #ifndef PNGAPI jpayne@69: # define PNGAPI PNGCAPI jpayne@69: #endif jpayne@69: jpayne@69: /* PNG_IMPEXP may be set on the compilation system command line or (if not set) jpayne@69: * then in an internal header file when building the library, otherwise (when jpayne@69: * using the library) it is set here. jpayne@69: */ jpayne@69: #ifndef PNG_IMPEXP jpayne@69: # if defined(PNG_USE_DLL) && defined(PNG_DLL_IMPORT) jpayne@69: /* This forces use of a DLL, disallowing static linking */ jpayne@69: # define PNG_IMPEXP PNG_DLL_IMPORT jpayne@69: # endif jpayne@69: jpayne@69: # ifndef PNG_IMPEXP jpayne@69: # define PNG_IMPEXP jpayne@69: # endif jpayne@69: #endif jpayne@69: jpayne@69: /* In 1.5.2 the definition of PNG_FUNCTION has been changed to always treat jpayne@69: * 'attributes' as a storage class - the attributes go at the start of the jpayne@69: * function definition, and attributes are always appended regardless of the jpayne@69: * compiler. This considerably simplifies these macros but may cause problems jpayne@69: * if any compilers both need function attributes and fail to handle them as jpayne@69: * a storage class (this is unlikely.) jpayne@69: */ jpayne@69: #ifndef PNG_FUNCTION jpayne@69: # define PNG_FUNCTION(type, name, args, attributes) attributes type name args jpayne@69: #endif jpayne@69: jpayne@69: #ifndef PNG_EXPORT_TYPE jpayne@69: # define PNG_EXPORT_TYPE(type) PNG_IMPEXP type jpayne@69: #endif jpayne@69: jpayne@69: /* The ordinal value is only relevant when preprocessing png.h for symbol jpayne@69: * table entries, so we discard it here. See the .dfn files in the jpayne@69: * scripts directory. jpayne@69: */ jpayne@69: jpayne@69: #ifndef PNG_EXPORTA jpayne@69: # define PNG_EXPORTA(ordinal, type, name, args, attributes) \ jpayne@69: PNG_FUNCTION(PNG_EXPORT_TYPE(type), (PNGAPI name), PNGARG(args), \ jpayne@69: PNG_LINKAGE_API attributes) jpayne@69: #endif jpayne@69: jpayne@69: /* ANSI-C (C90) does not permit a macro to be invoked with an empty argument, jpayne@69: * so make something non-empty to satisfy the requirement: jpayne@69: */ jpayne@69: #define PNG_EMPTY /*empty list*/ jpayne@69: jpayne@69: #define PNG_EXPORT(ordinal, type, name, args) \ jpayne@69: PNG_EXPORTA(ordinal, type, name, args, PNG_EMPTY) jpayne@69: jpayne@69: /* Use PNG_REMOVED to comment out a removed interface. */ jpayne@69: #ifndef PNG_REMOVED jpayne@69: # define PNG_REMOVED(ordinal, type, name, args, attributes) jpayne@69: #endif jpayne@69: jpayne@69: #ifndef PNG_CALLBACK jpayne@69: # define PNG_CALLBACK(type, name, args) type (PNGCBAPI name) PNGARG(args) jpayne@69: #endif jpayne@69: jpayne@69: /* Support for compiler specific function attributes. These are used jpayne@69: * so that where compiler support is available incorrect use of API jpayne@69: * functions in png.h will generate compiler warnings. jpayne@69: * jpayne@69: * Added at libpng-1.2.41. jpayne@69: */ jpayne@69: jpayne@69: #ifndef PNG_NO_PEDANTIC_WARNINGS jpayne@69: # ifndef PNG_PEDANTIC_WARNINGS_SUPPORTED jpayne@69: # define PNG_PEDANTIC_WARNINGS_SUPPORTED jpayne@69: # endif jpayne@69: #endif jpayne@69: jpayne@69: #ifdef PNG_PEDANTIC_WARNINGS_SUPPORTED jpayne@69: /* Support for compiler specific function attributes. These are used jpayne@69: * so that where compiler support is available, incorrect use of API jpayne@69: * functions in png.h will generate compiler warnings. Added at libpng jpayne@69: * version 1.2.41. Disabling these removes the warnings but may also produce jpayne@69: * less efficient code. jpayne@69: */ jpayne@69: # if defined(__clang__) && defined(__has_attribute) jpayne@69: /* Clang defines both __clang__ and __GNUC__. Check __clang__ first. */ jpayne@69: # if !defined(PNG_USE_RESULT) && __has_attribute(__warn_unused_result__) jpayne@69: # define PNG_USE_RESULT __attribute__((__warn_unused_result__)) jpayne@69: # endif jpayne@69: # if !defined(PNG_NORETURN) && __has_attribute(__noreturn__) jpayne@69: # define PNG_NORETURN __attribute__((__noreturn__)) jpayne@69: # endif jpayne@69: # if !defined(PNG_ALLOCATED) && __has_attribute(__malloc__) jpayne@69: # define PNG_ALLOCATED __attribute__((__malloc__)) jpayne@69: # endif jpayne@69: # if !defined(PNG_DEPRECATED) && __has_attribute(__deprecated__) jpayne@69: # define PNG_DEPRECATED __attribute__((__deprecated__)) jpayne@69: # endif jpayne@69: # if !defined(PNG_PRIVATE) jpayne@69: # ifdef __has_extension jpayne@69: # if __has_extension(attribute_unavailable_with_message) jpayne@69: # define PNG_PRIVATE __attribute__((__unavailable__(\ jpayne@69: "This function is not exported by libpng."))) jpayne@69: # endif jpayne@69: # endif jpayne@69: # endif jpayne@69: # ifndef PNG_RESTRICT jpayne@69: # define PNG_RESTRICT __restrict jpayne@69: # endif jpayne@69: jpayne@69: # elif defined(__GNUC__) jpayne@69: # ifndef PNG_USE_RESULT jpayne@69: # define PNG_USE_RESULT __attribute__((__warn_unused_result__)) jpayne@69: # endif jpayne@69: # ifndef PNG_NORETURN jpayne@69: # define PNG_NORETURN __attribute__((__noreturn__)) jpayne@69: # endif jpayne@69: # if __GNUC__ >= 3 jpayne@69: # ifndef PNG_ALLOCATED jpayne@69: # define PNG_ALLOCATED __attribute__((__malloc__)) jpayne@69: # endif jpayne@69: # ifndef PNG_DEPRECATED jpayne@69: # define PNG_DEPRECATED __attribute__((__deprecated__)) jpayne@69: # endif jpayne@69: # ifndef PNG_PRIVATE jpayne@69: # if 0 /* Doesn't work so we use deprecated instead*/ jpayne@69: # define PNG_PRIVATE \ jpayne@69: __attribute__((warning("This function is not exported by libpng."))) jpayne@69: # else jpayne@69: # define PNG_PRIVATE \ jpayne@69: __attribute__((__deprecated__)) jpayne@69: # endif jpayne@69: # endif jpayne@69: # if ((__GNUC__ > 3) || !defined(__GNUC_MINOR__) || (__GNUC_MINOR__ >= 1)) jpayne@69: # ifndef PNG_RESTRICT jpayne@69: # define PNG_RESTRICT __restrict jpayne@69: # endif jpayne@69: # endif /* __GNUC__.__GNUC_MINOR__ > 3.0 */ jpayne@69: # endif /* __GNUC__ >= 3 */ jpayne@69: jpayne@69: # elif defined(_MSC_VER) && (_MSC_VER >= 1300) jpayne@69: # ifndef PNG_USE_RESULT jpayne@69: # define PNG_USE_RESULT /* not supported */ jpayne@69: # endif jpayne@69: # ifndef PNG_NORETURN jpayne@69: # define PNG_NORETURN __declspec(noreturn) jpayne@69: # endif jpayne@69: # ifndef PNG_ALLOCATED jpayne@69: # if (_MSC_VER >= 1400) jpayne@69: # define PNG_ALLOCATED __declspec(restrict) jpayne@69: # endif jpayne@69: # endif jpayne@69: # ifndef PNG_DEPRECATED jpayne@69: # define PNG_DEPRECATED __declspec(deprecated) jpayne@69: # endif jpayne@69: # ifndef PNG_PRIVATE jpayne@69: # define PNG_PRIVATE __declspec(deprecated) jpayne@69: # endif jpayne@69: # ifndef PNG_RESTRICT jpayne@69: # if (_MSC_VER >= 1400) jpayne@69: # define PNG_RESTRICT __restrict jpayne@69: # endif jpayne@69: # endif jpayne@69: jpayne@69: # elif defined(__WATCOMC__) jpayne@69: # ifndef PNG_RESTRICT jpayne@69: # define PNG_RESTRICT __restrict jpayne@69: # endif jpayne@69: # endif jpayne@69: #endif /* PNG_PEDANTIC_WARNINGS */ jpayne@69: jpayne@69: #ifndef PNG_DEPRECATED jpayne@69: # define PNG_DEPRECATED /* Use of this function is deprecated */ jpayne@69: #endif jpayne@69: #ifndef PNG_USE_RESULT jpayne@69: # define PNG_USE_RESULT /* The result of this function must be checked */ jpayne@69: #endif jpayne@69: #ifndef PNG_NORETURN jpayne@69: # define PNG_NORETURN /* This function does not return */ jpayne@69: #endif jpayne@69: #ifndef PNG_ALLOCATED jpayne@69: # define PNG_ALLOCATED /* The result of the function is new memory */ jpayne@69: #endif jpayne@69: #ifndef PNG_PRIVATE jpayne@69: # define PNG_PRIVATE /* This is a private libpng function */ jpayne@69: #endif jpayne@69: #ifndef PNG_RESTRICT jpayne@69: # define PNG_RESTRICT /* The C99 "restrict" feature */ jpayne@69: #endif jpayne@69: jpayne@69: #ifndef PNG_FP_EXPORT /* A floating point API. */ jpayne@69: # ifdef PNG_FLOATING_POINT_SUPPORTED jpayne@69: # define PNG_FP_EXPORT(ordinal, type, name, args)\ jpayne@69: PNG_EXPORT(ordinal, type, name, args); jpayne@69: # else /* No floating point APIs */ jpayne@69: # define PNG_FP_EXPORT(ordinal, type, name, args) jpayne@69: # endif jpayne@69: #endif jpayne@69: #ifndef PNG_FIXED_EXPORT /* A fixed point API. */ jpayne@69: # ifdef PNG_FIXED_POINT_SUPPORTED jpayne@69: # define PNG_FIXED_EXPORT(ordinal, type, name, args)\ jpayne@69: PNG_EXPORT(ordinal, type, name, args); jpayne@69: # else /* No fixed point APIs */ jpayne@69: # define PNG_FIXED_EXPORT(ordinal, type, name, args) jpayne@69: # endif jpayne@69: #endif jpayne@69: jpayne@69: #ifndef PNG_BUILDING_SYMBOL_TABLE jpayne@69: /* Some typedefs to get us started. These should be safe on most of the common jpayne@69: * platforms. jpayne@69: * jpayne@69: * png_uint_32 and png_int_32 may, currently, be larger than required to hold a jpayne@69: * 32-bit value however this is not normally advisable. jpayne@69: * jpayne@69: * png_uint_16 and png_int_16 should always be two bytes in size - this is jpayne@69: * verified at library build time. jpayne@69: * jpayne@69: * png_byte must always be one byte in size. jpayne@69: * jpayne@69: * The checks below use constants from limits.h, as defined by the ISOC90 jpayne@69: * standard. jpayne@69: */ jpayne@69: #if CHAR_BIT == 8 && UCHAR_MAX == 255 jpayne@69: typedef unsigned char png_byte; jpayne@69: #else jpayne@69: # error "libpng requires 8-bit bytes" jpayne@69: #endif jpayne@69: jpayne@69: #if INT_MIN == -32768 && INT_MAX == 32767 jpayne@69: typedef int png_int_16; jpayne@69: #elif SHRT_MIN == -32768 && SHRT_MAX == 32767 jpayne@69: typedef short png_int_16; jpayne@69: #else jpayne@69: # error "libpng requires a signed 16-bit type" jpayne@69: #endif jpayne@69: jpayne@69: #if UINT_MAX == 65535 jpayne@69: typedef unsigned int png_uint_16; jpayne@69: #elif USHRT_MAX == 65535 jpayne@69: typedef unsigned short png_uint_16; jpayne@69: #else jpayne@69: # error "libpng requires an unsigned 16-bit type" jpayne@69: #endif jpayne@69: jpayne@69: #if INT_MIN < -2147483646 && INT_MAX > 2147483646 jpayne@69: typedef int png_int_32; jpayne@69: #elif LONG_MIN < -2147483646 && LONG_MAX > 2147483646 jpayne@69: typedef long int png_int_32; jpayne@69: #else jpayne@69: # error "libpng requires a signed 32-bit (or more) type" jpayne@69: #endif jpayne@69: jpayne@69: #if UINT_MAX > 4294967294U jpayne@69: typedef unsigned int png_uint_32; jpayne@69: #elif ULONG_MAX > 4294967294U jpayne@69: typedef unsigned long int png_uint_32; jpayne@69: #else jpayne@69: # error "libpng requires an unsigned 32-bit (or more) type" jpayne@69: #endif jpayne@69: jpayne@69: /* Prior to 1.6.0, it was possible to disable the use of size_t and ptrdiff_t. jpayne@69: * From 1.6.0 onwards, an ISO C90 compiler, as well as a standard-compliant jpayne@69: * behavior of sizeof and ptrdiff_t are required. jpayne@69: * The legacy typedefs are provided here for backwards compatibility. jpayne@69: */ jpayne@69: typedef size_t png_size_t; jpayne@69: typedef ptrdiff_t png_ptrdiff_t; jpayne@69: jpayne@69: /* libpng needs to know the maximum value of 'size_t' and this controls the jpayne@69: * definition of png_alloc_size_t, below. This maximum value of size_t limits jpayne@69: * but does not control the maximum allocations the library makes - there is jpayne@69: * direct application control of this through png_set_user_limits(). jpayne@69: */ jpayne@69: #ifndef PNG_SMALL_SIZE_T jpayne@69: /* Compiler specific tests for systems where size_t is known to be less than jpayne@69: * 32 bits (some of these systems may no longer work because of the lack of jpayne@69: * 'far' support; see above.) jpayne@69: */ jpayne@69: # if (defined(__TURBOC__) && !defined(__FLAT__)) ||\ jpayne@69: (defined(_MSC_VER) && defined(MAXSEG_64K)) jpayne@69: # define PNG_SMALL_SIZE_T jpayne@69: # endif jpayne@69: #endif jpayne@69: jpayne@69: /* png_alloc_size_t is guaranteed to be no smaller than size_t, and no smaller jpayne@69: * than png_uint_32. Casts from size_t or png_uint_32 to png_alloc_size_t are jpayne@69: * not necessary; in fact, it is recommended not to use them at all, so that jpayne@69: * the compiler can complain when something turns out to be problematic. jpayne@69: * jpayne@69: * Casts in the other direction (from png_alloc_size_t to size_t or jpayne@69: * png_uint_32) should be explicitly applied; however, we do not expect to jpayne@69: * encounter practical situations that require such conversions. jpayne@69: * jpayne@69: * PNG_SMALL_SIZE_T must be defined if the maximum value of size_t is less than jpayne@69: * 4294967295 - i.e. less than the maximum value of png_uint_32. jpayne@69: */ jpayne@69: #ifdef PNG_SMALL_SIZE_T jpayne@69: typedef png_uint_32 png_alloc_size_t; jpayne@69: #else jpayne@69: typedef size_t png_alloc_size_t; jpayne@69: #endif jpayne@69: jpayne@69: /* Prior to 1.6.0 libpng offered limited support for Microsoft C compiler jpayne@69: * implementations of Intel CPU specific support of user-mode segmented address jpayne@69: * spaces, where 16-bit pointers address more than 65536 bytes of memory using jpayne@69: * separate 'segment' registers. The implementation requires two different jpayne@69: * types of pointer (only one of which includes the segment value.) jpayne@69: * jpayne@69: * If required this support is available in version 1.2 of libpng and may be jpayne@69: * available in versions through 1.5, although the correctness of the code has jpayne@69: * not been verified recently. jpayne@69: */ jpayne@69: jpayne@69: /* Typedef for floating-point numbers that are converted to fixed-point with a jpayne@69: * multiple of 100,000, e.g., gamma jpayne@69: */ jpayne@69: typedef png_int_32 png_fixed_point; jpayne@69: jpayne@69: /* Add typedefs for pointers */ jpayne@69: typedef void * png_voidp; jpayne@69: typedef const void * png_const_voidp; jpayne@69: typedef png_byte * png_bytep; jpayne@69: typedef const png_byte * png_const_bytep; jpayne@69: typedef png_uint_32 * png_uint_32p; jpayne@69: typedef const png_uint_32 * png_const_uint_32p; jpayne@69: typedef png_int_32 * png_int_32p; jpayne@69: typedef const png_int_32 * png_const_int_32p; jpayne@69: typedef png_uint_16 * png_uint_16p; jpayne@69: typedef const png_uint_16 * png_const_uint_16p; jpayne@69: typedef png_int_16 * png_int_16p; jpayne@69: typedef const png_int_16 * png_const_int_16p; jpayne@69: typedef char * png_charp; jpayne@69: typedef const char * png_const_charp; jpayne@69: typedef png_fixed_point * png_fixed_point_p; jpayne@69: typedef const png_fixed_point * png_const_fixed_point_p; jpayne@69: typedef size_t * png_size_tp; jpayne@69: typedef const size_t * png_const_size_tp; jpayne@69: jpayne@69: #ifdef PNG_STDIO_SUPPORTED jpayne@69: typedef FILE * png_FILE_p; jpayne@69: #endif jpayne@69: jpayne@69: #ifdef PNG_FLOATING_POINT_SUPPORTED jpayne@69: typedef double * png_doublep; jpayne@69: typedef const double * png_const_doublep; jpayne@69: #endif jpayne@69: jpayne@69: /* Pointers to pointers; i.e. arrays */ jpayne@69: typedef png_byte * * png_bytepp; jpayne@69: typedef png_uint_32 * * png_uint_32pp; jpayne@69: typedef png_int_32 * * png_int_32pp; jpayne@69: typedef png_uint_16 * * png_uint_16pp; jpayne@69: typedef png_int_16 * * png_int_16pp; jpayne@69: typedef const char * * png_const_charpp; jpayne@69: typedef char * * png_charpp; jpayne@69: typedef png_fixed_point * * png_fixed_point_pp; jpayne@69: #ifdef PNG_FLOATING_POINT_SUPPORTED jpayne@69: typedef double * * png_doublepp; jpayne@69: #endif jpayne@69: jpayne@69: /* Pointers to pointers to pointers; i.e., pointer to array */ jpayne@69: typedef char * * * png_charppp; jpayne@69: jpayne@69: #endif /* PNG_BUILDING_SYMBOL_TABLE */ jpayne@69: jpayne@69: #endif /* PNGCONF_H */