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