mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng15] Clean up coding style in png_handle_PLTE()
This commit is contained in:
parent
b6ec5eb74e
commit
9b70e0332b
14
pngrutil.c
14
pngrutil.c
@ -667,13 +667,15 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
/* The cast is safe because 'length' is less than 3*PNG_MAX_PALETTE_LENGTH */
|
/* The cast is safe because 'length' is less than 3*PNG_MAX_PALETTE_LENGTH */
|
||||||
num = (int)length / 3;
|
num = (int)length / 3;
|
||||||
|
|
||||||
/* If the palette has 256 or fewer entries but is too large for the bit depth,
|
/* If the palette has 256 or fewer entries but is too large for the bit
|
||||||
* we don't issue an error, to preserve the behavior of previous libpng versions.
|
* depth, we don't issue an error, to preserve the behavior of previous
|
||||||
* We silently truncate the unused extra palette entries here.
|
* libpng versions. We silently truncate the unused extra palette entries
|
||||||
|
* here.
|
||||||
*/
|
*/
|
||||||
|
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||||
max_palette_length = (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) ?
|
max_palette_length = (1 << png_ptr->bit_depth);
|
||||||
(1 << png_ptr->bit_depth) : PNG_MAX_PALETTE_LENGTH;
|
else
|
||||||
|
max_palette_length = PNG_MAX_PALETTE_LENGTH;
|
||||||
|
|
||||||
if (num > max_palette_length)
|
if (num > max_palette_length)
|
||||||
num = max_palette_length;
|
num = max_palette_length;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user