pngconf.h 50 KB

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