xref: /aosp_15_r20/external/libpng/pngconf.h (revision a67afe4df73cf47866eedc69947994b8ff839aba)
1*a67afe4dSAndroid Build Coastguard Worker 
2*a67afe4dSAndroid Build Coastguard Worker /* pngconf.h - machine-configurable file for libpng
3*a67afe4dSAndroid Build Coastguard Worker  *
4*a67afe4dSAndroid Build Coastguard Worker  * libpng version 1.6.44
5*a67afe4dSAndroid Build Coastguard Worker  *
6*a67afe4dSAndroid Build Coastguard Worker  * Copyright (c) 2018-2024 Cosmin Truta
7*a67afe4dSAndroid Build Coastguard Worker  * Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
8*a67afe4dSAndroid Build Coastguard Worker  * Copyright (c) 1996-1997 Andreas Dilger
9*a67afe4dSAndroid Build Coastguard Worker  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
10*a67afe4dSAndroid Build Coastguard Worker  *
11*a67afe4dSAndroid Build Coastguard Worker  * This code is released under the libpng license.
12*a67afe4dSAndroid Build Coastguard Worker  * For conditions of distribution and use, see the disclaimer
13*a67afe4dSAndroid Build Coastguard Worker  * and license in png.h
14*a67afe4dSAndroid Build Coastguard Worker  *
15*a67afe4dSAndroid Build Coastguard Worker  * Any machine specific code is near the front of this file, so if you
16*a67afe4dSAndroid Build Coastguard Worker  * are configuring libpng for a machine, you may want to read the section
17*a67afe4dSAndroid Build Coastguard Worker  * starting here down to where it starts to typedef png_color, png_text,
18*a67afe4dSAndroid Build Coastguard Worker  * and png_info.
19*a67afe4dSAndroid Build Coastguard Worker  */
20*a67afe4dSAndroid Build Coastguard Worker 
21*a67afe4dSAndroid Build Coastguard Worker #ifndef PNGCONF_H
22*a67afe4dSAndroid Build Coastguard Worker #define PNGCONF_H
23*a67afe4dSAndroid Build Coastguard Worker 
24*a67afe4dSAndroid Build Coastguard Worker #ifndef PNG_BUILDING_SYMBOL_TABLE /* else includes may cause problems */
25*a67afe4dSAndroid Build Coastguard Worker 
26*a67afe4dSAndroid Build Coastguard Worker /* From libpng 1.6.0 libpng requires an ANSI X3.159-1989 ("ISOC90") compliant C
27*a67afe4dSAndroid Build Coastguard Worker  * compiler for correct compilation.  The following header files are required by
28*a67afe4dSAndroid Build Coastguard Worker  * the standard.  If your compiler doesn't provide these header files, or they
29*a67afe4dSAndroid Build Coastguard Worker  * do not match the standard, you will need to provide/improve them.
30*a67afe4dSAndroid Build Coastguard Worker  */
31*a67afe4dSAndroid Build Coastguard Worker #include <limits.h>
32*a67afe4dSAndroid Build Coastguard Worker #include <stddef.h>
33*a67afe4dSAndroid Build Coastguard Worker 
34*a67afe4dSAndroid Build Coastguard Worker /* Library header files.  These header files are all defined by ISOC90; libpng
35*a67afe4dSAndroid Build Coastguard Worker  * expects conformant implementations, however, an ISOC90 conformant system need
36*a67afe4dSAndroid Build Coastguard Worker  * not provide these header files if the functionality cannot be implemented.
37*a67afe4dSAndroid Build Coastguard Worker  * In this case it will be necessary to disable the relevant parts of libpng in
38*a67afe4dSAndroid Build Coastguard Worker  * the build of pnglibconf.h.
39*a67afe4dSAndroid Build Coastguard Worker  *
40*a67afe4dSAndroid Build Coastguard Worker  * Prior to 1.6.0 string.h was included here; the API changes in 1.6.0 to not
41*a67afe4dSAndroid Build Coastguard Worker  * include this unnecessary header file.
42*a67afe4dSAndroid Build Coastguard Worker  */
43*a67afe4dSAndroid Build Coastguard Worker 
44*a67afe4dSAndroid Build Coastguard Worker #ifdef PNG_STDIO_SUPPORTED
45*a67afe4dSAndroid Build Coastguard Worker    /* Required for the definition of FILE: */
46*a67afe4dSAndroid Build Coastguard Worker #  include <stdio.h>
47*a67afe4dSAndroid Build Coastguard Worker #endif
48*a67afe4dSAndroid Build Coastguard Worker 
49*a67afe4dSAndroid Build Coastguard Worker #ifdef PNG_SETJMP_SUPPORTED
50*a67afe4dSAndroid Build Coastguard Worker    /* Required for the definition of jmp_buf and the declaration of longjmp: */
51*a67afe4dSAndroid Build Coastguard Worker #  include <setjmp.h>
52*a67afe4dSAndroid Build Coastguard Worker #endif
53*a67afe4dSAndroid Build Coastguard Worker 
54*a67afe4dSAndroid Build Coastguard Worker #ifdef PNG_CONVERT_tIME_SUPPORTED
55*a67afe4dSAndroid Build Coastguard Worker    /* Required for struct tm: */
56*a67afe4dSAndroid Build Coastguard Worker #  include <time.h>
57*a67afe4dSAndroid Build Coastguard Worker #endif
58*a67afe4dSAndroid Build Coastguard Worker 
59*a67afe4dSAndroid Build Coastguard Worker #endif /* PNG_BUILDING_SYMBOL_TABLE */
60*a67afe4dSAndroid Build Coastguard Worker 
61*a67afe4dSAndroid Build Coastguard Worker /* Prior to 1.6.0, it was possible to turn off 'const' in declarations,
62*a67afe4dSAndroid Build Coastguard Worker  * using PNG_NO_CONST.  This is no longer supported.
63*a67afe4dSAndroid Build Coastguard Worker  */
64*a67afe4dSAndroid Build Coastguard Worker #define PNG_CONST const /* backward compatibility only */
65*a67afe4dSAndroid Build Coastguard Worker 
66*a67afe4dSAndroid Build Coastguard Worker /* This controls optimization of the reading of 16-bit and 32-bit
67*a67afe4dSAndroid Build Coastguard Worker  * values from PNG files.  It can be set on a per-app-file basis: it
68*a67afe4dSAndroid Build Coastguard Worker  * just changes whether a macro is used when the function is called.
69*a67afe4dSAndroid Build Coastguard Worker  * The library builder sets the default; if read functions are not
70*a67afe4dSAndroid Build Coastguard Worker  * built into the library the macro implementation is forced on.
71*a67afe4dSAndroid Build Coastguard Worker  */
72*a67afe4dSAndroid Build Coastguard Worker #ifndef PNG_READ_INT_FUNCTIONS_SUPPORTED
73*a67afe4dSAndroid Build Coastguard Worker #  define PNG_USE_READ_MACROS
74*a67afe4dSAndroid Build Coastguard Worker #endif
75*a67afe4dSAndroid Build Coastguard Worker #if !defined(PNG_NO_USE_READ_MACROS) && !defined(PNG_USE_READ_MACROS)
76*a67afe4dSAndroid Build Coastguard Worker #  if PNG_DEFAULT_READ_MACROS
77*a67afe4dSAndroid Build Coastguard Worker #    define PNG_USE_READ_MACROS
78*a67afe4dSAndroid Build Coastguard Worker #  endif
79*a67afe4dSAndroid Build Coastguard Worker #endif
80*a67afe4dSAndroid Build Coastguard Worker 
81*a67afe4dSAndroid Build Coastguard Worker /* COMPILER SPECIFIC OPTIONS.
82*a67afe4dSAndroid Build Coastguard Worker  *
83*a67afe4dSAndroid Build Coastguard Worker  * These options are provided so that a variety of difficult compilers
84*a67afe4dSAndroid Build Coastguard Worker  * can be used.  Some are fixed at build time (e.g. PNG_API_RULE
85*a67afe4dSAndroid Build Coastguard Worker  * below) but still have compiler specific implementations, others
86*a67afe4dSAndroid Build Coastguard Worker  * may be changed on a per-file basis when compiling against libpng.
87*a67afe4dSAndroid Build Coastguard Worker  */
88*a67afe4dSAndroid Build Coastguard Worker 
89*a67afe4dSAndroid Build Coastguard Worker /* The PNGARG macro was used in versions of libpng prior to 1.6.0 to protect
90*a67afe4dSAndroid Build Coastguard Worker  * against legacy (pre ISOC90) compilers that did not understand function
91*a67afe4dSAndroid Build Coastguard Worker  * prototypes.  [Deprecated.]
92*a67afe4dSAndroid Build Coastguard Worker  */
93*a67afe4dSAndroid Build Coastguard Worker #ifndef PNGARG
94*a67afe4dSAndroid Build Coastguard Worker #  define PNGARG(arglist) arglist
95*a67afe4dSAndroid Build Coastguard Worker #endif
96*a67afe4dSAndroid Build Coastguard Worker 
97*a67afe4dSAndroid Build Coastguard Worker /* Function calling conventions.
98*a67afe4dSAndroid Build Coastguard Worker  * =============================
99*a67afe4dSAndroid Build Coastguard Worker  * Normally it is not necessary to specify to the compiler how to call
100*a67afe4dSAndroid Build Coastguard Worker  * a function - it just does it - however on x86 systems derived from
101*a67afe4dSAndroid Build Coastguard Worker  * Microsoft and Borland C compilers ('IBM PC', 'DOS', 'Windows' systems
102*a67afe4dSAndroid Build Coastguard Worker  * and some others) there are multiple ways to call a function and the
103*a67afe4dSAndroid Build Coastguard Worker  * default can be changed on the compiler command line.  For this reason
104*a67afe4dSAndroid Build Coastguard Worker  * libpng specifies the calling convention of every exported function and
105*a67afe4dSAndroid Build Coastguard Worker  * every function called via a user supplied function pointer.  This is
106*a67afe4dSAndroid Build Coastguard Worker  * done in this file by defining the following macros:
107*a67afe4dSAndroid Build Coastguard Worker  *
108*a67afe4dSAndroid Build Coastguard Worker  * PNGAPI    Calling convention for exported functions.
109*a67afe4dSAndroid Build Coastguard Worker  * PNGCBAPI  Calling convention for user provided (callback) functions.
110*a67afe4dSAndroid Build Coastguard Worker  * PNGCAPI   Calling convention used by the ANSI-C library (required
111*a67afe4dSAndroid Build Coastguard Worker  *           for longjmp callbacks and sometimes used internally to
112*a67afe4dSAndroid Build Coastguard Worker  *           specify the calling convention for zlib).
113*a67afe4dSAndroid Build Coastguard Worker  *
114*a67afe4dSAndroid Build Coastguard Worker  * These macros should never be overridden.  If it is necessary to
115*a67afe4dSAndroid Build Coastguard Worker  * change calling convention in a private build this can be done
116*a67afe4dSAndroid Build Coastguard Worker  * by setting PNG_API_RULE (which defaults to 0) to one of the values
117*a67afe4dSAndroid Build Coastguard Worker  * below to select the correct 'API' variants.
118*a67afe4dSAndroid Build Coastguard Worker  *
119*a67afe4dSAndroid Build Coastguard Worker  * PNG_API_RULE=0 Use PNGCAPI - the 'C' calling convention - throughout.
120*a67afe4dSAndroid Build Coastguard Worker  *                This is correct in every known environment.
121*a67afe4dSAndroid Build Coastguard Worker  * PNG_API_RULE=1 Use the operating system convention for PNGAPI and
122*a67afe4dSAndroid Build Coastguard Worker  *                the 'C' calling convention (from PNGCAPI) for
123*a67afe4dSAndroid Build Coastguard Worker  *                callbacks (PNGCBAPI).  This is no longer required
124*a67afe4dSAndroid Build Coastguard Worker  *                in any known environment - if it has to be used
125*a67afe4dSAndroid Build Coastguard Worker  *                please post an explanation of the problem to the
126*a67afe4dSAndroid Build Coastguard Worker  *                libpng mailing list.
127*a67afe4dSAndroid Build Coastguard Worker  *
128*a67afe4dSAndroid Build Coastguard Worker  * These cases only differ if the operating system does not use the C
129*a67afe4dSAndroid Build Coastguard Worker  * calling convention, at present this just means the above cases
130*a67afe4dSAndroid Build Coastguard Worker  * (x86 DOS/Windows systems) and, even then, this does not apply to
131*a67afe4dSAndroid Build Coastguard Worker  * Cygwin running on those systems.
132*a67afe4dSAndroid Build Coastguard Worker  *
133*a67afe4dSAndroid Build Coastguard Worker  * Note that the value must be defined in pnglibconf.h so that what
134*a67afe4dSAndroid Build Coastguard Worker  * the application uses to call the library matches the conventions
135*a67afe4dSAndroid Build Coastguard Worker  * set when building the library.
136*a67afe4dSAndroid Build Coastguard Worker  */
137*a67afe4dSAndroid Build Coastguard Worker 
138*a67afe4dSAndroid Build Coastguard Worker /* Symbol export
139*a67afe4dSAndroid Build Coastguard Worker  * =============
140*a67afe4dSAndroid Build Coastguard Worker  * When building a shared library it is almost always necessary to tell
141*a67afe4dSAndroid Build Coastguard Worker  * the compiler which symbols to export.  The png.h macro 'PNG_EXPORT'
142*a67afe4dSAndroid Build Coastguard Worker  * is used to mark the symbols.  On some systems these symbols can be
143*a67afe4dSAndroid Build Coastguard Worker  * extracted at link time and need no special processing by the compiler,
144*a67afe4dSAndroid Build Coastguard Worker  * on other systems the symbols are flagged by the compiler and just
145*a67afe4dSAndroid Build Coastguard Worker  * the declaration requires a special tag applied (unfortunately) in a
146*a67afe4dSAndroid Build Coastguard Worker  * compiler dependent way.  Some systems can do either.
147*a67afe4dSAndroid Build Coastguard Worker  *
148*a67afe4dSAndroid Build Coastguard Worker  * A small number of older systems also require a symbol from a DLL to
149*a67afe4dSAndroid Build Coastguard Worker  * be flagged to the program that calls it.  This is a problem because
150*a67afe4dSAndroid Build Coastguard Worker  * we do not know in the header file included by application code that
151*a67afe4dSAndroid Build Coastguard Worker  * the symbol will come from a shared library, as opposed to a statically
152*a67afe4dSAndroid Build Coastguard Worker  * linked one.  For this reason the application must tell us by setting
153*a67afe4dSAndroid Build Coastguard Worker  * the magic flag PNG_USE_DLL to turn on the special processing before
154*a67afe4dSAndroid Build Coastguard Worker  * it includes png.h.
155*a67afe4dSAndroid Build Coastguard Worker  *
156*a67afe4dSAndroid Build Coastguard Worker  * Four additional macros are used to make this happen:
157*a67afe4dSAndroid Build Coastguard Worker  *
158*a67afe4dSAndroid Build Coastguard Worker  * PNG_IMPEXP The magic (if any) to cause a symbol to be exported from
159*a67afe4dSAndroid Build Coastguard Worker  *            the build or imported if PNG_USE_DLL is set - compiler
160*a67afe4dSAndroid Build Coastguard Worker  *            and system specific.
161*a67afe4dSAndroid Build Coastguard Worker  *
162*a67afe4dSAndroid Build Coastguard Worker  * PNG_EXPORT_TYPE(type) A macro that pre or appends PNG_IMPEXP to
163*a67afe4dSAndroid Build Coastguard Worker  *                       'type', compiler specific.
164*a67afe4dSAndroid Build Coastguard Worker  *
165*a67afe4dSAndroid Build Coastguard Worker  * PNG_DLL_EXPORT Set to the magic to use during a libpng build to
166*a67afe4dSAndroid Build Coastguard Worker  *                make a symbol exported from the DLL.  Not used in the
167*a67afe4dSAndroid Build Coastguard Worker  *                public header files; see pngpriv.h for how it is used
168*a67afe4dSAndroid Build Coastguard Worker  *                in the libpng build.
169*a67afe4dSAndroid Build Coastguard Worker  *
170*a67afe4dSAndroid Build Coastguard Worker  * PNG_DLL_IMPORT Set to the magic to force the libpng symbols to come
171*a67afe4dSAndroid Build Coastguard Worker  *                from a DLL - used to define PNG_IMPEXP when
172*a67afe4dSAndroid Build Coastguard Worker  *                PNG_USE_DLL is set.
173*a67afe4dSAndroid Build Coastguard Worker  */
174*a67afe4dSAndroid Build Coastguard Worker 
175*a67afe4dSAndroid Build Coastguard Worker /* System specific discovery.
176*a67afe4dSAndroid Build Coastguard Worker  * ==========================
177*a67afe4dSAndroid Build Coastguard Worker  * This code is used at build time to find PNG_IMPEXP, the API settings
178*a67afe4dSAndroid Build Coastguard Worker  * and PNG_EXPORT_TYPE(), it may also set a macro to indicate the DLL
179*a67afe4dSAndroid Build Coastguard Worker  * import processing is possible.  On Windows systems it also sets
180*a67afe4dSAndroid Build Coastguard Worker  * compiler-specific macros to the values required to change the calling
181*a67afe4dSAndroid Build Coastguard Worker  * conventions of the various functions.
182*a67afe4dSAndroid Build Coastguard Worker  */
183*a67afe4dSAndroid Build Coastguard Worker #if defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || \
184*a67afe4dSAndroid Build Coastguard Worker     defined(__CYGWIN__)
185*a67afe4dSAndroid Build Coastguard Worker   /* Windows system (DOS doesn't support DLLs).  Includes builds under Cygwin or
186*a67afe4dSAndroid Build Coastguard Worker    * MinGW on any architecture currently supported by Windows.  Also includes
187*a67afe4dSAndroid Build Coastguard Worker    * Watcom builds but these need special treatment because they are not
188*a67afe4dSAndroid Build Coastguard Worker    * compatible with GCC or Visual C because of different calling conventions.
189*a67afe4dSAndroid Build Coastguard Worker    */
190*a67afe4dSAndroid Build Coastguard Worker #  if PNG_API_RULE == 2
191*a67afe4dSAndroid Build Coastguard Worker    /* If this line results in an error, either because __watcall is not
192*a67afe4dSAndroid Build Coastguard Worker     * understood or because of a redefine just below you cannot use *this*
193*a67afe4dSAndroid Build Coastguard Worker     * build of the library with the compiler you are using.  *This* build was
194*a67afe4dSAndroid Build Coastguard Worker     * build using Watcom and applications must also be built using Watcom!
195*a67afe4dSAndroid Build Coastguard Worker     */
196*a67afe4dSAndroid Build Coastguard Worker #    define PNGCAPI __watcall
197*a67afe4dSAndroid Build Coastguard Worker #  endif
198*a67afe4dSAndroid Build Coastguard Worker 
199*a67afe4dSAndroid Build Coastguard Worker #  if defined(__GNUC__) || (defined(_MSC_VER) && (_MSC_VER >= 800))
200*a67afe4dSAndroid Build Coastguard Worker #    define PNGCAPI __cdecl
201*a67afe4dSAndroid Build Coastguard Worker #    if PNG_API_RULE == 1
202*a67afe4dSAndroid Build Coastguard Worker    /* If this line results in an error __stdcall is not understood and
203*a67afe4dSAndroid Build Coastguard Worker     * PNG_API_RULE should not have been set to '1'.
204*a67afe4dSAndroid Build Coastguard Worker     */
205*a67afe4dSAndroid Build Coastguard Worker #      define PNGAPI __stdcall
206*a67afe4dSAndroid Build Coastguard Worker #    endif
207*a67afe4dSAndroid Build Coastguard Worker #  else
208*a67afe4dSAndroid Build Coastguard Worker    /* An older compiler, or one not detected (erroneously) above,
209*a67afe4dSAndroid Build Coastguard Worker     * if necessary override on the command line to get the correct
210*a67afe4dSAndroid Build Coastguard Worker     * variants for the compiler.
211*a67afe4dSAndroid Build Coastguard Worker     */
212*a67afe4dSAndroid Build Coastguard Worker #    ifndef PNGCAPI
213*a67afe4dSAndroid Build Coastguard Worker #      define PNGCAPI _cdecl
214*a67afe4dSAndroid Build Coastguard Worker #    endif
215*a67afe4dSAndroid Build Coastguard Worker #    if PNG_API_RULE == 1 && !defined(PNGAPI)
216*a67afe4dSAndroid Build Coastguard Worker #      define PNGAPI _stdcall
217*a67afe4dSAndroid Build Coastguard Worker #    endif
218*a67afe4dSAndroid Build Coastguard Worker #  endif /* compiler/api */
219*a67afe4dSAndroid Build Coastguard Worker 
220*a67afe4dSAndroid Build Coastguard Worker   /* NOTE: PNGCBAPI always defaults to PNGCAPI. */
221*a67afe4dSAndroid Build Coastguard Worker 
222*a67afe4dSAndroid Build Coastguard Worker #  if defined(PNGAPI) && !defined(PNG_USER_PRIVATEBUILD)
223*a67afe4dSAndroid Build Coastguard Worker #     error "PNG_USER_PRIVATEBUILD must be defined if PNGAPI is changed"
224*a67afe4dSAndroid Build Coastguard Worker #  endif
225*a67afe4dSAndroid Build Coastguard Worker 
226*a67afe4dSAndroid Build Coastguard Worker #  if (defined(_MSC_VER) && _MSC_VER < 800) ||\
227*a67afe4dSAndroid Build Coastguard Worker       (defined(__BORLANDC__) && __BORLANDC__ < 0x500)
228*a67afe4dSAndroid Build Coastguard Worker    /* older Borland and MSC
229*a67afe4dSAndroid Build Coastguard Worker     * compilers used '__export' and required this to be after
230*a67afe4dSAndroid Build Coastguard Worker     * the type.
231*a67afe4dSAndroid Build Coastguard Worker     */
232*a67afe4dSAndroid Build Coastguard Worker #    ifndef PNG_EXPORT_TYPE
233*a67afe4dSAndroid Build Coastguard Worker #      define PNG_EXPORT_TYPE(type) type PNG_IMPEXP
234*a67afe4dSAndroid Build Coastguard Worker #    endif
235*a67afe4dSAndroid Build Coastguard Worker #    define PNG_DLL_EXPORT __export
236*a67afe4dSAndroid Build Coastguard Worker #  else /* newer compiler */
237*a67afe4dSAndroid Build Coastguard Worker #    define PNG_DLL_EXPORT __declspec(dllexport)
238*a67afe4dSAndroid Build Coastguard Worker #    ifndef PNG_DLL_IMPORT
239*a67afe4dSAndroid Build Coastguard Worker #      define PNG_DLL_IMPORT __declspec(dllimport)
240*a67afe4dSAndroid Build Coastguard Worker #    endif
241*a67afe4dSAndroid Build Coastguard Worker #  endif /* compiler */
242*a67afe4dSAndroid Build Coastguard Worker 
243*a67afe4dSAndroid Build Coastguard Worker #else /* !Windows */
244*a67afe4dSAndroid Build Coastguard Worker #  if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
245*a67afe4dSAndroid Build Coastguard Worker #    define PNGAPI _System
246*a67afe4dSAndroid Build Coastguard Worker #  else /* !Windows/x86 && !OS/2 */
247*a67afe4dSAndroid Build Coastguard Worker    /* Use the defaults, or define PNG*API on the command line (but
248*a67afe4dSAndroid Build Coastguard Worker     * this will have to be done for every compile!)
249*a67afe4dSAndroid Build Coastguard Worker     */
250*a67afe4dSAndroid Build Coastguard Worker #  endif /* other system, !OS/2 */
251*a67afe4dSAndroid Build Coastguard Worker #endif /* !Windows/x86 */
252*a67afe4dSAndroid Build Coastguard Worker 
253*a67afe4dSAndroid Build Coastguard Worker /* Now do all the defaulting . */
254*a67afe4dSAndroid Build Coastguard Worker #ifndef PNGCAPI
255*a67afe4dSAndroid Build Coastguard Worker #  define PNGCAPI
256*a67afe4dSAndroid Build Coastguard Worker #endif
257*a67afe4dSAndroid Build Coastguard Worker #ifndef PNGCBAPI
258*a67afe4dSAndroid Build Coastguard Worker #  define PNGCBAPI PNGCAPI
259*a67afe4dSAndroid Build Coastguard Worker #endif
260*a67afe4dSAndroid Build Coastguard Worker #ifndef PNGAPI
261*a67afe4dSAndroid Build Coastguard Worker #  define PNGAPI PNGCAPI
262*a67afe4dSAndroid Build Coastguard Worker #endif
263*a67afe4dSAndroid Build Coastguard Worker 
264*a67afe4dSAndroid Build Coastguard Worker /* PNG_IMPEXP may be set on the compilation system command line or (if not set)
265*a67afe4dSAndroid Build Coastguard Worker  * then in an internal header file when building the library, otherwise (when
266*a67afe4dSAndroid Build Coastguard Worker  * using the library) it is set here.
267*a67afe4dSAndroid Build Coastguard Worker  */
268*a67afe4dSAndroid Build Coastguard Worker #ifndef PNG_IMPEXP
269*a67afe4dSAndroid Build Coastguard Worker #  if defined(PNG_USE_DLL) && defined(PNG_DLL_IMPORT)
270*a67afe4dSAndroid Build Coastguard Worker    /* This forces use of a DLL, disallowing static linking */
271*a67afe4dSAndroid Build Coastguard Worker #    define PNG_IMPEXP PNG_DLL_IMPORT
272*a67afe4dSAndroid Build Coastguard Worker #  endif
273*a67afe4dSAndroid Build Coastguard Worker 
274*a67afe4dSAndroid Build Coastguard Worker #  ifndef PNG_IMPEXP
275*a67afe4dSAndroid Build Coastguard Worker #    define PNG_IMPEXP
276*a67afe4dSAndroid Build Coastguard Worker #  endif
277*a67afe4dSAndroid Build Coastguard Worker #endif
278*a67afe4dSAndroid Build Coastguard Worker 
279*a67afe4dSAndroid Build Coastguard Worker /* In 1.5.2 the definition of PNG_FUNCTION has been changed to always treat
280*a67afe4dSAndroid Build Coastguard Worker  * 'attributes' as a storage class - the attributes go at the start of the
281*a67afe4dSAndroid Build Coastguard Worker  * function definition, and attributes are always appended regardless of the
282*a67afe4dSAndroid Build Coastguard Worker  * compiler.  This considerably simplifies these macros but may cause problems
283*a67afe4dSAndroid Build Coastguard Worker  * if any compilers both need function attributes and fail to handle them as
284*a67afe4dSAndroid Build Coastguard Worker  * a storage class (this is unlikely.)
285*a67afe4dSAndroid Build Coastguard Worker  */
286*a67afe4dSAndroid Build Coastguard Worker #ifndef PNG_FUNCTION
287*a67afe4dSAndroid Build Coastguard Worker #  define PNG_FUNCTION(type, name, args, attributes) attributes type name args
288*a67afe4dSAndroid Build Coastguard Worker #endif
289*a67afe4dSAndroid Build Coastguard Worker 
290*a67afe4dSAndroid Build Coastguard Worker #ifndef PNG_EXPORT_TYPE
291*a67afe4dSAndroid Build Coastguard Worker #  define PNG_EXPORT_TYPE(type) PNG_IMPEXP type
292*a67afe4dSAndroid Build Coastguard Worker #endif
293*a67afe4dSAndroid Build Coastguard Worker 
294*a67afe4dSAndroid Build Coastguard Worker    /* The ordinal value is only relevant when preprocessing png.h for symbol
295*a67afe4dSAndroid Build Coastguard Worker     * table entries, so we discard it here.  See the .dfn files in the
296*a67afe4dSAndroid Build Coastguard Worker     * scripts directory.
297*a67afe4dSAndroid Build Coastguard Worker     */
298*a67afe4dSAndroid Build Coastguard Worker 
299*a67afe4dSAndroid Build Coastguard Worker #ifndef PNG_EXPORTA
300*a67afe4dSAndroid Build Coastguard Worker #  define PNG_EXPORTA(ordinal, type, name, args, attributes) \
301*a67afe4dSAndroid Build Coastguard Worker       PNG_FUNCTION(PNG_EXPORT_TYPE(type), (PNGAPI name), args, \
302*a67afe4dSAndroid Build Coastguard Worker       PNG_LINKAGE_API attributes)
303*a67afe4dSAndroid Build Coastguard Worker #endif
304*a67afe4dSAndroid Build Coastguard Worker 
305*a67afe4dSAndroid Build Coastguard Worker /* ANSI-C (C90) does not permit a macro to be invoked with an empty argument,
306*a67afe4dSAndroid Build Coastguard Worker  * so make something non-empty to satisfy the requirement:
307*a67afe4dSAndroid Build Coastguard Worker  */
308*a67afe4dSAndroid Build Coastguard Worker #define PNG_EMPTY /*empty list*/
309*a67afe4dSAndroid Build Coastguard Worker 
310*a67afe4dSAndroid Build Coastguard Worker #define PNG_EXPORT(ordinal, type, name, args) \
311*a67afe4dSAndroid Build Coastguard Worker    PNG_EXPORTA(ordinal, type, name, args, PNG_EMPTY)
312*a67afe4dSAndroid Build Coastguard Worker 
313*a67afe4dSAndroid Build Coastguard Worker /* Use PNG_REMOVED to comment out a removed interface. */
314*a67afe4dSAndroid Build Coastguard Worker #ifndef PNG_REMOVED
315*a67afe4dSAndroid Build Coastguard Worker #  define PNG_REMOVED(ordinal, type, name, args, attributes)
316*a67afe4dSAndroid Build Coastguard Worker #endif
317*a67afe4dSAndroid Build Coastguard Worker 
318*a67afe4dSAndroid Build Coastguard Worker #ifndef PNG_CALLBACK
319*a67afe4dSAndroid Build Coastguard Worker #  define PNG_CALLBACK(type, name, args) type (PNGCBAPI name) args
320*a67afe4dSAndroid Build Coastguard Worker #endif
321*a67afe4dSAndroid Build Coastguard Worker 
322*a67afe4dSAndroid Build Coastguard Worker /* Support for compiler specific function attributes.  These are used
323*a67afe4dSAndroid Build Coastguard Worker  * so that where compiler support is available incorrect use of API
324*a67afe4dSAndroid Build Coastguard Worker  * functions in png.h will generate compiler warnings.
325*a67afe4dSAndroid Build Coastguard Worker  *
326*a67afe4dSAndroid Build Coastguard Worker  * Added at libpng-1.2.41.
327*a67afe4dSAndroid Build Coastguard Worker  */
328*a67afe4dSAndroid Build Coastguard Worker 
329*a67afe4dSAndroid Build Coastguard Worker #ifndef PNG_NO_PEDANTIC_WARNINGS
330*a67afe4dSAndroid Build Coastguard Worker #  ifndef PNG_PEDANTIC_WARNINGS_SUPPORTED
331*a67afe4dSAndroid Build Coastguard Worker #    define PNG_PEDANTIC_WARNINGS_SUPPORTED
332*a67afe4dSAndroid Build Coastguard Worker #  endif
333*a67afe4dSAndroid Build Coastguard Worker #endif
334*a67afe4dSAndroid Build Coastguard Worker 
335*a67afe4dSAndroid Build Coastguard Worker #ifdef PNG_PEDANTIC_WARNINGS_SUPPORTED
336*a67afe4dSAndroid Build Coastguard Worker   /* Support for compiler specific function attributes.  These are used
337*a67afe4dSAndroid Build Coastguard Worker    * so that where compiler support is available, incorrect use of API
338*a67afe4dSAndroid Build Coastguard Worker    * functions in png.h will generate compiler warnings.  Added at libpng
339*a67afe4dSAndroid Build Coastguard Worker    * version 1.2.41.  Disabling these removes the warnings but may also produce
340*a67afe4dSAndroid Build Coastguard Worker    * less efficient code.
341*a67afe4dSAndroid Build Coastguard Worker    */
342*a67afe4dSAndroid Build Coastguard Worker #  if defined(__clang__) && defined(__has_attribute)
343*a67afe4dSAndroid Build Coastguard Worker    /* Clang defines both __clang__ and __GNUC__. Check __clang__ first. */
344*a67afe4dSAndroid Build Coastguard Worker #    if !defined(PNG_USE_RESULT) && __has_attribute(__warn_unused_result__)
345*a67afe4dSAndroid Build Coastguard Worker #      define PNG_USE_RESULT __attribute__((__warn_unused_result__))
346*a67afe4dSAndroid Build Coastguard Worker #    endif
347*a67afe4dSAndroid Build Coastguard Worker #    if !defined(PNG_NORETURN) && __has_attribute(__noreturn__)
348*a67afe4dSAndroid Build Coastguard Worker #      define PNG_NORETURN __attribute__((__noreturn__))
349*a67afe4dSAndroid Build Coastguard Worker #    endif
350*a67afe4dSAndroid Build Coastguard Worker #    if !defined(PNG_ALLOCATED) && __has_attribute(__malloc__)
351*a67afe4dSAndroid Build Coastguard Worker #      define PNG_ALLOCATED __attribute__((__malloc__))
352*a67afe4dSAndroid Build Coastguard Worker #    endif
353*a67afe4dSAndroid Build Coastguard Worker #    if !defined(PNG_DEPRECATED) && __has_attribute(__deprecated__)
354*a67afe4dSAndroid Build Coastguard Worker #      define PNG_DEPRECATED __attribute__((__deprecated__))
355*a67afe4dSAndroid Build Coastguard Worker #    endif
356*a67afe4dSAndroid Build Coastguard Worker #    if !defined(PNG_PRIVATE)
357*a67afe4dSAndroid Build Coastguard Worker #      ifdef __has_extension
358*a67afe4dSAndroid Build Coastguard Worker #        if __has_extension(attribute_unavailable_with_message)
359*a67afe4dSAndroid Build Coastguard Worker #          define PNG_PRIVATE __attribute__((__unavailable__(\
360*a67afe4dSAndroid Build Coastguard Worker              "This function is not exported by libpng.")))
361*a67afe4dSAndroid Build Coastguard Worker #        endif
362*a67afe4dSAndroid Build Coastguard Worker #      endif
363*a67afe4dSAndroid Build Coastguard Worker #    endif
364*a67afe4dSAndroid Build Coastguard Worker #    ifndef PNG_RESTRICT
365*a67afe4dSAndroid Build Coastguard Worker #      define PNG_RESTRICT __restrict
366*a67afe4dSAndroid Build Coastguard Worker #    endif
367*a67afe4dSAndroid Build Coastguard Worker 
368*a67afe4dSAndroid Build Coastguard Worker #  elif defined(__GNUC__)
369*a67afe4dSAndroid Build Coastguard Worker #    ifndef PNG_USE_RESULT
370*a67afe4dSAndroid Build Coastguard Worker #      define PNG_USE_RESULT __attribute__((__warn_unused_result__))
371*a67afe4dSAndroid Build Coastguard Worker #    endif
372*a67afe4dSAndroid Build Coastguard Worker #    ifndef PNG_NORETURN
373*a67afe4dSAndroid Build Coastguard Worker #      define PNG_NORETURN   __attribute__((__noreturn__))
374*a67afe4dSAndroid Build Coastguard Worker #    endif
375*a67afe4dSAndroid Build Coastguard Worker #    if __GNUC__ >= 3
376*a67afe4dSAndroid Build Coastguard Worker #      ifndef PNG_ALLOCATED
377*a67afe4dSAndroid Build Coastguard Worker #        define PNG_ALLOCATED  __attribute__((__malloc__))
378*a67afe4dSAndroid Build Coastguard Worker #      endif
379*a67afe4dSAndroid Build Coastguard Worker #      ifndef PNG_DEPRECATED
380*a67afe4dSAndroid Build Coastguard Worker #        define PNG_DEPRECATED __attribute__((__deprecated__))
381*a67afe4dSAndroid Build Coastguard Worker #      endif
382*a67afe4dSAndroid Build Coastguard Worker #      ifndef PNG_PRIVATE
383*a67afe4dSAndroid Build Coastguard Worker #        if 0 /* Doesn't work so we use deprecated instead*/
384*a67afe4dSAndroid Build Coastguard Worker #          define PNG_PRIVATE \
385*a67afe4dSAndroid Build Coastguard Worker             __attribute__((warning("This function is not exported by libpng.")))
386*a67afe4dSAndroid Build Coastguard Worker #        else
387*a67afe4dSAndroid Build Coastguard Worker #          define PNG_PRIVATE \
388*a67afe4dSAndroid Build Coastguard Worker             __attribute__((__deprecated__))
389*a67afe4dSAndroid Build Coastguard Worker #        endif
390*a67afe4dSAndroid Build Coastguard Worker #      endif
391*a67afe4dSAndroid Build Coastguard Worker #      if ((__GNUC__ > 3) || !defined(__GNUC_MINOR__) || (__GNUC_MINOR__ >= 1))
392*a67afe4dSAndroid Build Coastguard Worker #        ifndef PNG_RESTRICT
393*a67afe4dSAndroid Build Coastguard Worker #          define PNG_RESTRICT __restrict
394*a67afe4dSAndroid Build Coastguard Worker #        endif
395*a67afe4dSAndroid Build Coastguard Worker #      endif /* __GNUC__.__GNUC_MINOR__ > 3.0 */
396*a67afe4dSAndroid Build Coastguard Worker #    endif /* __GNUC__ >= 3 */
397*a67afe4dSAndroid Build Coastguard Worker 
398*a67afe4dSAndroid Build Coastguard Worker #  elif defined(_MSC_VER)  && (_MSC_VER >= 1300)
399*a67afe4dSAndroid Build Coastguard Worker #    ifndef PNG_USE_RESULT
400*a67afe4dSAndroid Build Coastguard Worker #      define PNG_USE_RESULT /* not supported */
401*a67afe4dSAndroid Build Coastguard Worker #    endif
402*a67afe4dSAndroid Build Coastguard Worker #    ifndef PNG_NORETURN
403*a67afe4dSAndroid Build Coastguard Worker #      define PNG_NORETURN   __declspec(noreturn)
404*a67afe4dSAndroid Build Coastguard Worker #    endif
405*a67afe4dSAndroid Build Coastguard Worker #    ifndef PNG_ALLOCATED
406*a67afe4dSAndroid Build Coastguard Worker #      if (_MSC_VER >= 1400)
407*a67afe4dSAndroid Build Coastguard Worker #        define PNG_ALLOCATED __declspec(restrict)
408*a67afe4dSAndroid Build Coastguard Worker #      endif
409*a67afe4dSAndroid Build Coastguard Worker #    endif
410*a67afe4dSAndroid Build Coastguard Worker #    ifndef PNG_DEPRECATED
411*a67afe4dSAndroid Build Coastguard Worker #      define PNG_DEPRECATED __declspec(deprecated)
412*a67afe4dSAndroid Build Coastguard Worker #    endif
413*a67afe4dSAndroid Build Coastguard Worker #    ifndef PNG_PRIVATE
414*a67afe4dSAndroid Build Coastguard Worker #      define PNG_PRIVATE __declspec(deprecated)
415*a67afe4dSAndroid Build Coastguard Worker #    endif
416*a67afe4dSAndroid Build Coastguard Worker #    ifndef PNG_RESTRICT
417*a67afe4dSAndroid Build Coastguard Worker #      if (_MSC_VER >= 1400)
418*a67afe4dSAndroid Build Coastguard Worker #        define PNG_RESTRICT __restrict
419*a67afe4dSAndroid Build Coastguard Worker #      endif
420*a67afe4dSAndroid Build Coastguard Worker #    endif
421*a67afe4dSAndroid Build Coastguard Worker 
422*a67afe4dSAndroid Build Coastguard Worker #  elif defined(__WATCOMC__)
423*a67afe4dSAndroid Build Coastguard Worker #    ifndef PNG_RESTRICT
424*a67afe4dSAndroid Build Coastguard Worker #      define PNG_RESTRICT __restrict
425*a67afe4dSAndroid Build Coastguard Worker #    endif
426*a67afe4dSAndroid Build Coastguard Worker #  endif
427*a67afe4dSAndroid Build Coastguard Worker #endif /* PNG_PEDANTIC_WARNINGS */
428*a67afe4dSAndroid Build Coastguard Worker 
429*a67afe4dSAndroid Build Coastguard Worker #ifndef PNG_DEPRECATED
430*a67afe4dSAndroid Build Coastguard Worker #  define PNG_DEPRECATED  /* Use of this function is deprecated */
431*a67afe4dSAndroid Build Coastguard Worker #endif
432*a67afe4dSAndroid Build Coastguard Worker #ifndef PNG_USE_RESULT
433*a67afe4dSAndroid Build Coastguard Worker #  define PNG_USE_RESULT  /* The result of this function must be checked */
434*a67afe4dSAndroid Build Coastguard Worker #endif
435*a67afe4dSAndroid Build Coastguard Worker #ifndef PNG_NORETURN
436*a67afe4dSAndroid Build Coastguard Worker #  define PNG_NORETURN    /* This function does not return */
437*a67afe4dSAndroid Build Coastguard Worker #endif
438*a67afe4dSAndroid Build Coastguard Worker #ifndef PNG_ALLOCATED
439*a67afe4dSAndroid Build Coastguard Worker #  define PNG_ALLOCATED   /* The result of the function is new memory */
440*a67afe4dSAndroid Build Coastguard Worker #endif
441*a67afe4dSAndroid Build Coastguard Worker #ifndef PNG_PRIVATE
442*a67afe4dSAndroid Build Coastguard Worker #  define PNG_PRIVATE     /* This is a private libpng function */
443*a67afe4dSAndroid Build Coastguard Worker #endif
444*a67afe4dSAndroid Build Coastguard Worker #ifndef PNG_RESTRICT
445*a67afe4dSAndroid Build Coastguard Worker #  define PNG_RESTRICT    /* The C99 "restrict" feature */
446*a67afe4dSAndroid Build Coastguard Worker #endif
447*a67afe4dSAndroid Build Coastguard Worker 
448*a67afe4dSAndroid Build Coastguard Worker #ifndef PNG_FP_EXPORT     /* A floating point API. */
449*a67afe4dSAndroid Build Coastguard Worker #  ifdef PNG_FLOATING_POINT_SUPPORTED
450*a67afe4dSAndroid Build Coastguard Worker #     define PNG_FP_EXPORT(ordinal, type, name, args)\
451*a67afe4dSAndroid Build Coastguard Worker          PNG_EXPORT(ordinal, type, name, args);
452*a67afe4dSAndroid Build Coastguard Worker #  else                   /* No floating point APIs */
453*a67afe4dSAndroid Build Coastguard Worker #     define PNG_FP_EXPORT(ordinal, type, name, args)
454*a67afe4dSAndroid Build Coastguard Worker #  endif
455*a67afe4dSAndroid Build Coastguard Worker #endif
456*a67afe4dSAndroid Build Coastguard Worker #ifndef PNG_FIXED_EXPORT  /* A fixed point API. */
457*a67afe4dSAndroid Build Coastguard Worker #  ifdef PNG_FIXED_POINT_SUPPORTED
458*a67afe4dSAndroid Build Coastguard Worker #     define PNG_FIXED_EXPORT(ordinal, type, name, args)\
459*a67afe4dSAndroid Build Coastguard Worker          PNG_EXPORT(ordinal, type, name, args);
460*a67afe4dSAndroid Build Coastguard Worker #  else                   /* No fixed point APIs */
461*a67afe4dSAndroid Build Coastguard Worker #     define PNG_FIXED_EXPORT(ordinal, type, name, args)
462*a67afe4dSAndroid Build Coastguard Worker #  endif
463*a67afe4dSAndroid Build Coastguard Worker #endif
464*a67afe4dSAndroid Build Coastguard Worker 
465*a67afe4dSAndroid Build Coastguard Worker #ifndef PNG_BUILDING_SYMBOL_TABLE
466*a67afe4dSAndroid Build Coastguard Worker /* Some typedefs to get us started.  These should be safe on most of the common
467*a67afe4dSAndroid Build Coastguard Worker  * platforms.
468*a67afe4dSAndroid Build Coastguard Worker  *
469*a67afe4dSAndroid Build Coastguard Worker  * png_uint_32 and png_int_32 may, currently, be larger than required to hold a
470*a67afe4dSAndroid Build Coastguard Worker  * 32-bit value however this is not normally advisable.
471*a67afe4dSAndroid Build Coastguard Worker  *
472*a67afe4dSAndroid Build Coastguard Worker  * png_uint_16 and png_int_16 should always be two bytes in size - this is
473*a67afe4dSAndroid Build Coastguard Worker  * verified at library build time.
474*a67afe4dSAndroid Build Coastguard Worker  *
475*a67afe4dSAndroid Build Coastguard Worker  * png_byte must always be one byte in size.
476*a67afe4dSAndroid Build Coastguard Worker  *
477*a67afe4dSAndroid Build Coastguard Worker  * The checks below use constants from limits.h, as defined by the ISOC90
478*a67afe4dSAndroid Build Coastguard Worker  * standard.
479*a67afe4dSAndroid Build Coastguard Worker  */
480*a67afe4dSAndroid Build Coastguard Worker #if CHAR_BIT == 8 && UCHAR_MAX == 255
481*a67afe4dSAndroid Build Coastguard Worker    typedef unsigned char png_byte;
482*a67afe4dSAndroid Build Coastguard Worker #else
483*a67afe4dSAndroid Build Coastguard Worker #  error "libpng requires 8-bit bytes"
484*a67afe4dSAndroid Build Coastguard Worker #endif
485*a67afe4dSAndroid Build Coastguard Worker 
486*a67afe4dSAndroid Build Coastguard Worker #if INT_MIN == -32768 && INT_MAX == 32767
487*a67afe4dSAndroid Build Coastguard Worker    typedef int png_int_16;
488*a67afe4dSAndroid Build Coastguard Worker #elif SHRT_MIN == -32768 && SHRT_MAX == 32767
489*a67afe4dSAndroid Build Coastguard Worker    typedef short png_int_16;
490*a67afe4dSAndroid Build Coastguard Worker #else
491*a67afe4dSAndroid Build Coastguard Worker #  error "libpng requires a signed 16-bit type"
492*a67afe4dSAndroid Build Coastguard Worker #endif
493*a67afe4dSAndroid Build Coastguard Worker 
494*a67afe4dSAndroid Build Coastguard Worker #if UINT_MAX == 65535
495*a67afe4dSAndroid Build Coastguard Worker    typedef unsigned int png_uint_16;
496*a67afe4dSAndroid Build Coastguard Worker #elif USHRT_MAX == 65535
497*a67afe4dSAndroid Build Coastguard Worker    typedef unsigned short png_uint_16;
498*a67afe4dSAndroid Build Coastguard Worker #else
499*a67afe4dSAndroid Build Coastguard Worker #  error "libpng requires an unsigned 16-bit type"
500*a67afe4dSAndroid Build Coastguard Worker #endif
501*a67afe4dSAndroid Build Coastguard Worker 
502*a67afe4dSAndroid Build Coastguard Worker #if INT_MIN < -2147483646 && INT_MAX > 2147483646
503*a67afe4dSAndroid Build Coastguard Worker    typedef int png_int_32;
504*a67afe4dSAndroid Build Coastguard Worker #elif LONG_MIN < -2147483646 && LONG_MAX > 2147483646
505*a67afe4dSAndroid Build Coastguard Worker    typedef long int png_int_32;
506*a67afe4dSAndroid Build Coastguard Worker #else
507*a67afe4dSAndroid Build Coastguard Worker #  error "libpng requires a signed 32-bit (or more) type"
508*a67afe4dSAndroid Build Coastguard Worker #endif
509*a67afe4dSAndroid Build Coastguard Worker 
510*a67afe4dSAndroid Build Coastguard Worker #if UINT_MAX > 4294967294U
511*a67afe4dSAndroid Build Coastguard Worker    typedef unsigned int png_uint_32;
512*a67afe4dSAndroid Build Coastguard Worker #elif ULONG_MAX > 4294967294U
513*a67afe4dSAndroid Build Coastguard Worker    typedef unsigned long int png_uint_32;
514*a67afe4dSAndroid Build Coastguard Worker #else
515*a67afe4dSAndroid Build Coastguard Worker #  error "libpng requires an unsigned 32-bit (or more) type"
516*a67afe4dSAndroid Build Coastguard Worker #endif
517*a67afe4dSAndroid Build Coastguard Worker 
518*a67afe4dSAndroid Build Coastguard Worker /* Prior to 1.6.0, it was possible to disable the use of size_t and ptrdiff_t.
519*a67afe4dSAndroid Build Coastguard Worker  * From 1.6.0 onwards, an ISO C90 compiler, as well as a standard-compliant
520*a67afe4dSAndroid Build Coastguard Worker  * behavior of sizeof and ptrdiff_t are required.
521*a67afe4dSAndroid Build Coastguard Worker  * The legacy typedefs are provided here for backwards compatibility.
522*a67afe4dSAndroid Build Coastguard Worker  */
523*a67afe4dSAndroid Build Coastguard Worker typedef size_t png_size_t;
524*a67afe4dSAndroid Build Coastguard Worker typedef ptrdiff_t png_ptrdiff_t;
525*a67afe4dSAndroid Build Coastguard Worker 
526*a67afe4dSAndroid Build Coastguard Worker /* libpng needs to know the maximum value of 'size_t' and this controls the
527*a67afe4dSAndroid Build Coastguard Worker  * definition of png_alloc_size_t, below.  This maximum value of size_t limits
528*a67afe4dSAndroid Build Coastguard Worker  * but does not control the maximum allocations the library makes - there is
529*a67afe4dSAndroid Build Coastguard Worker  * direct application control of this through png_set_user_limits().
530*a67afe4dSAndroid Build Coastguard Worker  */
531*a67afe4dSAndroid Build Coastguard Worker #ifndef PNG_SMALL_SIZE_T
532*a67afe4dSAndroid Build Coastguard Worker    /* Compiler specific tests for systems where size_t is known to be less than
533*a67afe4dSAndroid Build Coastguard Worker     * 32 bits (some of these systems may no longer work because of the lack of
534*a67afe4dSAndroid Build Coastguard Worker     * 'far' support; see above.)
535*a67afe4dSAndroid Build Coastguard Worker     */
536*a67afe4dSAndroid Build Coastguard Worker #  if (defined(__TURBOC__) && !defined(__FLAT__)) ||\
537*a67afe4dSAndroid Build Coastguard Worker    (defined(_MSC_VER) && defined(MAXSEG_64K))
538*a67afe4dSAndroid Build Coastguard Worker #     define PNG_SMALL_SIZE_T
539*a67afe4dSAndroid Build Coastguard Worker #  endif
540*a67afe4dSAndroid Build Coastguard Worker #endif
541*a67afe4dSAndroid Build Coastguard Worker 
542*a67afe4dSAndroid Build Coastguard Worker /* png_alloc_size_t is guaranteed to be no smaller than size_t, and no smaller
543*a67afe4dSAndroid Build Coastguard Worker  * than png_uint_32.  Casts from size_t or png_uint_32 to png_alloc_size_t are
544*a67afe4dSAndroid Build Coastguard Worker  * not necessary; in fact, it is recommended not to use them at all, so that
545*a67afe4dSAndroid Build Coastguard Worker  * the compiler can complain when something turns out to be problematic.
546*a67afe4dSAndroid Build Coastguard Worker  *
547*a67afe4dSAndroid Build Coastguard Worker  * Casts in the other direction (from png_alloc_size_t to size_t or
548*a67afe4dSAndroid Build Coastguard Worker  * png_uint_32) should be explicitly applied; however, we do not expect to
549*a67afe4dSAndroid Build Coastguard Worker  * encounter practical situations that require such conversions.
550*a67afe4dSAndroid Build Coastguard Worker  *
551*a67afe4dSAndroid Build Coastguard Worker  * PNG_SMALL_SIZE_T must be defined if the maximum value of size_t is less than
552*a67afe4dSAndroid Build Coastguard Worker  * 4294967295 - i.e. less than the maximum value of png_uint_32.
553*a67afe4dSAndroid Build Coastguard Worker  */
554*a67afe4dSAndroid Build Coastguard Worker #ifdef PNG_SMALL_SIZE_T
555*a67afe4dSAndroid Build Coastguard Worker    typedef png_uint_32 png_alloc_size_t;
556*a67afe4dSAndroid Build Coastguard Worker #else
557*a67afe4dSAndroid Build Coastguard Worker    typedef size_t png_alloc_size_t;
558*a67afe4dSAndroid Build Coastguard Worker #endif
559*a67afe4dSAndroid Build Coastguard Worker 
560*a67afe4dSAndroid Build Coastguard Worker /* Prior to 1.6.0 libpng offered limited support for Microsoft C compiler
561*a67afe4dSAndroid Build Coastguard Worker  * implementations of Intel CPU specific support of user-mode segmented address
562*a67afe4dSAndroid Build Coastguard Worker  * spaces, where 16-bit pointers address more than 65536 bytes of memory using
563*a67afe4dSAndroid Build Coastguard Worker  * separate 'segment' registers.  The implementation requires two different
564*a67afe4dSAndroid Build Coastguard Worker  * types of pointer (only one of which includes the segment value.)
565*a67afe4dSAndroid Build Coastguard Worker  *
566*a67afe4dSAndroid Build Coastguard Worker  * If required this support is available in version 1.2 of libpng and may be
567*a67afe4dSAndroid Build Coastguard Worker  * available in versions through 1.5, although the correctness of the code has
568*a67afe4dSAndroid Build Coastguard Worker  * not been verified recently.
569*a67afe4dSAndroid Build Coastguard Worker  */
570*a67afe4dSAndroid Build Coastguard Worker 
571*a67afe4dSAndroid Build Coastguard Worker /* Typedef for floating-point numbers that are converted to fixed-point with a
572*a67afe4dSAndroid Build Coastguard Worker  * multiple of 100,000, e.g., gamma
573*a67afe4dSAndroid Build Coastguard Worker  */
574*a67afe4dSAndroid Build Coastguard Worker typedef png_int_32 png_fixed_point;
575*a67afe4dSAndroid Build Coastguard Worker 
576*a67afe4dSAndroid Build Coastguard Worker /* Add typedefs for pointers */
577*a67afe4dSAndroid Build Coastguard Worker typedef void                  * png_voidp;
578*a67afe4dSAndroid Build Coastguard Worker typedef const void            * png_const_voidp;
579*a67afe4dSAndroid Build Coastguard Worker typedef png_byte              * png_bytep;
580*a67afe4dSAndroid Build Coastguard Worker typedef const png_byte        * png_const_bytep;
581*a67afe4dSAndroid Build Coastguard Worker typedef png_uint_32           * png_uint_32p;
582*a67afe4dSAndroid Build Coastguard Worker typedef const png_uint_32     * png_const_uint_32p;
583*a67afe4dSAndroid Build Coastguard Worker typedef png_int_32            * png_int_32p;
584*a67afe4dSAndroid Build Coastguard Worker typedef const png_int_32      * png_const_int_32p;
585*a67afe4dSAndroid Build Coastguard Worker typedef png_uint_16           * png_uint_16p;
586*a67afe4dSAndroid Build Coastguard Worker typedef const png_uint_16     * png_const_uint_16p;
587*a67afe4dSAndroid Build Coastguard Worker typedef png_int_16            * png_int_16p;
588*a67afe4dSAndroid Build Coastguard Worker typedef const png_int_16      * png_const_int_16p;
589*a67afe4dSAndroid Build Coastguard Worker typedef char                  * png_charp;
590*a67afe4dSAndroid Build Coastguard Worker typedef const char            * png_const_charp;
591*a67afe4dSAndroid Build Coastguard Worker typedef png_fixed_point       * png_fixed_point_p;
592*a67afe4dSAndroid Build Coastguard Worker typedef const png_fixed_point * png_const_fixed_point_p;
593*a67afe4dSAndroid Build Coastguard Worker typedef size_t                * png_size_tp;
594*a67afe4dSAndroid Build Coastguard Worker typedef const size_t          * png_const_size_tp;
595*a67afe4dSAndroid Build Coastguard Worker 
596*a67afe4dSAndroid Build Coastguard Worker #ifdef PNG_STDIO_SUPPORTED
597*a67afe4dSAndroid Build Coastguard Worker typedef FILE            * png_FILE_p;
598*a67afe4dSAndroid Build Coastguard Worker #endif
599*a67afe4dSAndroid Build Coastguard Worker 
600*a67afe4dSAndroid Build Coastguard Worker #ifdef PNG_FLOATING_POINT_SUPPORTED
601*a67afe4dSAndroid Build Coastguard Worker typedef double       * png_doublep;
602*a67afe4dSAndroid Build Coastguard Worker typedef const double * png_const_doublep;
603*a67afe4dSAndroid Build Coastguard Worker #endif
604*a67afe4dSAndroid Build Coastguard Worker 
605*a67afe4dSAndroid Build Coastguard Worker /* Pointers to pointers; i.e. arrays */
606*a67afe4dSAndroid Build Coastguard Worker typedef png_byte        * * png_bytepp;
607*a67afe4dSAndroid Build Coastguard Worker typedef png_uint_32     * * png_uint_32pp;
608*a67afe4dSAndroid Build Coastguard Worker typedef png_int_32      * * png_int_32pp;
609*a67afe4dSAndroid Build Coastguard Worker typedef png_uint_16     * * png_uint_16pp;
610*a67afe4dSAndroid Build Coastguard Worker typedef png_int_16      * * png_int_16pp;
611*a67afe4dSAndroid Build Coastguard Worker typedef const char      * * png_const_charpp;
612*a67afe4dSAndroid Build Coastguard Worker typedef char            * * png_charpp;
613*a67afe4dSAndroid Build Coastguard Worker typedef png_fixed_point * * png_fixed_point_pp;
614*a67afe4dSAndroid Build Coastguard Worker #ifdef PNG_FLOATING_POINT_SUPPORTED
615*a67afe4dSAndroid Build Coastguard Worker typedef double          * * png_doublepp;
616*a67afe4dSAndroid Build Coastguard Worker #endif
617*a67afe4dSAndroid Build Coastguard Worker 
618*a67afe4dSAndroid Build Coastguard Worker /* Pointers to pointers to pointers; i.e., pointer to array */
619*a67afe4dSAndroid Build Coastguard Worker typedef char            * * * png_charppp;
620*a67afe4dSAndroid Build Coastguard Worker 
621*a67afe4dSAndroid Build Coastguard Worker #endif /* PNG_BUILDING_SYMBOL_TABLE */
622*a67afe4dSAndroid Build Coastguard Worker 
623*a67afe4dSAndroid Build Coastguard Worker #endif /* PNGCONF_H */
624