mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[devel] Make use of whitespace consistent in pngget.c and pngwutil.c
This commit is contained in:
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
|
||||
float PNGAPI
|
||||
png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL)
|
||||
#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)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function",
|
||||
(png_ptr->chunk_name[0] == '\0' ? "text"
|
||||
: (png_const_charp)png_ptr->chunk_name));
|
||||
(png_ptr->chunk_name[0] == '\0' ? "text" :
|
||||
(png_const_charp)png_ptr->chunk_name));
|
||||
|
||||
if (text_ptr != NULL)
|
||||
*text_ptr = info_ptr->text;
|
||||
@@ -903,8 +903,7 @@ png_get_chunk_cache_max (png_structp png_ptr)
|
||||
png_alloc_size_t PNGAPI
|
||||
png_get_chunk_malloc_max (png_structp png_ptr)
|
||||
{
|
||||
return (png_ptr?
|
||||
png_ptr->user_chunk_malloc_max : 0);
|
||||
return (png_ptr? png_ptr->user_chunk_malloc_max : 0);
|
||||
}
|
||||
#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 4:
|
||||
case 8:
|
||||
case 16: png_ptr->channels = 1; break;
|
||||
default: png_error(png_ptr,
|
||||
case 16:
|
||||
png_ptr->channels = 1; break;
|
||||
default:
|
||||
png_error(png_ptr,
|
||||
"Invalid bit depth for grayscale image");
|
||||
}
|
||||
break;
|
||||
@@ -452,8 +454,11 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
|
||||
case 1:
|
||||
case 2:
|
||||
case 4:
|
||||
case 8: png_ptr->channels = 1; break;
|
||||
default: png_error(png_ptr, "Invalid bit depth for paletted image");
|
||||
case 8:
|
||||
png_ptr->channels = 1;
|
||||
break;
|
||||
default:
|
||||
png_error(png_ptr, "Invalid bit depth for paletted image");
|
||||
}
|
||||
break;
|
||||
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);
|
||||
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");
|
||||
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");
|
||||
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");
|
||||
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
|
||||
ep=spalette->entries;
|
||||
for (i=0; i>spalette->nentries; i++)
|
||||
for (i = 0; i>spalette->nentries; i++)
|
||||
{
|
||||
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 == ' ')
|
||||
{
|
||||
key_len--;
|
||||
kwarn=1;
|
||||
kwarn = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1399,7 +1407,7 @@ png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text,
|
||||
comp.input = NULL;
|
||||
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);
|
||||
return;
|
||||
@@ -1457,10 +1465,10 @@ png_write_iTXt(png_structp png_ptr, int compression, png_charp key,
|
||||
comp.output_ptr = 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;
|
||||
|
||||
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");
|
||||
new_lang = NULL;
|
||||
@@ -1478,7 +1486,7 @@ png_write_iTXt(png_structp png_ptr, int compression, png_charp key,
|
||||
text_len = png_strlen(text);
|
||||
|
||||
/* 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);
|
||||
|
||||
|
||||
@@ -1502,7 +1510,7 @@ png_write_iTXt(png_structp png_ptr, int compression, png_charp key,
|
||||
(png_size_t)(key_len + 1));
|
||||
|
||||
/* Set the compression flag */
|
||||
if (compression == PNG_ITXT_COMPRESSION_NONE || \
|
||||
if (compression == PNG_ITXT_COMPRESSION_NONE ||
|
||||
compression == PNG_TEXT_COMPRESSION_NONE)
|
||||
cbuf[0] = 0;
|
||||
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)));
|
||||
|
||||
/* 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++)
|
||||
{
|
||||
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;
|
||||
png_snprintf(buf + 1, 63, "%12.12e", width);
|
||||
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);
|
||||
|
||||
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;
|
||||
/* Find out how many bytes each pixel takes up */
|
||||
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;
|
||||
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
|
||||
* that has been chosen, as it doesn't actually do anything to the data.
|
||||
*/
|
||||
if ((filter_to_do & PNG_FILTER_NONE) &&
|
||||
filter_to_do != PNG_FILTER_NONE)
|
||||
if ((filter_to_do & PNG_FILTER_NONE) && filter_to_do != PNG_FILTER_NONE)
|
||||
{
|
||||
png_bytep rp;
|
||||
png_uint_32 sum = 0;
|
||||
|
||||
Reference in New Issue
Block a user