pngconf.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  1. /* pngconf.h - machine configurable file for libpng
  2. *
  3. * libpng version 1.6.10 - March 6, 2014
  4. *
  5. * Copyright (c) 1998-2013 Glenn Randers-Pehrson
  6. * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  7. * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  8. *
  9. * This code is released under the libpng license.
  10. * For conditions of distribution and use, see the disclaimer
  11. * and license in png.h
  12. *
  13. */
  14. /* Any machine specific code is near the front of this file, so if you
  15. * are configuring libpng for a machine, you may want to read the section
  16. * starting here down to where it starts to typedef png_color, png_text,
  17. * and png_info.
  18. */
  19. #ifndef PNGCONF_H
  20. #define PNGCONF_H
  21. /* To do: Do all of this in scripts/pnglibconf.dfa */
  22. #ifdef PNG_SAFE_LIMITS_SUPPORTED
  23. # ifdef PNG_USER_WIDTH_MAX
  24. # undef PNG_USER_WIDTH_MAX
  25. # define PNG_USER_WIDTH_MAX 1000000L
  26. # endif
  27. # ifdef PNG_USER_HEIGHT_MAX
  28. # undef PNG_USER_HEIGHT_MAX
  29. # define PNG_USER_HEIGHT_MAX 1000000L
  30. # endif
  31. # ifdef PNG_USER_CHUNK_MALLOC_MAX
  32. # undef PNG_USER_CHUNK_MALLOC_MAX
  33. # define PNG_USER_CHUNK_MALLOC_MAX 4000000L
  34. # endif
  35. # ifdef PNG_USER_CHUNK_CACHE_MAX
  36. # undef PNG_USER_CHUNK_CACHE_MAX
  37. # define PNG_USER_CHUNK_CACHE_MAX 128
  38. # endif
  39. #endif
  40. #ifndef PNG_BUILDING_SYMBOL_TABLE /* else includes may cause problems */
  41. /* From libpng 1.6.0 libpng requires an ANSI X3.159-1989 ("ISOC90") compliant C
  42. * compiler for correct compilation. The following header files are required by
  43. * the standard. If your compiler doesn't provide these header files, or they
  44. * do not match the standard, you will need to provide/improve them.
  45. */
  46. #include <limits.h>
  47. #include <stddef.h>
  48. /* Library header files. These header files are all defined by ISOC90; libpng
  49. * expects conformant implementations, however, an ISOC90 conformant system need
  50. * not provide these header files if the functionality cannot be implemented.
  51. * In this case it will be necessary to disable the relevant parts of libpng in
  52. * the build of pnglibconf.h.
  53. *
  54. * Prior to 1.6.0 string.h was included here; the API changes in 1.6.0 to not
  55. * include this unnecessary header file.
  56. */
  57. #ifdef PNG_STDIO_SUPPORTED
  58. /* Required for the definition of FILE: */
  59. # include <stdio.h>
  60. #endif
  61. #ifdef PNG_SETJMP_SUPPORTED
  62. /* Required for the definition of jmp_buf and the declaration of longjmp: */
  63. # include <setjmp.h>
  64. #endif
  65. #ifdef PNG_CONVERT_tIME_SUPPORTED
  66. /* Required for struct tm: */
  67. # include <time.h>
  68. #endif
  69. #endif /* PNG_BUILDING_SYMBOL_TABLE */
  70. /* Prior to 1.6.0 it was possible to turn off 'const' in declarations using
  71. * PNG_NO_CONST; this is no longer supported except for data declarations which
  72. * apparently still cause problems in 2011 on some compilers.
  73. */
  74. #define PNG_CONST const /* backward compatibility only */
  75. /* This controls optimization of the reading of 16 and 32 bit values
  76. * from PNG files. It can be set on a per-app-file basis - it
  77. * just changes whether a macro is used when the function is called.
  78. * The library builder sets the default; if read functions are not
  79. * built into the library the macro implementation is forced on.
  80. */
  81. #ifndef PNG_READ_INT_FUNCTIONS_SUPPORTED
  82. # define PNG_USE_READ_MACROS
  83. #endif
  84. #if !defined(PNG_NO_USE_READ_MACROS) && !defined(PNG_USE_READ_MACROS)
  85. # if PNG_DEFAULT_READ_MACROS
  86. # define PNG_USE_READ_MACROS
  87. # endif
  88. #endif
  89. /* COMPILER SPECIFIC OPTIONS.
  90. *
  91. * These options are provided so that a variety of difficult compilers
  92. * can be used. Some are fixed at build time (e.g. PNG_API_RULE
  93. * below) but still have compiler specific implementations, others
  94. * may be changed on a per-file basis when compiling against libpng.
  95. */
  96. /* The PNGARG macro was used in versions of libpng prior to 1.6.0 to protect
  97. * against legacy (pre ISOC90) compilers that did not understand function
  98. * prototypes. It is not required for modern C compilers.
  99. */
  100. #ifndef PNGARG
  101. # define PNGARG(arglist) arglist
  102. #endif
  103. /* Function calling conventions.
  104. * =============================
  105. * Normally it is not necessary to specify to the compiler how to call
  106. * a function - it just does it - however on x86 systems derived from
  107. * Microsoft and Borland C compilers ('IBM PC', 'DOS', 'Windows' systems
  108. * and some others) there are multiple ways to call a function and the
  109. * default can be changed on the compiler command line. For this reason
  110. * libpng specifies the calling convention of every exported function and
  111. * every function called via a user supplied function pointer. This is
  112. * done in this file by defining the following macros:
  113. *
  114. * PNGAPI Calling convention for exported functions.
  115. * PNGCBAPI Calling convention for user provided (callback) functions.
  116. * PNGCAPI Calling convention used by the ANSI-C library (required
  117. * for longjmp callbacks and sometimes used internally to
  118. * specify the calling convention for zlib).
  119. *
  120. * These macros should never be overridden. If it is necessary to
  121. * change calling convention in a private build this can be done
  122. * by setting PNG_API_RULE (which defaults to 0) to one of the values
  123. * below to select the correct 'API' variants.
  124. *
  125. * PNG_API_RULE=0 Use PNGCAPI - the 'C' calling convention - throughout.
  126. * This is correct in every known environment.
  127. * PNG_API_RULE=1 Use the operating system convention for PNGAPI and
  128. * the 'C' calling convention (from PNGCAPI) for
  129. * callbacks (PNGCBAPI). This is no longer required
  130. * in any known environment - if it has to be used
  131. * please post an explanation of the problem to the
  132. * libpng mailing list.
  133. *
  134. * These cases only differ if the operating system does not use the C
  135. * calling convention, at present this just means the above cases
  136. * (x86 DOS/Windows sytems) and, even then, this does not apply to
  137. * Cygwin running on those systems.
  138. *
  139. * Note that the value must be defined in pnglibconf.h so that what
  140. * the application uses to call the library matches the conventions
  141. * set when building the library.
  142. */
  143. /* Symbol export
  144. * =============
  145. * When building a shared library it is almost always necessary to tell
  146. * the compiler which symbols to export. The png.h macro 'PNG_EXPORT'
  147. * is used to mark the symbols. On some systems these symbols can be
  148. * extracted at link time and need no special processing by the compiler,
  149. * on other systems the symbols are flagged by the compiler and just
  150. * the declaration requires a special tag applied (unfortunately) in a
  151. * compiler dependent way. Some systems can do either.
  152. *
  153. * A small number of older systems also require a symbol from a DLL to
  154. * be flagged to the program that calls it. This is a problem because
  155. * we do not know in the header file included by application code that
  156. * the symbol will come from a shared library, as opposed to a statically
  157. * linked one. For this reason the application must tell us by setting
  158. * the magic flag PNG_USE_DLL to turn on the special processing before
  159. * it includes png.h.
  160. *
  161. * Four additional macros are used to make this happen:
  162. *
  163. * PNG_IMPEXP The magic (if any) to cause a symbol to be exported from
  164. * the build or imported if PNG_USE_DLL is set - compiler
  165. * and system specific.
  166. *
  167. * PNG_EXPORT_TYPE(type) A macro that pre or appends PNG_IMPEXP to
  168. * 'type', compiler specific.
  169. *
  170. * PNG_DLL_EXPORT Set to the magic to use during a libpng build to
  171. * make a symbol exported from the DLL. Not used in the
  172. * public header files; see pngpriv.h for how it is used
  173. * in the libpng build.
  174. *
  175. * PNG_DLL_IMPORT Set to the magic to force the libpng symbols to come
  176. * from a DLL - used to define PNG_IMPEXP when
  177. * PNG_USE_DLL is set.
  178. */
  179. /* System specific discovery.
  180. * ==========================
  181. * This code is used at build time to find PNG_IMPEXP, the API settings
  182. * and PNG_EXPORT_TYPE(), it may also set a macro to indicate the DLL
  183. * import processing is possible. On Windows systems it also sets
  184. * compiler-specific macros to the values required to change the calling
  185. * conventions of the various functions.
  186. */
  187. #if defined(_Windows) || defined(_WINDOWS) || defined(WIN32) ||\
  188. defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
  189. /* Windows system (DOS doesn't support DLLs). Includes builds under Cygwin or
  190. * MinGW on any architecture currently supported by Windows. Also includes
  191. * Watcom builds but these need special treatment because they are not
  192. * compatible with GCC or Visual C because of different calling conventions.
  193. */
  194. # if PNG_API_RULE == 2
  195. /* If this line results in an error, either because __watcall is not
  196. * understood or because of a redefine just below you cannot use *this*
  197. * build of the library with the compiler you are using. *This* build was
  198. * build using Watcom and applications must also be built using Watcom!
  199. */
  200. # define PNGCAPI __watcall
  201. # endif
  202. # if defined(__GNUC__) || (defined(_MSC_VER) && (_MSC_VER >= 800))
  203. # define PNGCAPI __cdecl
  204. # if PNG_API_RULE == 1
  205. /* If this line results in an error __stdcall is not understood and
  206. * PNG_API_RULE should not have been set to '1'.
  207. */
  208. # define PNGAPI __stdcall
  209. # endif
  210. # else
  211. /* An older compiler, or one not detected (erroneously) above,
  212. * if necessary override on the command line to get the correct
  213. * variants for the compiler.
  214. */
  215. # ifndef PNGCAPI
  216. # define PNGCAPI _cdecl
  217. # endif
  218. # if PNG_API_RULE == 1 && !defined(PNGAPI)
  219. # define PNGAPI _stdcall
  220. # endif
  221. # endif /* compiler/api */
  222. /* NOTE: PNGCBAPI always defaults to PNGCAPI. */
  223. # if defined(PNGAPI) && !defined(PNG_USER_PRIVATEBUILD)
  224. # error "PNG_USER_PRIVATEBUILD must be defined if PNGAPI is changed"
  225. # endif
  226. # if (defined(_MSC_VER) && _MSC_VER < 800) ||\
  227. (defined(__BORLANDC__) && __BORLANDC__ < 0x500)
  228. /* older Borland and MSC
  229. * compilers used '__export' and required this to be after
  230. * the type.
  231. */
  232. # ifndef PNG_EXPORT_TYPE
  233. # define PNG_EXPORT_TYPE(type) type PNG_IMPEXP
  234. # endif
  235. # define PNG_DLL_EXPORT __export
  236. # else /* newer compiler */
  237. # define PNG_DLL_EXPORT __declspec(dllexport)
  238. # ifndef PNG_DLL_IMPORT
  239. # define PNG_DLL_IMPORT __declspec(dllimport)
  240. # endif
  241. # endif /* compiler */
  242. #else /* !Windows */
  243. # if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
  244. # define PNGAPI _System
  245. # else /* !Windows/x86 && !OS/2 */
  246. /* Use the defaults, or define PNG*API on the command line (but
  247. * this will have to be done for every compile!)
  248. */
  249. # endif /* other system, !OS/2 */
  250. #endif /* !Windows/x86 */
  251. /* Now do all the defaulting . */
  252. #ifndef PNGCAPI
  253. # define PNGCAPI
  254. #endif
  255. #ifndef PNGCBAPI
  256. # define PNGCBAPI PNGCAPI
  257. #endif
  258. #ifndef PNGAPI
  259. # define PNGAPI PNGCAPI
  260. #endif
  261. /* PNG_IMPEXP may be set on the compilation system command line or (if not set)
  262. * then in an internal header file when building the library, otherwise (when
  263. * using the library) it is set here.
  264. */
  265. #ifndef PNG_IMPEXP
  266. # if defined(PNG_USE_DLL) && defined(PNG_DLL_IMPORT)
  267. /* This forces use of a DLL, disallowing static linking */
  268. # define PNG_IMPEXP PNG_DLL_IMPORT
  269. # endif
  270. # ifndef PNG_IMPEXP
  271. # define PNG_IMPEXP
  272. # endif
  273. #endif
  274. /* In 1.5.2 the definition of PNG_FUNCTION has been changed to always treat
  275. * 'attributes' as a storage class - the attributes go at the start of the
  276. * function definition, and attributes are always appended regardless of the
  277. * compiler. This considerably simplifies these macros but may cause problems
  278. * if any compilers both need function attributes and fail to handle them as
  279. * a storage class (this is unlikely.)
  280. */
  281. #ifndef PNG_FUNCTION
  282. # define PNG_FUNCTION(type, name, args, attributes) attributes type name args
  283. #endif
  284. #ifndef PNG_EXPORT_TYPE
  285. # define PNG_EXPORT_TYPE(type) PNG_IMPEXP type
  286. #endif
  287. /* The ordinal value is only relevant when preprocessing png.h for symbol
  288. * table entries, so we discard it here. See the .dfn files in the
  289. * scripts directory.
  290. */
  291. #ifndef PNG_EXPORTA
  292. # define PNG_EXPORTA(ordinal, type, name, args, attributes)\
  293. PNG_FUNCTION(PNG_EXPORT_TYPE(type),(PNGAPI name),PNGARG(args), \
  294. extern attributes)
  295. #endif
  296. /* ANSI-C (C90) does not permit a macro to be invoked with an empty argument,
  297. * so make something non-empty to satisfy the requirement:
  298. */
  299. #define PNG_EMPTY /*empty list*/
  300. #define PNG_EXPORT(ordinal, type, name, args)\
  301. PNG_EXPORTA(ordinal, type, name, args, PNG_EMPTY)
  302. /* Use PNG_REMOVED to comment out a removed interface. */
  303. #ifndef PNG_REMOVED
  304. # define PNG_REMOVED(ordinal, type, name, args, attributes)
  305. #endif
  306. #ifndef PNG_CALLBACK
  307. # define PNG_CALLBACK(type, name, args) type (PNGCBAPI name) PNGARG(args)
  308. #endif
  309. /* Support for compiler specific function attributes. These are used
  310. * so that where compiler support is available incorrect use of API
  311. * functions in png.h will generate compiler warnings.
  312. *
  313. * Added at libpng-1.2.41.
  314. */
  315. #ifndef PNG_NO_PEDANTIC_WARNINGS
  316. # ifndef PNG_PEDANTIC_WARNINGS_SUPPORTED
  317. # define PNG_PEDANTIC_WARNINGS_SUPPORTED
  318. # endif
  319. #endif
  320. #ifdef PNG_PEDANTIC_WARNINGS_SUPPORTED
  321. /* Support for compiler specific function attributes. These are used
  322. * so that where compiler support is available, incorrect use of API
  323. * functions in png.h will generate compiler warnings. Added at libpng
  324. * version 1.2.41. Disabling these removes the warnings but may also produce
  325. * less efficient code.
  326. */
  327. # if defined(__clang__)
  328. /* Clang defines both __clang__ and __GNUC__. Check __clang__ first. */
  329. # if !defined(PNG_USE_RESULT) && __has_attribute(__warn_unused_result__)
  330. # define PNG_USE_RESULT __attribute__((__warn_unused_result__))
  331. # endif
  332. # if !defined(PNG_NORETURN) && __has_attribute(__noreturn__)
  333. # define PNG_NORETURN __attribute__((__noreturn__))
  334. # endif
  335. # if !defined(PNG_ALLOCATED) && __has_attribute(__malloc__)
  336. # define PNG_ALLOCATED __attribute__((__malloc__))
  337. # endif
  338. # if !defined(PNG_DEPRECATED) && __has_attribute(__deprecated__)
  339. # define PNG_DEPRECATED __attribute__((__deprecated__))
  340. # endif
  341. # if !defined(PNG_PRIVATE)
  342. # ifdef __has_extension
  343. # if __has_extension(attribute_unavailable_with_message)
  344. # define PNG_PRIVATE __attribute__((__unavailable__(\
  345. "This function is not exported by libpng.")))
  346. # endif
  347. # endif
  348. # endif
  349. # ifndef PNG_RESTRICT
  350. # define PNG_RESTRICT __restrict
  351. # endif
  352. # elif defined(__GNUC__)
  353. # ifndef PNG_USE_RESULT
  354. # define PNG_USE_RESULT __attribute__((__warn_unused_result__))
  355. # endif
  356. # ifndef PNG_NORETURN
  357. # define PNG_NORETURN __attribute__((__noreturn__))
  358. # endif
  359. # if __GNUC__ >= 3
  360. # ifndef PNG_ALLOCATED
  361. # define PNG_ALLOCATED __attribute__((__malloc__))
  362. # endif
  363. # ifndef PNG_DEPRECATED
  364. # define PNG_DEPRECATED __attribute__((__deprecated__))
  365. # endif
  366. # ifndef PNG_PRIVATE
  367. # if 0 /* Doesn't work so we use deprecated instead*/
  368. # define PNG_PRIVATE \
  369. __attribute__((warning("This function is not exported by libpng.")))
  370. # else
  371. # define PNG_PRIVATE \
  372. __attribute__((__deprecated__))
  373. # endif
  374. # endif
  375. # if ((__GNUC__ > 3) || !defined(__GNUC_MINOR__) || (__GNUC_MINOR__ >= 1))
  376. # ifndef PNG_RESTRICT
  377. # define PNG_RESTRICT __restrict
  378. # endif
  379. # endif /* __GNUC__.__GNUC_MINOR__ > 3.0 */
  380. # endif /* __GNUC__ >= 3 */
  381. # elif defined(_MSC_VER) && (_MSC_VER >= 1300)
  382. # ifndef PNG_USE_RESULT
  383. # define PNG_USE_RESULT /* not supported */
  384. # endif
  385. # ifndef PNG_NORETURN
  386. # define PNG_NORETURN __declspec(noreturn)
  387. # endif
  388. # ifndef PNG_ALLOCATED
  389. # if (_MSC_VER >= 1400)
  390. # define PNG_ALLOCATED __declspec(restrict)
  391. # endif
  392. # endif
  393. # ifndef PNG_DEPRECATED
  394. # define PNG_DEPRECATED __declspec(deprecated)
  395. # endif
  396. # ifndef PNG_PRIVATE
  397. # define PNG_PRIVATE __declspec(deprecated)
  398. # endif
  399. # ifndef PNG_RESTRICT
  400. # if (_MSC_VER >= 1400)
  401. # define PNG_RESTRICT __restrict
  402. # endif
  403. # endif
  404. # elif defined(__WATCOMC__)
  405. # ifndef PNG_RESTRICT
  406. # define PNG_RESTRICT __restrict
  407. # endif
  408. # endif
  409. #endif /* PNG_PEDANTIC_WARNINGS */
  410. #ifndef PNG_DEPRECATED
  411. # define PNG_DEPRECATED /* Use of this function is deprecated */
  412. #endif
  413. #ifndef PNG_USE_RESULT
  414. # define PNG_USE_RESULT /* The result of this function must be checked */
  415. #endif
  416. #ifndef PNG_NORETURN
  417. # define PNG_NORETURN /* This function does not return */
  418. #endif
  419. #ifndef PNG_ALLOCATED
  420. # define PNG_ALLOCATED /* The result of the function is new memory */
  421. #endif
  422. #ifndef PNG_PRIVATE
  423. # define PNG_PRIVATE /* This is a private libpng function */
  424. #endif
  425. #ifndef PNG_RESTRICT
  426. # define PNG_RESTRICT /* The C99 "restrict" feature */
  427. #endif
  428. #ifndef PNG_FP_EXPORT /* A floating point API. */
  429. # ifdef PNG_FLOATING_POINT_SUPPORTED
  430. # define PNG_FP_EXPORT(ordinal, type, name, args)\
  431. PNG_EXPORT(ordinal, type, name, args);
  432. # else /* No floating point APIs */
  433. # define PNG_FP_EXPORT(ordinal, type, name, args)
  434. # endif
  435. #endif
  436. #ifndef PNG_FIXED_EXPORT /* A fixed point API. */
  437. # ifdef PNG_FIXED_POINT_SUPPORTED
  438. # define PNG_FIXED_EXPORT(ordinal, type, name, args)\
  439. PNG_EXPORT(ordinal, type, name, args);
  440. # else /* No fixed point APIs */
  441. # define PNG_FIXED_EXPORT(ordinal, type, name, args)
  442. # endif
  443. #endif
  444. #ifndef PNG_BUILDING_SYMBOL_TABLE
  445. /* Some typedefs to get us started. These should be safe on most of the common
  446. * platforms.
  447. *
  448. * png_uint_32 and png_int_32 may, currently, be larger than required to hold a
  449. * 32-bit value however this is not normally advisable.
  450. *
  451. * png_uint_16 and png_int_16 should always be two bytes in size - this is
  452. * verified at library build time.
  453. *
  454. * png_byte must always be one byte in size.
  455. *
  456. * The checks below use constants from limits.h, as defined by the ISOC90
  457. * standard.
  458. */
  459. #if CHAR_BIT == 8 && UCHAR_MAX == 255
  460. typedef unsigned char png_byte;
  461. #else
  462. # error "libpng requires 8 bit bytes"
  463. #endif
  464. #if INT_MIN == -32768 && INT_MAX == 32767
  465. typedef int png_int_16;
  466. #elif SHRT_MIN == -32768 && SHRT_MAX == 32767
  467. typedef short png_int_16;
  468. #else
  469. # error "libpng requires a signed 16 bit type"
  470. #endif
  471. #if UINT_MAX == 65535
  472. typedef unsigned int png_uint_16;
  473. #elif USHRT_MAX == 65535
  474. typedef unsigned short png_uint_16;
  475. #else
  476. # error "libpng requires an unsigned 16 bit type"
  477. #endif
  478. #if INT_MIN < -2147483646 && INT_MAX > 2147483646
  479. typedef int png_int_32;
  480. #elif LONG_MIN < -2147483646 && LONG_MAX > 2147483646
  481. typedef long int png_int_32;
  482. #else
  483. # error "libpng requires a signed 32 bit (or more) type"
  484. #endif
  485. #if UINT_MAX > 4294967294
  486. typedef unsigned int png_uint_32;
  487. #elif ULONG_MAX > 4294967294
  488. typedef unsigned long int png_uint_32;
  489. #else
  490. # error "libpng requires an unsigned 32 bit (or more) type"
  491. #endif
  492. /* Prior to 1.6.0 it was possible to disable the use of size_t, 1.6.0, however,
  493. * requires an ISOC90 compiler and relies on consistent behavior of sizeof.
  494. */
  495. typedef size_t png_size_t;
  496. typedef ptrdiff_t png_ptrdiff_t;
  497. /* libpng needs to know the maximum value of 'size_t' and this controls the
  498. * definition of png_alloc_size_t, below. This maximum value of size_t limits
  499. * but does not control the maximum allocations the library makes - there is
  500. * direct application control of this through png_set_user_limits().
  501. */
  502. #ifndef PNG_SMALL_SIZE_T
  503. /* Compiler specific tests for systems where size_t is known to be less than
  504. * 32 bits (some of these systems may no longer work because of the lack of
  505. * 'far' support; see above.)
  506. */
  507. # if (defined(__TURBOC__) && !defined(__FLAT__)) ||\
  508. (defined(_MSC_VER) && defined(MAXSEG_64K))
  509. # define PNG_SMALL_SIZE_T
  510. # endif
  511. #endif
  512. /* png_alloc_size_t is guaranteed to be no smaller than png_size_t, and no
  513. * smaller than png_uint_32. Casts from png_size_t or png_uint_32 to
  514. * png_alloc_size_t are not necessary; in fact, it is recommended not to use
  515. * them at all so that the compiler can complain when something turns out to be
  516. * problematic.
  517. *
  518. * Casts in the other direction (from png_alloc_size_t to png_size_t or
  519. * png_uint_32) should be explicitly applied; however, we do not expect to
  520. * encounter practical situations that require such conversions.
  521. *
  522. * PNG_SMALL_SIZE_T must be defined if the maximum value of size_t is less than
  523. * 4294967295 - i.e. less than the maximum value of png_uint_32.
  524. */
  525. #ifdef PNG_SMALL_SIZE_T
  526. typedef png_uint_32 png_alloc_size_t;
  527. #else
  528. typedef png_size_t png_alloc_size_t;
  529. #endif
  530. /* Prior to 1.6.0 libpng offered limited support for Microsoft C compiler
  531. * implementations of Intel CPU specific support of user-mode segmented address
  532. * spaces, where 16-bit pointers address more than 65536 bytes of memory using
  533. * separate 'segment' registers. The implementation requires two different
  534. * types of pointer (only one of which includes the segment value.)
  535. *
  536. * If required this support is available in version 1.2 of libpng and may be
  537. * available in versions through 1.5, although the correctness of the code has
  538. * not been verified recently.
  539. */
  540. /* Typedef for floating-point numbers that are converted to fixed-point with a
  541. * multiple of 100,000, e.g., gamma
  542. */
  543. typedef png_int_32 png_fixed_point;
  544. /* Add typedefs for pointers */
  545. typedef void * png_voidp;
  546. typedef const void * png_const_voidp;
  547. typedef png_byte * png_bytep;
  548. typedef const png_byte * png_const_bytep;
  549. typedef png_uint_32 * png_uint_32p;
  550. typedef const png_uint_32 * png_const_uint_32p;
  551. typedef png_int_32 * png_int_32p;
  552. typedef const png_int_32 * png_const_int_32p;
  553. typedef png_uint_16 * png_uint_16p;
  554. typedef const png_uint_16 * png_const_uint_16p;
  555. typedef png_int_16 * png_int_16p;
  556. typedef const png_int_16 * png_const_int_16p;
  557. typedef char * png_charp;
  558. typedef const char * png_const_charp;
  559. typedef png_fixed_point * png_fixed_point_p;
  560. typedef const png_fixed_point * png_const_fixed_point_p;
  561. typedef png_size_t * png_size_tp;
  562. typedef const png_size_t * png_const_size_tp;
  563. #ifdef PNG_STDIO_SUPPORTED
  564. typedef FILE * png_FILE_p;
  565. #endif
  566. #ifdef PNG_FLOATING_POINT_SUPPORTED
  567. typedef double * png_doublep;
  568. typedef const double * png_const_doublep;
  569. #endif
  570. /* Pointers to pointers; i.e. arrays */
  571. typedef png_byte * * png_bytepp;
  572. typedef png_uint_32 * * png_uint_32pp;
  573. typedef png_int_32 * * png_int_32pp;
  574. typedef png_uint_16 * * png_uint_16pp;
  575. typedef png_int_16 * * png_int_16pp;
  576. typedef const char * * png_const_charpp;
  577. typedef char * * png_charpp;
  578. typedef png_fixed_point * * png_fixed_point_pp;
  579. #ifdef PNG_FLOATING_POINT_SUPPORTED
  580. typedef double * * png_doublepp;
  581. #endif
  582. /* Pointers to pointers to pointers; i.e., pointer to array */
  583. typedef char * * * png_charppp;
  584. #endif /* PNG_BUILDING_SYMBOL_TABLE */
  585. #endif /* PNGCONF_H */