From 515659d6386e739dab743797c3799b12b08e8f8e Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Sat, 25 Oct 2014 19:30:02 -0500 Subject: [PATCH] [libpng17] Changed "if (!x)" to "if (x == 0)" and "if (x)" to "if (x !== 0)" --- ANNOUNCE | 5 +++-- CHANGES | 3 ++- png.c | 7 ++++--- pngrutil.c | 6 +++--- pngtest.c | 7 ++++--- pngwrite.c | 15 +++++++++------ 6 files changed, 25 insertions(+), 18 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 1e58bce0c..0367b5113 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.7.0beta39 - October 17, 2014 +Libpng 1.7.0beta39 - October 26, 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. @@ -617,7 +617,8 @@ Version 1.7.0beta38 [October 17, 2014] Removed "option WRITE_COMPRESSED_TEXT enables WRITE_TEXT" from pnglibconf.dfa Only mark text chunks as written after successfully writing them. -Version 1.7.0beta39 [October 17, 2014] +Version 1.7.0beta39 [October 26, 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 diff --git a/CHANGES b/CHANGES index 5a28177d4..bfd65ff7b 100644 --- a/CHANGES +++ b/CHANGES @@ -4906,7 +4906,8 @@ Version 1.7.0beta38 [October 17, 2014] Removed "option WRITE_COMPRESSED_TEXT enables WRITE_TEXT" from pnglibconf.dfa Only mark text chunks as written after successfully writing them. -Version 1.7.0beta39 [October 17, 2014] +Version 1.7.0beta39 [October 26, 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 diff --git a/png.c b/png.c index 75ca1996e..ec7dd8827 100644 --- a/png.c +++ b/png.c @@ -696,13 +696,13 @@ png_get_copyright(png_const_structrp png_ptr) #else # ifdef __STDC__ return PNG_STRING_NEWLINE \ - "libpng version 1.7.0beta39 - October 17, 2014" PNG_STRING_NEWLINE \ + "libpng version 1.7.0beta39 - October 26, 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.7.0beta39 - October 17, 2014\ + return "libpng version 1.7.0beta39 - October 26, 2014\ Copyright (c) 1998-2014 Glenn Randers-Pehrson\ Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; @@ -3180,7 +3180,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; diff --git a/pngrutil.c b/pngrutil.c index 3f1148275..09927a2c0 100644 --- a/pngrutil.c +++ b/pngrutil.c @@ -2632,10 +2632,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; @@ -2928,7 +2928,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"); } diff --git a/pngtest.c b/pngtest.c index 8ecec34b7..7e6708caa 100644 --- a/pngtest.c +++ b/pngtest.c @@ -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", diff --git a/pngwrite.c b/pngwrite.c index 71bb0c9d5..c1658f221 100644 --- a/pngwrite.c +++ b/pngwrite.c @@ -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)));