[devel] Adjusted some whitespace in pngset.c
This commit is contained in:
parent
c508081afc
commit
62333ba0cb
26
pngset.c
26
pngset.c
@ -142,11 +142,13 @@ png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_const_uint_16p hist)
|
||||
}
|
||||
|
||||
png_free_data(png_ptr, info_ptr, PNG_FREE_HIST, 0);
|
||||
|
||||
/* Changed from info->num_palette to PNG_MAX_PALETTE_LENGTH in
|
||||
* version 1.2.1
|
||||
*/
|
||||
png_ptr->hist = (png_uint_16p)png_malloc_warn(png_ptr,
|
||||
PNG_MAX_PALETTE_LENGTH * png_sizeof(png_uint_16));
|
||||
|
||||
if (png_ptr->hist == NULL)
|
||||
{
|
||||
png_warning(png_ptr, "Insufficient memory for hIST chunk data");
|
||||
@ -158,7 +160,6 @@ png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_const_uint_16p hist)
|
||||
|
||||
info_ptr->hist = png_ptr->hist;
|
||||
info_ptr->valid |= PNG_INFO_hIST;
|
||||
|
||||
info_ptr->free_me |= PNG_FREE_HIST;
|
||||
}
|
||||
#endif
|
||||
@ -201,8 +202,8 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
|
||||
info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth);
|
||||
|
||||
/* Check for potential overflow */
|
||||
if (width > (PNG_UINT_32_MAX
|
||||
>> 3) /* 8-byte RRGGBBAA pixels */
|
||||
if (width >
|
||||
(PNG_UINT_32_MAX >> 3) /* 8-byte RRGGBBAA pixels */
|
||||
- 48 /* bigrowbuf hack */
|
||||
- 1 /* filter byte */
|
||||
- 7*8 /* rounding of width to multiple of 8 pixels */
|
||||
@ -259,6 +260,7 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
|
||||
png_error(png_ptr, "Invalid format for pCAL parameter");
|
||||
|
||||
info_ptr->pcal_purpose = (png_charp)png_malloc_warn(png_ptr, length);
|
||||
|
||||
if (info_ptr->pcal_purpose == NULL)
|
||||
{
|
||||
png_warning(png_ptr, "Insufficient memory for pCAL purpose");
|
||||
@ -278,11 +280,13 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
|
||||
(unsigned long)length);
|
||||
|
||||
info_ptr->pcal_units = (png_charp)png_malloc_warn(png_ptr, length);
|
||||
|
||||
if (info_ptr->pcal_units == NULL)
|
||||
{
|
||||
png_warning(png_ptr, "Insufficient memory for pCAL units");
|
||||
return;
|
||||
}
|
||||
|
||||
png_memcpy(info_ptr->pcal_units, units, length);
|
||||
|
||||
info_ptr->pcal_params = (png_charpp)png_malloc_warn(png_ptr,
|
||||
@ -391,8 +395,10 @@ png_set_sCAL(png_structp png_ptr, png_infop info_ptr, int unit, double width,
|
||||
/* Check the arguments. */
|
||||
if (width <= 0)
|
||||
png_warning(png_ptr, "Invalid sCAL width ignored");
|
||||
|
||||
else if (height <= 0)
|
||||
png_warning(png_ptr, "Invalid sCAL height ignored");
|
||||
|
||||
else
|
||||
{
|
||||
/* Convert 'width' and 'height' to ASCII. */
|
||||
@ -419,8 +425,10 @@ png_set_sCAL_fixed(png_structp png_ptr, png_infop info_ptr, int unit,
|
||||
/* Check the arguments. */
|
||||
if (width <= 0)
|
||||
png_warning(png_ptr, "Invalid sCAL width ignored");
|
||||
|
||||
else if (height <= 0)
|
||||
png_warning(png_ptr, "Invalid sCAL height ignored");
|
||||
|
||||
else
|
||||
{
|
||||
/* Convert 'width' and 'height' to ASCII. */
|
||||
@ -570,11 +578,13 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
|
||||
|
||||
length = png_strlen(name)+1;
|
||||
new_iccp_name = (png_charp)png_malloc_warn(png_ptr, length);
|
||||
|
||||
if (new_iccp_name == NULL)
|
||||
{
|
||||
png_warning(png_ptr, "Insufficient memory to process iCCP chunk");
|
||||
return;
|
||||
}
|
||||
|
||||
png_memcpy(new_iccp_name, name, length);
|
||||
new_iccp_profile = (png_bytep)png_malloc_warn(png_ptr, proflen);
|
||||
|
||||
@ -874,6 +884,7 @@ png_set_sPLT(png_structp png_ptr,
|
||||
* 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.
|
||||
*/
|
||||
@ -980,6 +991,7 @@ png_set_unknown_chunks(png_structp png_ptr,
|
||||
png_memcpy(to->name, from->name, png_sizeof(from->name));
|
||||
to->name[png_sizeof(to->name)-1] = '\0';
|
||||
to->size = from->size;
|
||||
|
||||
/* Note our location in the read or write sequence */
|
||||
to->location = (png_byte)(png_ptr->mode & 0xff);
|
||||
|
||||
@ -1061,12 +1073,13 @@ png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_const_bytep
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (chunk_list == NULL)
|
||||
return;
|
||||
|
||||
old_num_chunks = png_ptr->num_chunk_list;
|
||||
new_list=(png_bytep)png_malloc(png_ptr,
|
||||
(png_size_t)
|
||||
(5*(num_chunks + old_num_chunks)));
|
||||
(png_size_t)(5*(num_chunks + old_num_chunks)));
|
||||
|
||||
if (png_ptr->chunk_list != NULL)
|
||||
{
|
||||
@ -1129,16 +1142,19 @@ png_set_compression_buffer_size(png_structp png_ptr, png_size_t size)
|
||||
return;
|
||||
|
||||
png_free(png_ptr, png_ptr->zbuf);
|
||||
|
||||
if (size > ZLIB_IO_MAX)
|
||||
{
|
||||
png_warning(png_ptr, "Attempt to set buffer size beyond max ignored");
|
||||
png_ptr->zbuf_size = ZLIB_IO_MAX;
|
||||
size = ZLIB_IO_MAX; /* must fit */
|
||||
}
|
||||
|
||||
else
|
||||
png_ptr->zbuf_size = (uInt)size;
|
||||
|
||||
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, size);
|
||||
|
||||
/* The following ensures a relatively safe failure if this gets called while
|
||||
* the buffer is actually in use.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user