Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

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