mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng15] Use "if (value != 0)" instead of "if (value)" consistently.
This commit is contained in:
parent
a00d14ddcf
commit
d92bbef414
5
ANNOUNCE
5
ANNOUNCE
@ -1,5 +1,5 @@
|
||||
|
||||
Libpng 1.5.19beta02 - February 28, 2014
|
||||
Libpng 1.5.19beta02 - March 8, 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.
|
||||
@ -34,7 +34,8 @@ Version 1.5.19beta01 [February 26, 2014]
|
||||
Fixed typos in the manual and in scripts/pnglibconf.dfa (CFLAGS -> CPPFLAGS
|
||||
and PNG_USR_CONFIG -> PNG_USER_CONFIG).
|
||||
|
||||
Version 1.5.19beta02 [February 28, 2014]
|
||||
Version 1.5.19beta02 [March 8, 2014]
|
||||
Use "if (value != 0)" instead of "if (value)" consistently.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
3
CHANGES
3
CHANGES
@ -4210,7 +4210,8 @@ Version 1.5.19beta01 [February 26, 2014]
|
||||
Fixed typos in the manual and in scripts/pnglibconf.dfa (CFLAGS -> CPPFLAGS
|
||||
and PNG_USR_CONFIG -> PNG_USER_CONFIG).
|
||||
|
||||
Version 1.5.19beta02 [February 28, 2014]
|
||||
Version 1.5.19beta02 [March 8, 2014]
|
||||
Use "if (value != 0)" instead of "if (value)" consistently.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
@ -2,8 +2,8 @@
|
||||
#if 0 /* in case someone actually tries to compile this */
|
||||
|
||||
/* example.c - an example of using libpng
|
||||
* Last changed in libpng 1.5.17 [June 27, 2013]
|
||||
* Maintained 1998-2013 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.5.19 [(PENDING RELEASE)]
|
||||
* Maintained 1998-2014 Glenn Randers-Pehrson
|
||||
* Maintained 1996, 1997 Andreas Dilger
|
||||
* Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
*/
|
||||
@ -788,7 +788,7 @@ void write_png(char *file_name /* , ... other image information ... */)
|
||||
png_set_packswap(png_ptr);
|
||||
|
||||
/* Turn on interlace handling if you are not using png_write_image() */
|
||||
if (interlacing)
|
||||
if (interlacing != 0)
|
||||
number_passes = png_set_interlace_handling(png_ptr);
|
||||
|
||||
else
|
||||
|
@ -1,6 +1,6 @@
|
||||
Libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
libpng version 1.5.19beta02 - February 28, 2014
|
||||
libpng version 1.5.19beta02 - March 8, 2014
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<glennrp at users.sourceforge.net>
|
||||
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
@ -11,7 +11,7 @@ Libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
Based on:
|
||||
|
||||
libpng versions 0.97, January 1998, through 1.5.19beta02 - February 28, 2014
|
||||
libpng versions 0.97, January 1998, through 1.5.19beta02 - March 8, 2014
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
|
||||
@ -4665,6 +4665,9 @@ with "defined".
|
||||
We prefer to express integers that are used as bit masks in hex format,
|
||||
with an even number of lower-case hex digits (e.g., 0x00, 0xff, 0x0100).
|
||||
|
||||
We prefer "if (something != 0)" and "if (something == 0)"
|
||||
over "if (something)" and if "(!something)", respectively.
|
||||
|
||||
We do not use the TAB character for indentation in the C sources.
|
||||
|
||||
Lines do not exceed 80 characters.
|
||||
@ -4673,7 +4676,7 @@ Other rules can be inferred by inspecting the libpng source.
|
||||
|
||||
XIV. Y2K Compliance in libpng
|
||||
|
||||
February 28, 2014
|
||||
March 8, 2014
|
||||
|
||||
Since the PNG Development group is an ad-hoc body, we can't make
|
||||
an official declaration.
|
||||
|
17
libpng.3
17
libpng.3
@ -1,4 +1,4 @@
|
||||
.TH LIBPNG 3 "February 28, 2014"
|
||||
.TH LIBPNG 3 "March 8, 2014"
|
||||
.SH NAME
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.5.19beta02
|
||||
.SH SYNOPSIS
|
||||
@ -492,7 +492,7 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng.
|
||||
.SH LIBPNG.TXT
|
||||
Libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
libpng version 1.5.19beta02 - February 28, 2014
|
||||
libpng version 1.5.19beta02 - March 8, 2014
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<glennrp at users.sourceforge.net>
|
||||
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
@ -503,7 +503,7 @@ Libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
Based on:
|
||||
|
||||
libpng versions 0.97, January 1998, through 1.5.19beta02 - February 28, 2014
|
||||
libpng versions 0.97, January 1998, through 1.5.19beta02 - March 8, 2014
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
|
||||
@ -5158,6 +5158,9 @@ with "defined".
|
||||
We prefer to express integers that are used as bit masks in hex format,
|
||||
with an even number of lower-case hex digits (e.g., 0x00, 0xff, 0x0100).
|
||||
|
||||
We prefer "if (something != 0)" and "if (something == 0)"
|
||||
over "if (something)" and if "(!something)", respectively.
|
||||
|
||||
We do not use the TAB character for indentation in the C sources.
|
||||
|
||||
Lines do not exceed 80 characters.
|
||||
@ -5166,7 +5169,7 @@ Other rules can be inferred by inspecting the libpng source.
|
||||
|
||||
.SH XIV. Y2K Compliance in libpng
|
||||
|
||||
February 28, 2014
|
||||
March 8, 2014
|
||||
|
||||
Since the PNG Development group is an ad-hoc body, we can't make
|
||||
an official declaration.
|
||||
@ -5464,7 +5467,7 @@ possible without all of you.
|
||||
|
||||
Thanks to Frank J. T. Wojcik for helping with the documentation.
|
||||
|
||||
Libpng version 1.5.19beta02 - February 28, 2014:
|
||||
Libpng version 1.5.19beta02 - March 8, 2014:
|
||||
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
|
||||
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
|
||||
|
||||
@ -5487,7 +5490,7 @@ this sentence.
|
||||
|
||||
This code is released under the libpng license.
|
||||
|
||||
libpng versions 1.2.6, August 15, 2004, through 1.5.19beta02, February 28, 2014, are
|
||||
libpng versions 1.2.6, August 15, 2004, through 1.5.19beta02, March 8, 2014, are
|
||||
Copyright (c) 2004,2006-2007 Glenn Randers-Pehrson, and are
|
||||
distributed according to the same disclaimer and license as libpng-1.2.5
|
||||
with the following individual added to the list of Contributing Authors
|
||||
@ -5586,7 +5589,7 @@ certification mark of the Open Source Initiative.
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
glennrp at users.sourceforge.net
|
||||
February 28, 2014
|
||||
March 8, 2014
|
||||
|
||||
.\" end of man page
|
||||
|
||||
|
16
png.c
16
png.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* Last changed in libpng 1.5.18 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.5.19 [(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.)
|
||||
@ -174,7 +174,7 @@ png_calculate_crc(png_structp png_ptr, png_const_bytep ptr, png_size_t length)
|
||||
int
|
||||
png_user_version_check(png_structp png_ptr, png_const_charp user_png_ver)
|
||||
{
|
||||
if (user_png_ver)
|
||||
if (user_png_ver != NULL)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
@ -658,13 +658,13 @@ png_get_copyright(png_const_structp png_ptr)
|
||||
#else
|
||||
# ifdef __STDC__
|
||||
return PNG_STRING_NEWLINE \
|
||||
"libpng version 1.5.19beta02 - February 28, 2014" PNG_STRING_NEWLINE \
|
||||
"libpng version 1.5.19beta02 - March 8, 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.5.19beta02 - February 28, 2014\
|
||||
return "libpng version 1.5.19beta02 - March 8, 2014\
|
||||
Copyright (c) 1998-2014 Glenn Randers-Pehrson\
|
||||
Copyright (c) 1996-1997 Andreas Dilger\
|
||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
|
||||
@ -1485,7 +1485,7 @@ png_pow10(int power)
|
||||
}
|
||||
while (power > 0);
|
||||
|
||||
if (recip) d = 1/d;
|
||||
if (recip != 0) d = 1/d;
|
||||
}
|
||||
/* else power is 0 and d is 1 */
|
||||
|
||||
@ -2003,7 +2003,7 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
|
||||
if (s00 >= (D >> 1))
|
||||
++result;
|
||||
|
||||
if (negative)
|
||||
if (negative != 0)
|
||||
result = -result;
|
||||
|
||||
/* Check for overflow. */
|
||||
@ -2570,7 +2570,7 @@ png_build_16bit_table(png_structp png_ptr, png_uint_16pp *ptable,
|
||||
double d = floor(65535*pow(ig/(double)max, gamma_val*.00001)+.5);
|
||||
sub_table[j] = (png_uint_16)d;
|
||||
# else
|
||||
if (shift)
|
||||
if (shift != 0)
|
||||
ig = (ig * 65535U + max_by_2)/max;
|
||||
|
||||
sub_table[j] = png_gamma_16bit_correct(ig, gamma_val);
|
||||
@ -2586,7 +2586,7 @@ png_build_16bit_table(png_structp png_ptr, png_uint_16pp *ptable,
|
||||
{
|
||||
png_uint_32 ig = (j << (8-shift)) + i;
|
||||
|
||||
if (shift)
|
||||
if (shift != 0)
|
||||
ig = (ig * 65535U + max_by_2)/max;
|
||||
|
||||
sub_table[j] = (png_uint_16)ig;
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngerror.c - stub functions for i/o and memory allocation
|
||||
*
|
||||
* Last changed in libpng 1.5.14 [January 24, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.5.19 [(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.)
|
||||
*
|
||||
@ -193,7 +193,7 @@ png_format_number(png_const_charp start, png_charp end, int format,
|
||||
* drop the decimal point. If the number is a true zero handle that
|
||||
* here.
|
||||
*/
|
||||
if (output)
|
||||
if (output != 0)
|
||||
*--end = '.';
|
||||
else if (number == 0) /* and !output */
|
||||
*--end = '0';
|
||||
|
4
pngget.c
4
pngget.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngget.c - retrieval of values from info struct
|
||||
*
|
||||
* Last changed in libpng 1.5.15 [March 28, 2013]
|
||||
* Last changed in libpng 1.5.19 [(PENDING RELEASE)]
|
||||
* Copyright (c) 1998-2013 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.)
|
||||
@ -652,7 +652,7 @@ png_get_gAMA(png_const_structp png_ptr, png_const_infop info_ptr,
|
||||
png_fixed_point igamma;
|
||||
png_uint_32 ok = png_get_gAMA_fixed(png_ptr, info_ptr, &igamma);
|
||||
|
||||
if (ok)
|
||||
if (ok != 0)
|
||||
*file_gamma = png_float(png_ptr, igamma, "png_get_gAMA");
|
||||
|
||||
return ok;
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngpread.c - read a png file in push mode
|
||||
*
|
||||
* Last changed in libpng 1.5.18 [February 6, 2014]
|
||||
* Last changed in libpng 1.5.19 [(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.)
|
||||
@ -49,7 +49,7 @@ png_process_data_pause(png_structp png_ptr, int save)
|
||||
/* It's easiest for the caller if we do the save, then the caller doesn't
|
||||
* have to supply the same data again:
|
||||
*/
|
||||
if (save)
|
||||
if (save != 0)
|
||||
png_push_save_buffer(png_ptr);
|
||||
else
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngread.c - read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.5.18 [February 6, 2014]
|
||||
* Last changed in libpng 1.5.19 [(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.)
|
||||
@ -100,7 +100,7 @@ png_create_read_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
if (!png_user_version_check(png_ptr, user_png_ver))
|
||||
png_cleanup_needed = 1;
|
||||
|
||||
if (!png_cleanup_needed)
|
||||
if (png_cleanup_needed == 0)
|
||||
{
|
||||
/* Initialize zbuf - compression buffer */
|
||||
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
|
||||
@ -114,7 +114,7 @@ png_create_read_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
png_ptr->zstream.zfree = png_zfree;
|
||||
png_ptr->zstream.opaque = (voidpf)png_ptr;
|
||||
|
||||
if (!png_cleanup_needed)
|
||||
if (png_cleanup_needed == 0)
|
||||
{
|
||||
switch (inflateInit(&png_ptr->zstream))
|
||||
{
|
||||
@ -141,7 +141,7 @@ png_create_read_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
if (png_cleanup_needed)
|
||||
if (png_cleanup_needed != 0)
|
||||
{
|
||||
/* Clean up PNG structure and deallocate any memory. */
|
||||
png_free(png_ptr, png_ptr->zbuf);
|
||||
|
76
pngrtran.c
76
pngrtran.c
@ -114,7 +114,7 @@ png_set_background_fixed(png_structp png_ptr,
|
||||
png_sizeof(png_color_16));
|
||||
png_ptr->background_gamma = background_gamma;
|
||||
png_ptr->background_gamma_type = (png_byte)(background_gamma_code);
|
||||
if (need_expand)
|
||||
if (need_expand != 0)
|
||||
png_ptr->transformations |= PNG_BACKGROUND_EXPAND;
|
||||
else
|
||||
png_ptr->transformations &= ~PNG_BACKGROUND_EXPAND;
|
||||
@ -197,7 +197,7 @@ translate_gamma_flags(png_structp png_ptr, png_fixed_point output_gamma,
|
||||
# else
|
||||
PNG_UNUSED(png_ptr)
|
||||
# endif
|
||||
if (is_screen)
|
||||
if (is_screen != 0)
|
||||
output_gamma = PNG_GAMMA_sRGB;
|
||||
else
|
||||
output_gamma = PNG_GAMMA_sRGB_INVERSE;
|
||||
@ -206,7 +206,7 @@ translate_gamma_flags(png_structp png_ptr, png_fixed_point output_gamma,
|
||||
else if (output_gamma == PNG_GAMMA_MAC_18 ||
|
||||
output_gamma == PNG_FP_1 / PNG_GAMMA_MAC_18)
|
||||
{
|
||||
if (is_screen)
|
||||
if (is_screen != 0)
|
||||
output_gamma = PNG_GAMMA_MAC_OLD;
|
||||
else
|
||||
output_gamma = PNG_GAMMA_MAC_INVERSE;
|
||||
@ -331,7 +331,7 @@ png_set_alpha_mode_fixed(png_structp png_ptr, int mode,
|
||||
/* Finally, if pre-multiplying, set the background fields to achieve the
|
||||
* desired result.
|
||||
*/
|
||||
if (compose)
|
||||
if (compose != 0)
|
||||
{
|
||||
/* And obtain alpha pre-multiplication by composing on black: */
|
||||
png_memset(&png_ptr->background, 0, sizeof png_ptr->background);
|
||||
@ -391,7 +391,7 @@ png_set_quantize(png_structp png_ptr, png_colorp palette,
|
||||
|
||||
png_ptr->transformations |= PNG_QUANTIZE;
|
||||
|
||||
if (!full_quantize)
|
||||
if (full_quantize == 0)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -446,12 +446,12 @@ png_set_quantize(png_structp png_ptr, png_colorp palette,
|
||||
}
|
||||
}
|
||||
|
||||
if (done)
|
||||
if (done != 0)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Swap the palette around, and set up a table, if necessary */
|
||||
if (full_quantize)
|
||||
if (full_quantize != 0)
|
||||
{
|
||||
int j = num_palette;
|
||||
|
||||
@ -634,7 +634,7 @@ png_set_quantize(png_structp png_ptr, png_colorp palette,
|
||||
num_new_palette--;
|
||||
palette[png_ptr->index_to_palette[j]]
|
||||
= palette[num_new_palette];
|
||||
if (!full_quantize)
|
||||
if (full_quantize == 0)
|
||||
{
|
||||
int k;
|
||||
|
||||
@ -702,7 +702,7 @@ png_set_quantize(png_structp png_ptr, png_colorp palette,
|
||||
}
|
||||
png_ptr->num_palette = (png_uint_16)num_palette;
|
||||
|
||||
if (full_quantize)
|
||||
if (full_quantize != 0)
|
||||
{
|
||||
int i;
|
||||
png_bytep distance;
|
||||
@ -1110,7 +1110,7 @@ png_init_palette_transformations(png_structp png_ptr)
|
||||
}
|
||||
|
||||
/* If no alpha we can optimize. */
|
||||
if (!input_has_alpha)
|
||||
if (input_has_alpha == 0)
|
||||
{
|
||||
/* Any alpha means background and associative alpha processing is
|
||||
* required, however if the alpha is 0 or 1 throughout OPTIMIZE_ALPHA
|
||||
@ -1119,7 +1119,7 @@ png_init_palette_transformations(png_structp png_ptr)
|
||||
png_ptr->transformations &= ~PNG_ENCODE_ALPHA;
|
||||
png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA;
|
||||
|
||||
if (!input_has_transparency)
|
||||
if (input_has_transparency == 0)
|
||||
png_ptr->transformations &= ~(PNG_COMPOSE | PNG_BACKGROUND_EXPAND);
|
||||
}
|
||||
|
||||
@ -1175,7 +1175,7 @@ png_init_rgb_transformations(png_structp png_ptr)
|
||||
int input_has_transparency = png_ptr->num_trans > 0;
|
||||
|
||||
/* If no alpha we can optimize. */
|
||||
if (!input_has_alpha)
|
||||
if (input_has_alpha == 0)
|
||||
{
|
||||
/* Any alpha means background and associative alpha processing is
|
||||
* required, however if the alpha is 0 or 1 throughout OPTIMIZE_ALPHA
|
||||
@ -1186,7 +1186,7 @@ png_init_rgb_transformations(png_structp png_ptr)
|
||||
png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA;
|
||||
# endif
|
||||
|
||||
if (!input_has_transparency)
|
||||
if (input_has_transparency == 0)
|
||||
png_ptr->transformations &= ~(PNG_COMPOSE | PNG_BACKGROUND_EXPAND);
|
||||
}
|
||||
|
||||
@ -1312,7 +1312,7 @@ png_init_read_transformations(png_structp png_ptr)
|
||||
* the code immediately below if the transform can be handled outside the
|
||||
* row loop.
|
||||
*/
|
||||
if (gamma_correction)
|
||||
if (gamma_correction != 0)
|
||||
png_ptr->transformations |= PNG_GAMMA;
|
||||
|
||||
else
|
||||
@ -1710,11 +1710,11 @@ png_init_read_transformations(png_structp png_ptr)
|
||||
g_sig = png_gamma_significant(g);
|
||||
gs_sig = png_gamma_significant(gs);
|
||||
|
||||
if (g_sig)
|
||||
if (g_sig != 0)
|
||||
png_ptr->background_1.gray = png_gamma_correct(png_ptr,
|
||||
png_ptr->background.gray, g);
|
||||
|
||||
if (gs_sig)
|
||||
if (gs_sig != 0)
|
||||
png_ptr->background.gray = png_gamma_correct(png_ptr,
|
||||
png_ptr->background.gray, gs);
|
||||
|
||||
@ -1723,7 +1723,7 @@ png_init_read_transformations(png_structp png_ptr)
|
||||
(png_ptr->background.red != png_ptr->background.gray))
|
||||
{
|
||||
/* RGB or RGBA with color background */
|
||||
if (g_sig)
|
||||
if (g_sig != 0)
|
||||
{
|
||||
png_ptr->background_1.red = png_gamma_correct(png_ptr,
|
||||
png_ptr->background.red, g);
|
||||
@ -1735,7 +1735,7 @@ png_init_read_transformations(png_structp png_ptr)
|
||||
png_ptr->background.blue, g);
|
||||
}
|
||||
|
||||
if (gs_sig)
|
||||
if (gs_sig != 0)
|
||||
{
|
||||
png_ptr->background.red = png_gamma_correct(png_ptr,
|
||||
png_ptr->background.red, gs);
|
||||
@ -2078,7 +2078,7 @@ defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
|
||||
png_ptr->info_rowbytes = info_ptr->rowbytes;
|
||||
|
||||
#ifndef PNG_READ_EXPAND_SUPPORTED
|
||||
if (png_ptr)
|
||||
if (png_ptr != NULL)
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
@ -2155,7 +2155,7 @@ png_do_read_transformations(png_structp png_ptr, png_row_infop row_info)
|
||||
png_do_rgb_to_gray(png_ptr, row_info,
|
||||
png_ptr->row_buf + 1);
|
||||
|
||||
if (rgb_error)
|
||||
if (rgb_error != 0)
|
||||
{
|
||||
png_ptr->rgb_to_gray_status=1;
|
||||
if ((png_ptr->transformations & PNG_RGB_TO_GRAY) ==
|
||||
@ -2533,7 +2533,7 @@ png_do_unshift(png_row_infop row_info, png_bytep row,
|
||||
have_shift = 1;
|
||||
}
|
||||
|
||||
if (!have_shift)
|
||||
if (have_shift == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3294,7 +3294,7 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row)
|
||||
*(dp++) = red;
|
||||
}
|
||||
|
||||
if (have_alpha)
|
||||
if (have_alpha != 0)
|
||||
*(dp++) = *(sp++);
|
||||
}
|
||||
}
|
||||
@ -3323,7 +3323,7 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row)
|
||||
else
|
||||
*(dp++) = red;
|
||||
|
||||
if (have_alpha)
|
||||
if (have_alpha != 0)
|
||||
*(dp++) = *(sp++);
|
||||
}
|
||||
}
|
||||
@ -3375,7 +3375,7 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row)
|
||||
*(dp++) = (png_byte)((w>>8) & 0xff);
|
||||
*(dp++) = (png_byte)(w & 0xff);
|
||||
|
||||
if (have_alpha)
|
||||
if (have_alpha != 0)
|
||||
{
|
||||
*(dp++) = *(sp++);
|
||||
*(dp++) = *(sp++);
|
||||
@ -3409,7 +3409,7 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row)
|
||||
*(dp++) = (png_byte)((gray16>>8) & 0xff);
|
||||
*(dp++) = (png_byte)(gray16 & 0xff);
|
||||
|
||||
if (have_alpha)
|
||||
if (have_alpha != 0)
|
||||
{
|
||||
*(dp++) = *(sp++);
|
||||
*(dp++) = *(sp++);
|
||||
@ -3535,7 +3535,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structp png_ptr)
|
||||
*sp |= (png_byte)(png_ptr->background.gray << shift);
|
||||
}
|
||||
|
||||
if (!shift)
|
||||
if (shift == 0)
|
||||
{
|
||||
shift = 7;
|
||||
sp++;
|
||||
@ -3572,7 +3572,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structp png_ptr)
|
||||
*sp |= (png_byte)(g << shift);
|
||||
}
|
||||
|
||||
if (!shift)
|
||||
if (shift == 0)
|
||||
{
|
||||
shift = 6;
|
||||
sp++;
|
||||
@ -3597,7 +3597,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structp png_ptr)
|
||||
*sp |= (png_byte)(png_ptr->background.gray << shift);
|
||||
}
|
||||
|
||||
if (!shift)
|
||||
if (shift == 0)
|
||||
{
|
||||
shift = 6;
|
||||
sp++;
|
||||
@ -3635,7 +3635,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structp png_ptr)
|
||||
*sp |= (png_byte)(g << shift);
|
||||
}
|
||||
|
||||
if (!shift)
|
||||
if (shift == 0)
|
||||
{
|
||||
shift = 4;
|
||||
sp++;
|
||||
@ -3660,7 +3660,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structp png_ptr)
|
||||
*sp |= (png_byte)(png_ptr->background.gray << shift);
|
||||
}
|
||||
|
||||
if (!shift)
|
||||
if (shift == 0)
|
||||
{
|
||||
shift = 4;
|
||||
sp++;
|
||||
@ -3913,7 +3913,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structp png_ptr)
|
||||
|
||||
v = gamma_to_1[*sp];
|
||||
png_composite(w, v, a, png_ptr->background_1.gray);
|
||||
if (!optimize)
|
||||
if (optimize == 0)
|
||||
w = gamma_from_1[w];
|
||||
*sp = w;
|
||||
}
|
||||
@ -3970,7 +3970,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structp png_ptr)
|
||||
|
||||
g = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp];
|
||||
png_composite_16(v, g, a, png_ptr->background_1.gray);
|
||||
if (optimize)
|
||||
if (optimize != 0)
|
||||
w = v;
|
||||
else
|
||||
w = gamma_16_from_1[(v&0xff) >> gamma_shift][v >> 8];
|
||||
@ -4044,17 +4044,17 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structp png_ptr)
|
||||
|
||||
v = gamma_to_1[*sp];
|
||||
png_composite(w, v, a, png_ptr->background_1.red);
|
||||
if (!optimize) w = gamma_from_1[w];
|
||||
if (optimize == 0) w = gamma_from_1[w];
|
||||
*sp = w;
|
||||
|
||||
v = gamma_to_1[*(sp + 1)];
|
||||
png_composite(w, v, a, png_ptr->background_1.green);
|
||||
if (!optimize) w = gamma_from_1[w];
|
||||
if (optimize == 0) w = gamma_from_1[w];
|
||||
*(sp + 1) = w;
|
||||
|
||||
v = gamma_to_1[*(sp + 2)];
|
||||
png_composite(w, v, a, png_ptr->background_1.blue);
|
||||
if (!optimize) w = gamma_from_1[w];
|
||||
if (optimize == 0) w = gamma_from_1[w];
|
||||
*(sp + 2) = w;
|
||||
}
|
||||
}
|
||||
@ -4136,7 +4136,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structp png_ptr)
|
||||
|
||||
v = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp];
|
||||
png_composite_16(w, v, a, png_ptr->background_1.red);
|
||||
if (!optimize)
|
||||
if (optimize == 0)
|
||||
w = gamma_16_from_1[((w&0xff) >> gamma_shift)]
|
||||
[w >> 8];
|
||||
*sp = (png_byte)((w >> 8) & 0xff);
|
||||
@ -4144,7 +4144,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structp png_ptr)
|
||||
|
||||
v = gamma_16_to_1[*(sp + 3) >> gamma_shift][*(sp + 2)];
|
||||
png_composite_16(w, v, a, png_ptr->background_1.green);
|
||||
if (!optimize)
|
||||
if (optimize == 0)
|
||||
w = gamma_16_from_1[((w&0xff) >> gamma_shift)]
|
||||
[w >> 8];
|
||||
|
||||
@ -4153,7 +4153,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structp png_ptr)
|
||||
|
||||
v = gamma_16_to_1[*(sp + 5) >> gamma_shift][*(sp + 4)];
|
||||
png_composite_16(w, v, a, png_ptr->background_1.blue);
|
||||
if (!optimize)
|
||||
if (optimize == 0)
|
||||
w = gamma_16_from_1[((w&0xff) >> gamma_shift)]
|
||||
[w >> 8];
|
||||
|
||||
|
16
pngrutil.c
16
pngrutil.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.5.18 [February 6, 2014]
|
||||
* Last changed in libpng 1.5.19 [(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.)
|
||||
@ -209,7 +209,7 @@ png_crc_finish(png_structp png_ptr, png_uint_32 skip)
|
||||
png_crc_read(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size);
|
||||
}
|
||||
|
||||
if (i)
|
||||
if (i != 0)
|
||||
{
|
||||
png_crc_read(png_ptr, png_ptr->zbuf, i);
|
||||
}
|
||||
@ -265,7 +265,7 @@ png_crc_error(png_structp png_ptr)
|
||||
/* The chunk CRC must be serialized in a single I/O call. */
|
||||
png_read_data(png_ptr, crc_bytes, 4);
|
||||
|
||||
if (need_crc)
|
||||
if (need_crc != 0)
|
||||
{
|
||||
crc = png_get_uint_32(crc_bytes);
|
||||
return ((int)(crc != png_ptr->crc));
|
||||
@ -1318,7 +1318,7 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
/* Compression_type should always be zero */
|
||||
compression_type = *profile++;
|
||||
|
||||
if (compression_type)
|
||||
if (compression_type != 0)
|
||||
{
|
||||
png_warning(png_ptr, "Ignoring nonzero compression type in iCCP chunk");
|
||||
compression_type = 0x00; /* Reset it to zero (libpng-1.0.6 through 1.0.8
|
||||
@ -2318,7 +2318,7 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
png_ptr->chunkdata = NULL;
|
||||
png_free(png_ptr, text_ptr);
|
||||
|
||||
if (ret)
|
||||
if (ret != 0)
|
||||
png_warning(png_ptr, "Insufficient memory to process text chunk");
|
||||
}
|
||||
#endif
|
||||
@ -2448,7 +2448,7 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
png_free(png_ptr, png_ptr->chunkdata);
|
||||
png_ptr->chunkdata = NULL;
|
||||
|
||||
if (ret)
|
||||
if (ret != 0)
|
||||
png_error(png_ptr, "Insufficient memory to store zTXt chunk");
|
||||
}
|
||||
#endif
|
||||
@ -2628,7 +2628,7 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
png_free(png_ptr, png_ptr->chunkdata);
|
||||
png_ptr->chunkdata = NULL;
|
||||
|
||||
if (ret)
|
||||
if (ret != 0)
|
||||
png_error(png_ptr, "Insufficient memory to store iTXt chunk");
|
||||
}
|
||||
#endif
|
||||
@ -3068,7 +3068,7 @@ png_combine_row(png_structp png_ptr, png_bytep dp, int display)
|
||||
}
|
||||
|
||||
/* Work out the bytes to copy. */
|
||||
if (display)
|
||||
if (display != 0)
|
||||
{
|
||||
/* When doing the 'block' algorithm the pixel in the pass gets
|
||||
* replicated to adjacent pixels. This is why the even (0,2,4,6)
|
||||
|
18
pngset.c
18
pngset.c
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngset.c - storage of image information into info struct
|
||||
*
|
||||
* Last changed in libpng 1.5.17 [June 27, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.5.19 [(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.)
|
||||
*
|
||||
@ -662,7 +662,7 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_const_textp text_ptr,
|
||||
int ret;
|
||||
ret = png_set_text_2(png_ptr, info_ptr, text_ptr, num_text);
|
||||
|
||||
if (ret)
|
||||
if (ret != 0)
|
||||
png_error(png_ptr, "Insufficient memory to store text");
|
||||
}
|
||||
|
||||
@ -838,7 +838,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr,
|
||||
textp->text = textp->key + key_len + 1;
|
||||
}
|
||||
|
||||
if (text_length)
|
||||
if (text_length != 0)
|
||||
png_memcpy(textp->text, text_ptr[i].text,
|
||||
(png_size_t)(text_length));
|
||||
|
||||
@ -1223,7 +1223,7 @@ png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers)
|
||||
|
||||
info_ptr->row_pointers = row_pointers;
|
||||
|
||||
if (row_pointers)
|
||||
if (row_pointers != NULL)
|
||||
info_ptr->valid |= PNG_INFO_IDAT;
|
||||
}
|
||||
#endif
|
||||
@ -1287,7 +1287,7 @@ void PNGAPI
|
||||
png_set_chunk_cache_max (png_structp png_ptr,
|
||||
png_uint_32 user_chunk_cache_max)
|
||||
{
|
||||
if (png_ptr)
|
||||
if (png_ptr != NULL)
|
||||
png_ptr->user_chunk_cache_max = user_chunk_cache_max;
|
||||
}
|
||||
|
||||
@ -1296,7 +1296,7 @@ void PNGAPI
|
||||
png_set_chunk_malloc_max (png_structp png_ptr,
|
||||
png_alloc_size_t user_chunk_malloc_max)
|
||||
{
|
||||
if (png_ptr)
|
||||
if (png_ptr != NULL)
|
||||
png_ptr->user_chunk_malloc_max = user_chunk_malloc_max;
|
||||
}
|
||||
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
|
||||
@ -1308,7 +1308,7 @@ png_set_benign_errors(png_structp png_ptr, int allowed)
|
||||
{
|
||||
png_debug(1, "in png_set_benign_errors");
|
||||
|
||||
if (allowed)
|
||||
if (allowed != 0)
|
||||
png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN;
|
||||
|
||||
else
|
||||
@ -1325,7 +1325,7 @@ png_set_check_for_invalid_index(png_structp png_ptr, int allowed)
|
||||
{
|
||||
png_debug(1, "in png_set_check_for_invalid_index");
|
||||
|
||||
if (allowed)
|
||||
if (allowed != 0)
|
||||
png_ptr->num_palette_max = 0;
|
||||
|
||||
else
|
||||
|
36
pngtest.c
36
pngtest.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngtest.c - a simple test program to test libpng
|
||||
*
|
||||
* Last changed in libpng 1.5.18 [February 6, 2014]
|
||||
* Last changed in libpng 1.5.19 [(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.)
|
||||
@ -359,7 +359,7 @@ pngtest_check_io_state(png_structp png_ptr, png_size_t data_length,
|
||||
default:
|
||||
err = 1; /* uninitialized */
|
||||
}
|
||||
if (err)
|
||||
if (err != 0)
|
||||
png_error(png_ptr, "Bad I/O state or buffer size");
|
||||
}
|
||||
#endif
|
||||
@ -540,7 +540,7 @@ PNGCBAPI png_debug_malloc(png_structp png_ptr, png_alloc_size_t size)
|
||||
/* Make sure the caller isn't assuming zeroed memory. */
|
||||
memset(pinfo->pointer, 0xdd, pinfo->size);
|
||||
|
||||
if (verbose)
|
||||
if (verbose != 0)
|
||||
printf("png_malloc %lu bytes at %p\n", (unsigned long)size,
|
||||
pinfo->pointer);
|
||||
|
||||
@ -580,7 +580,7 @@ png_debug_free(png_structp png_ptr, png_voidp ptr)
|
||||
/* We must free the list element too, but first kill
|
||||
the memory that is to be freed. */
|
||||
memset(ptr, 0x55, pinfo->size);
|
||||
if (pinfo)
|
||||
if (pinfo != NULL)
|
||||
free(pinfo);
|
||||
pinfo = NULL;
|
||||
break;
|
||||
@ -597,10 +597,10 @@ png_debug_free(png_structp png_ptr, png_voidp ptr)
|
||||
}
|
||||
|
||||
/* Finally free the data. */
|
||||
if (verbose)
|
||||
if (verbose != 0)
|
||||
printf("Freeing %p\n", ptr);
|
||||
|
||||
if (ptr)
|
||||
if (ptr != NULL)
|
||||
free(ptr);
|
||||
ptr = NULL;
|
||||
}
|
||||
@ -734,7 +734,7 @@ write_sTER_chunk(png_structp write_ptr)
|
||||
{
|
||||
png_byte sTER[5] = {115, 84, 69, 82, '\0'};
|
||||
|
||||
if (verbose)
|
||||
if (verbose != 0)
|
||||
fprintf(STDERR, "\n stereo mode = %d\n", user_chunk_data.sTER_mode);
|
||||
|
||||
png_write_chunk(write_ptr, sTER, &user_chunk_data.sTER_mode, 1);
|
||||
@ -747,7 +747,7 @@ write_vpAg_chunk(png_structp write_ptr)
|
||||
|
||||
png_byte vpag_chunk_data[9];
|
||||
|
||||
if (verbose)
|
||||
if (verbose != 0)
|
||||
fprintf(STDERR, " vpAg = %lu x %lu, units = %d\n",
|
||||
(unsigned long)user_chunk_data.vpAg_width,
|
||||
(unsigned long)user_chunk_data.vpAg_height,
|
||||
@ -938,7 +938,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (strict)
|
||||
if (strict != 0)
|
||||
{
|
||||
/* Treat png_benign_error() as errors on read */
|
||||
png_set_benign_errors(read_ptr, 0);
|
||||
@ -954,7 +954,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
*/
|
||||
}
|
||||
|
||||
else if (relaxed)
|
||||
else if (relaxed != 0)
|
||||
{
|
||||
/* Allow application (pngtest) errors and warnings to pass */
|
||||
png_set_benign_errors(read_ptr, 1);
|
||||
@ -1254,7 +1254,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
|
||||
pngtest_check_text_support(read_ptr, text_ptr, num_text);
|
||||
|
||||
if (verbose)
|
||||
if (verbose != 0)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -1320,7 +1320,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
int num_unknowns = png_get_unknown_chunks(read_ptr, read_info_ptr,
|
||||
&unknowns);
|
||||
|
||||
if (num_unknowns)
|
||||
if (num_unknowns != 0)
|
||||
{
|
||||
png_set_unknown_chunks(write_ptr, write_info_ptr, unknowns,
|
||||
num_unknowns);
|
||||
@ -1436,7 +1436,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
|
||||
pngtest_check_text_support(read_ptr, text_ptr, num_text);
|
||||
|
||||
if (verbose)
|
||||
if (verbose != 0)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -1479,7 +1479,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
int num_unknowns = png_get_unknown_chunks(read_ptr, end_info_ptr,
|
||||
&unknowns);
|
||||
|
||||
if (num_unknowns)
|
||||
if (num_unknowns != 0)
|
||||
{
|
||||
png_set_unknown_chunks(write_ptr, write_end_info_ptr, unknowns,
|
||||
num_unknowns);
|
||||
@ -1520,7 +1520,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
#endif
|
||||
|
||||
#ifdef PNG_EASY_ACCESS_SUPPORTED
|
||||
if (verbose)
|
||||
if (verbose != 0)
|
||||
{
|
||||
png_uint_32 iwidth, iheight;
|
||||
iwidth = png_get_image_width(write_ptr, write_info_ptr);
|
||||
@ -1598,7 +1598,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
}
|
||||
|
||||
#ifdef PNG_WRITE_SUPPORTED /* else nothing was written */
|
||||
if (interlace_preserved) /* else the files will be changed */
|
||||
if (interlace_preserved != 0) /* else the files will be changed */
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
@ -1637,7 +1637,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (!num_in)
|
||||
if (num_in == 0)
|
||||
break;
|
||||
|
||||
if (memcmp(inbuf, outbuf, num_in))
|
||||
@ -1794,7 +1794,7 @@ main(int argc, char *argv[])
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (multiple)
|
||||
if (multiple != 0)
|
||||
{
|
||||
int i;
|
||||
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
|
||||
|
12
pngtrans.c
12
pngtrans.c
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||
*
|
||||
* Last changed in libpng 1.5.11 [June 14, 2012]
|
||||
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.5.19 [(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.)
|
||||
*
|
||||
@ -452,7 +452,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
||||
{
|
||||
if (row_info->bit_depth == 8)
|
||||
{
|
||||
if (at_start) /* Skip initial filler */
|
||||
if (at_start != 0) /* Skip initial filler */
|
||||
++sp;
|
||||
else /* Skip initial channel and, for sp, the filler */
|
||||
sp += 2, ++dp;
|
||||
@ -466,7 +466,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
||||
|
||||
else if (row_info->bit_depth == 16)
|
||||
{
|
||||
if (at_start) /* Skip initial filler */
|
||||
if (at_start != 0) /* Skip initial filler */
|
||||
sp += 2;
|
||||
else /* Skip initial channel and, for sp, the filler */
|
||||
sp += 4, dp += 2;
|
||||
@ -492,7 +492,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
||||
{
|
||||
if (row_info->bit_depth == 8)
|
||||
{
|
||||
if (at_start) /* Skip initial filler */
|
||||
if (at_start != 0) /* Skip initial filler */
|
||||
++sp;
|
||||
else /* Skip initial channels and, for sp, the filler */
|
||||
sp += 4, dp += 3;
|
||||
@ -506,7 +506,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
||||
|
||||
else if (row_info->bit_depth == 16)
|
||||
{
|
||||
if (at_start) /* Skip initial filler */
|
||||
if (at_start != 0) /* Skip initial filler */
|
||||
sp += 2;
|
||||
else /* Skip initial channels and, for sp, the filler */
|
||||
sp += 8, dp += 6;
|
||||
|
@ -521,7 +521,7 @@ png_create_write_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
/* Initialize zbuf - compression buffer */
|
||||
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
|
||||
|
||||
if (!png_cleanup_needed)
|
||||
if (png_cleanup_needed == 0)
|
||||
{
|
||||
png_ptr->zbuf = (png_bytep)png_malloc_warn(png_ptr,
|
||||
png_ptr->zbuf_size);
|
||||
@ -529,7 +529,7 @@ png_create_write_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
png_cleanup_needed = 1;
|
||||
}
|
||||
|
||||
if (png_cleanup_needed)
|
||||
if (png_cleanup_needed != 0)
|
||||
{
|
||||
/* Clean up PNG structure and deallocate any memory. */
|
||||
png_free(png_ptr, png_ptr->zbuf);
|
||||
@ -765,7 +765,7 @@ png_write_row(png_structp 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;
|
||||
@ -865,7 +865,7 @@ png_write_flush(png_structp png_ptr)
|
||||
png_error(png_ptr, "zlib error");
|
||||
}
|
||||
|
||||
if (!(png_ptr->zstream.avail_out))
|
||||
if ((png_ptr->zstream.avail_out) == 0)
|
||||
{
|
||||
/* Write the IDAT and reset the zlib output buffer */
|
||||
png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size);
|
||||
|
12
pngwutil.c
12
pngwutil.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwutil.c - utilities to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.5.18 [February 6, 2014]
|
||||
* Last changed in libpng 1.5.19 [(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.)
|
||||
@ -825,7 +825,7 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
|
||||
png_ptr->zstream.zfree = png_zfree;
|
||||
png_ptr->zstream.opaque = (voidpf)png_ptr;
|
||||
|
||||
if (!(png_ptr->do_filter))
|
||||
if ((png_ptr->do_filter) == PNG_NO_FILTERS)
|
||||
{
|
||||
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE ||
|
||||
png_ptr->bit_depth < 8)
|
||||
@ -1149,7 +1149,7 @@ png_write_iCCP(png_structp png_ptr, png_const_charp name, int compression_type,
|
||||
profile_len = embedded_profile_len;
|
||||
}
|
||||
|
||||
if (profile_len)
|
||||
if (profile_len != 0)
|
||||
profile_len = png_text_compress(png_ptr, profile,
|
||||
(png_size_t)profile_len, PNG_COMPRESSION_TYPE_BASE, &comp);
|
||||
|
||||
@ -1162,7 +1162,7 @@ png_write_iCCP(png_structp png_ptr, png_const_charp name, int compression_type,
|
||||
png_write_chunk_data(png_ptr, (png_bytep)new_name,
|
||||
(png_size_t)(name_len + 2));
|
||||
|
||||
if (profile_len)
|
||||
if (profile_len != 0)
|
||||
{
|
||||
png_write_compressed_data_out(png_ptr, &comp, profile_len);
|
||||
}
|
||||
@ -1620,7 +1620,7 @@ png_check_keyword(png_structp png_ptr, png_const_charp key, png_charpp new_key)
|
||||
}
|
||||
}
|
||||
*dp = '\0';
|
||||
if (kwarn)
|
||||
if (kwarn != 0)
|
||||
png_warning(png_ptr, "extra interior spaces removed from keyword");
|
||||
|
||||
if (key_len == 0)
|
||||
@ -1672,7 +1672,7 @@ png_write_tEXt(png_structp png_ptr, png_const_charp key, png_const_charp text,
|
||||
png_write_chunk_data(png_ptr, (png_bytep)new_key,
|
||||
(png_size_t)(key_len + 1));
|
||||
|
||||
if (text_len)
|
||||
if (text_len != 0)
|
||||
png_write_chunk_data(png_ptr, (png_const_bytep)text,
|
||||
(png_size_t)text_len);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user