/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* pngpriv.h - private declarations for use inside libpng
*
* This file is available under and governed by the GNU General Public
* License version 2 only, as published by the Free Software Foundation.
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* Last changed in libpng 1.5.4 [July 7, 2011]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/
/* The symbols declared in this file (including the functions declared
* as PNG_EXTERN) are PRIVATE. They are not part of the libpng public
* interface, and are not recommended for use by regular applications.
* Some of them may become public in the future; others may stay private,
* change in an incompatible way, or even disappear.
* Although the libpng users are not forbidden to include this header,
* they should be well aware of the issues that may arise from doing so.
*/
#ifndef PNGPRIV_H
#define PNGPRIV_H
/* Feature Test Macros. The following are defined here to ensure that correctly
* implemented libraries reveal the APIs libpng needs to build and hide those
* that are not needed and potentially damaging to the compilation.
*
* Feature Test Macros must be defined before any system header is included (see
* POSIX 1003.1 2.8.2 "POSIX Symbols."
*
* These macros only have an effect if the operating system supports either
* POSIX 1003.1 or C99, or both. On other operating systems (particularly
* still required (as of 2011-05-02.)
*/
/* This is required for the definition of abort(), used as a last ditch
* error handler when all else fails.
*/
#include <stdlib.h>
#define PNGLIB_BUILD
#ifdef PNG_USER_CONFIG
# include "pngusr.h"
/* These should have been defined in pngusr.h */
# ifndef PNG_USER_PRIVATEBUILD
# endif
# ifndef PNG_USER_DLLFNAME_POSTFIX
# endif
#endif
#include "png.h"
#include "pnginfo.h"
#include "pngstruct.h"
/* This is used for 16 bit gamma tables - only the top level pointers are const,
* this could be changed:
*/
/* Added at libpng-1.2.9 */
/* Moved to pngpriv.h at libpng-1.5.0 */
/* config.h is created by and PNG_CONFIGURE_LIBPNG is set by the "configure"
* script. We may need it here to get the correct configuration on things
* like limits.
*/
#ifdef PNG_CONFIGURE_LIBPNG
# ifdef HAVE_CONFIG_H
# include "config.h"
# endif
#endif
/* Moved to pngpriv.h at libpng-1.5.0 */
/* NOTE: some of these may have been used in external applications as
* these definitions were exposed in pngconf.h prior to 1.5.
*/
/* If you are running on a machine where you cannot allocate more
* than 64K of memory at once, uncomment this. While libpng will not
* normally need that much memory in a chunk (unless you load up a very
* large file), zlib needs to know how big of a chunk it can use, and
* libpng thus makes sure to check any memory allocation to verify it
* will fit into memory.
*
* zlib provides 'MAXSEG_64K' which, if defined, indicates the
* same limit and pngconf.h (already included) sets the limit
* if certain operating systems are detected.
*/
#if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K)
# define PNG_MAX_MALLOC_64K
#endif
#ifndef PNG_UNUSED
/* Unused formal parameter warnings are silenced using the following macro
* which is expected to have no bad effects on performance (optimizing
* compilers will probably remove it entirely). Note that if you replace
* it with something other than whitespace, you must include the terminating
* semicolon.
*/
#endif
/* Just a little check that someone hasn't tried to define something
* contradictory.
*/
#endif
/* PNG_STATIC is used to mark internal file scope functions if they need to be
* accessed for implementation tests (see the code in tests/?*).
*/
#ifndef PNG_STATIC
# define PNG_STATIC static
#endif
/* If warnings or errors are turned off the code is disabled or redirected here.
* From 1.5.4 functions have been added to allow very limited formatting of
* error and warning messages - this code will also be disabled here.
*/
#ifdef PNG_WARNINGS_SUPPORTED
#else
# define PNG_WARNING_PARAMETERS(p)
#endif
#ifndef PNG_ERROR_TEXT_SUPPORTED
#endif
#ifndef PNG_EXTERN
/* The functions exported by PNG_EXTERN are internal functions, which
* aren't usually used outside the library (as far as I know), so it is
* debatable if they should be exported at all. In the future, when it
* is possible to have run-time registry of chunk-handling functions,
* some of these might be made available again.
# define PNG_EXTERN extern
*/
# define PNG_EXTERN
#endif
/* Some fixed point APIs are still required even if not exported because
* they get used by the corresponding floating point APIs. This magic
* deals with this:
*/
#ifdef PNG_FIXED_POINT_SUPPORTED
#else
#endif
/* Other defines specific to compilers can go here. Try to keep
*/
#if defined(PNG_FLOATING_POINT_SUPPORTED) ||\
defined(PNG_FLOATING_ARITHMETIC_SUPPORTED)
/* png.c requires the following ANSI-C constants if the conversion of
* floating point to ASCII is implemented therein:
*
* DBL_DIG Maximum number of decimal digits (can be set to any constant)
* DBL_MIN Smallest normalized fp number (can be set to an arbitrary value)
* DBL_MAX Maximum floating point number (can be set to an arbitrary value)
*/
# include <float.h>
/* We need to check that <math.h> hasn't already been included earlier
* as it seems it doesn't agree with <fp.h>, yet we should really use
* <fp.h> if possible.
*/
# include <fp.h>
# endif
# else
# include <math.h>
# endif
/* Amiga SAS/C: We must include builtin FPU functions when compiling using
* MATH=68881
*/
# include <m68881.h>
# endif
#endif
/* This provides the non-ANSI (far) memory allocation routines. */
#if defined(__TURBOC__) && defined(__MSDOS__)
# include <mem.h>
# include <alloc.h>
#endif
# include <windows.h> /* defines _WINDOWS_ macro */
#endif
/* Moved here around 1.5.0beta36 from pngconf.h */
/* Users may want to use these so they are not private. Any library
* functions that are passed far data must be model-independent.
*/
#ifndef PNG_ABORT
# ifdef _WINDOWS_
# else
# endif
#endif
#ifdef USE_FAR_KEYWORD
/* Use this to make far-to-near assignments */
# define NOCHECK 0
#else
# ifdef _WINDOWS_ /* Favor Windows over C runtime fns */
# else
# endif
#endif
/* End of 1.5.0beta36 move from pngconf.h */
/* CONSTANTS and UTILITY MACROS
* These are used internally by libpng and not exposed in the API
*/
/* Various modes of operation. Note that after an init, mode is set to
* zero automatically when the structure is created. Three of these
* are defined in png.h because they need to be visible to applications
* that call png_set_unknown_chunk().
*/
/* #define PNG_HAVE_IHDR 0x01 (defined in png.h) */
/* #define PNG_HAVE_PLTE 0x02 (defined in png.h) */
/* #define PNG_AFTER_IDAT 0x08 (defined in png.h) */
/* Flags for the transformations the PNG library does on the image data */
/* 0x8000000L unused */
/* 0x10000000L unused */
/* 0x20000000L unused */
/* 0x40000000L unused */
/* Flags for png_create_struct */
/* Scaling factor for filter heuristic weighting calculations */
/* Flags for the png_ptr->flags rather than declaring a byte for each one */
/* 0x200000L unused */
/* 0x400000L unused */
/* 0x20000000L unused */
/* 0x40000000L unused */
/* zlib.h declares a magic type 'uInt' that limits the amount of data that zlib
* can handle at once. This type need be no larger than 16 bits (so maximum of
* 65535), this define allows us to discover how big it is, but limited by the
* maximuum for png_size_t. The value can be overriden in a library build
* (pngusr.h, or set it in CPPFLAGS) and it works to set it to a considerably
* lower value (e.g. 255 works). A lower value may help memory usage (slightly)
* and may even improve performance on some systems (and degrade it on others.)
*/
#ifndef ZLIB_IO_MAX
#endif
/* Save typing and make code easier to understand */
/* Added to libpng-1.2.6 JB */
((pixel_bits) >= 8 ? \
/* PNG_OUT_OF_RANGE returns true if value is outside the range
* ideal-delta..ideal+delta. Each argument is evaluated twice.
* "ideal" and "delta" should be constants, normally simple
* integers, "value" a variable. Added to libpng-1.2.6 JB
*/
/* Conversions between fixed and floating point, only defined if
* required (to make sure the code doesn't accidentally use float
* when it is supposedly disabled.)
*/
#ifdef PNG_FLOATING_POINT_SUPPORTED
/* The floating point conversion can't overflow, though it can and
* does lose accuracy relative to the original fixed point value.
* In practice this doesn't matter because png_fixed_point only
* stores numbers with very low precision. The png_ptr and s
* arguments are unused by default but are there in case error
* checking becomes a requirement.
*/
/* The fixed point conversion performs range checking and evaluates
* its argument multiple times, so must be used with care. The
* range checking uses the PNG specification values for a signed
* 32 bit fixed point value except that the values are deliberately
* rounded-to-zero to an integral value - 21474 (21474.83 is roughly
* (2^31-1) * 100000). 's' is a string that describes the value being
* converted.
*
* NOTE: this macro will raise a png_error if the range check fails,
* therefore it is normally only appropriate to use this on values
* that come from API calls or other sources where an out of range
* error indicates a programming error, not a data error!
*
* NOTE: by default this is off - the macro is not used - because the
* function call saves a lot of code.
*/
#else
#endif
#endif
/* Constant strings for known chunk types. If you need to add a chunk,
* define the name here, and add an invocation of the macro wherever it's
* needed.
*/
/* Gamma values (new at libpng-1.5.4): */
/* Inhibit C++ name-mangling for libpng functions but not for system calls. */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* These functions are used internally in the code. They generally
* shouldn't be used unless you are writing code to add or replace some
* functionality in libpng. More information about most functions can
* be found in the files where the functions are located.
*/
/* Check the user version string for compatibility, returns false if the version
* numbers aren't compatible.
*/
/* Allocate memory for an internal libpng struct */
/* Free memory from internal libpng struct */
/* Free any memory that info_ptr points to and reset struct. */
/* Function to allocate memory for zlib. PNGAPI is disallowed. */
/* Function to free memory for zlib. PNGAPI is disallowed. */
/* Next four functions are used internally as callbacks. PNGCBAPI is required
* but not PNG_EXPORT. PNGAPI added at libpng version 1.2.3, changed to
* PNGCBAPI at 1.5.0
*/
#endif
#ifdef PNG_WRITE_FLUSH_SUPPORTED
# ifdef PNG_STDIO_SUPPORTED
# endif
#endif
/* Reset the CRC variable */
/* Write the "data" buffer to whatever output you are using */
/* Read and check the PNG file signature */
/* Read the chunk header (length + type name) */
/* Read data from whatever input you are using into the "data" buffer */
png_size_t length));
/* Read bytes into buf, and update png_ptr->crc */
png_size_t length));
/* Decompress data in a chunk that uses compression */
#if defined(PNG_READ_COMPRESSED_TEXT_SUPPORTED)
#endif
/* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */
/* Read the CRC from the file and compare it to the libpng calculated CRC */
/* Calculate the CRC over a section of data. Note that we are only
* passing a maximum of 64K on systems that have this as a memory limit,
* since this is the maximum buffer size we can specify.
*/
#ifdef PNG_WRITE_FLUSH_SUPPORTED
#endif
/* Write various chunks */
/* Write the IHDR chunk, and update the png_struct with the necessary
* information.
*/
int interlace_method));
png_size_t length));
#ifdef PNG_WRITE_gAMA_SUPPORTED
# ifdef PNG_FLOATING_POINT_SUPPORTED
# endif
# ifdef PNG_FIXED_POINT_SUPPORTED
# endif
#endif
#ifdef PNG_WRITE_sBIT_SUPPORTED
#endif
#ifdef PNG_WRITE_cHRM_SUPPORTED
# ifdef PNG_FLOATING_POINT_SUPPORTED
# endif
#endif
#ifdef PNG_WRITE_sRGB_SUPPORTED
int intent));
#endif
#ifdef PNG_WRITE_iCCP_SUPPORTED
/* Note to maintainer: profile should be png_bytep */
#endif
#ifdef PNG_WRITE_sPLT_SUPPORTED
#endif
#ifdef PNG_WRITE_tRNS_SUPPORTED
int color_type));
#endif
#ifdef PNG_WRITE_bKGD_SUPPORTED
#endif
#ifdef PNG_WRITE_hIST_SUPPORTED
#endif
/* Chunks that have keywords */
#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
#endif
#ifdef PNG_WRITE_tEXt_SUPPORTED
#endif
#ifdef PNG_WRITE_zTXt_SUPPORTED
#endif
#ifdef PNG_WRITE_iTXt_SUPPORTED
#endif
#ifdef PNG_TEXT_SUPPORTED /* Added at version 1.0.14 and 1.2.4 */
#endif
#ifdef PNG_WRITE_oFFs_SUPPORTED
#endif
#ifdef PNG_WRITE_pCAL_SUPPORTED
#endif
#ifdef PNG_WRITE_pHYs_SUPPORTED
int unit_type));
#endif
#ifdef PNG_WRITE_tIME_SUPPORTED
#endif
#ifdef PNG_WRITE_sCAL_SUPPORTED
#endif
/* Called when finished processing a row of data */
/* Internal use only. Called before first row of data */
/* Combine a row of data, dealing with alpha, etc. if requested */
int mask));
/* Expand an interlaced row */
/* OLD pre-1.0.9 interface:
PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info,
png_bytep row, int pass, png_uint_32 transformations));
*/
#endif
/* GRR TO DO (2.0 or whenever): simplify other internal calling interfaces */
/* Grab pixels out of a row for an interlaced pass */
#endif
/* Unfilter a row */
int filter));
/* Choose the best filter to use and filter the row data */
/* Finish a row while reading, dealing with interlacing passes, etc. */
/* Initialize the row buffers, etc. */
/* Optional call to update the users info structure */
#endif
/* These are the functions that do the transformations */
#ifdef PNG_READ_FILLER_SUPPORTED
#endif
#endif
#endif
#endif
#endif
#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
#endif
#ifdef PNG_16BIT_SUPPORTED
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
#endif
#endif
#if defined(PNG_READ_PACKSWAP_SUPPORTED) || \
defined(PNG_WRITE_PACKSWAP_SUPPORTED)
#endif
#endif
#endif
#ifdef PNG_READ_PACK_SUPPORTED
#endif
#ifdef PNG_READ_SHIFT_SUPPORTED
#endif
#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
#endif
#endif
#endif
#ifdef PNG_READ_QUANTIZE_SUPPORTED
# ifdef PNG_CORRECT_PALETTE_SUPPORTED
# endif
#endif
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
#endif
#ifdef PNG_WRITE_PACK_SUPPORTED
#endif
#ifdef PNG_WRITE_SHIFT_SUPPORTED
#endif
#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
defined(PNG_READ_ALPHA_MODE_SUPPORTED)
#endif
#ifdef PNG_READ_GAMMA_SUPPORTED
#endif
#endif
#ifdef PNG_READ_EXPAND_SUPPORTED
int num_trans));
#endif
#ifdef PNG_READ_EXPAND_16_SUPPORTED
#endif
/* The following decodes the appropriate chunks, and does error correction,
* then calls the appropriate callback for the chunk if it is valid.
*/
/* Decode the IHDR chunk */
#ifdef PNG_READ_bKGD_SUPPORTED
#endif
#ifdef PNG_READ_cHRM_SUPPORTED
#endif
#ifdef PNG_READ_gAMA_SUPPORTED
#endif
#ifdef PNG_READ_hIST_SUPPORTED
#endif
#ifdef PNG_READ_iCCP_SUPPORTED
#endif /* PNG_READ_iCCP_SUPPORTED */
#ifdef PNG_READ_iTXt_SUPPORTED
#endif
#ifdef PNG_READ_oFFs_SUPPORTED
#endif
#ifdef PNG_READ_pCAL_SUPPORTED
#endif
#ifdef PNG_READ_pHYs_SUPPORTED
#endif
#ifdef PNG_READ_sBIT_SUPPORTED
#endif
#ifdef PNG_READ_sCAL_SUPPORTED
#endif
#ifdef PNG_READ_sPLT_SUPPORTED
#endif /* PNG_READ_sPLT_SUPPORTED */
#ifdef PNG_READ_sRGB_SUPPORTED
#endif
#ifdef PNG_READ_tEXt_SUPPORTED
#endif
#ifdef PNG_READ_tIME_SUPPORTED
#endif
#ifdef PNG_READ_tRNS_SUPPORTED
#endif
#ifdef PNG_READ_zTXt_SUPPORTED
#endif
/* Handle the transformations for reading and writing */
#endif
#endif
#endif
# ifdef PNG_READ_tEXt_SUPPORTED
# endif
# ifdef PNG_READ_zTXt_SUPPORTED
# endif
# ifdef PNG_READ_iTXt_SUPPORTED
# endif
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
#ifdef PNG_MNG_FEATURES_SUPPORTED
#endif
/* Added at libpng version 1.4.0 */
#ifdef PNG_CHECK_cHRM_SUPPORTED
#endif
#ifdef PNG_CHECK_cHRM_SUPPORTED
/* Added at libpng version 1.2.34 and 1.4.0 */
/* Currently only used by png_check_cHRM_fixed */
unsigned long *hi_product, unsigned long *lo_product));
#endif
/* Added at libpng version 1.4.0 */
int filter_type));
/* Free all memory used by the read (old method - NOT DLL EXPORTED) */
/* Free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */
#ifdef USE_FAR_KEYWORD /* memory model conversion function */
int check));
#endif /* USE_FAR_KEYWORD */
#if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)
#endif
/* Puts 'string' into 'buffer' at buffer[pos], taking care never to overwrite
* the end. Always leaves the buffer nul terminated. Never errors out (and
* there is no error code.)
*/
/* Various internal functions to handle formatted warning messages, currently
* only implemented for warnings.
*/
#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_TIME_RFC1123_SUPPORTED)
/* Utility to dump an unsigned value into a buffer, given a start pointer and
* and end pointer (which should point just *beyond* the end of the buffer!)
* Returns the pointer to the start of the formatted string. This utility only
* does unsigned values.
*/
/* Convenience macro that takes an array: */
/* Suggested size for a number buffer (enough for 64 bits and a sign!) */
/* These are the integer formats currently supported, the name is formed from
* the standard printf(3) format string.
*/
#endif
#ifdef PNG_WARNINGS_SUPPORTED
/* New defines and members adding in libpng-1.5.4 */
/* An l-value of this type has to be passed to the APIs below to cache the
* values of the parameters to a formatted warning message.
*/
/* Parameters are limited in size to PNG_WARNING_PARAMETER_SIZE characters,
* including the trailing '\0'.
*/
/* Use png_alloc_size_t because it is an unsigned type as big as any we
* need to output. Use the following for a signed value.
*/
* parameters previously supplied using the above functions. Errors in
* specifying the paramters will simple result in garbage substitutions.
*/
#endif
/* ASCII to FP interfaces, currently only implemented if sCAL
* support is required.
*/
#if defined(PNG_READ_sCAL_SUPPORTED)
/* MAX_DIGITS is actually the maximum number of characters in an sCAL
* width or height, derived from the precision (number of significant
* digits - a build time settable option) and assumpitions about the
* maximum ridiculous exponent.
*/
#ifdef PNG_FLOATING_POINT_SUPPORTED
#endif /* FLOATING_POINT */
#ifdef PNG_FIXED_POINT_SUPPORTED
#endif /* FIXED_POINT */
#endif /* READ_sCAL */
#if defined(PNG_sCAL_SUPPORTED) || defined(PNG_pCAL_SUPPORTED)
/* An internal API to validate the format of a floating point number.
* The result is the index of the next character. If the number is
* not valid it will be the index of a character in the supposed number.
*
* The format of a number is defined in the PNG extensions specification
* and this API is strictly conformant to that spec, not anyone elses!
*
* The format as a regular expression is:
*
* [+-]?[0-9]+.?([Ee][+-]?[0-9]+)?
*
* or:
*
* [+-]?.[0-9]+(.[0-9]+)?([Ee][+-]?[0-9]+)?
*
* The complexity is that either integer or fraction must be present and the
* fraction is permitted to have no digits only if the integer is present.
*
* NOTE: The dangling E problem.
* There is a PNG valid floating point number in the following:
*
* PNG floating point numb1.ers are not greedy.
*
* Working this out requires *TWO* character lookahead (because of the
* sign), the parser does not do this - it will fail at the 'r' - this
* doesn't matter for PNG sCAL chunk values, but it requires more care
* if the value were ever to be embedded in something more complex. Use
* ANSI-C strtod if you need the lookahead.
*/
/* State table for the parser. */
/* These three values don't affect the parser. They are set but not used.
*/
/* This is available for the caller to store in 'state' if required. Do not
* call the parser after setting it (the parser sometimes clears it.)
*/
/* Result codes for the parser (boolean - true meants ok, false means
* not ok yet.)
*/
/* Tests on the sticky non-zero and negative flags. To pass these checks
* the state must also indicate that the whole number is valid - this is
* achieved by testing PNG_FP_SAW_DIGIT (see the implementation for why this
* is equivalent to PNG_FP_OK above.)
*/
/* NZ_MASK: the string is valid and a non-zero negative value */
/* Z MASK: the string is valid and a non-zero value. */
/* PNG_FP_SAW_DIGIT: the string is valid. */
/* The actual parser. This can be called repeatedly, it updates
* the index into the string and the state variable (which must
* be initialzed to 0). It returns a result code, as above. There
* is no point calling the parser any more if it fails to advance to
* the end of the string - it is stuck on an invalid character (or
* terminated by '\0').
*
* Note that the pointer will consume an E or even an E+ then leave
* a 'maybe' state even though a preceding integer.fraction is valid.
* The PNG_FP_WAS_VALID flag indicates that a preceding substring was
* a valid number. It's possible to recover from this by calling
* the parser again (from the start, with state 0) but with a string
* that omits the last character (i.e. set the size to the index of
* the problem character.) This has not been tested within libpng.
*/
/* This is the same but it checks a complete string and returns true
* only if it just contains a floating point number. As of 1.5.4 this
* function also returns the state at the end of parsing the number if
* it was valid (otherwise it returns 0.) This can be used for testing
* for negative or zero values using the sticky flag.
*/
png_size_t size));
#endif /* pCAL || sCAL */
#if defined(PNG_READ_GAMMA_SUPPORTED) ||\
defined(PNG_INCH_CONVERSIONS_SUPPORTED) || defined(PNG_READ_pHYs_SUPPORTED)
/* Added at libpng version 1.5.0 */
* if there is an overflow. The result is a boolean - false (0)
* for overflow, true (1) if no overflow, in which case *res
* holds the result.
*/
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED)
/* Same deal, but issue a warning on overflow and return 0. */
#endif
#ifdef PNG_READ_GAMMA_SUPPORTED
/* Calculate a reciprocal - used for gamma values. This returns
* 0 if the argument is 0 in order to maintain an undefined value,
* there are no warnings.
*/
/* The same but gives a reciprocal of the product of two fixed point
* values. Accuracy is suitable for gamma calculations but this is
* not exact - use png_muldiv for that.
*/
png_fixed_point b));
#endif
#ifdef PNG_READ_GAMMA_SUPPORTED
/* Internal fixed point gamma correction. These APIs are called as
* required to convert single values - they don't need to be fast,
* they are not used when processing image pixel values.
*
* While the input is an 'unsigned' value it must actually be the
* correct bit value - 0..255 or 0..65535 as required.
*/
int bit_depth));
#endif
/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
#include "pngdebug.h"
#ifdef __cplusplus
}
#endif
#endif /* PNGPRIV_H */