1365 Commits

Author SHA1 Message Date
Cosmin Truta
44f97f08d7 [libpng18] chore: Clean up the FILE * formulations in code and in documentation
We should use `FILE *` instead of `FILE*` or `(FILE*)`, consistently,
as we should for all other pointer types. Moreover, when we refer to
standard stdio file objects in comments and in documentation, we should
use the term "FILE objects" consistently.

Lastly, we clarify in a comment in example.c that `PNG_STDIO_SUPPORTED`
is true only when the stdio support is both available in the system and
accessible in the user's libpng build.

This is a cherry-pick of commit c63c5463903014c904b540216c2784023fb8c1c8
from branch 'libpng18'.

Reviewed-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-02-26 19:46:08 +02:00
Cosmin Truta
044536de92 [libpng18] chore: Clean up remnants of the long-discontinued Win16 support
Remove #ifdef sections and other workarounds for old Windows compilers
that lacked proper support for Win32, including, especially, support
for the Win32 stdio API.

This is a cherry-pick of commit e936211760ddf0ed4a4711ea897b59395dfd206e
from branch 'libpng18'.

Reviewed-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-02-26 19:42:28 +02:00
Cosmin Truta
5d09501462 Bump version to 1.6.48.git 2025-02-19 13:07:40 +02:00
Cosmin Truta
872555f4ba Release libpng version 1.6.47 2025-02-18 11:18:30 +02:00
Cosmin Truta
171bdd3a6c Bump version to 1.6.47.git 2025-01-27 18:32:44 +02:00
Cosmin Truta
0024abd279 Release libpng version 1.6.46 2025-01-23 19:02:04 +02:00
John Bowler
4d7c99334e fix: Restore the build for strictly-conforming standard compilers
In libpng version 1.6.45 we inadvertently used a declaration after
a statement, which works for compilers supporting C99 and newer,
but fails with C89 compilers, which we are still supporting in the
branch 'libpng16'.

Moreover, in commit 92e8581f12d4570b777eaabfbe1f4243b7b80c04, we used
the macro `PNG_FIXED_EXPORT` in a manner that introduced a spurious ';'
character, which broke the build for all standard-conforming compilers.

Reviewed-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-01-21 11:24:21 +02:00
John Bowler
f753baae52 api(PNGv3): Update the generated files and PNG_EXPORT_LAST_ORDINAL
Apart from the png.h change, these files are machine-generated.

Reviewed-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-01-08 23:22:50 +02:00
John Bowler
92e8581f12 api(PNGv3): Add support for mDCV and cLLI
This adds APIs to get/set the two remaining new PNG-v3 colour space
chunks.  The mDCV API matches that of cHRM.  Both chunks support
floating point APIs (all values in the two chunks are real numbers).

Both chunks have a new encoded type, a four-digit-precision fixed-point
number, which cannot be represented in the existing `png_fixed_point`
type, so a `png_uint_32` is used.

Test examples for cICP, cLLI and mDCV are now in pngtest.png, and a
necessary change to the pngunknown.c test program has been made to
accomodate the additions.

Reviewed-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-01-08 23:22:50 +02:00
Cosmin Truta
8ffc967e8a Bump version to 1.6.46.git 2025-01-08 19:26:11 +02:00
Cosmin Truta
51f5bd68b9 Release libpng version 1.6.45 2025-01-07 18:31:22 +02:00
Lucas CHOLLET
75748d93ce [libpng16] Add support for reading and writing the cICP chunk
This chunk was added in the third edition of the PNG specification and
contains Coding Independent Code Points (related to color space
description). It is fairly simple as it only contains four fields of one
byte each: Colour Primaries, Transfer Function, Matrix Coefficients,
Video Full Range Flag.

The test file originally comes from the related WPT test case:
https://github.com/web-platform-tests/wpt/blob/master/png/support/cicp-display-p3.png

Note that I reencoded the file to make it match libpng's default
encoding parameters (it only modifies the IDAT chunk).

This is a cherry-pick of commit 65925ad4b2cbed934d5d850fe764dc46c4becbcb
from branch 'libpng18'.

Reviewed-by: John Bowler <jbowler@acm.org>
Reviewed-by: Chris Blume <ProgramMax@gmail.com>
Reviewed-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-01-02 11:15:20 +02:00
Cosmin Truta
6f786ff0f6 Update the copyright year
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-01-02 11:08:58 +02:00
John Bowler
d7d950e8bd [libpng16] chore: Clean up the leading blank lines from all source files
The leading blank lines are apparently an artefact of an older source
control system.  They are not required and they look like accidents,
because starting a source file with a blank line is not a regular habit
of software developers nowadays.

This is a cherry-pick of commit 37cc20add8fb5b83bb5299a26cd3b41e0f776017
from branch 'libpng18'.

Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-10-11 11:51:04 +03:00
Cosmin Truta
ef153d5325 Bump version to 1.6.45.git 2024-09-14 11:46:34 +03:00
Cosmin Truta
f5e92d7697 Release libpng version 1.6.44 2024-09-12 23:44:44 +03:00
Cosmin Truta
1964d560e9 Deprecate PNGARG and remove all of its remaining uses 2024-09-10 19:15:13 +03:00
Cosmin Truta
f1848a3b56 Bump version to 1.6.44.git 2024-02-24 13:32:56 +02:00
Cosmin Truta
ed217e3e60 Release libpng version 1.6.43 2024-02-23 11:51:40 +02:00
Cosmin Truta
920db2ecc0 api: Introduce the PNG_LIBPNG_VER_SHAREDLIB macro; update pngwin.rc
The version macros `PNG_LIBPNG_VER_SONUM` and `PNG_LIBPNG_VER_DLLNUM`
weren't always in sync, but they should be, going forward.

Or, better yet, we should keep them in, deprecated, and introduce
`PNG_LIBPNG_VER_SHAREDLIB` for all shared library builds of all kinds
on all platforms.

It is unknown how many user applications have been using these macros.
We have been using `PNG_LIBPNG_VER_DLLNUM` for pngwin.rc, for example.
Which, by the way, was last updated in 2009.
2024-02-05 21:54:19 +02:00
Cosmin Truta
4356cb0709 Bump version to 1.6.43.git 2024-01-31 11:32:51 +02:00
Cosmin Truta
35d9f5ea52 Release libpng version 1.6.42 2024-01-29 22:51:33 +02:00
Cosmin Truta
ac944e2b36 Fix a regression introduced in "chore: Clean up the return statements"
This fixes commit 27e548af2518ff8d278b45c40d11ad1bdd68eaa0.

The macro `png_check_sig` has been deprecated and remained untested
for decades. And yet, somehow it escaped from all past API cleanups.

Also update the libpng manual.

Reported-by: Matthieu Darbois
2024-01-29 15:30:10 +02:00
Cosmin Truta
ba980b8f0c Release libpng version 1.6.41 2024-01-24 18:59:00 +02:00
Cosmin Truta
27e548af25 chore: Clean up the return statements and update example.c accordingly 2024-01-23 21:25:03 +02:00
John Bowler
269b753496 Do not build unused Adler32 code
This removes the default build of an undocumented feature to disable
Adler32 checksums on those systems where it was the default.

The PR is motived by github #187 however it fixes a much more general
problem (#187 is limited to an issue where libpng "crashes" on some
manufacturer systems).  The fix is based on a suggestion by @sgowdev who
is the originator of the issue.

When libpng disables the checking of Adler32 checksums it does so by an
undocumented and therefore possibly unsupported call to a zlib function
which does not exist in some versions of zlib.

Fortunately libpng only does this if the caller of libpng explicitly
asks for it to happen.  Unfortunately the call to the undocumented
function is still in the compiled and built libpng and this means that
on some systems (as identified in #187) libpng can fail to load or maybe
even crash.

The libpng authors are currently unaware of any program or system that
uses this feature and none has been identified by the contributors to

In this fix an option is added to *enable* the code so that by default
the code is *disabled* - this is a simple generalization of the
suggestion by @sgowdev.

BENEFITS: the problem is eliminated, users of the functionality, if any,
are idenfified, the functionality can be implemented correctly in the
future or it can be removed.  Hardly anyone complains.

COSTS: someone will complain that they have to enable an option in a
libpng build to use a feature that never worked consistently in the
first place.

This patch has been tested both with the option enabled and with it
disabled via pngusr.dfa.  Tests, checks pass with cmake and configure,
make distcheck passes on configure.

Reported-by: Stephen Gowen <dev.sgowen@gmail.com>
Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-01-18 23:57:06 +02:00
gxw
ce4b632dd7 Optimize png16 with loongson mmi for 64-bit os 2024-01-17 22:46:16 +02:00
Cosmin Truta
6b241f3786 Do not rely on INT_MAX in png.h
At a certain step in the configuration process, `gcc -Wundef`
complained about using `INT_MAX` without a definition in png.h,
which is easily fixable with an include.

We would rather not add any extra dependencies to png.h, however,
so we use some unsigned int arithmetic magic instead.
2024-01-12 01:12:08 +02:00
Cosmin Truta
6abf8c1e91 Fix the API comment about png_data_freer
The old note about this function being unlikely to work correctly was
likely incorrect.
2024-01-03 21:13:59 +02:00
Cosmin Truta
0dfe422e9f Update the copyright year 2024-01-02 21:25:55 +02:00
Cosmin Truta
d7f77bf271 Bump version to 1.6.41.git 2023-06-26 11:09:17 +03:00
Cosmin Truta
f135775ad4 Release libpng version 1.6.40 2023-06-21 22:06:40 +03:00
Cosmin Truta
9923515ff4 Update the copyright year 2023-01-09 19:50:00 +02:00
Cosmin Truta
3c761b5135 Bump version to 1.6.40.git 2022-11-27 13:10:35 +02:00
Cosmin Truta
07b8803110 Release libpng version 1.6.39 2022-11-20 23:53:23 +02:00
Cosmin Truta
6fc5119423 Bump version to 1.6.39.git 2022-09-17 13:36:12 +03:00
Cosmin Truta
0a158f3506 Release libpng version 1.6.38 2022-09-14 22:42:00 +03:00
luz paz
f16427e58e Fix various typos
Found via `codespell -q 3 -S ./ltmain.sh,./scripts/libtool.m4 -L ake,ans,ba,bloc,crashers,doed,inout,lengthh,maked,paeth,parm,parms,redy,unx`
2022-09-13 01:35:28 +03:00
Cosmin Truta
723b2d9f2e Update the copyright year 2022-08-26 03:12:35 +03:00
Cosmin Truta
b7ea74c97d Update the copyright year 2021-03-15 20:23:26 -04:00
Cosmin Truta
2c0aee56a0 Update the copyright year 2020-02-02 20:02:00 -05:00
Cosmin Truta
5df8e982e2 Bump version to 1.6.38.git 2019-04-14 14:10:32 -04:00
Cosmin Truta
a40189cf88 Release libpng version 1.6.37 2019-04-14 14:10:32 -04:00
Miguel Ojeda
8da8257d0b Fix typo in the new v2 license
Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2019-04-14 11:15:51 -04:00
Cosmin Truta
fef895aa28 Update the copyright year 2019-01-19 19:01:19 -05:00
Cosmin Truta
6a94d14567 Bump version to 1.6.37.git 2018-12-30 12:00:41 -05:00
Cosmin Truta
eddf902320 Release libpng version 1.6.36 2018-12-01 09:36:00 -05:00
Cosmin Truta
e79085a172 Introduce the PNG Reference Library License version 2
The new libpng license comprises the terms and conditions from the zlib
license, and the disclaimer from the Boost license.

The legacy libpng license, used until libpng-1.6.35, is appended to the
new license, following the precedent established in the Python Software
Foundation License version 2.

From now on, the list of contributing authors shall be maintained in a
separate AUTHORS file.

The lists of previous contributing authors, mentioned in the legacy
libpng license and considered to be an integral part of that license,
are kept intact, with no further updates.
2018-11-25 23:33:30 -05:00
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