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
|
/* Some compilers complain that this is always true. However, it
|
||||||
* can be false when integer overflow happens.
|
* can be false when integer overflow happens.
|
||||||
*/
|
*/
|
||||||
if (size > 0 && size <= PNG_SIZE_MAX
|
|
||||||
#ifdef PNG_MAX_MALLOC_64K
|
#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
|
#endif
|
||||||
)
|
|
||||||
{
|
{
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
if (png_ptr != NULL && png_ptr->malloc_fn != NULL)
|
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);
|
png_ptr->free_fn(png_constcast(png_structrp,png_ptr), ptr);
|
||||||
|
|
||||||
else
|
else
|
||||||
#endif /* USER_MEM */
|
|
||||||
free(ptr);
|
free(ptr);
|
||||||
|
#else
|
||||||
|
free(ptr);
|
||||||
|
#endif /* USER_MEM */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#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
|
#ifdef PNG_READ_DEINTERLACE_SUPPORTED
|
||||||
if (!png_ptr->do_interlace)
|
if (!png_ptr->do_interlace)
|
||||||
# endif
|
|
||||||
continue;
|
continue;
|
||||||
|
#else
|
||||||
|
continue;
|
||||||
|
#endif
|
||||||
|
|
||||||
display_row:
|
display_row:
|
||||||
if (dsp_row != NULL)
|
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
|
#ifdef PNG_READ_DEINTERLACE_SUPPORTED
|
||||||
if (!png_ptr->do_interlace)
|
if (!png_ptr->do_interlace)
|
||||||
# endif
|
|
||||||
continue;
|
continue;
|
||||||
|
#else
|
||||||
|
continue;
|
||||||
|
#endif
|
||||||
|
|
||||||
row_fn:
|
row_fn:
|
||||||
if (png_ptr->read_row_fn != NULL)
|
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");
|
png_app_error(png_ptr, "PNG_TRANSFORM_EXPAND not supported");
|
||||||
#endif
|
#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)
|
if ((transforms & PNG_TRANSFORM_INVERT_MONO) != 0)
|
||||||
#ifdef PNG_READ_INVERT_SUPPORTED
|
#ifdef PNG_READ_INVERT_SUPPORTED
|
||||||
png_set_invert_mono(png_ptr);
|
png_set_invert_mono(png_ptr);
|
||||||
@ -2912,7 +2914,6 @@ png_image_read_colormap(png_voidp argument)
|
|||||||
default:
|
default:
|
||||||
png_error(png_ptr, "invalid PNG color type");
|
png_error(png_ptr, "invalid PNG color type");
|
||||||
/*NOT REACHED*/
|
/*NOT REACHED*/
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now deal with the output processing */
|
/* 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
|
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||||
&& (png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) == 0
|
if ((num_palette > 0 && palette == NULL) || (num_palette == 0 &&
|
||||||
# endif /* MNG_FEATURES */
|
(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) == 0))
|
||||||
))
|
|
||||||
png_error(png_ptr, "Invalid palette");
|
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;
|
/* 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
|
* we do it for backward compatibility with the way the png_handle_tRNS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user