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