[libpng16] Use "if (value != 0)" instead of "if (value)" consistently.

This commit is contained in:
Glenn Randers-Pehrson
2014-03-08 12:39:52 -06:00
parent b65b3412b1
commit 05670156f3
16 changed files with 154 additions and 146 deletions

View File

@@ -1,7 +1,7 @@
/* pngwrite.c - general routines to write a PNG file
*
* Last changed in libpng 1.6.10 [March 6, 1014]]
* Last changed in libpng 1.6.11 [(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.)
@@ -826,7 +826,7 @@ png_write_row(png_structrp png_ptr, png_const_bytep row)
{
png_do_write_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass);
/* This should always get caught above, but still ... */
if (!(row_info.width))
if (row_info.width == 0)
{
png_write_finish_row(png_ptr);
return;
@@ -2177,7 +2177,7 @@ png_image_write_main(png_voidp argument)
* write an interlaced image.
*/
if (write_16bit)
if (write_16bit != 0)
{
/* The gamma here is 1.0 (linear) and the cHRM chunk matches sRGB. */
png_set_gAMA_fixed(png_ptr, info_ptr, PNG_GAMMA_LINEAR);
@@ -2209,7 +2209,7 @@ png_image_write_main(png_voidp argument)
*
* First check for a little endian system if writing 16 bit files.
*/
if (write_16bit)
if (write_16bit != 0)
{
PNG_CONST png_uint_16 le = 0x0001;
@@ -2250,7 +2250,7 @@ png_image_write_main(png_voidp argument)
png_const_bytep row = png_voidcast(png_const_bytep, display->buffer);
ptrdiff_t row_bytes = display->row_stride;
if (linear)
if (linear != 0)
row_bytes *= (sizeof (png_uint_16));
if (row_bytes < 0)
@@ -2283,7 +2283,7 @@ png_image_write_main(png_voidp argument)
int result;
display->local_row = row;
if (write_16bit)
if (write_16bit != 0)
result = png_safe_execute(image, png_write_image_16bit, display);
else
result = png_safe_execute(image, png_write_image_8bit, display);
@@ -2292,7 +2292,7 @@ png_image_write_main(png_voidp argument)
png_free(png_ptr, row);
/* Skip the 'write_end' on error: */
if (!result)
if (result == 0)
return 0;
}