Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/3rdparty/libpng/pngconf.h

    r561 r846  
    22/* pngconf.h - machine configurable file for libpng
    33 *
    4  * libpng version 1.2.40 - September 10, 2009
    5  * Copyright (c) 1998-2009 Glenn Randers-Pehrson
     4 * libpng version 1.4.0 - January 3, 2010
     5 * For conditions of distribution and use, see copyright notice in png.h
     6 * Copyright (c) 1998-2010 Glenn Randers-Pehrson
    67 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
    78 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
     
    1011 * For conditions of distribution and use, see the disclaimer
    1112 * and license in png.h
     13 *
    1214 */
    1315
     
    2123#define PNGCONF_H
    2224
    23 #define PNG_1_2_X
     25#ifndef PNG_NO_LIMITS_H
     26#  include <limits.h>
     27#endif
     28
     29/* Added at libpng-1.2.9 */
     30
     31/* config.h is created by and PNG_CONFIGURE_LIBPNG is set by the "configure" script. */
     32#ifdef PNG_CONFIGURE_LIBPNG
     33#  ifdef HAVE_CONFIG_H
     34#    include "config.h"
     35#  endif
     36#endif
    2437
    2538/*
     39 * Added at libpng-1.2.8
     40 *
    2641 * PNG_USER_CONFIG has to be defined on the compiler command line. This
    2742 * includes the resource compiler for Windows DLL configurations.
     
    3146#    define PNG_USER_PRIVATEBUILD
    3247#  endif
    33 #include "pngusr.h"
    34 #endif
    35 
    36 /* PNG_CONFIGURE_LIBPNG is set by the "configure" script. */
    37 #ifdef PNG_CONFIGURE_LIBPNG
    38 #ifdef HAVE_CONFIG_H
    39 #include "config.h"
    40 #endif
     48#  include "pngusr.h"
    4149#endif
    4250
    4351/*
    44  * Added at libpng-1.2.8
    45  *
    4652 * If you create a private DLL you need to define in "pngusr.h" the followings:
    4753 * #define PNG_USER_PRIVATEBUILD <Describes by whom and why this version of
     
    6369
    6470#ifdef __STDC__
    65 #ifdef SPECIALBUILD
    66 pragma message("PNG_LIBPNG_SPECIALBUILD (and deprecated SPECIALBUILD)\
    67  are now LIBPNG reserved macros. Use PNG_USER_PRIVATEBUILD instead.")
    68 #endif
    69 
    70 #ifdef PRIVATEBUILD
    71 # pragma message("PRIVATEBUILD is deprecated.\
    72  Use PNG_USER_PRIVATEBUILD instead.")
    73 # define PNG_USER_PRIVATEBUILD PRIVATEBUILD
    74 #endif
     71#  ifdef SPECIALBUILD
     72  pragma message("PNG_LIBPNG_SPECIALBUILD (and deprecated SPECIALBUILD)\
     73     are now LIBPNG reserved macros. Use PNG_USER_PRIVATEBUILD instead.")
     74#  endif
     75
     76#  ifdef PRIVATEBUILD
     77#    pragma message("PRIVATEBUILD is deprecated.\
     78     Use PNG_USER_PRIVATEBUILD instead.")
     79#    define PNG_USER_PRIVATEBUILD PRIVATEBUILD
     80#  endif
    7581#endif /* __STDC__ */
    7682
     83/* End of material added to libpng-1.2.8 */
     84
    7785#ifndef PNG_VERSION_INFO_ONLY
    78 
    79 /* End of material added to libpng-1.2.8 */
    80 
    81 /* Added at libpng-1.2.19, removed at libpng-1.2.20 because it caused trouble
    82    Restored at libpng-1.2.21 */
    83 #if !defined(PNG_NO_WARN_UNINITIALIZED_ROW) && \
    84     !defined(PNG_WARN_UNINITIALIZED_ROW)
    85 #  define PNG_WARN_UNINITIALIZED_ROW 1
    86 #endif
    87 /* End of material added at libpng-1.2.19/1.2.21 */
    8886
    8987/* This is the size of the compression buffer, and thus the size of
     
    116114#endif
    117115
     116/* Enabled in 1.4.0. */
     117#ifdef PNG_ALLOW_BENIGN_ERRORS
     118#  define png_benign_error png_warning
     119#  define png_chunk_benign_error png_chunk_warning
     120#else
     121#  ifndef PNG_BENIGN_ERRORS_SUPPORTED
     122#    define png_benign_error png_error
     123#    define png_chunk_benign_error png_chunk_error
     124#  endif
     125#endif
     126
     127/* Added at libpng version 1.4.0 */
     128#if !defined(PNG_NO_WARNINGS) && !defined(PNG_WARNINGS_SUPPORTED)
     129#  define PNG_WARNINGS_SUPPORTED
     130#endif
     131
     132/* Added at libpng version 1.4.0 */
     133#if !defined(PNG_NO_ERROR_TEXT) && !defined(PNG_ERROR_TEXT_SUPPORTED)
     134#  define PNG_ERROR_TEXT_SUPPORTED
     135#endif
     136
     137/* Added at libpng version 1.4.0 */
     138#if !defined(PNG_NO_CHECK_cHRM) && !defined(PNG_CHECK_cHRM_SUPPORTED)
     139#  define PNG_CHECK_cHRM_SUPPORTED
     140#endif
     141
     142/* Added at libpng version 1.4.0 */
     143#if !defined(PNG_NO_ALIGNED_MEMORY) && !defined(PNG_ALIGNED_MEMORY_SUPPORTED)
     144#  define PNG_ALIGNED_MEMORY_SUPPORTED
     145#endif
     146
    118147/* Enabled by default in 1.2.0.  You can disable this if you don't need to
    119148   support PNGs that are embedded in MNG datastreams */
    120 #if !defined(PNG_1_0_X) && !defined(PNG_NO_MNG_FEATURES)
     149#ifndef PNG_NO_MNG_FEATURES
    121150#  ifndef PNG_MNG_FEATURES_SUPPORTED
    122151#    define PNG_MNG_FEATURES_SUPPORTED
     
    124153#endif
    125154
     155/* Added at libpng version 1.4.0 */
    126156#ifndef PNG_NO_FLOATING_POINT_SUPPORTED
    127157#  ifndef PNG_FLOATING_POINT_SUPPORTED
     
    129159#  endif
    130160#endif
     161
     162/* Added at libpng-1.4.0beta49 for testing (this test is no longer used
     163   in libpng and png_calloc() is always present)
     164 */
     165#define PNG_CALLOC_SUPPORTED
    131166
    132167/* If you are running on a machine where you cannot allocate more
     
    173208 *   to __declspec() stuff.  However, we DO need to worry about
    174209 *   PNG_BUILD_DLL and PNG_STATIC because those change some defaults
    175  *   such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed.
    176  */
    177 #if defined(__CYGWIN__)
    178 #  if defined(ALL_STATIC)
    179 #    if defined(PNG_BUILD_DLL)
     210 *   such as CONSOLE_IO.
     211 */
     212#ifdef __CYGWIN__
     213#  ifdef ALL_STATIC
     214#    ifdef PNG_BUILD_DLL
    180215#      undef PNG_BUILD_DLL
    181216#    endif
    182 #    if defined(PNG_USE_DLL)
     217#    ifdef PNG_USE_DLL
    183218#      undef PNG_USE_DLL
    184219#    endif
    185 #    if defined(PNG_DLL)
     220#    ifdef PNG_DLL
    186221#      undef PNG_DLL
    187222#    endif
    188 #    if !defined(PNG_STATIC)
     223#    ifndef PNG_STATIC
    189224#      define PNG_STATIC
    190225#    endif
    191226#  else
    192 #    if defined (PNG_BUILD_DLL)
    193 #      if defined(PNG_STATIC)
     227#    ifdef PNG_BUILD_DLL
     228#      ifdef PNG_STATIC
    194229#        undef PNG_STATIC
    195230#      endif
    196 #      if defined(PNG_USE_DLL)
     231#      ifdef PNG_USE_DLL
    197232#        undef PNG_USE_DLL
    198233#      endif
    199 #      if !defined(PNG_DLL)
     234#      ifndef PNG_DLL
    200235#        define PNG_DLL
    201236#      endif
    202237#    else
    203 #      if defined(PNG_STATIC)
    204 #        if defined(PNG_USE_DLL)
     238#      ifdef PNG_STATIC
     239#        ifdef PNG_USE_DLL
    205240#          undef PNG_USE_DLL
    206241#        endif
    207 #        if defined(PNG_DLL)
     242#        ifdef PNG_DLL
    208243#          undef PNG_DLL
    209244#        endif
    210245#      else
    211 #        if !defined(PNG_USE_DLL)
     246#        ifndef PNG_USE_DLL
    212247#          define PNG_USE_DLL
    213248#        endif
    214 #        if !defined(PNG_DLL)
     249#        ifndef PNG_DLL
    215250#          define PNG_DLL
    216251#        endif
     
    233268 */
    234269
    235 #if defined(_WIN32_WCE)
    236 #  include <windows.h>
    237    /* Console I/O functions are not supported on WindowsCE */
    238 #  define PNG_NO_CONSOLE_IO
    239    /* abort() may not be supported on some/all Windows CE platforms */
    240 #  define PNG_ABORT() exit(-1)
    241 #  ifdef PNG_DEBUG
    242 #    undef PNG_DEBUG
    243 #  endif
    244 #endif
     270#if !defined(PNG_NO_STDIO) && !defined(PNG_STDIO_SUPPORTED)
     271#  define PNG_STDIO_SUPPORTED
     272#endif
     273
    245274
    246275#ifdef PNG_BUILD_DLL
    247 #  ifndef PNG_CONSOLE_IO_SUPPORTED
    248 #    ifndef PNG_NO_CONSOLE_IO
    249 #      define PNG_NO_CONSOLE_IO
    250 #    endif
     276#  if !defined(PNG_CONSOLE_IO_SUPPORTED) && !defined(PNG_NO_CONSOLE_IO)
     277#    define PNG_NO_CONSOLE_IO
    251278#  endif
    252279#endif
     
    262289#    endif
    263290#  else
    264 #    if !defined(_WIN32_WCE)
    265 /* "stdio.h" functions are not supported on WindowsCE */
    266 #      include <stdio.h>
    267 #    endif
    268 #  endif
     291#    include <stdio.h>
     292#  endif
     293
     294#if !(defined PNG_NO_CONSOLE_IO) && !defined(PNG_CONSOLE_IO_SUPPORTED)
     295#  define PNG_CONSOLE_IO_SUPPORTED
     296#endif
    269297
    270298/* This macro protects us against machines that don't have function
     
    283311#ifdef _NO_PROTO
    284312#  define PNGARG(arglist) ()
    285 #  ifndef PNG_TYPECAST_NULL
    286 #     define PNG_TYPECAST_NULL
    287 #  endif
    288313#else
    289314#  define PNGARG(arglist) arglist
    290315#endif /* _NO_PROTO */
    291 
    292316
    293317#endif /* OF */
     
    306330#endif
    307331
    308 /* enough people need this for various reasons to include it here */
     332/* Enough people need this for various reasons to include it here */
    309333#if !defined(MACOS) && !defined(RISCOS) && !defined(_WIN32_WCE)
    310334#  include <sys/types.h>
    311335#endif
    312336
    313 #if !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED)
     337/* PNG_SETJMP_NOT_SUPPORTED and PNG_NO_SETJMP_SUPPORTED are deprecated. */
     338#if !defined(PNG_NO_SETJMP) && \
     339    !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED)
    314340#  define PNG_SETJMP_SUPPORTED
    315341#endif
     
    342368#  endif /* PNG_SKIP_SETJMP_CHECK */
    343369
    344    /* include setjmp.h for error handling */
     370   /* Include setjmp.h for error handling */
    345371#  include <setjmp.h>
    346372
    347373#  ifdef __linux__
    348374#    ifdef PNG_SAVE_BSD_SOURCE
    349 #      ifndef _BSD_SOURCE
    350 #        define _BSD_SOURCE
     375#      ifdef _BSD_SOURCE
     376#        undef _BSD_SOURCE
    351377#      endif
     378#      define _BSD_SOURCE
    352379#      undef PNG_SAVE_BSD_SOURCE
    353380#    endif
     
    362389
    363390/* Other defines for things like memory and the like can go here.  */
    364 #ifdef PNG_INTERNAL
    365 
    366 #include <stdlib.h>
    367 
    368 /* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which
    369  * aren't usually used outside the library (as far as I know), so it is
    370  * debatable if they should be exported at all.  In the future, when it is
    371  * possible to have run-time registry of chunk-handling functions, some of
    372  * these will be made available again.
    373 #define PNG_EXTERN extern
    374  */
    375 #define PNG_EXTERN
    376 
    377 /* Other defines specific to compilers can go here.  Try to keep
    378  * them inside an appropriate ifdef/endif pair for portability.
    379  */
    380 
    381 #if defined(PNG_FLOATING_POINT_SUPPORTED)
    382 #  if defined(MACOS)
    383      /* We need to check that <math.h> hasn't already been included earlier
    384       * as it seems it doesn't agree with <fp.h>, yet we should really use
    385       * <fp.h> if possible.
    386       */
    387 #    if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
    388 #      include <fp.h>
    389 #    endif
    390 #  else
    391 #    include <math.h>
    392 #  endif
    393 #  if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
    394      /* Amiga SAS/C: We must include builtin FPU functions when compiling using
    395       * MATH=68881
    396       */
    397 #    include <m68881.h>
    398 #  endif
    399 #endif
    400 
    401 /* Codewarrior on NT has linking problems without this. */
    402 #if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__)
    403 #  define PNG_ALWAYS_EXTERN
    404 #endif
    405 
    406 /* This provides the non-ANSI (far) memory allocation routines. */
    407 #if defined(__TURBOC__) && defined(__MSDOS__)
    408 #  include <mem.h>
    409 #  include <alloc.h>
    410 #endif
    411 
    412 /* I have no idea why is this necessary... */
    413 #if defined(_MSC_VER) && (defined(WIN32) || defined(_Windows) || \
    414     defined(_WINDOWS) || defined(_WIN32) || defined(__WIN32__))
    415 #  include <malloc.h>
    416 #endif
    417391
    418392/* This controls how fine the dithering gets.  As this allocates
     
    448422#endif
    449423
    450 #endif /* PNG_INTERNAL */
    451 
    452424/* The following uses const char * instead of char * for error
    453425 * and warning message functions, so some compilers won't complain.
     
    455427 */
    456428
    457 #ifndef PNG_NO_CONST
    458 #  define PNG_CONST const
    459 #else
    460 #  define PNG_CONST
     429#ifndef PNG_CONST
     430#  ifndef PNG_NO_CONST
     431#    define PNG_CONST const
     432#  else
     433#    define PNG_CONST
     434#  endif
    461435#endif
    462436
     
    478452
    479453/* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user
    480  * to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS
    481  * on the compile line, then pick and choose which ones to define without
    482  * having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED
     454 * to turn it off with PNG_NO_READ|WRITE_TRANSFORMS on the compile line,
     455 * then pick and choose which ones to define without having to edit this
     456 * file. It is safe to use the PNG_NO_READ|WRITE_TRANSFORMS
    483457 * if you only want to have a png-compliant reader/writer but don't need
    484458 * any of the extra transformations.  This saves about 80 kbytes in a
    485459 * typical installation of the library. (PNG_NO_* form added in version
    486  * 1.0.1c, for consistency)
    487  */
    488 
    489 /* The size of the png_text structure changed in libpng-1.0.6 when
    490  * iTXt support was added.  iTXt support was turned off by default through
    491  * libpng-1.2.x, to support old apps that malloc the png_text structure
    492  * instead of calling png_set_text() and letting libpng malloc it.  It
    493  * will be turned on by default in libpng-1.4.0.
    494  */
    495 
    496 #if defined(PNG_1_0_X) || defined (PNG_1_2_X)
    497 #  ifndef PNG_NO_iTXt_SUPPORTED
    498 #    define PNG_NO_iTXt_SUPPORTED
    499 #  endif
    500 #  ifndef PNG_NO_READ_iTXt
    501 #    define PNG_NO_READ_iTXt
    502 #  endif
    503 #  ifndef PNG_NO_WRITE_iTXt
    504 #    define PNG_NO_WRITE_iTXt
    505 #  endif
    506 #endif
    507 
    508 #if !defined(PNG_NO_iTXt_SUPPORTED)
    509 #  if !defined(PNG_READ_iTXt_SUPPORTED) && !defined(PNG_NO_READ_iTXt)
    510 #    define PNG_READ_iTXt
    511 #  endif
    512 #  if !defined(PNG_WRITE_iTXt_SUPPORTED) && !defined(PNG_NO_WRITE_iTXt)
    513 #    define PNG_WRITE_iTXt
    514 #  endif
    515 #endif
    516 
    517 /* The following support, added after version 1.0.0, can be turned off here en
    518  * masse by defining PNG_LEGACY_SUPPORTED in case you need binary compatibility
    519  * with old applications that require the length of png_struct and png_info
    520  * to remain unchanged.
    521  */
    522 
    523 #ifdef PNG_LEGACY_SUPPORTED
    524 #  define PNG_NO_FREE_ME
    525 #  define PNG_NO_READ_UNKNOWN_CHUNKS
    526 #  define PNG_NO_WRITE_UNKNOWN_CHUNKS
    527 #  define PNG_NO_HANDLE_AS_UNKNOWN
    528 #  define PNG_NO_READ_USER_CHUNKS
    529 #  define PNG_NO_READ_iCCP
    530 #  define PNG_NO_WRITE_iCCP
    531 #  define PNG_NO_READ_iTXt
    532 #  define PNG_NO_WRITE_iTXt
    533 #  define PNG_NO_READ_sCAL
    534 #  define PNG_NO_WRITE_sCAL
    535 #  define PNG_NO_READ_sPLT
    536 #  define PNG_NO_WRITE_sPLT
    537 #  define PNG_NO_INFO_IMAGE
    538 #  define PNG_NO_READ_RGB_TO_GRAY
    539 #  define PNG_NO_READ_USER_TRANSFORM
    540 #  define PNG_NO_WRITE_USER_TRANSFORM
    541 #  define PNG_NO_USER_MEM
    542 #  define PNG_NO_READ_EMPTY_PLTE
    543 #  define PNG_NO_MNG_FEATURES
    544 #  define PNG_NO_FIXED_POINT_SUPPORTED
    545 #endif
     460 * 1.0.1c, for consistency; PNG_*_TRANSFORMS_NOT_SUPPORTED deprecated in
     461 * 1.4.0)
     462 */
    546463
    547464/* Ignore attempt to turn off both floating and fixed point support */
     
    551468#endif
    552469
    553 #ifndef PNG_NO_FREE_ME
    554 #  define PNG_FREE_ME_SUPPORTED
    555 #endif
    556 
    557470#ifdef PNG_READ_SUPPORTED
    558471
     472/* PNG_READ_TRANSFORMS_NOT_SUPPORTED is deprecated. */
    559473#if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
    560474      !defined(PNG_NO_READ_TRANSFORMS)
     
    584498#    define PNG_READ_INVERT_SUPPORTED
    585499#  endif
     500#if 0 /* removed from libpng-1.4.0 */
    586501#  ifndef PNG_NO_READ_DITHER
    587502#    define PNG_READ_DITHER_SUPPORTED
    588503#  endif
     504#endif /* 0 */
    589505#  ifndef PNG_NO_READ_BACKGROUND
    590506#    define PNG_READ_BACKGROUND_SUPPORTED
     
    619535#endif /* PNG_READ_TRANSFORMS_SUPPORTED */
    620536
     537/* PNG_PROGRESSIVE_READ_NOT_SUPPORTED is deprecated. */
    621538#if !defined(PNG_NO_PROGRESSIVE_READ) && \
    622  !defined(PNG_PROGRESSIVE_READ_SUPPORTED) /* if you don't do progressive   */
    623 #  define PNG_PROGRESSIVE_READ_SUPPORTED  /* reading.  This is not talking */
    624 #endif                            /* about interlacing capability!  You'll */
    625            /* still have interlacing unless you change the following line: */
    626 
    627 #define PNG_READ_INTERLACING_SUPPORTED /* required in PNG-compliant decoders */
     539 !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED)  /* if you don't do progressive */
     540#  define PNG_PROGRESSIVE_READ_SUPPORTED     /* reading.  This is not talking */
     541#endif                               /* about interlacing capability!  You'll */
     542            /* still have interlacing unless you change the following define: */
     543
     544#define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */
     545
     546/* PNG_NO_SEQUENTIAL_READ_SUPPORTED is deprecated. */
     547#if !defined(PNG_NO_SEQUENTIAL_READ) && \
     548    !defined(PNG_SEQUENTIAL_READ_SUPPORTED) && \
     549    !defined(PNG_NO_SEQUENTIAL_READ_SUPPORTED)
     550#  define PNG_SEQUENTIAL_READ_SUPPORTED
     551#endif
    628552
    629553#ifndef PNG_NO_READ_COMPOSITE_NODIV
    630554#  ifndef PNG_NO_READ_COMPOSITED_NODIV  /* libpng-1.0.x misspelling */
    631 #    define PNG_READ_COMPOSITE_NODIV_SUPPORTED  /* well tested on Intel, SGI */
    632 #  endif
    633 #endif
    634 
    635 #if defined(PNG_1_0_X) || defined (PNG_1_2_X)
    636 /* Deprecated, will be removed from version 2.0.0.
    637    Use PNG_MNG_FEATURES_SUPPORTED instead. */
    638 #ifndef PNG_NO_READ_EMPTY_PLTE
    639 #  define PNG_READ_EMPTY_PLTE_SUPPORTED
    640 #endif
     555#    define PNG_READ_COMPOSITE_NODIV_SUPPORTED   /* well tested on Intel, SGI */
     556#  endif
     557#endif
     558
     559#if !defined(PNG_NO_GET_INT_32) || defined(PNG_READ_oFFS_SUPPORTED) || \
     560    defined(PNG_READ_pCAL_SUPPORTED)
     561#  ifndef PNG_GET_INT_32_SUPPORTED
     562#    define PNG_GET_INT_32_SUPPORTED
     563#  endif
    641564#endif
    642565
     
    645568#ifdef PNG_WRITE_SUPPORTED
    646569
    647 # if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
     570/* PNG_WRITE_TRANSFORMS_NOT_SUPPORTED is deprecated. */
     571#if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
    648572    !defined(PNG_NO_WRITE_TRANSFORMS)
    649573#  define PNG_WRITE_TRANSFORMS_SUPPORTED
     
    685609#if !defined(PNG_NO_WRITE_INTERLACING_SUPPORTED) && \
    686610    !defined(PNG_WRITE_INTERLACING_SUPPORTED)
    687 #define PNG_WRITE_INTERLACING_SUPPORTED  /* not required for PNG-compliant
    688                                             encoders, but can cause trouble
    689                                             if left undefined */
     611    /* This is not required for PNG-compliant encoders, but can cause
     612     * trouble if left undefined
     613    */
     614#  define PNG_WRITE_INTERLACING_SUPPORTED
    690615#endif
    691616
     
    700625#endif
    701626
    702 #if defined(PNG_1_0_X) || defined (PNG_1_2_X)
    703 /* Deprecated, see PNG_MNG_FEATURES_SUPPORTED, above */
    704 #ifndef PNG_NO_WRITE_EMPTY_PLTE
    705 define PNG_WRITE_EMPTY_PLTE_SUPPORTED
    706 #endif
     627#if !defined(PNG_NO_SAVE_INT_32) || defined(PNG_WRITE_oFFS_SUPPORTED) || \
     628    defined(PNG_WRITE_pCAL_SUPPORTED)
     629#  ifndef PNG_SAVE_INT_32_SUPPORTED
     630  define PNG_SAVE_INT_32_SUPPORTED
     631#  endif
    707632#endif
    708633
    709634#endif /* PNG_WRITE_SUPPORTED */
    710635
    711 #ifndef PNG_1_0_X
    712 #  ifndef PNG_NO_ERROR_NUMBERS
    713 #    define PNG_ERROR_NUMBERS_SUPPORTED
    714 #  endif
    715 #endif /* PNG_1_0_X */
     636#define PNG_NO_ERROR_NUMBERS
    716637
    717638#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
     
    722643#endif
    723644
    724 #ifndef PNG_NO_STDIO
     645#if defined(PNG_STDIO_SUPPORTED) && !defined(PNG_TIME_RFC1123_SUPPORTED)
    725646#  define PNG_TIME_RFC1123_SUPPORTED
    726647#endif
     
    746667#endif
    747668
    748 /* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0
    749  * and removed from version 1.2.20.  The following will be removed
    750  * from libpng-1.4.0
    751 */
    752 
    753 #if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_OPTIMIZED_CODE)
    754 #  ifndef PNG_OPTIMIZED_CODE_SUPPORTED
    755 #    define PNG_OPTIMIZED_CODE_SUPPORTED
    756 #  endif
    757 #endif
    758 
    759 #if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE)
    760 #  ifndef PNG_ASSEMBLER_CODE_SUPPORTED
    761 #    define PNG_ASSEMBLER_CODE_SUPPORTED
    762 #  endif
    763 
    764 #  if defined(__GNUC__) && defined(__x86_64__) && (__GNUC__ < 4)
    765      /* work around 64-bit gcc compiler bugs in gcc-3.x */
    766 #    if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
    767 #      define PNG_NO_MMX_CODE
    768 #    endif
    769 #  endif
    770 
    771 #  if defined(__APPLE__)
    772 #    if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
    773 #      define PNG_NO_MMX_CODE
    774 #    endif
    775 #  endif
    776 
    777 #  if (defined(__MWERKS__) && ((__MWERKS__ < 0x0900) || macintosh))
    778 #    if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
    779 #      define PNG_NO_MMX_CODE
    780 #    endif
    781 #  endif
    782 
    783 #  if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
    784 #    define PNG_MMX_CODE_SUPPORTED
    785 #  endif
    786 
    787 #endif
    788 /* end of obsolete code to be removed from libpng-1.4.0 */
    789 
    790 #if !defined(PNG_1_0_X)
     669/* Added at libpng-1.2.0 */
    791670#if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED)
    792671#  define PNG_USER_MEM_SUPPORTED
    793672#endif
    794 #endif /* PNG_1_0_X */
    795673
    796674/* Added at libpng-1.2.6 */
    797 #if !defined(PNG_1_0_X)
    798675#ifndef PNG_SET_USER_LIMITS_SUPPORTED
    799 #if !defined(PNG_NO_SET_USER_LIMITS) && !defined(PNG_SET_USER_LIMITS_SUPPORTED)
    800 #  define PNG_SET_USER_LIMITS_SUPPORTED
    801 #endif
    802 #endif
    803 #endif /* PNG_1_0_X */
    804 
    805 /* Added at libpng-1.0.16 and 1.2.6.  To accept all valid PNGS no matter
     676#  ifndef PNG_NO_SET_USER_LIMITS
     677#    define PNG_SET_USER_LIMITS_SUPPORTED
     678#  endif
     679#endif
     680
     681/* Added at libpng-1.0.16 and 1.2.6.  To accept all valid PNGs no matter
    806682 * how large, set these limits to 0x7fffffffL
    807683 */
     
    813689#endif
    814690
    815 /* Added at libpng-1.2.34 and 1.4.0 */
     691/* Added at libpng-1.4.0 */
     692#ifndef PNG_USER_CHUNK_CACHE_MAX
     693#  define PNG_USER_CHUNK_CACHE_MAX 0x7fffffffL
     694#endif
     695
     696/* Added at libpng-1.4.0 */
     697#if !defined(PNG_NO_IO_STATE) && !defined(PNG_IO_STATE_SUPPORTED)
     698#  define PNG_IO_STATE_SUPPORTED
     699#endif
     700
     701#ifndef PNG_LITERAL_SHARP
     702#  define PNG_LITERAL_SHARP 0x23
     703#endif
     704#ifndef PNG_LITERAL_LEFT_SQUARE_BRACKET
     705#  define PNG_LITERAL_LEFT_SQUARE_BRACKET 0x5b
     706#endif
     707#ifndef PNG_LITERAL_RIGHT_SQUARE_BRACKET
     708#  define PNG_LITERAL_RIGHT_SQUARE_BRACKET 0x5d
     709#endif
    816710#ifndef PNG_STRING_NEWLINE
    817711#define PNG_STRING_NEWLINE "\n"
     
    820714/* These are currently experimental features, define them if you want */
    821715
    822 /* very little testing */
     716/* Very little testing */
    823717/*
    824718#ifdef PNG_READ_SUPPORTED
     
    837731*/
    838732
    839 /* Buggy compilers (e.g., gcc 2.7.2.2) need this */
    840 /*
    841 #define PNG_NO_POINTER_INDEXING
    842 */
    843 
    844 /* These functions are turned off by default, as they will be phased out. */
    845 /*
    846 #define  PNG_USELESS_TESTS_SUPPORTED
    847 #define  PNG_CORRECT_PALETTE_SUPPORTED
    848 */
     733#if !defined(PNG_NO_USE_READ_MACROS) && !defined(PNG_USE_READ_MACROS)
     734#  define PNG_USE_READ_MACROS
     735#endif
     736
     737/* Buggy compilers (e.g., gcc 2.7.2.2) need PNG_NO_POINTER_INDEXING */
     738
     739#if !defined(PNG_NO_POINTER_INDEXING) && \
     740    !defined(PNG_POINTER_INDEXING_SUPPORTED)
     741#  define PNG_POINTER_INDEXING_SUPPORTED
     742#endif
     743
    849744
    850745/* Any chunks you are not interested in, you can undef here.  The
     
    854749 */
    855750
     751/* The size of the png_text structure changed in libpng-1.0.6 when
     752 * iTXt support was added.  iTXt support was turned off by default through
     753 * libpng-1.2.x, to support old apps that malloc the png_text structure
     754 * instead of calling png_set_text() and letting libpng malloc it.  It
     755 * was turned on by default in libpng-1.4.0.
     756 */
     757
     758/* PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED is deprecated. */
    856759#if defined(PNG_READ_SUPPORTED) && \
    857760    !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
     
    860763#endif
    861764
     765/* PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED is deprecated. */
    862766#if defined(PNG_WRITE_SUPPORTED) && \
    863767    !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
     
    873777#  define PNG_NO_READ_zTXt
    874778#endif
     779
    875780#ifndef PNG_NO_READ_bKGD
    876781#  define PNG_READ_bKGD_SUPPORTED
     
    973878#  endif
    974879#endif
    975 
    976880#ifndef PNG_NO_HANDLE_AS_UNKNOWN
    977881#  ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
     
    11001004#endif
    11011005
     1006#ifdef PNG_WRITE_tIME_SUPPORTED
     1007#  ifndef PNG_NO_CONVERT_tIME
     1008#    ifndef _WIN32_WCE
     1009/*   The "tm" structure is not supported on WindowsCE */
     1010#      ifndef PNG_CONVERT_tIME_SUPPORTED
     1011#        define PNG_CONVERT_tIME_SUPPORTED
     1012#      endif
     1013#   endif
     1014#  endif
     1015#endif
     1016
    11021017#endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
     1018
     1019#if !defined(PNG_NO_WRITE_FILTER) && !defined(PNG_WRITE_FILTER_SUPPORTED)
     1020#  define PNG_WRITE_FILTER_SUPPORTED
     1021#endif
    11031022
    11041023#ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
     
    11081027#  endif
    11091028#endif
    1110 
    11111029#ifndef PNG_NO_HANDLE_AS_UNKNOWN
    11121030#  ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
     
    11241042#endif
    11251043
    1126 /* need the time information for reading tIME chunks */
    1127 #if defined(PNG_tIME_SUPPORTED)
    1128 #  if !defined(_WIN32_WCE)
     1044/* Need the time information for converting tIME chunks */
     1045#ifdef PNG_CONVERT_tIME_SUPPORTED
    11291046     /* "time.h" functions are not supported on WindowsCE */
    11301047#    include <time.h>
    1131 #  endif
    11321048#endif
    11331049
     
    11371053 * don't have to be exactly that size.  Some compilers dislike passing
    11381054 * unsigned shorts as function parameters, so you may be better off using
    1139  * unsigned int for png_uint_16.  Likewise, for 64-bit systems, you may
    1140  * want to have unsigned int for png_uint_32 instead of unsigned long.
    1141  */
    1142 
     1055 * unsigned int for png_uint_16.
     1056 */
     1057
     1058#if defined(INT_MAX) && (INT_MAX > 0x7ffffffeL)
     1059typedef unsigned int png_uint_32;
     1060typedef int png_int_32;
     1061#else
    11431062typedef unsigned long png_uint_32;
    11441063typedef long png_int_32;
     1064#endif
    11451065typedef unsigned short png_uint_16;
    11461066typedef short png_int_16;
    11471067typedef unsigned char png_byte;
    11481068
    1149 /* This is usually size_t.  It is typedef'ed just in case you need it to
    1150    change (I'm not sure if you will or not, so I thought I'd be safe) */
    1151 #ifdef PNG_SIZE_T
    1152    typedef PNG_SIZE_T png_size_t;
    1153 #  define png_sizeof(x) png_convert_size(sizeof(x))
     1069#ifdef PNG_NO_SIZE_T
     1070   typedef unsigned int png_size_t;
    11541071#else
    11551072   typedef size_t png_size_t;
    1156 #  define png_sizeof(x) sizeof(x)
    1157 #endif
     1073#endif
     1074#define png_sizeof(x) sizeof(x)
    11581075
    11591076/* The following is needed for medium model support.  It cannot be in the
    1160  * PNG_INTERNAL section.  Needs modification for other compilers besides
     1077 * pngpriv.h header.  Needs modification for other compilers besides
    11611078 * MSC.  Model independent support declares all arrays and pointers to be
    11621079 * large using the far keyword.  The zlib version used must also support
     
    11671084
    11681085/* Separate compiler dependencies (problem here is that zlib.h always
    1169    defines FAR. (SJT) */
     1086 * defines FAR. (SJT)
     1087 */
    11701088#ifdef __BORLANDC__
    11711089#  if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
     
    11981116
    11991117/* MSC Medium model */
    1200 #if defined(FAR)
    1201 #  if defined(M_I86MM)
     1118#ifdef FAR
     1119#  ifdef M_I86MM
    12021120#    define USE_FAR_KEYWORD
    12031121#    define FARDATA FAR
     
    12321150
    12331151#ifndef PNG_NO_STDIO
    1234 #if defined(_WIN32_WCE)
    1235 typedef HANDLE                png_FILE_p;
    1236 #else
    12371152typedef FILE                * png_FILE_p;
    1238 #endif
    12391153#endif
    12401154
     
    12591173typedef char            FAR * FAR * FAR * png_charppp;
    12601174
    1261 #if defined(PNG_1_0_X) || defined(PNG_1_2_X)
    1262 /* SPC -  Is this stuff deprecated? */
    1263 /* It'll be removed as of libpng-1.4.0 - GR-P */
    1264 /* libpng typedefs for types in zlib. If zlib changes
    1265  * or another compression library is used, then change these.
    1266  * Eliminates need to change all the source files.
    1267  */
    1268 typedef charf *         png_zcharp;
    1269 typedef charf * FAR *   png_zcharpp;
    1270 typedef z_stream FAR *  png_zstreamp;
    1271 #endif /* (PNG_1_0_X) || defined(PNG_1_2_X) */
    1272 
    1273 /*
    1274  * Define PNG_BUILD_DLL if the module being built is a Windows
     1175/* Define PNG_BUILD_DLL if the module being built is a Windows
    12751176 * LIBPNG DLL.
    12761177 *
     
    12921193#  define PNG_DLL
    12931194#endif
    1294 /* If CYGWIN, then disallow GLOBAL ARRAYS unless building a static lib.
    1295  * When building a static lib, default to no GLOBAL ARRAYS, but allow
    1296  * command-line override
    1297  */
    1298 #if defined(__CYGWIN__)
    1299 #  if !defined(PNG_STATIC)
    1300 #    if defined(PNG_USE_GLOBAL_ARRAYS)
    1301 #      undef PNG_USE_GLOBAL_ARRAYS
    1302 #    endif
    1303 #    if !defined(PNG_USE_LOCAL_ARRAYS)
    1304 #      define PNG_USE_LOCAL_ARRAYS
    1305 #    endif
    1306 #  else
    1307 #    if defined(PNG_USE_LOCAL_ARRAYS) || defined(PNG_NO_GLOBAL_ARRAYS)
    1308 #      if defined(PNG_USE_GLOBAL_ARRAYS)
    1309 #        undef PNG_USE_GLOBAL_ARRAYS
    1310 #      endif
    1311 #    endif
    1312 #  endif
    1313 #  if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
    1314 #    define PNG_USE_LOCAL_ARRAYS
    1315 #  endif
    1316 #endif
    1317 
    1318 /* Do not use global arrays (helps with building DLL's)
    1319  * They are no longer used in libpng itself, since version 1.0.5c,
    1320  * but might be required for some pre-1.0.5c applications.
    1321  */
    1322 #if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
    1323 #  if defined(PNG_NO_GLOBAL_ARRAYS) || \
    1324       (defined(__GNUC__) && defined(PNG_DLL)) || defined(_MSC_VER)
    1325 #    define PNG_USE_LOCAL_ARRAYS
    1326 #  else
    1327 #    define PNG_USE_GLOBAL_ARRAYS
    1328 #  endif
    1329 #endif
    1330 
    1331 #if defined(__CYGWIN__)
     1195
     1196#ifdef __CYGWIN__
    13321197#  undef PNGAPI
    13331198#  define PNGAPI __cdecl
     
    13351200#  define PNG_IMPEXP
    13361201#endif
     1202
     1203#define PNG_USE_LOCAL_ARRAYS /* Not used in libpng, defined for legacy apps */
    13371204
    13381205/* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall",
     
    13721239#  endif
    13731240
    1374 #  if !defined(PNG_IMPEXP)
    1375 
    1376 #     define PNG_EXPORT_TYPE1(type,symbol)  PNG_IMPEXP type PNGAPI symbol
    1377 #     define PNG_EXPORT_TYPE2(type,symbol)  type PNG_IMPEXP PNGAPI symbol
    1378 
    1379       /* Borland/Microsoft */
    1380 #     if defined(_MSC_VER) || defined(__BORLANDC__)
    1381 #        if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500)
    1382 #           define PNG_EXPORT PNG_EXPORT_TYPE1
    1383 #        else
    1384 #           define PNG_EXPORT PNG_EXPORT_TYPE2
    1385 #           if defined(PNG_BUILD_DLL)
    1386 #              define PNG_IMPEXP __export
    1387 #           else
    1388 #              define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in
    1389                                                  VC++ */
    1390 #           endif                             /* Exists in Borland C++ for
    1391                                                  C++ classes (== huge) */
    1392 #        endif
    1393 #     endif
    1394 
    1395 #     if !defined(PNG_IMPEXP)
    1396 #        if defined(PNG_BUILD_DLL)
    1397 #           define PNG_IMPEXP __declspec(dllexport)
    1398 #        else
    1399 #           define PNG_IMPEXP __declspec(dllimport)
    1400 #        endif
    1401 #     endif
     1241#  ifndef PNG_IMPEXP
     1242
     1243#    define PNG_EXPORT_TYPE1(type,symbol)  PNG_IMPEXP type PNGAPI symbol
     1244#    define PNG_EXPORT_TYPE2(type,symbol)  type PNG_IMPEXP PNGAPI symbol
     1245
     1246     /* Borland/Microsoft */
     1247#    if defined(_MSC_VER) || defined(__BORLANDC__)
     1248#      if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500)
     1249#         define PNG_EXPORT PNG_EXPORT_TYPE1
     1250#      else
     1251#         define PNG_EXPORT PNG_EXPORT_TYPE2
     1252#         ifdef PNG_BUILD_DLL
     1253#            define PNG_IMPEXP __export
     1254#         else
     1255#            define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in VC++ */
     1256#         endif                              /* Exists in Borland C++ for
     1257                                                C++ classes (== huge) */
     1258#      endif
     1259#    endif
     1260
     1261#    ifndef PNG_IMPEXP
     1262#      ifdef PNG_BUILD_DLL
     1263#        define PNG_IMPEXP __declspec(dllexport)
     1264#      else
     1265#        define PNG_IMPEXP __declspec(dllimport)
     1266#      endif
     1267#    endif
    14021268#  endif  /* PNG_IMPEXP */
    14031269#else /* !(DLL || non-cygwin WINDOWS) */
    14041270#   if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
    1405 #      ifndef PNGAPI
    1406 #         define PNGAPI _System
    1407 #      endif
     1271#     ifndef PNGAPI
     1272#       define PNGAPI _System
     1273#     endif
    14081274#   else
    1409 #      if 0 /* ... other platforms, with other meanings */
    1410 #      endif
     1275#     if 0 /* ... other platforms, with other meanings */
     1276#     endif
    14111277#   endif
    14121278
     
    14311297#    define PNG_EXPORT(type,symbol) PNG_FUNCTION_EXPORT symbol END
    14321298#  endif
    1433 #  ifdef PNG_USE_GLOBAL_ARRAYS
    1434 #    ifndef PNG_EXPORT_VAR
    1435 #      define PNG_EXPORT_VAR(type) PNG_DATA_EXPORT
    1436 #    endif
    1437 #  endif
    14381299#endif
    14391300
     
    14421303#endif
    14431304
    1444 #ifdef PNG_USE_GLOBAL_ARRAYS
    1445 #  ifndef PNG_EXPORT_VAR
    1446 #    define PNG_EXPORT_VAR(type) extern PNG_IMPEXP type
    1447 #  endif
    1448 #endif
    1449 
    1450 /* User may want to use these so they are not in PNG_INTERNAL. Any library
    1451  * functions that are passed far data must be model independent.
    1452  */
    1453 
     1305/* Support for compiler specific function attributes.  These are used
     1306 * so that where compiler support is available incorrect use of API
     1307 * functions in png.h will generate compiler warnings.
     1308 *
     1309 * Added at libpng-1.2.41.
     1310 */
     1311
     1312#ifndef PNG_NO_PEDANTIC_WARNINGS
     1313#  ifndef PNG_PEDANTIC_WARNINGS_SUPPORTED
     1314#    define PNG_PEDANTIC_WARNINGS_SUPPORTED
     1315#  endif
     1316#endif
     1317
     1318#ifdef PNG_PEDANTIC_WARNINGS_SUPPORTED
     1319/* Support for compiler specific function attributes.  These are used
     1320 * so that where compiler support is available incorrect use of API
     1321 * functions in png.h will generate compiler warnings.  Added at libpng
     1322 * version 1.2.41.
     1323 */
     1324#  ifdef __GNUC__
     1325#    ifndef PNG_USE_RESULT
     1326#      define PNG_USE_RESULT __attribute__((__warn_unused_result__))
     1327#    endif
     1328#    ifndef PNG_NORETURN
     1329#      define PNG_NORETURN   __attribute__((__noreturn__))
     1330#    endif
     1331#    ifndef PNG_ALLOCATED
     1332#      define PNG_ALLOCATED  __attribute__((__malloc__))
     1333#    endif
     1334
     1335    /* This specifically protects structure members that should only be
     1336     * accessed from within the library, therefore should be empty during
     1337     * a library build.
     1338     */
     1339#    ifndef PNG_DEPRECATED
     1340#      define PNG_DEPRECATED __attribute__((__deprecated__))
     1341#    endif
     1342#    ifndef PNG_DEPSTRUCT
     1343#      define PNG_DEPSTRUCT  __attribute__((__deprecated__))
     1344#    endif
     1345#    ifndef PNG_PRIVATE
     1346#      if 0 /* Doesn't work so we use deprecated instead*/
     1347#        define PNG_PRIVATE \
     1348          __attribute__((warning("This function is not exported by libpng.")))
     1349#      else
     1350#        define PNG_PRIVATE \
     1351          __attribute__((__deprecated__))
     1352#      endif
     1353#    endif /* PNG_PRIVATE */
     1354#  endif /* __GNUC__ */
     1355#endif /* PNG_PEDANTIC_WARNINGS */
     1356
     1357#ifndef PNG_DEPRECATED
     1358#  define PNG_DEPRECATED  /* Use of this function is deprecated */
     1359#endif
     1360#ifndef PNG_USE_RESULT
     1361#  define PNG_USE_RESULT  /* The result of this function must be checked */
     1362#endif
     1363#ifndef PNG_NORETURN
     1364#  define PNG_NORETURN    /* This function does not return */
     1365#endif
     1366#ifndef PNG_ALLOCATED
     1367#  define PNG_ALLOCATED   /* The result of the function is new memory */
     1368#endif
     1369#ifndef PNG_DEPSTRUCT
     1370#  define PNG_DEPSTRUCT   /* Access to this struct member is deprecated */
     1371#endif
     1372#ifndef PNG_PRIVATE
     1373#  define PNG_PRIVATE     /* This is a private libpng function */
     1374#endif
     1375
     1376/* Users may want to use these so they are not private.  Any library
     1377 * functions that are passed far data must be model-independent.
     1378 */
     1379
     1380/* memory model/platform independent fns */
    14541381#ifndef PNG_ABORT
    1455 #  define PNG_ABORT() abort()
    1456 #endif
    1457 
    1458 #ifdef PNG_SETJMP_SUPPORTED
    1459 #  define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
    1460 #else
    1461 #  define png_jmpbuf(png_ptr) \
    1462    (LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED)
    1463 #endif
    1464 
    1465 #if defined(USE_FAR_KEYWORD)  /* memory model independent fns */
    1466 /* use this to make far-to-near assignments */
     1382#  if defined(_WINDOWS_) || defined(_WIN32_WCE)
     1383#     define PNG_ABORT() ExitProcess(0)
     1384#  else
     1385#     define PNG_ABORT() abort()
     1386#  endif
     1387#endif
     1388
     1389#ifdef USE_FAR_KEYWORD
     1390/* Use this to make far-to-near assignments */
    14671391#  define CHECK   1
    14681392#  define NOCHECK 0
    14691393#  define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
    14701394#  define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
    1471 #  define png_snprintf _fsnprintf   /* Added to v 1.2.19 */
     1395#  define png_strcpy  _fstrcpy
     1396#  define png_strncpy _fstrncpy   /* Added to v 1.2.6 */
    14721397#  define png_strlen  _fstrlen
    14731398#  define png_memcmp  _fmemcmp    /* SJT: added */
    14741399#  define png_memcpy  _fmemcpy
    14751400#  define png_memset  _fmemset
    1476 #else /* use the usual functions */
    1477 #  define CVT_PTR(ptr)         (ptr)
    1478 #  define CVT_PTR_NOCHECK(ptr) (ptr)
    1479 #  ifndef PNG_NO_SNPRINTF
    1480 #    ifdef _MSC_VER
    1481 #      define png_snprintf _snprintf   /* Added to v 1.2.19 */
    1482 #      define png_snprintf2 _snprintf
    1483 #      define png_snprintf6 _snprintf
     1401#  define png_sprintf sprintf
     1402#else
     1403#  ifdef _WINDOWS_  /* Favor Windows over C runtime fns */
     1404#    define CVT_PTR(ptr)         (ptr)
     1405#    define CVT_PTR_NOCHECK(ptr) (ptr)
     1406#    define png_strcpy  lstrcpyA
     1407#    define png_strncpy lstrcpynA
     1408#    define png_strlen  lstrlenA
     1409#    define png_memcmp  memcmp
     1410#    define png_memcpy  CopyMemory
     1411#    define png_memset  memset
     1412#    define png_sprintf wsprintfA
     1413#  else
     1414#    define CVT_PTR(ptr)         (ptr)
     1415#    define CVT_PTR_NOCHECK(ptr) (ptr)
     1416#    define png_strcpy  strcpy
     1417#    define png_strncpy strncpy     /* Added to v 1.2.6 */
     1418#    define png_strlen  strlen
     1419#    define png_memcmp  memcmp      /* SJT: added */
     1420#    define png_memcpy  memcpy
     1421#    define png_memset  memset
     1422#    define png_sprintf sprintf
     1423#    ifndef PNG_NO_SNPRINTF
     1424#      ifdef _MSC_VER
     1425#        define png_snprintf _snprintf   /* Added to v 1.2.19 */
     1426#        define png_snprintf2 _snprintf
     1427#        define png_snprintf6 _snprintf
     1428#      else
     1429#        define png_snprintf snprintf   /* Added to v 1.2.19 */
     1430#        define png_snprintf2 snprintf
     1431#        define png_snprintf6 snprintf
     1432#      endif
    14841433#    else
    1485 #      define png_snprintf snprintf   /* Added to v 1.2.19 */
    1486 #      define png_snprintf2 snprintf
    1487 #      define png_snprintf6 snprintf
    1488 #    endif
     1434       /* You don't have or don't want to use snprintf().  Caution: Using
     1435        * sprintf instead of snprintf exposes your application to accidental
     1436        * or malevolent buffer overflows.  If you don't have snprintf()
     1437        * as a general rule you should provide one (you can get one from
     1438        * Portable OpenSSH).
     1439        */
     1440#      define png_snprintf(s1,n,fmt,x1) sprintf(s1,fmt,x1)
     1441#      define png_snprintf2(s1,n,fmt,x1,x2) sprintf(s1,fmt,x1,x2)
     1442#      define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \
     1443          sprintf(s1,fmt,x1,x2,x3,x4,x5,x6)
     1444#    endif
     1445#  endif
     1446#endif
     1447
     1448/* png_alloc_size_t is guaranteed to be no smaller than png_size_t,
     1449 * and no smaller than png_uint_32.  Casts from png_size_t or png_uint_32
     1450 * to png_alloc_size_t are not necessary; in fact, it is recommended
     1451 * not to use them at all so that the compiler can complain when something
     1452 * turns out to be problematic.
     1453 * Casts in the other direction (from png_alloc_size_t to png_size_t or
     1454 * png_uint_32) should be explicitly applied; however, we do not expect
     1455 * to encounter practical situations that require such conversions.
     1456 */
     1457#if defined(__TURBOC__) && !defined(__FLAT__)
     1458#  define  png_mem_alloc farmalloc
     1459#  define  png_mem_free  farfree
     1460   typedef unsigned long png_alloc_size_t;
     1461#else
     1462#  if defined(_MSC_VER) && defined(MAXSEG_64K)
     1463#    define  png_mem_alloc(s) halloc(s, 1)
     1464#    define  png_mem_free     hfree
     1465     typedef unsigned long    png_alloc_size_t;
    14891466#  else
    1490      /* You don't have or don't want to use snprintf().  Caution: Using
    1491       * sprintf instead of snprintf exposes your application to accidental
    1492       * or malevolent buffer overflows.  If you don't have snprintf()
    1493       * as a general rule you should provide one (you can get one from
    1494       * Portable OpenSSH). */
    1495 #    define png_snprintf(s1,n,fmt,x1) sprintf(s1,fmt,x1)
    1496 #    define png_snprintf2(s1,n,fmt,x1,x2) sprintf(s1,fmt,x1,x2)
    1497 #    define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \
    1498         sprintf(s1,fmt,x1,x2,x3,x4,x5,x6)
    1499 #  endif
    1500 #  define png_strlen  strlen
    1501 #  define png_memcmp  memcmp      /* SJT: added */
    1502 #  define png_memcpy  memcpy
    1503 #  define png_memset  memset
    1504 #endif
    1505 /* End of memory model independent support */
     1467#    if defined(_WINDOWS_) && (!defined(INT_MAX) || INT_MAX <= 0x7ffffffeL)
     1468#      define  png_mem_alloc(s) HeapAlloc(GetProcessHeap(), 0, s)
     1469#      define  png_mem_free(p)  HeapFree(GetProcessHeap(), 0, p)
     1470       typedef DWORD            png_alloc_size_t;
     1471#    else
     1472#      define  png_mem_alloc malloc
     1473#      define  png_mem_free  free
     1474       typedef png_size_t    png_alloc_size_t;
     1475#    endif
     1476#  endif
     1477#endif
     1478/* End of memory model/platform independent support */
    15061479
    15071480/* Just a little check that someone hasn't tried to define something
     
    15131486#endif
    15141487
     1488
    15151489/* Added at libpng-1.2.8 */
    15161490#endif /* PNG_VERSION_INFO_ONLY */
Note: See TracChangeset for help on using the changeset viewer.