mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng17] Use "if (value != 0)" instead of "if (value)" consistently.
This commit is contained in:
parent
88e7d62fbc
commit
4e61b58980
5
ANNOUNCE
5
ANNOUNCE
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
Libpng 1.7.0beta34 - February 27, 2014
|
Libpng 1.7.0beta34 - March 8, 2014
|
||||||
|
|
||||||
This is not intended to be a public release. It will be replaced
|
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.
|
within a few weeks by a public version or by another test version.
|
||||||
@ -565,9 +565,10 @@ Version 1.7.0beta33 [February 27, 2014]
|
|||||||
Fixed typos in the manual and in scripts/pnglibconf.dfa (CFLAGS -> CPPFLAGS
|
Fixed typos in the manual and in scripts/pnglibconf.dfa (CFLAGS -> CPPFLAGS
|
||||||
and PNG_USR_CONFIG -> PNG_USER_CONFIG).
|
and PNG_USR_CONFIG -> PNG_USER_CONFIG).
|
||||||
|
|
||||||
Version 1.7.0beta34 [February 27, 2014]
|
Version 1.7.0beta34 [March 8, 2014]
|
||||||
Treat CRC error handling with png_set_crc_action(), instead of with
|
Treat CRC error handling with png_set_crc_action(), instead of with
|
||||||
png_set_benign_errors(), which has been the case since libpng-1.6.0beta18.
|
png_set_benign_errors(), which has been the case since libpng-1.6.0beta18.
|
||||||
|
Use "if (value != 0)" instead of "if (value)" consistently.
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
(subscription required; visit
|
||||||
|
|||||||
3
CHANGES
3
CHANGES
@ -4854,9 +4854,10 @@ Version 1.7.0beta33 [February 27, 2014]
|
|||||||
Fixed typos in the manual and in scripts/pnglibconf.dfa (CFLAGS -> CPPFLAGS
|
Fixed typos in the manual and in scripts/pnglibconf.dfa (CFLAGS -> CPPFLAGS
|
||||||
and PNG_USR_CONFIG -> PNG_USER_CONFIG).
|
and PNG_USR_CONFIG -> PNG_USER_CONFIG).
|
||||||
|
|
||||||
Version 1.7.0beta34 [February 27, 2014]
|
Version 1.7.0beta34 [March 8, 2014]
|
||||||
Treat CRC error handling with png_set_crc_action(), instead of with
|
Treat CRC error handling with png_set_crc_action(), instead of with
|
||||||
png_set_benign_errors(), which has been the case since libpng-1.6.0beta18.
|
png_set_benign_errors(), which has been the case since libpng-1.6.0beta18.
|
||||||
|
Use "if (value != 0)" instead of "if (value)" consistently.
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
(subscription required; visit
|
||||||
|
|||||||
@ -970,7 +970,7 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
png_set_packswap(png_ptr);
|
png_set_packswap(png_ptr);
|
||||||
|
|
||||||
/* Turn on interlace handling if you are not using png_write_image() */
|
/* 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);
|
number_passes = png_set_interlace_handling(png_ptr);
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
libpng-manual.txt - A description on how to use and modify libpng
|
libpng-manual.txt - A description on how to use and modify libpng
|
||||||
|
|
||||||
libpng version 1.7.0beta34 - February 27, 2014
|
libpng version 1.7.0beta34 - March 8, 2014
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
<glennrp at users.sourceforge.net>
|
<glennrp at users.sourceforge.net>
|
||||||
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
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:
|
Based on:
|
||||||
|
|
||||||
libpng versions 0.97, January 1998, through 1.7.0beta34 - February 27, 2014
|
libpng versions 0.97, January 1998, through 1.7.0beta34 - March 8, 2014
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||||
|
|
||||||
@ -277,8 +277,8 @@ pngusr.dfa in these directories.
|
|||||||
|
|
||||||
C. Configuration using PNG_USER_CONFIG
|
C. Configuration using PNG_USER_CONFIG
|
||||||
|
|
||||||
If -DPNG_USER_CONFIG is added to the CPPFLAGS when pnglibconf.h is built the file
|
If -DPNG_USER_CONFIG is added to the CPPFLAGS when pnglibconf.h is built,
|
||||||
pngusr.h will automatically be included before the options in
|
the file pngusr.h will automatically be included before the options in
|
||||||
scripts/pnglibconf.dfa are processed. Your pngusr.h file should contain only
|
scripts/pnglibconf.dfa are processed. Your pngusr.h file should contain only
|
||||||
macro definitions turning features on or off or setting settings.
|
macro definitions turning features on or off or setting settings.
|
||||||
|
|
||||||
@ -428,7 +428,7 @@ an end_info structure.
|
|||||||
|
|
||||||
If you would rather avoid the complexity of setjmp/longjmp issues,
|
If you would rather avoid the complexity of setjmp/longjmp issues,
|
||||||
you can compile libpng with PNG_NO_SETJMP, in which case
|
you can compile libpng with PNG_NO_SETJMP, in which case
|
||||||
errors will result in a call to PNG_ABORT() which defaults to abort().
|
errors will result in a call to PNG_ABORT which defaults to abort().
|
||||||
|
|
||||||
You can #define PNG_ABORT to a function or other C code that does something
|
You can #define PNG_ABORT to a function or other C code that does something
|
||||||
more useful than abort(), as long as your function does not
|
more useful than abort(), as long as your function does not
|
||||||
@ -1160,7 +1160,7 @@ where row_pointers is an array of pointers to the pixel data for each row:
|
|||||||
If you know your image size and pixel size ahead of time, you can allocate
|
If you know your image size and pixel size ahead of time, you can allocate
|
||||||
row_pointers prior to calling png_read_png() with
|
row_pointers prior to calling png_read_png() with
|
||||||
|
|
||||||
if (height > PNG_UINT_32_MAX/(sizeof (png_byte))
|
if (height > PNG_UINT_32_MAX/(sizeof (png_byte)))
|
||||||
png_error (png_ptr,
|
png_error (png_ptr,
|
||||||
"Image is too tall to process in memory");
|
"Image is too tall to process in memory");
|
||||||
|
|
||||||
@ -2741,8 +2741,7 @@ you can compile libpng with PNG_NO_SETJMP, in which case
|
|||||||
errors will result in a call to PNG_ABORT which defaults to abort().
|
errors will result in a call to PNG_ABORT which defaults to abort().
|
||||||
|
|
||||||
You can #define PNG_ABORT to a function or other C code that does something
|
You can #define PNG_ABORT to a function or other C code that does something
|
||||||
more useful than abort(), as long as your function does not
|
more useful than abort(), as long as your function does not return.
|
||||||
return.
|
|
||||||
|
|
||||||
Checking for invalid palette index on write was added at libpng
|
Checking for invalid palette index on write was added at libpng
|
||||||
1.5.10. If a pixel contains an invalid (out-of-range) index libpng issues
|
1.5.10. If a pixel contains an invalid (out-of-range) index libpng issues
|
||||||
@ -5173,7 +5172,6 @@ The following API are now DEPRECATED:
|
|||||||
png_info_init_3()
|
png_info_init_3()
|
||||||
png_convert_to_rfc1123() which has been replaced
|
png_convert_to_rfc1123() which has been replaced
|
||||||
with png_convert_to_rfc1123_buffer()
|
with png_convert_to_rfc1123_buffer()
|
||||||
png_data_freer()
|
|
||||||
png_malloc_default()
|
png_malloc_default()
|
||||||
png_free_default()
|
png_free_default()
|
||||||
png_reset_zstream()
|
png_reset_zstream()
|
||||||
@ -5382,6 +5380,9 @@ exported functions are marked with PNGAPI:
|
|||||||
body;
|
body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
The return type and decorations are placed on a separate line
|
||||||
|
ahead of the function name, as illustrated above.
|
||||||
|
|
||||||
The prototypes for all exported functions appear in png.h,
|
The prototypes for all exported functions appear in png.h,
|
||||||
above the comment that says
|
above the comment that says
|
||||||
|
|
||||||
@ -5438,6 +5439,9 @@ with an even number of lower-case hex digits (e.g., 0x00, 0xff, 0x0100).
|
|||||||
We prefer to use underscores in variable names rather than camelCase, except
|
We prefer to use underscores in variable names rather than camelCase, except
|
||||||
for a few type names that we inherit from zlib.h.
|
for a few type names that we inherit from zlib.h.
|
||||||
|
|
||||||
|
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.
|
We do not use the TAB character for indentation in the C sources.
|
||||||
|
|
||||||
Lines do not exceed 80 characters.
|
Lines do not exceed 80 characters.
|
||||||
@ -5446,7 +5450,7 @@ Other rules can be inferred by inspecting the libpng source.
|
|||||||
|
|
||||||
XVII. Y2K Compliance in libpng
|
XVII. Y2K Compliance in libpng
|
||||||
|
|
||||||
February 27, 2014
|
March 8, 2014
|
||||||
|
|
||||||
Since the PNG Development group is an ad-hoc body, we can't make
|
Since the PNG Development group is an ad-hoc body, we can't make
|
||||||
an official declaration.
|
an official declaration.
|
||||||
|
|||||||
32
libpng.3
32
libpng.3
@ -1,4 +1,4 @@
|
|||||||
.TH LIBPNG 3 "February 27, 2014"
|
.TH LIBPNG 3 "March 8, 2014"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.7.0beta34
|
libpng \- Portable Network Graphics (PNG) Reference Library 1.7.0beta34
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@ -494,7 +494,7 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng.
|
|||||||
.SH LIBPNG.TXT
|
.SH LIBPNG.TXT
|
||||||
libpng-manual.txt - A description on how to use and modify libpng
|
libpng-manual.txt - A description on how to use and modify libpng
|
||||||
|
|
||||||
libpng version 1.7.0beta34 - February 27, 2014
|
libpng version 1.7.0beta34 - March 8, 2014
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
<glennrp at users.sourceforge.net>
|
<glennrp at users.sourceforge.net>
|
||||||
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||||
@ -505,7 +505,7 @@ libpng-manual.txt - A description on how to use and modify libpng
|
|||||||
|
|
||||||
Based on:
|
Based on:
|
||||||
|
|
||||||
libpng versions 0.97, January 1998, through 1.7.0beta34 - February 27, 2014
|
libpng versions 0.97, January 1998, through 1.7.0beta34 - March 8, 2014
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||||
|
|
||||||
@ -771,8 +771,8 @@ pngusr.dfa in these directories.
|
|||||||
|
|
||||||
C. Configuration using PNG_USER_CONFIG
|
C. Configuration using PNG_USER_CONFIG
|
||||||
|
|
||||||
If \-DPNG_USER_CONFIG is added to the CPPFLAGS when pnglibconf.h is built the file
|
If \-DPNG_USER_CONFIG is added to the CPPFLAGS when pnglibconf.h is built,
|
||||||
pngusr.h will automatically be included before the options in
|
the file pngusr.h will automatically be included before the options in
|
||||||
scripts/pnglibconf.dfa are processed. Your pngusr.h file should contain only
|
scripts/pnglibconf.dfa are processed. Your pngusr.h file should contain only
|
||||||
macro definitions turning features on or off or setting settings.
|
macro definitions turning features on or off or setting settings.
|
||||||
|
|
||||||
@ -922,7 +922,7 @@ an end_info structure.
|
|||||||
|
|
||||||
If you would rather avoid the complexity of setjmp/longjmp issues,
|
If you would rather avoid the complexity of setjmp/longjmp issues,
|
||||||
you can compile libpng with PNG_NO_SETJMP, in which case
|
you can compile libpng with PNG_NO_SETJMP, in which case
|
||||||
errors will result in a call to PNG_ABORT() which defaults to abort().
|
errors will result in a call to PNG_ABORT which defaults to abort().
|
||||||
|
|
||||||
You can #define PNG_ABORT to a function or other C code that does something
|
You can #define PNG_ABORT to a function or other C code that does something
|
||||||
more useful than abort(), as long as your function does not
|
more useful than abort(), as long as your function does not
|
||||||
@ -1654,7 +1654,7 @@ where row_pointers is an array of pointers to the pixel data for each row:
|
|||||||
If you know your image size and pixel size ahead of time, you can allocate
|
If you know your image size and pixel size ahead of time, you can allocate
|
||||||
row_pointers prior to calling png_read_png() with
|
row_pointers prior to calling png_read_png() with
|
||||||
|
|
||||||
if (height > PNG_UINT_32_MAX/(sizeof (png_byte))
|
if (height > PNG_UINT_32_MAX/(sizeof (png_byte)))
|
||||||
png_error (png_ptr,
|
png_error (png_ptr,
|
||||||
"Image is too tall to process in memory");
|
"Image is too tall to process in memory");
|
||||||
|
|
||||||
@ -3235,8 +3235,7 @@ you can compile libpng with PNG_NO_SETJMP, in which case
|
|||||||
errors will result in a call to PNG_ABORT which defaults to abort().
|
errors will result in a call to PNG_ABORT which defaults to abort().
|
||||||
|
|
||||||
You can #define PNG_ABORT to a function or other C code that does something
|
You can #define PNG_ABORT to a function or other C code that does something
|
||||||
more useful than abort(), as long as your function does not
|
more useful than abort(), as long as your function does not return.
|
||||||
return.
|
|
||||||
|
|
||||||
Checking for invalid palette index on write was added at libpng
|
Checking for invalid palette index on write was added at libpng
|
||||||
1.5.10. If a pixel contains an invalid (out-of-range) index libpng issues
|
1.5.10. If a pixel contains an invalid (out-of-range) index libpng issues
|
||||||
@ -5668,7 +5667,6 @@ The following API are now DEPRECATED:
|
|||||||
png_info_init_3()
|
png_info_init_3()
|
||||||
png_convert_to_rfc1123() which has been replaced
|
png_convert_to_rfc1123() which has been replaced
|
||||||
with png_convert_to_rfc1123_buffer()
|
with png_convert_to_rfc1123_buffer()
|
||||||
png_data_freer()
|
|
||||||
png_malloc_default()
|
png_malloc_default()
|
||||||
png_free_default()
|
png_free_default()
|
||||||
png_reset_zstream()
|
png_reset_zstream()
|
||||||
@ -5877,6 +5875,9 @@ exported functions are marked with PNGAPI:
|
|||||||
body;
|
body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
The return type and decorations are placed on a separate line
|
||||||
|
ahead of the function name, as illustrated above.
|
||||||
|
|
||||||
The prototypes for all exported functions appear in png.h,
|
The prototypes for all exported functions appear in png.h,
|
||||||
above the comment that says
|
above the comment that says
|
||||||
|
|
||||||
@ -5933,6 +5934,9 @@ with an even number of lower-case hex digits (e.g., 0x00, 0xff, 0x0100).
|
|||||||
We prefer to use underscores in variable names rather than camelCase, except
|
We prefer to use underscores in variable names rather than camelCase, except
|
||||||
for a few type names that we inherit from zlib.h.
|
for a few type names that we inherit from zlib.h.
|
||||||
|
|
||||||
|
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.
|
We do not use the TAB character for indentation in the C sources.
|
||||||
|
|
||||||
Lines do not exceed 80 characters.
|
Lines do not exceed 80 characters.
|
||||||
@ -5941,7 +5945,7 @@ Other rules can be inferred by inspecting the libpng source.
|
|||||||
|
|
||||||
.SH XVII. Y2K Compliance in libpng
|
.SH XVII. Y2K Compliance in libpng
|
||||||
|
|
||||||
February 27, 2014
|
March 8, 2014
|
||||||
|
|
||||||
Since the PNG Development group is an ad-hoc body, we can't make
|
Since the PNG Development group is an ad-hoc body, we can't make
|
||||||
an official declaration.
|
an official declaration.
|
||||||
@ -6211,7 +6215,7 @@ possible without all of you.
|
|||||||
|
|
||||||
Thanks to Frank J. T. Wojcik for helping with the documentation.
|
Thanks to Frank J. T. Wojcik for helping with the documentation.
|
||||||
|
|
||||||
Libpng version 1.7.0beta34 - February 27, 2014:
|
Libpng version 1.7.0beta34 - March 8, 2014:
|
||||||
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
|
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
|
||||||
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
|
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
|
||||||
|
|
||||||
@ -6234,7 +6238,7 @@ this sentence.
|
|||||||
|
|
||||||
This code is released under the libpng license.
|
This code is released under the libpng license.
|
||||||
|
|
||||||
libpng versions 1.2.6, August 15, 2004, through 1.7.0beta34, February 27, 2014, are
|
libpng versions 1.2.6, August 15, 2004, through 1.7.0beta34, March 8, 2014, are
|
||||||
Copyright (c) 2004,2006-2007 Glenn Randers-Pehrson, and are
|
Copyright (c) 2004,2006-2007 Glenn Randers-Pehrson, and are
|
||||||
distributed according to the same disclaimer and license as libpng-1.2.5
|
distributed according to the same disclaimer and license as libpng-1.2.5
|
||||||
with the following individual added to the list of Contributing Authors
|
with the following individual added to the list of Contributing Authors
|
||||||
@ -6333,7 +6337,7 @@ certification mark of the Open Source Initiative.
|
|||||||
|
|
||||||
Glenn Randers-Pehrson
|
Glenn Randers-Pehrson
|
||||||
glennrp at users.sourceforge.net
|
glennrp at users.sourceforge.net
|
||||||
February 27, 2014
|
March 8, 2014
|
||||||
|
|
||||||
.\" end of man page
|
.\" end of man page
|
||||||
|
|
||||||
|
|||||||
24
png.c
24
png.c
@ -165,7 +165,7 @@ png_calculate_crc(png_structrp png_ptr, png_const_bytep ptr, png_size_t length)
|
|||||||
int
|
int
|
||||||
png_user_version_check(png_structrp png_ptr, png_const_charp user_png_ver)
|
png_user_version_check(png_structrp png_ptr, png_const_charp user_png_ver)
|
||||||
{
|
{
|
||||||
if (user_png_ver)
|
if (user_png_ver != NULL)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
@ -696,13 +696,13 @@ png_get_copyright(png_const_structrp png_ptr)
|
|||||||
#else
|
#else
|
||||||
# ifdef __STDC__
|
# ifdef __STDC__
|
||||||
return PNG_STRING_NEWLINE \
|
return PNG_STRING_NEWLINE \
|
||||||
"libpng version 1.7.0beta34 - February 27, 2014" PNG_STRING_NEWLINE \
|
"libpng version 1.7.0beta34 - March 8, 2014" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
|
"Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
||||||
PNG_STRING_NEWLINE;
|
PNG_STRING_NEWLINE;
|
||||||
# else
|
# else
|
||||||
return "libpng version 1.7.0beta34 - February 27, 2014\
|
return "libpng version 1.7.0beta34 - March 8, 2014\
|
||||||
Copyright (c) 1998-2014 Glenn Randers-Pehrson\
|
Copyright (c) 1998-2014 Glenn Randers-Pehrson\
|
||||||
Copyright (c) 1996-1997 Andreas Dilger\
|
Copyright (c) 1996-1997 Andreas Dilger\
|
||||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
|
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
|
||||||
@ -1466,10 +1466,10 @@ png_colorspace_check_xy(png_XYZ *XYZ, const png_xy *xy)
|
|||||||
|
|
||||||
/* As a side-effect this routine also returns the XYZ endpoints. */
|
/* As a side-effect this routine also returns the XYZ endpoints. */
|
||||||
result = png_XYZ_from_xy(XYZ, xy);
|
result = png_XYZ_from_xy(XYZ, xy);
|
||||||
if (result) return result;
|
if (result != 0) return result;
|
||||||
|
|
||||||
result = png_xy_from_XYZ(&xy_test, XYZ);
|
result = png_xy_from_XYZ(&xy_test, XYZ);
|
||||||
if (result) return result;
|
if (result != 0) return result;
|
||||||
|
|
||||||
if (png_colorspace_endpoints_match(xy, &xy_test,
|
if (png_colorspace_endpoints_match(xy, &xy_test,
|
||||||
5/*actually, the math is pretty accurate*/))
|
5/*actually, the math is pretty accurate*/))
|
||||||
@ -1489,10 +1489,10 @@ png_colorspace_check_XYZ(png_xy *xy, png_XYZ *XYZ)
|
|||||||
png_XYZ XYZtemp;
|
png_XYZ XYZtemp;
|
||||||
|
|
||||||
result = png_XYZ_normalize(XYZ);
|
result = png_XYZ_normalize(XYZ);
|
||||||
if (result) return result;
|
if (result != 0) return result;
|
||||||
|
|
||||||
result = png_xy_from_XYZ(xy, XYZ);
|
result = png_xy_from_XYZ(xy, XYZ);
|
||||||
if (result) return result;
|
if (result != 0) return result;
|
||||||
|
|
||||||
XYZtemp = *XYZ;
|
XYZtemp = *XYZ;
|
||||||
return png_colorspace_check_xy(&XYZtemp, xy);
|
return png_colorspace_check_xy(&XYZtemp, xy);
|
||||||
@ -1533,7 +1533,7 @@ png_colorspace_set_xy_and_XYZ(png_const_structrp png_ptr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Only overwrite with preferred values */
|
/* Only overwrite with preferred values */
|
||||||
if (!preferred)
|
if (preferred == 0)
|
||||||
return 1; /* ok, but no change */
|
return 1; /* ok, but no change */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2644,7 +2644,7 @@ png_pow10(int power)
|
|||||||
}
|
}
|
||||||
while (power > 0);
|
while (power > 0);
|
||||||
|
|
||||||
if (recip) d = 1/d;
|
if (recip != 0) d = 1/d;
|
||||||
}
|
}
|
||||||
/* else power is 0 and d is 1 */
|
/* else power is 0 and d is 1 */
|
||||||
|
|
||||||
@ -3175,7 +3175,7 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
|
|||||||
if (s00 >= (D >> 1))
|
if (s00 >= (D >> 1))
|
||||||
++result;
|
++result;
|
||||||
|
|
||||||
if (negative)
|
if (negative != 0)
|
||||||
result = -result;
|
result = -result;
|
||||||
|
|
||||||
/* Check for overflow. */
|
/* Check for overflow. */
|
||||||
@ -3877,7 +3877,7 @@ png_build_gamma_table(png_structrp png_ptr, png_fixed_point gamma_val,
|
|||||||
*/
|
*/
|
||||||
data.adjust = output > PNG_GAMMA_TABLE_8;
|
data.adjust = output > PNG_GAMMA_TABLE_8;
|
||||||
|
|
||||||
if (use_shift)
|
if (use_shift != 0)
|
||||||
{
|
{
|
||||||
/* The multiplier does the shift: */
|
/* The multiplier does the shift: */
|
||||||
data.mult = 1U << (8-input_depth);
|
data.mult = 1U << (8-input_depth);
|
||||||
@ -3901,7 +3901,7 @@ png_build_gamma_table(png_structrp png_ptr, png_fixed_point gamma_val,
|
|||||||
*/
|
*/
|
||||||
data.adjust = output == PNG_GAMMA_TABLE_8;
|
data.adjust = output == PNG_GAMMA_TABLE_8;
|
||||||
|
|
||||||
if (use_shift)
|
if (use_shift != 0)
|
||||||
{
|
{
|
||||||
data.mult = 1U << (16-input_depth);
|
data.mult = 1U << (16-input_depth);
|
||||||
data.add = 0;
|
data.add = 0;
|
||||||
|
|||||||
@ -195,7 +195,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
|
* drop the decimal point. If the number is a true zero handle that
|
||||||
* here.
|
* here.
|
||||||
*/
|
*/
|
||||||
if (output)
|
if (output != 0)
|
||||||
*--end = '.';
|
*--end = '.';
|
||||||
else if (number == 0) /* and !output */
|
else if (number == 0) /* and !output */
|
||||||
*--end = '0';
|
*--end = '0';
|
||||||
@ -949,7 +949,7 @@ png_safe_execute(png_imagep image_in, int (*function)(png_voidp), png_voidp arg)
|
|||||||
saved_error_buf = image->opaque->error_buf;
|
saved_error_buf = image->opaque->error_buf;
|
||||||
result = setjmp(safe_jmpbuf) == 0;
|
result = setjmp(safe_jmpbuf) == 0;
|
||||||
|
|
||||||
if (result)
|
if (result != 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
image->opaque->error_buf = safe_jmpbuf;
|
image->opaque->error_buf = safe_jmpbuf;
|
||||||
@ -959,7 +959,7 @@ png_safe_execute(png_imagep image_in, int (*function)(png_voidp), png_voidp arg)
|
|||||||
image->opaque->error_buf = saved_error_buf;
|
image->opaque->error_buf = saved_error_buf;
|
||||||
|
|
||||||
/* And do the cleanup prior to any failure return. */
|
/* And do the cleanup prior to any failure return. */
|
||||||
if (!result)
|
if (result == 0)
|
||||||
png_image_free(image);
|
png_image_free(image);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
4
pngget.c
4
pngget.c
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngget.c - retrieval of values from info struct
|
/* pngget.c - retrieval of values from info struct
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.1 [March 28, 2013]
|
* Last changed in libpng 1.7.0 [(PENDING RELEASE)]
|
||||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
|
|||||||
@ -49,7 +49,7 @@ png_process_data_pause(png_structrp png_ptr, int save)
|
|||||||
/* It's easiest for the caller if we do the save, then the caller doesn't
|
/* It's easiest for the caller if we do the save, then the caller doesn't
|
||||||
* have to supply the same data again:
|
* have to supply the same data again:
|
||||||
*/
|
*/
|
||||||
if (save)
|
if (save != 0)
|
||||||
png_push_save_buffer(png_ptr);
|
png_push_save_buffer(png_ptr);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
28
pngread.c
28
pngread.c
@ -1788,7 +1788,7 @@ png_create_colormap_entry(png_image_read_control *display,
|
|||||||
/* This is set if the color isn't gray but the output is. */
|
/* This is set if the color isn't gray but the output is. */
|
||||||
if (encoding == P_LINEAR)
|
if (encoding == P_LINEAR)
|
||||||
{
|
{
|
||||||
if (convert_to_Y)
|
if (convert_to_Y != 0)
|
||||||
{
|
{
|
||||||
/* NOTE: these values are copied from png_do_rgb_to_gray */
|
/* NOTE: these values are copied from png_do_rgb_to_gray */
|
||||||
png_uint_32 y = (png_uint_32)6968 * red + (png_uint_32)23434 * green +
|
png_uint_32 y = (png_uint_32)6968 * red + (png_uint_32)23434 * green +
|
||||||
@ -3586,7 +3586,7 @@ png_image_read_background(png_voidp argument)
|
|||||||
component = 0;
|
component = 0;
|
||||||
|
|
||||||
outrow[swap_alpha] = (png_uint_16)component;
|
outrow[swap_alpha] = (png_uint_16)component;
|
||||||
if (preserve_alpha)
|
if (preserve_alpha != 0)
|
||||||
outrow[1 ^ swap_alpha] = alpha;
|
outrow[1 ^ swap_alpha] = alpha;
|
||||||
|
|
||||||
inrow += 2; /* components and alpha channel */
|
inrow += 2; /* components and alpha channel */
|
||||||
@ -3679,7 +3679,7 @@ png_image_read_direct(png_voidp argument)
|
|||||||
png_set_alpha_mode_fixed(png_ptr, PNG_ALPHA_PNG, input_gamma_default);
|
png_set_alpha_mode_fixed(png_ptr, PNG_ALPHA_PNG, input_gamma_default);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (linear)
|
if (linear != 0)
|
||||||
{
|
{
|
||||||
/* If there *is* an alpha channel in the input it must be multiplied
|
/* If there *is* an alpha channel in the input it must be multiplied
|
||||||
* out; use PNG_ALPHA_STANDARD, otherwise just use PNG_ALPHA_PNG.
|
* out; use PNG_ALPHA_STANDARD, otherwise just use PNG_ALPHA_PNG.
|
||||||
@ -3705,7 +3705,7 @@ png_image_read_direct(png_voidp argument)
|
|||||||
*
|
*
|
||||||
* TODO: fix libpng and remove this.
|
* TODO: fix libpng and remove this.
|
||||||
*/
|
*/
|
||||||
if (do_local_background)
|
if (do_local_background != 0)
|
||||||
{
|
{
|
||||||
png_fixed_point gtest;
|
png_fixed_point gtest;
|
||||||
|
|
||||||
@ -3753,11 +3753,11 @@ png_image_read_direct(png_voidp argument)
|
|||||||
*
|
*
|
||||||
* TODO: fix libpng and remove this.
|
* TODO: fix libpng and remove this.
|
||||||
*/
|
*/
|
||||||
if (do_local_background)
|
if (do_local_background != 0)
|
||||||
do_local_background = 2/*required*/;
|
do_local_background = 2/*required*/;
|
||||||
|
|
||||||
/* 16-bit output: just remove the channel */
|
/* 16-bit output: just remove the channel */
|
||||||
else if (linear) /* compose on black (well, pre-multiply) */
|
else if (linear != 0) /* compose on black (well, pre-multiply) */
|
||||||
png_set_strip_alpha(png_ptr);
|
png_set_strip_alpha(png_ptr);
|
||||||
|
|
||||||
/* 8-bit output: do an appropriate compose */
|
/* 8-bit output: do an appropriate compose */
|
||||||
@ -3804,7 +3804,7 @@ png_image_read_direct(png_voidp argument)
|
|||||||
png_uint_32 filler; /* opaque filler */
|
png_uint_32 filler; /* opaque filler */
|
||||||
int where;
|
int where;
|
||||||
|
|
||||||
if (linear)
|
if (linear != 0)
|
||||||
filler = 65535;
|
filler = 65535;
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -3877,7 +3877,7 @@ png_image_read_direct(png_voidp argument)
|
|||||||
/* If the *output* is 16-bit then we need to check for a byte-swap on this
|
/* If the *output* is 16-bit then we need to check for a byte-swap on this
|
||||||
* architecture.
|
* architecture.
|
||||||
*/
|
*/
|
||||||
if (linear)
|
if (linear != 0)
|
||||||
{
|
{
|
||||||
PNG_CONST png_uint_16 le = 0x0001;
|
PNG_CONST png_uint_16 le = 0x0001;
|
||||||
|
|
||||||
@ -3886,7 +3886,7 @@ png_image_read_direct(png_voidp argument)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If change is not now 0 some transformation is missing - error out. */
|
/* If change is not now 0 some transformation is missing - error out. */
|
||||||
if (change)
|
if (change != 0)
|
||||||
png_error(png_ptr, "png_read_image: unsupported transformation");
|
png_error(png_ptr, "png_read_image: unsupported transformation");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3898,7 +3898,7 @@ png_image_read_direct(png_voidp argument)
|
|||||||
*
|
*
|
||||||
* TODO: remove the do_local_background fixup below.
|
* TODO: remove the do_local_background fixup below.
|
||||||
*/
|
*/
|
||||||
if (!do_local_compose && do_local_background != 2)
|
if (do_local_compose == 0 && do_local_background != 2)
|
||||||
passes = png_set_interlace_handling(png_ptr);
|
passes = png_set_interlace_handling(png_ptr);
|
||||||
|
|
||||||
png_read_update_info(png_ptr, info_ptr);
|
png_read_update_info(png_ptr, info_ptr);
|
||||||
@ -3912,7 +3912,7 @@ png_image_read_direct(png_voidp argument)
|
|||||||
if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
|
if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
|
||||||
{
|
{
|
||||||
/* do_local_compose removes this channel below. */
|
/* do_local_compose removes this channel below. */
|
||||||
if (!do_local_compose)
|
if (do_local_compose == 0)
|
||||||
{
|
{
|
||||||
/* do_local_background does the same if required. */
|
/* do_local_background does the same if required. */
|
||||||
if (do_local_background != 2 ||
|
if (do_local_background != 2 ||
|
||||||
@ -3921,7 +3921,7 @@ png_image_read_direct(png_voidp argument)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (do_local_compose) /* internal error */
|
else if (do_local_compose != 0) /* internal error */
|
||||||
png_error(png_ptr, "png_image_read: alpha channel lost");
|
png_error(png_ptr, "png_image_read: alpha channel lost");
|
||||||
|
|
||||||
if (info_ptr->bit_depth == 16)
|
if (info_ptr->bit_depth == 16)
|
||||||
@ -3964,7 +3964,7 @@ png_image_read_direct(png_voidp argument)
|
|||||||
png_voidp first_row = display->buffer;
|
png_voidp first_row = display->buffer;
|
||||||
ptrdiff_t row_bytes = display->row_stride;
|
ptrdiff_t row_bytes = display->row_stride;
|
||||||
|
|
||||||
if (linear)
|
if (linear != 0)
|
||||||
row_bytes *= 2;
|
row_bytes *= 2;
|
||||||
|
|
||||||
/* The following expression is designed to work correctly whether it gives
|
/* The following expression is designed to work correctly whether it gives
|
||||||
@ -3981,7 +3981,7 @@ png_image_read_direct(png_voidp argument)
|
|||||||
display->row_bytes = row_bytes;
|
display->row_bytes = row_bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_local_compose)
|
if (do_local_compose != 0)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
png_voidp row = png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr));
|
png_voidp row = png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr));
|
||||||
|
|||||||
2
pngrio.c
2
pngrio.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngrio.c - functions for data input
|
/* pngrio.c - functions for data input
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.9 [(PENDING RELEASE)]
|
* Last changed in libpng 1.6.9 [February 6, 2014]
|
||||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
|
|||||||
70
pngrtran.c
70
pngrtran.c
@ -146,7 +146,7 @@ png_set_background_fixed(png_structrp png_ptr,
|
|||||||
png_ptr->background_gamma = background_gamma;
|
png_ptr->background_gamma = background_gamma;
|
||||||
png_ptr->background_gamma_type = (png_byte)(background_gamma_code);
|
png_ptr->background_gamma_type = (png_byte)(background_gamma_code);
|
||||||
|
|
||||||
if (need_expand)
|
if (need_expand != 0)
|
||||||
png_ptr->flags |= PNG_FLAG_BACKGROUND_EXPAND;
|
png_ptr->flags |= PNG_FLAG_BACKGROUND_EXPAND;
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -230,7 +230,7 @@ translate_gamma_flags(png_structrp png_ptr, png_fixed_point output_gamma,
|
|||||||
# else
|
# else
|
||||||
PNG_UNUSED(png_ptr)
|
PNG_UNUSED(png_ptr)
|
||||||
# endif
|
# endif
|
||||||
if (is_screen)
|
if (is_screen != 0)
|
||||||
output_gamma = PNG_GAMMA_sRGB;
|
output_gamma = PNG_GAMMA_sRGB;
|
||||||
else
|
else
|
||||||
output_gamma = PNG_GAMMA_sRGB_INVERSE;
|
output_gamma = PNG_GAMMA_sRGB_INVERSE;
|
||||||
@ -239,7 +239,7 @@ translate_gamma_flags(png_structrp png_ptr, png_fixed_point output_gamma,
|
|||||||
else if (output_gamma == PNG_GAMMA_MAC_18 ||
|
else if (output_gamma == PNG_GAMMA_MAC_18 ||
|
||||||
output_gamma == PNG_FP_1 / 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;
|
output_gamma = PNG_GAMMA_MAC_OLD;
|
||||||
else
|
else
|
||||||
output_gamma = PNG_GAMMA_MAC_INVERSE;
|
output_gamma = PNG_GAMMA_MAC_INVERSE;
|
||||||
@ -361,7 +361,7 @@ png_set_alpha_mode_fixed(png_structrp png_ptr, int mode,
|
|||||||
/* Finally, if pre-multiplying, set the background fields to achieve the
|
/* Finally, if pre-multiplying, set the background fields to achieve the
|
||||||
* desired result.
|
* desired result.
|
||||||
*/
|
*/
|
||||||
if (compose)
|
if (compose != 0)
|
||||||
{
|
{
|
||||||
/* And obtain alpha pre-multiplication by composing on black: */
|
/* And obtain alpha pre-multiplication by composing on black: */
|
||||||
memset(&png_ptr->background, 0, (sizeof png_ptr->background));
|
memset(&png_ptr->background, 0, (sizeof png_ptr->background));
|
||||||
@ -418,7 +418,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
|||||||
|
|
||||||
png_ptr->transformations |= PNG_QUANTIZE;
|
png_ptr->transformations |= PNG_QUANTIZE;
|
||||||
|
|
||||||
if (!full_quantize)
|
if (full_quantize == 0)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -473,12 +473,12 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (done)
|
if (done != 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Swap the palette around, and set up a table, if necessary */
|
/* Swap the palette around, and set up a table, if necessary */
|
||||||
if (full_quantize)
|
if (full_quantize != 0)
|
||||||
{
|
{
|
||||||
int j = num_palette;
|
int j = num_palette;
|
||||||
|
|
||||||
@ -661,7 +661,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
|||||||
num_new_palette--;
|
num_new_palette--;
|
||||||
palette[png_ptr->index_to_palette[j]]
|
palette[png_ptr->index_to_palette[j]]
|
||||||
= palette[num_new_palette];
|
= palette[num_new_palette];
|
||||||
if (!full_quantize)
|
if (full_quantize == 0)
|
||||||
{
|
{
|
||||||
int k;
|
int k;
|
||||||
|
|
||||||
@ -729,7 +729,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
|||||||
}
|
}
|
||||||
png_ptr->num_palette = (png_uint_16)num_palette;
|
png_ptr->num_palette = (png_uint_16)num_palette;
|
||||||
|
|
||||||
if (full_quantize)
|
if (full_quantize != 0)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
png_bytep distance;
|
png_bytep distance;
|
||||||
@ -1181,7 +1181,7 @@ png_init_background_transformations(png_structrp png_ptr)
|
|||||||
* does not necessarily match the output the application gets, fix that and
|
* does not necessarily match the output the application gets, fix that and
|
||||||
* the color type here:
|
* the color type here:
|
||||||
*/
|
*/
|
||||||
if (!expand)
|
if (expand == 0)
|
||||||
{
|
{
|
||||||
/* The background bit_depth and color_type need correcting */
|
/* The background bit_depth and color_type need correcting */
|
||||||
if ((transform & PNG_EXPAND) != 0)
|
if ((transform & PNG_EXPAND) != 0)
|
||||||
@ -1372,7 +1372,7 @@ png_init_palette_transformations(png_structrp png_ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If no alpha we can optimize. */
|
/* If no alpha we can optimize. */
|
||||||
if (!input_has_alpha)
|
if (input_has_alpha == 0)
|
||||||
{
|
{
|
||||||
/* Any alpha means background and associative alpha processing is
|
/* Any alpha means background and associative alpha processing is
|
||||||
* required, however if the alpha is 0 or 1 throughout OPTIMIZE_ALPHA
|
* required, however if the alpha is 0 or 1 throughout OPTIMIZE_ALPHA
|
||||||
@ -1381,7 +1381,7 @@ png_init_palette_transformations(png_structrp png_ptr)
|
|||||||
png_ptr->transformations &= ~PNG_ENCODE_ALPHA;
|
png_ptr->transformations &= ~PNG_ENCODE_ALPHA;
|
||||||
png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA;
|
png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA;
|
||||||
|
|
||||||
if (!input_has_transparency)
|
if (input_has_transparency == 0)
|
||||||
png_ptr->transformations &= ~PNG_COMPOSE;
|
png_ptr->transformations &= ~PNG_COMPOSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1397,7 +1397,7 @@ png_init_rgb_transformations(png_structrp png_ptr)
|
|||||||
int input_has_transparency = png_ptr->num_trans > 0;
|
int input_has_transparency = png_ptr->num_trans > 0;
|
||||||
|
|
||||||
/* If no alpha we can optimize. */
|
/* If no alpha we can optimize. */
|
||||||
if (!input_has_alpha)
|
if (input_has_alpha == 0)
|
||||||
{
|
{
|
||||||
/* Any alpha means background and associative alpha processing is
|
/* Any alpha means background and associative alpha processing is
|
||||||
* required, however if the alpha is 0 or 1 throughout OPTIMIZE_ALPHA
|
* required, however if the alpha is 0 or 1 throughout OPTIMIZE_ALPHA
|
||||||
@ -1408,7 +1408,7 @@ png_init_rgb_transformations(png_structrp png_ptr)
|
|||||||
png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA;
|
png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
if (!input_has_transparency)
|
if (input_has_transparency == 0)
|
||||||
png_ptr->transformations &= ~PNG_COMPOSE;
|
png_ptr->transformations &= ~PNG_COMPOSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1479,7 +1479,7 @@ png_init_read_transformations(png_structrp png_ptr)
|
|||||||
* the code immediately below if the transform can be handled outside the
|
* the code immediately below if the transform can be handled outside the
|
||||||
* row loop.
|
* row loop.
|
||||||
*/
|
*/
|
||||||
if (gamma_correction)
|
if (gamma_correction != 0)
|
||||||
png_ptr->transformations |= PNG_GAMMA;
|
png_ptr->transformations |= PNG_GAMMA;
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -2015,7 +2015,7 @@ defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
|
|||||||
png_ptr->info_rowbytes = info_ptr->rowbytes;
|
png_ptr->info_rowbytes = info_ptr->rowbytes;
|
||||||
|
|
||||||
#ifndef PNG_READ_EXPAND_SUPPORTED
|
#ifndef PNG_READ_EXPAND_SUPPORTED
|
||||||
if (png_ptr)
|
if (png_ptr != NULL)
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -2174,7 +2174,7 @@ png_do_unshift(png_row_infop row_info, png_bytep row,
|
|||||||
have_shift = 1;
|
have_shift = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!have_shift)
|
if (have_shift == 0)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2936,7 +2936,7 @@ png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
|
|||||||
*(dp++) = (png_byte)red;
|
*(dp++) = (png_byte)red;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (have_alpha)
|
if (have_alpha != 0)
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2962,7 +2962,7 @@ png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
|
|||||||
else
|
else
|
||||||
*(dp++) = red;
|
*(dp++) = red;
|
||||||
|
|
||||||
if (have_alpha)
|
if (have_alpha != 0)
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3012,7 +3012,7 @@ png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
|
|||||||
*(dp++) = (png_byte)((w>>8) & 0xff);
|
*(dp++) = (png_byte)((w>>8) & 0xff);
|
||||||
*(dp++) = (png_byte)(w & 0xff);
|
*(dp++) = (png_byte)(w & 0xff);
|
||||||
|
|
||||||
if (have_alpha)
|
if (have_alpha != 0)
|
||||||
{
|
{
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
@ -3045,7 +3045,7 @@ png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
|
|||||||
*(dp++) = (png_byte)((gray16>>8) & 0xff);
|
*(dp++) = (png_byte)((gray16>>8) & 0xff);
|
||||||
*(dp++) = (png_byte)(gray16 & 0xff);
|
*(dp++) = (png_byte)(gray16 & 0xff);
|
||||||
|
|
||||||
if (have_alpha)
|
if (have_alpha != 0)
|
||||||
{
|
{
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
@ -3111,7 +3111,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
|||||||
*sp = (png_byte)(tmp & 0xff);
|
*sp = (png_byte)(tmp & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bit_shift)
|
if (bit_shift == 0)
|
||||||
{
|
{
|
||||||
bit_shift = 7;
|
bit_shift = 7;
|
||||||
sp++;
|
sp++;
|
||||||
@ -3150,7 +3150,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
|||||||
*sp = (png_byte)(tmp & 0xff);
|
*sp = (png_byte)(tmp & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bit_shift)
|
if (bit_shift == 0)
|
||||||
{
|
{
|
||||||
bit_shift = 6;
|
bit_shift = 6;
|
||||||
sp++;
|
sp++;
|
||||||
@ -3176,7 +3176,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
|||||||
*sp = (png_byte)(tmp & 0xff);
|
*sp = (png_byte)(tmp & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bit_shift)
|
if (bit_shift == 0)
|
||||||
{
|
{
|
||||||
bit_shift = 6;
|
bit_shift = 6;
|
||||||
sp++;
|
sp++;
|
||||||
@ -3216,7 +3216,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
|||||||
*sp = (png_byte)(tmp & 0xff);
|
*sp = (png_byte)(tmp & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bit_shift)
|
if (bit_shift == 0)
|
||||||
{
|
{
|
||||||
bit_shift = 4;
|
bit_shift = 4;
|
||||||
sp++;
|
sp++;
|
||||||
@ -3242,7 +3242,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
|||||||
*sp = (png_byte)(tmp & 0xff);
|
*sp = (png_byte)(tmp & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bit_shift)
|
if (bit_shift == 0)
|
||||||
{
|
{
|
||||||
bit_shift = 4;
|
bit_shift = 4;
|
||||||
sp++;
|
sp++;
|
||||||
@ -3491,7 +3491,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
|||||||
png_composite_16(w, v, 257*a,
|
png_composite_16(w, v, 257*a,
|
||||||
png_ptr->background_1.gray);
|
png_ptr->background_1.gray);
|
||||||
|
|
||||||
if (!optimize)
|
if (optimize == 0)
|
||||||
w = gamma_from_1[(w+add)>>shift];
|
w = gamma_from_1[(w+add)>>shift];
|
||||||
|
|
||||||
else /* alpha pixels linear and approximate */
|
else /* alpha pixels linear and approximate */
|
||||||
@ -3553,7 +3553,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
|||||||
g = gamma_16_to_1[((sp[0]<<8)+sp[1]+add) >> shift];
|
g = gamma_16_to_1[((sp[0]<<8)+sp[1]+add) >> shift];
|
||||||
png_composite_16(v, g, a, png_ptr->background_1.gray);
|
png_composite_16(v, g, a, png_ptr->background_1.gray);
|
||||||
|
|
||||||
if (!optimize)
|
if (optimize == 0)
|
||||||
w = gamma_16_from_1[(v+add) >> shift];
|
w = gamma_16_from_1[(v+add) >> shift];
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -3631,7 +3631,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
|||||||
png_composite_16(w, v, alpha,
|
png_composite_16(w, v, alpha,
|
||||||
png_ptr->background_1.red);
|
png_ptr->background_1.red);
|
||||||
|
|
||||||
if (!optimize)
|
if (optimize == 0)
|
||||||
w = gamma_from_1[(w+add)>>shift];
|
w = gamma_from_1[(w+add)>>shift];
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -3643,7 +3643,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
|||||||
png_composite_16(w, v, alpha,
|
png_composite_16(w, v, alpha,
|
||||||
png_ptr->background_1.green);
|
png_ptr->background_1.green);
|
||||||
|
|
||||||
if (!optimize)
|
if (optimize == 0)
|
||||||
w = gamma_from_1[(w+add)>>shift];
|
w = gamma_from_1[(w+add)>>shift];
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -3655,7 +3655,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
|||||||
png_composite_16(w, v, alpha,
|
png_composite_16(w, v, alpha,
|
||||||
png_ptr->background_1.blue);
|
png_ptr->background_1.blue);
|
||||||
|
|
||||||
if (!optimize)
|
if (optimize == 0)
|
||||||
w = gamma_from_1[(w+add)>>shift];
|
w = gamma_from_1[(w+add)>>shift];
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -3743,7 +3743,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
|||||||
v = gamma_16_to_1[((sp[0]<<8)+sp[1]+add) >> shift];
|
v = gamma_16_to_1[((sp[0]<<8)+sp[1]+add) >> shift];
|
||||||
png_composite_16(w, v, a, png_ptr->background_1.red);
|
png_composite_16(w, v, a, png_ptr->background_1.red);
|
||||||
|
|
||||||
if (!optimize)
|
if (optimize == 0)
|
||||||
w = gamma_16_from_1[(w+add) >> shift];
|
w = gamma_16_from_1[(w+add) >> shift];
|
||||||
|
|
||||||
*sp = (png_byte)((w >> 8) & 0xff);
|
*sp = (png_byte)((w >> 8) & 0xff);
|
||||||
@ -3752,7 +3752,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
|||||||
v = gamma_16_to_1[((sp[2]<<8)+sp[3]+add) >> shift];
|
v = gamma_16_to_1[((sp[2]<<8)+sp[3]+add) >> shift];
|
||||||
png_composite_16(w, v, a, png_ptr->background_1.green);
|
png_composite_16(w, v, a, png_ptr->background_1.green);
|
||||||
|
|
||||||
if (!optimize)
|
if (optimize == 0)
|
||||||
w = gamma_16_from_1[(w+add) >> shift];
|
w = gamma_16_from_1[(w+add) >> shift];
|
||||||
|
|
||||||
*(sp + 2) = (png_byte)((w >> 8) & 0xff);
|
*(sp + 2) = (png_byte)((w >> 8) & 0xff);
|
||||||
@ -3761,7 +3761,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
|||||||
v = gamma_16_to_1[((sp[4]<<8)+sp[5]+add) >> shift];
|
v = gamma_16_to_1[((sp[4]<<8)+sp[5]+add) >> shift];
|
||||||
png_composite_16(w, v, a, png_ptr->background_1.blue);
|
png_composite_16(w, v, a, png_ptr->background_1.blue);
|
||||||
|
|
||||||
if (!optimize)
|
if (optimize == 0)
|
||||||
w = gamma_16_from_1[(w+add) >> shift];
|
w = gamma_16_from_1[(w+add) >> shift];
|
||||||
|
|
||||||
*(sp + 4) = (png_byte)((w >> 8) & 0xff);
|
*(sp + 4) = (png_byte)((w >> 8) & 0xff);
|
||||||
@ -4658,7 +4658,7 @@ png_do_read_transformations(png_structrp png_ptr, png_row_infop row_info)
|
|||||||
png_do_rgb_to_gray(png_ptr, row_info,
|
png_do_rgb_to_gray(png_ptr, row_info,
|
||||||
png_ptr->row_buf + 1);
|
png_ptr->row_buf + 1);
|
||||||
|
|
||||||
if (rgb_error)
|
if (rgb_error != 0)
|
||||||
{
|
{
|
||||||
png_ptr->rgb_to_gray_status=1;
|
png_ptr->rgb_to_gray_status=1;
|
||||||
if ((png_ptr->transformations & PNG_RGB_TO_GRAY) ==
|
if ((png_ptr->transformations & PNG_RGB_TO_GRAY) ==
|
||||||
|
|||||||
12
pngrutil.c
12
pngrutil.c
@ -248,7 +248,7 @@ png_crc_error(png_structrp png_ptr)
|
|||||||
/* The chunk CRC must be serialized in a single I/O call. */
|
/* The chunk CRC must be serialized in a single I/O call. */
|
||||||
png_read_data(png_ptr, crc_bytes, 4);
|
png_read_data(png_ptr, crc_bytes, 4);
|
||||||
|
|
||||||
if (need_crc)
|
if (need_crc != 0)
|
||||||
{
|
{
|
||||||
crc = png_get_uint_32(crc_bytes);
|
crc = png_get_uint_32(crc_bytes);
|
||||||
return ((int)(crc != png_ptr->crc));
|
return ((int)(crc != png_ptr->crc));
|
||||||
@ -294,7 +294,7 @@ png_read_buffer(png_structrp png_ptr, png_alloc_size_t new_size, int warn)
|
|||||||
|
|
||||||
else if (warn < 2) /* else silent */
|
else if (warn < 2) /* else silent */
|
||||||
{
|
{
|
||||||
if (warn)
|
if (warn != 0)
|
||||||
png_chunk_warning(png_ptr, "insufficient memory to read chunk");
|
png_chunk_warning(png_ptr, "insufficient memory to read chunk");
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -620,7 +620,7 @@ png_decompress_chunk(png_structrp png_ptr,
|
|||||||
{
|
{
|
||||||
if (new_size == *newlength)
|
if (new_size == *newlength)
|
||||||
{
|
{
|
||||||
if (terminate)
|
if (terminate != 0)
|
||||||
text[prefix_size + *newlength] = 0;
|
text[prefix_size + *newlength] = 0;
|
||||||
|
|
||||||
if (prefix_size > 0)
|
if (prefix_size > 0)
|
||||||
@ -1543,7 +1543,7 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|||||||
errmsg = "too many profiles";
|
errmsg = "too many profiles";
|
||||||
|
|
||||||
/* Failure: the reason is in 'errmsg' */
|
/* Failure: the reason is in 'errmsg' */
|
||||||
if (!finished)
|
if (finished == 0)
|
||||||
png_crc_finish(png_ptr, length);
|
png_crc_finish(png_ptr, length);
|
||||||
|
|
||||||
png_ptr->colorspace.flags |= PNG_COLORSPACE_INVALID;
|
png_ptr->colorspace.flags |= PNG_COLORSPACE_INVALID;
|
||||||
@ -2660,7 +2660,7 @@ png_handle_iTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|||||||
|
|
||||||
buffer[uncompressed_length+prefix_length] = 0;
|
buffer[uncompressed_length+prefix_length] = 0;
|
||||||
|
|
||||||
if (compressed)
|
if (compressed != 0)
|
||||||
text.compression = PNG_ITXT_COMPRESSION_NONE;
|
text.compression = PNG_ITXT_COMPRESSION_NONE;
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -3237,7 +3237,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Work out the bytes to copy. */
|
/* Work out the bytes to copy. */
|
||||||
if (display)
|
if (display != 0)
|
||||||
{
|
{
|
||||||
/* When doing the 'block' algorithm the pixel in the pass gets
|
/* When doing the 'block' algorithm the pixel in the pass gets
|
||||||
* replicated to adjacent pixels. This is why the even (0,2,4,6)
|
* replicated to adjacent pixels. This is why the even (0,2,4,6)
|
||||||
|
|||||||
12
pngset.c
12
pngset.c
@ -638,7 +638,7 @@ png_set_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||||||
png_colorspace_sync_info(png_ptr, info_ptr);
|
png_colorspace_sync_info(png_ptr, info_ptr);
|
||||||
|
|
||||||
/* Don't do any of the copying if the profile was bad, or inconsistent. */
|
/* Don't do any of the copying if the profile was bad, or inconsistent. */
|
||||||
if (!result)
|
if (result == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* But do write the gAMA and cHRM chunks from the profile. */
|
/* But do write the gAMA and cHRM chunks from the profile. */
|
||||||
@ -687,7 +687,7 @@ png_set_text(png_structrp png_ptr, png_inforp info_ptr,
|
|||||||
int ret;
|
int ret;
|
||||||
ret = png_set_text_2(png_ptr, info_ptr, text_ptr, num_text);
|
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");
|
png_error(png_ptr, "Insufficient memory to store text");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -857,7 +857,7 @@ png_set_text_2(png_structrp png_ptr, png_inforp info_ptr,
|
|||||||
textp->text = textp->key + key_len + 1;
|
textp->text = textp->key + key_len + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (text_length)
|
if (text_length != 0)
|
||||||
memcpy(textp->text, text_ptr[i].text, text_length);
|
memcpy(textp->text, text_ptr[i].text, text_length);
|
||||||
|
|
||||||
*(textp->text + text_length) = '\0';
|
*(textp->text + text_length) = '\0';
|
||||||
@ -1397,7 +1397,7 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep,
|
|||||||
* required because add_one_chunk above doesn't extend the list if the 'keep'
|
* required because add_one_chunk above doesn't extend the list if the 'keep'
|
||||||
* parameter is the default.
|
* parameter is the default.
|
||||||
*/
|
*/
|
||||||
if (keep)
|
if (keep != 0)
|
||||||
{
|
{
|
||||||
new_list = png_voidcast(png_bytep, png_malloc(png_ptr,
|
new_list = png_voidcast(png_bytep, png_malloc(png_ptr,
|
||||||
5 * (num_chunks + old_num_chunks)));
|
5 * (num_chunks + old_num_chunks)));
|
||||||
@ -1493,7 +1493,7 @@ png_set_rows(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||||||
|
|
||||||
info_ptr->row_pointers = row_pointers;
|
info_ptr->row_pointers = row_pointers;
|
||||||
|
|
||||||
if (row_pointers)
|
if (row_pointers != NULL)
|
||||||
info_ptr->valid |= PNG_INFO_IDAT;
|
info_ptr->valid |= PNG_INFO_IDAT;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1607,7 +1607,7 @@ png_set_benign_errors(png_structrp png_ptr, int allowed)
|
|||||||
* is the default behavior if png_set_benign_errors() is not called).
|
* is the default behavior if png_set_benign_errors() is not called).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (allowed)
|
if (allowed != 0)
|
||||||
png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN |
|
png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN |
|
||||||
PNG_FLAG_APP_WARNINGS_WARN | PNG_FLAG_APP_ERRORS_WARN;
|
PNG_FLAG_APP_WARNINGS_WARN | PNG_FLAG_APP_ERRORS_WARN;
|
||||||
|
|
||||||
|
|||||||
40
pngtest.c
40
pngtest.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngtest.c - a simple test program to test libpng
|
/* pngtest.c - a simple test program to test libpng
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.9 [(PENDING RELEASE)]
|
* Last changed in libpng 1.6.11 [(PENDING RELEASE)]
|
||||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (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:
|
default:
|
||||||
err = 1; /* uninitialized */
|
err = 1; /* uninitialized */
|
||||||
}
|
}
|
||||||
if (err)
|
if (err != 0)
|
||||||
png_error(png_ptr, "Bad I/O state or buffer size");
|
png_error(png_ptr, "Bad I/O state or buffer size");
|
||||||
}
|
}
|
||||||
#endif
|
#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. */
|
/* Make sure the caller isn't assuming zeroed memory. */
|
||||||
memset(pinfo->pointer, 0xdd, pinfo->size);
|
memset(pinfo->pointer, 0xdd, pinfo->size);
|
||||||
|
|
||||||
if (verbose)
|
if (verbose != 0)
|
||||||
printf("png_malloc %lu bytes at %p\n", (unsigned long)size,
|
printf("png_malloc %lu bytes at %p\n", (unsigned long)size,
|
||||||
pinfo->pointer);
|
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
|
/* We must free the list element too, but first kill
|
||||||
the memory that is to be freed. */
|
the memory that is to be freed. */
|
||||||
memset(ptr, 0x55, pinfo->size);
|
memset(ptr, 0x55, pinfo->size);
|
||||||
if (pinfo)
|
if (pinfo != NULL)
|
||||||
free(pinfo);
|
free(pinfo);
|
||||||
pinfo = NULL;
|
pinfo = NULL;
|
||||||
break;
|
break;
|
||||||
@ -597,10 +597,10 @@ png_debug_free(png_structp png_ptr, png_voidp ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Finally free the data. */
|
/* Finally free the data. */
|
||||||
if (verbose)
|
if (verbose != 0)
|
||||||
printf("Freeing %p\n", ptr);
|
printf("Freeing %p\n", ptr);
|
||||||
|
|
||||||
if (ptr)
|
if (ptr != NULL)
|
||||||
free(ptr);
|
free(ptr);
|
||||||
ptr = NULL;
|
ptr = NULL;
|
||||||
}
|
}
|
||||||
@ -667,8 +667,8 @@ set_location(png_structp png_ptr, struct user_chunk_data *data, int what)
|
|||||||
return 1; /* handled */
|
return 1; /* handled */
|
||||||
}
|
}
|
||||||
|
|
||||||
static int PNGCBAPI read_user_chunk_callback(png_struct *png_ptr,
|
static int PNGCBAPI
|
||||||
png_unknown_chunkp chunk)
|
read_user_chunk_callback(png_struct *png_ptr, png_unknown_chunkp chunk)
|
||||||
{
|
{
|
||||||
struct user_chunk_data *my_user_chunk_data =
|
struct user_chunk_data *my_user_chunk_data =
|
||||||
(struct user_chunk_data*)png_get_user_chunk_ptr(png_ptr);
|
(struct user_chunk_data*)png_get_user_chunk_ptr(png_ptr);
|
||||||
@ -734,7 +734,7 @@ write_sTER_chunk(png_structp write_ptr)
|
|||||||
{
|
{
|
||||||
png_byte sTER[5] = {115, 84, 69, 82, '\0'};
|
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);
|
fprintf(STDERR, "\n stereo mode = %d\n", user_chunk_data.sTER_mode);
|
||||||
|
|
||||||
png_write_chunk(write_ptr, sTER, &user_chunk_data.sTER_mode, 1);
|
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];
|
png_byte vpag_chunk_data[9];
|
||||||
|
|
||||||
if (verbose)
|
if (verbose != 0)
|
||||||
fprintf(STDERR, " vpAg = %lu x %lu, units = %d\n",
|
fprintf(STDERR, " vpAg = %lu x %lu, units = %d\n",
|
||||||
(unsigned long)user_chunk_data.vpAg_width,
|
(unsigned long)user_chunk_data.vpAg_width,
|
||||||
(unsigned long)user_chunk_data.vpAg_height,
|
(unsigned long)user_chunk_data.vpAg_height,
|
||||||
@ -938,7 +938,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (strict)
|
if (strict != 0)
|
||||||
{
|
{
|
||||||
/* Treat png_benign_error() as errors on read */
|
/* Treat png_benign_error() as errors on read */
|
||||||
png_set_benign_errors(read_ptr, 0);
|
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 */
|
/* Allow application (pngtest) errors and warnings to pass */
|
||||||
png_set_benign_errors(read_ptr, 1);
|
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);
|
pngtest_check_text_support(read_ptr, text_ptr, num_text);
|
||||||
|
|
||||||
if (verbose)
|
if (verbose != 0)
|
||||||
{
|
{
|
||||||
int i;
|
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,
|
int num_unknowns = png_get_unknown_chunks(read_ptr, read_info_ptr,
|
||||||
&unknowns);
|
&unknowns);
|
||||||
|
|
||||||
if (num_unknowns)
|
if (num_unknowns != 0)
|
||||||
{
|
{
|
||||||
png_set_unknown_chunks(write_ptr, write_info_ptr, unknowns,
|
png_set_unknown_chunks(write_ptr, write_info_ptr, unknowns,
|
||||||
num_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);
|
pngtest_check_text_support(read_ptr, text_ptr, num_text);
|
||||||
|
|
||||||
if (verbose)
|
if (verbose != 0)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -1480,7 +1480,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
int num_unknowns = png_get_unknown_chunks(read_ptr, end_info_ptr,
|
int num_unknowns = png_get_unknown_chunks(read_ptr, end_info_ptr,
|
||||||
&unknowns);
|
&unknowns);
|
||||||
|
|
||||||
if (num_unknowns)
|
if (num_unknowns != 0)
|
||||||
{
|
{
|
||||||
png_set_unknown_chunks(write_ptr, write_end_info_ptr, unknowns,
|
png_set_unknown_chunks(write_ptr, write_end_info_ptr, unknowns,
|
||||||
num_unknowns);
|
num_unknowns);
|
||||||
@ -1521,7 +1521,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_EASY_ACCESS_SUPPORTED
|
#ifdef PNG_EASY_ACCESS_SUPPORTED
|
||||||
if (verbose)
|
if (verbose != 0)
|
||||||
{
|
{
|
||||||
png_uint_32 iwidth, iheight;
|
png_uint_32 iwidth, iheight;
|
||||||
iwidth = png_get_image_width(write_ptr, write_info_ptr);
|
iwidth = png_get_image_width(write_ptr, write_info_ptr);
|
||||||
@ -1599,7 +1599,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_WRITE_SUPPORTED /* else nothing was written */
|
#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 (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
@ -1638,7 +1638,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!num_in)
|
if (num_in == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (memcmp(inbuf, outbuf, num_in))
|
if (memcmp(inbuf, outbuf, num_in))
|
||||||
@ -1795,7 +1795,7 @@ main(int argc, char *argv[])
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (multiple)
|
if (multiple != 0)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
|
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
|
||||||
|
|||||||
10
pngtrans.c
10
pngtrans.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.9 [(PENDING RELEASE)]
|
* Last changed in libpng 1.6.11 [(PENDING RELEASE)]
|
||||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
@ -503,7 +503,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
|||||||
{
|
{
|
||||||
if (row_info->bit_depth == 8)
|
if (row_info->bit_depth == 8)
|
||||||
{
|
{
|
||||||
if (at_start) /* Skip initial filler */
|
if (at_start != 0) /* Skip initial filler */
|
||||||
++sp;
|
++sp;
|
||||||
else /* Skip initial channel and, for sp, the filler */
|
else /* Skip initial channel and, for sp, the filler */
|
||||||
sp += 2, ++dp;
|
sp += 2, ++dp;
|
||||||
@ -517,7 +517,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
|||||||
|
|
||||||
else if (row_info->bit_depth == 16)
|
else if (row_info->bit_depth == 16)
|
||||||
{
|
{
|
||||||
if (at_start) /* Skip initial filler */
|
if (at_start != 0) /* Skip initial filler */
|
||||||
sp += 2;
|
sp += 2;
|
||||||
else /* Skip initial channel and, for sp, the filler */
|
else /* Skip initial channel and, for sp, the filler */
|
||||||
sp += 4, dp += 2;
|
sp += 4, dp += 2;
|
||||||
@ -543,7 +543,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
|||||||
{
|
{
|
||||||
if (row_info->bit_depth == 8)
|
if (row_info->bit_depth == 8)
|
||||||
{
|
{
|
||||||
if (at_start) /* Skip initial filler */
|
if (at_start != 0) /* Skip initial filler */
|
||||||
++sp;
|
++sp;
|
||||||
else /* Skip initial channels and, for sp, the filler */
|
else /* Skip initial channels and, for sp, the filler */
|
||||||
sp += 4, dp += 3;
|
sp += 4, dp += 3;
|
||||||
@ -557,7 +557,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
|||||||
|
|
||||||
else if (row_info->bit_depth == 16)
|
else if (row_info->bit_depth == 16)
|
||||||
{
|
{
|
||||||
if (at_start) /* Skip initial filler */
|
if (at_start != 0) /* Skip initial filler */
|
||||||
sp += 2;
|
sp += 2;
|
||||||
else /* Skip initial channels and, for sp, the filler */
|
else /* Skip initial channels and, for sp, the filler */
|
||||||
sp += 8, dp += 6;
|
sp += 8, dp += 6;
|
||||||
|
|||||||
2
pngwio.c
2
pngwio.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngwio.c - functions for data output
|
/* pngwio.c - functions for data output
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.9 [(PENDING RELEASE)]
|
* Last changed in libpng 1.6.9 [February 6, 2014]
|
||||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
|
|||||||
12
pngwrite.c
12
pngwrite.c
@ -832,7 +832,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);
|
png_do_write_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass);
|
||||||
/* This should always get caught above, but still ... */
|
/* This should always get caught above, but still ... */
|
||||||
if (!(row_info.width))
|
if (row_info.width == 0)
|
||||||
{
|
{
|
||||||
png_write_finish_row(png_ptr);
|
png_write_finish_row(png_ptr);
|
||||||
return;
|
return;
|
||||||
@ -2163,7 +2163,7 @@ png_image_write_main(png_voidp argument)
|
|||||||
* write an interlaced image.
|
* write an interlaced image.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (write_16bit)
|
if (write_16bit != 0)
|
||||||
{
|
{
|
||||||
/* The gamma here is 1.0 (linear) and the cHRM chunk matches sRGB. */
|
/* The gamma here is 1.0 (linear) and the cHRM chunk matches sRGB. */
|
||||||
png_set_gAMA_fixed(png_ptr, info_ptr, PNG_GAMMA_LINEAR);
|
png_set_gAMA_fixed(png_ptr, info_ptr, PNG_GAMMA_LINEAR);
|
||||||
@ -2195,7 +2195,7 @@ png_image_write_main(png_voidp argument)
|
|||||||
*
|
*
|
||||||
* First check for a little endian system if writing 16 bit files.
|
* 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;
|
PNG_CONST png_uint_16 le = 0x0001;
|
||||||
|
|
||||||
@ -2236,7 +2236,7 @@ png_image_write_main(png_voidp argument)
|
|||||||
png_const_bytep row = png_voidcast(png_const_bytep, display->buffer);
|
png_const_bytep row = png_voidcast(png_const_bytep, display->buffer);
|
||||||
ptrdiff_t row_bytes = display->row_stride;
|
ptrdiff_t row_bytes = display->row_stride;
|
||||||
|
|
||||||
if (linear)
|
if (linear != 0)
|
||||||
row_bytes *= (sizeof (png_uint_16));
|
row_bytes *= (sizeof (png_uint_16));
|
||||||
|
|
||||||
if (row_bytes < 0)
|
if (row_bytes < 0)
|
||||||
@ -2269,7 +2269,7 @@ png_image_write_main(png_voidp argument)
|
|||||||
int result;
|
int result;
|
||||||
|
|
||||||
display->local_row = row;
|
display->local_row = row;
|
||||||
if (write_16bit)
|
if (write_16bit != 0)
|
||||||
result = png_safe_execute(image, png_write_image_16bit, display);
|
result = png_safe_execute(image, png_write_image_16bit, display);
|
||||||
else
|
else
|
||||||
result = png_safe_execute(image, png_write_image_8bit, display);
|
result = png_safe_execute(image, png_write_image_8bit, display);
|
||||||
@ -2278,7 +2278,7 @@ png_image_write_main(png_voidp argument)
|
|||||||
png_free(png_ptr, row);
|
png_free(png_ptr, row);
|
||||||
|
|
||||||
/* Skip the 'write_end' on error: */
|
/* Skip the 'write_end' on error: */
|
||||||
if (!result)
|
if (result == 0)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngwtran.c - transforms the data in a row for PNG writers
|
/* pngwtran.c - transforms the data in a row for PNG writers
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.9 [(PENDING RELEASE)]
|
* Last changed in libpng 1.6.9 [February 6, 2014]
|
||||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
|
|||||||
16
pngwutil.c
16
pngwutil.c
@ -699,7 +699,7 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
|
|||||||
if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/))
|
if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/))
|
||||||
*new_key++ = ch, ++key_len, space = 0;
|
*new_key++ = ch, ++key_len, space = 0;
|
||||||
|
|
||||||
else if (!space)
|
else if (space == 0)
|
||||||
{
|
{
|
||||||
/* A space or an invalid character when one wasn't seen immediately
|
/* A space or an invalid character when one wasn't seen immediately
|
||||||
* before; output just a space.
|
* before; output just a space.
|
||||||
@ -711,14 +711,14 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
|
|||||||
bad_character = ch;
|
bad_character = ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!bad_character)
|
else if (bad_character == 0)
|
||||||
bad_character = ch; /* just skip it, record the first error */
|
bad_character = ch; /* just skip it, record the first error */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key_len > 0 && space) /* trailing space */
|
if (key_len > 0 && space) /* trailing space */
|
||||||
{
|
{
|
||||||
--key_len, --new_key;
|
--key_len, --new_key;
|
||||||
if (!bad_character)
|
if (bad_character == 0)
|
||||||
bad_character = 32;
|
bad_character = 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -732,7 +732,7 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
|
|||||||
if (*key) /* keyword too long */
|
if (*key) /* keyword too long */
|
||||||
png_warning(png_ptr, "keyword truncated");
|
png_warning(png_ptr, "keyword truncated");
|
||||||
|
|
||||||
else if (bad_character)
|
else if (bad_character != 0)
|
||||||
{
|
{
|
||||||
PNG_WARNING_PARAMETERS(p)
|
PNG_WARNING_PARAMETERS(p)
|
||||||
|
|
||||||
@ -898,7 +898,7 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height,
|
|||||||
/* Write the chunk */
|
/* Write the chunk */
|
||||||
png_write_complete_chunk(png_ptr, png_IHDR, buf, (png_size_t)13);
|
png_write_complete_chunk(png_ptr, png_IHDR, buf, (png_size_t)13);
|
||||||
|
|
||||||
if (!(png_ptr->do_filter))
|
if ((png_ptr->do_filter) == PNG_NO_FILTERS)
|
||||||
{
|
{
|
||||||
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE ||
|
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE ||
|
||||||
png_ptr->bit_depth < 8)
|
png_ptr->bit_depth < 8)
|
||||||
@ -1612,7 +1612,7 @@ png_write_tEXt(png_structrp png_ptr, png_const_charp key, png_const_charp text,
|
|||||||
*/
|
*/
|
||||||
png_write_chunk_data(png_ptr, new_key, key_len + 1);
|
png_write_chunk_data(png_ptr, new_key, key_len + 1);
|
||||||
|
|
||||||
if (text_len)
|
if (text_len != 0)
|
||||||
png_write_chunk_data(png_ptr, (png_const_bytep)text, text_len);
|
png_write_chunk_data(png_ptr, (png_const_bytep)text, text_len);
|
||||||
|
|
||||||
png_write_chunk_end(png_ptr);
|
png_write_chunk_end(png_ptr);
|
||||||
@ -1738,7 +1738,7 @@ png_write_iTXt(png_structrp png_ptr, int compression, png_const_charp key,
|
|||||||
|
|
||||||
png_text_compress_init(&comp, (png_const_bytep)text, strlen(text));
|
png_text_compress_init(&comp, (png_const_bytep)text, strlen(text));
|
||||||
|
|
||||||
if (compression)
|
if (compression != 0)
|
||||||
{
|
{
|
||||||
if (png_text_compress(png_ptr, png_iTXt, &comp, prefix_len) != Z_OK)
|
if (png_text_compress(png_ptr, png_iTXt, &comp, prefix_len) != Z_OK)
|
||||||
png_error(png_ptr, png_ptr->zstream.msg);
|
png_error(png_ptr, png_ptr->zstream.msg);
|
||||||
@ -1761,7 +1761,7 @@ png_write_iTXt(png_structrp png_ptr, int compression, png_const_charp key,
|
|||||||
|
|
||||||
png_write_chunk_data(png_ptr, (png_const_bytep)lang_key, lang_key_len);
|
png_write_chunk_data(png_ptr, (png_const_bytep)lang_key, lang_key_len);
|
||||||
|
|
||||||
if (compression)
|
if (compression != 0)
|
||||||
png_write_compressed_data_out(png_ptr, &comp);
|
png_write_compressed_data_out(png_ptr, &comp);
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user