Commit Graph

240 Commits

Author SHA1 Message Date
luz.paz
a294c1bcb6 Some more trivial source typos
Found via `codespell` and `grep`
2018-08-19 00:57:20 -04:00
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
Cosmin Truta
43446b735d Fix a build warning on OpenBSD
(Contributed by Theo Buehler)
2018-08-12 23:46:02 -04:00
Cosmin Truta
a74aa9a002 [libpng16] Replace the remaining uses of png_size_t with size_t
In v1.6.0, size_t became a required type. It should be used
consistently. To maintain backwards compatibility, png_size_t
is still maintained in deprecated form.
2018-06-17 22:37:44 -04:00
luz.paz
eb91c0e4ed More misc. typos
found via `codespell-q 3`
please review
2018-02-09 06:57:29 -05: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
5c27e93f51 [libpng16] Bump version to 1.6.33beta02 2017-08-30 07:03:12 -05:00
Glenn Randers-Pehrson
f6ca33d42c [libpng16] Bump version to 1.6.33beta01 2017-08-25 18:54:30 -05:00
Glenn Randers-Pehrson
df7e9dae0c [libpng16] Imported from libpng-1.6.32.tar 2017-08-24 16:39:02 -05:00
Glenn Randers-Pehrson
bc68c41d5f [libpng16] Initialized btoa[] in pngstest.c; stop memory leak in png_handle_eXIf()
when returning with an error.
2017-08-01 15:24:21 -05:00
Glenn Randers-Pehrson
68a80b10fe [libpng16] updated tests/pngunknown-sAPI; it works now. 2017-07-31 20:22:08 -05:00
Glenn Randers-Pehrson
c17b7b38b0 [libpng16] Updated contrib/libtests/pngunknown.c with eXIf chunk. Note:
the unknown-sAPI test is failing.
2017-07-31 19:04:15 -05:00
Glenn Randers-Pehrson
9fcb846402 [libpng16] Imported from libpng-1.6.31.tar 2017-07-27 05:27:17 -05:00
John Bowler
72d07d3202 [libpng16] Removed one of the GCC-7.1.0 'strict-overflow' warnings that
result when integers appear on both sides of a compare.  Worked around the
  others by forcing the strict-overflow setting in the relevant functions to
  a level where they are not reported.
Changed "FALL THROUGH" comments to "FALLTHROUGH" because GCC doesn't like
  the space.
Worked around some C-style casts from (void*) because g++ 5.4.0 objects
  to them.
Increased the buffer size for 'sprint' to pass the gcc 7.1.0 'sprint
  overflow' check that is on by default with -Wall -Wextra.
2017-07-11 08:47:05 -05:00
Glenn Randers-Pehrson
d42e88d5b3 [libpng16] Imported from libpng-1.6.29.tar 2017-03-16 07:26:33 -05:00
Glenn Randers-Pehrson
dd24a6ca15 [libpng16] Imported from libpng-1.6.29beta01.tar 2017-01-12 10:02:56 -06:00
Glenn Randers-Pehrson
4c0740c8de [libpng16] Simplified conditional compilation in pngvalid.c, for AIX (Michael Felt). 2017-01-12 09:48:12 -06:00
Glenn Randers-Pehrson
a3b5edc934 [libpng16] Bump version to 1.6.27 2016-12-29 07:50:33 -06:00
Glenn Randers-Pehrson
61a9a054fd [libpng16] Imported from libpng-1.6.27rc01.tar 2016-12-27 08:24:22 -06:00
John Bowler
13a354f81e Remove 'defined' within macro
This removes the use of a macro containing the pre-processor 'defined'
operator.  It is unclear whether this is valid; a macro which
"generates" 'defined' is not permitted, but the use of the work
"generates" within the C90 standard seems to imply more than simple
substitution of an expression itself containing a well-formed defined
operation.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-12-26 16:43:15 -08:00
Glenn Randers-Pehrson
0c440812db [libpng16] Imported from libpng-1.6.26.tar 2016-10-19 19:11:38 -05:00
Glenn Randers-Pehrson
ad3318ddc8 [libpng16] Bump version to 1.6.26beta03 2016-10-01 19:44:42 -05:00
John Bowler
319c9852bf Unsigned overflow
Remove all currently detected cases of unsigned overflow.  Detection is
runtime, so test case dependent.  The changes to pngvalid.c eliminate
spurious and probably invalid tests with one while loop exception.

Apart from that and the change to the dependence on the intended
unsigned overflow in pngtrans.c the changes are limited to altering the
meme for an unsigned 'x' from:

   while (x-- > 0)

to

   for (; x > 0; --x)

This works because, in all cases, the control variable is not used in
the loop.  The 'while' meme was, at one time, warn'ed by GCC so it is
probably a good change, for some weird religious value of good.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-09-30 18:37:22 -07:00
Glenn Randers-Pehrson
b50d5cea2b [libpng16] Imported from libpng-1.6.24.tar 2016-08-03 21:32:26 -05:00
Glenn Randers-Pehrson
9b14f5f85a [libpng16] Fix a bad indent in pngvalid.c 2016-07-13 17:21:31 -05:00
Glenn Randers-Pehrson
66f796e74c [libpng16] Imported from libpng-1.6.24beta03.tar 2016-07-04 09:55:12 -05:00
Glenn Randers-Pehrson
11c88033d4 [libpng16] Added "Common linking failures" section to INSTALL 2016-07-02 14:29:29 -05:00
John Bowler
54feb0ad2a pngimage: correct #define checking
In libpng 1.7 pngimage needs to check PNG_WRITE_PNG_SUPPORTED (new in 1.7), not
PNG_WRITE_SUPPORTED because png_write_png can be disabled without disabling
PNG_WRITE_SUPPORTED.  Copied the approach from 1.6 pngcp.c (so this still works
in 1.6 as well.)
2016-07-02 08:03:09 -07:00
Glenn Randers-Pehrson
b733c50bc0 [libpng16] Updated CHANGES and ANNOUNCE 2016-07-01 18:42:07 -05:00
John Bowler
0ac91cc657 pngcp: tool to copy PNG files
This adds pngcp to the build together with a pngcp.dfa configuration test; the
test revealed some configuration bugs which are fixed by corrections to the
_SUPPORTED macros.

pngcp builds on all tested configurations and a number of bugs have been fixed
to make this happen relative to the version in libpng 1.7 contrib/examples.
pngcp.dfa will have to be different for 1.7 but pngcp.c should work fine (not
yet tested).  pngcp itself is still missing a usage message; this is a
preliminary version, although since it behaves the same way as 'cp' most unoids
shouldn't have a problem using it correctly.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-07-01 11:27:43 -07:00
Glenn Randers-Pehrson
3f2879bf60 [libpng16] Imported from libpng-1.6.24beta02.tar 2016-06-23 11:26:59 -05:00
Glenn Randers-Pehrson
4b4a9583b4 [libpng16] Imported from libpng-1.6.24beta02.tar 2016-06-23 11:08:06 -05:00
John Bowler
21d9e6e0fb SKIP definition in pngstest.c misplaced
The SKIP definition needs to come after the png.h include (see all the other .c
files in contrib/libtests) because it depends on PNG_LIBPNG_VER.  This commit
puts it in the correct place.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-06-22 17:38:56 -07:00
John Bowler
98af505439 Fix MSVC Level 4 warning
MSVC does not like (uInt) = -(unsigned) (i.e. as an initializer), but it is fine
with it if the conversion is explicitly invoked by a cast.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-06-22 17:37:20 -07:00
Glenn Randers-Pehrson
ed6db9d86b [libpng16] Imported from libpng-1.6.23.tar 2016-06-09 06:49:42 -05:00
John Bowler
bd2370c054 pngvalid.c: don't use size_t count arguments
Coverity rejects code where an array element count has type size_t, this
elminates the code in question from contrib/libtests/pngvalid.c

Signed-off-by: John Bowler <jbowler@acm.org>
2016-05-30 08:12:51 -07:00
Glenn Randers-Pehrson
dbfd68ae3a [libpng16] Update CHANGES, ANNOUNCE, and change date in pngvalid.c 2016-05-29 15:47:57 -05:00
John Bowler
801b925edf pngvalid.c: correct progressive read input buffer
The previous version of the code invariably passed just one byte at a time to
libpng.  The intention was to pass a random number of bytes in the range 0..511
(and this is what happens now).

Signed-off-by: John Bowler <jbowler@acm.org>
2016-05-29 09:30:00 -07:00
Glenn Randers-Pehrson
84cc738166 [libpng16] Imported from libpng-1.6.23beta01.tar 2016-05-29 09:47:30 -05:00
Glenn Randers-Pehrson
ac43a87820 [libpng16] Imported from libpng-1.6.22.tar 2016-05-26 07:25:14 -05:00
Glenn Randers-Pehrson
37ab4d946c [libpng16] Imported from libpng-1.6.22rc03.tar 2016-05-18 07:26:06 -05:00
Glenn Randers-Pehrson
21939d36ec [libpng16] Use PNG_UINT_31_MAX instead of constant 0x7fffffff in timepng.c 2016-04-29 21:48:52 -05:00
Glenn Randers-Pehrson
8c754b1834 [libpng16] Quieted two Coverity issues in contrib/libtests/timepng.c. 2016-04-28 21:23:37 -05:00
John Bowler
af9d06e06a timepng: better errors, fix signed overflow
Too many input files would overflow nfiles

Signed-off-by: John Bowler <jbowler@acm.org>
2016-04-13 10:04:08 -07:00
John Bowler
703944c39d timepng: C++ fixes, correct add_one_file
timepng would could a file as added even if it failed and the assembly file got
rewound.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-04-13 09:37:25 -07:00
John Bowler
e81f16bf5d timepng: more support requirements
Signed-off-by: John Bowler <jbowler@acm.org>
2016-04-12 21:17:22 -07:00
John Bowler
7572840cd0 timepng requires STDIO
Signed-off-by: John Bowler <jbowler@acm.org>
2016-04-12 21:10:04 -07:00
John Bowler
569a1d27b4 Fix timepng 'skip' return code.
Signed-off-by: John Bowler <jbowler@acm.org>
2016-04-12 21:04:27 -07:00
John Bowler
d642eede9a timepng: fix builds when there is no read support
Signed-off-by: John Bowler <jbowler@acm.org>
2016-04-12 21:01:50 -07:00