mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[devel] Fix whitespace in pngerror.c and pngset.c
This commit is contained in:
parent
45624d6c2c
commit
da30135c4c
137
pngerror.c
137
pngerror.c
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
static void /* PRIVATE */
|
static void /* PRIVATE */
|
||||||
png_default_error PNGARG((png_structp png_ptr,
|
png_default_error PNGARG((png_structp png_ptr,
|
||||||
png_const_charp error_message)) PNG_NORETURN;
|
png_const_charp error_message)) PNG_NORETURN;
|
||||||
#ifdef PNG_WARNINGS_SUPPORTED
|
#ifdef PNG_WARNINGS_SUPPORTED
|
||||||
static void /* PRIVATE */
|
static void /* PRIVATE */
|
||||||
png_default_warning PNGARG((png_structp png_ptr,
|
png_default_warning PNGARG((png_structp png_ptr,
|
||||||
@ -45,7 +45,7 @@ png_error(png_structp png_ptr, png_const_charp error_message)
|
|||||||
if (png_ptr != NULL)
|
if (png_ptr != NULL)
|
||||||
{
|
{
|
||||||
if (png_ptr->flags&
|
if (png_ptr->flags&
|
||||||
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
|
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
|
||||||
{
|
{
|
||||||
if (*error_message == PNG_LITERAL_SHARP)
|
if (*error_message == PNG_LITERAL_SHARP)
|
||||||
{
|
{
|
||||||
@ -111,16 +111,16 @@ png_warning(png_structp png_ptr, png_const_charp warning_message)
|
|||||||
{
|
{
|
||||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
if (png_ptr->flags&
|
if (png_ptr->flags&
|
||||||
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
|
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (*warning_message == PNG_LITERAL_SHARP)
|
if (*warning_message == PNG_LITERAL_SHARP)
|
||||||
{
|
{
|
||||||
for (offset = 1; offset < 15; offset++)
|
for (offset = 1; offset < 15; offset++)
|
||||||
if (warning_message[offset] == ' ')
|
if (warning_message[offset] == ' ')
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (png_ptr != NULL && png_ptr->warning_fn != NULL)
|
if (png_ptr != NULL && png_ptr->warning_fn != NULL)
|
||||||
(*(png_ptr->warning_fn))(png_ptr, warning_message + offset);
|
(*(png_ptr->warning_fn))(png_ptr, warning_message + offset);
|
||||||
@ -134,9 +134,9 @@ void PNGAPI
|
|||||||
png_benign_error(png_structp png_ptr, png_const_charp error_message)
|
png_benign_error(png_structp png_ptr, png_const_charp error_message)
|
||||||
{
|
{
|
||||||
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
|
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
|
||||||
png_warning(png_ptr, error_message);
|
png_warning(png_ptr, error_message);
|
||||||
else
|
else
|
||||||
png_error(png_ptr, error_message);
|
png_error(png_ptr, error_message);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ static PNG_CONST char png_digit[16] = {
|
|||||||
#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED)
|
#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED)
|
||||||
static void /* PRIVATE */
|
static void /* PRIVATE */
|
||||||
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
||||||
error_message)
|
error_message)
|
||||||
{
|
{
|
||||||
int iout = 0, iin = 0;
|
int iout = 0, iin = 0;
|
||||||
|
|
||||||
@ -193,11 +193,11 @@ png_chunk_error(png_structp png_ptr, png_const_charp error_message)
|
|||||||
{
|
{
|
||||||
char msg[18+PNG_MAX_ERROR_TEXT];
|
char msg[18+PNG_MAX_ERROR_TEXT];
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
png_error(png_ptr, error_message);
|
png_error(png_ptr, error_message);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_format_buffer(png_ptr, msg, error_message);
|
png_format_buffer(png_ptr, msg, error_message);
|
||||||
png_error(png_ptr, msg);
|
png_error(png_ptr, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_READ_SUPPORTED */
|
#endif /* PNG_READ_SUPPORTED */
|
||||||
@ -209,11 +209,11 @@ png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
|
|||||||
{
|
{
|
||||||
char msg[18+PNG_MAX_ERROR_TEXT];
|
char msg[18+PNG_MAX_ERROR_TEXT];
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
png_warning(png_ptr, warning_message);
|
png_warning(png_ptr, warning_message);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_format_buffer(png_ptr, msg, warning_message);
|
png_format_buffer(png_ptr, msg, warning_message);
|
||||||
png_warning(png_ptr, msg);
|
png_warning(png_ptr, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_WARNINGS_SUPPORTED */
|
#endif /* PNG_WARNINGS_SUPPORTED */
|
||||||
@ -223,10 +223,10 @@ png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_chunk_benign_error(png_structp png_ptr, png_const_charp error_message)
|
png_chunk_benign_error(png_structp png_ptr, png_const_charp error_message)
|
||||||
{
|
{
|
||||||
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
|
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
|
||||||
png_chunk_warning(png_ptr, error_message);
|
png_chunk_warning(png_ptr, error_message);
|
||||||
else
|
else
|
||||||
png_chunk_error(png_ptr, error_message);
|
png_chunk_error(png_ptr, error_message);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* PNG_READ_SUPPORTED */
|
#endif /* PNG_READ_SUPPORTED */
|
||||||
@ -259,28 +259,28 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
|
|||||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
if (*error_message == PNG_LITERAL_SHARP)
|
if (*error_message == PNG_LITERAL_SHARP)
|
||||||
{
|
{
|
||||||
/* Strip "#nnnn " from beginning of error message. */
|
/* Strip "#nnnn " from beginning of error message. */
|
||||||
int offset;
|
int offset;
|
||||||
char error_number[16];
|
char error_number[16];
|
||||||
for (offset = 0; offset<15; offset++)
|
for (offset = 0; offset<15; offset++)
|
||||||
{
|
{
|
||||||
error_number[offset] = error_message[offset + 1];
|
error_number[offset] = error_message[offset + 1];
|
||||||
if (error_message[offset] == ' ')
|
if (error_message[offset] == ' ')
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((offset > 1) && (offset < 15))
|
if ((offset > 1) && (offset < 15))
|
||||||
{
|
{
|
||||||
error_number[offset - 1] = '\0';
|
error_number[offset - 1] = '\0';
|
||||||
fprintf(stderr, "libpng error no. %s: %s",
|
fprintf(stderr, "libpng error no. %s: %s",
|
||||||
error_number, error_message + offset + 1);
|
error_number, error_message + offset + 1);
|
||||||
fprintf(stderr, PNG_STRING_NEWLINE);
|
fprintf(stderr, PNG_STRING_NEWLINE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "libpng error: %s, offset=%d",
|
fprintf(stderr, "libpng error: %s, offset=%d",
|
||||||
error_message, offset);
|
error_message, offset);
|
||||||
fprintf(stderr, PNG_STRING_NEWLINE);
|
fprintf(stderr, PNG_STRING_NEWLINE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@ -329,33 +329,33 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message)
|
|||||||
# ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
# ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
if (*warning_message == PNG_LITERAL_SHARP)
|
if (*warning_message == PNG_LITERAL_SHARP)
|
||||||
{
|
{
|
||||||
int offset;
|
int offset;
|
||||||
char warning_number[16];
|
char warning_number[16];
|
||||||
for (offset = 0; offset < 15; offset++)
|
for (offset = 0; offset < 15; offset++)
|
||||||
{
|
{
|
||||||
warning_number[offset] = warning_message[offset + 1];
|
warning_number[offset] = warning_message[offset + 1];
|
||||||
if (warning_message[offset] == ' ')
|
if (warning_message[offset] == ' ')
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((offset > 1) && (offset < 15))
|
if ((offset > 1) && (offset < 15))
|
||||||
{
|
{
|
||||||
warning_number[offset + 1] = '\0';
|
warning_number[offset + 1] = '\0';
|
||||||
fprintf(stderr, "libpng warning no. %s: %s",
|
fprintf(stderr, "libpng warning no. %s: %s",
|
||||||
warning_number, warning_message + offset);
|
warning_number, warning_message + offset);
|
||||||
fprintf(stderr, PNG_STRING_NEWLINE);
|
fprintf(stderr, PNG_STRING_NEWLINE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "libpng warning: %s",
|
fprintf(stderr, "libpng warning: %s",
|
||||||
warning_message);
|
warning_message);
|
||||||
fprintf(stderr, PNG_STRING_NEWLINE);
|
fprintf(stderr, PNG_STRING_NEWLINE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
# endif
|
# endif
|
||||||
{
|
{
|
||||||
fprintf(stderr, "libpng warning: %s", warning_message);
|
fprintf(stderr, "libpng warning: %s", warning_message);
|
||||||
fprintf(stderr, PNG_STRING_NEWLINE);
|
fprintf(stderr, PNG_STRING_NEWLINE);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
warning_message = warning_message; /* Make compiler happy */
|
warning_message = warning_message; /* Make compiler happy */
|
||||||
@ -371,7 +371,7 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message)
|
|||||||
*/
|
*/
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
|
png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
|
||||||
png_error_ptr error_fn, png_error_ptr warning_fn)
|
png_error_ptr error_fn, png_error_ptr warning_fn)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
@ -400,8 +400,9 @@ png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode)
|
|||||||
{
|
{
|
||||||
if (png_ptr != NULL)
|
if (png_ptr != NULL)
|
||||||
{
|
{
|
||||||
png_ptr->flags &=
|
png_ptr->flags &=
|
||||||
((~(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))&strip_mode);
|
((~(PNG_FLAG_STRIP_ERROR_NUMBERS |
|
||||||
|
PNG_FLAG_STRIP_ERROR_TEXT))&strip_mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
118
pngset.c
118
pngset.c
@ -40,8 +40,8 @@ png_set_bKGD(png_structp png_ptr, png_infop info_ptr, png_color_16p background)
|
|||||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_cHRM(png_structp png_ptr, png_infop info_ptr,
|
png_set_cHRM(png_structp png_ptr, png_infop info_ptr,
|
||||||
double white_x, double white_y, double red_x, double red_y,
|
double white_x, double white_y, double red_x, double red_y,
|
||||||
double green_x, double green_y, double blue_x, double blue_y)
|
double green_x, double green_y, double blue_x, double blue_y)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s storage function", "cHRM");
|
png_debug1(1, "in %s storage function", "cHRM");
|
||||||
|
|
||||||
@ -57,14 +57,14 @@ png_set_cHRM(png_structp png_ptr, png_infop info_ptr,
|
|||||||
info_ptr->x_blue = (float)blue_x;
|
info_ptr->x_blue = (float)blue_x;
|
||||||
info_ptr->y_blue = (float)blue_y;
|
info_ptr->y_blue = (float)blue_y;
|
||||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||||
info_ptr->int_x_white = (png_fixed_point)(white_x*100000.+0.5);
|
info_ptr->int_x_white = (png_fixed_point)(white_x*100000. + 0.5);
|
||||||
info_ptr->int_y_white = (png_fixed_point)(white_y*100000.+0.5);
|
info_ptr->int_y_white = (png_fixed_point)(white_y*100000. + 0.5);
|
||||||
info_ptr->int_x_red = (png_fixed_point)( red_x*100000.+0.5);
|
info_ptr->int_x_red = (png_fixed_point)( red_x*100000. + 0.5);
|
||||||
info_ptr->int_y_red = (png_fixed_point)( red_y*100000.+0.5);
|
info_ptr->int_y_red = (png_fixed_point)( red_y*100000. + 0.5);
|
||||||
info_ptr->int_x_green = (png_fixed_point)(green_x*100000.+0.5);
|
info_ptr->int_x_green = (png_fixed_point)(green_x*100000. + 0.5);
|
||||||
info_ptr->int_y_green = (png_fixed_point)(green_y*100000.+0.5);
|
info_ptr->int_y_green = (png_fixed_point)(green_y*100000. + 0.5);
|
||||||
info_ptr->int_x_blue = (png_fixed_point)( blue_x*100000.+0.5);
|
info_ptr->int_x_blue = (png_fixed_point)( blue_x*100000. + 0.5);
|
||||||
info_ptr->int_y_blue = (png_fixed_point)( blue_y*100000.+0.5);
|
info_ptr->int_y_blue = (png_fixed_point)( blue_y*100000. + 0.5);
|
||||||
#endif
|
#endif
|
||||||
info_ptr->valid |= PNG_INFO_cHRM;
|
info_ptr->valid |= PNG_INFO_cHRM;
|
||||||
}
|
}
|
||||||
@ -73,9 +73,9 @@ png_set_cHRM(png_structp png_ptr, png_infop info_ptr,
|
|||||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
|
png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
|
||||||
png_fixed_point white_x, png_fixed_point white_y, png_fixed_point red_x,
|
png_fixed_point white_x, png_fixed_point white_y, png_fixed_point red_x,
|
||||||
png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y,
|
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_fixed_point blue_x, png_fixed_point blue_y)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s storage function", "cHRM fixed");
|
png_debug1(1, "in %s storage function", "cHRM fixed");
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
|
|||||||
|
|
||||||
#ifdef PNG_CHECK_cHRM_SUPPORTED
|
#ifdef PNG_CHECK_cHRM_SUPPORTED
|
||||||
if (png_check_cHRM_fixed(png_ptr,
|
if (png_check_cHRM_fixed(png_ptr,
|
||||||
white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y))
|
white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
info_ptr->int_x_white = white_x;
|
info_ptr->int_x_white = white_x;
|
||||||
@ -127,7 +127,7 @@ png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma)
|
|||||||
if (file_gamma > 21474.83)
|
if (file_gamma > 21474.83)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Limiting gamma to 21474.83");
|
png_warning(png_ptr, "Limiting gamma to 21474.83");
|
||||||
png_gamma=21474.83;
|
png_gamma = 21474.83;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
png_gamma = file_gamma;
|
png_gamma = file_gamma;
|
||||||
@ -137,12 +137,12 @@ png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma)
|
|||||||
#endif
|
#endif
|
||||||
info_ptr->valid |= PNG_INFO_gAMA;
|
info_ptr->valid |= PNG_INFO_gAMA;
|
||||||
if (png_gamma == 0.0)
|
if (png_gamma == 0.0)
|
||||||
png_warning(png_ptr, "Setting gamma=0");
|
png_warning(png_ptr, "Setting gamma = 0");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
|
png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
|
||||||
int_gamma)
|
int_gamma)
|
||||||
{
|
{
|
||||||
png_fixed_point png_gamma;
|
png_fixed_point png_gamma;
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
|
|||||||
if (int_gamma > (png_fixed_point)PNG_UINT_31_MAX)
|
if (int_gamma > (png_fixed_point)PNG_UINT_31_MAX)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Limiting gamma to 21474.83");
|
png_warning(png_ptr, "Limiting gamma to 21474.83");
|
||||||
png_gamma=PNG_UINT_31_MAX;
|
png_gamma = PNG_UINT_31_MAX;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -174,7 +174,7 @@ png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
|
|||||||
#endif
|
#endif
|
||||||
info_ptr->valid |= PNG_INFO_gAMA;
|
info_ptr->valid |= PNG_INFO_gAMA;
|
||||||
if (png_gamma == 0)
|
if (png_gamma == 0)
|
||||||
png_warning(png_ptr, "Setting gamma=0");
|
png_warning(png_ptr, "Setting gamma = 0");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist)
|
|||||||
> PNG_MAX_PALETTE_LENGTH)
|
> PNG_MAX_PALETTE_LENGTH)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"Invalid palette size, hIST allocation skipped");
|
"Invalid palette size, hIST allocation skipped");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,7 +202,7 @@ png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist)
|
|||||||
* version 1.2.1
|
* version 1.2.1
|
||||||
*/
|
*/
|
||||||
png_ptr->hist = (png_uint_16p)png_malloc_warn(png_ptr,
|
png_ptr->hist = (png_uint_16p)png_malloc_warn(png_ptr,
|
||||||
PNG_MAX_PALETTE_LENGTH * png_sizeof(png_uint_16));
|
PNG_MAX_PALETTE_LENGTH * png_sizeof(png_uint_16));
|
||||||
if (png_ptr->hist == NULL)
|
if (png_ptr->hist == NULL)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Insufficient memory for hIST chunk data");
|
png_warning(png_ptr, "Insufficient memory for hIST chunk data");
|
||||||
@ -253,7 +253,7 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
|
|||||||
|
|
||||||
/* Check for potential overflow */
|
/* Check for potential overflow */
|
||||||
if (width > (PNG_UINT_32_MAX
|
if (width > (PNG_UINT_32_MAX
|
||||||
>> 3) /* 8-byte RGBA pixels */
|
>> 3) /* 8-byte RRGGBBAA pixels */
|
||||||
- 64 /* bigrowbuf hack */
|
- 64 /* bigrowbuf hack */
|
||||||
- 1 /* filter byte */
|
- 1 /* filter byte */
|
||||||
- 7*8 /* rounding of width to multiple of 8 pixels */
|
- 7*8 /* rounding of width to multiple of 8 pixels */
|
||||||
@ -266,7 +266,7 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
|
|||||||
#ifdef PNG_oFFs_SUPPORTED
|
#ifdef PNG_oFFs_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_oFFs(png_structp png_ptr, png_infop info_ptr,
|
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_int_32 offset_x, png_int_32 offset_y, int unit_type)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s storage function", "oFFs");
|
png_debug1(1, "in %s storage function", "oFFs");
|
||||||
|
|
||||||
@ -283,8 +283,8 @@ png_set_oFFs(png_structp png_ptr, png_infop info_ptr,
|
|||||||
#ifdef PNG_pCAL_SUPPORTED
|
#ifdef PNG_pCAL_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
|
png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
|
||||||
png_charp purpose, png_int_32 X0, png_int_32 X1, int type, int nparams,
|
png_charp purpose, png_int_32 X0, png_int_32 X1, int type, int nparams,
|
||||||
png_charp units, png_charpp params)
|
png_charp units, png_charpp params)
|
||||||
{
|
{
|
||||||
png_size_t length;
|
png_size_t length;
|
||||||
int i;
|
int i;
|
||||||
@ -296,7 +296,7 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
|
|||||||
|
|
||||||
length = png_strlen(purpose) + 1;
|
length = png_strlen(purpose) + 1;
|
||||||
png_debug1(3, "allocating purpose for info (%lu bytes)",
|
png_debug1(3, "allocating purpose for info (%lu bytes)",
|
||||||
(unsigned long)length);
|
(unsigned long)length);
|
||||||
info_ptr->pcal_purpose = (png_charp)png_malloc_warn(png_ptr, length);
|
info_ptr->pcal_purpose = (png_charp)png_malloc_warn(png_ptr, length);
|
||||||
if (info_ptr->pcal_purpose == NULL)
|
if (info_ptr->pcal_purpose == NULL)
|
||||||
{
|
{
|
||||||
@ -355,7 +355,7 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
|
|||||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_sCAL(png_structp png_ptr, png_infop info_ptr,
|
png_set_sCAL(png_structp png_ptr, png_infop info_ptr,
|
||||||
int unit, double width, double height)
|
int unit, double width, double height)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s storage function", "sCAL");
|
png_debug1(1, "in %s storage function", "sCAL");
|
||||||
|
|
||||||
@ -372,7 +372,7 @@ png_set_sCAL(png_structp png_ptr, png_infop info_ptr,
|
|||||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
|
png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
|
||||||
int unit, png_charp swidth, png_charp sheight)
|
int unit, png_charp swidth, png_charp sheight)
|
||||||
{
|
{
|
||||||
png_size_t length;
|
png_size_t length;
|
||||||
|
|
||||||
@ -385,7 +385,7 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
|
|||||||
|
|
||||||
length = png_strlen(swidth) + 1;
|
length = png_strlen(swidth) + 1;
|
||||||
png_debug1(3, "allocating unit for info (%u bytes)",
|
png_debug1(3, "allocating unit for info (%u bytes)",
|
||||||
(unsigned int)length);
|
(unsigned int)length);
|
||||||
info_ptr->scal_s_width = (png_charp)png_malloc_warn(png_ptr, length);
|
info_ptr->scal_s_width = (png_charp)png_malloc_warn(png_ptr, length);
|
||||||
if (info_ptr->scal_s_width == NULL)
|
if (info_ptr->scal_s_width == NULL)
|
||||||
{
|
{
|
||||||
@ -418,7 +418,7 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
|
|||||||
#ifdef PNG_pHYs_SUPPORTED
|
#ifdef PNG_pHYs_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_pHYs(png_structp png_ptr, png_infop info_ptr,
|
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_uint_32 res_x, png_uint_32 res_y, int unit_type)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s storage function", "pHYs");
|
png_debug1(1, "in %s storage function", "pHYs");
|
||||||
|
|
||||||
@ -434,7 +434,7 @@ png_set_pHYs(png_structp png_ptr, png_infop info_ptr,
|
|||||||
|
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
|
png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
|
||||||
png_colorp palette, int num_palette)
|
png_colorp palette, int num_palette)
|
||||||
{
|
{
|
||||||
|
|
||||||
png_debug1(1, "in %s storage function", "PLTE");
|
png_debug1(1, "in %s storage function", "PLTE");
|
||||||
@ -464,7 +464,7 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
|
|||||||
* too-large sample values.
|
* too-large sample values.
|
||||||
*/
|
*/
|
||||||
png_ptr->palette = (png_colorp)png_calloc(png_ptr,
|
png_ptr->palette = (png_colorp)png_calloc(png_ptr,
|
||||||
PNG_MAX_PALETTE_LENGTH * png_sizeof(png_color));
|
PNG_MAX_PALETTE_LENGTH * png_sizeof(png_color));
|
||||||
png_memcpy(png_ptr->palette, palette, num_palette * png_sizeof(png_color));
|
png_memcpy(png_ptr->palette, palette, num_palette * png_sizeof(png_color));
|
||||||
info_ptr->palette = png_ptr->palette;
|
info_ptr->palette = png_ptr->palette;
|
||||||
info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette;
|
info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette;
|
||||||
@ -477,7 +477,7 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
|
|||||||
#ifdef PNG_sBIT_SUPPORTED
|
#ifdef PNG_sBIT_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_sBIT(png_structp png_ptr, png_infop info_ptr,
|
png_set_sBIT(png_structp png_ptr, png_infop info_ptr,
|
||||||
png_color_8p sig_bit)
|
png_color_8p sig_bit)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s storage function", "sBIT");
|
png_debug1(1, "in %s storage function", "sBIT");
|
||||||
|
|
||||||
@ -504,7 +504,7 @@ png_set_sRGB(png_structp png_ptr, png_infop info_ptr, int intent)
|
|||||||
|
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
|
png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
|
||||||
int intent)
|
int intent)
|
||||||
{
|
{
|
||||||
#ifdef PNG_gAMA_SUPPORTED
|
#ifdef PNG_gAMA_SUPPORTED
|
||||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
@ -519,7 +519,7 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
|
|||||||
float white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y;
|
float white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y;
|
||||||
#endif
|
#endif
|
||||||
png_fixed_point int_white_x, int_white_y, int_red_x, int_red_y, int_green_x,
|
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;
|
int_green_y, int_blue_x, int_blue_y;
|
||||||
#endif
|
#endif
|
||||||
png_debug1(1, "in %s storage function", "sRGB_gAMA_and_cHRM");
|
png_debug1(1, "in %s storage function", "sRGB_gAMA_and_cHRM");
|
||||||
|
|
||||||
@ -577,8 +577,8 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
|
|||||||
#ifdef PNG_iCCP_SUPPORTED
|
#ifdef PNG_iCCP_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
|
png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
|
||||||
png_charp name, int compression_type,
|
png_charp name, int compression_type,
|
||||||
png_charp profile, png_uint_32 proflen)
|
png_charp profile, png_uint_32 proflen)
|
||||||
{
|
{
|
||||||
png_charp new_iccp_name;
|
png_charp new_iccp_name;
|
||||||
png_charp new_iccp_profile;
|
png_charp new_iccp_profile;
|
||||||
@ -624,7 +624,7 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
|
|||||||
#ifdef PNG_TEXT_SUPPORTED
|
#ifdef PNG_TEXT_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
||||||
int num_text)
|
int num_text)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
ret = png_set_text_2(png_ptr, info_ptr, text_ptr, num_text);
|
ret = png_set_text_2(png_ptr, info_ptr, text_ptr, num_text);
|
||||||
@ -634,7 +634,7 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
|||||||
|
|
||||||
int /* PRIVATE */
|
int /* PRIVATE */
|
||||||
png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
||||||
int num_text)
|
int num_text)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -666,7 +666,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
|||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
png_memcpy(info_ptr->text, old_text, (png_size_t)(old_max *
|
png_memcpy(info_ptr->text, old_text, (png_size_t)(old_max *
|
||||||
png_sizeof(png_text)));
|
png_sizeof(png_text)));
|
||||||
png_free(png_ptr, old_text);
|
png_free(png_ptr, old_text);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -674,13 +674,13 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
|||||||
info_ptr->max_text = num_text + 8;
|
info_ptr->max_text = num_text + 8;
|
||||||
info_ptr->num_text = 0;
|
info_ptr->num_text = 0;
|
||||||
info_ptr->text = (png_textp)png_malloc_warn(png_ptr,
|
info_ptr->text = (png_textp)png_malloc_warn(png_ptr,
|
||||||
(png_size_t)(info_ptr->max_text * png_sizeof(png_text)));
|
(png_size_t)(info_ptr->max_text * png_sizeof(png_text)));
|
||||||
if (info_ptr->text == NULL)
|
if (info_ptr->text == NULL)
|
||||||
return(1);
|
return(1);
|
||||||
info_ptr->free_me |= PNG_FREE_TEXT;
|
info_ptr->free_me |= PNG_FREE_TEXT;
|
||||||
}
|
}
|
||||||
png_debug1(3, "allocated %d entries for info_ptr->text",
|
png_debug1(3, "allocated %d entries for info_ptr->text",
|
||||||
info_ptr->max_text);
|
info_ptr->max_text);
|
||||||
}
|
}
|
||||||
for (i = 0; i < num_text; i++)
|
for (i = 0; i < num_text; i++)
|
||||||
{
|
{
|
||||||
@ -738,14 +738,14 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
textp->key = (png_charp)png_malloc_warn(png_ptr,
|
textp->key = (png_charp)png_malloc_warn(png_ptr,
|
||||||
(png_size_t)
|
(png_size_t)
|
||||||
(key_len + text_length + lang_len + lang_key_len + 4));
|
(key_len + text_length + lang_len + lang_key_len + 4));
|
||||||
if (textp->key == NULL)
|
if (textp->key == NULL)
|
||||||
return(1);
|
return(1);
|
||||||
png_debug2(2, "Allocated %lu bytes at %x in png_set_text",
|
png_debug2(2, "Allocated %lu bytes at %x in png_set_text",
|
||||||
(unsigned long)(png_uint_32)
|
(unsigned long)(png_uint_32)
|
||||||
(key_len + lang_len + lang_key_len + text_length + 4),
|
(key_len + lang_len + lang_key_len + text_length + 4),
|
||||||
(int)textp->key);
|
(int)textp->key);
|
||||||
|
|
||||||
png_memcpy(textp->key, text_ptr[i].key,(png_size_t)(key_len));
|
png_memcpy(textp->key, text_ptr[i].key,(png_size_t)(key_len));
|
||||||
*(textp->key + key_len) = '\0';
|
*(textp->key + key_len) = '\0';
|
||||||
@ -771,7 +771,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
|||||||
}
|
}
|
||||||
if (text_length)
|
if (text_length)
|
||||||
png_memcpy(textp->text, text_ptr[i].text,
|
png_memcpy(textp->text, text_ptr[i].text,
|
||||||
(png_size_t)(text_length));
|
(png_size_t)(text_length));
|
||||||
*(textp->text + text_length) = '\0';
|
*(textp->text + text_length) = '\0';
|
||||||
|
|
||||||
#ifdef PNG_iTXt_SUPPORTED
|
#ifdef PNG_iTXt_SUPPORTED
|
||||||
@ -814,7 +814,7 @@ png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time)
|
|||||||
#ifdef PNG_tRNS_SUPPORTED
|
#ifdef PNG_tRNS_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
|
png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
|
||||||
png_bytep trans_alpha, int num_trans, png_color_16p trans_color)
|
png_bytep trans_alpha, int num_trans, png_color_16p trans_color)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s storage function", "tRNS");
|
png_debug1(1, "in %s storage function", "tRNS");
|
||||||
|
|
||||||
@ -866,7 +866,7 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
|
|||||||
#ifdef PNG_sPLT_SUPPORTED
|
#ifdef PNG_sPLT_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_sPLT(png_structp png_ptr,
|
png_set_sPLT(png_structp png_ptr,
|
||||||
png_infop info_ptr, png_sPLT_tp entries, int nentries)
|
png_infop info_ptr, png_sPLT_tp entries, int nentries)
|
||||||
/*
|
/*
|
||||||
* entries - array of png_sPLT_t structures
|
* entries - array of png_sPLT_t structures
|
||||||
* to be added to the list of palettes
|
* to be added to the list of palettes
|
||||||
@ -906,7 +906,7 @@ png_set_sPLT(png_structp png_ptr,
|
|||||||
if (to->name == NULL)
|
if (to->name == NULL)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"Out of memory while processing sPLT chunk");
|
"Out of memory while processing sPLT chunk");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
png_memcpy(to->name, from->name, length);
|
png_memcpy(to->name, from->name, length);
|
||||||
@ -915,7 +915,7 @@ png_set_sPLT(png_structp png_ptr,
|
|||||||
if (to->entries == NULL)
|
if (to->entries == NULL)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"Out of memory while processing sPLT chunk");
|
"Out of memory while processing sPLT chunk");
|
||||||
png_free(png_ptr, to->name);
|
png_free(png_ptr, to->name);
|
||||||
to->name = NULL;
|
to->name = NULL;
|
||||||
continue;
|
continue;
|
||||||
@ -976,11 +976,11 @@ png_set_unknown_chunks(png_structp png_ptr,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
to->data = (png_bytep)png_malloc_warn(png_ptr,
|
to->data = (png_bytep)png_malloc_warn(png_ptr,
|
||||||
(png_size_t)from->size);
|
(png_size_t)from->size);
|
||||||
if (to->data == NULL)
|
if (to->data == NULL)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"Out of memory while processing unknown chunk");
|
"Out of memory while processing unknown chunk");
|
||||||
to->size = 0;
|
to->size = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -994,7 +994,7 @@ png_set_unknown_chunks(png_structp png_ptr,
|
|||||||
}
|
}
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_unknown_chunk_location(png_structp png_ptr, png_infop info_ptr,
|
png_set_unknown_chunk_location(png_structp png_ptr, png_infop info_ptr,
|
||||||
int chunk, int location)
|
int chunk, int location)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL && chunk >= 0 && chunk <
|
if (png_ptr != NULL && info_ptr != NULL && chunk >= 0 && chunk <
|
||||||
(int)info_ptr->unknown_chunks_num)
|
(int)info_ptr->unknown_chunks_num)
|
||||||
@ -1012,7 +1012,7 @@ png_permit_mng_features (png_structp png_ptr, png_uint_32 mng_features)
|
|||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return (png_uint_32)0;
|
return (png_uint_32)0;
|
||||||
png_ptr->mng_features_permitted =
|
png_ptr->mng_features_permitted =
|
||||||
(png_byte)(mng_features & PNG_ALL_MNG_FEATURES);
|
(png_byte)(mng_features & PNG_ALL_MNG_FEATURES);
|
||||||
return (png_uint_32)png_ptr->mng_features_permitted;
|
return (png_uint_32)png_ptr->mng_features_permitted;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1020,7 +1020,7 @@ png_permit_mng_features (png_structp png_ptr, png_uint_32 mng_features)
|
|||||||
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep
|
png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep
|
||||||
chunk_list, int num_chunks)
|
chunk_list, int num_chunks)
|
||||||
{
|
{
|
||||||
png_bytep new_list, p;
|
png_bytep new_list, p;
|
||||||
int i, old_num_chunks;
|
int i, old_num_chunks;
|
||||||
@ -1043,7 +1043,7 @@ png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep
|
|||||||
return;
|
return;
|
||||||
old_num_chunks = png_ptr->num_chunk_list;
|
old_num_chunks = png_ptr->num_chunk_list;
|
||||||
new_list=(png_bytep)png_malloc(png_ptr,
|
new_list=(png_bytep)png_malloc(png_ptr,
|
||||||
(png_size_t)
|
(png_size_t)
|
||||||
(5*(num_chunks + old_num_chunks)));
|
(5*(num_chunks + old_num_chunks)));
|
||||||
if (png_ptr->chunk_list != NULL)
|
if (png_ptr->chunk_list != NULL)
|
||||||
{
|
{
|
||||||
@ -1065,7 +1065,7 @@ png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep
|
|||||||
#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
|
#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr,
|
png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr,
|
||||||
png_user_chunk_ptr read_user_chunk_fn)
|
png_user_chunk_ptr read_user_chunk_fn)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_read_user_chunk_fn");
|
png_debug(1, "in png_set_read_user_chunk_fn");
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user