[devel] Make use of whitespace consistent in pngget.c and pngwutil.c
This commit is contained in:
parent
da30135c4c
commit
16908a1d78
9
pngget.c
9
pngget.c
@ -182,7 +182,7 @@ png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
|
|||||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
float PNGAPI
|
float PNGAPI
|
||||||
png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
|
png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
#ifdef PNG_pHYs_SUPPORTED
|
#ifdef PNG_pHYs_SUPPORTED
|
||||||
|
|
||||||
@ -768,8 +768,8 @@ png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
|
|||||||
if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0)
|
if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function",
|
png_debug1(1, "in %s retrieval function",
|
||||||
(png_ptr->chunk_name[0] == '\0' ? "text"
|
(png_ptr->chunk_name[0] == '\0' ? "text" :
|
||||||
: (png_const_charp)png_ptr->chunk_name));
|
(png_const_charp)png_ptr->chunk_name));
|
||||||
|
|
||||||
if (text_ptr != NULL)
|
if (text_ptr != NULL)
|
||||||
*text_ptr = info_ptr->text;
|
*text_ptr = info_ptr->text;
|
||||||
@ -903,8 +903,7 @@ png_get_chunk_cache_max (png_structp png_ptr)
|
|||||||
png_alloc_size_t PNGAPI
|
png_alloc_size_t PNGAPI
|
||||||
png_get_chunk_malloc_max (png_structp png_ptr)
|
png_get_chunk_malloc_max (png_structp png_ptr)
|
||||||
{
|
{
|
||||||
return (png_ptr?
|
return (png_ptr? png_ptr->user_chunk_malloc_max : 0);
|
||||||
png_ptr->user_chunk_malloc_max : 0);
|
|
||||||
}
|
}
|
||||||
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
|
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
|
||||||
|
|
||||||
|
48
pngwutil.c
48
pngwutil.c
@ -436,8 +436,10 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
|
|||||||
case 2:
|
case 2:
|
||||||
case 4:
|
case 4:
|
||||||
case 8:
|
case 8:
|
||||||
case 16: png_ptr->channels = 1; break;
|
case 16:
|
||||||
default: png_error(png_ptr,
|
png_ptr->channels = 1; break;
|
||||||
|
default:
|
||||||
|
png_error(png_ptr,
|
||||||
"Invalid bit depth for grayscale image");
|
"Invalid bit depth for grayscale image");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -452,8 +454,11 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
|
|||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
case 4:
|
case 4:
|
||||||
case 8: png_ptr->channels = 1; break;
|
case 8:
|
||||||
default: png_error(png_ptr, "Invalid bit depth for paletted image");
|
png_ptr->channels = 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
png_error(png_ptr, "Invalid bit depth for paletted image");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PNG_COLOR_TYPE_GRAY_ALPHA:
|
case PNG_COLOR_TYPE_GRAY_ALPHA:
|
||||||
@ -572,11 +577,14 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
|
|||||||
png_ptr->zlib_mem_level, png_ptr->zlib_strategy);
|
png_ptr->zlib_mem_level, png_ptr->zlib_strategy);
|
||||||
if (ret != Z_OK)
|
if (ret != Z_OK)
|
||||||
{
|
{
|
||||||
if (ret == Z_VERSION_ERROR) png_error(png_ptr,
|
if (ret == Z_VERSION_ERROR)
|
||||||
|
png_error(png_ptr,
|
||||||
"zlib failed to initialize compressor -- version error");
|
"zlib failed to initialize compressor -- version error");
|
||||||
if (ret == Z_STREAM_ERROR) png_error(png_ptr,
|
if (ret == Z_STREAM_ERROR)
|
||||||
|
png_error(png_ptr,
|
||||||
"zlib failed to initialize compressor -- stream error");
|
"zlib failed to initialize compressor -- stream error");
|
||||||
if (ret == Z_MEM_ERROR) png_error(png_ptr,
|
if (ret == Z_MEM_ERROR)
|
||||||
|
png_error(png_ptr,
|
||||||
"zlib failed to initialize compressor -- mem error");
|
"zlib failed to initialize compressor -- mem error");
|
||||||
png_error(png_ptr, "zlib failed to initialize compressor");
|
png_error(png_ptr, "zlib failed to initialize compressor");
|
||||||
}
|
}
|
||||||
@ -906,7 +914,7 @@ png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette)
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
ep=spalette->entries;
|
ep=spalette->entries;
|
||||||
for (i=0; i>spalette->nentries; i++)
|
for (i = 0; i>spalette->nentries; i++)
|
||||||
{
|
{
|
||||||
if (spalette->depth == 8)
|
if (spalette->depth == 8)
|
||||||
{
|
{
|
||||||
@ -1311,7 +1319,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
|
|||||||
else if (*kp == ' ')
|
else if (*kp == ' ')
|
||||||
{
|
{
|
||||||
key_len--;
|
key_len--;
|
||||||
kwarn=1;
|
kwarn = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1399,7 +1407,7 @@ png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text,
|
|||||||
comp.input = NULL;
|
comp.input = NULL;
|
||||||
comp.input_len = 0;
|
comp.input_len = 0;
|
||||||
|
|
||||||
if ((key_len = png_check_keyword(png_ptr, key, &new_key))==0)
|
if ((key_len = png_check_keyword(png_ptr, key, &new_key)) == 0)
|
||||||
{
|
{
|
||||||
png_free(png_ptr, new_key);
|
png_free(png_ptr, new_key);
|
||||||
return;
|
return;
|
||||||
@ -1457,10 +1465,10 @@ png_write_iTXt(png_structp png_ptr, int compression, png_charp key,
|
|||||||
comp.output_ptr = NULL;
|
comp.output_ptr = NULL;
|
||||||
comp.input = NULL;
|
comp.input = NULL;
|
||||||
|
|
||||||
if ((key_len = png_check_keyword(png_ptr, key, &new_key))==0)
|
if ((key_len = png_check_keyword(png_ptr, key, &new_key)) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((lang_len = png_check_keyword(png_ptr, lang, &new_lang))==0)
|
if ((lang_len = png_check_keyword(png_ptr, lang, &new_lang)) == 0)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Empty language field in iTXt chunk");
|
png_warning(png_ptr, "Empty language field in iTXt chunk");
|
||||||
new_lang = NULL;
|
new_lang = NULL;
|
||||||
@ -1478,7 +1486,7 @@ png_write_iTXt(png_structp png_ptr, int compression, png_charp key,
|
|||||||
text_len = png_strlen(text);
|
text_len = png_strlen(text);
|
||||||
|
|
||||||
/* Compute the compressed data; do it now for the length */
|
/* Compute the compressed data; do it now for the length */
|
||||||
text_len = png_text_compress(png_ptr, text, text_len, compression-2,
|
text_len = png_text_compress(png_ptr, text, text_len, compression - 2,
|
||||||
&comp);
|
&comp);
|
||||||
|
|
||||||
|
|
||||||
@ -1502,7 +1510,7 @@ png_write_iTXt(png_structp png_ptr, int compression, png_charp key,
|
|||||||
(png_size_t)(key_len + 1));
|
(png_size_t)(key_len + 1));
|
||||||
|
|
||||||
/* Set the compression flag */
|
/* Set the compression flag */
|
||||||
if (compression == PNG_ITXT_COMPRESSION_NONE || \
|
if (compression == PNG_ITXT_COMPRESSION_NONE ||
|
||||||
compression == PNG_TEXT_COMPRESSION_NONE)
|
compression == PNG_TEXT_COMPRESSION_NONE)
|
||||||
cbuf[0] = 0;
|
cbuf[0] = 0;
|
||||||
else /* compression == PNG_ITXT_COMPRESSION_zTXt */
|
else /* compression == PNG_ITXT_COMPRESSION_zTXt */
|
||||||
@ -1573,7 +1581,8 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0,
|
|||||||
(png_alloc_size_t)(nparams * png_sizeof(png_uint_32)));
|
(png_alloc_size_t)(nparams * png_sizeof(png_uint_32)));
|
||||||
|
|
||||||
/* Find the length of each parameter, making sure we don't count the
|
/* Find the length of each parameter, making sure we don't count the
|
||||||
null terminator for the last parameter. */
|
* null terminator for the last parameter.
|
||||||
|
*/
|
||||||
for (i = 0; i < nparams; i++)
|
for (i = 0; i < nparams; i++)
|
||||||
{
|
{
|
||||||
params_len[i] = png_strlen(params[i]) + (i == nparams - 1 ? 0 : 1);
|
params_len[i] = png_strlen(params[i]) + (i == nparams - 1 ? 0 : 1);
|
||||||
@ -1621,7 +1630,7 @@ png_write_sCAL(png_structp png_ptr, int unit, double width, double height)
|
|||||||
buf[0] = (char)unit;
|
buf[0] = (char)unit;
|
||||||
png_snprintf(buf + 1, 63, "%12.12e", width);
|
png_snprintf(buf + 1, 63, "%12.12e", width);
|
||||||
total_len = 1 + png_strlen(buf + 1) + 1;
|
total_len = 1 + png_strlen(buf + 1) + 1;
|
||||||
png_snprintf(buf + total_len, 64-total_len, "%12.12e", height);
|
png_snprintf(buf + total_len, 64 - total_len, "%12.12e", height);
|
||||||
total_len += png_strlen(buf + total_len);
|
total_len += png_strlen(buf + total_len);
|
||||||
|
|
||||||
png_debug1(3, "sCAL total length = %u", (unsigned int)total_len);
|
png_debug1(3, "sCAL total length = %u", (unsigned int)total_len);
|
||||||
@ -2061,8 +2070,8 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
|
|||||||
dp = row;
|
dp = row;
|
||||||
/* Find out how many bytes each pixel takes up */
|
/* Find out how many bytes each pixel takes up */
|
||||||
pixel_bytes = (row_info->pixel_depth >> 3);
|
pixel_bytes = (row_info->pixel_depth >> 3);
|
||||||
/* Loop through the row, only looking at the pixels that
|
|
||||||
matter */
|
/* Loop through the row, only looking at the pixels that matter */
|
||||||
for (i = png_pass_start[pass]; i < row_width;
|
for (i = png_pass_start[pass]; i < row_width;
|
||||||
i += png_pass_inc[pass])
|
i += png_pass_inc[pass])
|
||||||
{
|
{
|
||||||
@ -2154,8 +2163,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
/* We don't need to test the 'no filter' case if this is the only filter
|
/* We don't need to test the 'no filter' case if this is the only filter
|
||||||
* that has been chosen, as it doesn't actually do anything to the data.
|
* that has been chosen, as it doesn't actually do anything to the data.
|
||||||
*/
|
*/
|
||||||
if ((filter_to_do & PNG_FILTER_NONE) &&
|
if ((filter_to_do & PNG_FILTER_NONE) && filter_to_do != PNG_FILTER_NONE)
|
||||||
filter_to_do != PNG_FILTER_NONE)
|
|
||||||
{
|
{
|
||||||
png_bytep rp;
|
png_bytep rp;
|
||||||
png_uint_32 sum = 0;
|
png_uint_32 sum = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user