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