]> git.jsancho.org Git - lugaru.git/blob - Dependencies/libpng/pngconf.h
CMake: Purge all the bundled dependencies
[lugaru.git] / Dependencies / libpng / pngconf.h
1
2 /* pngconf.h - machine configurable file for libpng
3  *
4  * libpng version 1.4.1 - February 25, 2010
5  * For conditions of distribution and use, see copyright notice in png.h
6  * Copyright (c) 1998-2010 Glenn Randers-Pehrson
7  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
8  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
9  *
10  * This code is released under the libpng license.
11  * For conditions of distribution and use, see the disclaimer
12  * and license in png.h
13  *
14  */
15
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
18  * starting here down to where it starts to typedef png_color, png_text,
19  * and png_info.
20  */
21
22 #ifndef PNGCONF_H
23 #define PNGCONF_H
24
25 #ifndef PNG_NO_LIMITS_H
26 #  include <limits.h>
27 #endif
28
29 /* Added at libpng-1.2.9 */
30
31 /* config.h is created by and PNG_CONFIGURE_LIBPNG is set by the "configure"
32  * script.
33  */
34 #ifdef PNG_CONFIGURE_LIBPNG
35 #  ifdef HAVE_CONFIG_H
36 #    include "config.h"
37 #  endif
38 #endif
39
40 /*
41  * Added at libpng-1.2.8
42  *
43  * PNG_USER_CONFIG has to be defined on the compiler command line. This
44  * includes the resource compiler for Windows DLL configurations.
45  */
46 #ifdef PNG_USER_CONFIG
47 #  ifndef PNG_USER_PRIVATEBUILD
48 #    define PNG_USER_PRIVATEBUILD
49 #  endif
50 #  include "pngusr.h"
51 #endif
52
53 /*
54  * If you create a private DLL you need to define in "pngusr.h" the followings:
55  * #define PNG_USER_PRIVATEBUILD <Describes by whom and why this version of
56  *        the DLL was built>
57  *  e.g. #define PNG_USER_PRIVATEBUILD "Build by MyCompany for xyz reasons."
58  * #define PNG_USER_DLLFNAME_POSTFIX <two-letter postfix that serve to
59  *        distinguish your DLL from those of the official release. These
60  *        correspond to the trailing letters that come after the version
61  *        number and must match your private DLL name>
62  *  e.g. // private DLL "libpng13gx.dll"
63  *       #define PNG_USER_DLLFNAME_POSTFIX "gx"
64  *
65  * The following macros are also at your disposal if you want to complete the
66  * DLL VERSIONINFO structure.
67  * - PNG_USER_VERSIONINFO_COMMENTS
68  * - PNG_USER_VERSIONINFO_COMPANYNAME
69  * - PNG_USER_VERSIONINFO_LEGALTRADEMARKS
70  */
71
72 #ifdef __STDC__
73 #  ifdef SPECIALBUILD
74 #    pragma message("PNG_LIBPNG_SPECIALBUILD (and deprecated SPECIALBUILD)\
75      are now LIBPNG reserved macros. Use PNG_USER_PRIVATEBUILD instead.")
76 #  endif
77
78 #  ifdef PRIVATEBUILD
79 #    pragma message("PRIVATEBUILD is deprecated.\
80      Use PNG_USER_PRIVATEBUILD instead.")
81 #    define PNG_USER_PRIVATEBUILD PRIVATEBUILD
82 #  endif
83 #endif /* __STDC__ */
84
85 /* End of material added to libpng-1.2.8 */
86
87 #ifndef PNG_VERSION_INFO_ONLY
88
89 /* This is the size of the compression buffer, and thus the size of
90  * an IDAT chunk.  Make this whatever size you feel is best for your
91  * machine.  One of these will be allocated per png_struct.  When this
92  * is full, it writes the data to the disk, and does some other
93  * calculations.  Making this an extremely small size will slow
94  * the library down, but you may want to experiment to determine
95  * where it becomes significant, if you are concerned with memory
96  * usage.  Note that zlib allocates at least 32Kb also.  For readers,
97  * this describes the size of the buffer available to read the data in.
98  * Unless this gets smaller than the size of a row (compressed),
99  * it should not make much difference how big this is.
100  */
101
102 #ifndef PNG_ZBUF_SIZE
103 #  define PNG_ZBUF_SIZE 8192
104 #endif
105
106 /* Enable if you want a write-only libpng */
107
108 #ifndef PNG_NO_READ_SUPPORTED
109 #  define PNG_READ_SUPPORTED
110 #endif
111
112 /* Enable if you want a read-only libpng */
113
114 #ifndef PNG_NO_WRITE_SUPPORTED
115 #  define PNG_WRITE_SUPPORTED
116 #endif
117
118 /* Enabled in 1.4.0. */
119 #ifdef PNG_ALLOW_BENIGN_ERRORS
120 #  define png_benign_error png_warning
121 #  define png_chunk_benign_error png_chunk_warning
122 #else
123 #  ifndef PNG_BENIGN_ERRORS_SUPPORTED
124 #    define png_benign_error png_error
125 #    define png_chunk_benign_error png_chunk_error
126 #  endif
127 #endif
128
129 /* Added at libpng version 1.4.0 */
130 #if !defined(PNG_NO_WARNINGS) && !defined(PNG_WARNINGS_SUPPORTED)
131 #  define PNG_WARNINGS_SUPPORTED
132 #endif
133
134 /* Added at libpng version 1.4.0 */
135 #if !defined(PNG_NO_ERROR_TEXT) && !defined(PNG_ERROR_TEXT_SUPPORTED)
136 #  define PNG_ERROR_TEXT_SUPPORTED
137 #endif
138
139 /* Added at libpng version 1.4.0 */
140 #if !defined(PNG_NO_CHECK_cHRM) && !defined(PNG_CHECK_cHRM_SUPPORTED)
141 #  define PNG_CHECK_cHRM_SUPPORTED
142 #endif
143
144 /* Added at libpng version 1.4.0 */
145 #if !defined(PNG_NO_ALIGNED_MEMORY) && !defined(PNG_ALIGNED_MEMORY_SUPPORTED)
146 #  define PNG_ALIGNED_MEMORY_SUPPORTED
147 #endif
148
149 /* Enabled by default in 1.2.0.  You can disable this if you don't need to
150    support PNGs that are embedded in MNG datastreams */
151 #ifndef PNG_NO_MNG_FEATURES
152 #  ifndef PNG_MNG_FEATURES_SUPPORTED
153 #    define PNG_MNG_FEATURES_SUPPORTED
154 #  endif
155 #endif
156
157 /* Added at libpng version 1.4.0 */
158 #ifndef PNG_NO_FLOATING_POINT_SUPPORTED
159 #  ifndef PNG_FLOATING_POINT_SUPPORTED
160 #    define PNG_FLOATING_POINT_SUPPORTED
161 #  endif
162 #endif
163
164 /* Added at libpng-1.4.0beta49 for testing (this test is no longer used
165    in libpng and png_calloc() is always present)
166  */
167 #define PNG_CALLOC_SUPPORTED
168
169 /* If you are running on a machine where you cannot allocate more
170  * than 64K of memory at once, uncomment this.  While libpng will not
171  * normally need that much memory in a chunk (unless you load up a very
172  * large file), zlib needs to know how big of a chunk it can use, and
173  * libpng thus makes sure to check any memory allocation to verify it
174  * will fit into memory.
175 #define PNG_MAX_MALLOC_64K
176  */
177 #if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K)
178 #  define PNG_MAX_MALLOC_64K
179 #endif
180
181 /* Special munging to support doing things the 'cygwin' way:
182  * 'Normal' png-on-win32 defines/defaults:
183  *   PNG_BUILD_DLL -- building dll
184  *   PNG_USE_DLL   -- building an application, linking to dll
185  *   (no define)   -- building static library, or building an
186  *                    application and linking to the static lib
187  * 'Cygwin' defines/defaults:
188  *   PNG_BUILD_DLL -- (ignored) building the dll
189  *   (no define)   -- (ignored) building an application, linking to the dll
190  *   PNG_STATIC    -- (ignored) building the static lib, or building an
191  *                    application that links to the static lib.
192  *   ALL_STATIC    -- (ignored) building various static libs, or building an
193  *                    application that links to the static libs.
194  * Thus,
195  * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and
196  * this bit of #ifdefs will define the 'correct' config variables based on
197  * that. If a cygwin user *wants* to define 'PNG_USE_DLL' that's okay, but
198  * unnecessary.
199  *
200  * Also, the precedence order is:
201  *   ALL_STATIC (since we can't #undef something outside our namespace)
202  *   PNG_BUILD_DLL
203  *   PNG_STATIC
204  *   (nothing) == PNG_USE_DLL
205  *
206  * CYGWIN (2002-01-20): The preceding is now obsolete. With the advent
207  *   of auto-import in binutils, we no longer need to worry about
208  *   __declspec(dllexport) / __declspec(dllimport) and friends.  Therefore,
209  *   we don't need to worry about PNG_STATIC or ALL_STATIC when it comes
210  *   to __declspec() stuff.  However, we DO need to worry about
211  *   PNG_BUILD_DLL and PNG_STATIC because those change some defaults
212  *   such as CONSOLE_IO.
213  */
214 #ifdef __CYGWIN__
215 #  ifdef ALL_STATIC
216 #    ifdef PNG_BUILD_DLL
217 #      undef PNG_BUILD_DLL
218 #    endif
219 #    ifdef PNG_USE_DLL
220 #      undef PNG_USE_DLL
221 #    endif
222 #    ifdef PNG_DLL
223 #      undef PNG_DLL
224 #    endif
225 #    ifndef PNG_STATIC
226 #      define PNG_STATIC
227 #    endif
228 #  else
229 #    ifdef PNG_BUILD_DLL
230 #      ifdef PNG_STATIC
231 #        undef PNG_STATIC
232 #      endif
233 #      ifdef PNG_USE_DLL
234 #        undef PNG_USE_DLL
235 #      endif
236 #      ifndef PNG_DLL
237 #        define PNG_DLL
238 #      endif
239 #    else
240 #      ifdef PNG_STATIC
241 #        ifdef PNG_USE_DLL
242 #          undef PNG_USE_DLL
243 #        endif
244 #        ifdef PNG_DLL
245 #          undef PNG_DLL
246 #        endif
247 #      else
248 #        ifndef PNG_USE_DLL
249 #          define PNG_USE_DLL
250 #        endif
251 #        ifndef PNG_DLL
252 #          define PNG_DLL
253 #        endif
254 #      endif
255 #    endif
256 #  endif
257 #endif
258
259 /* This protects us against compilers that run on a windowing system
260  * and thus don't have or would rather us not use the stdio types:
261  * stdin, stdout, and stderr.  The only one currently used is stderr
262  * in png_error() and png_warning().  #defining PNG_NO_CONSOLE_IO will
263  * prevent these from being compiled and used. #defining PNG_NO_STDIO
264  * will also prevent these, plus will prevent the entire set of stdio
265  * macros and functions (FILE *, printf, etc.) from being compiled and used,
266  * unless (PNG_DEBUG > 0) has been #defined.
267  *
268  * #define PNG_NO_CONSOLE_IO
269  * #define PNG_NO_STDIO
270  */
271
272 #if !defined(PNG_NO_STDIO) && !defined(PNG_STDIO_SUPPORTED)
273 #  define PNG_STDIO_SUPPORTED
274 #endif
275
276
277 #ifdef PNG_BUILD_DLL
278 #  if !defined(PNG_CONSOLE_IO_SUPPORTED) && !defined(PNG_NO_CONSOLE_IO)
279 #    define PNG_NO_CONSOLE_IO
280 #  endif
281 #endif
282
283 #  ifdef PNG_NO_STDIO
284 #    ifndef PNG_NO_CONSOLE_IO
285 #      define PNG_NO_CONSOLE_IO
286 #    endif
287 #    ifdef PNG_DEBUG
288 #      if (PNG_DEBUG > 0)
289 #        include <stdio.h>
290 #      endif
291 #    endif
292 #  else
293 #    include <stdio.h>
294 #  endif
295
296 #if !(defined PNG_NO_CONSOLE_IO) && !defined(PNG_CONSOLE_IO_SUPPORTED)
297 #  define PNG_CONSOLE_IO_SUPPORTED
298 #endif
299
300 /* This macro protects us against machines that don't have function
301  * prototypes (ie K&R style headers).  If your compiler does not handle
302  * function prototypes, define this macro and use the included ansi2knr.
303  * I've always been able to use _NO_PROTO as the indicator, but you may
304  * need to drag the empty declaration out in front of here, or change the
305  * ifdef to suit your own needs.
306  */
307 #ifndef PNGARG
308
309 #ifdef OF /* zlib prototype munger */
310 #  define PNGARG(arglist) OF(arglist)
311 #else
312
313 #ifdef _NO_PROTO
314 #  define PNGARG(arglist) ()
315 #else
316 #  define PNGARG(arglist) arglist
317 #endif /* _NO_PROTO */
318
319 #endif /* OF */
320
321 #endif /* PNGARG */
322
323 /* Try to determine if we are compiling on a Mac.  Note that testing for
324  * just __MWERKS__ is not good enough, because the Codewarrior is now used
325  * on non-Mac platforms.
326  */
327 #ifndef MACOS
328 #  if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
329       defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
330 #    define MACOS
331 #  endif
332 #endif
333
334 /* Enough people need this for various reasons to include it here */
335 #if !defined(MACOS) && !defined(RISCOS)
336 #  include <sys/types.h>
337 #endif
338
339 /* PNG_SETJMP_NOT_SUPPORTED and PNG_NO_SETJMP_SUPPORTED are deprecated. */
340 #if !defined(PNG_NO_SETJMP) && \
341     !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED)
342 #  define PNG_SETJMP_SUPPORTED
343 #endif
344
345 #ifdef PNG_SETJMP_SUPPORTED
346 /* This is an attempt to force a single setjmp behaviour on Linux.  If
347  * the X config stuff didn't define _BSD_SOURCE we wouldn't need this.
348  *
349  * You can bypass this test if you know that your application uses exactly
350  * the same setjmp.h that was included when libpng was built.  Only define
351  * PNG_SKIP_SETJMP_CHECK while building your application, prior to the
352  * application's '#include "png.h"'. Don't define PNG_SKIP_SETJMP_CHECK
353  * while building a separate libpng library for general use.
354  */
355
356 #  ifndef PNG_SKIP_SETJMP_CHECK
357 #    ifdef __linux__
358 #      ifdef _BSD_SOURCE
359 #        define PNG_SAVE_BSD_SOURCE
360 #        undef _BSD_SOURCE
361 #      endif
362 #      ifdef _SETJMP_H
363        /* If you encounter a compiler error here, see the explanation
364         * near the end of INSTALL.
365         */
366            __pngconf.h__ in libpng already includes setjmp.h;
367            __dont__ include it again.;
368 #      endif
369 #    endif /* __linux__ */
370 #  endif /* PNG_SKIP_SETJMP_CHECK */
371
372    /* Include setjmp.h for error handling */
373 #  include <setjmp.h>
374
375 #  ifdef __linux__
376 #    ifdef PNG_SAVE_BSD_SOURCE
377 #      ifdef _BSD_SOURCE
378 #        undef _BSD_SOURCE
379 #      endif
380 #      define _BSD_SOURCE
381 #      undef PNG_SAVE_BSD_SOURCE
382 #    endif
383 #  endif /* __linux__ */
384 #endif /* PNG_SETJMP_SUPPORTED */
385
386 #ifdef BSD
387 #  include <strings.h>
388 #else
389 #  include <string.h>
390 #endif
391
392 /* Other defines for things like memory and the like can go here.  */
393
394 /* This controls how fine the dithering gets.  As this allocates
395  * a largish chunk of memory (32K), those who are not as concerned
396  * with dithering quality can decrease some or all of these.
397  */
398 #ifndef PNG_DITHER_RED_BITS
399 #  define PNG_DITHER_RED_BITS 5
400 #endif
401 #ifndef PNG_DITHER_GREEN_BITS
402 #  define PNG_DITHER_GREEN_BITS 5
403 #endif
404 #ifndef PNG_DITHER_BLUE_BITS
405 #  define PNG_DITHER_BLUE_BITS 5
406 #endif
407
408 /* This controls how fine the gamma correction becomes when you
409  * are only interested in 8 bits anyway.  Increasing this value
410  * results in more memory being used, and more pow() functions
411  * being called to fill in the gamma tables.  Don't set this value
412  * less then 8, and even that may not work (I haven't tested it).
413  */
414
415 #ifndef PNG_MAX_GAMMA_8
416 #  define PNG_MAX_GAMMA_8 11
417 #endif
418
419 /* This controls how much a difference in gamma we can tolerate before
420  * we actually start doing gamma conversion.
421  */
422 #ifndef PNG_GAMMA_THRESHOLD
423 #  define PNG_GAMMA_THRESHOLD 0.05
424 #endif
425
426 /* The following uses const char * instead of char * for error
427  * and warning message functions, so some compilers won't complain.
428  * If you do not want to use const, define PNG_NO_CONST here.
429  */
430
431 #ifndef PNG_CONST
432 #  ifndef PNG_NO_CONST
433 #    define PNG_CONST const
434 #  else
435 #    define PNG_CONST
436 #  endif
437 #endif
438
439 /* The following defines give you the ability to remove code from the
440  * library that you will not be using.  I wish I could figure out how to
441  * automate this, but I can't do that without making it seriously hard
442  * on the users.  So if you are not using an ability, change the #define
443  * to and #undef, and that part of the library will not be compiled.  If
444  * your linker can't find a function, you may want to make sure the
445  * ability is defined here.  Some of these depend upon some others being
446  * defined.  I haven't figured out all the interactions here, so you may
447  * have to experiment awhile to get everything to compile.  If you are
448  * creating or using a shared library, you probably shouldn't touch this,
449  * as it will affect the size of the structures, and this will cause bad
450  * things to happen if the library and/or application ever change.
451  */
452
453 /* Any features you will not be using can be undef'ed here */
454
455 /* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user
456  * to turn it off with PNG_NO_READ|WRITE_TRANSFORMS on the compile line,
457  * then pick and choose which ones to define without having to edit this
458  * file. It is safe to use the PNG_NO_READ|WRITE_TRANSFORMS
459  * if you only want to have a png-compliant reader/writer but don't need
460  * any of the extra transformations.  This saves about 80 kbytes in a
461  * typical installation of the library. (PNG_NO_* form added in version
462  * 1.0.1c, for consistency; PNG_*_TRANSFORMS_NOT_SUPPORTED deprecated in
463  * 1.4.0)
464  */
465
466 /* Ignore attempt to turn off both floating and fixed point support */
467 #if !defined(PNG_FLOATING_POINT_SUPPORTED) || \
468     !defined(PNG_NO_FIXED_POINT_SUPPORTED)
469 #  define PNG_FIXED_POINT_SUPPORTED
470 #endif
471
472 #ifdef PNG_READ_SUPPORTED
473
474 /* PNG_READ_TRANSFORMS_NOT_SUPPORTED is deprecated. */
475 #if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
476       !defined(PNG_NO_READ_TRANSFORMS)
477 #  define PNG_READ_TRANSFORMS_SUPPORTED
478 #endif
479
480 #ifdef PNG_READ_TRANSFORMS_SUPPORTED
481 #  ifndef PNG_NO_READ_EXPAND
482 #    define PNG_READ_EXPAND_SUPPORTED
483 #  endif
484 #  ifndef PNG_NO_READ_SHIFT
485 #    define PNG_READ_SHIFT_SUPPORTED
486 #  endif
487 #  ifndef PNG_NO_READ_PACK
488 #    define PNG_READ_PACK_SUPPORTED
489 #  endif
490 #  ifndef PNG_NO_READ_BGR
491 #    define PNG_READ_BGR_SUPPORTED
492 #  endif
493 #  ifndef PNG_NO_READ_SWAP
494 #    define PNG_READ_SWAP_SUPPORTED
495 #  endif
496 #  ifndef PNG_NO_READ_PACKSWAP
497 #    define PNG_READ_PACKSWAP_SUPPORTED
498 #  endif
499 #  ifndef PNG_NO_READ_INVERT
500 #    define PNG_READ_INVERT_SUPPORTED
501 #  endif
502 #if 0 /* removed from libpng-1.4.0 */
503 #  ifndef PNG_NO_READ_DITHER
504 #    define PNG_READ_DITHER_SUPPORTED
505 #  endif
506 #endif /* 0 */
507 #  ifndef PNG_NO_READ_BACKGROUND
508 #    define PNG_READ_BACKGROUND_SUPPORTED
509 #  endif
510 #  ifndef PNG_NO_READ_16_TO_8
511 #    define PNG_READ_16_TO_8_SUPPORTED
512 #  endif
513 #  ifndef PNG_NO_READ_FILLER
514 #    define PNG_READ_FILLER_SUPPORTED
515 #  endif
516 #  ifndef PNG_NO_READ_GAMMA
517 #    define PNG_READ_GAMMA_SUPPORTED
518 #  endif
519 #  ifndef PNG_NO_READ_GRAY_TO_RGB
520 #    define PNG_READ_GRAY_TO_RGB_SUPPORTED
521 #  endif
522 #  ifndef PNG_NO_READ_SWAP_ALPHA
523 #    define PNG_READ_SWAP_ALPHA_SUPPORTED
524 #  endif
525 #  ifndef PNG_NO_READ_INVERT_ALPHA
526 #    define PNG_READ_INVERT_ALPHA_SUPPORTED
527 #  endif
528 #  ifndef PNG_NO_READ_STRIP_ALPHA
529 #    define PNG_READ_STRIP_ALPHA_SUPPORTED
530 #  endif
531 #  ifndef PNG_NO_READ_USER_TRANSFORM
532 #    define PNG_READ_USER_TRANSFORM_SUPPORTED
533 #  endif
534 #  ifndef PNG_NO_READ_RGB_TO_GRAY
535 #    define PNG_READ_RGB_TO_GRAY_SUPPORTED
536 #  endif
537 #endif /* PNG_READ_TRANSFORMS_SUPPORTED */
538
539 /* PNG_PROGRESSIVE_READ_NOT_SUPPORTED is deprecated. */
540 #if !defined(PNG_NO_PROGRESSIVE_READ) && \
541  !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED)  /* if you don't do progressive */
542 #  define PNG_PROGRESSIVE_READ_SUPPORTED     /* reading.  This is not talking */
543 #endif                               /* about interlacing capability!  You'll */
544             /* still have interlacing unless you change the following define: */
545
546 #define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */
547
548 /* PNG_NO_SEQUENTIAL_READ_SUPPORTED is deprecated. */
549 #if !defined(PNG_NO_SEQUENTIAL_READ) && \
550     !defined(PNG_SEQUENTIAL_READ_SUPPORTED) && \
551     !defined(PNG_NO_SEQUENTIAL_READ_SUPPORTED)
552 #  define PNG_SEQUENTIAL_READ_SUPPORTED
553 #endif
554
555 #ifndef PNG_NO_READ_COMPOSITE_NODIV
556 #  ifndef PNG_NO_READ_COMPOSITED_NODIV  /* libpng-1.0.x misspelling */
557 #    define PNG_READ_COMPOSITE_NODIV_SUPPORTED   /* well tested on Intel, SGI */
558 #  endif
559 #endif
560
561 #if !defined(PNG_NO_GET_INT_32) || defined(PNG_READ_oFFS_SUPPORTED) || \
562     defined(PNG_READ_pCAL_SUPPORTED)
563 #  ifndef PNG_GET_INT_32_SUPPORTED
564 #    define PNG_GET_INT_32_SUPPORTED
565 #  endif
566 #endif
567
568 #endif /* PNG_READ_SUPPORTED */
569
570 #ifdef PNG_WRITE_SUPPORTED
571
572 /* PNG_WRITE_TRANSFORMS_NOT_SUPPORTED is deprecated. */
573 #if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
574     !defined(PNG_NO_WRITE_TRANSFORMS)
575 #  define PNG_WRITE_TRANSFORMS_SUPPORTED
576 #endif
577
578 #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
579 #  ifndef PNG_NO_WRITE_SHIFT
580 #    define PNG_WRITE_SHIFT_SUPPORTED
581 #  endif
582 #  ifndef PNG_NO_WRITE_PACK
583 #    define PNG_WRITE_PACK_SUPPORTED
584 #  endif
585 #  ifndef PNG_NO_WRITE_BGR
586 #    define PNG_WRITE_BGR_SUPPORTED
587 #  endif
588 #  ifndef PNG_NO_WRITE_SWAP
589 #    define PNG_WRITE_SWAP_SUPPORTED
590 #  endif
591 #  ifndef PNG_NO_WRITE_PACKSWAP
592 #    define PNG_WRITE_PACKSWAP_SUPPORTED
593 #  endif
594 #  ifndef PNG_NO_WRITE_INVERT
595 #    define PNG_WRITE_INVERT_SUPPORTED
596 #  endif
597 #  ifndef PNG_NO_WRITE_FILLER
598 #    define PNG_WRITE_FILLER_SUPPORTED   /* same as WRITE_STRIP_ALPHA */
599 #  endif
600 #  ifndef PNG_NO_WRITE_SWAP_ALPHA
601 #    define PNG_WRITE_SWAP_ALPHA_SUPPORTED
602 #  endif
603 #  ifndef PNG_NO_WRITE_INVERT_ALPHA
604 #    define PNG_WRITE_INVERT_ALPHA_SUPPORTED
605 #  endif
606 #  ifndef PNG_NO_WRITE_USER_TRANSFORM
607 #    define PNG_WRITE_USER_TRANSFORM_SUPPORTED
608 #  endif
609 #endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
610
611 #if !defined(PNG_NO_WRITE_INTERLACING_SUPPORTED) && \
612     !defined(PNG_WRITE_INTERLACING_SUPPORTED)
613     /* This is not required for PNG-compliant encoders, but can cause
614      * trouble if left undefined
615     */
616 #  define PNG_WRITE_INTERLACING_SUPPORTED
617 #endif
618
619 #if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \
620     !defined(PNG_WRITE_WEIGHTED_FILTER) && \
621      defined(PNG_FLOATING_POINT_SUPPORTED)
622 #  define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
623 #endif
624
625 #ifndef PNG_NO_WRITE_FLUSH
626 #  define PNG_WRITE_FLUSH_SUPPORTED
627 #endif
628
629 #if !defined(PNG_NO_SAVE_INT_32) || defined(PNG_WRITE_oFFS_SUPPORTED) || \
630     defined(PNG_WRITE_pCAL_SUPPORTED)
631 #  ifndef PNG_SAVE_INT_32_SUPPORTED
632 #    define PNG_SAVE_INT_32_SUPPORTED
633 #  endif
634 #endif
635
636 #endif /* PNG_WRITE_SUPPORTED */
637
638 #define PNG_NO_ERROR_NUMBERS
639
640 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
641     defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
642 #  ifndef PNG_NO_USER_TRANSFORM_PTR
643 #    define PNG_USER_TRANSFORM_PTR_SUPPORTED
644 #  endif
645 #endif
646
647 #if defined(PNG_STDIO_SUPPORTED) && !defined(PNG_TIME_RFC1123_SUPPORTED)
648 #  define PNG_TIME_RFC1123_SUPPORTED
649 #endif
650
651 /* This adds extra functions in pngget.c for accessing data from the
652  * info pointer (added in version 0.99)
653  * png_get_image_width()
654  * png_get_image_height()
655  * png_get_bit_depth()
656  * png_get_color_type()
657  * png_get_compression_type()
658  * png_get_filter_type()
659  * png_get_interlace_type()
660  * png_get_pixel_aspect_ratio()
661  * png_get_pixels_per_meter()
662  * png_get_x_offset_pixels()
663  * png_get_y_offset_pixels()
664  * png_get_x_offset_microns()
665  * png_get_y_offset_microns()
666  */
667 #if !defined(PNG_NO_EASY_ACCESS) && !defined(PNG_EASY_ACCESS_SUPPORTED)
668 #  define PNG_EASY_ACCESS_SUPPORTED
669 #endif
670
671 /* Added at libpng-1.2.0 */
672 #if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED)
673 #  define PNG_USER_MEM_SUPPORTED
674 #endif
675
676 /* Added at libpng-1.2.6 */
677 #ifndef PNG_NO_SET_USER_LIMITS
678 #  ifndef PNG_SET_USER_LIMITS_SUPPORTED
679 #    define PNG_SET_USER_LIMITS_SUPPORTED
680 #  endif
681   /* Feature added at libpng-1.4.0, this flag added at 1.4.1 */
682 #  ifndef PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED
683 #    define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED
684 #  endif
685   /* Feature added at libpng-1.4.1, this flag added at 1.4.1 */
686 #  ifndef PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
687 #    define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
688 #  endif
689 #endif
690
691 /* Added at libpng-1.2.43 */
692 #ifndef PNG_USER_LIMITS_SUPPORTED
693 #  ifndef PNG_NO_USER_LIMITS
694 #    define PNG_USER_LIMITS_SUPPORTED
695 #  endif
696 #endif
697
698 /* Added at libpng-1.0.16 and 1.2.6.  To accept all valid PNGs no matter
699  * how large, set these two limits to 0x7fffffffL
700  */
701 #ifndef PNG_USER_WIDTH_MAX
702 #  define PNG_USER_WIDTH_MAX 1000000L
703 #endif
704 #ifndef PNG_USER_HEIGHT_MAX
705 #  define PNG_USER_HEIGHT_MAX 1000000L
706 #endif
707
708 /* Added at libpng-1.2.43.  To accept all valid PNGs no matter
709  * how large, set these two limits to 0.
710  */
711 #ifndef PNG_USER_CHUNK_CACHE_MAX
712 #  define PNG_USER_CHUNK_CACHE_MAX 0
713 #endif
714
715 /* Added at libpng-1.2.43 */
716 #ifndef PNG_USER_CHUNK_MALLOC_MAX
717 #  define PNG_USER_CHUNK_MALLOC_MAX 0
718 #endif
719
720 /* Added at libpng-1.4.0 */
721 #if !defined(PNG_NO_IO_STATE) && !defined(PNG_IO_STATE_SUPPORTED)
722 #  define PNG_IO_STATE_SUPPORTED
723 #endif
724
725 #ifndef PNG_LITERAL_SHARP
726 #  define PNG_LITERAL_SHARP 0x23
727 #endif
728 #ifndef PNG_LITERAL_LEFT_SQUARE_BRACKET
729 #  define PNG_LITERAL_LEFT_SQUARE_BRACKET 0x5b
730 #endif
731 #ifndef PNG_LITERAL_RIGHT_SQUARE_BRACKET
732 #  define PNG_LITERAL_RIGHT_SQUARE_BRACKET 0x5d
733 #endif
734 #ifndef PNG_STRING_NEWLINE
735 #define PNG_STRING_NEWLINE "\n"
736 #endif
737
738 /* These are currently experimental features, define them if you want */
739
740 /* Very little testing */
741 /*
742 #ifdef PNG_READ_SUPPORTED
743 #  ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
744 #    define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
745 #  endif
746 #endif
747 */
748
749 /* This is only for PowerPC big-endian and 680x0 systems */
750 /* some testing */
751 /*
752 #ifndef PNG_READ_BIG_ENDIAN_SUPPORTED
753 #  define PNG_READ_BIG_ENDIAN_SUPPORTED
754 #endif
755 */
756
757 #if !defined(PNG_NO_USE_READ_MACROS) && !defined(PNG_USE_READ_MACROS)
758 #  define PNG_USE_READ_MACROS
759 #endif
760
761 /* Buggy compilers (e.g., gcc 2.7.2.2) need PNG_NO_POINTER_INDEXING */
762
763 #if !defined(PNG_NO_POINTER_INDEXING) && \
764     !defined(PNG_POINTER_INDEXING_SUPPORTED)
765 #  define PNG_POINTER_INDEXING_SUPPORTED
766 #endif
767
768
769 /* Any chunks you are not interested in, you can undef here.  The
770  * ones that allocate memory may be expecially important (hIST,
771  * tEXt, zTXt, tRNS, pCAL).  Others will just save time and make png_info
772  * a bit smaller.
773  */
774
775 /* The size of the png_text structure changed in libpng-1.0.6 when
776  * iTXt support was added.  iTXt support was turned off by default through
777  * libpng-1.2.x, to support old apps that malloc the png_text structure
778  * instead of calling png_set_text() and letting libpng malloc it.  It
779  * was turned on by default in libpng-1.4.0.
780  */
781
782 /* PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED is deprecated. */
783 #if defined(PNG_READ_SUPPORTED) && \
784     !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
785     !defined(PNG_NO_READ_ANCILLARY_CHUNKS)
786 #  define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
787 #endif
788
789 /* PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED is deprecated. */
790 #if defined(PNG_WRITE_SUPPORTED) && \
791     !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
792     !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)
793 #  define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
794 #endif
795
796 #ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
797
798 #ifdef PNG_NO_READ_TEXT
799 #  define PNG_NO_READ_iTXt
800 #  define PNG_NO_READ_tEXt
801 #  define PNG_NO_READ_zTXt
802 #endif
803
804 #ifndef PNG_NO_READ_bKGD
805 #  define PNG_READ_bKGD_SUPPORTED
806 #  define PNG_bKGD_SUPPORTED
807 #endif
808 #ifndef PNG_NO_READ_cHRM
809 #  define PNG_READ_cHRM_SUPPORTED
810 #  define PNG_cHRM_SUPPORTED
811 #endif
812 #ifndef PNG_NO_READ_gAMA
813 #  define PNG_READ_gAMA_SUPPORTED
814 #  define PNG_gAMA_SUPPORTED
815 #endif
816 #ifndef PNG_NO_READ_hIST
817 #  define PNG_READ_hIST_SUPPORTED
818 #  define PNG_hIST_SUPPORTED
819 #endif
820 #ifndef PNG_NO_READ_iCCP
821 #  define PNG_READ_iCCP_SUPPORTED
822 #  define PNG_iCCP_SUPPORTED
823 #endif
824 #ifndef PNG_NO_READ_iTXt
825 #  ifndef PNG_READ_iTXt_SUPPORTED
826 #    define PNG_READ_iTXt_SUPPORTED
827 #  endif
828 #  ifndef PNG_iTXt_SUPPORTED
829 #    define PNG_iTXt_SUPPORTED
830 #  endif
831 #endif
832 #ifndef PNG_NO_READ_oFFs
833 #  define PNG_READ_oFFs_SUPPORTED
834 #  define PNG_oFFs_SUPPORTED
835 #endif
836 #ifndef PNG_NO_READ_pCAL
837 #  define PNG_READ_pCAL_SUPPORTED
838 #  define PNG_pCAL_SUPPORTED
839 #endif
840 #ifndef PNG_NO_READ_sCAL
841 #  define PNG_READ_sCAL_SUPPORTED
842 #  define PNG_sCAL_SUPPORTED
843 #endif
844 #ifndef PNG_NO_READ_pHYs
845 #  define PNG_READ_pHYs_SUPPORTED
846 #  define PNG_pHYs_SUPPORTED
847 #endif
848 #ifndef PNG_NO_READ_sBIT
849 #  define PNG_READ_sBIT_SUPPORTED
850 #  define PNG_sBIT_SUPPORTED
851 #endif
852 #ifndef PNG_NO_READ_sPLT
853 #  define PNG_READ_sPLT_SUPPORTED
854 #  define PNG_sPLT_SUPPORTED
855 #endif
856 #ifndef PNG_NO_READ_sRGB
857 #  define PNG_READ_sRGB_SUPPORTED
858 #  define PNG_sRGB_SUPPORTED
859 #endif
860 #ifndef PNG_NO_READ_tEXt
861 #  define PNG_READ_tEXt_SUPPORTED
862 #  define PNG_tEXt_SUPPORTED
863 #endif
864 #ifndef PNG_NO_READ_tIME
865 #  define PNG_READ_tIME_SUPPORTED
866 #  define PNG_tIME_SUPPORTED
867 #endif
868 #ifndef PNG_NO_READ_tRNS
869 #  define PNG_READ_tRNS_SUPPORTED
870 #  define PNG_tRNS_SUPPORTED
871 #endif
872 #ifndef PNG_NO_READ_zTXt
873 #  define PNG_READ_zTXt_SUPPORTED
874 #  define PNG_zTXt_SUPPORTED
875 #endif
876 #ifndef PNG_NO_READ_OPT_PLTE
877 #  define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */
878 #endif                      /* optional PLTE chunk in RGB and RGBA images */
879 #if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \
880     defined(PNG_READ_zTXt_SUPPORTED)
881 #  define PNG_READ_TEXT_SUPPORTED
882 #  define PNG_TEXT_SUPPORTED
883 #endif
884
885 #endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
886
887 #ifndef PNG_NO_READ_UNKNOWN_CHUNKS
888 #  ifndef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
889 #    define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
890 #  endif
891 #  ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
892 #    define PNG_UNKNOWN_CHUNKS_SUPPORTED
893 #  endif
894 #  ifndef PNG_READ_USER_CHUNKS_SUPPORTED
895 #    define PNG_READ_USER_CHUNKS_SUPPORTED
896 #  endif
897 #endif
898 #ifndef PNG_NO_READ_USER_CHUNKS
899 #  ifndef PNG_READ_USER_CHUNKS_SUPPORTED
900 #    define PNG_READ_USER_CHUNKS_SUPPORTED
901 #  endif
902 #  ifndef PNG_USER_CHUNKS_SUPPORTED
903 #    define PNG_USER_CHUNKS_SUPPORTED
904 #  endif
905 #endif
906 #ifndef PNG_NO_HANDLE_AS_UNKNOWN
907 #  ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
908 #    define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
909 #  endif
910 #endif
911
912 #ifdef PNG_WRITE_SUPPORTED
913 #ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
914
915 #ifdef PNG_NO_WRITE_TEXT
916 #  define PNG_NO_WRITE_iTXt
917 #  define PNG_NO_WRITE_tEXt
918 #  define PNG_NO_WRITE_zTXt
919 #endif
920 #ifndef PNG_NO_WRITE_bKGD
921 #  define PNG_WRITE_bKGD_SUPPORTED
922 #  ifndef PNG_bKGD_SUPPORTED
923 #    define PNG_bKGD_SUPPORTED
924 #  endif
925 #endif
926 #ifndef PNG_NO_WRITE_cHRM
927 #  define PNG_WRITE_cHRM_SUPPORTED
928 #  ifndef PNG_cHRM_SUPPORTED
929 #    define PNG_cHRM_SUPPORTED
930 #  endif
931 #endif
932 #ifndef PNG_NO_WRITE_gAMA
933 #  define PNG_WRITE_gAMA_SUPPORTED
934 #  ifndef PNG_gAMA_SUPPORTED
935 #    define PNG_gAMA_SUPPORTED
936 #  endif
937 #endif
938 #ifndef PNG_NO_WRITE_hIST
939 #  define PNG_WRITE_hIST_SUPPORTED
940 #  ifndef PNG_hIST_SUPPORTED
941 #    define PNG_hIST_SUPPORTED
942 #  endif
943 #endif
944 #ifndef PNG_NO_WRITE_iCCP
945 #  define PNG_WRITE_iCCP_SUPPORTED
946 #  ifndef PNG_iCCP_SUPPORTED
947 #    define PNG_iCCP_SUPPORTED
948 #  endif
949 #endif
950 #ifndef PNG_NO_WRITE_iTXt
951 #  ifndef PNG_WRITE_iTXt_SUPPORTED
952 #    define PNG_WRITE_iTXt_SUPPORTED
953 #  endif
954 #  ifndef PNG_iTXt_SUPPORTED
955 #    define PNG_iTXt_SUPPORTED
956 #  endif
957 #endif
958 #ifndef PNG_NO_WRITE_oFFs
959 #  define PNG_WRITE_oFFs_SUPPORTED
960 #  ifndef PNG_oFFs_SUPPORTED
961 #    define PNG_oFFs_SUPPORTED
962 #  endif
963 #endif
964 #ifndef PNG_NO_WRITE_pCAL
965 #  define PNG_WRITE_pCAL_SUPPORTED
966 #  ifndef PNG_pCAL_SUPPORTED
967 #    define PNG_pCAL_SUPPORTED
968 #  endif
969 #endif
970 #ifndef PNG_NO_WRITE_sCAL
971 #  define PNG_WRITE_sCAL_SUPPORTED
972 #  ifndef PNG_sCAL_SUPPORTED
973 #    define PNG_sCAL_SUPPORTED
974 #  endif
975 #endif
976 #ifndef PNG_NO_WRITE_pHYs
977 #  define PNG_WRITE_pHYs_SUPPORTED
978 #  ifndef PNG_pHYs_SUPPORTED
979 #    define PNG_pHYs_SUPPORTED
980 #  endif
981 #endif
982 #ifndef PNG_NO_WRITE_sBIT
983 #  define PNG_WRITE_sBIT_SUPPORTED
984 #  ifndef PNG_sBIT_SUPPORTED
985 #    define PNG_sBIT_SUPPORTED
986 #  endif
987 #endif
988 #ifndef PNG_NO_WRITE_sPLT
989 #  define PNG_WRITE_sPLT_SUPPORTED
990 #  ifndef PNG_sPLT_SUPPORTED
991 #    define PNG_sPLT_SUPPORTED
992 #  endif
993 #endif
994 #ifndef PNG_NO_WRITE_sRGB
995 #  define PNG_WRITE_sRGB_SUPPORTED
996 #  ifndef PNG_sRGB_SUPPORTED
997 #    define PNG_sRGB_SUPPORTED
998 #  endif
999 #endif
1000 #ifndef PNG_NO_WRITE_tEXt
1001 #  define PNG_WRITE_tEXt_SUPPORTED
1002 #  ifndef PNG_tEXt_SUPPORTED
1003 #    define PNG_tEXt_SUPPORTED
1004 #  endif
1005 #endif
1006 #ifndef PNG_NO_WRITE_tIME
1007 #  define PNG_WRITE_tIME_SUPPORTED
1008 #  ifndef PNG_tIME_SUPPORTED
1009 #    define PNG_tIME_SUPPORTED
1010 #  endif
1011 #endif
1012 #ifndef PNG_NO_WRITE_tRNS
1013 #  define PNG_WRITE_tRNS_SUPPORTED
1014 #  ifndef PNG_tRNS_SUPPORTED
1015 #    define PNG_tRNS_SUPPORTED
1016 #  endif
1017 #endif
1018 #ifndef PNG_NO_WRITE_zTXt
1019 #  define PNG_WRITE_zTXt_SUPPORTED
1020 #  ifndef PNG_zTXt_SUPPORTED
1021 #    define PNG_zTXt_SUPPORTED
1022 #  endif
1023 #endif
1024 #if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \
1025     defined(PNG_WRITE_zTXt_SUPPORTED)
1026 #  define PNG_WRITE_TEXT_SUPPORTED
1027 #  ifndef PNG_TEXT_SUPPORTED
1028 #    define PNG_TEXT_SUPPORTED
1029 #  endif
1030 #endif
1031
1032 #ifdef PNG_WRITE_tIME_SUPPORTED
1033 #  ifndef PNG_NO_CONVERT_tIME
1034 #    ifndef _WIN32_WCE
1035 /*   The "tm" structure is not supported on WindowsCE */
1036 #      ifndef PNG_CONVERT_tIME_SUPPORTED
1037 #        define PNG_CONVERT_tIME_SUPPORTED
1038 #      endif
1039 #   endif
1040 #  endif
1041 #endif
1042
1043 #endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
1044
1045 #ifndef PNG_NO_WRITE_FILTER
1046 #  ifndef PNG_WRITE_FILTER_SUPPORTED
1047 #    define PNG_WRITE_FILTER_SUPPORTED
1048 #  endif
1049 #endif
1050
1051 #ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
1052 #  define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
1053 #  ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
1054 #    define PNG_UNKNOWN_CHUNKS_SUPPORTED
1055 #  endif
1056 #endif
1057 #ifndef PNG_NO_HANDLE_AS_UNKNOWN
1058 #  ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
1059 #    define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
1060 #  endif
1061 #endif
1062 #endif /* PNG_WRITE_SUPPORTED */
1063
1064 /* Turn this off to disable png_read_png() and
1065  * png_write_png() and leave the row_pointers member
1066  * out of the info structure.
1067  */
1068 #ifndef PNG_NO_INFO_IMAGE
1069 #  define PNG_INFO_IMAGE_SUPPORTED
1070 #endif
1071
1072 /* Need the time information for converting tIME chunks */
1073 #ifdef PNG_CONVERT_tIME_SUPPORTED
1074      /* "time.h" functions are not supported on WindowsCE */
1075 #    include <time.h>
1076 #endif
1077
1078 /* Some typedefs to get us started.  These should be safe on most of the
1079  * common platforms.  The typedefs should be at least as large as the
1080  * numbers suggest (a png_uint_32 must be at least 32 bits long), but they
1081  * don't have to be exactly that size.  Some compilers dislike passing
1082  * unsigned shorts as function parameters, so you may be better off using
1083  * unsigned int for png_uint_16.
1084  */
1085
1086 #if defined(INT_MAX) && (INT_MAX > 0x7ffffffeL)
1087 typedef unsigned int png_uint_32;
1088 typedef int png_int_32;
1089 #else
1090 typedef unsigned long png_uint_32;
1091 typedef long png_int_32;
1092 #endif
1093 typedef unsigned short png_uint_16;
1094 typedef short png_int_16;
1095 typedef unsigned char png_byte;
1096
1097 #ifdef PNG_NO_SIZE_T
1098    typedef unsigned int png_size_t;
1099 #else
1100    typedef size_t png_size_t;
1101 #endif
1102 #define png_sizeof(x) sizeof(x)
1103
1104 /* The following is needed for medium model support.  It cannot be in the
1105  * pngpriv.h header.  Needs modification for other compilers besides
1106  * MSC.  Model independent support declares all arrays and pointers to be
1107  * large using the far keyword.  The zlib version used must also support
1108  * model independent data.  As of version zlib 1.0.4, the necessary changes
1109  * have been made in zlib.  The USE_FAR_KEYWORD define triggers other
1110  * changes that are needed. (Tim Wegner)
1111  */
1112
1113 /* Separate compiler dependencies (problem here is that zlib.h always
1114  * defines FAR. (SJT)
1115  */
1116 #ifdef __BORLANDC__
1117 #  if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
1118 #    define LDATA 1
1119 #  else
1120 #    define LDATA 0
1121 #  endif
1122    /* GRR:  why is Cygwin in here?  Cygwin is not Borland C... */
1123 #  if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__)
1124 #    define PNG_MAX_MALLOC_64K
1125 #    if (LDATA != 1)
1126 #      ifndef FAR
1127 #        define FAR __far
1128 #      endif
1129 #      define USE_FAR_KEYWORD
1130 #    endif   /* LDATA != 1 */
1131      /* Possibly useful for moving data out of default segment.
1132       * Uncomment it if you want. Could also define FARDATA as
1133       * const if your compiler supports it. (SJT)
1134 #    define FARDATA FAR
1135       */
1136 #  endif  /* __WIN32__, __FLAT__, __CYGWIN__ */
1137 #endif   /* __BORLANDC__ */
1138
1139
1140 /* Suggest testing for specific compiler first before testing for
1141  * FAR.  The Watcom compiler defines both __MEDIUM__ and M_I86MM,
1142  * making reliance oncertain keywords suspect. (SJT)
1143  */
1144
1145 /* MSC Medium model */
1146 #ifdef FAR
1147 #  ifdef M_I86MM
1148 #    define USE_FAR_KEYWORD
1149 #    define FARDATA FAR
1150 #    include <dos.h>
1151 #  endif
1152 #endif
1153
1154 /* SJT: default case */
1155 #ifndef FAR
1156 #  define FAR
1157 #endif
1158
1159 /* At this point FAR is always defined */
1160 #ifndef FARDATA
1161 #  define FARDATA
1162 #endif
1163
1164 /* Typedef for floating-point numbers that are converted
1165    to fixed-point with a multiple of 100,000, e.g., int_gamma */
1166 typedef png_int_32 png_fixed_point;
1167
1168 /* Add typedefs for pointers */
1169 typedef void            FAR * png_voidp;
1170 typedef png_byte        FAR * png_bytep;
1171 typedef png_uint_32     FAR * png_uint_32p;
1172 typedef png_int_32      FAR * png_int_32p;
1173 typedef png_uint_16     FAR * png_uint_16p;
1174 typedef png_int_16      FAR * png_int_16p;
1175 typedef PNG_CONST char  FAR * png_const_charp;
1176 typedef char            FAR * png_charp;
1177 typedef png_fixed_point FAR * png_fixed_point_p;
1178
1179 #ifndef PNG_NO_STDIO
1180 typedef FILE                * png_FILE_p;
1181 #endif
1182
1183 #ifdef PNG_FLOATING_POINT_SUPPORTED
1184 typedef double          FAR * png_doublep;
1185 #endif
1186
1187 /* Pointers to pointers; i.e. arrays */
1188 typedef png_byte        FAR * FAR * png_bytepp;
1189 typedef png_uint_32     FAR * FAR * png_uint_32pp;
1190 typedef png_int_32      FAR * FAR * png_int_32pp;
1191 typedef png_uint_16     FAR * FAR * png_uint_16pp;
1192 typedef png_int_16      FAR * FAR * png_int_16pp;
1193 typedef PNG_CONST char  FAR * FAR * png_const_charpp;
1194 typedef char            FAR * FAR * png_charpp;
1195 typedef png_fixed_point FAR * FAR * png_fixed_point_pp;
1196 #ifdef PNG_FLOATING_POINT_SUPPORTED
1197 typedef double          FAR * FAR * png_doublepp;
1198 #endif
1199
1200 /* Pointers to pointers to pointers; i.e., pointer to array */
1201 typedef char            FAR * FAR * FAR * png_charppp;
1202
1203 /* Define PNG_BUILD_DLL if the module being built is a Windows
1204  * LIBPNG DLL.
1205  *
1206  * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL.
1207  * It is equivalent to Microsoft predefined macro _DLL that is
1208  * automatically defined when you compile using the share
1209  * version of the CRT (C Run-Time library)
1210  *
1211  * The cygwin mods make this behavior a little different:
1212  * Define PNG_BUILD_DLL if you are building a dll for use with cygwin
1213  * Define PNG_STATIC if you are building a static library for use with cygwin,
1214  *   -or- if you are building an application that you want to link to the
1215  *   static library.
1216  * PNG_USE_DLL is defined by default (no user action needed) unless one of
1217  *   the other flags is defined.
1218  */
1219
1220 #if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL))
1221 #  define PNG_DLL
1222 #endif
1223
1224 #ifdef __CYGWIN__
1225 #  undef PNGAPI
1226 #  define PNGAPI __cdecl
1227 #  undef PNG_IMPEXP
1228 #  define PNG_IMPEXP
1229 #endif
1230
1231 #define PNG_USE_LOCAL_ARRAYS /* Not used in libpng, defined for legacy apps */
1232
1233 /* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall",
1234  * you may get warnings regarding the linkage of png_zalloc and png_zfree.
1235  * Don't ignore those warnings; you must also reset the default calling
1236  * convention in your compiler to match your PNGAPI, and you must build
1237  * zlib and your applications the same way you build libpng.
1238  */
1239
1240 #if defined(__MINGW32__) && !defined(PNG_MODULEDEF)
1241 #  ifndef PNG_NO_MODULEDEF
1242 #    define PNG_NO_MODULEDEF
1243 #  endif
1244 #endif
1245
1246 #if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF)
1247 #  define PNG_IMPEXP
1248 #endif
1249
1250 #if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \
1251     (( defined(_Windows) || defined(_WINDOWS) || \
1252        defined(WIN32) || defined(_WIN32) || defined(__WIN32__) ))
1253
1254 #  ifndef PNGAPI
1255 #     if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
1256 #        define PNGAPI __cdecl
1257 #     else
1258 #        define PNGAPI _cdecl
1259 #     endif
1260 #  endif
1261
1262 #  if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \
1263        0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */)
1264 #     define PNG_IMPEXP
1265 #  endif
1266
1267 #  ifndef PNG_IMPEXP
1268
1269 #    define PNG_EXPORT_TYPE1(type,symbol)  PNG_IMPEXP type PNGAPI symbol
1270 #    define PNG_EXPORT_TYPE2(type,symbol)  type PNG_IMPEXP PNGAPI symbol
1271
1272      /* Borland/Microsoft */
1273 #    if defined(_MSC_VER) || defined(__BORLANDC__)
1274 #      if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500)
1275 #         define PNG_EXPORT PNG_EXPORT_TYPE1
1276 #      else
1277 #         define PNG_EXPORT PNG_EXPORT_TYPE2
1278 #         ifdef PNG_BUILD_DLL
1279 #            define PNG_IMPEXP __export
1280 #         else
1281 #            define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in VC++ */
1282 #         endif                              /* Exists in Borland C++ for
1283                                                 C++ classes (== huge) */
1284 #      endif
1285 #    endif
1286
1287 #    ifndef PNG_IMPEXP
1288 #      ifdef PNG_BUILD_DLL
1289 #        define PNG_IMPEXP __declspec(dllexport)
1290 #      else
1291 #        define PNG_IMPEXP __declspec(dllimport)
1292 #      endif
1293 #    endif
1294 #  endif  /* PNG_IMPEXP */
1295 #else /* !(DLL || non-cygwin WINDOWS) */
1296 #   if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
1297 #     ifndef PNGAPI
1298 #       define PNGAPI _System
1299 #     endif
1300 #   else
1301 #     if 0 /* ... other platforms, with other meanings */
1302 #     endif
1303 #   endif
1304 #endif
1305
1306 #ifndef PNGAPI
1307 #  define PNGAPI
1308 #endif
1309 #ifndef PNG_IMPEXP
1310 #  define PNG_IMPEXP
1311 #endif
1312
1313 #ifdef PNG_BUILDSYMS
1314 #  ifndef PNG_EXPORT
1315 #    define PNG_EXPORT(type,symbol) PNG_FUNCTION_EXPORT symbol END
1316 #  endif
1317 #endif
1318
1319 #ifndef PNG_EXPORT
1320 #  define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol
1321 #endif
1322
1323 /* Support for compiler specific function attributes.  These are used
1324  * so that where compiler support is available incorrect use of API
1325  * functions in png.h will generate compiler warnings.
1326  *
1327  * Added at libpng-1.2.41.
1328  */
1329
1330 #ifndef PNG_NO_PEDANTIC_WARNINGS
1331 #  ifndef PNG_PEDANTIC_WARNINGS_SUPPORTED
1332 #    define PNG_PEDANTIC_WARNINGS_SUPPORTED
1333 #  endif
1334 #endif
1335
1336 #ifdef PNG_PEDANTIC_WARNINGS_SUPPORTED
1337 /* Support for compiler specific function attributes.  These are used
1338  * so that where compiler support is available incorrect use of API
1339  * functions in png.h will generate compiler warnings.  Added at libpng
1340  * version 1.2.41.
1341  */
1342 #  ifdef __GNUC__
1343 #    ifndef PNG_USE_RESULT
1344 #      define PNG_USE_RESULT __attribute__((__warn_unused_result__))
1345 #    endif
1346 #    ifndef PNG_NORETURN
1347 #      define PNG_NORETURN   __attribute__((__noreturn__))
1348 #    endif
1349 #    ifndef PNG_ALLOCATED
1350 #      define PNG_ALLOCATED  __attribute__((__malloc__))
1351 #    endif
1352
1353     /* This specifically protects structure members that should only be
1354      * accessed from within the library, therefore should be empty during
1355      * a library build.
1356      */
1357 #    ifndef PNG_DEPRECATED
1358 #      define PNG_DEPRECATED __attribute__((__deprecated__))
1359 #    endif
1360 #    ifndef PNG_DEPSTRUCT
1361 #      define PNG_DEPSTRUCT  __attribute__((__deprecated__))
1362 #    endif
1363 #    ifndef PNG_PRIVATE
1364 #      if 0 /* Doesn't work so we use deprecated instead*/
1365 #        define PNG_PRIVATE \
1366           __attribute__((warning("This function is not exported by libpng.")))
1367 #      else
1368 #        define PNG_PRIVATE \
1369           __attribute__((__deprecated__))
1370 #      endif
1371 #    endif /* PNG_PRIVATE */
1372 #  endif /* __GNUC__ */
1373 #endif /* PNG_PEDANTIC_WARNINGS */
1374
1375 #ifndef PNG_DEPRECATED
1376 #  define PNG_DEPRECATED  /* Use of this function is deprecated */
1377 #endif
1378 #ifndef PNG_USE_RESULT
1379 #  define PNG_USE_RESULT  /* The result of this function must be checked */
1380 #endif
1381 #ifndef PNG_NORETURN
1382 #  define PNG_NORETURN    /* This function does not return */
1383 #endif
1384 #ifndef PNG_ALLOCATED
1385 #  define PNG_ALLOCATED   /* The result of the function is new memory */
1386 #endif
1387 #ifndef PNG_DEPSTRUCT
1388 #  define PNG_DEPSTRUCT   /* Access to this struct member is deprecated */
1389 #endif
1390 #ifndef PNG_PRIVATE
1391 #  define PNG_PRIVATE     /* This is a private libpng function */
1392 #endif
1393
1394 /* Users may want to use these so they are not private.  Any library
1395  * functions that are passed far data must be model-independent.
1396  */
1397
1398 /* memory model/platform independent fns */
1399 #ifndef PNG_ABORT
1400 #  ifdef _WINDOWS_
1401 #     define PNG_ABORT() ExitProcess(0)
1402 #  else
1403 #     define PNG_ABORT() abort()
1404 #  endif
1405 #endif
1406
1407 #ifdef USE_FAR_KEYWORD
1408 /* Use this to make far-to-near assignments */
1409 #  define CHECK   1
1410 #  define NOCHECK 0
1411 #  define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
1412 #  define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
1413 #  define png_strcpy  _fstrcpy
1414 #  define png_strncpy _fstrncpy   /* Added to v 1.2.6 */
1415 #  define png_strlen  _fstrlen
1416 #  define png_memcmp  _fmemcmp    /* SJT: added */
1417 #  define png_memcpy  _fmemcpy
1418 #  define png_memset  _fmemset
1419 #  define png_sprintf sprintf
1420 #else
1421 #  ifdef _WINDOWS_  /* Favor Windows over C runtime fns */
1422 #    define CVT_PTR(ptr)         (ptr)
1423 #    define CVT_PTR_NOCHECK(ptr) (ptr)
1424 #    define png_strcpy  lstrcpyA
1425 #    define png_strncpy lstrcpynA
1426 #    define png_strlen  lstrlenA
1427 #    define png_memcmp  memcmp
1428 #    define png_memcpy  CopyMemory
1429 #    define png_memset  memset
1430 #    define png_sprintf wsprintfA
1431 #  else
1432 #    define CVT_PTR(ptr)         (ptr)
1433 #    define CVT_PTR_NOCHECK(ptr) (ptr)
1434 #    define png_strcpy  strcpy
1435 #    define png_strncpy strncpy     /* Added to v 1.2.6 */
1436 #    define png_strlen  strlen
1437 #    define png_memcmp  memcmp      /* SJT: added */
1438 #    define png_memcpy  memcpy
1439 #    define png_memset  memset
1440 #    define png_sprintf sprintf
1441 #    ifndef PNG_NO_SNPRINTF
1442 #      ifdef _MSC_VER
1443 #        define png_snprintf _snprintf   /* Added to v 1.2.19 */
1444 #        define png_snprintf2 _snprintf
1445 #        define png_snprintf6 _snprintf
1446 #      else
1447 #        define png_snprintf snprintf   /* Added to v 1.2.19 */
1448 #        define png_snprintf2 snprintf
1449 #        define png_snprintf6 snprintf
1450 #      endif
1451 #    else
1452        /* You don't have or don't want to use snprintf().  Caution: Using
1453         * sprintf instead of snprintf exposes your application to accidental
1454         * or malevolent buffer overflows.  If you don't have snprintf()
1455         * as a general rule you should provide one (you can get one from
1456         * Portable OpenSSH).
1457         */
1458 #      define png_snprintf(s1,n,fmt,x1) sprintf(s1,fmt,x1)
1459 #      define png_snprintf2(s1,n,fmt,x1,x2) sprintf(s1,fmt,x1,x2)
1460 #      define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \
1461           sprintf(s1,fmt,x1,x2,x3,x4,x5,x6)
1462 #    endif
1463 #  endif
1464 #endif
1465
1466 /* png_alloc_size_t is guaranteed to be no smaller than png_size_t,
1467  * and no smaller than png_uint_32.  Casts from png_size_t or png_uint_32
1468  * to png_alloc_size_t are not necessary; in fact, it is recommended
1469  * not to use them at all so that the compiler can complain when something
1470  * turns out to be problematic.
1471  * Casts in the other direction (from png_alloc_size_t to png_size_t or
1472  * png_uint_32) should be explicitly applied; however, we do not expect
1473  * to encounter practical situations that require such conversions.
1474  */
1475 #if defined(__TURBOC__) && !defined(__FLAT__)
1476 #  define  png_mem_alloc farmalloc
1477 #  define  png_mem_free  farfree
1478    typedef unsigned long png_alloc_size_t;
1479 #else
1480 #  if defined(_MSC_VER) && defined(MAXSEG_64K)
1481 #    define  png_mem_alloc(s) halloc(s, 1)
1482 #    define  png_mem_free     hfree
1483      typedef unsigned long    png_alloc_size_t;
1484 #  else
1485 #    if defined(_WINDOWS_) && (!defined(INT_MAX) || INT_MAX <= 0x7ffffffeL)
1486 #      define  png_mem_alloc(s) HeapAlloc(GetProcessHeap(), 0, s)
1487 #      define  png_mem_free(p)  HeapFree(GetProcessHeap(), 0, p)
1488        typedef DWORD            png_alloc_size_t;
1489 #    else
1490 #      define  png_mem_alloc malloc
1491 #      define  png_mem_free  free
1492        typedef png_size_t    png_alloc_size_t;
1493 #    endif
1494 #  endif
1495 #endif
1496 /* End of memory model/platform independent support */
1497
1498 /* Just a little check that someone hasn't tried to define something
1499  * contradictory.
1500  */
1501 #if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K)
1502 #  undef PNG_ZBUF_SIZE
1503 #  define PNG_ZBUF_SIZE 65536L
1504 #endif
1505
1506
1507 /* Added at libpng-1.2.8 */
1508 #endif /* PNG_VERSION_INFO_ONLY */
1509
1510 #endif /* PNGCONF_H */