Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

650 lines
23 KiB

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