PageRenderTime 62ms CodeModel.GetById 15ms app.highlight 40ms RepoModel.GetById 1ms app.codeStats 0ms

/media/libpng/pngpriv.h

http://github.com/zpao/v8monkey
C Header | 1012 lines | 715 code | 149 blank | 148 comment | 29 complexity | 526eb06276468e25d9e325d42492a4b6 MD5 | raw file
   1
   2/* pngpriv.h - private declarations for use inside libpng
   3 *
   4 * libpng version 1.4.8 - July 7, 2011
   5 * For conditions of distribution and use, see copyright notice in png.h
   6 * Copyright (c) 1998-2011 Glenn Randers-Pehrson
   7 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
   8 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
   9 *
  10 * This code is released under the libpng license.
  11 * For conditions of distribution and use, see the disclaimer
  12 * and license in png.h
  13 */
  14
  15/* The symbols declared in this file (including the functions declared
  16 * as PNG_EXTERN) are PRIVATE.  They are not part of the libpng public
  17 * interface, and are not recommended for use by regular applications.
  18 * Some of them may become public in the future; others may stay private,
  19 * change in an incompatible way, or even disappear.
  20 * Although the libpng users are not forbidden to include this header,
  21 * they should be well aware of the issues that may arise from doing so.
  22 */
  23
  24#ifndef PNGPRIV_H
  25#define PNGPRIV_H
  26
  27#ifndef PNG_VERSION_INFO_ONLY
  28
  29#if defined(_AIX) && defined(_ALL_SOURCE)
  30   /* On AIX if _ALL_SOURCE is defined standard header files (including
  31    * stdlib.h) define identifiers that are not permitted by the ANSI and
  32    * POSIX standards.  In particular 'jmpbuf' is #defined and this will
  33    * prevent compilation of libpng.  The following prevents this:
  34    */
  35#  undef _ALL_SOURCE
  36#endif
  37
  38#include <stdlib.h>
  39
  40#ifndef PNG_EXTERN
  41/* The functions exported by PNG_EXTERN are internal functions, which
  42 * aren't usually used outside the library (as far as I know), so it is
  43 * debatable if they should be exported at all.  In the future, when it
  44 * is possible to have run-time registry of chunk-handling functions,
  45 * some of these will be made available again.
  46#  define PNG_EXTERN extern
  47 */
  48#  define PNG_EXTERN
  49#endif
  50
  51/* Other defines specific to compilers can go here.  Try to keep
  52 * them inside an appropriate ifdef/endif pair for portability.
  53 */
  54
  55#ifdef PNG_FLOATING_POINT_SUPPORTED
  56#  ifdef MACOS
  57     /* We need to check that <math.h> hasn't already been included earlier
  58      * as it seems it doesn't agree with <fp.h>, yet we should really use
  59      * <fp.h> if possible.
  60      */
  61#    if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
  62#      include <fp.h>
  63#    endif
  64#  else
  65#    include <math.h>
  66#  endif
  67#  if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
  68     /* Amiga SAS/C: We must include builtin FPU functions when compiling using
  69      * MATH=68881
  70      */
  71#    include <m68881.h>
  72#  endif
  73#endif
  74
  75/* Codewarrior on NT has linking problems without this. */
  76#if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__)
  77#  define PNG_ALWAYS_EXTERN
  78#endif
  79
  80/* This provides the non-ANSI (far) memory allocation routines. */
  81#if defined(__TURBOC__) && defined(__MSDOS__)
  82#  include <mem.h>
  83#  include <alloc.h>
  84#endif
  85
  86#if defined(WIN32) || defined(_Windows) || defined(_WINDOWS) || \
  87    defined(_WIN32) || defined(__WIN32__)
  88#  include <windows.h>  /* defines _WINDOWS_ macro */
  89#endif
  90
  91/* Various modes of operation.  Note that after an init, mode is set to
  92 * zero automatically when the structure is created.
  93 */
  94#define PNG_HAVE_IHDR               0x01
  95#define PNG_HAVE_PLTE               0x02
  96#define PNG_HAVE_IDAT               0x04
  97#define PNG_AFTER_IDAT              0x08 /* Have complete zlib datastream */
  98#define PNG_HAVE_IEND               0x10
  99#define PNG_HAVE_gAMA               0x20
 100#define PNG_HAVE_cHRM               0x40
 101#define PNG_HAVE_sRGB               0x80
 102#define PNG_HAVE_CHUNK_HEADER      0x100
 103#define PNG_WROTE_tIME             0x200
 104#define PNG_WROTE_INFO_BEFORE_PLTE 0x400
 105#define PNG_BACKGROUND_IS_GRAY     0x800
 106#define PNG_HAVE_PNG_SIGNATURE    0x1000
 107#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */
 108#ifdef PNG_APNG_SUPPORTED
 109#define PNG_HAVE_acTL             0x4000
 110#define PNG_HAVE_fcTL             0x8000L
 111#endif
 112
 113/* Flags for the transformations the PNG library does on the image data */
 114#define PNG_BGR                 0x0001
 115#define PNG_INTERLACE           0x0002
 116#define PNG_PACK                0x0004
 117#define PNG_SHIFT               0x0008
 118#define PNG_SWAP_BYTES          0x0010
 119#define PNG_INVERT_MONO         0x0020
 120#define PNG_QUANTIZE            0x0040 /* formerly PNG_DITHER */
 121#define PNG_BACKGROUND          0x0080
 122#define PNG_BACKGROUND_EXPAND   0x0100
 123                          /*    0x0200 unused */
 124#define PNG_16_TO_8             0x0400
 125#define PNG_RGBA                0x0800
 126#define PNG_EXPAND              0x1000
 127#define PNG_GAMMA               0x2000
 128#define PNG_GRAY_TO_RGB         0x4000
 129#define PNG_FILLER              0x8000L
 130#define PNG_PACKSWAP           0x10000L
 131#define PNG_SWAP_ALPHA         0x20000L
 132#define PNG_STRIP_ALPHA        0x40000L
 133#define PNG_INVERT_ALPHA       0x80000L
 134#define PNG_USER_TRANSFORM    0x100000L
 135#define PNG_RGB_TO_GRAY_ERR   0x200000L
 136#define PNG_RGB_TO_GRAY_WARN  0x400000L
 137#define PNG_RGB_TO_GRAY       0x600000L  /* two bits, RGB_TO_GRAY_ERR|WARN */
 138                       /*     0x800000L     Unused */
 139#define PNG_ADD_ALPHA         0x1000000L  /* Added to libpng-1.2.7 */
 140#define PNG_EXPAND_tRNS       0x2000000L  /* Added to libpng-1.2.9 */
 141                       /*   0x4000000L  unused */
 142                       /*   0x8000000L  unused */
 143                       /*  0x10000000L  unused */
 144                       /*  0x20000000L  unused */
 145                       /*  0x40000000L  unused */
 146
 147/* Flags for png_create_struct */
 148#define PNG_STRUCT_PNG   0x0001
 149#define PNG_STRUCT_INFO  0x0002
 150
 151/* Scaling factor for filter heuristic weighting calculations */
 152#define PNG_WEIGHT_SHIFT 8
 153#define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT))
 154#define PNG_COST_SHIFT 3
 155#define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT))
 156
 157/* Flags for the png_ptr->flags rather than declaring a byte for each one */
 158#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY     0x0001
 159#define PNG_FLAG_ZLIB_CUSTOM_LEVEL        0x0002
 160#define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL    0x0004
 161#define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS  0x0008
 162#define PNG_FLAG_ZLIB_CUSTOM_METHOD       0x0010
 163#define PNG_FLAG_ZLIB_FINISHED            0x0020
 164#define PNG_FLAG_ROW_INIT                 0x0040
 165#define PNG_FLAG_FILLER_AFTER             0x0080
 166#define PNG_FLAG_CRC_ANCILLARY_USE        0x0100
 167#define PNG_FLAG_CRC_ANCILLARY_NOWARN     0x0200
 168#define PNG_FLAG_CRC_CRITICAL_USE         0x0400
 169#define PNG_FLAG_CRC_CRITICAL_IGNORE      0x0800
 170                                /*        0x1000  unused */
 171                                /*        0x2000  unused */
 172                                /*        0x4000  unused */
 173#define PNG_FLAG_KEEP_UNKNOWN_CHUNKS      0x8000L
 174#define PNG_FLAG_KEEP_UNSAFE_CHUNKS       0x10000L
 175#define PNG_FLAG_LIBRARY_MISMATCH         0x20000L
 176#define PNG_FLAG_STRIP_ERROR_NUMBERS      0x40000L
 177#define PNG_FLAG_STRIP_ERROR_TEXT         0x80000L
 178#define PNG_FLAG_MALLOC_NULL_MEM_OK       0x100000L
 179#define PNG_FLAG_ADD_ALPHA                0x200000L  /* Added to libpng-1.2.8 */
 180#define PNG_FLAG_STRIP_ALPHA              0x400000L  /* Added to libpng-1.2.8 */
 181#define PNG_FLAG_BENIGN_ERRORS_WARN       0x800000L  /* Added to libpng-1.4.0 */
 182                                  /*     0x1000000L  unused */
 183                                  /*     0x2000000L  unused */
 184                                  /*     0x4000000L  unused */
 185                                  /*     0x8000000L  unused */
 186                                  /*    0x10000000L  unused */
 187                                  /*    0x20000000L  unused */
 188                                  /*    0x40000000L  unused */
 189
 190#define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \
 191                                     PNG_FLAG_CRC_ANCILLARY_NOWARN)
 192
 193#define PNG_FLAG_CRC_CRITICAL_MASK  (PNG_FLAG_CRC_CRITICAL_USE | \
 194                                     PNG_FLAG_CRC_CRITICAL_IGNORE)
 195
 196#define PNG_FLAG_CRC_MASK           (PNG_FLAG_CRC_ANCILLARY_MASK | \
 197                                     PNG_FLAG_CRC_CRITICAL_MASK)
 198
 199/* Save typing and make code easier to understand */
 200
 201#define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \
 202   abs((int)((c1).green) - (int)((c2).green)) + \
 203   abs((int)((c1).blue) - (int)((c2).blue)))
 204
 205/* Added to libpng-1.2.6 JB */
 206#define PNG_ROWBYTES(pixel_bits, width) \
 207    ((pixel_bits) >= 8 ? \
 208    ((png_size_t)(width) * (((png_size_t)(pixel_bits)) >> 3)) : \
 209    (( ((png_size_t)(width) * ((png_size_t)(pixel_bits))) + 7) >> 3) )
 210
 211/* PNG_OUT_OF_RANGE returns true if value is outside the range
 212 * ideal-delta..ideal+delta.  Each argument is evaluated twice.
 213 * "ideal" and "delta" should be constants, normally simple
 214 * integers, "value" a variable. Added to libpng-1.2.6 JB
 215 */
 216#define PNG_OUT_OF_RANGE(value, ideal, delta) \
 217        ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) )
 218
 219/* Constant strings for known chunk types.  If you need to add a chunk,
 220 * define the name here, and add an invocation of the macro wherever it's
 221 * needed.
 222 */
 223#define PNG_IHDR PNG_CONST png_byte png_IHDR[5] = { 73,  72,  68,  82, '\0'}
 224#define PNG_IDAT PNG_CONST png_byte png_IDAT[5] = { 73,  68,  65,  84, '\0'}
 225#define PNG_IEND PNG_CONST png_byte png_IEND[5] = { 73,  69,  78,  68, '\0'}
 226#define PNG_PLTE PNG_CONST png_byte png_PLTE[5] = { 80,  76,  84,  69, '\0'}
 227#define PNG_bKGD PNG_CONST png_byte png_bKGD[5] = { 98,  75,  71,  68, '\0'}
 228#define PNG_cHRM PNG_CONST png_byte png_cHRM[5] = { 99,  72,  82,  77, '\0'}
 229#define PNG_gAMA PNG_CONST png_byte png_gAMA[5] = {103,  65,  77,  65, '\0'}
 230#define PNG_hIST PNG_CONST png_byte png_hIST[5] = {104,  73,  83,  84, '\0'}
 231#define PNG_iCCP PNG_CONST png_byte png_iCCP[5] = {105,  67,  67,  80, '\0'}
 232#define PNG_iTXt PNG_CONST png_byte png_iTXt[5] = {105,  84,  88, 116, '\0'}
 233#define PNG_oFFs PNG_CONST png_byte png_oFFs[5] = {111,  70,  70, 115, '\0'}
 234#define PNG_pCAL PNG_CONST png_byte png_pCAL[5] = {112,  67,  65,  76, '\0'}
 235#define PNG_sCAL PNG_CONST png_byte png_sCAL[5] = {115,  67,  65,  76, '\0'}
 236#define PNG_pHYs PNG_CONST png_byte png_pHYs[5] = {112,  72,  89, 115, '\0'}
 237#define PNG_sBIT PNG_CONST png_byte png_sBIT[5] = {115,  66,  73,  84, '\0'}
 238#define PNG_sPLT PNG_CONST png_byte png_sPLT[5] = {115,  80,  76,  84, '\0'}
 239#define PNG_sRGB PNG_CONST png_byte png_sRGB[5] = {115,  82,  71,  66, '\0'}
 240#define PNG_sTER PNG_CONST png_byte png_sTER[5] = {115,  84,  69,  82, '\0'}
 241#define PNG_tEXt PNG_CONST png_byte png_tEXt[5] = {116,  69,  88, 116, '\0'}
 242#define PNG_tIME PNG_CONST png_byte png_tIME[5] = {116,  73,  77,  69, '\0'}
 243#define PNG_tRNS PNG_CONST png_byte png_tRNS[5] = {116,  82,  78,  83, '\0'}
 244#define PNG_zTXt PNG_CONST png_byte png_zTXt[5] = {122,  84,  88, 116, '\0'}
 245#ifdef PNG_APNG_SUPPORTED
 246#define PNG_acTL PNG_CONST png_byte png_acTL[5] = { 97,  99,  84,  76, '\0'}
 247#define PNG_fcTL PNG_CONST png_byte png_fcTL[5] = {102,  99,  84,  76, '\0'}
 248#define PNG_fdAT PNG_CONST png_byte png_fdAT[5] = {102, 100,  65,  84, '\0'}
 249#endif
 250
 251
 252/* Inhibit C++ name-mangling for libpng functions but not for system calls. */
 253#ifdef __cplusplus
 254extern "C" {
 255#endif /* __cplusplus */
 256
 257/* These functions are used internally in the code.  They generally
 258 * shouldn't be used unless you are writing code to add or replace some
 259 * functionality in libpng.  More information about most functions can
 260 * be found in the files where the functions are located.
 261 */
 262
 263/* Allocate memory for an internal libpng struct */
 264PNG_EXTERN png_voidp png_create_struct PNGARG((int type));
 265
 266/* Free memory from internal libpng struct */
 267PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr));
 268
 269PNG_EXTERN png_voidp png_create_struct_2 PNGARG((int type, png_malloc_ptr
 270  malloc_fn, png_voidp mem_ptr));
 271PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr,
 272   png_free_ptr free_fn, png_voidp mem_ptr));
 273
 274/* Free any memory that info_ptr points to and reset struct. */
 275PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr,
 276   png_infop info_ptr));
 277
 278/* Function to allocate memory for zlib.  PNGAPI is disallowed. */
 279PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size));
 280
 281/* Function to free memory for zlib.  PNGAPI is disallowed. */
 282PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr));
 283
 284/* Next four functions are used internally as callbacks.  PNGAPI is required
 285 * but not PNG_EXPORT.  PNGAPI added at libpng version 1.2.3. */
 286
 287PNG_EXTERN void PNGAPI png_default_read_data PNGARG((png_structp png_ptr,
 288   png_bytep data, png_size_t length));
 289
 290#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
 291PNG_EXTERN void PNGAPI png_push_fill_buffer PNGARG((png_structp png_ptr,
 292   png_bytep buffer, png_size_t length));
 293#endif
 294
 295PNG_EXTERN void PNGAPI png_default_write_data PNGARG((png_structp png_ptr,
 296   png_bytep data, png_size_t length));
 297
 298#ifdef PNG_WRITE_FLUSH_SUPPORTED
 299#ifdef PNG_STDIO_SUPPORTED
 300PNG_EXTERN void PNGAPI png_default_flush PNGARG((png_structp png_ptr));
 301#endif
 302#endif
 303
 304/* Reset the CRC variable */
 305PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr));
 306
 307/* Write the "data" buffer to whatever output you are using */
 308PNG_EXTERN void png_write_data PNGARG((png_structp png_ptr, png_bytep data,
 309   png_size_t length));
 310
 311/* Read and check the PNG file signature */
 312PNG_EXTERN void png_read_sig PNGARG((png_structp png_ptr, png_infop info_ptr));
 313
 314/* Read the chunk header (length + type name) */
 315PNG_EXTERN png_uint_32 png_read_chunk_header PNGARG((png_structp png_ptr));
 316
 317/* Read data from whatever input you are using into the "data" buffer */
 318PNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data,
 319   png_size_t length));
 320
 321/* Read bytes into buf, and update png_ptr->crc */
 322PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf,
 323   png_size_t length));
 324
 325/* Decompress data in a chunk that uses compression */
 326#if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \
 327    defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED)
 328PNG_EXTERN void png_decompress_chunk PNGARG((png_structp png_ptr,
 329   int comp_type, png_size_t chunklength, png_size_t prefix_length,
 330   png_size_t *data_length));
 331#endif
 332
 333/* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */
 334PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip));
 335
 336/* Read the CRC from the file and compare it to the libpng calculated CRC */
 337PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr));
 338
 339/* Calculate the CRC over a section of data.  Note that we are only
 340 * passing a maximum of 64K on systems that have this as a memory limit,
 341 * since this is the maximum buffer size we can specify.
 342 */
 343PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr,
 344   png_size_t length));
 345
 346#ifdef PNG_WRITE_FLUSH_SUPPORTED
 347PNG_EXTERN void png_flush PNGARG((png_structp png_ptr));
 348#endif
 349
 350/* Write various chunks */
 351
 352/* Write the IHDR chunk, and update the png_struct with the necessary
 353 * information.
 354 */
 355PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width,
 356   png_uint_32 height,
 357   int bit_depth, int color_type, int compression_method, int filter_method,
 358   int interlace_method));
 359
 360PNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr, png_colorp palette,
 361   png_uint_32 num_pal));
 362
 363PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data,
 364   png_size_t length));
 365
 366PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr));
 367
 368#ifdef PNG_WRITE_gAMA_SUPPORTED
 369#ifdef PNG_FLOATING_POINT_SUPPORTED
 370PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma));
 371#endif
 372#ifdef PNG_FIXED_POINT_SUPPORTED
 373PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr,
 374    png_fixed_point file_gamma));
 375#endif
 376#endif
 377
 378#ifdef PNG_WRITE_sBIT_SUPPORTED
 379PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit,
 380   int color_type));
 381#endif
 382
 383#ifdef PNG_WRITE_cHRM_SUPPORTED
 384#ifdef PNG_FLOATING_POINT_SUPPORTED
 385PNG_EXTERN void png_write_cHRM PNGARG((png_structp png_ptr,
 386   double white_x, double white_y,
 387   double red_x, double red_y, double green_x, double green_y,
 388   double blue_x, double blue_y));
 389#endif
 390PNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structp png_ptr,
 391   png_fixed_point int_white_x, png_fixed_point int_white_y,
 392   png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
 393   int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
 394   png_fixed_point int_blue_y));
 395#endif
 396
 397#ifdef PNG_WRITE_sRGB_SUPPORTED
 398PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr,
 399   int intent));
 400#endif
 401
 402#ifdef PNG_WRITE_iCCP_SUPPORTED
 403PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr,
 404   png_charp name, int compression_type,
 405   png_charp profile, int proflen));
 406   /* Note to maintainer: profile should be png_bytep */
 407#endif
 408
 409#ifdef PNG_WRITE_sPLT_SUPPORTED
 410PNG_EXTERN void png_write_sPLT PNGARG((png_structp png_ptr,
 411   png_sPLT_tp palette));
 412#endif
 413
 414#ifdef PNG_WRITE_tRNS_SUPPORTED
 415PNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr, png_bytep trans,
 416   png_color_16p values, int number, int color_type));
 417#endif
 418
 419#ifdef PNG_WRITE_bKGD_SUPPORTED
 420PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr,
 421   png_color_16p values, int color_type));
 422#endif
 423
 424#ifdef PNG_WRITE_hIST_SUPPORTED
 425PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, png_uint_16p hist,
 426   int num_hist));
 427#endif
 428
 429#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
 430    defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
 431PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr,
 432   png_charp key, png_charpp new_key));
 433#endif
 434
 435#ifdef PNG_WRITE_tEXt_SUPPORTED
 436PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_charp key,
 437   png_charp text, png_size_t text_len));
 438#endif
 439
 440#ifdef PNG_WRITE_zTXt_SUPPORTED
 441PNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_charp key,
 442   png_charp text, png_size_t text_len, int compression));
 443#endif
 444
 445#ifdef PNG_WRITE_iTXt_SUPPORTED
 446PNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr,
 447   int compression, png_charp key, png_charp lang, png_charp lang_key,
 448   png_charp text));
 449#endif
 450
 451#ifdef PNG_TEXT_SUPPORTED  /* Added at version 1.0.14 and 1.2.4 */
 452PNG_EXTERN int png_set_text_2 PNGARG((png_structp png_ptr,
 453   png_infop info_ptr, png_textp text_ptr, int num_text));
 454#endif
 455
 456#ifdef PNG_WRITE_oFFs_SUPPORTED
 457PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr,
 458   png_int_32 x_offset, png_int_32 y_offset, int unit_type));
 459#endif
 460
 461#ifdef PNG_WRITE_pCAL_SUPPORTED
 462PNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose,
 463   png_int_32 X0, png_int_32 X1, int type, int nparams,
 464   png_charp units, png_charpp params));
 465#endif
 466
 467#ifdef PNG_WRITE_pHYs_SUPPORTED
 468PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr,
 469   png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit,
 470   int unit_type));
 471#endif
 472
 473#ifdef PNG_WRITE_tIME_SUPPORTED
 474PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr,
 475   png_timep mod_time));
 476#endif
 477
 478#ifdef PNG_WRITE_sCAL_SUPPORTED
 479#if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_STDIO_SUPPORTED)
 480PNG_EXTERN void png_write_sCAL PNGARG((png_structp png_ptr,
 481   int unit, double width, double height));
 482#else
 483#ifdef PNG_FIXED_POINT_SUPPORTED
 484PNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr,
 485   int unit, png_charp width, png_charp height));
 486#endif
 487#endif
 488#endif
 489
 490#ifdef PNG_WRITE_APNG_SUPPORTED
 491PNG_EXTERN void png_write_acTL PNGARG((png_structp png_ptr,
 492   png_uint_32 num_frames, png_uint_32 num_plays));
 493
 494PNG_EXTERN void png_write_fcTL PNGARG((png_structp png_ptr,
 495   png_uint_32 width, png_uint_32 height,
 496   png_uint_32 x_offset, png_uint_32 y_offset,
 497   png_uint_16 delay_num, png_uint_16 delay_den,
 498   png_byte dispose_op, png_byte blend_op));
 499#endif
 500
 501/* Called when finished processing a row of data */
 502PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr));
 503
 504/* Internal use only.   Called before first row of data */
 505PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr));
 506
 507#ifdef PNG_READ_GAMMA_SUPPORTED
 508PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr,
 509   png_byte bit_depth));
 510#endif
 511
 512/* Combine a row of data, dealing with alpha, etc. if requested */
 513PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row,
 514   int mask));
 515
 516#ifdef PNG_READ_INTERLACING_SUPPORTED
 517/* Expand an interlaced row */
 518/* OLD pre-1.0.9 interface:
 519PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info,
 520   png_bytep row, int pass, png_uint_32 transformations));
 521 */
 522PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr));
 523#endif
 524
 525/* GRR TO DO (2.0 or whenever):  simplify other internal calling interfaces */
 526
 527#ifdef PNG_WRITE_INTERLACING_SUPPORTED
 528/* Grab pixels out of a row for an interlaced pass */
 529PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info,
 530   png_bytep row, int pass));
 531#endif
 532
 533/* Unfilter a row */
 534PNG_EXTERN void png_read_filter_row PNGARG((png_structp png_ptr,
 535   png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter));
 536
 537/* Choose the best filter to use and filter the row data */
 538PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr,
 539   png_row_infop row_info));
 540
 541/* Write out the filtered row. */
 542PNG_EXTERN void png_write_filtered_row PNGARG((png_structp png_ptr,
 543   png_bytep filtered_row));
 544/* Finish a row while reading, dealing with interlacing passes, etc. */
 545PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr));
 546
 547/* Initialize the row buffers, etc. */
 548PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr));
 549/* Optional call to update the users info structure */
 550PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr,
 551   png_infop info_ptr));
 552
 553#ifdef PNG_READ_APNG_SUPPORTED
 554/* Private, reset some things to become ready for reading next frame */
 555PNG_EXTERN void png_read_reset PNGARG((png_structp png_ptr));
 556PNG_EXTERN void png_read_reinit PNGARG((png_structp png_ptr,
 557   png_infop info_ptr));
 558PNG_EXTERN void png_progressive_read_reset PNGARG((png_structp png_ptr));
 559#endif
 560#ifdef PNG_WRITE_APNG_SUPPORTED
 561/* Private, reset some things to become ready for writing next frame */
 562PNG_EXTERN void png_write_reset PNGARG((png_structp png_ptr));
 563PNG_EXTERN void png_write_reinit PNGARG((png_structp png_ptr,
 564   png_infop info_ptr, png_uint_32 width, png_uint_32 height));
 565#endif
 566
 567/* These are the functions that do the transformations */
 568#ifdef PNG_READ_FILLER_SUPPORTED
 569PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info,
 570   png_bytep row, png_uint_32 filler, png_uint_32 flags));
 571#endif
 572
 573#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
 574PNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info,
 575   png_bytep row));
 576#endif
 577
 578#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
 579PNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info,
 580   png_bytep row));
 581#endif
 582
 583#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
 584PNG_EXTERN void png_do_read_invert_alpha PNGARG((png_row_infop row_info,
 585   png_bytep row));
 586#endif
 587
 588#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
 589PNG_EXTERN void png_do_write_invert_alpha PNGARG((png_row_infop row_info,
 590   png_bytep row));
 591#endif
 592
 593#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
 594    defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
 595PNG_EXTERN void png_do_strip_filler PNGARG((png_row_infop row_info,
 596   png_bytep row, png_uint_32 flags));
 597#endif
 598
 599#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
 600PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info, png_bytep row));
 601#endif
 602
 603#if defined(PNG_READ_PACKSWAP_SUPPORTED) || \
 604    defined(PNG_WRITE_PACKSWAP_SUPPORTED)
 605PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, png_bytep row));
 606#endif
 607
 608#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
 609PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr, png_row_infop
 610   row_info, png_bytep row));
 611#endif
 612
 613#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
 614PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info,
 615   png_bytep row));
 616#endif
 617
 618#ifdef PNG_READ_PACK_SUPPORTED
 619PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info, png_bytep row));
 620#endif
 621
 622#ifdef PNG_READ_SHIFT_SUPPORTED
 623PNG_EXTERN void png_do_unshift PNGARG((png_row_infop row_info, png_bytep row,
 624   png_color_8p sig_bits));
 625#endif
 626
 627#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
 628PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info, png_bytep row));
 629#endif
 630
 631#ifdef PNG_READ_16_TO_8_SUPPORTED
 632PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, png_bytep row));
 633#endif
 634
 635#ifdef PNG_READ_QUANTIZE_SUPPORTED
 636PNG_EXTERN void png_do_quantize PNGARG((png_row_infop row_info,
 637   png_bytep row, png_bytep palette_lookup, png_bytep quantize_lookup));
 638
 639#  ifdef PNG_CORRECT_PALETTE_SUPPORTED
 640PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr,
 641   png_colorp palette, int num_palette));
 642#  endif
 643#endif
 644
 645#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
 646PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info, png_bytep row));
 647#endif
 648
 649#ifdef PNG_WRITE_PACK_SUPPORTED
 650PNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info,
 651   png_bytep row, png_uint_32 bit_depth));
 652#endif
 653
 654#ifdef PNG_WRITE_SHIFT_SUPPORTED
 655PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info, png_bytep row,
 656   png_color_8p bit_depth));
 657#endif
 658
 659#ifdef PNG_READ_BACKGROUND_SUPPORTED
 660#ifdef PNG_READ_GAMMA_SUPPORTED
 661PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
 662   png_color_16p trans_color, png_color_16p background,
 663   png_color_16p background_1,
 664   png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1,
 665   png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1,
 666   png_uint_16pp gamma_16_to_1, int gamma_shift));
 667#else
 668PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
 669   png_color_16p trans_color, png_color_16p background));
 670#endif
 671#endif
 672
 673#ifdef PNG_READ_GAMMA_SUPPORTED
 674PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, png_bytep row,
 675   png_bytep gamma_table, png_uint_16pp gamma_16_table,
 676   int gamma_shift));
 677#endif
 678
 679#ifdef PNG_READ_EXPAND_SUPPORTED
 680PNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info,
 681   png_bytep row, png_colorp palette, png_bytep trans, int num_trans));
 682PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info,
 683   png_bytep row, png_color_16p trans_value));
 684#endif
 685
 686/* The following decodes the appropriate chunks, and does error correction,
 687 * then calls the appropriate callback for the chunk if it is valid.
 688 */
 689
 690/* Decode the IHDR chunk */
 691PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr,
 692   png_uint_32 length));
 693PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr,
 694   png_uint_32 length));
 695PNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr,
 696   png_uint_32 length));
 697
 698#ifdef PNG_READ_bKGD_SUPPORTED
 699PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr,
 700   png_uint_32 length));
 701#endif
 702
 703#ifdef PNG_READ_cHRM_SUPPORTED
 704PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr,
 705   png_uint_32 length));
 706#endif
 707
 708#ifdef PNG_READ_gAMA_SUPPORTED
 709PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr,
 710   png_uint_32 length));
 711#endif
 712
 713#ifdef PNG_READ_hIST_SUPPORTED
 714PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr,
 715   png_uint_32 length));
 716#endif
 717
 718#ifdef PNG_READ_iCCP_SUPPORTED
 719PNG_EXTERN void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr,
 720   png_uint_32 length));
 721#endif /* PNG_READ_iCCP_SUPPORTED */
 722
 723#ifdef PNG_READ_iTXt_SUPPORTED
 724PNG_EXTERN void png_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
 725   png_uint_32 length));
 726#endif
 727
 728#ifdef PNG_READ_oFFs_SUPPORTED
 729PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr,
 730   png_uint_32 length));
 731#endif
 732
 733#ifdef PNG_READ_pCAL_SUPPORTED
 734PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
 735   png_uint_32 length));
 736#endif
 737
 738#ifdef PNG_READ_pHYs_SUPPORTED
 739PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr,
 740   png_uint_32 length));
 741#endif
 742
 743#ifdef PNG_READ_sBIT_SUPPORTED
 744PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr,
 745   png_uint_32 length));
 746#endif
 747
 748#ifdef PNG_READ_sCAL_SUPPORTED
 749PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
 750   png_uint_32 length));
 751#endif
 752
 753#ifdef PNG_READ_sPLT_SUPPORTED
 754PNG_EXTERN void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr,
 755   png_uint_32 length));
 756#endif /* PNG_READ_sPLT_SUPPORTED */
 757
 758#ifdef PNG_READ_sRGB_SUPPORTED
 759PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr,
 760   png_uint_32 length));
 761#endif
 762
 763#ifdef PNG_READ_tEXt_SUPPORTED
 764PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr,
 765   png_uint_32 length));
 766#endif
 767
 768#ifdef PNG_READ_tIME_SUPPORTED
 769PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr,
 770   png_uint_32 length));
 771#endif
 772
 773#ifdef PNG_READ_tRNS_SUPPORTED
 774PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr,
 775   png_uint_32 length));
 776#endif
 777
 778#ifdef PNG_READ_zTXt_SUPPORTED
 779PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
 780   png_uint_32 length));
 781#endif
 782
 783#ifdef PNG_READ_APNG_SUPPORTED
 784PNG_EXTERN void png_handle_acTL PNGARG((png_structp png_ptr, png_infop info_ptr,
 785   png_uint_32 length));
 786PNG_EXTERN void png_handle_fcTL PNGARG((png_structp png_ptr, png_infop info_ptr,
 787   png_uint_32 length));
 788PNG_EXTERN void png_have_info PNGARG((png_structp png_ptr, png_infop info_ptr));
 789PNG_EXTERN void png_handle_fdAT PNGARG((png_structp png_ptr, png_infop info_ptr,
 790   png_uint_32 length));
 791PNG_EXTERN void png_ensure_sequence_number PNGARG((png_structp png_ptr,
 792   png_uint_32 length));
 793#endif
 794
 795PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr,
 796   png_infop info_ptr, png_uint_32 length));
 797
 798PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr,
 799   png_bytep chunk_name));
 800
 801/* Handle the transformations for reading and writing */
 802PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr));
 803PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr));
 804
 805PNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr));
 806
 807#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
 808PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr,
 809   png_infop info_ptr));
 810PNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr,
 811   png_infop info_ptr));
 812PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr));
 813PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr,
 814   png_uint_32 length));
 815PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr));
 816PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr));
 817PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr,
 818   png_bytep buffer, png_size_t buffer_length));
 819PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr));
 820PNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr,
 821   png_bytep buffer, png_size_t buffer_length));
 822PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr));
 823PNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr,
 824   png_infop info_ptr, png_uint_32 length));
 825PNG_EXTERN void png_push_have_info PNGARG((png_structp png_ptr,
 826   png_infop info_ptr));
 827PNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr,
 828   png_infop info_ptr));
 829PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row));
 830PNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr,
 831   png_infop info_ptr));
 832PNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr,
 833   png_infop info_ptr));
 834PNG_EXTERN void png_read_push_finish_row PNGARG((png_structp png_ptr));
 835#ifdef PNG_READ_tEXt_SUPPORTED
 836PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr,
 837   png_infop info_ptr, png_uint_32 length));
 838PNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr,
 839   png_infop info_ptr));
 840#endif
 841#ifdef PNG_READ_zTXt_SUPPORTED
 842PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr,
 843   png_infop info_ptr, png_uint_32 length));
 844PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr,
 845   png_infop info_ptr));
 846#endif
 847#ifdef PNG_READ_iTXt_SUPPORTED
 848PNG_EXTERN void png_push_handle_iTXt PNGARG((png_structp png_ptr,
 849   png_infop info_ptr, png_uint_32 length));
 850PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr,
 851   png_infop info_ptr));
 852#endif
 853
 854#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
 855
 856#ifdef PNG_MNG_FEATURES_SUPPORTED
 857PNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info,
 858   png_bytep row));
 859PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info,
 860   png_bytep row));
 861#endif
 862
 863/* Added at libpng version 1.4.0 */
 864#ifdef PNG_cHRM_SUPPORTED
 865PNG_EXTERN int png_check_cHRM_fixed PNGARG((png_structp png_ptr,
 866   png_fixed_point int_white_x, png_fixed_point int_white_y,
 867   png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
 868   int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
 869   png_fixed_point int_blue_y));
 870#endif
 871
 872#ifdef PNG_cHRM_SUPPORTED
 873#ifdef PNG_CHECK_cHRM_SUPPORTED
 874/* Added at libpng version 1.2.34 and 1.4.0 */
 875PNG_EXTERN void png_64bit_product PNGARG((long v1, long v2,
 876   unsigned long *hi_product, unsigned long *lo_product));
 877#endif
 878#endif
 879
 880/* Added at libpng version 1.4.0 */
 881PNG_EXTERN void png_check_IHDR PNGARG((png_structp png_ptr,
 882   png_uint_32 width, png_uint_32 height, int bit_depth,
 883   int color_type, int interlace_type, int compression_type,
 884   int filter_type));
 885
 886/* Free all memory used by the read (old method - NOT DLL EXPORTED) */
 887PNG_EXTERN void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr,
 888   png_infop end_info_ptr));
 889
 890/* Free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */
 891PNG_EXTERN void png_write_destroy PNGARG((png_structp png_ptr));
 892
 893#ifdef USE_FAR_KEYWORD  /* memory model conversion function */
 894PNG_EXTERN void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr,
 895   int check));
 896#endif /* USE_FAR_KEYWORD */
 897
 898/* Define PNG_DEBUG at compile time for debugging information.  Higher
 899 * numbers for PNG_DEBUG mean more debugging information.  This has
 900 * only been added since version 0.95 so it is not implemented throughout
 901 * libpng yet, but more support will be added as needed.
 902 */
 903#ifdef PNG_DEBUG
 904#if (PNG_DEBUG > 0)
 905#if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER)
 906#include <crtdbg.h>
 907#if (PNG_DEBUG > 1)
 908#ifndef _DEBUG
 909#  define _DEBUG
 910#endif
 911#ifndef png_debug
 912#define png_debug(l,m)  _RPT0(_CRT_WARN,m PNG_STRING_NEWLINE)
 913#endif
 914#ifndef png_debug1
 915#define png_debug1(l,m,p1)  _RPT1(_CRT_WARN,m PNG_STRING_NEWLINE,p1)
 916#endif
 917#ifndef png_debug2
 918#define png_debug2(l,m,p1,p2) _RPT2(_CRT_WARN,m PNG_STRING_NEWLINE,p1,p2)
 919#endif
 920#endif
 921#else /* PNG_DEBUG_FILE || !_MSC_VER */
 922#ifndef PNG_DEBUG_FILE
 923#define PNG_DEBUG_FILE stderr
 924#endif /* PNG_DEBUG_FILE */
 925
 926#if (PNG_DEBUG > 1)
 927/* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on
 928 * non-ISO compilers
 929 */
 930#  ifdef __STDC__
 931#    ifndef png_debug
 932#      define png_debug(l,m) \
 933       { \
 934       int num_tabs=l; \
 935       fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
 936         (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
 937       }
 938#    endif
 939#    ifndef png_debug1
 940#      define png_debug1(l,m,p1) \
 941       { \
 942       int num_tabs=l; \
 943       fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
 944         (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
 945       }
 946#    endif
 947#    ifndef png_debug2
 948#      define png_debug2(l,m,p1,p2) \
 949       { \
 950       int num_tabs=l; \
 951       fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
 952         (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
 953       }
 954#    endif
 955#  else /* __STDC __ */
 956#    ifndef png_debug
 957#      define png_debug(l,m) \
 958       { \
 959       int num_tabs=l; \
 960       char format[256]; \
 961       snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
 962         (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
 963         m,PNG_STRING_NEWLINE); \
 964       fprintf(PNG_DEBUG_FILE,format); \
 965       }
 966#    endif
 967#    ifndef png_debug1
 968#      define png_debug1(l,m,p1) \
 969       { \
 970       int num_tabs=l; \
 971       char format[256]; \
 972       snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
 973         (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
 974         m,PNG_STRING_NEWLINE); \
 975       fprintf(PNG_DEBUG_FILE,format,p1); \
 976       }
 977#    endif
 978#    ifndef png_debug2
 979#      define png_debug2(l,m,p1,p2) \
 980       { \
 981       int num_tabs=l; \
 982       char format[256]; \
 983       snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
 984         (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
 985         m,PNG_STRING_NEWLINE); \
 986       fprintf(PNG_DEBUG_FILE,format,p1,p2); \
 987       }
 988#    endif
 989#  endif /* __STDC __ */
 990#endif /* (PNG_DEBUG > 1) */
 991
 992#endif /* _MSC_VER */
 993#endif /* (PNG_DEBUG > 0) */
 994#endif /* PNG_DEBUG */
 995#ifndef png_debug
 996#define png_debug(l, m)
 997#endif
 998#ifndef png_debug1
 999#define png_debug1(l, m, p1)
1000#endif
1001#ifndef png_debug2
1002#define png_debug2(l, m, p1, p2)
1003#endif
1004
1005/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
1006
1007#ifdef __cplusplus
1008}
1009#endif
1010
1011#endif /* PNG_VERSION_INFO_ONLY */
1012#endif /* PNGPRIV_H */