mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Imported from libpng-1.4.0beta27.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.4.0 [August 4, 2008]
|
||||
* Last changed in libpng 1.4.0 [August 5, 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;
|
||||
if (!(white_x || white_y || red_x || red_y || green_x || green_y ||
|
||||
@@ -94,7 +94,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");
|
||||
png_debug1(1, "in %s storage function", "cHRM");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
@@ -156,7 +156,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;
|
||||
|
||||
@@ -183,7 +183,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;
|
||||
|
||||
@@ -220,7 +220,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
|
||||
@@ -263,7 +263,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;
|
||||
|
||||
@@ -370,7 +370,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;
|
||||
|
||||
@@ -390,12 +390,12 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
|
||||
png_size_t 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)
|
||||
@@ -405,14 +405,14 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
|
||||
}
|
||||
png_memcpy(info_ptr->pcal_purpose, purpose, 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)
|
||||
@@ -435,7 +435,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)
|
||||
@@ -459,7 +459,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;
|
||||
|
||||
@@ -477,14 +477,14 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
|
||||
{
|
||||
png_size_t 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)
|
||||
@@ -496,7 +496,7 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
|
||||
png_memcpy(info_ptr->scal_s_width, swidth, 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)
|
||||
@@ -522,7 +522,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;
|
||||
|
||||
@@ -538,7 +538,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;
|
||||
|
||||
@@ -587,7 +587,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;
|
||||
|
||||
@@ -600,7 +600,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;
|
||||
|
||||
@@ -629,7 +629,7 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
|
||||
int_green_y, int_blue_x, int_blue_y;
|
||||
#endif
|
||||
#endif
|
||||
png_debug1(1, "in %s storage function\n", "sRGB_gAMA_and_cHRM");
|
||||
png_debug1(1, "in %s storage function", "sRGB_gAMA_and_cHRM");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
@@ -689,7 +689,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;
|
||||
|
||||
@@ -743,7 +743,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)
|
||||
@@ -785,7 +785,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++)
|
||||
@@ -845,7 +845,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",
|
||||
(unsigned long)(png_uint_32)
|
||||
(key_len + lang_len + lang_key_len + text_length + 4),
|
||||
(int)textp->key);
|
||||
@@ -893,7 +893,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);
|
||||
}
|
||||
@@ -903,7 +903,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;
|
||||
@@ -918,7 +918,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;
|
||||
|
||||
@@ -1119,7 +1119,7 @@ png_set_unknown_chunk_location(png_structp png_ptr, png_infop info_ptr,
|
||||
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 =
|
||||
@@ -1180,7 +1180,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;
|
||||
@@ -1192,7 +1192,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;
|
||||
@@ -1250,7 +1250,7 @@ png_set_user_limits (png_structp png_ptr, png_uint_32 user_width_max,
|
||||
void PNGAPI
|
||||
png_set_benign_errors(png_structp png_ptr, int allowed)
|
||||
{
|
||||
png_debug(1, "in png_set_benign_errors\n");
|
||||
png_debug(1, "in png_set_benign_errors");
|
||||
if (allowed)
|
||||
png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN;
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user