blob: daddce48ffe0d2c92da06d26552188936b3927fb [file] [log] [blame]
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -05001
Glenn Randers-Pehrson0f881d61998-02-07 10:20:57 -06002/* pngconf.h - machine configurable file for libpng
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -06003 *
Glenn Randers-Pehrsond6ea40a2009-11-02 07:32:00 -06004 * libpng version 1.4.0beta90 - November 2, 2009
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -06005 * For conditions of distribution and use, see copyright notice in png.h
Glenn Randers-Pehrson79134c62009-02-14 10:32:18 -06006 * Copyright (c) 1998-2009 Glenn Randers-Pehrson
Glenn Randers-Pehrsond4366722000-06-04 14:29:29 -05007 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
8 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
Glenn Randers-Pehrson3e61d792009-06-24 09:31:28 -05009 *
Glenn Randers-Pehrsonbfbf8652009-06-26 21:46:52 -050010 * This code is released under the libpng license.
Glenn Randers-Pehrsonc332bbc2009-06-25 13:43:50 -050011 * For conditions of distribution and use, see the disclaimer
Glenn Randers-Pehrson037023b2009-06-24 10:27:36 -050012 * and license in png.h
Glenn Randers-Pehrson3e61d792009-06-24 09:31:28 -050013 *
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060014 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -050015
16/* Any machine specific code is near the front of this file, so if you
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060017 * 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 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -050021
22#ifndef PNGCONF_H
23#define PNGCONF_H
24
Glenn Randers-Pehrson6bc53be2006-06-16 07:52:03 -050025#ifndef PNG_NO_LIMITS_H
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -050026# include <limits.h>
Glenn Randers-Pehrson6bc53be2006-06-16 07:52:03 -050027#endif
28
Glenn Randers-Pehrson86dc9812006-05-10 07:27:44 -050029/* Added at libpng-1.2.9 */
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -050030
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -050031/* config.h is created by and PNG_CONFIGURE_LIBPNG is set by the "configure" script. */
Glenn Randers-Pehrsond5d63602006-04-15 06:37:45 -050032#ifdef PNG_CONFIGURE_LIBPNG
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -050033# ifdef HAVE_CONFIG_H
34# include "config.h"
35# endif
Glenn Randers-Pehrson170b70c2006-03-10 10:19:04 -060036#endif
37
Glenn Randers-Pehrson5dd2b8e2004-11-24 07:50:16 -060038/*
39 * Added at libpng-1.2.8
Glenn Randers-Pehrson7824a702009-06-13 10:05:05 -050040 *
Glenn Randers-Pehrson86dc9812006-05-10 07:27:44 -050041 * PNG_USER_CONFIG has to be defined on the compiler command line. This
42 * includes the resource compiler for Windows DLL configurations.
43 */
44#ifdef PNG_USER_CONFIG
45# ifndef PNG_USER_PRIVATEBUILD
46# define PNG_USER_PRIVATEBUILD
47# endif
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -050048# include "pngusr.h"
Glenn Randers-Pehrson86dc9812006-05-10 07:27:44 -050049#endif
50
Glenn Randers-Pehrson7824a702009-06-13 10:05:05 -050051/*
Glenn Randers-Pehrson5dd2b8e2004-11-24 07:50:16 -060052 * If you create a private DLL you need to define in "pngusr.h" the followings:
53 * #define PNG_USER_PRIVATEBUILD <Describes by whom and why this version of
54 * the DLL was built>
55 * e.g. #define PNG_USER_PRIVATEBUILD "Build by MyCompany for xyz reasons."
56 * #define PNG_USER_DLLFNAME_POSTFIX <two-letter postfix that serve to
57 * distinguish your DLL from those of the official release. These
58 * correspond to the trailing letters that come after the version
59 * number and must match your private DLL name>
60 * e.g. // private DLL "libpng13gx.dll"
61 * #define PNG_USER_DLLFNAME_POSTFIX "gx"
Glenn Randers-Pehrson7824a702009-06-13 10:05:05 -050062 *
63 * The following macros are also at your disposal if you want to complete the
Glenn Randers-Pehrson5dd2b8e2004-11-24 07:50:16 -060064 * DLL VERSIONINFO structure.
65 * - PNG_USER_VERSIONINFO_COMMENTS
66 * - PNG_USER_VERSIONINFO_COMPANYNAME
67 * - PNG_USER_VERSIONINFO_LEGALTRADEMARKS
68 */
69
70#ifdef __STDC__
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -050071# ifdef SPECIALBUILD
72# pragma message("PNG_LIBPNG_SPECIALBUILD (and deprecated SPECIALBUILD)\
73 are now LIBPNG reserved macros. Use PNG_USER_PRIVATEBUILD instead.")
74# endif
Glenn Randers-Pehrson5dd2b8e2004-11-24 07:50:16 -060075
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -050076# ifdef PRIVATEBUILD
77# pragma message("PRIVATEBUILD is deprecated.\
78 Use PNG_USER_PRIVATEBUILD instead.")
79# define PNG_USER_PRIVATEBUILD PRIVATEBUILD
80# endif
Glenn Randers-Pehrson5dd2b8e2004-11-24 07:50:16 -060081#endif /* __STDC__ */
82
Glenn Randers-Pehrson5dd2b8e2004-11-24 07:50:16 -060083/* End of material added to libpng-1.2.8 */
Glenn Randers-Pehrson878b31e2004-11-12 22:04:56 -060084
Glenn Randers-Pehrson5d95de72009-09-01 11:28:09 -050085#ifndef PNG_VERSION_INFO_ONLY
86
Andreas Dilger02ad0ef1997-01-17 01:34:35 -060087/* This is the size of the compression buffer, and thus the size of
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060088 * an IDAT chunk. Make this whatever size you feel is best for your
89 * machine. One of these will be allocated per png_struct. When this
90 * is full, it writes the data to the disk, and does some other
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -060091 * calculations. Making this an extremely small size will slow
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060092 * the library down, but you may want to experiment to determine
93 * where it becomes significant, if you are concerned with memory
94 * usage. Note that zlib allocates at least 32Kb also. For readers,
95 * this describes the size of the buffer available to read the data in.
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -060096 * Unless this gets smaller than the size of a row (compressed),
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060097 * it should not make much difference how big this is.
98 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -050099
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -0600100#ifndef PNG_ZBUF_SIZE
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600101# define PNG_ZBUF_SIZE 8192
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -0600102#endif
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500103
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600104/* Enable if you want a write-only libpng */
105
106#ifndef PNG_NO_READ_SUPPORTED
107# define PNG_READ_SUPPORTED
108#endif
109
110/* Enable if you want a read-only libpng */
111
112#ifndef PNG_NO_WRITE_SUPPORTED
113# define PNG_WRITE_SUPPORTED
114#endif
115
Glenn Randers-Pehrson6bc53be2006-06-16 07:52:03 -0500116/* Enabled in 1.4.0. */
117#ifdef PNG_ALLOW_BENIGN_ERRORS
118# define png_benign_error png_warning
119# define png_chunk_benign_error png_chunk_warning
120#else
121# ifndef PNG_BENIGN_ERRORS_SUPPORTED
122# define png_benign_error png_error
123# define png_chunk_benign_error png_chunk_error
124# endif
125#endif
126
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500127/* Added at libpng version 1.4.0 */
128#if !defined(PNG_NO_WARNINGS) && !defined(PNG_WARNINGS_SUPPORTED)
129# define PNG_WARNINGS_SUPPORTED
130#endif
131
132#if !defined(PNG_NO_ERROR_TEXT) && !defined(PNG_ERROR_TEXT_SUPPORTED)
133# define PNG_ERROR_TEXT_SUPPORTED
134#endif
135
136#if !defined(PNG_NO_CHECK_cHRM) && !defined(PNG_CHECK_cHRM_SUPPORTED)
137# define PNG_CHECK_cHRM_SUPPORTED
138#endif
139
Glenn Randers-Pehrsone68f5a32001-05-14 09:20:53 -0500140/* Enabled by default in 1.2.0. You can disable this if you don't need to
141 support PNGs that are embedded in MNG datastreams */
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500142#ifndef PNG_NO_MNG_FEATURES
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600143# ifndef PNG_MNG_FEATURES_SUPPORTED
144# define PNG_MNG_FEATURES_SUPPORTED
145# endif
146#endif
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600147
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500148/* Added at libpng version 1.4.0 */
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -0600149#ifndef PNG_NO_FLOATING_POINT_SUPPORTED
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600150# ifndef PNG_FLOATING_POINT_SUPPORTED
151# define PNG_FLOATING_POINT_SUPPORTED
152# endif
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500153#endif
154
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -0500155/* Added at libpng-1.4.0beta49 for testing (this test is no longer used
156 in libpng and png_calloc() is always present)
157 */
Glenn Randers-Pehrson5d95de72009-09-01 11:28:09 -0500158#define PNG_CALLOC_SUPPORTED
159
Andreas Dilger47a0c421997-05-16 02:46:07 -0500160/* If you are running on a machine where you cannot allocate more
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600161 * than 64K of memory at once, uncomment this. While libpng will not
162 * normally need that much memory in a chunk (unless you load up a very
163 * large file), zlib needs to know how big of a chunk it can use, and
164 * libpng thus makes sure to check any memory allocation to verify it
165 * will fit into memory.
Andreas Dilger47a0c421997-05-16 02:46:07 -0500166#define PNG_MAX_MALLOC_64K
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600167 */
Andreas Dilger47a0c421997-05-16 02:46:07 -0500168#if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K)
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600169# define PNG_MAX_MALLOC_64K
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500170#endif
171
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -0500172/* Special munging to support doing things the 'cygwin' way:
173 * 'Normal' png-on-win32 defines/defaults:
174 * PNG_BUILD_DLL -- building dll
175 * PNG_USE_DLL -- building an application, linking to dll
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -0600176 * (no define) -- building static library, or building an
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -0500177 * application and linking to the static lib
178 * 'Cygwin' defines/defaults:
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500179 * PNG_BUILD_DLL -- (ignored) building the dll
180 * (no define) -- (ignored) building an application, linking to the dll
Glenn Randers-Pehrson7824a702009-06-13 10:05:05 -0500181 * PNG_STATIC -- (ignored) building the static lib, or building an
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500182 * application that links to the static lib.
Glenn Randers-Pehrson7824a702009-06-13 10:05:05 -0500183 * ALL_STATIC -- (ignored) building various static libs, or building an
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500184 * application that links to the static libs.
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -0500185 * Thus,
186 * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and
187 * this bit of #ifdefs will define the 'correct' config variables based on
188 * that. If a cygwin user *wants* to define 'PNG_USE_DLL' that's okay, but
189 * unnecessary.
Glenn Randers-Pehrsone68f5a32001-05-14 09:20:53 -0500190 *
191 * Also, the precedence order is:
192 * ALL_STATIC (since we can't #undef something outside our namespace)
193 * PNG_BUILD_DLL
194 * PNG_STATIC
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500195 * (nothing) == PNG_USE_DLL
Glenn Randers-Pehrson7824a702009-06-13 10:05:05 -0500196 *
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500197 * CYGWIN (2002-01-20): The preceding is now obsolete. With the advent
Glenn Randers-Pehrson7824a702009-06-13 10:05:05 -0500198 * of auto-import in binutils, we no longer need to worry about
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500199 * __declspec(dllexport) / __declspec(dllimport) and friends. Therefore,
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500200 * we don't need to worry about PNG_STATIC or ALL_STATIC when it comes
Glenn Randers-Pehrson7824a702009-06-13 10:05:05 -0500201 * to __declspec() stuff. However, we DO need to worry about
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500202 * PNG_BUILD_DLL and PNG_STATIC because those change some defaults
Glenn Randers-Pehrson86312502009-08-31 14:17:23 -0500203 * such as CONSOLE_IO.
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -0500204 */
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500205#ifdef __CYGWIN__
206# ifdef ALL_STATIC
207# ifdef PNG_BUILD_DLL
Glenn Randers-Pehrsone68f5a32001-05-14 09:20:53 -0500208# undef PNG_BUILD_DLL
209# endif
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500210# ifdef PNG_USE_DLL
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -0500211# undef PNG_USE_DLL
212# endif
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500213# ifdef PNG_DLL
Glenn Randers-Pehrsone68f5a32001-05-14 09:20:53 -0500214# undef PNG_DLL
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -0500215# endif
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500216# ifndef PNG_STATIC
Glenn Randers-Pehrsond4e81092001-01-31 05:56:52 -0600217# define PNG_STATIC
218# endif
Glenn Randers-Pehrsone68f5a32001-05-14 09:20:53 -0500219# else
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500220# ifdef PNG_BUILD_DLL
221# ifdef PNG_STATIC
Glenn Randers-Pehrsone68f5a32001-05-14 09:20:53 -0500222# undef PNG_STATIC
223# endif
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500224# ifdef PNG_USE_DLL
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -0500225# undef PNG_USE_DLL
226# endif
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500227# ifndef PNG_DLL
Glenn Randers-Pehrsone68f5a32001-05-14 09:20:53 -0500228# define PNG_DLL
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -0500229# endif
230# else
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500231# ifdef PNG_STATIC
232# ifdef PNG_USE_DLL
Glenn Randers-Pehrsone68f5a32001-05-14 09:20:53 -0500233# undef PNG_USE_DLL
234# endif
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500235# ifdef PNG_DLL
Glenn Randers-Pehrsone68f5a32001-05-14 09:20:53 -0500236# undef PNG_DLL
237# endif
238# else
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500239# ifndef PNG_USE_DLL
Glenn Randers-Pehrsone68f5a32001-05-14 09:20:53 -0500240# define PNG_USE_DLL
241# endif
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500242# ifndef PNG_DLL
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -0500243# define PNG_DLL
244# endif
Glenn Randers-Pehrson7824a702009-06-13 10:05:05 -0500245# endif
246# endif
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -0500247# endif
248#endif
249
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500250/* This protects us against compilers that run on a windowing system
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600251 * and thus don't have or would rather us not use the stdio types:
252 * stdin, stdout, and stderr. The only one currently used is stderr
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -0600253 * in png_error() and png_warning(). #defining PNG_NO_CONSOLE_IO will
254 * prevent these from being compiled and used. #defining PNG_NO_STDIO
255 * will also prevent these, plus will prevent the entire set of stdio
256 * macros and functions (FILE *, printf, etc.) from being compiled and used,
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500257 * unless (PNG_DEBUG > 0) has been #defined.
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -0600258 *
259 * #define PNG_NO_CONSOLE_IO
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600260 * #define PNG_NO_STDIO
261 */
Guy Schalnat6d764711995-12-19 03:22:19 -0600262
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500263#if !defined(PNG_NO_STDIO) && !defined(PNG_STDIO_SUPPORTED)
264# define PNG_STDIO_SUPPORTED
265#endif
266
Glenn Randers-Pehrson316f97a2000-07-08 13:19:41 -0500267
Glenn Randers-Pehrson1ef65b62000-05-12 06:19:53 -0500268#ifdef PNG_BUILD_DLL
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500269# if !defined(PNG_CONSOLE_IO_SUPPORTED) && !defined(PNG_NO_CONSOLE_IO)
270# define PNG_NO_CONSOLE_IO
Glenn Randers-Pehrson1ef65b62000-05-12 06:19:53 -0500271# endif
272#endif
273
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -0600274# ifdef PNG_NO_STDIO
275# ifndef PNG_NO_CONSOLE_IO
276# define PNG_NO_CONSOLE_IO
277# endif
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500278# ifdef PNG_DEBUG
279# if (PNG_DEBUG > 0)
280# include <stdio.h>
281# endif
282# endif
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -0600283# else
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500284# include <stdio.h>
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -0600285# endif
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600286
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500287#if !(defined PNG_NO_CONSOLE_IO) && !defined(PNG_CONSOLE_IO_SUPPORTED)
288# define PNG_CONSOLE_IO_SUPPORTED
289#endif
290
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600291/* This macro protects us against machines that don't have function
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600292 * prototypes (ie K&R style headers). If your compiler does not handle
293 * function prototypes, define this macro and use the included ansi2knr.
294 * I've always been able to use _NO_PROTO as the indicator, but you may
295 * need to drag the empty declaration out in front of here, or change the
296 * ifdef to suit your own needs.
297 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500298#ifndef PNGARG
299
Andreas Dilger47a0c421997-05-16 02:46:07 -0500300#ifdef OF /* zlib prototype munger */
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600301# define PNGARG(arglist) OF(arglist)
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500302#else
303
304#ifdef _NO_PROTO
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600305# define PNGARG(arglist) ()
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500306#else
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600307# define PNGARG(arglist) arglist
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500308#endif /* _NO_PROTO */
309
310#endif /* OF */
311
312#endif /* PNGARG */
313
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600314/* Try to determine if we are compiling on a Mac. Note that testing for
315 * just __MWERKS__ is not good enough, because the Codewarrior is now used
316 * on non-Mac platforms.
317 */
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600318#ifndef MACOS
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600319# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
320 defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
321# define MACOS
322# endif
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600323#endif
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600324
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500325/* Enough people need this for various reasons to include it here */
Glenn Randers-Pehrson418783e2009-11-01 06:45:09 -0600326#if !defined(MACOS) && !defined(RISCOS)
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600327# include <sys/types.h>
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500328#endif
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600329
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500330/* PNG_SETJMP_NOT_SUPPORTED and PNG_NO_SETJMP_SUPPORTED are deprecated. */
331#if !defined(PNG_NO_SETJMP) && \
332 !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED)
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600333# define PNG_SETJMP_SUPPORTED
334#endif
335
336#ifdef PNG_SETJMP_SUPPORTED
Andreas Dilger47a0c421997-05-16 02:46:07 -0500337/* This is an attempt to force a single setjmp behaviour on Linux. If
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600338 * the X config stuff didn't define _BSD_SOURCE we wouldn't need this.
Glenn Randers-Pehrsona93c9422009-04-13 11:41:33 -0500339 *
340 * You can bypass this test if you know that your application uses exactly
341 * the same setjmp.h that was included when libpng was built. Only define
342 * PNG_SKIP_SETJMP_CHECK while building your application, prior to the
343 * application's '#include "png.h"'. Don't define PNG_SKIP_SETJMP_CHECK
344 * while building a separate libpng library for general use.
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600345 */
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500346
Glenn Randers-Pehrsona93c9422009-04-13 11:41:33 -0500347# ifndef PNG_SKIP_SETJMP_CHECK
348# ifdef __linux__
349# ifdef _BSD_SOURCE
350# define PNG_SAVE_BSD_SOURCE
351# undef _BSD_SOURCE
352# endif
353# ifdef _SETJMP_H
354 /* If you encounter a compiler error here, see the explanation
355 * near the end of INSTALL.
356 */
357 __pngconf.h__ in libpng already includes setjmp.h;
358 __dont__ include it again.;
359# endif
360# endif /* __linux__ */
361# endif /* PNG_SKIP_SETJMP_CHECK */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500362
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500363 /* Include setjmp.h for error handling */
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600364# include <setjmp.h>
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500365
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600366# ifdef __linux__
Glenn Randers-Pehrson13944802000-06-24 07:42:42 -0500367# ifdef PNG_SAVE_BSD_SOURCE
Glenn Randers-Pehrson56f63962008-10-06 10:16:17 -0500368# ifdef _BSD_SOURCE
369# undef _BSD_SOURCE
370# endif
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600371# define _BSD_SOURCE
Glenn Randers-Pehrson13944802000-06-24 07:42:42 -0500372# undef PNG_SAVE_BSD_SOURCE
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600373# endif
374# endif /* __linux__ */
375#endif /* PNG_SETJMP_SUPPORTED */
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600376
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500377#ifdef BSD
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600378# include <strings.h>
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500379#else
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600380# include <string.h>
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500381#endif
382
Andreas Dilger47a0c421997-05-16 02:46:07 -0500383/* Other defines for things like memory and the like can go here. */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500384
Glenn Randers-Pehrson145f5c82008-07-10 09:13:13 -0500385/* This controls how fine the dithering gets. As this allocates
386 * a largish chunk of memory (32K), those who are not as concerned
387 * with dithering quality can decrease some or all of these.
388 */
389#ifndef PNG_DITHER_RED_BITS
390# define PNG_DITHER_RED_BITS 5
391#endif
392#ifndef PNG_DITHER_GREEN_BITS
393# define PNG_DITHER_GREEN_BITS 5
394#endif
395#ifndef PNG_DITHER_BLUE_BITS
396# define PNG_DITHER_BLUE_BITS 5
397#endif
398
399/* This controls how fine the gamma correction becomes when you
400 * are only interested in 8 bits anyway. Increasing this value
401 * results in more memory being used, and more pow() functions
402 * being called to fill in the gamma tables. Don't set this value
403 * less then 8, and even that may not work (I haven't tested it).
404 */
405
406#ifndef PNG_MAX_GAMMA_8
407# define PNG_MAX_GAMMA_8 11
408#endif
409
410/* This controls how much a difference in gamma we can tolerate before
411 * we actually start doing gamma conversion.
412 */
413#ifndef PNG_GAMMA_THRESHOLD
414# define PNG_GAMMA_THRESHOLD 0.05
415#endif
416
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600417/* The following uses const char * instead of char * for error
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600418 * and warning message functions, so some compilers won't complain.
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600419 * If you do not want to use const, define PNG_NO_CONST here.
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600420 */
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600421
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600422#ifndef PNG_NO_CONST
Guy Schalnat6d764711995-12-19 03:22:19 -0600423# define PNG_CONST const
424#else
425# define PNG_CONST
426#endif
427
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600428/* The following defines give you the ability to remove code from the
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600429 * library that you will not be using. I wish I could figure out how to
430 * automate this, but I can't do that without making it seriously hard
431 * on the users. So if you are not using an ability, change the #define
432 * to and #undef, and that part of the library will not be compiled. If
433 * your linker can't find a function, you may want to make sure the
434 * ability is defined here. Some of these depend upon some others being
435 * defined. I haven't figured out all the interactions here, so you may
436 * have to experiment awhile to get everything to compile. If you are
437 * creating or using a shared library, you probably shouldn't touch this,
438 * as it will affect the size of the structures, and this will cause bad
439 * things to happen if the library and/or application ever change.
440 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500441
Glenn Randers-Pehrson38e6e772000-04-09 19:06:13 -0500442/* Any features you will not be using can be undef'ed here */
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600443
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600444/* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500445 * to turn it off with PNG_NO_READ|WRITE_TRANSFORMS on the compile line,
446 * then pick and choose which ones to define without having to edit this
447 * file. It is safe to use the PNG_NO_READ|WRITE_TRANSFORMS
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500448 * if you only want to have a png-compliant reader/writer but don't need
449 * any of the extra transformations. This saves about 80 kbytes in a
450 * typical installation of the library. (PNG_NO_* form added in version
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500451 * 1.0.1c, for consistency; PNG_*_TRANSFORMS_NOT_SUPPORTED deprecated in
452 * 1.4.0)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600453 */
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600454
Glenn Randers-Pehrson6942d532000-05-01 09:31:54 -0500455/* Ignore attempt to turn off both floating and fixed point support */
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500456#if !defined(PNG_FLOATING_POINT_SUPPORTED) || \
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600457 !defined(PNG_NO_FIXED_POINT_SUPPORTED)
458# define PNG_FIXED_POINT_SUPPORTED
Glenn Randers-Pehrson38e6e772000-04-09 19:06:13 -0500459#endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600460
Glenn Randers-Pehrson3b3e0902009-06-16 17:20:43 -0500461#ifdef PNG_READ_SUPPORTED
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600462
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500463/* PNG_READ_TRANSFORMS_NOT_SUPPORTED is deprecated. */
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500464#if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600465 !defined(PNG_NO_READ_TRANSFORMS)
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600466# define PNG_READ_TRANSFORMS_SUPPORTED
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600467#endif
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600468
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600469#ifdef PNG_READ_TRANSFORMS_SUPPORTED
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600470# ifndef PNG_NO_READ_EXPAND
471# define PNG_READ_EXPAND_SUPPORTED
472# endif
473# ifndef PNG_NO_READ_SHIFT
474# define PNG_READ_SHIFT_SUPPORTED
475# endif
476# ifndef PNG_NO_READ_PACK
477# define PNG_READ_PACK_SUPPORTED
478# endif
479# ifndef PNG_NO_READ_BGR
480# define PNG_READ_BGR_SUPPORTED
481# endif
482# ifndef PNG_NO_READ_SWAP
483# define PNG_READ_SWAP_SUPPORTED
484# endif
485# ifndef PNG_NO_READ_PACKSWAP
486# define PNG_READ_PACKSWAP_SUPPORTED
487# endif
488# ifndef PNG_NO_READ_INVERT
489# define PNG_READ_INVERT_SUPPORTED
490# endif
Glenn Randers-Pehrson4a82d692008-12-15 16:25:05 -0600491#if 0 /* removed from libpng-1.4.0 */
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600492# ifndef PNG_NO_READ_DITHER
493# define PNG_READ_DITHER_SUPPORTED
494# endif
Glenn Randers-Pehrson4a82d692008-12-15 16:25:05 -0600495#endif /* 0 */
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600496# ifndef PNG_NO_READ_BACKGROUND
497# define PNG_READ_BACKGROUND_SUPPORTED
498# endif
499# ifndef PNG_NO_READ_16_TO_8
500# define PNG_READ_16_TO_8_SUPPORTED
501# endif
502# ifndef PNG_NO_READ_FILLER
503# define PNG_READ_FILLER_SUPPORTED
504# endif
505# ifndef PNG_NO_READ_GAMMA
506# define PNG_READ_GAMMA_SUPPORTED
507# endif
508# ifndef PNG_NO_READ_GRAY_TO_RGB
509# define PNG_READ_GRAY_TO_RGB_SUPPORTED
510# endif
511# ifndef PNG_NO_READ_SWAP_ALPHA
512# define PNG_READ_SWAP_ALPHA_SUPPORTED
513# endif
514# ifndef PNG_NO_READ_INVERT_ALPHA
515# define PNG_READ_INVERT_ALPHA_SUPPORTED
516# endif
Glenn Randers-Pehrson1916f6a2008-08-14 13:44:49 -0500517# ifndef PNG_NO_READ_PREMULTIPLY_ALPHA
518# define PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED
519# endif
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600520# ifndef PNG_NO_READ_STRIP_ALPHA
521# define PNG_READ_STRIP_ALPHA_SUPPORTED
522# endif
523# ifndef PNG_NO_READ_USER_TRANSFORM
524# define PNG_READ_USER_TRANSFORM_SUPPORTED
525# endif
526# ifndef PNG_NO_READ_RGB_TO_GRAY
527# define PNG_READ_RGB_TO_GRAY_SUPPORTED
528# endif
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600529#endif /* PNG_READ_TRANSFORMS_SUPPORTED */
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600530
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500531/* PNG_PROGRESSIVE_READ_NOT_SUPPORTED is deprecated. */
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500532#if !defined(PNG_NO_PROGRESSIVE_READ) && \
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600533 !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */
534# define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600535#endif /* about interlacing capability! You'll */
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500536 /* still have interlacing unless you change the following define: */
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600537
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600538#define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500539
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500540/* PNG_NO_SEQUENTIAL_READ_SUPPORTED is deprecated. */
541#if !defined(PNG_NO_SEQUENTIAL_READ) && \
542 !defined(PNG_SEQUENTIAL_READ_SUPPORTED) && \
543 !defined(PNG_NO_SEQUENTIAL_READ_SUPPORTED)
544# define PNG_SEQUENTIAL_READ_SUPPORTED
545#endif
546
Glenn Randers-Pehrson98c9d732000-05-03 21:06:11 -0500547#ifndef PNG_NO_READ_COMPOSITE_NODIV
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600548# ifndef PNG_NO_READ_COMPOSITED_NODIV /* libpng-1.0.x misspelling */
549# define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel, SGI */
550# endif
Glenn Randers-Pehrson98c9d732000-05-03 21:06:11 -0500551#endif
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500552
Glenn Randers-Pehrson86dc9812006-05-10 07:27:44 -0500553#if !defined(PNG_NO_GET_INT_32) || defined(PNG_READ_oFFS_SUPPORTED) || \
554 defined(PNG_READ_pCAL_SUPPORTED)
555# ifndef PNG_GET_INT_32_SUPPORTED
556# define PNG_GET_INT_32_SUPPORTED
557# endif
558#endif
559
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600560#endif /* PNG_READ_SUPPORTED */
561
Glenn Randers-Pehrson3b3e0902009-06-16 17:20:43 -0500562#ifdef PNG_WRITE_SUPPORTED
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600563
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500564/* PNG_WRITE_TRANSFORMS_NOT_SUPPORTED is deprecated. */
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -0500565#if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600566 !defined(PNG_NO_WRITE_TRANSFORMS)
567# define PNG_WRITE_TRANSFORMS_SUPPORTED
568#endif
569
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600570#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600571# ifndef PNG_NO_WRITE_SHIFT
572# define PNG_WRITE_SHIFT_SUPPORTED
573# endif
574# ifndef PNG_NO_WRITE_PACK
575# define PNG_WRITE_PACK_SUPPORTED
576# endif
577# ifndef PNG_NO_WRITE_BGR
578# define PNG_WRITE_BGR_SUPPORTED
579# endif
580# ifndef PNG_NO_WRITE_SWAP
581# define PNG_WRITE_SWAP_SUPPORTED
582# endif
583# ifndef PNG_NO_WRITE_PACKSWAP
584# define PNG_WRITE_PACKSWAP_SUPPORTED
585# endif
586# ifndef PNG_NO_WRITE_INVERT
587# define PNG_WRITE_INVERT_SUPPORTED
588# endif
589# ifndef PNG_NO_WRITE_FILLER
590# define PNG_WRITE_FILLER_SUPPORTED /* same as WRITE_STRIP_ALPHA */
591# endif
592# ifndef PNG_NO_WRITE_SWAP_ALPHA
593# define PNG_WRITE_SWAP_ALPHA_SUPPORTED
594# endif
595# ifndef PNG_NO_WRITE_INVERT_ALPHA
596# define PNG_WRITE_INVERT_ALPHA_SUPPORTED
597# endif
598# ifndef PNG_NO_WRITE_USER_TRANSFORM
599# define PNG_WRITE_USER_TRANSFORM_SUPPORTED
600# endif
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600601#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600602
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600603#if !defined(PNG_NO_WRITE_INTERLACING_SUPPORTED) && \
604 !defined(PNG_WRITE_INTERLACING_SUPPORTED)
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -0500605 /* This is not required for PNG-compliant encoders, but can cause
606 * trouble if left undefined
607 */
608# define PNG_WRITE_INTERLACING_SUPPORTED
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600609#endif
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600610
Glenn Randers-Pehrson38e6e772000-04-09 19:06:13 -0500611#if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600612 !defined(PNG_WRITE_WEIGHTED_FILTER) && \
Glenn Randers-Pehrson38e6e772000-04-09 19:06:13 -0500613 defined(PNG_FLOATING_POINT_SUPPORTED)
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600614# define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500615#endif
616
617#ifndef PNG_NO_WRITE_FLUSH
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600618# define PNG_WRITE_FLUSH_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500619#endif
620
Glenn Randers-Pehrson86dc9812006-05-10 07:27:44 -0500621#if !defined(PNG_NO_SAVE_INT_32) || defined(PNG_WRITE_oFFS_SUPPORTED) || \
622 defined(PNG_WRITE_pCAL_SUPPORTED)
623# ifndef PNG_SAVE_INT_32_SUPPORTED
624# define PNG_SAVE_INT_32_SUPPORTED
625# endif
626#endif
627
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600628#endif /* PNG_WRITE_SUPPORTED */
629
Glenn Randers-Pehrson895a9c92008-07-25 08:51:18 -0500630#define PNG_NO_ERROR_NUMBERS
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500631
632#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
633 defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
634# ifndef PNG_NO_USER_TRANSFORM_PTR
635# define PNG_USER_TRANSFORM_PTR_SUPPORTED
636# endif
637#endif
638
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500639#if defined(PNG_STDIO_SUPPORTED) && !defined(PNG_TIME_RFC1123_SUPPORTED)
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600640# define PNG_TIME_RFC1123_SUPPORTED
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -0600641#endif
Andreas Dilger47a0c421997-05-16 02:46:07 -0500642
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600643/* This adds extra functions in pngget.c for accessing data from the
644 * info pointer (added in version 0.99)
645 * png_get_image_width()
646 * png_get_image_height()
647 * png_get_bit_depth()
648 * png_get_color_type()
649 * png_get_compression_type()
650 * png_get_filter_type()
651 * png_get_interlace_type()
652 * png_get_pixel_aspect_ratio()
653 * png_get_pixels_per_meter()
654 * png_get_x_offset_pixels()
655 * png_get_y_offset_pixels()
656 * png_get_x_offset_microns()
657 * png_get_y_offset_microns()
658 */
Glenn Randers-Pehrson8b6a8892001-05-18 04:54:50 -0500659#if !defined(PNG_NO_EASY_ACCESS) && !defined(PNG_EASY_ACCESS_SUPPORTED)
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600660# define PNG_EASY_ACCESS_SUPPORTED
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600661#endif
662
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -0500663/* Added at libpng-1.2.0 */
Glenn Randers-Pehrson8b6a8892001-05-18 04:54:50 -0500664#if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED)
665# define PNG_USER_MEM_SUPPORTED
666#endif
667
Glenn Randers-Pehrson272489d2004-08-04 06:34:52 -0500668/* Added at libpng-1.2.6 */
Glenn Randers-Pehrson272489d2004-08-04 06:34:52 -0500669#ifndef PNG_SET_USER_LIMITS_SUPPORTED
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -0500670# ifndef PNG_NO_SET_USER_LIMITS
671# define PNG_SET_USER_LIMITS_SUPPORTED
672# endif
Glenn Randers-Pehrson272489d2004-08-04 06:34:52 -0500673#endif
Glenn Randers-Pehrson272489d2004-08-04 06:34:52 -0500674
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500675/* Added at libpng-1.0.16 and 1.2.6. To accept all valid PNGs no matter
Glenn Randers-Pehrson272489d2004-08-04 06:34:52 -0500676 * how large, set these limits to 0x7fffffffL
677 */
678#ifndef PNG_USER_WIDTH_MAX
679# define PNG_USER_WIDTH_MAX 1000000L
680#endif
681#ifndef PNG_USER_HEIGHT_MAX
682# define PNG_USER_HEIGHT_MAX 1000000L
683#endif
684
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500685/* Added at libpng-1.4.0 */
Glenn Randers-Pehrson800d1e92008-08-20 17:25:21 -0500686#ifndef PNG_USER_CHUNK_CACHE_MAX
Glenn Randers-Pehrsonf298db92009-10-31 21:32:08 -0500687# define PNG_USER_CHUNK_CACHE_MAX 0x7fffffffL
Glenn Randers-Pehrson800d1e92008-08-20 17:25:21 -0500688#endif
689
690/* Added at libpng-1.4.0 */
Glenn Randers-Pehrsoneb580912008-07-30 14:47:09 -0500691#if !defined(PNG_NO_IO_STATE) && !defined(PNG_IO_STATE_SUPPORTED)
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500692# define PNG_IO_STATE_SUPPORTED
693#endif
694
Glenn Randers-Pehrson43aaf6e2008-08-05 22:17:03 -0500695#ifndef PNG_LITERAL_SHARP
696# define PNG_LITERAL_SHARP 0x23
697#endif
Glenn Randers-Pehrson79084212008-08-04 13:31:41 -0500698#ifndef PNG_LITERAL_LEFT_SQUARE_BRACKET
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500699# define PNG_LITERAL_LEFT_SQUARE_BRACKET 0x5b
Glenn Randers-Pehrson79084212008-08-04 13:31:41 -0500700#endif
701#ifndef PNG_LITERAL_RIGHT_SQUARE_BRACKET
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500702# define PNG_LITERAL_RIGHT_SQUARE_BRACKET 0x5d
Glenn Randers-Pehrson79084212008-08-04 13:31:41 -0500703#endif
Glenn Randers-Pehrson43aaf6e2008-08-05 22:17:03 -0500704#ifndef PNG_STRING_NEWLINE
Glenn Randers-Pehrsone0784c72008-08-09 07:11:44 -0500705#define PNG_STRING_NEWLINE "\n"
Glenn Randers-Pehrson43aaf6e2008-08-05 22:17:03 -0500706#endif
Glenn Randers-Pehrson79084212008-08-04 13:31:41 -0500707
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600708/* These are currently experimental features, define them if you want */
709
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500710/* Very little testing */
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600711/*
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600712#ifdef PNG_READ_SUPPORTED
713# ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
714# define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
715# endif
716#endif
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600717*/
Andreas Dilger47a0c421997-05-16 02:46:07 -0500718
719/* This is only for PowerPC big-endian and 680x0 systems */
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600720/* some testing */
721/*
Glenn Randers-Pehrson272489d2004-08-04 06:34:52 -0500722#ifndef PNG_READ_BIG_ENDIAN_SUPPORTED
723# define PNG_READ_BIG_ENDIAN_SUPPORTED
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600724#endif
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600725*/
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500726
Glenn Randers-Pehrsoneb580912008-07-30 14:47:09 -0500727#if !defined(PNG_NO_USE_READ_MACROS) && !defined(PNG_USE_READ_MACROS)
728# define PNG_USE_READ_MACROS
729#endif
730
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500731/* Buggy compilers (e.g., gcc 2.7.2.2) need PNG_NO_POINTER_INDEXING */
732
733#if !defined(PNG_NO_POINTER_INDEXING) && \
734 !defined(PNG_POINTER_INDEXING_SUPPORTED)
735# define PNG_POINTER_INDEXING_SUPPORTED
736#endif
Glenn Randers-Pehrsond4366722000-06-04 14:29:29 -0500737
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600738
Andreas Dilger47a0c421997-05-16 02:46:07 -0500739/* Any chunks you are not interested in, you can undef here. The
740 * ones that allocate memory may be expecially important (hIST,
741 * tEXt, zTXt, tRNS, pCAL). Others will just save time and make png_info
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600742 * a bit smaller.
Andreas Dilger47a0c421997-05-16 02:46:07 -0500743 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500744
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500745/* The size of the png_text structure changed in libpng-1.0.6 when
746 * iTXt support was added. iTXt support was turned off by default through
747 * libpng-1.2.x, to support old apps that malloc the png_text structure
748 * instead of calling png_set_text() and letting libpng malloc it. It
749 * was turned on by default in libpng-1.4.0.
750 */
751
752/* PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED is deprecated. */
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600753#if defined(PNG_READ_SUPPORTED) && \
754 !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500755 !defined(PNG_NO_READ_ANCILLARY_CHUNKS)
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600756# define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600757#endif
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600758
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500759/* PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED is deprecated. */
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600760#if defined(PNG_WRITE_SUPPORTED) && \
761 !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500762 !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600763# define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600764#endif
765
766#ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600767
768#ifdef PNG_NO_READ_TEXT
769# define PNG_NO_READ_iTXt
770# define PNG_NO_READ_tEXt
771# define PNG_NO_READ_zTXt
772#endif
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500773
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500774#ifndef PNG_NO_READ_bKGD
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600775# define PNG_READ_bKGD_SUPPORTED
776# define PNG_bKGD_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500777#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500778#ifndef PNG_NO_READ_cHRM
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600779# define PNG_READ_cHRM_SUPPORTED
780# define PNG_cHRM_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500781#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500782#ifndef PNG_NO_READ_gAMA
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600783# define PNG_READ_gAMA_SUPPORTED
784# define PNG_gAMA_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500785#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500786#ifndef PNG_NO_READ_hIST
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600787# define PNG_READ_hIST_SUPPORTED
788# define PNG_hIST_SUPPORTED
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600789#endif
790#ifndef PNG_NO_READ_iCCP
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600791# define PNG_READ_iCCP_SUPPORTED
792# define PNG_iCCP_SUPPORTED
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600793#endif
794#ifndef PNG_NO_READ_iTXt
Glenn Randers-Pehrson5a0be342001-10-18 20:55:13 -0500795# ifndef PNG_READ_iTXt_SUPPORTED
796# define PNG_READ_iTXt_SUPPORTED
797# endif
798# ifndef PNG_iTXt_SUPPORTED
799# define PNG_iTXt_SUPPORTED
800# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500801#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500802#ifndef PNG_NO_READ_oFFs
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600803# define PNG_READ_oFFs_SUPPORTED
804# define PNG_oFFs_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500805#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500806#ifndef PNG_NO_READ_pCAL
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600807# define PNG_READ_pCAL_SUPPORTED
808# define PNG_pCAL_SUPPORTED
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600809#endif
810#ifndef PNG_NO_READ_sCAL
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600811# define PNG_READ_sCAL_SUPPORTED
812# define PNG_sCAL_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500813#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500814#ifndef PNG_NO_READ_pHYs
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600815# define PNG_READ_pHYs_SUPPORTED
816# define PNG_pHYs_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500817#endif
818#ifndef PNG_NO_READ_sBIT
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600819# define PNG_READ_sBIT_SUPPORTED
820# define PNG_sBIT_SUPPORTED
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600821#endif
822#ifndef PNG_NO_READ_sPLT
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600823# define PNG_READ_sPLT_SUPPORTED
824# define PNG_sPLT_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500825#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500826#ifndef PNG_NO_READ_sRGB
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600827# define PNG_READ_sRGB_SUPPORTED
828# define PNG_sRGB_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500829#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500830#ifndef PNG_NO_READ_tEXt
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600831# define PNG_READ_tEXt_SUPPORTED
832# define PNG_tEXt_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500833#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500834#ifndef PNG_NO_READ_tIME
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600835# define PNG_READ_tIME_SUPPORTED
836# define PNG_tIME_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500837#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500838#ifndef PNG_NO_READ_tRNS
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600839# define PNG_READ_tRNS_SUPPORTED
840# define PNG_tRNS_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500841#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500842#ifndef PNG_NO_READ_zTXt
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600843# define PNG_READ_zTXt_SUPPORTED
844# define PNG_zTXt_SUPPORTED
845#endif
Glenn Randers-Pehrson658ea432009-06-16 16:24:57 -0500846#ifndef PNG_NO_READ_OPT_PLTE
847# define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */
848#endif /* optional PLTE chunk in RGB and RGBA images */
849#if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \
850 defined(PNG_READ_zTXt_SUPPORTED)
851# define PNG_READ_TEXT_SUPPORTED
852# define PNG_TEXT_SUPPORTED
853#endif
854
855#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
856
Glenn Randers-Pehrson6942d532000-05-01 09:31:54 -0500857#ifndef PNG_NO_READ_UNKNOWN_CHUNKS
858# define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
Glenn Randers-Pehrson98c9d732000-05-03 21:06:11 -0500859# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
860# define PNG_UNKNOWN_CHUNKS_SUPPORTED
861# endif
Glenn Randers-Pehrson6942d532000-05-01 09:31:54 -0500862#endif
Glenn Randers-Pehrson3d5a5202000-07-01 15:37:28 -0500863#if !defined(PNG_NO_READ_USER_CHUNKS) && \
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500864 defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600865# define PNG_READ_USER_CHUNKS_SUPPORTED
866# define PNG_USER_CHUNKS_SUPPORTED
867# ifdef PNG_NO_READ_UNKNOWN_CHUNKS
868# undef PNG_NO_READ_UNKNOWN_CHUNKS
869# endif
870# ifdef PNG_NO_HANDLE_AS_UNKNOWN
871# undef PNG_NO_HANDLE_AS_UNKNOWN
872# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600873#endif
Glenn Randers-Pehrson7824a702009-06-13 10:05:05 -0500874#ifndef PNG_NO_HANDLE_AS_UNKNOWN
875# ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
876# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
877# endif
878#endif
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500879
Glenn Randers-Pehrson3b3e0902009-06-16 17:20:43 -0500880#ifdef PNG_WRITE_SUPPORTED
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600881#ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600882
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600883#ifdef PNG_NO_WRITE_TEXT
884# define PNG_NO_WRITE_iTXt
885# define PNG_NO_WRITE_tEXt
886# define PNG_NO_WRITE_zTXt
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600887#endif
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600888#ifndef PNG_NO_WRITE_bKGD
889# define PNG_WRITE_bKGD_SUPPORTED
890# ifndef PNG_bKGD_SUPPORTED
891# define PNG_bKGD_SUPPORTED
892# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500893#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500894#ifndef PNG_NO_WRITE_cHRM
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600895# define PNG_WRITE_cHRM_SUPPORTED
896# ifndef PNG_cHRM_SUPPORTED
897# define PNG_cHRM_SUPPORTED
898# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500899#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500900#ifndef PNG_NO_WRITE_gAMA
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600901# define PNG_WRITE_gAMA_SUPPORTED
902# ifndef PNG_gAMA_SUPPORTED
903# define PNG_gAMA_SUPPORTED
904# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500905#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500906#ifndef PNG_NO_WRITE_hIST
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600907# define PNG_WRITE_hIST_SUPPORTED
908# ifndef PNG_hIST_SUPPORTED
909# define PNG_hIST_SUPPORTED
910# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600911#endif
912#ifndef PNG_NO_WRITE_iCCP
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600913# define PNG_WRITE_iCCP_SUPPORTED
914# ifndef PNG_iCCP_SUPPORTED
915# define PNG_iCCP_SUPPORTED
916# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600917#endif
918#ifndef PNG_NO_WRITE_iTXt
Glenn Randers-Pehrson5a0be342001-10-18 20:55:13 -0500919# ifndef PNG_WRITE_iTXt_SUPPORTED
920# define PNG_WRITE_iTXt_SUPPORTED
921# endif
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600922# ifndef PNG_iTXt_SUPPORTED
923# define PNG_iTXt_SUPPORTED
924# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500925#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500926#ifndef PNG_NO_WRITE_oFFs
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600927# define PNG_WRITE_oFFs_SUPPORTED
928# ifndef PNG_oFFs_SUPPORTED
929# define PNG_oFFs_SUPPORTED
930# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500931#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500932#ifndef PNG_NO_WRITE_pCAL
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600933# define PNG_WRITE_pCAL_SUPPORTED
934# ifndef PNG_pCAL_SUPPORTED
935# define PNG_pCAL_SUPPORTED
936# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600937#endif
938#ifndef PNG_NO_WRITE_sCAL
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600939# define PNG_WRITE_sCAL_SUPPORTED
940# ifndef PNG_sCAL_SUPPORTED
941# define PNG_sCAL_SUPPORTED
942# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500943#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500944#ifndef PNG_NO_WRITE_pHYs
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600945# define PNG_WRITE_pHYs_SUPPORTED
946# ifndef PNG_pHYs_SUPPORTED
947# define PNG_pHYs_SUPPORTED
948# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500949#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500950#ifndef PNG_NO_WRITE_sBIT
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600951# define PNG_WRITE_sBIT_SUPPORTED
952# ifndef PNG_sBIT_SUPPORTED
953# define PNG_sBIT_SUPPORTED
954# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600955#endif
956#ifndef PNG_NO_WRITE_sPLT
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600957# define PNG_WRITE_sPLT_SUPPORTED
958# ifndef PNG_sPLT_SUPPORTED
959# define PNG_sPLT_SUPPORTED
960# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500961#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500962#ifndef PNG_NO_WRITE_sRGB
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600963# define PNG_WRITE_sRGB_SUPPORTED
964# ifndef PNG_sRGB_SUPPORTED
965# define PNG_sRGB_SUPPORTED
966# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500967#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500968#ifndef PNG_NO_WRITE_tEXt
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600969# define PNG_WRITE_tEXt_SUPPORTED
970# ifndef PNG_tEXt_SUPPORTED
971# define PNG_tEXt_SUPPORTED
972# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500973#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500974#ifndef PNG_NO_WRITE_tIME
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600975# define PNG_WRITE_tIME_SUPPORTED
976# ifndef PNG_tIME_SUPPORTED
977# define PNG_tIME_SUPPORTED
978# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500979#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500980#ifndef PNG_NO_WRITE_tRNS
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600981# define PNG_WRITE_tRNS_SUPPORTED
982# ifndef PNG_tRNS_SUPPORTED
983# define PNG_tRNS_SUPPORTED
984# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500985#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500986#ifndef PNG_NO_WRITE_zTXt
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600987# define PNG_WRITE_zTXt_SUPPORTED
988# ifndef PNG_zTXt_SUPPORTED
989# define PNG_zTXt_SUPPORTED
990# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600991#endif
Glenn Randers-Pehrson658ea432009-06-16 16:24:57 -0500992#if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \
993 defined(PNG_WRITE_zTXt_SUPPORTED)
994# define PNG_WRITE_TEXT_SUPPORTED
995# ifndef PNG_TEXT_SUPPORTED
996# define PNG_TEXT_SUPPORTED
997# endif
998#endif
999
1000#endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
1001
Glenn Randers-Pehrsond6ea40a2009-11-02 07:32:00 -06001002#define PNG_CONVERT_tIME_SUPPORTED (PNG_tIME_SUPPORTED && !WIN32_WCE)
1003
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -05001004#if !defined(PNG_NO_WRITE_FILTER) && !defined(PNG_WRITE_FILTER_SUPPORTED)
1005# define PNG_WRITE_FILTER_SUPPORTED
1006#endif
1007
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -06001008#ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -06001009# define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
1010# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
1011# define PNG_UNKNOWN_CHUNKS_SUPPORTED
1012# endif
Glenn Randers-Pehrson7824a702009-06-13 10:05:05 -05001013#endif
1014#ifndef PNG_NO_HANDLE_AS_UNKNOWN
1015# ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
1016# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -06001017# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -06001018#endif
Glenn Randers-Pehrson3b3e0902009-06-16 17:20:43 -05001019#endif /* PNG_WRITE_SUPPORTED */
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001020
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -06001021/* Turn this off to disable png_read_png() and
Glenn Randers-Pehrsona77ef622000-02-18 13:48:52 -06001022 * png_write_png() and leave the row_pointers member
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -06001023 * out of the info structure.
1024 */
1025#ifndef PNG_NO_INFO_IMAGE
1026# define PNG_INFO_IMAGE_SUPPORTED
1027#endif
1028
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -05001029/* Need the time information for reading tIME chunks */
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -05001030#ifdef PNG_tIME_SUPPORTED
Glenn Randers-Pehrson316f97a2000-07-08 13:19:41 -05001031# include <time.h>
Andreas Dilger47a0c421997-05-16 02:46:07 -05001032#endif
1033
Andreas Dilger02ad0ef1997-01-17 01:34:35 -06001034/* Some typedefs to get us started. These should be safe on most of the
Andreas Dilger47a0c421997-05-16 02:46:07 -05001035 * common platforms. The typedefs should be at least as large as the
1036 * numbers suggest (a png_uint_32 must be at least 32 bits long), but they
1037 * don't have to be exactly that size. Some compilers dislike passing
1038 * unsigned shorts as function parameters, so you may be better off using
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -05001039 * unsigned int for png_uint_16.
Andreas Dilger47a0c421997-05-16 02:46:07 -05001040 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001041
Glenn Randers-Pehrson6bc53be2006-06-16 07:52:03 -05001042#if defined(INT_MAX) && (INT_MAX > 0x7ffffffeL)
1043typedef unsigned int png_uint_32;
1044typedef int png_int_32;
1045#else
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001046typedef unsigned long png_uint_32;
1047typedef long png_int_32;
Glenn Randers-Pehrson6bc53be2006-06-16 07:52:03 -05001048#endif
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001049typedef unsigned short png_uint_16;
1050typedef short png_int_16;
1051typedef unsigned char png_byte;
1052
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -05001053#ifdef PNG_NO_SIZE_T
1054 typedef unsigned int png_size_t;
Glenn Randers-Pehrson5fea36f2004-07-28 08:20:44 -05001055#else
1056 typedef size_t png_size_t;
Glenn Randers-Pehrson5fea36f2004-07-28 08:20:44 -05001057#endif
Glenn Randers-Pehrson145f5c82008-07-10 09:13:13 -05001058#define png_sizeof(x) sizeof(x)
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001059
Andreas Dilger47a0c421997-05-16 02:46:07 -05001060/* The following is needed for medium model support. It cannot be in the
Glenn Randers-Pehrson6a9c2ce2009-03-27 19:30:10 -05001061 * pngpriv.h header. Needs modification for other compilers besides
Andreas Dilger47a0c421997-05-16 02:46:07 -05001062 * MSC. Model independent support declares all arrays and pointers to be
1063 * large using the far keyword. The zlib version used must also support
1064 * model independent data. As of version zlib 1.0.4, the necessary changes
1065 * have been made in zlib. The USE_FAR_KEYWORD define triggers other
1066 * changes that are needed. (Tim Wegner)
1067 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001068
Andreas Dilger02ad0ef1997-01-17 01:34:35 -06001069/* Separate compiler dependencies (problem here is that zlib.h always
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -05001070 * defines FAR. (SJT)
1071 */
Guy Schalnat6d764711995-12-19 03:22:19 -06001072#ifdef __BORLANDC__
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001073# if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
1074# define LDATA 1
1075# else
1076# define LDATA 0
1077# endif
1078 /* GRR: why is Cygwin in here? Cygwin is not Borland C... */
1079# if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__)
1080# define PNG_MAX_MALLOC_64K
1081# if (LDATA != 1)
1082# ifndef FAR
1083# define FAR __far
1084# endif
1085# define USE_FAR_KEYWORD
1086# endif /* LDATA != 1 */
1087 /* Possibly useful for moving data out of default segment.
1088 * Uncomment it if you want. Could also define FARDATA as
1089 * const if your compiler supports it. (SJT)
1090# define FARDATA FAR
1091 */
1092# endif /* __WIN32__, __FLAT__, __CYGWIN__ */
Guy Schalnatb2e01bd1996-01-26 01:38:47 -06001093#endif /* __BORLANDC__ */
Guy Schalnat6d764711995-12-19 03:22:19 -06001094
1095
Andreas Dilger02ad0ef1997-01-17 01:34:35 -06001096/* Suggest testing for specific compiler first before testing for
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -06001097 * FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM,
1098 * making reliance oncertain keywords suspect. (SJT)
1099 */
Guy Schalnat6d764711995-12-19 03:22:19 -06001100
1101/* MSC Medium model */
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -05001102#ifdef FAR
1103# ifdef M_I86MM
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001104# define USE_FAR_KEYWORD
1105# define FARDATA FAR
1106# include <dos.h>
Guy Schalnat6d764711995-12-19 03:22:19 -06001107# endif
1108#endif
1109
1110/* SJT: default case */
1111#ifndef FAR
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001112# define FAR
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001113#endif
1114
Andreas Dilger47a0c421997-05-16 02:46:07 -05001115/* At this point FAR is always defined */
Guy Schalnat6d764711995-12-19 03:22:19 -06001116#ifndef FARDATA
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001117# define FARDATA
Guy Schalnat6d764711995-12-19 03:22:19 -06001118#endif
1119
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -06001120/* Typedef for floating-point numbers that are converted
1121 to fixed-point with a multiple of 100,000, e.g., int_gamma */
1122typedef png_int_32 png_fixed_point;
1123
Andreas Dilger47a0c421997-05-16 02:46:07 -05001124/* Add typedefs for pointers */
Andreas Dilger02ad0ef1997-01-17 01:34:35 -06001125typedef void FAR * png_voidp;
Guy Schalnat6d764711995-12-19 03:22:19 -06001126typedef png_byte FAR * png_bytep;
1127typedef png_uint_32 FAR * png_uint_32p;
1128typedef png_int_32 FAR * png_int_32p;
1129typedef png_uint_16 FAR * png_uint_16p;
1130typedef png_int_16 FAR * png_int_16p;
1131typedef PNG_CONST char FAR * png_const_charp;
1132typedef char FAR * png_charp;
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -06001133typedef png_fixed_point FAR * png_fixed_point_p;
Glenn Randers-Pehrsonbe9de0f2001-01-22 08:52:16 -06001134
1135#ifndef PNG_NO_STDIO
Glenn Randers-Pehrson316f97a2000-07-08 13:19:41 -05001136typedef FILE * png_FILE_p;
Glenn Randers-Pehrsonbe9de0f2001-01-22 08:52:16 -06001137#endif
1138
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -06001139#ifdef PNG_FLOATING_POINT_SUPPORTED
Andreas Dilger47a0c421997-05-16 02:46:07 -05001140typedef double FAR * png_doublep;
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -06001141#endif
Guy Schalnat6d764711995-12-19 03:22:19 -06001142
Andreas Dilger47a0c421997-05-16 02:46:07 -05001143/* Pointers to pointers; i.e. arrays */
Guy Schalnat6d764711995-12-19 03:22:19 -06001144typedef png_byte FAR * FAR * png_bytepp;
1145typedef png_uint_32 FAR * FAR * png_uint_32pp;
1146typedef png_int_32 FAR * FAR * png_int_32pp;
1147typedef png_uint_16 FAR * FAR * png_uint_16pp;
1148typedef png_int_16 FAR * FAR * png_int_16pp;
1149typedef PNG_CONST char FAR * FAR * png_const_charpp;
1150typedef char FAR * FAR * png_charpp;
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -06001151typedef png_fixed_point FAR * FAR * png_fixed_point_pp;
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -06001152#ifdef PNG_FLOATING_POINT_SUPPORTED
Andreas Dilger47a0c421997-05-16 02:46:07 -05001153typedef double FAR * FAR * png_doublepp;
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -06001154#endif
Guy Schalnat6d764711995-12-19 03:22:19 -06001155
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001156/* Pointers to pointers to pointers; i.e., pointer to array */
Andreas Dilger47a0c421997-05-16 02:46:07 -05001157typedef char FAR * FAR * FAR * png_charppp;
Guy Schalnat6d764711995-12-19 03:22:19 -06001158
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -05001159/* Define PNG_BUILD_DLL if the module being built is a Windows
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001160 * LIBPNG DLL.
1161 *
Glenn Randers-Pehrsond4366722000-06-04 14:29:29 -05001162 * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL.
Glenn Randers-Pehrsond4e81092001-01-31 05:56:52 -06001163 * It is equivalent to Microsoft predefined macro _DLL that is
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001164 * automatically defined when you compile using the share
1165 * version of the CRT (C Run-Time library)
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -06001166 *
1167 * The cygwin mods make this behavior a little different:
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -05001168 * Define PNG_BUILD_DLL if you are building a dll for use with cygwin
1169 * Define PNG_STATIC if you are building a static library for use with cygwin,
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -06001170 * -or- if you are building an application that you want to link to the
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -05001171 * static library.
1172 * PNG_USE_DLL is defined by default (no user action needed) unless one of
1173 * the other flags is defined.
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001174 */
1175
Glenn Randers-Pehrsond4366722000-06-04 14:29:29 -05001176#if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL))
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001177# define PNG_DLL
1178#endif
Glenn Randers-Pehrsonec61c232000-05-16 06:17:36 -05001179
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -05001180#ifdef __CYGWIN__
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -05001181# undef PNGAPI
1182# define PNGAPI __cdecl
1183# undef PNG_IMPEXP
1184# define PNG_IMPEXP
Glenn Randers-Pehrson7824a702009-06-13 10:05:05 -05001185#endif
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -05001186
Glenn Randers-Pehrson9e978842009-08-31 14:28:33 -05001187#define PNG_USE_LOCAL_ARRAYS /* Not used in libpng, defined for legacy apps */
1188
Glenn Randers-Pehrson25d82242002-05-01 11:51:26 -05001189/* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall",
1190 * you may get warnings regarding the linkage of png_zalloc and png_zfree.
1191 * Don't ignore those warnings; you must also reset the default calling
1192 * convention in your compiler to match your PNGAPI, and you must build
1193 * zlib and your applications the same way you build libpng.
1194 */
1195
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -05001196#if defined(__MINGW32__) && !defined(PNG_MODULEDEF)
Glenn Randers-Pehrson13944802000-06-24 07:42:42 -05001197# ifndef PNG_NO_MODULEDEF
1198# define PNG_NO_MODULEDEF
1199# endif
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -06001200#endif
1201
Glenn Randers-Pehrson13944802000-06-24 07:42:42 -05001202#if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF)
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001203# define PNG_IMPEXP
1204#endif
1205
1206#if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -05001207 (( defined(_Windows) || defined(_WINDOWS) || \
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -05001208 defined(WIN32) || defined(_WIN32) || defined(__WIN32__) ))
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001209
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -05001210# ifndef PNGAPI
1211# if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
1212# define PNGAPI __cdecl
1213# else
1214# define PNGAPI _cdecl
1215# endif
Glenn Randers-Pehrson13944802000-06-24 07:42:42 -05001216# endif
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001217
1218# if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \
1219 0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */)
1220# define PNG_IMPEXP
1221# endif
1222
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -05001223# ifndef PNG_IMPEXP
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001224
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -05001225# define PNG_EXPORT_TYPE1(type,symbol) PNG_IMPEXP type PNGAPI symbol
1226# define PNG_EXPORT_TYPE2(type,symbol) type PNG_IMPEXP PNGAPI symbol
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001227
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -05001228 /* Borland/Microsoft */
1229# if defined(_MSC_VER) || defined(__BORLANDC__)
1230# if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500)
1231# define PNG_EXPORT PNG_EXPORT_TYPE1
1232# else
1233# define PNG_EXPORT PNG_EXPORT_TYPE2
1234# ifdef PNG_BUILD_DLL
1235# define PNG_IMPEXP __export
1236# else
1237# define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in VC++ */
1238# endif /* Exists in Borland C++ for
1239 C++ classes (== huge) */
1240# endif
1241# endif
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001242
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -05001243# ifndef PNG_IMPEXP
1244# ifdef PNG_BUILD_DLL
1245# define PNG_IMPEXP __declspec(dllexport)
1246# else
1247# define PNG_IMPEXP __declspec(dllimport)
1248# endif
1249# endif
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001250# endif /* PNG_IMPEXP */
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -05001251#else /* !(DLL || non-cygwin WINDOWS) */
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -05001252# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -05001253# ifndef PNGAPI
1254# define PNGAPI _System
1255# endif
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -05001256# else
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -05001257# if 0 /* ... other platforms, with other meanings */
1258# endif
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -05001259# endif
Glenn Randers-Pehrson13944802000-06-24 07:42:42 -05001260#endif
Andreas Dilger47a0c421997-05-16 02:46:07 -05001261
Glenn Randers-Pehrson5e5c1e12000-11-10 12:26:19 -06001262#ifndef PNGAPI
1263# define PNGAPI
1264#endif
1265#ifndef PNG_IMPEXP
1266# define PNG_IMPEXP
1267#endif
1268
Glenn Randers-Pehrsonc3dda6d2004-11-27 18:22:29 -06001269#ifdef PNG_BUILDSYMS
1270# ifndef PNG_EXPORT
1271# define PNG_EXPORT(type,symbol) PNG_FUNCTION_EXPORT symbol END
1272# endif
Glenn Randers-Pehrsonc3dda6d2004-11-27 18:22:29 -06001273#endif
1274
Glenn Randers-Pehrsonf8b008c1999-09-18 10:54:36 -05001275#ifndef PNG_EXPORT
Glenn Randers-Pehrson13944802000-06-24 07:42:42 -05001276# define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -06001277#endif
1278
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -05001279/* Users may want to use these so they are not private. Any library
1280 * functions that are passed far data must be model-independent.
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -06001281 */
Andreas Dilger02ad0ef1997-01-17 01:34:35 -06001282
Glenn Randers-Pehrsona77ef622000-02-18 13:48:52 -06001283#ifdef PNG_SETJMP_SUPPORTED
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001284# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
Glenn Randers-Pehrson520a7642000-03-21 05:13:06 -06001285#else
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001286# define png_jmpbuf(png_ptr) \
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -05001287 (LIBPNG_WAS_COMPILED_WITH__PNG_NO_SETJMP)
Glenn Randers-Pehrsona77ef622000-02-18 13:48:52 -06001288#endif
1289
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -05001290/* memory model/platform independent fns */
1291#ifndef PNG_ABORT
1292# ifdef _WINDOWS_
1293# define PNG_ABORT() ExitProcess(0)
1294# else
1295# define PNG_ABORT() abort()
1296# endif
1297#endif
1298
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -05001299#ifdef USE_FAR_KEYWORD
Andreas Dilger02ad0ef1997-01-17 01:34:35 -06001300/* use this to make far-to-near assignments */
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001301# define CHECK 1
1302# define NOCHECK 0
1303# define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
1304# define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -05001305# define png_strcpy _fstrcpy
1306# define png_strncpy _fstrncpy /* Added to v 1.2.6 */
1307# define png_strlen _fstrlen
1308# define png_memcmp _fmemcmp /* SJT: added */
1309# define png_memcpy _fmemcpy
Glenn Randers-Pehrson8551d592009-08-29 16:25:19 -05001310# define png_memset _fmemset
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -05001311# define png_sprintf sprintf
1312#else
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -05001313# ifdef _WINDOWS_ /* favor Windows over C runtime fns */
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -05001314# define CVT_PTR(ptr) (ptr)
1315# define CVT_PTR_NOCHECK(ptr) (ptr)
1316# define png_strcpy lstrcpyA
1317# define png_strncpy lstrcpynA
1318# define png_strlen lstrlenA
1319# define png_memcmp memcmp
1320# define png_memcpy CopyMemory
1321# define png_memset memset
1322# define png_sprintf wsprintfA
1323# else
1324# define CVT_PTR(ptr) (ptr)
1325# define CVT_PTR_NOCHECK(ptr) (ptr)
1326# define png_strcpy strcpy
1327# define png_strncpy strncpy /* Added to v 1.2.6 */
1328# define png_strlen strlen
1329# define png_memcmp memcmp /* SJT: added */
1330# define png_memcpy memcpy
1331# define png_memset memset
1332# define png_sprintf sprintf
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -05001333# ifndef PNG_NO_SNPRINTF
1334# ifdef _MSC_VER
1335# define png_snprintf _snprintf /* Added to v 1.2.19 */
1336# define png_snprintf2 _snprintf
1337# define png_snprintf6 _snprintf
1338# else
1339# define png_snprintf snprintf /* Added to v 1.2.19 */
1340# define png_snprintf2 snprintf
1341# define png_snprintf6 snprintf
1342# endif
Glenn Randers-Pehrson145f5c82008-07-10 09:13:13 -05001343# else
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -05001344 /* You don't have or don't want to use snprintf(). Caution: Using
1345 * sprintf instead of snprintf exposes your application to accidental
1346 * or malevolent buffer overflows. If you don't have snprintf()
1347 * as a general rule you should provide one (you can get one from
1348 * Portable OpenSSH).
1349 */
1350# define png_snprintf(s1,n,fmt,x1) sprintf(s1,fmt,x1)
1351# define png_snprintf2(s1,n,fmt,x1,x2) sprintf(s1,fmt,x1,x2)
1352# define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \
1353 sprintf(s1,fmt,x1,x2,x3,x4,x5,x6)
Glenn Randers-Pehrson145f5c82008-07-10 09:13:13 -05001354# endif
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -05001355# endif
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001356#endif
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -05001357
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -05001358/* png_alloc_size_t is guaranteed to be no smaller than png_size_t,
1359 * and no smaller than png_uint_32. Casts from png_size_t or png_uint_32
1360 * to png_alloc_size_t are not necessary; in fact, it is recommended
1361 * not to use them at all so that the compiler can complain when something
1362 * turns out to be problematic.
1363 * Casts in the other direction (from png_alloc_size_t to png_size_t or
1364 * png_uint_32) should be explicitly applied; however, we do not expect
1365 * to encounter practical situations that require such conversions.
1366 */
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -05001367#if defined(__TURBOC__) && !defined(__FLAT__)
1368# define png_mem_alloc farmalloc
1369# define png_mem_free farfree
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -05001370 typedef unsigned long png_alloc_size_t;
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -05001371#else
1372# if defined(_MSC_VER) && defined(MAXSEG_64K)
1373# define png_mem_alloc(s) halloc(s, 1)
1374# define png_mem_free hfree
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -05001375 typedef unsigned long png_alloc_size_t;
1376# else
1377# if defined(_WINDOWS_) && (!defined(INT_MAX) || INT_MAX <= 0x7ffffffeL)
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -05001378# define png_mem_alloc(s) HeapAlloc(GetProcessHeap(), 0, s)
1379# define png_mem_free(p) HeapFree(GetProcessHeap(), 0, p)
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -05001380 typedef DWORD png_alloc_size_t;
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -05001381# else
1382# define png_mem_alloc malloc
1383# define png_mem_free free
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -05001384 typedef png_size_t png_alloc_size_t;
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -05001385# endif
1386# endif
1387#endif
1388/* End of memory model/platform independent support */
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001389
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -06001390/* Just a little check that someone hasn't tried to define something
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -06001391 * contradictory.
Andreas Dilger47a0c421997-05-16 02:46:07 -05001392 */
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -05001393#if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K)
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001394# undef PNG_ZBUF_SIZE
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -05001395# define PNG_ZBUF_SIZE 65536L
Andreas Dilger47a0c421997-05-16 02:46:07 -05001396#endif
1397
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001398
Glenn Randers-Pehrson5dd2b8e2004-11-24 07:50:16 -06001399/* Added at libpng-1.2.8 */
1400#endif /* PNG_VERSION_INFO_ONLY */
Glenn Randers-Pehrson40936072004-11-20 11:18:40 -06001401
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001402#endif /* PNGCONF_H */