blob: e8cdee8f76d1fcf452ab6d24f24bf36ae41840a5 [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-Pehrsond708cb82009-11-12 22:35:16 -06004 * libpng version 1.4.0beta98 - November 13, 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-Pehrson28d4aae2009-11-13 16:29:45 -0600422#ifndef PNG_CONST
423# ifndef PNG_NO_CONST
424# define PNG_CONST const
425# else
426# define PNG_CONST
427# endif
Guy Schalnat6d764711995-12-19 03:22:19 -0600428#endif
429
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600430/* The following defines give you the ability to remove code from the
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600431 * library that you will not be using. I wish I could figure out how to
432 * automate this, but I can't do that without making it seriously hard
433 * on the users. So if you are not using an ability, change the #define
434 * to and #undef, and that part of the library will not be compiled. If
435 * your linker can't find a function, you may want to make sure the
436 * ability is defined here. Some of these depend upon some others being
437 * defined. I haven't figured out all the interactions here, so you may
438 * have to experiment awhile to get everything to compile. If you are
439 * creating or using a shared library, you probably shouldn't touch this,
440 * as it will affect the size of the structures, and this will cause bad
441 * things to happen if the library and/or application ever change.
442 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500443
Glenn Randers-Pehrson38e6e772000-04-09 19:06:13 -0500444/* Any features you will not be using can be undef'ed here */
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600445
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600446/* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500447 * to turn it off with PNG_NO_READ|WRITE_TRANSFORMS on the compile line,
448 * then pick and choose which ones to define without having to edit this
449 * file. It is safe to use the PNG_NO_READ|WRITE_TRANSFORMS
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500450 * if you only want to have a png-compliant reader/writer but don't need
451 * any of the extra transformations. This saves about 80 kbytes in a
452 * typical installation of the library. (PNG_NO_* form added in version
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500453 * 1.0.1c, for consistency; PNG_*_TRANSFORMS_NOT_SUPPORTED deprecated in
454 * 1.4.0)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600455 */
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600456
Glenn Randers-Pehrson6942d532000-05-01 09:31:54 -0500457/* Ignore attempt to turn off both floating and fixed point support */
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500458#if !defined(PNG_FLOATING_POINT_SUPPORTED) || \
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600459 !defined(PNG_NO_FIXED_POINT_SUPPORTED)
460# define PNG_FIXED_POINT_SUPPORTED
Glenn Randers-Pehrson38e6e772000-04-09 19:06:13 -0500461#endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600462
Glenn Randers-Pehrson3b3e0902009-06-16 17:20:43 -0500463#ifdef PNG_READ_SUPPORTED
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600464
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500465/* PNG_READ_TRANSFORMS_NOT_SUPPORTED is deprecated. */
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500466#if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600467 !defined(PNG_NO_READ_TRANSFORMS)
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600468# define PNG_READ_TRANSFORMS_SUPPORTED
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600469#endif
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600470
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600471#ifdef PNG_READ_TRANSFORMS_SUPPORTED
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600472# ifndef PNG_NO_READ_EXPAND
473# define PNG_READ_EXPAND_SUPPORTED
474# endif
475# ifndef PNG_NO_READ_SHIFT
476# define PNG_READ_SHIFT_SUPPORTED
477# endif
478# ifndef PNG_NO_READ_PACK
479# define PNG_READ_PACK_SUPPORTED
480# endif
481# ifndef PNG_NO_READ_BGR
482# define PNG_READ_BGR_SUPPORTED
483# endif
484# ifndef PNG_NO_READ_SWAP
485# define PNG_READ_SWAP_SUPPORTED
486# endif
487# ifndef PNG_NO_READ_PACKSWAP
488# define PNG_READ_PACKSWAP_SUPPORTED
489# endif
490# ifndef PNG_NO_READ_INVERT
491# define PNG_READ_INVERT_SUPPORTED
492# endif
Glenn Randers-Pehrson4a82d692008-12-15 16:25:05 -0600493#if 0 /* removed from libpng-1.4.0 */
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600494# ifndef PNG_NO_READ_DITHER
495# define PNG_READ_DITHER_SUPPORTED
496# endif
Glenn Randers-Pehrson4a82d692008-12-15 16:25:05 -0600497#endif /* 0 */
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600498# ifndef PNG_NO_READ_BACKGROUND
499# define PNG_READ_BACKGROUND_SUPPORTED
500# endif
501# ifndef PNG_NO_READ_16_TO_8
502# define PNG_READ_16_TO_8_SUPPORTED
503# endif
504# ifndef PNG_NO_READ_FILLER
505# define PNG_READ_FILLER_SUPPORTED
506# endif
507# ifndef PNG_NO_READ_GAMMA
508# define PNG_READ_GAMMA_SUPPORTED
509# endif
510# ifndef PNG_NO_READ_GRAY_TO_RGB
511# define PNG_READ_GRAY_TO_RGB_SUPPORTED
512# endif
513# ifndef PNG_NO_READ_SWAP_ALPHA
514# define PNG_READ_SWAP_ALPHA_SUPPORTED
515# endif
516# ifndef PNG_NO_READ_INVERT_ALPHA
517# define PNG_READ_INVERT_ALPHA_SUPPORTED
518# endif
Glenn Randers-Pehrson1916f6a2008-08-14 13:44:49 -0500519# ifndef PNG_NO_READ_PREMULTIPLY_ALPHA
520# define PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED
521# endif
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600522# ifndef PNG_NO_READ_STRIP_ALPHA
523# define PNG_READ_STRIP_ALPHA_SUPPORTED
524# endif
525# ifndef PNG_NO_READ_USER_TRANSFORM
526# define PNG_READ_USER_TRANSFORM_SUPPORTED
527# endif
528# ifndef PNG_NO_READ_RGB_TO_GRAY
529# define PNG_READ_RGB_TO_GRAY_SUPPORTED
530# endif
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600531#endif /* PNG_READ_TRANSFORMS_SUPPORTED */
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600532
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500533/* PNG_PROGRESSIVE_READ_NOT_SUPPORTED is deprecated. */
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500534#if !defined(PNG_NO_PROGRESSIVE_READ) && \
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600535 !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */
536# define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600537#endif /* about interlacing capability! You'll */
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500538 /* still have interlacing unless you change the following define: */
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600539
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600540#define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500541
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500542/* PNG_NO_SEQUENTIAL_READ_SUPPORTED is deprecated. */
543#if !defined(PNG_NO_SEQUENTIAL_READ) && \
544 !defined(PNG_SEQUENTIAL_READ_SUPPORTED) && \
545 !defined(PNG_NO_SEQUENTIAL_READ_SUPPORTED)
546# define PNG_SEQUENTIAL_READ_SUPPORTED
547#endif
548
Glenn Randers-Pehrson98c9d732000-05-03 21:06:11 -0500549#ifndef PNG_NO_READ_COMPOSITE_NODIV
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600550# ifndef PNG_NO_READ_COMPOSITED_NODIV /* libpng-1.0.x misspelling */
551# define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel, SGI */
552# endif
Glenn Randers-Pehrson98c9d732000-05-03 21:06:11 -0500553#endif
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500554
Glenn Randers-Pehrson86dc9812006-05-10 07:27:44 -0500555#if !defined(PNG_NO_GET_INT_32) || defined(PNG_READ_oFFS_SUPPORTED) || \
556 defined(PNG_READ_pCAL_SUPPORTED)
557# ifndef PNG_GET_INT_32_SUPPORTED
558# define PNG_GET_INT_32_SUPPORTED
559# endif
560#endif
561
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600562#endif /* PNG_READ_SUPPORTED */
563
Glenn Randers-Pehrson3b3e0902009-06-16 17:20:43 -0500564#ifdef PNG_WRITE_SUPPORTED
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600565
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500566/* PNG_WRITE_TRANSFORMS_NOT_SUPPORTED is deprecated. */
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -0500567#if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600568 !defined(PNG_NO_WRITE_TRANSFORMS)
569# define PNG_WRITE_TRANSFORMS_SUPPORTED
570#endif
571
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600572#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600573# ifndef PNG_NO_WRITE_SHIFT
574# define PNG_WRITE_SHIFT_SUPPORTED
575# endif
576# ifndef PNG_NO_WRITE_PACK
577# define PNG_WRITE_PACK_SUPPORTED
578# endif
579# ifndef PNG_NO_WRITE_BGR
580# define PNG_WRITE_BGR_SUPPORTED
581# endif
582# ifndef PNG_NO_WRITE_SWAP
583# define PNG_WRITE_SWAP_SUPPORTED
584# endif
585# ifndef PNG_NO_WRITE_PACKSWAP
586# define PNG_WRITE_PACKSWAP_SUPPORTED
587# endif
588# ifndef PNG_NO_WRITE_INVERT
589# define PNG_WRITE_INVERT_SUPPORTED
590# endif
591# ifndef PNG_NO_WRITE_FILLER
592# define PNG_WRITE_FILLER_SUPPORTED /* same as WRITE_STRIP_ALPHA */
593# endif
594# ifndef PNG_NO_WRITE_SWAP_ALPHA
595# define PNG_WRITE_SWAP_ALPHA_SUPPORTED
596# endif
597# ifndef PNG_NO_WRITE_INVERT_ALPHA
598# define PNG_WRITE_INVERT_ALPHA_SUPPORTED
599# endif
600# ifndef PNG_NO_WRITE_USER_TRANSFORM
601# define PNG_WRITE_USER_TRANSFORM_SUPPORTED
602# endif
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600603#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600604
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600605#if !defined(PNG_NO_WRITE_INTERLACING_SUPPORTED) && \
606 !defined(PNG_WRITE_INTERLACING_SUPPORTED)
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -0500607 /* This is not required for PNG-compliant encoders, but can cause
608 * trouble if left undefined
609 */
610# define PNG_WRITE_INTERLACING_SUPPORTED
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600611#endif
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600612
Glenn Randers-Pehrson38e6e772000-04-09 19:06:13 -0500613#if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600614 !defined(PNG_WRITE_WEIGHTED_FILTER) && \
Glenn Randers-Pehrson38e6e772000-04-09 19:06:13 -0500615 defined(PNG_FLOATING_POINT_SUPPORTED)
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600616# define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500617#endif
618
619#ifndef PNG_NO_WRITE_FLUSH
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600620# define PNG_WRITE_FLUSH_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500621#endif
622
Glenn Randers-Pehrson86dc9812006-05-10 07:27:44 -0500623#if !defined(PNG_NO_SAVE_INT_32) || defined(PNG_WRITE_oFFS_SUPPORTED) || \
624 defined(PNG_WRITE_pCAL_SUPPORTED)
625# ifndef PNG_SAVE_INT_32_SUPPORTED
626# define PNG_SAVE_INT_32_SUPPORTED
627# endif
628#endif
629
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600630#endif /* PNG_WRITE_SUPPORTED */
631
Glenn Randers-Pehrson895a9c92008-07-25 08:51:18 -0500632#define PNG_NO_ERROR_NUMBERS
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500633
634#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
635 defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
636# ifndef PNG_NO_USER_TRANSFORM_PTR
637# define PNG_USER_TRANSFORM_PTR_SUPPORTED
638# endif
639#endif
640
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500641#if defined(PNG_STDIO_SUPPORTED) && !defined(PNG_TIME_RFC1123_SUPPORTED)
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600642# define PNG_TIME_RFC1123_SUPPORTED
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -0600643#endif
Andreas Dilger47a0c421997-05-16 02:46:07 -0500644
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600645/* This adds extra functions in pngget.c for accessing data from the
646 * info pointer (added in version 0.99)
647 * png_get_image_width()
648 * png_get_image_height()
649 * png_get_bit_depth()
650 * png_get_color_type()
651 * png_get_compression_type()
652 * png_get_filter_type()
653 * png_get_interlace_type()
654 * png_get_pixel_aspect_ratio()
655 * png_get_pixels_per_meter()
656 * png_get_x_offset_pixels()
657 * png_get_y_offset_pixels()
658 * png_get_x_offset_microns()
659 * png_get_y_offset_microns()
660 */
Glenn Randers-Pehrson8b6a8892001-05-18 04:54:50 -0500661#if !defined(PNG_NO_EASY_ACCESS) && !defined(PNG_EASY_ACCESS_SUPPORTED)
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600662# define PNG_EASY_ACCESS_SUPPORTED
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600663#endif
664
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -0500665/* Added at libpng-1.2.0 */
Glenn Randers-Pehrson8b6a8892001-05-18 04:54:50 -0500666#if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED)
667# define PNG_USER_MEM_SUPPORTED
668#endif
669
Glenn Randers-Pehrson272489d2004-08-04 06:34:52 -0500670/* Added at libpng-1.2.6 */
Glenn Randers-Pehrson272489d2004-08-04 06:34:52 -0500671#ifndef PNG_SET_USER_LIMITS_SUPPORTED
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -0500672# ifndef PNG_NO_SET_USER_LIMITS
673# define PNG_SET_USER_LIMITS_SUPPORTED
674# endif
Glenn Randers-Pehrson272489d2004-08-04 06:34:52 -0500675#endif
Glenn Randers-Pehrson272489d2004-08-04 06:34:52 -0500676
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500677/* 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 -0500678 * how large, set these limits to 0x7fffffffL
679 */
680#ifndef PNG_USER_WIDTH_MAX
681# define PNG_USER_WIDTH_MAX 1000000L
682#endif
683#ifndef PNG_USER_HEIGHT_MAX
684# define PNG_USER_HEIGHT_MAX 1000000L
685#endif
686
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500687/* Added at libpng-1.4.0 */
Glenn Randers-Pehrson800d1e92008-08-20 17:25:21 -0500688#ifndef PNG_USER_CHUNK_CACHE_MAX
Glenn Randers-Pehrsonf298db92009-10-31 21:32:08 -0500689# define PNG_USER_CHUNK_CACHE_MAX 0x7fffffffL
Glenn Randers-Pehrson800d1e92008-08-20 17:25:21 -0500690#endif
691
692/* Added at libpng-1.4.0 */
Glenn Randers-Pehrsoneb580912008-07-30 14:47:09 -0500693#if !defined(PNG_NO_IO_STATE) && !defined(PNG_IO_STATE_SUPPORTED)
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500694# define PNG_IO_STATE_SUPPORTED
695#endif
696
Glenn Randers-Pehrson43aaf6e2008-08-05 22:17:03 -0500697#ifndef PNG_LITERAL_SHARP
698# define PNG_LITERAL_SHARP 0x23
699#endif
Glenn Randers-Pehrson79084212008-08-04 13:31:41 -0500700#ifndef PNG_LITERAL_LEFT_SQUARE_BRACKET
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500701# define PNG_LITERAL_LEFT_SQUARE_BRACKET 0x5b
Glenn Randers-Pehrson79084212008-08-04 13:31:41 -0500702#endif
703#ifndef PNG_LITERAL_RIGHT_SQUARE_BRACKET
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500704# define PNG_LITERAL_RIGHT_SQUARE_BRACKET 0x5d
Glenn Randers-Pehrson79084212008-08-04 13:31:41 -0500705#endif
Glenn Randers-Pehrson43aaf6e2008-08-05 22:17:03 -0500706#ifndef PNG_STRING_NEWLINE
Glenn Randers-Pehrsone0784c72008-08-09 07:11:44 -0500707#define PNG_STRING_NEWLINE "\n"
Glenn Randers-Pehrson43aaf6e2008-08-05 22:17:03 -0500708#endif
Glenn Randers-Pehrson79084212008-08-04 13:31:41 -0500709
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600710/* These are currently experimental features, define them if you want */
711
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500712/* Very little testing */
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600713/*
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600714#ifdef PNG_READ_SUPPORTED
715# ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
716# define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
717# endif
718#endif
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600719*/
Andreas Dilger47a0c421997-05-16 02:46:07 -0500720
721/* This is only for PowerPC big-endian and 680x0 systems */
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600722/* some testing */
723/*
Glenn Randers-Pehrson272489d2004-08-04 06:34:52 -0500724#ifndef PNG_READ_BIG_ENDIAN_SUPPORTED
725# define PNG_READ_BIG_ENDIAN_SUPPORTED
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600726#endif
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600727*/
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500728
Glenn Randers-Pehrsoneb580912008-07-30 14:47:09 -0500729#if !defined(PNG_NO_USE_READ_MACROS) && !defined(PNG_USE_READ_MACROS)
730# define PNG_USE_READ_MACROS
731#endif
732
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500733/* Buggy compilers (e.g., gcc 2.7.2.2) need PNG_NO_POINTER_INDEXING */
734
735#if !defined(PNG_NO_POINTER_INDEXING) && \
736 !defined(PNG_POINTER_INDEXING_SUPPORTED)
737# define PNG_POINTER_INDEXING_SUPPORTED
738#endif
Glenn Randers-Pehrsond4366722000-06-04 14:29:29 -0500739
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600740
Andreas Dilger47a0c421997-05-16 02:46:07 -0500741/* Any chunks you are not interested in, you can undef here. The
742 * ones that allocate memory may be expecially important (hIST,
743 * tEXt, zTXt, tRNS, pCAL). Others will just save time and make png_info
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600744 * a bit smaller.
Andreas Dilger47a0c421997-05-16 02:46:07 -0500745 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500746
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500747/* The size of the png_text structure changed in libpng-1.0.6 when
748 * iTXt support was added. iTXt support was turned off by default through
749 * libpng-1.2.x, to support old apps that malloc the png_text structure
750 * instead of calling png_set_text() and letting libpng malloc it. It
751 * was turned on by default in libpng-1.4.0.
752 */
753
754/* PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED is deprecated. */
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600755#if defined(PNG_READ_SUPPORTED) && \
756 !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500757 !defined(PNG_NO_READ_ANCILLARY_CHUNKS)
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600758# define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600759#endif
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600760
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500761/* PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED is deprecated. */
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600762#if defined(PNG_WRITE_SUPPORTED) && \
763 !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500764 !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600765# define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600766#endif
767
768#ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600769
770#ifdef PNG_NO_READ_TEXT
771# define PNG_NO_READ_iTXt
772# define PNG_NO_READ_tEXt
773# define PNG_NO_READ_zTXt
774#endif
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500775
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500776#ifndef PNG_NO_READ_bKGD
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600777# define PNG_READ_bKGD_SUPPORTED
778# define PNG_bKGD_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500779#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500780#ifndef PNG_NO_READ_cHRM
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600781# define PNG_READ_cHRM_SUPPORTED
782# define PNG_cHRM_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500783#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500784#ifndef PNG_NO_READ_gAMA
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600785# define PNG_READ_gAMA_SUPPORTED
786# define PNG_gAMA_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500787#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500788#ifndef PNG_NO_READ_hIST
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600789# define PNG_READ_hIST_SUPPORTED
790# define PNG_hIST_SUPPORTED
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600791#endif
792#ifndef PNG_NO_READ_iCCP
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600793# define PNG_READ_iCCP_SUPPORTED
794# define PNG_iCCP_SUPPORTED
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600795#endif
796#ifndef PNG_NO_READ_iTXt
Glenn Randers-Pehrson5a0be342001-10-18 20:55:13 -0500797# ifndef PNG_READ_iTXt_SUPPORTED
798# define PNG_READ_iTXt_SUPPORTED
799# endif
800# ifndef PNG_iTXt_SUPPORTED
801# define PNG_iTXt_SUPPORTED
802# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500803#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500804#ifndef PNG_NO_READ_oFFs
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600805# define PNG_READ_oFFs_SUPPORTED
806# define PNG_oFFs_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500807#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500808#ifndef PNG_NO_READ_pCAL
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600809# define PNG_READ_pCAL_SUPPORTED
810# define PNG_pCAL_SUPPORTED
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600811#endif
812#ifndef PNG_NO_READ_sCAL
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600813# define PNG_READ_sCAL_SUPPORTED
814# define PNG_sCAL_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500815#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500816#ifndef PNG_NO_READ_pHYs
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600817# define PNG_READ_pHYs_SUPPORTED
818# define PNG_pHYs_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500819#endif
820#ifndef PNG_NO_READ_sBIT
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600821# define PNG_READ_sBIT_SUPPORTED
822# define PNG_sBIT_SUPPORTED
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600823#endif
824#ifndef PNG_NO_READ_sPLT
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600825# define PNG_READ_sPLT_SUPPORTED
826# define PNG_sPLT_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500827#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500828#ifndef PNG_NO_READ_sRGB
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600829# define PNG_READ_sRGB_SUPPORTED
830# define PNG_sRGB_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500831#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500832#ifndef PNG_NO_READ_tEXt
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600833# define PNG_READ_tEXt_SUPPORTED
834# define PNG_tEXt_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500835#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500836#ifndef PNG_NO_READ_tIME
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600837# define PNG_READ_tIME_SUPPORTED
838# define PNG_tIME_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500839#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500840#ifndef PNG_NO_READ_tRNS
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600841# define PNG_READ_tRNS_SUPPORTED
842# define PNG_tRNS_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500843#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500844#ifndef PNG_NO_READ_zTXt
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600845# define PNG_READ_zTXt_SUPPORTED
846# define PNG_zTXt_SUPPORTED
847#endif
Glenn Randers-Pehrson658ea432009-06-16 16:24:57 -0500848#ifndef PNG_NO_READ_OPT_PLTE
849# define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */
850#endif /* optional PLTE chunk in RGB and RGBA images */
851#if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \
852 defined(PNG_READ_zTXt_SUPPORTED)
853# define PNG_READ_TEXT_SUPPORTED
854# define PNG_TEXT_SUPPORTED
855#endif
856
857#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
858
Glenn Randers-Pehrson6942d532000-05-01 09:31:54 -0500859#ifndef PNG_NO_READ_UNKNOWN_CHUNKS
860# define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
Glenn Randers-Pehrson98c9d732000-05-03 21:06:11 -0500861# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
862# define PNG_UNKNOWN_CHUNKS_SUPPORTED
863# endif
Glenn Randers-Pehrson6942d532000-05-01 09:31:54 -0500864#endif
Glenn Randers-Pehrson3d5a5202000-07-01 15:37:28 -0500865#if !defined(PNG_NO_READ_USER_CHUNKS) && \
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500866 defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600867# define PNG_READ_USER_CHUNKS_SUPPORTED
868# define PNG_USER_CHUNKS_SUPPORTED
869# ifdef PNG_NO_READ_UNKNOWN_CHUNKS
870# undef PNG_NO_READ_UNKNOWN_CHUNKS
871# endif
872# ifdef PNG_NO_HANDLE_AS_UNKNOWN
873# undef PNG_NO_HANDLE_AS_UNKNOWN
874# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600875#endif
Glenn Randers-Pehrson7824a702009-06-13 10:05:05 -0500876#ifndef PNG_NO_HANDLE_AS_UNKNOWN
877# ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
878# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
879# endif
880#endif
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500881
Glenn Randers-Pehrson3b3e0902009-06-16 17:20:43 -0500882#ifdef PNG_WRITE_SUPPORTED
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600883#ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600884
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600885#ifdef PNG_NO_WRITE_TEXT
886# define PNG_NO_WRITE_iTXt
887# define PNG_NO_WRITE_tEXt
888# define PNG_NO_WRITE_zTXt
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600889#endif
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600890#ifndef PNG_NO_WRITE_bKGD
891# define PNG_WRITE_bKGD_SUPPORTED
892# ifndef PNG_bKGD_SUPPORTED
893# define PNG_bKGD_SUPPORTED
894# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500895#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500896#ifndef PNG_NO_WRITE_cHRM
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600897# define PNG_WRITE_cHRM_SUPPORTED
898# ifndef PNG_cHRM_SUPPORTED
899# define PNG_cHRM_SUPPORTED
900# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500901#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500902#ifndef PNG_NO_WRITE_gAMA
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600903# define PNG_WRITE_gAMA_SUPPORTED
904# ifndef PNG_gAMA_SUPPORTED
905# define PNG_gAMA_SUPPORTED
906# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500907#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500908#ifndef PNG_NO_WRITE_hIST
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600909# define PNG_WRITE_hIST_SUPPORTED
910# ifndef PNG_hIST_SUPPORTED
911# define PNG_hIST_SUPPORTED
912# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600913#endif
914#ifndef PNG_NO_WRITE_iCCP
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600915# define PNG_WRITE_iCCP_SUPPORTED
916# ifndef PNG_iCCP_SUPPORTED
917# define PNG_iCCP_SUPPORTED
918# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600919#endif
920#ifndef PNG_NO_WRITE_iTXt
Glenn Randers-Pehrson5a0be342001-10-18 20:55:13 -0500921# ifndef PNG_WRITE_iTXt_SUPPORTED
922# define PNG_WRITE_iTXt_SUPPORTED
923# endif
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600924# ifndef PNG_iTXt_SUPPORTED
925# define PNG_iTXt_SUPPORTED
926# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500927#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500928#ifndef PNG_NO_WRITE_oFFs
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600929# define PNG_WRITE_oFFs_SUPPORTED
930# ifndef PNG_oFFs_SUPPORTED
931# define PNG_oFFs_SUPPORTED
932# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500933#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500934#ifndef PNG_NO_WRITE_pCAL
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600935# define PNG_WRITE_pCAL_SUPPORTED
936# ifndef PNG_pCAL_SUPPORTED
937# define PNG_pCAL_SUPPORTED
938# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600939#endif
940#ifndef PNG_NO_WRITE_sCAL
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600941# define PNG_WRITE_sCAL_SUPPORTED
942# ifndef PNG_sCAL_SUPPORTED
943# define PNG_sCAL_SUPPORTED
944# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500945#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500946#ifndef PNG_NO_WRITE_pHYs
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600947# define PNG_WRITE_pHYs_SUPPORTED
948# ifndef PNG_pHYs_SUPPORTED
949# define PNG_pHYs_SUPPORTED
950# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500951#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500952#ifndef PNG_NO_WRITE_sBIT
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600953# define PNG_WRITE_sBIT_SUPPORTED
954# ifndef PNG_sBIT_SUPPORTED
955# define PNG_sBIT_SUPPORTED
956# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600957#endif
958#ifndef PNG_NO_WRITE_sPLT
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600959# define PNG_WRITE_sPLT_SUPPORTED
960# ifndef PNG_sPLT_SUPPORTED
961# define PNG_sPLT_SUPPORTED
962# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500963#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500964#ifndef PNG_NO_WRITE_sRGB
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600965# define PNG_WRITE_sRGB_SUPPORTED
966# ifndef PNG_sRGB_SUPPORTED
967# define PNG_sRGB_SUPPORTED
968# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500969#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500970#ifndef PNG_NO_WRITE_tEXt
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600971# define PNG_WRITE_tEXt_SUPPORTED
972# ifndef PNG_tEXt_SUPPORTED
973# define PNG_tEXt_SUPPORTED
974# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500975#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500976#ifndef PNG_NO_WRITE_tIME
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600977# define PNG_WRITE_tIME_SUPPORTED
978# ifndef PNG_tIME_SUPPORTED
979# define PNG_tIME_SUPPORTED
980# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500981#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500982#ifndef PNG_NO_WRITE_tRNS
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600983# define PNG_WRITE_tRNS_SUPPORTED
984# ifndef PNG_tRNS_SUPPORTED
985# define PNG_tRNS_SUPPORTED
986# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500987#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500988#ifndef PNG_NO_WRITE_zTXt
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600989# define PNG_WRITE_zTXt_SUPPORTED
990# ifndef PNG_zTXt_SUPPORTED
991# define PNG_zTXt_SUPPORTED
992# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600993#endif
Glenn Randers-Pehrson658ea432009-06-16 16:24:57 -0500994#if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \
995 defined(PNG_WRITE_zTXt_SUPPORTED)
996# define PNG_WRITE_TEXT_SUPPORTED
997# ifndef PNG_TEXT_SUPPORTED
998# define PNG_TEXT_SUPPORTED
999# endif
1000#endif
1001
Glenn Randers-Pehrson74b5acc2009-11-03 12:27:25 -06001002#ifdef PNG_WRITE_tIME_SUPPORTED
Glenn Randers-Pehrson45b87612009-11-03 11:42:05 -06001003# ifndef PNG_NO_CONVERT_tIME
1004# ifndef _WIN32_WCE
1005/* The "tm" structure is not supported on WindowsCE */
1006# ifndef PNG_CONVERT_tIME_SUPPORTED
1007# define PNG_CONVERT_tIME_SUPPORTED
1008# endif
Glenn Randers-Pehrson0cb46e22009-11-02 11:24:33 -06001009# endif
Glenn Randers-Pehrson45b87612009-11-03 11:42:05 -06001010# endif
Glenn Randers-Pehrson0cb46e22009-11-02 11:24:33 -06001011#endif
Glenn Randers-Pehrson658ea432009-06-16 16:24:57 -05001012
Glenn Randers-Pehrson0cb46e22009-11-02 11:24:33 -06001013#endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
Glenn Randers-Pehrsond6ea40a2009-11-02 07:32:00 -06001014
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -05001015#if !defined(PNG_NO_WRITE_FILTER) && !defined(PNG_WRITE_FILTER_SUPPORTED)
1016# define PNG_WRITE_FILTER_SUPPORTED
1017#endif
1018
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -06001019#ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -06001020# define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
1021# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
1022# define PNG_UNKNOWN_CHUNKS_SUPPORTED
1023# endif
Glenn Randers-Pehrson7824a702009-06-13 10:05:05 -05001024#endif
1025#ifndef PNG_NO_HANDLE_AS_UNKNOWN
1026# ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
1027# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -06001028# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -06001029#endif
Glenn Randers-Pehrson3b3e0902009-06-16 17:20:43 -05001030#endif /* PNG_WRITE_SUPPORTED */
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001031
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -06001032/* Turn this off to disable png_read_png() and
Glenn Randers-Pehrsona77ef622000-02-18 13:48:52 -06001033 * png_write_png() and leave the row_pointers member
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -06001034 * out of the info structure.
1035 */
1036#ifndef PNG_NO_INFO_IMAGE
1037# define PNG_INFO_IMAGE_SUPPORTED
1038#endif
1039
Glenn Randers-Pehrson45b87612009-11-03 11:42:05 -06001040/* Need the time information for converting tIME chunks */
1041#ifdef PNG_CONVERT_tIME_SUPPORTED
1042 /* "time.h" functions are not supported on WindowsCE */
Glenn Randers-Pehrson316f97a2000-07-08 13:19:41 -05001043# include <time.h>
Andreas Dilger47a0c421997-05-16 02:46:07 -05001044#endif
1045
Andreas Dilger02ad0ef1997-01-17 01:34:35 -06001046/* Some typedefs to get us started. These should be safe on most of the
Andreas Dilger47a0c421997-05-16 02:46:07 -05001047 * common platforms. The typedefs should be at least as large as the
1048 * numbers suggest (a png_uint_32 must be at least 32 bits long), but they
1049 * don't have to be exactly that size. Some compilers dislike passing
1050 * unsigned shorts as function parameters, so you may be better off using
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -05001051 * unsigned int for png_uint_16.
Andreas Dilger47a0c421997-05-16 02:46:07 -05001052 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001053
Glenn Randers-Pehrson6bc53be2006-06-16 07:52:03 -05001054#if defined(INT_MAX) && (INT_MAX > 0x7ffffffeL)
1055typedef unsigned int png_uint_32;
1056typedef int png_int_32;
1057#else
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001058typedef unsigned long png_uint_32;
1059typedef long png_int_32;
Glenn Randers-Pehrson6bc53be2006-06-16 07:52:03 -05001060#endif
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001061typedef unsigned short png_uint_16;
1062typedef short png_int_16;
1063typedef unsigned char png_byte;
1064
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -05001065#ifdef PNG_NO_SIZE_T
1066 typedef unsigned int png_size_t;
Glenn Randers-Pehrson5fea36f2004-07-28 08:20:44 -05001067#else
1068 typedef size_t png_size_t;
Glenn Randers-Pehrson5fea36f2004-07-28 08:20:44 -05001069#endif
Glenn Randers-Pehrson145f5c82008-07-10 09:13:13 -05001070#define png_sizeof(x) sizeof(x)
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001071
Andreas Dilger47a0c421997-05-16 02:46:07 -05001072/* The following is needed for medium model support. It cannot be in the
Glenn Randers-Pehrson6a9c2ce2009-03-27 19:30:10 -05001073 * pngpriv.h header. Needs modification for other compilers besides
Andreas Dilger47a0c421997-05-16 02:46:07 -05001074 * MSC. Model independent support declares all arrays and pointers to be
1075 * large using the far keyword. The zlib version used must also support
1076 * model independent data. As of version zlib 1.0.4, the necessary changes
1077 * have been made in zlib. The USE_FAR_KEYWORD define triggers other
1078 * changes that are needed. (Tim Wegner)
1079 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001080
Andreas Dilger02ad0ef1997-01-17 01:34:35 -06001081/* Separate compiler dependencies (problem here is that zlib.h always
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -05001082 * defines FAR. (SJT)
1083 */
Guy Schalnat6d764711995-12-19 03:22:19 -06001084#ifdef __BORLANDC__
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001085# if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
1086# define LDATA 1
1087# else
1088# define LDATA 0
1089# endif
1090 /* GRR: why is Cygwin in here? Cygwin is not Borland C... */
1091# if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__)
1092# define PNG_MAX_MALLOC_64K
1093# if (LDATA != 1)
1094# ifndef FAR
1095# define FAR __far
1096# endif
1097# define USE_FAR_KEYWORD
1098# endif /* LDATA != 1 */
1099 /* Possibly useful for moving data out of default segment.
1100 * Uncomment it if you want. Could also define FARDATA as
1101 * const if your compiler supports it. (SJT)
1102# define FARDATA FAR
1103 */
1104# endif /* __WIN32__, __FLAT__, __CYGWIN__ */
Guy Schalnatb2e01bd1996-01-26 01:38:47 -06001105#endif /* __BORLANDC__ */
Guy Schalnat6d764711995-12-19 03:22:19 -06001106
1107
Andreas Dilger02ad0ef1997-01-17 01:34:35 -06001108/* Suggest testing for specific compiler first before testing for
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -06001109 * FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM,
1110 * making reliance oncertain keywords suspect. (SJT)
1111 */
Guy Schalnat6d764711995-12-19 03:22:19 -06001112
1113/* MSC Medium model */
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -05001114#ifdef FAR
1115# ifdef M_I86MM
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001116# define USE_FAR_KEYWORD
1117# define FARDATA FAR
1118# include <dos.h>
Guy Schalnat6d764711995-12-19 03:22:19 -06001119# endif
1120#endif
1121
1122/* SJT: default case */
1123#ifndef FAR
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001124# define FAR
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001125#endif
1126
Andreas Dilger47a0c421997-05-16 02:46:07 -05001127/* At this point FAR is always defined */
Guy Schalnat6d764711995-12-19 03:22:19 -06001128#ifndef FARDATA
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001129# define FARDATA
Guy Schalnat6d764711995-12-19 03:22:19 -06001130#endif
1131
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -06001132/* Typedef for floating-point numbers that are converted
1133 to fixed-point with a multiple of 100,000, e.g., int_gamma */
1134typedef png_int_32 png_fixed_point;
1135
Andreas Dilger47a0c421997-05-16 02:46:07 -05001136/* Add typedefs for pointers */
Andreas Dilger02ad0ef1997-01-17 01:34:35 -06001137typedef void FAR * png_voidp;
Guy Schalnat6d764711995-12-19 03:22:19 -06001138typedef png_byte FAR * png_bytep;
1139typedef png_uint_32 FAR * png_uint_32p;
1140typedef png_int_32 FAR * png_int_32p;
1141typedef png_uint_16 FAR * png_uint_16p;
1142typedef png_int_16 FAR * png_int_16p;
1143typedef PNG_CONST char FAR * png_const_charp;
1144typedef char FAR * png_charp;
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -06001145typedef png_fixed_point FAR * png_fixed_point_p;
Glenn Randers-Pehrsonbe9de0f2001-01-22 08:52:16 -06001146
1147#ifndef PNG_NO_STDIO
Glenn Randers-Pehrson316f97a2000-07-08 13:19:41 -05001148typedef FILE * png_FILE_p;
Glenn Randers-Pehrsonbe9de0f2001-01-22 08:52:16 -06001149#endif
1150
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -06001151#ifdef PNG_FLOATING_POINT_SUPPORTED
Andreas Dilger47a0c421997-05-16 02:46:07 -05001152typedef double FAR * png_doublep;
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -06001153#endif
Guy Schalnat6d764711995-12-19 03:22:19 -06001154
Andreas Dilger47a0c421997-05-16 02:46:07 -05001155/* Pointers to pointers; i.e. arrays */
Guy Schalnat6d764711995-12-19 03:22:19 -06001156typedef png_byte FAR * FAR * png_bytepp;
1157typedef png_uint_32 FAR * FAR * png_uint_32pp;
1158typedef png_int_32 FAR * FAR * png_int_32pp;
1159typedef png_uint_16 FAR * FAR * png_uint_16pp;
1160typedef png_int_16 FAR * FAR * png_int_16pp;
1161typedef PNG_CONST char FAR * FAR * png_const_charpp;
1162typedef char FAR * FAR * png_charpp;
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -06001163typedef png_fixed_point FAR * FAR * png_fixed_point_pp;
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -06001164#ifdef PNG_FLOATING_POINT_SUPPORTED
Andreas Dilger47a0c421997-05-16 02:46:07 -05001165typedef double FAR * FAR * png_doublepp;
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -06001166#endif
Guy Schalnat6d764711995-12-19 03:22:19 -06001167
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001168/* Pointers to pointers to pointers; i.e., pointer to array */
Andreas Dilger47a0c421997-05-16 02:46:07 -05001169typedef char FAR * FAR * FAR * png_charppp;
Guy Schalnat6d764711995-12-19 03:22:19 -06001170
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -05001171/* Define PNG_BUILD_DLL if the module being built is a Windows
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001172 * LIBPNG DLL.
1173 *
Glenn Randers-Pehrsond4366722000-06-04 14:29:29 -05001174 * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL.
Glenn Randers-Pehrsond4e81092001-01-31 05:56:52 -06001175 * It is equivalent to Microsoft predefined macro _DLL that is
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001176 * automatically defined when you compile using the share
1177 * version of the CRT (C Run-Time library)
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -06001178 *
1179 * The cygwin mods make this behavior a little different:
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -05001180 * Define PNG_BUILD_DLL if you are building a dll for use with cygwin
1181 * Define PNG_STATIC if you are building a static library for use with cygwin,
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -06001182 * -or- if you are building an application that you want to link to the
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -05001183 * static library.
1184 * PNG_USE_DLL is defined by default (no user action needed) unless one of
1185 * the other flags is defined.
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001186 */
1187
Glenn Randers-Pehrsond4366722000-06-04 14:29:29 -05001188#if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL))
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001189# define PNG_DLL
1190#endif
Glenn Randers-Pehrsonec61c232000-05-16 06:17:36 -05001191
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -05001192#ifdef __CYGWIN__
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -05001193# undef PNGAPI
1194# define PNGAPI __cdecl
1195# undef PNG_IMPEXP
1196# define PNG_IMPEXP
Glenn Randers-Pehrson7824a702009-06-13 10:05:05 -05001197#endif
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -05001198
Glenn Randers-Pehrson9e978842009-08-31 14:28:33 -05001199#define PNG_USE_LOCAL_ARRAYS /* Not used in libpng, defined for legacy apps */
1200
Glenn Randers-Pehrson25d82242002-05-01 11:51:26 -05001201/* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall",
1202 * you may get warnings regarding the linkage of png_zalloc and png_zfree.
1203 * Don't ignore those warnings; you must also reset the default calling
1204 * convention in your compiler to match your PNGAPI, and you must build
1205 * zlib and your applications the same way you build libpng.
1206 */
1207
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -05001208#if defined(__MINGW32__) && !defined(PNG_MODULEDEF)
Glenn Randers-Pehrson13944802000-06-24 07:42:42 -05001209# ifndef PNG_NO_MODULEDEF
1210# define PNG_NO_MODULEDEF
1211# endif
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -06001212#endif
1213
Glenn Randers-Pehrson13944802000-06-24 07:42:42 -05001214#if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF)
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001215# define PNG_IMPEXP
1216#endif
1217
1218#if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -05001219 (( defined(_Windows) || defined(_WINDOWS) || \
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -05001220 defined(WIN32) || defined(_WIN32) || defined(__WIN32__) ))
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001221
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -05001222# ifndef PNGAPI
1223# if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
1224# define PNGAPI __cdecl
1225# else
1226# define PNGAPI _cdecl
1227# endif
Glenn Randers-Pehrson13944802000-06-24 07:42:42 -05001228# endif
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001229
1230# if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \
1231 0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */)
1232# define PNG_IMPEXP
1233# endif
1234
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -05001235# ifndef PNG_IMPEXP
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001236
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -05001237# define PNG_EXPORT_TYPE1(type,symbol) PNG_IMPEXP type PNGAPI symbol
1238# define PNG_EXPORT_TYPE2(type,symbol) type PNG_IMPEXP PNGAPI symbol
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001239
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -05001240 /* Borland/Microsoft */
1241# if defined(_MSC_VER) || defined(__BORLANDC__)
1242# if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500)
1243# define PNG_EXPORT PNG_EXPORT_TYPE1
1244# else
1245# define PNG_EXPORT PNG_EXPORT_TYPE2
1246# ifdef PNG_BUILD_DLL
1247# define PNG_IMPEXP __export
1248# else
1249# define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in VC++ */
1250# endif /* Exists in Borland C++ for
1251 C++ classes (== huge) */
1252# endif
1253# endif
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001254
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -05001255# ifndef PNG_IMPEXP
1256# ifdef PNG_BUILD_DLL
1257# define PNG_IMPEXP __declspec(dllexport)
1258# else
1259# define PNG_IMPEXP __declspec(dllimport)
1260# endif
1261# endif
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001262# endif /* PNG_IMPEXP */
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -05001263#else /* !(DLL || non-cygwin WINDOWS) */
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -05001264# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -05001265# ifndef PNGAPI
1266# define PNGAPI _System
1267# endif
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -05001268# else
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -05001269# if 0 /* ... other platforms, with other meanings */
1270# endif
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -05001271# endif
Glenn Randers-Pehrson13944802000-06-24 07:42:42 -05001272#endif
Andreas Dilger47a0c421997-05-16 02:46:07 -05001273
Glenn Randers-Pehrson5e5c1e12000-11-10 12:26:19 -06001274#ifndef PNGAPI
1275# define PNGAPI
1276#endif
1277#ifndef PNG_IMPEXP
1278# define PNG_IMPEXP
1279#endif
1280
Glenn Randers-Pehrsonc3dda6d2004-11-27 18:22:29 -06001281#ifdef PNG_BUILDSYMS
1282# ifndef PNG_EXPORT
1283# define PNG_EXPORT(type,symbol) PNG_FUNCTION_EXPORT symbol END
1284# endif
Glenn Randers-Pehrsonc3dda6d2004-11-27 18:22:29 -06001285#endif
1286
Glenn Randers-Pehrsonf8b008c1999-09-18 10:54:36 -05001287#ifndef PNG_EXPORT
Glenn Randers-Pehrson13944802000-06-24 07:42:42 -05001288# define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -06001289#endif
1290
Glenn Randers-Pehrsond29033f2009-11-07 10:46:42 -06001291/* Support for compiler specific function attributes. These are used
1292 * so that where compiler support is available incorrect use of API
1293 * functions in png.h will generate compiler warnings.
Glenn Randers-Pehrsonce00e7d2009-11-12 08:52:03 -06001294 *
1295 * Added at libpng-1.2.41.
Glenn Randers-Pehrsond29033f2009-11-07 10:46:42 -06001296 */
1297#ifdef __GNUC__
Glenn Randers-Pehrson44db6e32009-11-08 20:36:28 -06001298# ifndef PNG_DEPRECATED
1299# define PNG_DEPRECATED __attribute__((__deprecated__))
1300# endif
1301# ifndef PNG_USE_RESULT
1302# define PNG_USE_RESULT __attribute__((__warn_unused_result__))
1303# endif
1304# ifndef PNG_NORETURN
1305# define PNG_NORETURN __attribute__((__noreturn__))
1306# endif
1307# ifndef PNG_ALLOCATED
1308# define PNG_ALLOCATED __attribute__((__malloc__))
1309# endif
Glenn Randers-Pehrsond29033f2009-11-07 10:46:42 -06001310
1311# ifndef PNG_CONFIGURE_LIBPNG
Glenn Randers-Pehrson44db6e32009-11-08 20:36:28 -06001312 /* This specifically protects structure members that should only be
1313 * accessed from within the library, therefore should be empty during
1314 * a library build.
1315 */
1316# ifndef PNG_DEPSTRUCT
1317# define PNG_DEPSTRUCT __attribute__((__deprecated__))
1318# endif
Glenn Randers-Pehrson4e1e1992009-11-12 08:29:21 -06001319# ifndef PNG_PRIVATE
1320# define PNG_PRIVATE __attribute__((__deprecated__))
1321# endif
Glenn Randers-Pehrsond29033f2009-11-07 10:46:42 -06001322# endif
1323#endif
1324
1325#ifndef PNG_DEPRECATED
Glenn Randers-Pehrson17ca3402009-11-09 06:51:16 -06001326# define PNG_DEPRECATED /* Use of this function is deprecated */
Glenn Randers-Pehrsond29033f2009-11-07 10:46:42 -06001327#endif
1328#ifndef PNG_USE_RESULT
Glenn Randers-Pehrson17ca3402009-11-09 06:51:16 -06001329# define PNG_USE_RESULT /* The result of this function must be checked */
Glenn Randers-Pehrsond29033f2009-11-07 10:46:42 -06001330#endif
1331#ifndef PNG_NORETURN
Glenn Randers-Pehrson17ca3402009-11-09 06:51:16 -06001332# define PNG_NORETURN /* This function does not return */
Glenn Randers-Pehrsond29033f2009-11-07 10:46:42 -06001333#endif
1334#ifndef PNG_ALLOCATED
Glenn Randers-Pehrson17ca3402009-11-09 06:51:16 -06001335# define PNG_ALLOCATED /* The result of the function is new memory */
Glenn Randers-Pehrsond29033f2009-11-07 10:46:42 -06001336#endif
1337#ifndef PNG_DEPSTRUCT
Glenn Randers-Pehrson17ca3402009-11-09 06:51:16 -06001338# define PNG_DEPSTRUCT /* Access to this struct member is deprecated */
Glenn Randers-Pehrsond29033f2009-11-07 10:46:42 -06001339#endif
Glenn Randers-Pehrson4e1e1992009-11-12 08:29:21 -06001340#ifndef PNG_PRIVATE
1341# define PNG_PRIVATE /* This is a private libpng function */
1342#endif
Glenn Randers-Pehrsond29033f2009-11-07 10:46:42 -06001343
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -05001344/* Users may want to use these so they are not private. Any library
1345 * functions that are passed far data must be model-independent.
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -06001346 */
Andreas Dilger02ad0ef1997-01-17 01:34:35 -06001347
Glenn Randers-Pehrsona77ef622000-02-18 13:48:52 -06001348#ifdef PNG_SETJMP_SUPPORTED
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001349# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
Glenn Randers-Pehrson520a7642000-03-21 05:13:06 -06001350#else
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001351# define png_jmpbuf(png_ptr) \
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -05001352 (LIBPNG_WAS_COMPILED_WITH__PNG_NO_SETJMP)
Glenn Randers-Pehrsona77ef622000-02-18 13:48:52 -06001353#endif
1354
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -05001355/* memory model/platform independent fns */
1356#ifndef PNG_ABORT
1357# ifdef _WINDOWS_
1358# define PNG_ABORT() ExitProcess(0)
1359# else
1360# define PNG_ABORT() abort()
1361# endif
1362#endif
1363
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -05001364#ifdef USE_FAR_KEYWORD
Glenn Randers-Pehrson17ca3402009-11-09 06:51:16 -06001365/* Use this to make far-to-near assignments */
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001366# define CHECK 1
1367# define NOCHECK 0
1368# define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
1369# define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -05001370# define png_strcpy _fstrcpy
1371# define png_strncpy _fstrncpy /* Added to v 1.2.6 */
1372# define png_strlen _fstrlen
1373# define png_memcmp _fmemcmp /* SJT: added */
1374# define png_memcpy _fmemcpy
Glenn Randers-Pehrson8551d592009-08-29 16:25:19 -05001375# define png_memset _fmemset
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -05001376# define png_sprintf sprintf
1377#else
Glenn Randers-Pehrson17ca3402009-11-09 06:51:16 -06001378# ifdef _WINDOWS_ /* Favor Windows over C runtime fns */
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -05001379# define CVT_PTR(ptr) (ptr)
1380# define CVT_PTR_NOCHECK(ptr) (ptr)
1381# define png_strcpy lstrcpyA
1382# define png_strncpy lstrcpynA
1383# define png_strlen lstrlenA
1384# define png_memcmp memcmp
1385# define png_memcpy CopyMemory
1386# define png_memset memset
1387# define png_sprintf wsprintfA
1388# else
1389# define CVT_PTR(ptr) (ptr)
1390# define CVT_PTR_NOCHECK(ptr) (ptr)
1391# define png_strcpy strcpy
1392# define png_strncpy strncpy /* Added to v 1.2.6 */
1393# define png_strlen strlen
1394# define png_memcmp memcmp /* SJT: added */
1395# define png_memcpy memcpy
1396# define png_memset memset
1397# define png_sprintf sprintf
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -05001398# ifndef PNG_NO_SNPRINTF
1399# ifdef _MSC_VER
1400# define png_snprintf _snprintf /* Added to v 1.2.19 */
1401# define png_snprintf2 _snprintf
1402# define png_snprintf6 _snprintf
1403# else
1404# define png_snprintf snprintf /* Added to v 1.2.19 */
1405# define png_snprintf2 snprintf
1406# define png_snprintf6 snprintf
1407# endif
Glenn Randers-Pehrson145f5c82008-07-10 09:13:13 -05001408# else
Glenn Randers-Pehrson6076da82009-09-30 12:28:07 -05001409 /* You don't have or don't want to use snprintf(). Caution: Using
1410 * sprintf instead of snprintf exposes your application to accidental
1411 * or malevolent buffer overflows. If you don't have snprintf()
1412 * as a general rule you should provide one (you can get one from
1413 * Portable OpenSSH).
1414 */
1415# define png_snprintf(s1,n,fmt,x1) sprintf(s1,fmt,x1)
1416# define png_snprintf2(s1,n,fmt,x1,x2) sprintf(s1,fmt,x1,x2)
1417# define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \
1418 sprintf(s1,fmt,x1,x2,x3,x4,x5,x6)
Glenn Randers-Pehrson145f5c82008-07-10 09:13:13 -05001419# endif
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -05001420# endif
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001421#endif
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -05001422
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -05001423/* png_alloc_size_t is guaranteed to be no smaller than png_size_t,
1424 * and no smaller than png_uint_32. Casts from png_size_t or png_uint_32
1425 * to png_alloc_size_t are not necessary; in fact, it is recommended
1426 * not to use them at all so that the compiler can complain when something
1427 * turns out to be problematic.
1428 * Casts in the other direction (from png_alloc_size_t to png_size_t or
1429 * png_uint_32) should be explicitly applied; however, we do not expect
1430 * to encounter practical situations that require such conversions.
1431 */
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -05001432#if defined(__TURBOC__) && !defined(__FLAT__)
1433# define png_mem_alloc farmalloc
1434# define png_mem_free farfree
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -05001435 typedef unsigned long png_alloc_size_t;
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -05001436#else
1437# if defined(_MSC_VER) && defined(MAXSEG_64K)
1438# define png_mem_alloc(s) halloc(s, 1)
1439# define png_mem_free hfree
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -05001440 typedef unsigned long png_alloc_size_t;
1441# else
1442# if defined(_WINDOWS_) && (!defined(INT_MAX) || INT_MAX <= 0x7ffffffeL)
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -05001443# define png_mem_alloc(s) HeapAlloc(GetProcessHeap(), 0, s)
1444# define png_mem_free(p) HeapFree(GetProcessHeap(), 0, p)
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -05001445 typedef DWORD png_alloc_size_t;
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -05001446# else
1447# define png_mem_alloc malloc
1448# define png_mem_free free
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -05001449 typedef png_size_t png_alloc_size_t;
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -05001450# endif
1451# endif
1452#endif
1453/* End of memory model/platform independent support */
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001454
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -06001455/* Just a little check that someone hasn't tried to define something
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -06001456 * contradictory.
Andreas Dilger47a0c421997-05-16 02:46:07 -05001457 */
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -05001458#if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K)
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001459# undef PNG_ZBUF_SIZE
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -05001460# define PNG_ZBUF_SIZE 65536L
Andreas Dilger47a0c421997-05-16 02:46:07 -05001461#endif
1462
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001463
Glenn Randers-Pehrson5dd2b8e2004-11-24 07:50:16 -06001464/* Added at libpng-1.2.8 */
1465#endif /* PNG_VERSION_INFO_ONLY */
Glenn Randers-Pehrson40936072004-11-20 11:18:40 -06001466
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001467#endif /* PNGCONF_H */