src/3rdparty/libpng/pngconf.h
branchGCC_SURGE
changeset 31 5daf16870df6
parent 30 5dc02b23752f
equal deleted inserted replaced
27:93b982ccede2 31:5daf16870df6
     1 
     1 
     2 /* pngconf.h - machine configurable file for libpng
     2 /* pngconf.h - machine configurable file for libpng
     3  *
     3  *
     4  * libpng version 1.2.40 - September 10, 2009
     4  * libpng version 1.4.0 - January 3, 2010
     5  * Copyright (c) 1998-2009 Glenn Randers-Pehrson
     5  * For conditions of distribution and use, see copyright notice in png.h
       
     6  * Copyright (c) 1998-2010 Glenn Randers-Pehrson
     6  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
     7  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
     7  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
     8  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
     8  *
     9  *
     9  * This code is released under the libpng license.
    10  * This code is released under the libpng license.
    10  * For conditions of distribution and use, see the disclaimer
    11  * For conditions of distribution and use, see the disclaimer
    11  * and license in png.h
    12  * and license in png.h
       
    13  *
    12  */
    14  */
    13 
    15 
    14 /* Any machine specific code is near the front of this file, so if you
    16 /* Any machine specific code is near the front of this file, so if you
    15  * are configuring libpng for a machine, you may want to read the section
    17  * are configuring libpng for a machine, you may want to read the section
    16  * starting here down to where it starts to typedef png_color, png_text,
    18  * starting here down to where it starts to typedef png_color, png_text,
    18  */
    20  */
    19 
    21 
    20 #ifndef PNGCONF_H
    22 #ifndef PNGCONF_H
    21 #define PNGCONF_H
    23 #define PNGCONF_H
    22 
    24 
    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
    24 
    37 
    25 /*
    38 /*
       
    39  * Added at libpng-1.2.8
       
    40  *
    26  * PNG_USER_CONFIG has to be defined on the compiler command line. This
    41  * PNG_USER_CONFIG has to be defined on the compiler command line. This
    27  * includes the resource compiler for Windows DLL configurations.
    42  * includes the resource compiler for Windows DLL configurations.
    28  */
    43  */
    29 #ifdef PNG_USER_CONFIG
    44 #ifdef PNG_USER_CONFIG
    30 #  ifndef PNG_USER_PRIVATEBUILD
    45 #  ifndef PNG_USER_PRIVATEBUILD
    31 #    define PNG_USER_PRIVATEBUILD
    46 #    define PNG_USER_PRIVATEBUILD
    32 #  endif
    47 #  endif
    33 #include "pngusr.h"
    48 #  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
       
    41 #endif
    49 #endif
    42 
    50 
    43 /*
    51 /*
    44  * Added at libpng-1.2.8
       
    45  *
       
    46  * If you create a private DLL you need to define in "pngusr.h" the followings:
    52  * If you create a private DLL you need to define in "pngusr.h" the followings:
    47  * #define PNG_USER_PRIVATEBUILD <Describes by whom and why this version of
    53  * #define PNG_USER_PRIVATEBUILD <Describes by whom and why this version of
    48  *        the DLL was built>
    54  *        the DLL was built>
    49  *  e.g. #define PNG_USER_PRIVATEBUILD "Build by MyCompany for xyz reasons."
    55  *  e.g. #define PNG_USER_PRIVATEBUILD "Build by MyCompany for xyz reasons."
    50  * #define PNG_USER_DLLFNAME_POSTFIX <two-letter postfix that serve to
    56  * #define PNG_USER_DLLFNAME_POSTFIX <two-letter postfix that serve to
    60  * - PNG_USER_VERSIONINFO_COMPANYNAME
    66  * - PNG_USER_VERSIONINFO_COMPANYNAME
    61  * - PNG_USER_VERSIONINFO_LEGALTRADEMARKS
    67  * - PNG_USER_VERSIONINFO_LEGALTRADEMARKS
    62  */
    68  */
    63 
    69 
    64 #ifdef __STDC__
    70 #ifdef __STDC__
    65 #ifdef SPECIALBUILD
    71 #  ifdef SPECIALBUILD
    66 #  pragma message("PNG_LIBPNG_SPECIALBUILD (and deprecated SPECIALBUILD)\
    72 #    pragma message("PNG_LIBPNG_SPECIALBUILD (and deprecated SPECIALBUILD)\
    67  are now LIBPNG reserved macros. Use PNG_USER_PRIVATEBUILD instead.")
    73      are now LIBPNG reserved macros. Use PNG_USER_PRIVATEBUILD instead.")
    68 #endif
    74 #  endif
    69 
    75 
    70 #ifdef PRIVATEBUILD
    76 #  ifdef PRIVATEBUILD
    71 # pragma message("PRIVATEBUILD is deprecated.\
    77 #    pragma message("PRIVATEBUILD is deprecated.\
    72  Use PNG_USER_PRIVATEBUILD instead.")
    78      Use PNG_USER_PRIVATEBUILD instead.")
    73 # define PNG_USER_PRIVATEBUILD PRIVATEBUILD
    79 #    define PNG_USER_PRIVATEBUILD PRIVATEBUILD
    74 #endif
    80 #  endif
    75 #endif /* __STDC__ */
    81 #endif /* __STDC__ */
    76 
    82 
       
    83 /* End of material added to libpng-1.2.8 */
       
    84 
    77 #ifndef PNG_VERSION_INFO_ONLY
    85 #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 */
       
    88 
    86 
    89 /* This is the size of the compression buffer, and thus the size of
    87 /* This is the size of the compression buffer, and thus the size of
    90  * an IDAT chunk.  Make this whatever size you feel is best for your
    88  * an IDAT chunk.  Make this whatever size you feel is best for your
    91  * machine.  One of these will be allocated per png_struct.  When this
    89  * machine.  One of these will be allocated per png_struct.  When this
    92  * is full, it writes the data to the disk, and does some other
    90  * is full, it writes the data to the disk, and does some other
   113 
   111 
   114 #ifndef PNG_NO_WRITE_SUPPORTED
   112 #ifndef PNG_NO_WRITE_SUPPORTED
   115 #  define PNG_WRITE_SUPPORTED
   113 #  define PNG_WRITE_SUPPORTED
   116 #endif
   114 #endif
   117 
   115 
       
   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 
   118 /* Enabled by default in 1.2.0.  You can disable this if you don't need to
   147 /* Enabled by default in 1.2.0.  You can disable this if you don't need to
   119    support PNGs that are embedded in MNG datastreams */
   148    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
   121 #  ifndef PNG_MNG_FEATURES_SUPPORTED
   150 #  ifndef PNG_MNG_FEATURES_SUPPORTED
   122 #    define PNG_MNG_FEATURES_SUPPORTED
   151 #    define PNG_MNG_FEATURES_SUPPORTED
   123 #  endif
   152 #  endif
   124 #endif
   153 #endif
   125 
   154 
       
   155 /* Added at libpng version 1.4.0 */
   126 #ifndef PNG_NO_FLOATING_POINT_SUPPORTED
   156 #ifndef PNG_NO_FLOATING_POINT_SUPPORTED
   127 #  ifndef PNG_FLOATING_POINT_SUPPORTED
   157 #  ifndef PNG_FLOATING_POINT_SUPPORTED
   128 #    define PNG_FLOATING_POINT_SUPPORTED
   158 #    define PNG_FLOATING_POINT_SUPPORTED
   129 #  endif
   159 #  endif
   130 #endif
   160 #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
   131 
   166 
   132 /* If you are running on a machine where you cannot allocate more
   167 /* If you are running on a machine where you cannot allocate more
   133  * than 64K of memory at once, uncomment this.  While libpng will not
   168  * than 64K of memory at once, uncomment this.  While libpng will not
   134  * normally need that much memory in a chunk (unless you load up a very
   169  * normally need that much memory in a chunk (unless you load up a very
   135  * large file), zlib needs to know how big of a chunk it can use, and
   170  * large file), zlib needs to know how big of a chunk it can use, and
   170  *   of auto-import in binutils, we no longer need to worry about
   205  *   of auto-import in binutils, we no longer need to worry about
   171  *   __declspec(dllexport) / __declspec(dllimport) and friends.  Therefore,
   206  *   __declspec(dllexport) / __declspec(dllimport) and friends.  Therefore,
   172  *   we don't need to worry about PNG_STATIC or ALL_STATIC when it comes
   207  *   we don't need to worry about PNG_STATIC or ALL_STATIC when it comes
   173  *   to __declspec() stuff.  However, we DO need to worry about
   208  *   to __declspec() stuff.  However, we DO need to worry about
   174  *   PNG_BUILD_DLL and PNG_STATIC because those change some defaults
   209  *   PNG_BUILD_DLL and PNG_STATIC because those change some defaults
   175  *   such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed.
   210  *   such as CONSOLE_IO.
   176  */
   211  */
   177 #if defined(__CYGWIN__)
   212 #ifdef __CYGWIN__
   178 #  if defined(ALL_STATIC)
   213 #  ifdef ALL_STATIC
   179 #    if defined(PNG_BUILD_DLL)
   214 #    ifdef PNG_BUILD_DLL
   180 #      undef PNG_BUILD_DLL
   215 #      undef PNG_BUILD_DLL
   181 #    endif
   216 #    endif
   182 #    if defined(PNG_USE_DLL)
   217 #    ifdef PNG_USE_DLL
   183 #      undef PNG_USE_DLL
   218 #      undef PNG_USE_DLL
   184 #    endif
   219 #    endif
   185 #    if defined(PNG_DLL)
   220 #    ifdef PNG_DLL
   186 #      undef PNG_DLL
   221 #      undef PNG_DLL
   187 #    endif
   222 #    endif
   188 #    if !defined(PNG_STATIC)
   223 #    ifndef PNG_STATIC
   189 #      define PNG_STATIC
   224 #      define PNG_STATIC
   190 #    endif
   225 #    endif
   191 #  else
   226 #  else
   192 #    if defined (PNG_BUILD_DLL)
   227 #    ifdef PNG_BUILD_DLL
   193 #      if defined(PNG_STATIC)
   228 #      ifdef PNG_STATIC
   194 #        undef PNG_STATIC
   229 #        undef PNG_STATIC
   195 #      endif
   230 #      endif
   196 #      if defined(PNG_USE_DLL)
   231 #      ifdef PNG_USE_DLL
   197 #        undef PNG_USE_DLL
   232 #        undef PNG_USE_DLL
   198 #      endif
   233 #      endif
   199 #      if !defined(PNG_DLL)
   234 #      ifndef PNG_DLL
   200 #        define PNG_DLL
   235 #        define PNG_DLL
   201 #      endif
   236 #      endif
   202 #    else
   237 #    else
   203 #      if defined(PNG_STATIC)
   238 #      ifdef PNG_STATIC
   204 #        if defined(PNG_USE_DLL)
   239 #        ifdef PNG_USE_DLL
   205 #          undef PNG_USE_DLL
   240 #          undef PNG_USE_DLL
   206 #        endif
   241 #        endif
   207 #        if defined(PNG_DLL)
   242 #        ifdef PNG_DLL
   208 #          undef PNG_DLL
   243 #          undef PNG_DLL
   209 #        endif
   244 #        endif
   210 #      else
   245 #      else
   211 #        if !defined(PNG_USE_DLL)
   246 #        ifndef PNG_USE_DLL
   212 #          define PNG_USE_DLL
   247 #          define PNG_USE_DLL
   213 #        endif
   248 #        endif
   214 #        if !defined(PNG_DLL)
   249 #        ifndef PNG_DLL
   215 #          define PNG_DLL
   250 #          define PNG_DLL
   216 #        endif
   251 #        endif
   217 #      endif
   252 #      endif
   218 #    endif
   253 #    endif
   219 #  endif
   254 #  endif
   230  *
   265  *
   231  * #define PNG_NO_CONSOLE_IO
   266  * #define PNG_NO_CONSOLE_IO
   232  * #define PNG_NO_STDIO
   267  * #define PNG_NO_STDIO
   233  */
   268  */
   234 
   269 
   235 #if defined(_WIN32_WCE)
   270 #if !defined(PNG_NO_STDIO) && !defined(PNG_STDIO_SUPPORTED)
   236 #  include <windows.h>
   271 #  define PNG_STDIO_SUPPORTED
   237    /* Console I/O functions are not supported on WindowsCE */
   272 #endif
   238 #  define PNG_NO_CONSOLE_IO
   273 
   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
       
   245 
   274 
   246 #ifdef PNG_BUILD_DLL
   275 #ifdef PNG_BUILD_DLL
   247 #  ifndef PNG_CONSOLE_IO_SUPPORTED
   276 #  if !defined(PNG_CONSOLE_IO_SUPPORTED) && !defined(PNG_NO_CONSOLE_IO)
   248 #    ifndef PNG_NO_CONSOLE_IO
   277 #    define PNG_NO_CONSOLE_IO
   249 #      define PNG_NO_CONSOLE_IO
       
   250 #    endif
       
   251 #  endif
   278 #  endif
   252 #endif
   279 #endif
   253 
   280 
   254 #  ifdef PNG_NO_STDIO
   281 #  ifdef PNG_NO_STDIO
   255 #    ifndef PNG_NO_CONSOLE_IO
   282 #    ifndef PNG_NO_CONSOLE_IO
   259 #      if (PNG_DEBUG > 0)
   286 #      if (PNG_DEBUG > 0)
   260 #        include <stdio.h>
   287 #        include <stdio.h>
   261 #      endif
   288 #      endif
   262 #    endif
   289 #    endif
   263 #  else
   290 #  else
   264 #    if !defined(_WIN32_WCE)
   291 #    include <stdio.h>
   265 /* "stdio.h" functions are not supported on WindowsCE */
   292 #  endif
   266 #      include <stdio.h>
   293 
   267 #    endif
   294 #if !(defined PNG_NO_CONSOLE_IO) && !defined(PNG_CONSOLE_IO_SUPPORTED)
   268 #  endif
   295 #  define PNG_CONSOLE_IO_SUPPORTED
       
   296 #endif
   269 
   297 
   270 /* This macro protects us against machines that don't have function
   298 /* This macro protects us against machines that don't have function
   271  * prototypes (ie K&R style headers).  If your compiler does not handle
   299  * prototypes (ie K&R style headers).  If your compiler does not handle
   272  * function prototypes, define this macro and use the included ansi2knr.
   300  * function prototypes, define this macro and use the included ansi2knr.
   273  * I've always been able to use _NO_PROTO as the indicator, but you may
   301  * I've always been able to use _NO_PROTO as the indicator, but you may
   280 #  define PNGARG(arglist) OF(arglist)
   308 #  define PNGARG(arglist) OF(arglist)
   281 #else
   309 #else
   282 
   310 
   283 #ifdef _NO_PROTO
   311 #ifdef _NO_PROTO
   284 #  define PNGARG(arglist) ()
   312 #  define PNGARG(arglist) ()
   285 #  ifndef PNG_TYPECAST_NULL
       
   286 #     define PNG_TYPECAST_NULL
       
   287 #  endif
       
   288 #else
   313 #else
   289 #  define PNGARG(arglist) arglist
   314 #  define PNGARG(arglist) arglist
   290 #endif /* _NO_PROTO */
   315 #endif /* _NO_PROTO */
   291 
       
   292 
   316 
   293 #endif /* OF */
   317 #endif /* OF */
   294 
   318 
   295 #endif /* PNGARG */
   319 #endif /* PNGARG */
   296 
   320 
   303       defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
   327       defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
   304 #    define MACOS
   328 #    define MACOS
   305 #  endif
   329 #  endif
   306 #endif
   330 #endif
   307 
   331 
   308 /* enough people need this for various reasons to include it here */
   332 /* Enough people need this for various reasons to include it here */
   309 #if !defined(MACOS) && !defined(RISCOS) && !defined(_WIN32_WCE)
   333 #if !defined(MACOS) && !defined(RISCOS) && !defined(_WIN32_WCE)
   310 #  include <sys/types.h>
   334 #  include <sys/types.h>
   311 #endif
   335 #endif
   312 
   336 
   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)
   314 #  define PNG_SETJMP_SUPPORTED
   340 #  define PNG_SETJMP_SUPPORTED
   315 #endif
   341 #endif
   316 
   342 
   317 #ifdef PNG_SETJMP_SUPPORTED
   343 #ifdef PNG_SETJMP_SUPPORTED
   318 /* This is an attempt to force a single setjmp behaviour on Linux.  If
   344 /* This is an attempt to force a single setjmp behaviour on Linux.  If
   339            __dont__ include it again.;
   365            __dont__ include it again.;
   340 #      endif
   366 #      endif
   341 #    endif /* __linux__ */
   367 #    endif /* __linux__ */
   342 #  endif /* PNG_SKIP_SETJMP_CHECK */
   368 #  endif /* PNG_SKIP_SETJMP_CHECK */
   343 
   369 
   344    /* include setjmp.h for error handling */
   370    /* Include setjmp.h for error handling */
   345 #  include <setjmp.h>
   371 #  include <setjmp.h>
   346 
   372 
   347 #  ifdef __linux__
   373 #  ifdef __linux__
   348 #    ifdef PNG_SAVE_BSD_SOURCE
   374 #    ifdef PNG_SAVE_BSD_SOURCE
   349 #      ifndef _BSD_SOURCE
   375 #      ifdef _BSD_SOURCE
   350 #        define _BSD_SOURCE
   376 #        undef _BSD_SOURCE
   351 #      endif
   377 #      endif
       
   378 #      define _BSD_SOURCE
   352 #      undef PNG_SAVE_BSD_SOURCE
   379 #      undef PNG_SAVE_BSD_SOURCE
   353 #    endif
   380 #    endif
   354 #  endif /* __linux__ */
   381 #  endif /* __linux__ */
   355 #endif /* PNG_SETJMP_SUPPORTED */
   382 #endif /* PNG_SETJMP_SUPPORTED */
   356 
   383 
   359 #else
   386 #else
   360 #  include <string.h>
   387 #  include <string.h>
   361 #endif
   388 #endif
   362 
   389 
   363 /* Other defines for things like memory and the like can go here.  */
   390 /* 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
       
   417 
   391 
   418 /* This controls how fine the dithering gets.  As this allocates
   392 /* This controls how fine the dithering gets.  As this allocates
   419  * a largish chunk of memory (32K), those who are not as concerned
   393  * a largish chunk of memory (32K), those who are not as concerned
   420  * with dithering quality can decrease some or all of these.
   394  * with dithering quality can decrease some or all of these.
   421  */
   395  */
   445  */
   419  */
   446 #ifndef PNG_GAMMA_THRESHOLD
   420 #ifndef PNG_GAMMA_THRESHOLD
   447 #  define PNG_GAMMA_THRESHOLD 0.05
   421 #  define PNG_GAMMA_THRESHOLD 0.05
   448 #endif
   422 #endif
   449 
   423 
   450 #endif /* PNG_INTERNAL */
       
   451 
       
   452 /* The following uses const char * instead of char * for error
   424 /* The following uses const char * instead of char * for error
   453  * and warning message functions, so some compilers won't complain.
   425  * and warning message functions, so some compilers won't complain.
   454  * If you do not want to use const, define PNG_NO_CONST here.
   426  * If you do not want to use const, define PNG_NO_CONST here.
   455  */
   427  */
   456 
   428 
   457 #ifndef PNG_NO_CONST
   429 #ifndef PNG_CONST
   458 #  define PNG_CONST const
   430 #  ifndef PNG_NO_CONST
   459 #else
   431 #    define PNG_CONST const
   460 #  define PNG_CONST
   432 #  else
       
   433 #    define PNG_CONST
       
   434 #  endif
   461 #endif
   435 #endif
   462 
   436 
   463 /* The following defines give you the ability to remove code from the
   437 /* The following defines give you the ability to remove code from the
   464  * library that you will not be using.  I wish I could figure out how to
   438  * library that you will not be using.  I wish I could figure out how to
   465  * automate this, but I can't do that without making it seriously hard
   439  * automate this, but I can't do that without making it seriously hard
   475  */
   449  */
   476 
   450 
   477 /* Any features you will not be using can be undef'ed here */
   451 /* Any features you will not be using can be undef'ed here */
   478 
   452 
   479 /* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user
   453 /* 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
   454  * to turn it off with PNG_NO_READ|WRITE_TRANSFORMS on the compile line,
   481  * on the compile line, then pick and choose which ones to define without
   455  * then pick and choose which ones to define without having to edit this
   482  * having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED
   456  * file. It is safe to use the PNG_NO_READ|WRITE_TRANSFORMS
   483  * if you only want to have a png-compliant reader/writer but don't need
   457  * if you only want to have a png-compliant reader/writer but don't need
   484  * any of the extra transformations.  This saves about 80 kbytes in a
   458  * any of the extra transformations.  This saves about 80 kbytes in a
   485  * typical installation of the library. (PNG_NO_* form added in version
   459  * typical installation of the library. (PNG_NO_* form added in version
   486  * 1.0.1c, for consistency)
   460  * 1.0.1c, for consistency; PNG_*_TRANSFORMS_NOT_SUPPORTED deprecated in
   487  */
   461  * 1.4.0)
   488 
   462  */
   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
       
   546 
   463 
   547 /* Ignore attempt to turn off both floating and fixed point support */
   464 /* Ignore attempt to turn off both floating and fixed point support */
   548 #if !defined(PNG_FLOATING_POINT_SUPPORTED) || \
   465 #if !defined(PNG_FLOATING_POINT_SUPPORTED) || \
   549     !defined(PNG_NO_FIXED_POINT_SUPPORTED)
   466     !defined(PNG_NO_FIXED_POINT_SUPPORTED)
   550 #  define PNG_FIXED_POINT_SUPPORTED
   467 #  define PNG_FIXED_POINT_SUPPORTED
   551 #endif
   468 #endif
   552 
   469 
   553 #ifndef PNG_NO_FREE_ME
       
   554 #  define PNG_FREE_ME_SUPPORTED
       
   555 #endif
       
   556 
       
   557 #ifdef PNG_READ_SUPPORTED
   470 #ifdef PNG_READ_SUPPORTED
   558 
   471 
       
   472 /* PNG_READ_TRANSFORMS_NOT_SUPPORTED is deprecated. */
   559 #if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
   473 #if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
   560       !defined(PNG_NO_READ_TRANSFORMS)
   474       !defined(PNG_NO_READ_TRANSFORMS)
   561 #  define PNG_READ_TRANSFORMS_SUPPORTED
   475 #  define PNG_READ_TRANSFORMS_SUPPORTED
   562 #endif
   476 #endif
   563 
   477 
   581 #    define PNG_READ_PACKSWAP_SUPPORTED
   495 #    define PNG_READ_PACKSWAP_SUPPORTED
   582 #  endif
   496 #  endif
   583 #  ifndef PNG_NO_READ_INVERT
   497 #  ifndef PNG_NO_READ_INVERT
   584 #    define PNG_READ_INVERT_SUPPORTED
   498 #    define PNG_READ_INVERT_SUPPORTED
   585 #  endif
   499 #  endif
       
   500 #if 0 /* removed from libpng-1.4.0 */
   586 #  ifndef PNG_NO_READ_DITHER
   501 #  ifndef PNG_NO_READ_DITHER
   587 #    define PNG_READ_DITHER_SUPPORTED
   502 #    define PNG_READ_DITHER_SUPPORTED
   588 #  endif
   503 #  endif
       
   504 #endif /* 0 */
   589 #  ifndef PNG_NO_READ_BACKGROUND
   505 #  ifndef PNG_NO_READ_BACKGROUND
   590 #    define PNG_READ_BACKGROUND_SUPPORTED
   506 #    define PNG_READ_BACKGROUND_SUPPORTED
   591 #  endif
   507 #  endif
   592 #  ifndef PNG_NO_READ_16_TO_8
   508 #  ifndef PNG_NO_READ_16_TO_8
   593 #    define PNG_READ_16_TO_8_SUPPORTED
   509 #    define PNG_READ_16_TO_8_SUPPORTED
   616 #  ifndef PNG_NO_READ_RGB_TO_GRAY
   532 #  ifndef PNG_NO_READ_RGB_TO_GRAY
   617 #    define PNG_READ_RGB_TO_GRAY_SUPPORTED
   533 #    define PNG_READ_RGB_TO_GRAY_SUPPORTED
   618 #  endif
   534 #  endif
   619 #endif /* PNG_READ_TRANSFORMS_SUPPORTED */
   535 #endif /* PNG_READ_TRANSFORMS_SUPPORTED */
   620 
   536 
       
   537 /* PNG_PROGRESSIVE_READ_NOT_SUPPORTED is deprecated. */
   621 #if !defined(PNG_NO_PROGRESSIVE_READ) && \
   538 #if !defined(PNG_NO_PROGRESSIVE_READ) && \
   622  !defined(PNG_PROGRESSIVE_READ_SUPPORTED) /* if you don't do progressive   */
   539  !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED)  /* if you don't do progressive */
   623 #  define PNG_PROGRESSIVE_READ_SUPPORTED  /* reading.  This is not talking */
   540 #  define PNG_PROGRESSIVE_READ_SUPPORTED     /* reading.  This is not talking */
   624 #endif                            /* about interlacing capability!  You'll */
   541 #endif                               /* about interlacing capability!  You'll */
   625            /* still have interlacing unless you change the following line: */
   542             /* still have interlacing unless you change the following define: */
   626 
   543 
   627 #define PNG_READ_INTERLACING_SUPPORTED /* required in PNG-compliant decoders */
   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
   628 
   552 
   629 #ifndef PNG_NO_READ_COMPOSITE_NODIV
   553 #ifndef PNG_NO_READ_COMPOSITE_NODIV
   630 #  ifndef PNG_NO_READ_COMPOSITED_NODIV  /* libpng-1.0.x misspelling */
   554 #  ifndef PNG_NO_READ_COMPOSITED_NODIV  /* libpng-1.0.x misspelling */
   631 #    define PNG_READ_COMPOSITE_NODIV_SUPPORTED  /* well tested on Intel, SGI */
   555 #    define PNG_READ_COMPOSITE_NODIV_SUPPORTED   /* well tested on Intel, SGI */
   632 #  endif
   556 #  endif
   633 #endif
   557 #endif
   634 
   558 
   635 #if defined(PNG_1_0_X) || defined (PNG_1_2_X)
   559 #if !defined(PNG_NO_GET_INT_32) || defined(PNG_READ_oFFS_SUPPORTED) || \
   636 /* Deprecated, will be removed from version 2.0.0.
   560     defined(PNG_READ_pCAL_SUPPORTED)
   637    Use PNG_MNG_FEATURES_SUPPORTED instead. */
   561 #  ifndef PNG_GET_INT_32_SUPPORTED
   638 #ifndef PNG_NO_READ_EMPTY_PLTE
   562 #    define PNG_GET_INT_32_SUPPORTED
   639 #  define PNG_READ_EMPTY_PLTE_SUPPORTED
   563 #  endif
   640 #endif
       
   641 #endif
   564 #endif
   642 
   565 
   643 #endif /* PNG_READ_SUPPORTED */
   566 #endif /* PNG_READ_SUPPORTED */
   644 
   567 
   645 #ifdef PNG_WRITE_SUPPORTED
   568 #ifdef PNG_WRITE_SUPPORTED
   646 
   569 
   647 # if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
   570 /* PNG_WRITE_TRANSFORMS_NOT_SUPPORTED is deprecated. */
       
   571 #if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
   648     !defined(PNG_NO_WRITE_TRANSFORMS)
   572     !defined(PNG_NO_WRITE_TRANSFORMS)
   649 #  define PNG_WRITE_TRANSFORMS_SUPPORTED
   573 #  define PNG_WRITE_TRANSFORMS_SUPPORTED
   650 #endif
   574 #endif
   651 
   575 
   652 #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
   576 #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
   682 #  endif
   606 #  endif
   683 #endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
   607 #endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
   684 
   608 
   685 #if !defined(PNG_NO_WRITE_INTERLACING_SUPPORTED) && \
   609 #if !defined(PNG_NO_WRITE_INTERLACING_SUPPORTED) && \
   686     !defined(PNG_WRITE_INTERLACING_SUPPORTED)
   610     !defined(PNG_WRITE_INTERLACING_SUPPORTED)
   687 #define PNG_WRITE_INTERLACING_SUPPORTED  /* not required for PNG-compliant
   611     /* This is not required for PNG-compliant encoders, but can cause
   688                                             encoders, but can cause trouble
   612      * trouble if left undefined
   689                                             if left undefined */
   613     */
       
   614 #  define PNG_WRITE_INTERLACING_SUPPORTED
   690 #endif
   615 #endif
   691 
   616 
   692 #if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \
   617 #if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \
   693     !defined(PNG_WRITE_WEIGHTED_FILTER) && \
   618     !defined(PNG_WRITE_WEIGHTED_FILTER) && \
   694      defined(PNG_FLOATING_POINT_SUPPORTED)
   619      defined(PNG_FLOATING_POINT_SUPPORTED)
   697 
   622 
   698 #ifndef PNG_NO_WRITE_FLUSH
   623 #ifndef PNG_NO_WRITE_FLUSH
   699 #  define PNG_WRITE_FLUSH_SUPPORTED
   624 #  define PNG_WRITE_FLUSH_SUPPORTED
   700 #endif
   625 #endif
   701 
   626 
   702 #if defined(PNG_1_0_X) || defined (PNG_1_2_X)
   627 #if !defined(PNG_NO_SAVE_INT_32) || defined(PNG_WRITE_oFFS_SUPPORTED) || \
   703 /* Deprecated, see PNG_MNG_FEATURES_SUPPORTED, above */
   628     defined(PNG_WRITE_pCAL_SUPPORTED)
   704 #ifndef PNG_NO_WRITE_EMPTY_PLTE
   629 #  ifndef PNG_SAVE_INT_32_SUPPORTED
   705 #  define PNG_WRITE_EMPTY_PLTE_SUPPORTED
   630 #    define PNG_SAVE_INT_32_SUPPORTED
   706 #endif
   631 #  endif
   707 #endif
   632 #endif
   708 
   633 
   709 #endif /* PNG_WRITE_SUPPORTED */
   634 #endif /* PNG_WRITE_SUPPORTED */
   710 
   635 
   711 #ifndef PNG_1_0_X
   636 #define PNG_NO_ERROR_NUMBERS
   712 #  ifndef PNG_NO_ERROR_NUMBERS
       
   713 #    define PNG_ERROR_NUMBERS_SUPPORTED
       
   714 #  endif
       
   715 #endif /* PNG_1_0_X */
       
   716 
   637 
   717 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
   638 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
   718     defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
   639     defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
   719 #  ifndef PNG_NO_USER_TRANSFORM_PTR
   640 #  ifndef PNG_NO_USER_TRANSFORM_PTR
   720 #    define PNG_USER_TRANSFORM_PTR_SUPPORTED
   641 #    define PNG_USER_TRANSFORM_PTR_SUPPORTED
   721 #  endif
   642 #  endif
   722 #endif
   643 #endif
   723 
   644 
   724 #ifndef PNG_NO_STDIO
   645 #if defined(PNG_STDIO_SUPPORTED) && !defined(PNG_TIME_RFC1123_SUPPORTED)
   725 #  define PNG_TIME_RFC1123_SUPPORTED
   646 #  define PNG_TIME_RFC1123_SUPPORTED
   726 #endif
   647 #endif
   727 
   648 
   728 /* This adds extra functions in pngget.c for accessing data from the
   649 /* This adds extra functions in pngget.c for accessing data from the
   729  * info pointer (added in version 0.99)
   650  * info pointer (added in version 0.99)
   743  */
   664  */
   744 #if !defined(PNG_NO_EASY_ACCESS) && !defined(PNG_EASY_ACCESS_SUPPORTED)
   665 #if !defined(PNG_NO_EASY_ACCESS) && !defined(PNG_EASY_ACCESS_SUPPORTED)
   745 #  define PNG_EASY_ACCESS_SUPPORTED
   666 #  define PNG_EASY_ACCESS_SUPPORTED
   746 #endif
   667 #endif
   747 
   668 
   748 /* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0
   669 /* Added at libpng-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)
       
   791 #if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED)
   670 #if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED)
   792 #  define PNG_USER_MEM_SUPPORTED
   671 #  define PNG_USER_MEM_SUPPORTED
   793 #endif
   672 #endif
   794 #endif /* PNG_1_0_X */
       
   795 
   673 
   796 /* Added at libpng-1.2.6 */
   674 /* Added at libpng-1.2.6 */
   797 #if !defined(PNG_1_0_X)
       
   798 #ifndef PNG_SET_USER_LIMITS_SUPPORTED
   675 #ifndef PNG_SET_USER_LIMITS_SUPPORTED
   799 #if !defined(PNG_NO_SET_USER_LIMITS) && !defined(PNG_SET_USER_LIMITS_SUPPORTED)
   676 #  ifndef PNG_NO_SET_USER_LIMITS
   800 #  define PNG_SET_USER_LIMITS_SUPPORTED
   677 #    define PNG_SET_USER_LIMITS_SUPPORTED
   801 #endif
   678 #  endif
   802 #endif
   679 #endif
   803 #endif /* PNG_1_0_X */
   680 
   804 
   681 /* Added at libpng-1.0.16 and 1.2.6.  To accept all valid PNGs no matter
   805 /* Added at libpng-1.0.16 and 1.2.6.  To accept all valid PNGS no matter
       
   806  * how large, set these limits to 0x7fffffffL
   682  * how large, set these limits to 0x7fffffffL
   807  */
   683  */
   808 #ifndef PNG_USER_WIDTH_MAX
   684 #ifndef PNG_USER_WIDTH_MAX
   809 #  define PNG_USER_WIDTH_MAX 1000000L
   685 #  define PNG_USER_WIDTH_MAX 1000000L
   810 #endif
   686 #endif
   811 #ifndef PNG_USER_HEIGHT_MAX
   687 #ifndef PNG_USER_HEIGHT_MAX
   812 #  define PNG_USER_HEIGHT_MAX 1000000L
   688 #  define PNG_USER_HEIGHT_MAX 1000000L
   813 #endif
   689 #endif
   814 
   690 
   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
   816 #ifndef PNG_STRING_NEWLINE
   710 #ifndef PNG_STRING_NEWLINE
   817 #define PNG_STRING_NEWLINE "\n"
   711 #define PNG_STRING_NEWLINE "\n"
   818 #endif
   712 #endif
   819 
   713 
   820 /* These are currently experimental features, define them if you want */
   714 /* These are currently experimental features, define them if you want */
   821 
   715 
   822 /* very little testing */
   716 /* Very little testing */
   823 /*
   717 /*
   824 #ifdef PNG_READ_SUPPORTED
   718 #ifdef PNG_READ_SUPPORTED
   825 #  ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
   719 #  ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
   826 #    define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
   720 #    define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
   827 #  endif
   721 #  endif
   834 #ifndef PNG_READ_BIG_ENDIAN_SUPPORTED
   728 #ifndef PNG_READ_BIG_ENDIAN_SUPPORTED
   835 #  define PNG_READ_BIG_ENDIAN_SUPPORTED
   729 #  define PNG_READ_BIG_ENDIAN_SUPPORTED
   836 #endif
   730 #endif
   837 */
   731 */
   838 
   732 
   839 /* Buggy compilers (e.g., gcc 2.7.2.2) need this */
   733 #if !defined(PNG_NO_USE_READ_MACROS) && !defined(PNG_USE_READ_MACROS)
   840 /*
   734 #  define PNG_USE_READ_MACROS
   841 #define PNG_NO_POINTER_INDEXING
   735 #endif
   842 */
   736 
   843 
   737 /* Buggy compilers (e.g., gcc 2.7.2.2) need PNG_NO_POINTER_INDEXING */
   844 /* These functions are turned off by default, as they will be phased out. */
   738 
   845 /*
   739 #if !defined(PNG_NO_POINTER_INDEXING) && \
   846 #define  PNG_USELESS_TESTS_SUPPORTED
   740     !defined(PNG_POINTER_INDEXING_SUPPORTED)
   847 #define  PNG_CORRECT_PALETTE_SUPPORTED
   741 #  define PNG_POINTER_INDEXING_SUPPORTED
   848 */
   742 #endif
       
   743 
   849 
   744 
   850 /* Any chunks you are not interested in, you can undef here.  The
   745 /* Any chunks you are not interested in, you can undef here.  The
   851  * ones that allocate memory may be expecially important (hIST,
   746  * ones that allocate memory may be expecially important (hIST,
   852  * tEXt, zTXt, tRNS, pCAL).  Others will just save time and make png_info
   747  * tEXt, zTXt, tRNS, pCAL).  Others will just save time and make png_info
   853  * a bit smaller.
   748  * a bit smaller.
   854  */
   749  */
   855 
   750 
       
   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. */
   856 #if defined(PNG_READ_SUPPORTED) && \
   759 #if defined(PNG_READ_SUPPORTED) && \
   857     !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
   760     !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
   858     !defined(PNG_NO_READ_ANCILLARY_CHUNKS)
   761     !defined(PNG_NO_READ_ANCILLARY_CHUNKS)
   859 #  define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
   762 #  define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
   860 #endif
   763 #endif
   861 
   764 
       
   765 /* PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED is deprecated. */
   862 #if defined(PNG_WRITE_SUPPORTED) && \
   766 #if defined(PNG_WRITE_SUPPORTED) && \
   863     !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
   767     !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
   864     !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)
   768     !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)
   865 #  define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
   769 #  define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
   866 #endif
   770 #endif
   870 #ifdef PNG_NO_READ_TEXT
   774 #ifdef PNG_NO_READ_TEXT
   871 #  define PNG_NO_READ_iTXt
   775 #  define PNG_NO_READ_iTXt
   872 #  define PNG_NO_READ_tEXt
   776 #  define PNG_NO_READ_tEXt
   873 #  define PNG_NO_READ_zTXt
   777 #  define PNG_NO_READ_zTXt
   874 #endif
   778 #endif
       
   779 
   875 #ifndef PNG_NO_READ_bKGD
   780 #ifndef PNG_NO_READ_bKGD
   876 #  define PNG_READ_bKGD_SUPPORTED
   781 #  define PNG_READ_bKGD_SUPPORTED
   877 #  define PNG_bKGD_SUPPORTED
   782 #  define PNG_bKGD_SUPPORTED
   878 #endif
   783 #endif
   879 #ifndef PNG_NO_READ_cHRM
   784 #ifndef PNG_NO_READ_cHRM
   970 #  endif
   875 #  endif
   971 #  ifdef PNG_NO_HANDLE_AS_UNKNOWN
   876 #  ifdef PNG_NO_HANDLE_AS_UNKNOWN
   972 #    undef PNG_NO_HANDLE_AS_UNKNOWN
   877 #    undef PNG_NO_HANDLE_AS_UNKNOWN
   973 #  endif
   878 #  endif
   974 #endif
   879 #endif
   975 
       
   976 #ifndef PNG_NO_HANDLE_AS_UNKNOWN
   880 #ifndef PNG_NO_HANDLE_AS_UNKNOWN
   977 #  ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
   881 #  ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
   978 #    define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
   882 #    define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
   979 #  endif
   883 #  endif
   980 #endif
   884 #endif
  1097 #  ifndef PNG_TEXT_SUPPORTED
  1001 #  ifndef PNG_TEXT_SUPPORTED
  1098 #    define PNG_TEXT_SUPPORTED
  1002 #    define PNG_TEXT_SUPPORTED
  1099 #  endif
  1003 #  endif
  1100 #endif
  1004 #endif
  1101 
  1005 
       
  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 
  1102 #endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
  1017 #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
  1103 
  1022 
  1104 #ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
  1023 #ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
  1105 #  define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
  1024 #  define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
  1106 #  ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
  1025 #  ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
  1107 #    define PNG_UNKNOWN_CHUNKS_SUPPORTED
  1026 #    define PNG_UNKNOWN_CHUNKS_SUPPORTED
  1108 #  endif
  1027 #  endif
  1109 #endif
  1028 #endif
  1110 
       
  1111 #ifndef PNG_NO_HANDLE_AS_UNKNOWN
  1029 #ifndef PNG_NO_HANDLE_AS_UNKNOWN
  1112 #  ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
  1030 #  ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
  1113 #    define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
  1031 #    define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
  1114 #  endif
  1032 #  endif
  1115 #endif
  1033 #endif
  1121  */
  1039  */
  1122 #ifndef PNG_NO_INFO_IMAGE
  1040 #ifndef PNG_NO_INFO_IMAGE
  1123 #  define PNG_INFO_IMAGE_SUPPORTED
  1041 #  define PNG_INFO_IMAGE_SUPPORTED
  1124 #endif
  1042 #endif
  1125 
  1043 
  1126 /* need the time information for reading tIME chunks */
  1044 /* Need the time information for converting tIME chunks */
  1127 #if defined(PNG_tIME_SUPPORTED)
  1045 #ifdef PNG_CONVERT_tIME_SUPPORTED
  1128 #  if !defined(_WIN32_WCE)
       
  1129      /* "time.h" functions are not supported on WindowsCE */
  1046      /* "time.h" functions are not supported on WindowsCE */
  1130 #    include <time.h>
  1047 #    include <time.h>
  1131 #  endif
       
  1132 #endif
  1048 #endif
  1133 
  1049 
  1134 /* Some typedefs to get us started.  These should be safe on most of the
  1050 /* Some typedefs to get us started.  These should be safe on most of the
  1135  * common platforms.  The typedefs should be at least as large as the
  1051  * common platforms.  The typedefs should be at least as large as the
  1136  * numbers suggest (a png_uint_32 must be at least 32 bits long), but they
  1052  * numbers suggest (a png_uint_32 must be at least 32 bits long), but they
  1137  * don't have to be exactly that size.  Some compilers dislike passing
  1053  * don't have to be exactly that size.  Some compilers dislike passing
  1138  * unsigned shorts as function parameters, so you may be better off using
  1054  * 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
  1055  * unsigned int for png_uint_16.
  1140  * want to have unsigned int for png_uint_32 instead of unsigned long.
  1056  */
  1141  */
  1057 
  1142 
  1058 #if defined(INT_MAX) && (INT_MAX > 0x7ffffffeL)
       
  1059 typedef unsigned int png_uint_32;
       
  1060 typedef int png_int_32;
       
  1061 #else
  1143 typedef unsigned long png_uint_32;
  1062 typedef unsigned long png_uint_32;
  1144 typedef long png_int_32;
  1063 typedef long png_int_32;
       
  1064 #endif
  1145 typedef unsigned short png_uint_16;
  1065 typedef unsigned short png_uint_16;
  1146 typedef short png_int_16;
  1066 typedef short png_int_16;
  1147 typedef unsigned char png_byte;
  1067 typedef unsigned char png_byte;
  1148 
  1068 
  1149 /* This is usually size_t.  It is typedef'ed just in case you need it to
  1069 #ifdef PNG_NO_SIZE_T
  1150    change (I'm not sure if you will or not, so I thought I'd be safe) */
  1070    typedef unsigned int png_size_t;
  1151 #ifdef PNG_SIZE_T
       
  1152    typedef PNG_SIZE_T png_size_t;
       
  1153 #  define png_sizeof(x) png_convert_size(sizeof(x))
       
  1154 #else
  1071 #else
  1155    typedef size_t png_size_t;
  1072    typedef size_t png_size_t;
  1156 #  define png_sizeof(x) sizeof(x)
  1073 #endif
  1157 #endif
  1074 #define png_sizeof(x) sizeof(x)
  1158 
  1075 
  1159 /* The following is needed for medium model support.  It cannot be in the
  1076 /* 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
  1161  * MSC.  Model independent support declares all arrays and pointers to be
  1078  * MSC.  Model independent support declares all arrays and pointers to be
  1162  * large using the far keyword.  The zlib version used must also support
  1079  * large using the far keyword.  The zlib version used must also support
  1163  * model independent data.  As of version zlib 1.0.4, the necessary changes
  1080  * model independent data.  As of version zlib 1.0.4, the necessary changes
  1164  * have been made in zlib.  The USE_FAR_KEYWORD define triggers other
  1081  * have been made in zlib.  The USE_FAR_KEYWORD define triggers other
  1165  * changes that are needed. (Tim Wegner)
  1082  * changes that are needed. (Tim Wegner)
  1166  */
  1083  */
  1167 
  1084 
  1168 /* Separate compiler dependencies (problem here is that zlib.h always
  1085 /* Separate compiler dependencies (problem here is that zlib.h always
  1169    defines FAR. (SJT) */
  1086  * defines FAR. (SJT)
       
  1087  */
  1170 #ifdef __BORLANDC__
  1088 #ifdef __BORLANDC__
  1171 #  if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
  1089 #  if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
  1172 #    define LDATA 1
  1090 #    define LDATA 1
  1173 #  else
  1091 #  else
  1174 #    define LDATA 0
  1092 #    define LDATA 0
  1195  * FAR.  The Watcom compiler defines both __MEDIUM__ and M_I86MM,
  1113  * FAR.  The Watcom compiler defines both __MEDIUM__ and M_I86MM,
  1196  * making reliance oncertain keywords suspect. (SJT)
  1114  * making reliance oncertain keywords suspect. (SJT)
  1197  */
  1115  */
  1198 
  1116 
  1199 /* MSC Medium model */
  1117 /* MSC Medium model */
  1200 #if defined(FAR)
  1118 #ifdef FAR
  1201 #  if defined(M_I86MM)
  1119 #  ifdef M_I86MM
  1202 #    define USE_FAR_KEYWORD
  1120 #    define USE_FAR_KEYWORD
  1203 #    define FARDATA FAR
  1121 #    define FARDATA FAR
  1204 #    include <dos.h>
  1122 #    include <dos.h>
  1205 #  endif
  1123 #  endif
  1206 #endif
  1124 #endif
  1229 typedef PNG_CONST char  FAR * png_const_charp;
  1147 typedef PNG_CONST char  FAR * png_const_charp;
  1230 typedef char            FAR * png_charp;
  1148 typedef char            FAR * png_charp;
  1231 typedef png_fixed_point FAR * png_fixed_point_p;
  1149 typedef png_fixed_point FAR * png_fixed_point_p;
  1232 
  1150 
  1233 #ifndef PNG_NO_STDIO
  1151 #ifndef PNG_NO_STDIO
  1234 #if defined(_WIN32_WCE)
       
  1235 typedef HANDLE                png_FILE_p;
       
  1236 #else
       
  1237 typedef FILE                * png_FILE_p;
  1152 typedef FILE                * png_FILE_p;
  1238 #endif
       
  1239 #endif
  1153 #endif
  1240 
  1154 
  1241 #ifdef PNG_FLOATING_POINT_SUPPORTED
  1155 #ifdef PNG_FLOATING_POINT_SUPPORTED
  1242 typedef double          FAR * png_doublep;
  1156 typedef double          FAR * png_doublep;
  1243 #endif
  1157 #endif
  1256 #endif
  1170 #endif
  1257 
  1171 
  1258 /* Pointers to pointers to pointers; i.e., pointer to array */
  1172 /* Pointers to pointers to pointers; i.e., pointer to array */
  1259 typedef char            FAR * FAR * FAR * png_charppp;
  1173 typedef char            FAR * FAR * FAR * png_charppp;
  1260 
  1174 
  1261 #if defined(PNG_1_0_X) || defined(PNG_1_2_X)
  1175 /* Define PNG_BUILD_DLL if the module being built is a Windows
  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
       
  1275  * LIBPNG DLL.
  1176  * LIBPNG DLL.
  1276  *
  1177  *
  1277  * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL.
  1178  * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL.
  1278  * It is equivalent to Microsoft predefined macro _DLL that is
  1179  * It is equivalent to Microsoft predefined macro _DLL that is
  1279  * automatically defined when you compile using the share
  1180  * automatically defined when you compile using the share
  1289  */
  1190  */
  1290 
  1191 
  1291 #if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL))
  1192 #if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL))
  1292 #  define PNG_DLL
  1193 #  define PNG_DLL
  1293 #endif
  1194 #endif
  1294 /* If CYGWIN, then disallow GLOBAL ARRAYS unless building a static lib.
  1195 
  1295  * When building a static lib, default to no GLOBAL ARRAYS, but allow
  1196 #ifdef __CYGWIN__
  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__)
       
  1332 #  undef PNGAPI
  1197 #  undef PNGAPI
  1333 #  define PNGAPI __cdecl
  1198 #  define PNGAPI __cdecl
  1334 #  undef PNG_IMPEXP
  1199 #  undef PNG_IMPEXP
  1335 #  define PNG_IMPEXP
  1200 #  define PNG_IMPEXP
  1336 #endif
  1201 #endif
       
  1202 
       
  1203 #define PNG_USE_LOCAL_ARRAYS /* Not used in libpng, defined for legacy apps */
  1337 
  1204 
  1338 /* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall",
  1205 /* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall",
  1339  * you may get warnings regarding the linkage of png_zalloc and png_zfree.
  1206  * you may get warnings regarding the linkage of png_zalloc and png_zfree.
  1340  * Don't ignore those warnings; you must also reset the default calling
  1207  * Don't ignore those warnings; you must also reset the default calling
  1341  * convention in your compiler to match your PNGAPI, and you must build
  1208  * convention in your compiler to match your PNGAPI, and you must build
  1369 #  if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \
  1236 #  if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \
  1370        0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */)
  1237        0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */)
  1371 #     define PNG_IMPEXP
  1238 #     define PNG_IMPEXP
  1372 #  endif
  1239 #  endif
  1373 
  1240 
  1374 #  if !defined(PNG_IMPEXP)
  1241 #  ifndef PNG_IMPEXP
  1375 
  1242 
  1376 #     define PNG_EXPORT_TYPE1(type,symbol)  PNG_IMPEXP type PNGAPI symbol
  1243 #    define PNG_EXPORT_TYPE1(type,symbol)  PNG_IMPEXP type PNGAPI symbol
  1377 #     define PNG_EXPORT_TYPE2(type,symbol)  type PNG_IMPEXP PNGAPI symbol
  1244 #    define PNG_EXPORT_TYPE2(type,symbol)  type PNG_IMPEXP PNGAPI symbol
  1378 
  1245 
  1379       /* Borland/Microsoft */
  1246      /* Borland/Microsoft */
  1380 #     if defined(_MSC_VER) || defined(__BORLANDC__)
  1247 #    if defined(_MSC_VER) || defined(__BORLANDC__)
  1381 #        if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500)
  1248 #      if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500)
  1382 #           define PNG_EXPORT PNG_EXPORT_TYPE1
  1249 #         define PNG_EXPORT PNG_EXPORT_TYPE1
  1383 #        else
  1250 #      else
  1384 #           define PNG_EXPORT PNG_EXPORT_TYPE2
  1251 #         define PNG_EXPORT PNG_EXPORT_TYPE2
  1385 #           if defined(PNG_BUILD_DLL)
  1252 #         ifdef PNG_BUILD_DLL
  1386 #              define PNG_IMPEXP __export
  1253 #            define PNG_IMPEXP __export
  1387 #           else
  1254 #         else
  1388 #              define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in
  1255 #            define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in VC++ */
  1389                                                  VC++ */
  1256 #         endif                              /* Exists in Borland C++ for
  1390 #           endif                             /* Exists in Borland C++ for
  1257                                                 C++ classes (== huge) */
  1391                                                  C++ classes (== huge) */
  1258 #      endif
  1392 #        endif
  1259 #    endif
  1393 #     endif
  1260 
  1394 
  1261 #    ifndef PNG_IMPEXP
  1395 #     if !defined(PNG_IMPEXP)
  1262 #      ifdef PNG_BUILD_DLL
  1396 #        if defined(PNG_BUILD_DLL)
  1263 #        define PNG_IMPEXP __declspec(dllexport)
  1397 #           define PNG_IMPEXP __declspec(dllexport)
  1264 #      else
  1398 #        else
  1265 #        define PNG_IMPEXP __declspec(dllimport)
  1399 #           define PNG_IMPEXP __declspec(dllimport)
  1266 #      endif
  1400 #        endif
  1267 #    endif
  1401 #     endif
       
  1402 #  endif  /* PNG_IMPEXP */
  1268 #  endif  /* PNG_IMPEXP */
  1403 #else /* !(DLL || non-cygwin WINDOWS) */
  1269 #else /* !(DLL || non-cygwin WINDOWS) */
  1404 #   if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
  1270 #   if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
  1405 #      ifndef PNGAPI
  1271 #     ifndef PNGAPI
  1406 #         define PNGAPI _System
  1272 #       define PNGAPI _System
  1407 #      endif
  1273 #     endif
  1408 #   else
  1274 #   else
  1409 #      if 0 /* ... other platforms, with other meanings */
  1275 #     if 0 /* ... other platforms, with other meanings */
  1410 #      endif
  1276 #     endif
  1411 #   endif
  1277 #   endif
  1412 
  1278 
  1413 #   if !defined(PNG_IMPEXP)
  1279 #   if !defined(PNG_IMPEXP)
  1414 #       include <qconfig.h>
  1280 #       include <qconfig.h>
  1415 #       if defined(QT_VISIBILITY_AVAILABLE)
  1281 #       if defined(QT_VISIBILITY_AVAILABLE)
  1428 
  1294 
  1429 #ifdef PNG_BUILDSYMS
  1295 #ifdef PNG_BUILDSYMS
  1430 #  ifndef PNG_EXPORT
  1296 #  ifndef PNG_EXPORT
  1431 #    define PNG_EXPORT(type,symbol) PNG_FUNCTION_EXPORT symbol END
  1297 #    define PNG_EXPORT(type,symbol) PNG_FUNCTION_EXPORT symbol END
  1432 #  endif
  1298 #  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
       
  1438 #endif
  1299 #endif
  1439 
  1300 
  1440 #ifndef PNG_EXPORT
  1301 #ifndef PNG_EXPORT
  1441 #  define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol
  1302 #  define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol
  1442 #endif
  1303 #endif
  1443 
  1304 
  1444 #ifdef PNG_USE_GLOBAL_ARRAYS
  1305 /* Support for compiler specific function attributes.  These are used
  1445 #  ifndef PNG_EXPORT_VAR
  1306  * so that where compiler support is available incorrect use of API
  1446 #    define PNG_EXPORT_VAR(type) extern PNG_IMPEXP type
  1307  * functions in png.h will generate compiler warnings.
  1447 #  endif
  1308  *
  1448 #endif
  1309  * Added at libpng-1.2.41.
  1449 
  1310  */
  1450 /* User may want to use these so they are not in PNG_INTERNAL. Any library
  1311 
  1451  * functions that are passed far data must be model independent.
  1312 #ifndef PNG_NO_PEDANTIC_WARNINGS
  1452  */
  1313 #  ifndef PNG_PEDANTIC_WARNINGS_SUPPORTED
  1453 
  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 */
  1454 #ifndef PNG_ABORT
  1381 #ifndef PNG_ABORT
  1455 #  define PNG_ABORT() abort()
  1382 #  if defined(_WINDOWS_) || defined(_WIN32_WCE)
  1456 #endif
  1383 #     define PNG_ABORT() ExitProcess(0)
  1457 
  1384 #  else
  1458 #ifdef PNG_SETJMP_SUPPORTED
  1385 #     define PNG_ABORT() abort()
  1459 #  define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
  1386 #  endif
  1460 #else
  1387 #endif
  1461 #  define png_jmpbuf(png_ptr) \
  1388 
  1462    (LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED)
  1389 #ifdef USE_FAR_KEYWORD
  1463 #endif
  1390 /* Use this to make far-to-near assignments */
  1464 
       
  1465 #if defined(USE_FAR_KEYWORD)  /* memory model independent fns */
       
  1466 /* use this to make far-to-near assignments */
       
  1467 #  define CHECK   1
  1391 #  define CHECK   1
  1468 #  define NOCHECK 0
  1392 #  define NOCHECK 0
  1469 #  define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
  1393 #  define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
  1470 #  define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
  1394 #  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 */
  1472 #  define png_strlen  _fstrlen
  1397 #  define png_strlen  _fstrlen
  1473 #  define png_memcmp  _fmemcmp    /* SJT: added */
  1398 #  define png_memcmp  _fmemcmp    /* SJT: added */
  1474 #  define png_memcpy  _fmemcpy
  1399 #  define png_memcpy  _fmemcpy
  1475 #  define png_memset  _fmemset
  1400 #  define png_memset  _fmemset
  1476 #else /* use the usual functions */
  1401 #  define png_sprintf sprintf
  1477 #  define CVT_PTR(ptr)         (ptr)
  1402 #else
  1478 #  define CVT_PTR_NOCHECK(ptr) (ptr)
  1403 #  ifdef _WINDOWS_  /* Favor Windows over C runtime fns */
  1479 #  ifndef PNG_NO_SNPRINTF
  1404 #    define CVT_PTR(ptr)         (ptr)
  1480 #    ifdef _MSC_VER
  1405 #    define CVT_PTR_NOCHECK(ptr) (ptr)
  1481 #      define png_snprintf _snprintf   /* Added to v 1.2.19 */
  1406 #    define png_strcpy  lstrcpyA
  1482 #      define png_snprintf2 _snprintf
  1407 #    define png_strncpy lstrcpynA
  1483 #      define png_snprintf6 _snprintf
  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
  1484 #    else
  1433 #    else
  1485 #      define png_snprintf snprintf   /* Added to v 1.2.19 */
  1434        /* You don't have or don't want to use snprintf().  Caution: Using
  1486 #      define png_snprintf2 snprintf
  1435         * sprintf instead of snprintf exposes your application to accidental
  1487 #      define png_snprintf6 snprintf
  1436         * or malevolent buffer overflows.  If you don't have snprintf()
  1488 #    endif
  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;
  1489 #  else
  1466 #  else
  1490      /* You don't have or don't want to use snprintf().  Caution: Using
  1467 #    if defined(_WINDOWS_) && (!defined(INT_MAX) || INT_MAX <= 0x7ffffffeL)
  1491       * sprintf instead of snprintf exposes your application to accidental
  1468 #      define  png_mem_alloc(s) HeapAlloc(GetProcessHeap(), 0, s)
  1492       * or malevolent buffer overflows.  If you don't have snprintf()
  1469 #      define  png_mem_free(p)  HeapFree(GetProcessHeap(), 0, p)
  1493       * as a general rule you should provide one (you can get one from
  1470        typedef DWORD            png_alloc_size_t;
  1494       * Portable OpenSSH). */
  1471 #    else
  1495 #    define png_snprintf(s1,n,fmt,x1) sprintf(s1,fmt,x1)
  1472 #      define  png_mem_alloc malloc
  1496 #    define png_snprintf2(s1,n,fmt,x1,x2) sprintf(s1,fmt,x1,x2)
  1473 #      define  png_mem_free  free
  1497 #    define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \
  1474        typedef png_size_t    png_alloc_size_t;
  1498         sprintf(s1,fmt,x1,x2,x3,x4,x5,x6)
  1475 #    endif
  1499 #  endif
  1476 #  endif
  1500 #  define png_strlen  strlen
  1477 #endif
  1501 #  define png_memcmp  memcmp      /* SJT: added */
  1478 /* End of memory model/platform independent support */
  1502 #  define png_memcpy  memcpy
       
  1503 #  define png_memset  memset
       
  1504 #endif
       
  1505 /* End of memory model independent support */
       
  1506 
  1479 
  1507 /* Just a little check that someone hasn't tried to define something
  1480 /* Just a little check that someone hasn't tried to define something
  1508  * contradictory.
  1481  * contradictory.
  1509  */
  1482  */
  1510 #if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K)
  1483 #if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K)
  1511 #  undef PNG_ZBUF_SIZE
  1484 #  undef PNG_ZBUF_SIZE
  1512 #  define PNG_ZBUF_SIZE 65536L
  1485 #  define PNG_ZBUF_SIZE 65536L
  1513 #endif
  1486 #endif
  1514 
  1487 
       
  1488 
  1515 /* Added at libpng-1.2.8 */
  1489 /* Added at libpng-1.2.8 */
  1516 #endif /* PNG_VERSION_INFO_ONLY */
  1490 #endif /* PNG_VERSION_INFO_ONLY */
  1517 
  1491 
  1518 #endif /* PNGCONF_H */
  1492 #endif /* PNGCONF_H */