pngconf.h 50 KB

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