mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Imported from libpng-1.2.34beta03.tar
This commit is contained in:
68
pngset.c
68
pngset.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngset.c - storage of image information into info struct
|
||||
*
|
||||
* Last changed in libpng 1.2.34 [November 28, 2008]
|
||||
* Last changed in libpng 1.2.34 [December 1, 2008]
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@@ -21,7 +21,7 @@
|
||||
void PNGAPI
|
||||
png_set_bKGD(png_structp png_ptr, png_infop info_ptr, png_color_16p background)
|
||||
{
|
||||
png_debug1(1, "in %s storage function\n", "bKGD");
|
||||
png_debug1(1, "in %s storage function", "bKGD");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
@@ -37,7 +37,7 @@ png_set_cHRM(png_structp png_ptr, png_infop info_ptr,
|
||||
double white_x, double white_y, double red_x, double red_y,
|
||||
double green_x, double green_y, double blue_x, double blue_y)
|
||||
{
|
||||
png_debug1(1, "in %s storage function\n", "cHRM");
|
||||
png_debug1(1, "in %s storage function", "cHRM");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
@@ -69,7 +69,7 @@ png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
|
||||
png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y,
|
||||
png_fixed_point blue_x, png_fixed_point blue_y)
|
||||
{
|
||||
png_debug1(1, "in %s storage function\n", "cHRM fixed");
|
||||
png_debug1(1, "in %s storage function", "cHRM fixed");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
@@ -108,7 +108,7 @@ void PNGAPI
|
||||
png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma)
|
||||
{
|
||||
double gamma;
|
||||
png_debug1(1, "in %s storage function\n", "gAMA");
|
||||
png_debug1(1, "in %s storage function", "gAMA");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
@@ -135,7 +135,7 @@ png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
|
||||
{
|
||||
png_fixed_point gamma;
|
||||
|
||||
png_debug1(1, "in %s storage function\n", "gAMA");
|
||||
png_debug1(1, "in %s storage function", "gAMA");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
@@ -172,7 +172,7 @@ png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist)
|
||||
{
|
||||
int i;
|
||||
|
||||
png_debug1(1, "in %s storage function\n", "hIST");
|
||||
png_debug1(1, "in %s storage function", "hIST");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
if (info_ptr->num_palette == 0 || info_ptr->num_palette
|
||||
@@ -215,7 +215,7 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
|
||||
int color_type, int interlace_type, int compression_type,
|
||||
int filter_type)
|
||||
{
|
||||
png_debug1(1, "in %s storage function\n", "IHDR");
|
||||
png_debug1(1, "in %s storage function", "IHDR");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
@@ -322,7 +322,7 @@ void PNGAPI
|
||||
png_set_oFFs(png_structp png_ptr, png_infop info_ptr,
|
||||
png_int_32 offset_x, png_int_32 offset_y, int unit_type)
|
||||
{
|
||||
png_debug1(1, "in %s storage function\n", "oFFs");
|
||||
png_debug1(1, "in %s storage function", "oFFs");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
@@ -342,12 +342,12 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
|
||||
png_uint_32 length;
|
||||
int i;
|
||||
|
||||
png_debug1(1, "in %s storage function\n", "pCAL");
|
||||
png_debug1(1, "in %s storage function", "pCAL");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
length = png_strlen(purpose) + 1;
|
||||
png_debug1(3, "allocating purpose for info (%lu bytes)\n",
|
||||
png_debug1(3, "allocating purpose for info (%lu bytes)",
|
||||
(unsigned long)length);
|
||||
info_ptr->pcal_purpose = (png_charp)png_malloc_warn(png_ptr, length);
|
||||
if (info_ptr->pcal_purpose == NULL)
|
||||
@@ -357,14 +357,14 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
|
||||
}
|
||||
png_memcpy(info_ptr->pcal_purpose, purpose, (png_size_t)length);
|
||||
|
||||
png_debug(3, "storing X0, X1, type, and nparams in info\n");
|
||||
png_debug(3, "storing X0, X1, type, and nparams in info");
|
||||
info_ptr->pcal_X0 = X0;
|
||||
info_ptr->pcal_X1 = X1;
|
||||
info_ptr->pcal_type = (png_byte)type;
|
||||
info_ptr->pcal_nparams = (png_byte)nparams;
|
||||
|
||||
length = png_strlen(units) + 1;
|
||||
png_debug1(3, "allocating units for info (%lu bytes)\n",
|
||||
png_debug1(3, "allocating units for info (%lu bytes)",
|
||||
(unsigned long)length);
|
||||
info_ptr->pcal_units = (png_charp)png_malloc_warn(png_ptr, length);
|
||||
if (info_ptr->pcal_units == NULL)
|
||||
@@ -387,7 +387,7 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
|
||||
for (i = 0; i < nparams; i++)
|
||||
{
|
||||
length = png_strlen(params[i]) + 1;
|
||||
png_debug2(3, "allocating parameter %d for info (%lu bytes)\n", i,
|
||||
png_debug2(3, "allocating parameter %d for info (%lu bytes)", i,
|
||||
(unsigned long)length);
|
||||
info_ptr->pcal_params[i] = (png_charp)png_malloc_warn(png_ptr, length);
|
||||
if (info_ptr->pcal_params[i] == NULL)
|
||||
@@ -411,7 +411,7 @@ void PNGAPI
|
||||
png_set_sCAL(png_structp png_ptr, png_infop info_ptr,
|
||||
int unit, double width, double height)
|
||||
{
|
||||
png_debug1(1, "in %s storage function\n", "sCAL");
|
||||
png_debug1(1, "in %s storage function", "sCAL");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
@@ -429,14 +429,14 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
|
||||
{
|
||||
png_uint_32 length;
|
||||
|
||||
png_debug1(1, "in %s storage function\n", "sCAL");
|
||||
png_debug1(1, "in %s storage function", "sCAL");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
info_ptr->scal_unit = (png_byte)unit;
|
||||
|
||||
length = png_strlen(swidth) + 1;
|
||||
png_debug1(3, "allocating unit for info (%u bytes)\n",
|
||||
png_debug1(3, "allocating unit for info (%u bytes)",
|
||||
(unsigned int)length);
|
||||
info_ptr->scal_s_width = (png_charp)png_malloc_warn(png_ptr, length);
|
||||
if (info_ptr->scal_s_width == NULL)
|
||||
@@ -448,7 +448,7 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
|
||||
png_memcpy(info_ptr->scal_s_width, swidth, (png_size_t)length);
|
||||
|
||||
length = png_strlen(sheight) + 1;
|
||||
png_debug1(3, "allocating unit for info (%u bytes)\n",
|
||||
png_debug1(3, "allocating unit for info (%u bytes)",
|
||||
(unsigned int)length);
|
||||
info_ptr->scal_s_height = (png_charp)png_malloc_warn(png_ptr, length);
|
||||
if (info_ptr->scal_s_height == NULL)
|
||||
@@ -474,7 +474,7 @@ void PNGAPI
|
||||
png_set_pHYs(png_structp png_ptr, png_infop info_ptr,
|
||||
png_uint_32 res_x, png_uint_32 res_y, int unit_type)
|
||||
{
|
||||
png_debug1(1, "in %s storage function\n", "pHYs");
|
||||
png_debug1(1, "in %s storage function", "pHYs");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
@@ -490,7 +490,7 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
|
||||
png_colorp palette, int num_palette)
|
||||
{
|
||||
|
||||
png_debug1(1, "in %s storage function\n", "PLTE");
|
||||
png_debug1(1, "in %s storage function", "PLTE");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
@@ -539,7 +539,7 @@ void PNGAPI
|
||||
png_set_sBIT(png_structp png_ptr, png_infop info_ptr,
|
||||
png_color_8p sig_bit)
|
||||
{
|
||||
png_debug1(1, "in %s storage function\n", "sBIT");
|
||||
png_debug1(1, "in %s storage function", "sBIT");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
@@ -552,7 +552,7 @@ png_set_sBIT(png_structp png_ptr, png_infop info_ptr,
|
||||
void PNGAPI
|
||||
png_set_sRGB(png_structp png_ptr, png_infop info_ptr, int intent)
|
||||
{
|
||||
png_debug1(1, "in %s storage function\n", "sRGB");
|
||||
png_debug1(1, "in %s storage function", "sRGB");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
@@ -579,7 +579,7 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
|
||||
png_fixed_point int_white_x, int_white_y, int_red_x, int_red_y, int_green_x,
|
||||
int_green_y, int_blue_x, int_blue_y;
|
||||
#endif
|
||||
png_debug1(1, "in %s storage function", "sRGB_gAMA_and_cHRM\n");
|
||||
png_debug1(1, "in %s storage function", "sRGB_gAMA_and_cHRM");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
@@ -648,7 +648,7 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
|
||||
png_charp new_iccp_profile;
|
||||
png_uint_32 length;
|
||||
|
||||
png_debug1(1, "in %s storage function\n", "iCCP");
|
||||
png_debug1(1, "in %s storage function", "iCCP");
|
||||
if (png_ptr == NULL || info_ptr == NULL || name == NULL || profile == NULL)
|
||||
return;
|
||||
|
||||
@@ -702,7 +702,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
||||
{
|
||||
int i;
|
||||
|
||||
png_debug1(1, "in %s storage function\n", (png_ptr->chunk_name[0] == '\0' ?
|
||||
png_debug1(1, "in %s storage function", (png_ptr->chunk_name[0] == '\0' ?
|
||||
"text" : (png_const_charp)png_ptr->chunk_name));
|
||||
|
||||
if (png_ptr == NULL || info_ptr == NULL || num_text == 0)
|
||||
@@ -744,7 +744,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
||||
info_ptr->free_me |= PNG_FREE_TEXT;
|
||||
#endif
|
||||
}
|
||||
png_debug1(3, "allocated %d entries for info_ptr->text\n",
|
||||
png_debug1(3, "allocated %d entries for info_ptr->text",
|
||||
info_ptr->max_text);
|
||||
}
|
||||
for (i = 0; i < num_text; i++)
|
||||
@@ -804,7 +804,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
||||
(key_len + text_length + lang_len + lang_key_len + 4));
|
||||
if (textp->key == NULL)
|
||||
return(1);
|
||||
png_debug2(2, "Allocated %lu bytes at %x in png_set_text\n",
|
||||
png_debug2(2, "Allocated %lu bytes at %x in png_set_text",
|
||||
(png_uint_32)
|
||||
(key_len + lang_len + lang_key_len + text_length + 4),
|
||||
(int)textp->key);
|
||||
@@ -852,7 +852,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
||||
#endif
|
||||
}
|
||||
info_ptr->num_text++;
|
||||
png_debug1(3, "transferred text chunk %d\n", info_ptr->num_text);
|
||||
png_debug1(3, "transferred text chunk %d", info_ptr->num_text);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
@@ -862,7 +862,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
||||
void PNGAPI
|
||||
png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time)
|
||||
{
|
||||
png_debug1(1, "in %s storage function\n", "tIME");
|
||||
png_debug1(1, "in %s storage function", "tIME");
|
||||
if (png_ptr == NULL || info_ptr == NULL ||
|
||||
(png_ptr->mode & PNG_WROTE_tIME))
|
||||
return;
|
||||
@@ -877,7 +877,7 @@ void PNGAPI
|
||||
png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
|
||||
png_bytep trans, int num_trans, png_color_16p trans_values)
|
||||
{
|
||||
png_debug1(1, "in %s storage function\n", "tRNS");
|
||||
png_debug1(1, "in %s storage function", "tRNS");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
@@ -1082,7 +1082,7 @@ png_permit_empty_plte (png_structp png_ptr, int empty_plte_permitted)
|
||||
{
|
||||
/* This function is deprecated in favor of png_permit_mng_features()
|
||||
and will be removed from libpng-1.3.0 */
|
||||
png_debug(1, "in png_permit_empty_plte, DEPRECATED.\n");
|
||||
png_debug(1, "in png_permit_empty_plte, DEPRECATED.");
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
png_ptr->mng_features_permitted = (png_byte)
|
||||
@@ -1096,7 +1096,7 @@ png_permit_empty_plte (png_structp png_ptr, int empty_plte_permitted)
|
||||
png_uint_32 PNGAPI
|
||||
png_permit_mng_features (png_structp png_ptr, png_uint_32 mng_features)
|
||||
{
|
||||
png_debug(1, "in png_permit_mng_features\n");
|
||||
png_debug(1, "in png_permit_mng_features");
|
||||
if (png_ptr == NULL)
|
||||
return (png_uint_32)0;
|
||||
png_ptr->mng_features_permitted =
|
||||
@@ -1157,7 +1157,7 @@ void PNGAPI
|
||||
png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr,
|
||||
png_user_chunk_ptr read_user_chunk_fn)
|
||||
{
|
||||
png_debug(1, "in png_set_read_user_chunk_fn\n");
|
||||
png_debug(1, "in png_set_read_user_chunk_fn");
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
png_ptr->read_user_chunk_fn = read_user_chunk_fn;
|
||||
@@ -1169,7 +1169,7 @@ png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr,
|
||||
void PNGAPI
|
||||
png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers)
|
||||
{
|
||||
png_debug1(1, "in %s storage function\n", "rows");
|
||||
png_debug1(1, "in %s storage function", "rows");
|
||||
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user