Commit Graph

27 Commits

Author SHA1 Message Date
Cosmin Truta
ceb327789b Remove top-level const from function-scope variables
As per the const correctness rules, top-level const-ness of data
in automatic scopes does not propagate outside of these scopes
(unlike const-ness at lower levels, such as pointers to const data).

Previously, const was used liberally, but inconsistently across the
libpng codebase. Using const wherever applicable is not incorrect.
However, _consistent_ use of const is difficult to maintain in such
conditions.

In conclusion, we shall continue to use const only where doing so is
strictly necessary:

1. If a function guarantees that it will not modify an argument
   passed by pointer, the corresponding function parameter should be
   a pointer-to-const (const T *).

2. Static data should not be modified, therefore it should be const.

Reference:
Google C++ Style Guide
https://google.github.io/styleguide/cppguide.html#Use_of_const
2018-08-18 22:47:16 -04:00
Cosmin Truta
1ef8882814 Replace the remaining uses of PNG_CONST with const
In v1.6.0, compiler support for const became a requirement.
It should be used consistently. To maintain backwards compatibility,
PNG_CONST is still maintained in deprecated form.
2018-08-18 21:01:02 -04:00
Unknown
f23b41d7b1 Misc. typos
Some are user facing. Some are in actual code. Most are in source comments. Also, please double check the changes in contrib/tools/pngfix.c
2017-11-03 00:52:06 -04:00
Glenn Randers-Pehrson
03a6f3f9c9 [libpng16] Bump version to 1.6.30beta01 2017-03-16 10:40:01 -05:00
Glenn Randers-Pehrson
a8de1a70d1 [libpng16] Imported from libpng-1.6.29beta03.tar 2017-03-01 07:15:29 -06:00
John Bowler
7218761fe1 Fix right code in the wrong place.
The recovery stuff was in the wrong if branches; the comments were
correct.

Signed-off-by: John Bowler <jbowler@acm.org>
2017-02-21 15:15:48 -08:00
Glenn Randers-Pehrson
436ce2c6e9 [libpng16] Bump version to 1.6.26rc02 2016-10-17 12:46:41 -05:00
Glenn Randers-Pehrson
e7092bc59c [libpng16] Imported from libpng-1.6.20rc01.tar 2015-11-26 07:04:24 -06:00
John Bowler
c3e7e7d715 [libpng16] tests backported from libpng 1.7
This updates libpng16 with all the test changes from libpng17,
including changes to pngvalid.c to ensure that the original,
distributed, version of contrib/visupng/cexcept.h can be used.

pngvalid contains the correction to the use of SAVE/STORE_
UNKNOWN_CHUNKS; a bug revealed by changes in libpng 1.7.  More
tests contain the --strict option to detect warnings and the
pngvalid-standard test has been corrected so that it does not
turn on progresive-read (there is a separate test which does
that.)

Some signed/unsigned fixes have been made.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-15 15:38:52 -07:00
Glenn Randers-Pehrson
867f2ec058 [libpng16] Imported from libpng-1.6.18beta07.tar 2015-06-06 17:03:14 -05:00
Glenn Randers-Pehrson
d8d18fbb02 [libpng16] Imported from libpng-1.6.18beta03.tar 2015-05-06 16:39:31 -05:00
John Bowler
74428df2fd [libpng16] Improved DIV65535 algorithm in simpleover.c. By experiment,
(x + (x>>16) + 32769) works as well as the previous form and avoids one shift.
2015-05-06 11:41:17 -05:00
Glenn Randers-Pehrson
d6b1375bf5 [libpng16] Trivial editing of comments in contrib/examples/simpleover.c 2015-05-04 20:25:31 -05:00
John Bowler
0f12df19a1 [libpng16] Added PNG generation tool, fixed unitialized pointer in
simpleover. Also added a comment to png.h pointing out that the pointer must
 be set to NULL!  (simpleover crashes with any slightly complex command lines
 without this fix.)
2015-05-04 19:58:41 -05:00
John Bowler
cde3078963 [libpng16] Added contrib/examples/simpleover.c, to demonstrate how to handle
alpha compositing of multiple images, using the "simplified API"
2015-05-02 19:53:40 -05:00
Glenn Randers-Pehrson
61ea3eacb0 [libpng16] Reverted use png_get_libpng_ver(NULL) instead of PNG_LIBPNG_VER_STRING
in the manual, example.c, pngtest.c, and applications in the contrib directory.
It was incorrect advice.
2014-11-06 06:39:56 -06:00
Glenn Randers-Pehrson
f1b547a509 [libpng16] Use png_get_libpng_ver(NULL), not PNG_LIBPNG_VER_STRING 2014-11-04 23:33:46 -06:00
Glenn Randers-Pehrson
079a724833 [libpng16] Fixed some nits in contrib/arm-neon/README and comments in
contrib/examples/*.c
2014-02-23 10:59:27 -06:00
John Bowler
59ae38984f [libpng16] Corrected simplified API default gamma for color-mapped output, added
a flag to change default. In 1.6.0 when the simplified API was used
to produce color-mapped output from an input image with no gamma
information the gamma assumed for the input could be different from
that assumed for non-color-mapped output.  In particular 16-bit depth
input files were assumed to be sRGB encoded, whereas in the 'direct'
case they were assumed to have linear data.  This was an error.  The
fix makes the simplified API treat all input files the same way and
adds a new flag to the png_image::flags member to allow the
application/user to specify that 16-bit files contain sRGB data
rather than the default linear.
Fixed bugs in the pngpixel and makepng test programs.
2013-03-06 22:15:25 -06:00
Glenn Randers-Pehrson
871b1d0fab [libpng16] Bump version to 1.6.1beta05 2013-03-02 15:03:15 -06:00
Glenn Randers-Pehrson
f3af706c2a [libpng16] Imported from libpng-1.6.0beta05.tar 2013-03-01 21:38:03 -06:00
Glenn Randers-Pehrson
75fde9e99a [libpng16] Imported from libpng-1.6.0beta30.tar 2012-10-24 11:37:08 -05:00
John Bowler
53f7051b1b [libpng] Fixed contrib/examples/png2png.c 2012-09-01 13:26:41 -05:00
John Bowler
6f237b6bf0 [libpng16] Remove whitespace at end of lines 2012-03-02 13:20:52 -06:00
John Bowler
414769b415 [libpng16] Add "free()" and "png_free_image()" calls to example code. 2011-11-27 21:39:13 -06:00
Glenn Randers-Pehrson
2ddb252d07 [libpng16] Updated license info in contrib/examples and example.c 2011-11-25 07:27:51 -06:00
John Bowler
36082cffcd [libpng16] Added example programs for the new 'simplified' API. 2011-11-24 08:22:24 -06:00