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