[libpng16] 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 12:22:39 -05:00
parent 67152e75e6
commit ebba0746bc
6 changed files with 28 additions and 21 deletions

View File

@ -1,4 +1,4 @@
Libpng 1.6.15beta01 - October 23, 2014
Libpng 1.6.15beta01 - October 25, 2014
This is not intended to be a public release. It will be replaced
within a few weeks by a public version or by another test version.
@ -25,7 +25,8 @@ Other information:
Changes since the last public release (1.6.14):
Version 1.6.15beta01 [October 23, 2014]
Version 1.6.15beta01 [October 25, 2014]
Changed "if (!x)" to "if (x == 0)" and "if (x)" to "if (x !== 0)"
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -5033,7 +5033,8 @@ Version 1.6.14rc02 [October 17, 2014]
Version 1.6.14 [October 23, 2014]
No changes.
Version 1.6.15beta01 [October 23, 2014]
Version 1.6.15beta01 [October 25, 2014]
Changed "if (!x)" to "if (x == 0)" and "if (x)" to "if (x !== 0)"
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

9
png.c
View File

@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions
*
* Last changed in libpng 1.6.14 [October 23, 2014]
* Last changed in libpng 1.6.15 [(PENDING RELEASE)]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -773,13 +773,13 @@ png_get_copyright(png_const_structrp png_ptr)
#else
# ifdef __STDC__
return PNG_STRING_NEWLINE \
"libpng version 1.6.15beta01 - October 23, 2014" PNG_STRING_NEWLINE \
"libpng version 1.6.15beta01 - October 25, 2014" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE;
# else
return "libpng version 1.6.15beta01 - October 23, 2014\
return "libpng version 1.6.15beta01 - October 25, 2014\
Copyright (c) 1998-2014 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
@ -3277,7 +3277,8 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
result = -result;
/* Check for overflow. */
if ((negative && result <= 0) || (!negative && result >= 0))
if ((negative != 0 && result <= 0) ||
(negative == 0 && result >= 0))
{
*res = result;
return 1;

View File

@ -1,7 +1,7 @@
/* pngrutil.c - utilities to read a PNG file
*
* Last changed in libpng 1.6.14 [October 23, 2014]
* Last changed in libpng 1.6.15 [(PENDING RELEASE)]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -2643,10 +2643,10 @@ png_handle_iTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
*/
++prefix_length;
if (!compressed && prefix_length <= length)
if (compressed == 0 && prefix_length <= length)
uncompressed_length = length - prefix_length;
else if (compressed && prefix_length < length)
else if (compressed != 0 && prefix_length < length)
{
uncompressed_length = PNG_SIZE_MAX;
@ -2954,7 +2954,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
#endif /* !PNG_READ_UNKNOWN_CHUNKS_SUPPORTED */
/* Check for unhandled critical chunks */
if (!handled && PNG_CHUNK_CRITICAL(png_ptr->chunk_name))
if (handled == 0 && PNG_CHUNK_CRITICAL(png_ptr->chunk_name))
png_chunk_error(png_ptr, "unhandled critical chunk");
}

View File

@ -1,7 +1,7 @@
/* pngtest.c - a simple test program to test libpng
*
* Last changed in libpng 1.6.11 [June 5, 2014]
* Last changed in libpng 1.6.15 [(PENDING RELEASE)]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -1780,10 +1780,11 @@ main(int argc, char *argv[])
}
}
if (!multiple && argc == 3 + verbose)
if (multiple == 0 && argc == 3 + verbose)
outname = argv[2 + verbose];
if ((!multiple && argc > 3 + verbose) || (multiple && argc < 2))
if ((multiple == 0 && argc > 3 + verbose) ||
(multiple != 0 && argc < 2))
{
fprintf(STDERR,
"usage: %s [infile.png] [outfile.png]\n\t%s -m {infile.png}\n",

View File

@ -1,7 +1,7 @@
/* pngwrite.c - general routines to write a PNG file
*
* Last changed in libpng 1.6.14 [October 23, 2014]
* Last changed in libpng 1.6.15 [(PENDING RELEASE)]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -2135,9 +2135,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 */
@ -2224,7 +2226,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;
}
@ -2233,7 +2235,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;
}
@ -2280,7 +2282,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)));