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