mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng17] Clean up some conditional compilation of parts of statements
and fixed some indentation
This commit is contained in:
parent
3a866cb451
commit
daf4b9dd18
11
pngmem.c
11
pngmem.c
@ -81,11 +81,11 @@ png_malloc_base,(png_const_structrp png_ptr, png_alloc_size_t size),
|
||||
/* Some compilers complain that this is always true. However, it
|
||||
* can be false when integer overflow happens.
|
||||
*/
|
||||
if (size > 0 && size <= PNG_SIZE_MAX
|
||||
#ifdef PNG_MAX_MALLOC_64K
|
||||
&& size <= 65536U
|
||||
if (size > 0 && size <= PNG_SIZE_MAX && size <= 65536U)
|
||||
#else
|
||||
if (size > 0 && size <= PNG_SIZE_MAX)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
if (png_ptr != NULL && png_ptr->malloc_fn != NULL)
|
||||
@ -226,8 +226,11 @@ png_free(png_const_structrp png_ptr, png_voidp ptr)
|
||||
png_ptr->free_fn(png_constcast(png_structrp,png_ptr), ptr);
|
||||
|
||||
else
|
||||
#endif /* USER_MEM */
|
||||
free(ptr);
|
||||
#else
|
||||
free(ptr);
|
||||
#endif /* USER_MEM */
|
||||
|
||||
}
|
||||
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
|
15
pngread.c
15
pngread.c
@ -433,8 +433,10 @@ png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row)
|
||||
*/
|
||||
#ifdef PNG_READ_DEINTERLACE_SUPPORTED
|
||||
if (!png_ptr->do_interlace)
|
||||
# endif
|
||||
continue;
|
||||
#else
|
||||
continue;
|
||||
#endif
|
||||
|
||||
display_row:
|
||||
if (dsp_row != NULL)
|
||||
@ -448,8 +450,10 @@ png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row)
|
||||
*/
|
||||
#ifdef PNG_READ_DEINTERLACE_SUPPORTED
|
||||
if (!png_ptr->do_interlace)
|
||||
# endif
|
||||
continue;
|
||||
#else
|
||||
continue;
|
||||
#endif
|
||||
|
||||
row_fn:
|
||||
if (png_ptr->read_row_fn != NULL)
|
||||
@ -919,11 +923,9 @@ png_read_png(png_structrp png_ptr, png_inforp info_ptr, int transforms,
|
||||
png_app_error(png_ptr, "PNG_TRANSFORM_EXPAND not supported");
|
||||
#endif
|
||||
|
||||
/* We don't handle background color or gamma transformation or quantizing.
|
||||
*/
|
||||
/* We don't handle background color, gamma transformation, or quantizing. */
|
||||
|
||||
/* Invert monochrome files to have 0 as white and 1 as black
|
||||
*/
|
||||
/* Invert monochrome files to have 0 as white and 1 as black */
|
||||
if ((transforms & PNG_TRANSFORM_INVERT_MONO) != 0)
|
||||
#ifdef PNG_READ_INVERT_SUPPORTED
|
||||
png_set_invert_mono(png_ptr);
|
||||
@ -2912,7 +2914,6 @@ png_image_read_colormap(png_voidp argument)
|
||||
default:
|
||||
png_error(png_ptr, "invalid PNG color type");
|
||||
/*NOT REACHED*/
|
||||
break;
|
||||
}
|
||||
|
||||
/* Now deal with the output processing */
|
||||
|
11
pngset.c
11
pngset.c
@ -524,13 +524,14 @@ png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
if ((num_palette > 0 && palette == NULL) ||
|
||||
(num_palette == 0
|
||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||
&& (png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) == 0
|
||||
# endif /* MNG_FEATURES */
|
||||
))
|
||||
if ((num_palette > 0 && palette == NULL) || (num_palette == 0 &&
|
||||
(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) == 0))
|
||||
png_error(png_ptr, "Invalid palette");
|
||||
#else
|
||||
if ((num_palette > 0 && palette == NULL) || (num_palette == 0))
|
||||
png_error(png_ptr, "Invalid palette");
|
||||
#endif /* MNG_FEATURES */
|
||||
|
||||
/* It may not actually be necessary to set png_ptr->palette here;
|
||||
* we do it for backward compatibility with the way the png_handle_tRNS
|
||||
|
Loading…
x
Reference in New Issue
Block a user