/*
* 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.
*/
/* pngset.c - storage of image information into info struct
*
* 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:
*
* Last changed in libpng 1.5.4 [July 7, 2011]
* 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.)
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
* The functions here are used during reads to store data from the file
* into the info struct, and during writes to store application data
* into the info struct for writing into the file. This abstracts the
* info struct and allows us to change the structure in the future.
*/
#include "pngpriv.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#ifdef PNG_bKGD_SUPPORTED
void PNGAPI
{
return;
}
#endif
#ifdef PNG_cHRM_SUPPORTED
void PNGFAPI
{
return;
# ifdef PNG_CHECK_cHRM_SUPPORTED
# endif
{
}
}
# ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI
{
}
# endif /* PNG_FLOATING_POINT_SUPPORTED */
#endif /* PNG_cHRM_SUPPORTED */
#ifdef PNG_gAMA_SUPPORTED
void PNGFAPI
{
return;
/* Changed in libpng-1.5.4 to limit the values to ensure overflow can't
* occur. Since the fixed point representation is assymetrical it is
* possible for 1/gamma to overflow the limit of 21474 and this means the
* gamma value must be at least 5/100000 and hence at most 20000.0. For
* safety the limits here are a little narrower. The values are 0.00016 to
* 6250.0, which are truely ridiculous gammma values (and will produce
* displays that are all black or all white.)
*/
else
{
}
}
# ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI
{
"png_set_gAMA"));
}
# endif
#endif
#ifdef PNG_hIST_SUPPORTED
void PNGAPI
{
int i;
return;
{
"Invalid palette size, hIST allocation skipped");
return;
}
/* Changed from info->num_palette to PNG_MAX_PALETTE_LENGTH in
* version 1.2.1
*/
{
return;
}
for (i = 0; i < info_ptr->num_palette; i++)
}
#endif
void PNGAPI
int filter_type)
{
return;
else
/* Check for potential overflow */
if (width >
- 48 /* bigrowbuf hack */
- 1 /* filter byte */
- 7*8 /* rounding of width to multiple of 8 pixels */
- 8) /* extra max_pixel_depth pad */
else
}
#ifdef PNG_oFFs_SUPPORTED
void PNGAPI
{
return;
}
#endif
#ifdef PNG_pCAL_SUPPORTED
void PNGAPI
{
int i;
return;
(unsigned long)length);
/* TODO: validate format of calibration name and unit name */
/* Check that the type matches the specification. */
/* Validate params[nparams] */
for (i=0; i<nparams; ++i)
{
return;
}
(unsigned long)length);
{
return;
}
{
return;
}
for (i = 0; i < nparams; i++)
{
(unsigned long)length);
{
return;
}
}
}
#endif
#ifdef PNG_sCAL_SUPPORTED
void PNGAPI
{
return;
/* Double check the unit (should never get here with an invalid
* unit unless this is an API call.)
*/
++lengthw;
{
return;
}
++lengthh;
{
return;
}
}
# ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI
double height)
{
/* Check the arguments. */
if (width <= 0)
else if (height <= 0)
else
{
/* Convert 'width' and 'height' to ASCII. */
}
}
# endif
# ifdef PNG_FIXED_POINT_SUPPORTED
void PNGAPI
{
/* Check the arguments. */
if (width <= 0)
else if (height <= 0)
else
{
/* Convert 'width' and 'height' to ASCII. */
}
}
# endif
#endif
#ifdef PNG_pHYs_SUPPORTED
void PNGAPI
{
return;
}
#endif
void PNGAPI
{
return;
{
else
{
return;
}
}
/* It may not actually be necessary to set png_ptr->palette here;
* we do it for backward compatibility with the way the png_handle_tRNS
* function used to do the allocation.
*/
/* Changed in libpng-1.2.1 to allocate PNG_MAX_PALETTE_LENGTH instead
* of num_palette entries, in case of an invalid PNG file that has
* too-large sample values.
*/
}
#ifdef PNG_sBIT_SUPPORTED
void PNGAPI
{
return;
}
#endif
#ifdef PNG_sRGB_SUPPORTED
void PNGAPI
{
return;
}
void PNGAPI
int srgb_intent)
{
return;
# ifdef PNG_gAMA_SUPPORTED
# endif
# ifdef PNG_cHRM_SUPPORTED
/* color x y */
/* white */ 31270L, 32900L,
/* red */ 64000L, 33000L,
/* green */ 30000L, 60000L,
/* blue */ 15000L, 6000L
);
# endif /* cHRM */
}
#endif /* sRGB */
#ifdef PNG_iCCP_SUPPORTED
void PNGAPI
{
return;
if (new_iccp_name == NULL)
{
return;
}
if (new_iccp_profile == NULL)
{
"Insufficient memory to process iCCP profile");
return;
}
/* Compression is always zero but is here so the API and info structure
* does not have to change if we introduce multiple compression types
*/
}
#endif
#ifdef PNG_TEXT_SUPPORTED
void PNGAPI
int num_text)
{
int ret;
if (ret)
}
int /* PRIVATE */
{
int i;
return(0);
/* Make sure we have enough space in the "text" array in info_struct
* to hold all of the incoming text_ptr objects.
*/
{
{
int old_max;
{
return(1);
}
png_sizeof(png_text)));
}
else
{
return(1);
}
}
for (i = 0; i < num_text; i++)
{
continue;
{
continue;
}
if (text_ptr[i].compression <= 0)
{
lang_len = 0;
lang_key_len = 0;
}
else
# ifdef PNG_iTXt_SUPPORTED
{
/* Set iTXt data */
else
lang_len = 0;
else
lang_key_len = 0;
}
# else /* PNG_iTXt_SUPPORTED */
{
continue;
}
# endif
{
text_length = 0;
# ifdef PNG_iTXt_SUPPORTED
if (text_ptr[i].compression > 0)
else
# endif
}
else
{
}
return(1);
(unsigned long)(png_uint_32)
if (text_ptr[i].compression > 0)
{
}
else
{
}
if (text_length)
(png_size_t)(text_length));
# ifdef PNG_iTXt_SUPPORTED
if (textp->compression > 0)
{
textp->text_length = 0;
}
else
# endif
{
textp->itxt_length = 0;
}
}
return(0);
}
#endif
#ifdef PNG_tIME_SUPPORTED
void PNGAPI
{
return;
}
#endif
#ifdef PNG_tRNS_SUPPORTED
void PNGAPI
{
return;
if (trans_alpha != NULL)
{
/* It may not actually be necessary to set png_ptr->trans_alpha here;
* we do it for backward compatibility with the way the png_handle_tRNS
* function used to do the allocation.
*/
/* Changed from num_trans to PNG_MAX_PALETTE_LENGTH in version 1.2.1 */
}
if (trans_color != NULL)
{
"tRNS chunk has out-of-range samples for bit_depth");
if (num_trans == 0)
num_trans = 1;
}
if (num_trans != 0)
{
}
}
#endif
#ifdef PNG_sPLT_SUPPORTED
void PNGAPI
/*
* entries - array of png_sPLT_t structures
* to be added to the list of palettes
* in the info structure.
*
* nentries - number of palette structures to be
* added.
*/
{
int i;
return;
{
return;
}
for (i = 0; i < nentries; i++)
{
{
"Out of memory while processing sPLT chunk");
continue;
}
{
"Out of memory while processing sPLT chunk");
continue;
}
}
}
#endif /* PNG_sPLT_SUPPORTED */
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
void PNGAPI
{
int i;
return;
{
"Out of memory while processing unknown chunk");
return;
}
for (i = 0; i < num_unknowns; i++)
{
/* Note our location in the read or write sequence */
else
{
{
"Out of memory while processing unknown chunk");
}
else
}
}
}
void PNGAPI
{
}
#endif
#ifdef PNG_MNG_FEATURES_SUPPORTED
{
return (png_uint_32)0;
}
#endif
void PNGAPI
chunk_list, int num_chunks)
{
int i, old_num_chunks;
return;
if (num_chunks == 0)
{
else
if (keep == PNG_HANDLE_CHUNK_ALWAYS)
else
return;
}
if (chunk_list == NULL)
return;
{
}
}
#endif
void PNGAPI
{
return;
}
#endif
#ifdef PNG_INFO_IMAGE_SUPPORTED
void PNGAPI
{
return;
if (row_pointers)
}
#endif
void PNGAPI
{
return;
if (size > ZLIB_IO_MAX)
{
}
else
/* The following ensures a relatively safe failure if this gets called while
* the buffer is actually in use.
*/
}
void PNGAPI
{
}
/* This function was added to libpng 1.2.6 */
void PNGAPI
{
/* Images with dimensions larger than these limits will be
* rejected by png_set_IHDR(). To accept any PNG datastream
* regardless of dimensions, set both limits to 0x7ffffffL.
*/
return;
}
/* This function was added to libpng 1.4.0 */
void PNGAPI
{
if (png_ptr)
}
/* This function was added to libpng 1.4.1 */
void PNGAPI
{
if (png_ptr)
}
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
void PNGAPI
{
if (allowed)
else
}
#endif /* PNG_BENIGN_ERRORS_SUPPORTED */
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */