[libpng17] Changed "if (!x)" to "if (x == 0)" and "if (x)" to "if (x !== 0)"

This commit is contained in:
Glenn Randers-Pehrson
2014-10-25 19:30:02 -05:00
parent fd409c8019
commit 515659d638
6 changed files with 25 additions and 18 deletions

View File

@@ -2120,9 +2120,11 @@ png_image_write_main(png_voidp argument)
png_uint_32 format = image->format;
int colormap = (format & PNG_FORMAT_FLAG_COLORMAP) != 0;
int linear = !colormap && (format & PNG_FORMAT_FLAG_LINEAR) != 0; /* input */
int alpha = !colormap && (format & PNG_FORMAT_FLAG_ALPHA) != 0;
int write_16bit = linear && !colormap && !display->convert_to_8bit;
/* input */
int linear = (colormap == 0) && (format & PNG_FORMAT_FLAG_LINEAR) != 0;
int alpha = (colormap == 0) && (format & PNG_FORMAT_FLAG_ALPHA) != 0;
int write_16bit = (linear != 0 ) && (colormap == 0) &&
(display->convert_to_8bit == 0);
# ifdef PNG_BENIGN_ERRORS_SUPPORTED
/* Make sure we error out on any bad situation */
@@ -2209,7 +2211,7 @@ png_image_write_main(png_voidp argument)
# ifdef PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
if (format & PNG_FORMAT_FLAG_BGR)
{
if (!colormap && (format & PNG_FORMAT_FLAG_COLOR) != 0)
if (colormap == 0 && (format & PNG_FORMAT_FLAG_COLOR) != 0)
png_set_bgr(png_ptr);
format &= ~PNG_FORMAT_FLAG_BGR;
}
@@ -2218,7 +2220,7 @@ png_image_write_main(png_voidp argument)
# ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
if (format & PNG_FORMAT_FLAG_AFIRST)
{
if (!colormap && (format & PNG_FORMAT_FLAG_ALPHA) != 0)
if (colormap == 0 && (format & PNG_FORMAT_FLAG_ALPHA) != 0)
png_set_swap_alpha(png_ptr);
format &= ~PNG_FORMAT_FLAG_AFIRST;
}
@@ -2265,7 +2267,8 @@ png_image_write_main(png_voidp argument)
* before it is written. This only applies when the input is 16-bit and
* either there is an alpha channel or it is converted to 8-bit.
*/
if ((linear && alpha) || (!colormap && display->convert_to_8bit))
if ((linear != 0 && alpha != 0 ) ||
(colormap == 0 && display->convert_to_8bit != 0))
{
png_bytep row = png_voidcast(png_bytep, png_malloc(png_ptr,
png_get_rowbytes(png_ptr, info_ptr)));