Compare commits

...

1294 Commits

Author SHA1 Message Date
Cosmin Truta
7cecdcae07 Harden a vestigial check against overflow inside png_zalloc
Reported-by: Sergio Atienza Pastor, MTP Métodos y Tecnología
2025-07-03 22:42:11 +03:00
Cosmin Truta
cf59edd364 Bump version to 1.6.51.git 2025-07-02 20:24:24 +03:00
Cosmin Truta
2b978915d8 Release libpng version 1.6.50 2025-07-01 23:50:00 +03:00
Cosmin Truta
254a64ec30 doc: Update the man pages to the final PNG-3 specification
Also make editorial changes regarding the previous PNG specifications.
2025-07-01 22:57:36 +03:00
Cosmin Truta
9eb25bd899 chore: Rerun ./autogen.sh --maintainer 2025-06-30 23:46:32 +03:00
Cosmin Truta
8087a21d0a build: Fix the CMake file for cross-platform builds that require libm
Detect the availability of `libm` on the target platform.
Previously, `libm` was detected on the host platform only.

Also introduce the variable `PNG_LINK_LIBRARIES`.
Stop using `M_LIBRARY`, which was not namespace-clean.
2025-06-30 22:27:17 +03:00
John Bowler
2e5f296bfa fix: Prevent unknown chunks from causing out-of-place IEND errors
PNG_AFTER_IDAT was not set by the IDAT read code if unknown chunk
handling was turned on.  This was hidden in the current tests by checks
within the text handling chunks. (For example, pngtest.png has a zTXt
chunk after IDAT.)

This change modifies both the sequential and the progressive reader to
reliably set PNG_AFTER_IDAT when the first non-IDAT chunk is seen and
before that chunk is processed.

The change is minimalist; PNG_HAVE_CHUNK_AFTER_IDAT can probably be
removed and replaced with PNG_AFTER_IDAT.  Making the latter change is
something to be considered in libpng2.

Co-authored-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-06-30 16:27:22 +03:00
Filip Wasil
4266c75f40 riscv: Remove unused argument
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-06-28 16:19:11 +03:00
Filip Wasil
f451a4de09 riscv: Simplify the runtime check to always be present
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-06-28 16:19:11 +03:00
Filip Wasil
6aa47debba riscv: Do not overwrite -march when testing against SIMD availability
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-06-28 16:19:11 +03:00
Filip Wasil
3391bb98e3 riscv: Use C intrinsics
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-06-28 16:19:11 +03:00
Filip Wasil
21895b05ab riscv: Clearly separate the build flow for autotools and cmake
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-06-18 14:43:36 +03:00
Cosmin Truta
be81ebe1a4 chore: Rerun ./autogen.sh --maintainer 2025-06-17 11:41:32 +03:00
Filip Wasil
edf46621f3 riscv: Improve the RVV availability check
In some cases, the vector extension is not supported, although the
compiler allows the "v" flag in `-march` and includes `<riscv_vector>`
without raising an error.

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-06-17 11:40:57 +03:00
Cosmin Truta
5dc5937b30 chore: Update .gitignore
This is a cherry-pick of commit df3b9173277aae60b08a216dc23484f6ec171ef5
from branch 'libpng18'.
2025-06-14 18:35:46 +03:00
Cosmin Truta
7084241c75 Bump version to 1.6.50.git 2025-06-14 17:13:02 +03:00
Cosmin Truta
640204280f Release libpng version 1.6.49 2025-06-12 20:05:46 +03:00
Cosmin Truta
740366c32b doc: Update the png.5 man page to the latest PNG-3 draft 2025-06-12 19:58:06 +03:00
Cosmin Truta
5d53dfd20c chore: Rerun ./autogen.sh --maintainer 2025-06-12 18:46:04 +03:00
Filip Wasil
5b62726ced riscv: Fix autodetection of RVV support
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-06-12 18:44:02 +03:00
Cosmin Truta
a5830bfcb1 build: Fix the detection of the math library in the CMake file
This is a fix of commit 5631b9b952e6940c67d4b48c00882e99229aa31b
"build: Implement various improvements to the CMake file"
2025-06-11 21:38:01 +03:00
Cosmin Truta
3bca02e274 examples: Refactor and reformat using clang-format
Add contrib/examples/.clang-format, tailored to fit the existing code
as closely as possible. The end goal is to set up automatic formatting
for the entire libpng source tree. We're doing this experiment in this
subdirectory, for now.

Also make refactoring changes, as follows:

 * Rewrite the preprocessor checks `#if PNG_FOO_SUPPORTED` to stop
   compilation immediately, with a descriptive `#error` about what
   needs to be supported.

 * Rewrite and reflow comments, add braces and brackets, and make other
   minor modifications that are suited for the clang-format'ed code.
2025-06-01 22:40:38 +03:00
Sanjay Jangid
197bbfe0d5 examples: Fix file descriptor leak in iccfrompng.c by closing input file
Reviewed-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-05-31 17:06:28 +03:00
Cosmin Truta
0cc6436ef5 build: Repair and reduce the CMake build dependency graph
A funny thing happened while refactoring the function argument parsing
in the `PNGGenConfig` module: the processing of dependencies inside
the CMake function `generate_copy` got fixed, thanks to an inadvertent
typo correction!

Going down the rabbit hole, we uncovered two issues:

 1. A typo in `scripts/cmake/PNGGenConfig.cmake` caused a dependency
    declaration to disappear, disrupting the graph. Fortunately, this
    disruption was being mitigated by an additional set of (redundant)
    symbolic target declarations that kept the CMake build going.

 2. The exact string matching inside `scripts/cmake/gensrc.cmake.in`
    imposed an artificial limitation, disallowing the use of absolute
    file paths.

The typo correction in (1), and the use of regex matching instead of
exact string matching in (2), allowed us to use absolute file paths
in the main CMake file, consistently, thus allowing CMake to recognize
them as uniquely-identifiable nodes in the dependency graph. There
should be no further need to have extra symbolic targets for proper
node identification.

In the end, we shaved off the redundant symbolic target declarations,
retaining only `png_genfiles` and `png_genprebuilt`.
2025-05-29 22:55:00 +03:00
Cosmin Truta
f04c457a51 build: Remove the PNG_DEBUG option from CMake files and project files
Counter-intuitively, defining the PNG_DEBUG macro as 1 (i.e. setting
the debug verbosity level to 1) does *not* cause any of the existing
debug traces to show up. This setting would have worked if we had trace
statements like `png_debug(0, message)`, but we don't have any.

Debug traces do show up for verbosity levels from 2 to 5. The libpng
manual describes in detail how they are meant to be used.

According to the history of the CMake file, as well as the history of
other project files, PNG_DEBUG was never set to a numeric value larger
than 1. In other words, these debug settings inside these build files
never produced any output in any (unmodified) libpng version.

(As for the configure build, PNG_DEBUG has no special treatment there.)

Considering the plethora of alternative methods to pass C preprocessor
options through our build files, scripts and projects onto libpng, we'd
rather discontinue PNG_DEBUG as a dedicated build option.
2025-05-29 19:47:03 +03:00
Cosmin Truta
5631b9b952 build: Implement various improvements to the CMake file
Allow the CMake build to work properly, even if file paths (in the
source directory, in the build directory, or in the install directory)
might contain whitespace characters.

Improve the check for compilers that might use MSVC Runtime library
headers on Windows. We use POSIX-ish ("deprecated") functions, even
on Windows, and we want no spurious warnings.

Tidy up the CMake file: rearrange declarations, rewrite comments, etc.
2025-05-29 18:28:16 +03:00
Joost Nieuwenhuijse
dc71f481ff build: Fix apple-non-apple cross building
When cross compiling for an apple platform on a non-apple platform
(or the reverse), `if(APPLE)` in line 32 should refer to the target
platform. Without importing the `APPLE` variable, it refers to the
host platform.

Reviewed-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-05-28 17:24:21 +03:00
Cosmin Truta
e2c1579816 ci: Add action-editorconfig-checker to the GitHub Action for linting
The editorconfig-checker program is not installed by default in the OS
used by GitHub Actions. Fortunately, the editorconfig-checker authors
have kindly provided the action-editorconfig-checker repository, which
we are now using.
2025-05-28 11:02:47 +03:00
Cosmin Truta
cff8620272 chore: Add riscv/.editorconfig and pacify editorconfig-checker
Also tidy up the new RISC-V code to comply with our coding style,
and rearrange comments inside png.h to improve readability within
the configured editing limits.
2025-05-27 11:28:56 +03:00
Cosmin Truta
5be32eb35c chore: Rerun ./autogen.sh --maintainer 2025-05-26 22:37:06 +03:00
Filip Wasil
611bf1016c riscv: autotools update 2025-05-19 15:58:44 +02:00
Filip Wasil
0e37c0b477 riscv: Fix more comments
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-05-14 22:35:47 +03:00
Filip Wasil
7108843467 riscv: Fix the run-time checking of the RVV availability
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-05-14 10:24:58 +03:00
Filip Wasil
2b0eb78656 riscv: Fix autotools definitions and comments
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-05-14 10:24:58 +03:00
Filip Wasil
ffb8e8b26f Fix and improve the RISC-V Vector (RVV) implementation
Changes include manually merged code from Manfred SCHLAEGL.

Co-authored-by: Manfred SCHLAEGL <manfred.schlaegl@gmx.at>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-05-01 17:44:00 +03:00
Dragoș Tiselice
cc5ee6b213 Add optimized RISC-V Vector functions
Largely based off of the ARM NEON implementation.

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-05-01 17:44:00 +03:00
Cosmin Truta
b4800bae33 Bump version to 1.6.49.git 2025-05-01 14:50:23 +03:00
Cosmin Truta
ea12796820 Release libpng version 1.6.48 2025-04-30 16:51:46 +03:00
Cosmin Truta
643dbda7d6 doc: Update the png.5 man page to the latest PNG-3 draft specification
Also update libpngpf.3 to explicitly state that the internal functions
should not be used by applications.
2025-04-30 16:30:24 +03:00
Cosmin Truta
34e3f7a65b Remove the config for Travis CI (and thank them for their support!)
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-04-30 11:49:37 +03:00
Cosmin Truta
3e67531078 chore: Add a TODO note in .cmake-format.yaml; reformat CMakeLists.txt
Apply some (but not all) of the suggestions made by the cmake-format
program. Meanwhile, the cmake-lint program is (still) happy.
2025-04-29 17:30:30 +03:00
Cosmin Truta
23bdc7a6c4 build: Add the CMake build option PNG_LIBCONF_HEADER
Running the pnglibconf scripts (script/*.awk) is not always possible.
An AWK interpreter is not always guaranteed to be available; and even
if it is, there are limitations when making cross-platform libpng
builds, especially when the differences between the host platform and
the target platform are significant. For example:
 * Building for the Windows (MinGW) target on a Unix development host;
 * Building for the iOS target on a macOS development host;
 * Building for the Android target on any development host.

In such scenarios, a preconfigured (i.e. prebuilt) pnglibconf.h file,
either taken from the libpng source tree or provided by the user who
wants to make a custom libpng build, becomes a necessity.

In this commit we introduce the build option `PNG_LIBCONF_HEADER` in
order to address this specific use case.

We also specify a version range (3.14...4.0) for the minimum required
CMake program, to future-proof the CMake build for just a little bit
longer.

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-04-28 20:44:53 +03:00
Cosmin Truta
69a3e5bfd1 chore: Clean up the error directives
Make the error directives uniformly consistent with one another.
Remove surrounding quotes and trailing punctuation, and rephrase
some of the error messages and some of their associated comments
for either brevity or clarity.
2025-04-25 16:19:30 +03:00
Cosmin Truta
c90491724e Discourage the inclusion of private headers outside libpng
Add checks inside the private png*.h header files, in order to reduce
unintentional occurences of application backdoors.

Such backdoors might occur, for example, when we make changes to the
internal data structures that might somehow "leak" from the libpng
code into the user code. The applications that use the libpng API must
pretend not to know that these headers exist at all.

Co-authored-by: John Bowler <jbowler@acm.org>
Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-04-25 15:35:11 +03:00
John Bowler
98448e372d Remove unused function from write-only configurations
`png_icc_profile_error` is no longer used when writing iCCP chunks,
therefore it can be compiled out when the reading is disabled.

This change includes two `minconfig` files to test read-only and
write-only "full" configurations, to supplement the existing tests
for "minimal" configurations.

Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-04-22 19:35:01 +03:00
John Bowler
f2b0f5fe1c fix(mDCv): Correct the floating-point setter png_set_mDCv
In the floating-point API function `png_set_mDCv` we incorrectly
divided by two the chromaticity values before passing them on to
`png_set_mDCv_fixed`.

Reported-by: Mohit Bakshi <mohitbakshi2205@gmail.com>
Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-04-22 18:08:39 +03:00
Chris Blume
7101a5569f Correct mistake in example.c 2025-04-22 18:04:46 +03:00
Cosmin Truta
e046c0dc3b Revert "Recover from errors in ancillary chunks"
This reverts commit 34005e3d3d373c0c36898cc55eae48a79c8238a1.

Although I agreed with Lucas Chollet initially, I finally understood
the objection brought forth by John Bowler: "[...] it's not an
ancillary chunk type if it's not a chunk type in the first place."

I feel that more deliberation is needed on what a robust PNG decoder
should do when it stumbles upon a chunk type that fails to meet its
basic requirements. A clarifying recommendation for decoders may or
may not need to be stipulated in the PNG specification as well.

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-04-22 16:39:01 +03:00
Lucas CHOLLET
34005e3d3d Recover from errors in ancillary chunks
As per the third edition of the spec, decoders should recover from
errors in ancillary chunks.

In section 13.1 Error handling [1]:
> Anomalous situations other than syntax errors shall be treated as
> follows:
>  1. Encountering an unknown ancillary chunk is never an error. The
>     chunk can simply be ignored.

More specifically, in this commit, if a chunk that is detected as
ancillary, does not pass the `check_chunk_name()` function, only a
_benign_ is issued, instead of an error.

This allows libpng to fully decode images like [2] and [3]. It has been
tested by passing them to both pngtest and Gnome's image viewer. Note
that invalid-unknown-ancillary-after-IDAT.png could already be displayed
but not fully decoded.

[1] https://w3c.github.io/png/#13Decoders.Errors
[2] https://github.com/web-platform-tests/wpt/blob/master/png/errors/support/invalid-unknown-ancillary.png
[3] https://github.com/web-platform-tests/wpt/blob/master/png/errors/support/invalid-unknown-ancillary-after-IDAT.png
2025-03-04 15:13:19 -07:00
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
738f5e743c ci: Add more checks to ci_verify_version.sh; refactor
In addition to png.h, configure.ac and CMakeLists.txt, the script
ci_verify_version.sh is now able to verify libpng-config-head.in also.

For the benefit of readability, the old script ci_shellify.sh has been
split into smaller, independent scriptlets: libexec/ci_shellify_*.sh.

The linting script ci_lint.sh has been updated as needed.
2025-02-20 11:59:16 +02:00
Cosmin Truta
f20e66aa93 chore: Apply some of the missed updates to the copyright year 2025-02-19 13:15:14 +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
bb7e922914 ci: Introduce the CI_NO_BUILD flag
For testing purposes (e.g. wanting to see if "make distclean" works
correctly with and without building), as well as development purposes
(e.g. wanting to inspect the artifacts produced in the configuration
stage), add `CI_NO_BUILD` to the family of contrarians.
2025-02-17 21:13:32 +02:00
John Bowler
b20e6fb314 pngimage: clean up on user/internal errors
pngimage: The code simply exited with a return code of 99 in the event
of a user error including giving pngimage invalid PNG files and an
internal error.  It now attempts to clean up the state before doing so,
matching the normal behaviour.

pngimage: Non-ISO use of setjmp(3) corrected.

pngerror.c: Failure to call png_image_free on a false result from a
png_safe_execute function call fixed.  This was a regression caused by
the 'volatile' clean-up.  Not normally detectable because png_image_free
will often be called by the application.

Reviewed-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-02-17 11:38:28 +02:00
Chris Lilley
5356b94169 Update man page to latest PNG 3e draft 2025-02-11 11:39:31 -05:00
John Bowler
812c34c13c test: add limit configuration tests
nocompile-limits.dfa: turns off all limits including run-time limits

nolimits.dfa: makes the compile time limits unlimited while leaving on
    the run-time limits.

Fixes compiler warnings exposed by these tests. These are just warnings,
there were no bugs other than a failure to handle systems with a 16-bit
at the appropriate time which would result in a later failure on malloc.

png.c: png_icc_check_length: in-line code was still used in place of
    png_chunk_max when checking the current chunk allocation limit.  The
    in-line code did not handle PNG_MAXSEG_64K and, anyway, issued
    compiler warnings in the 'nocompile-limits' case.  Changed to use
    png_malloc_max.

pngrutil.c: eliminated an erroneous 'truncation' warning with GCC-14 by
    using a safe cast.

pngtest.c: failed to check for PNG_USER_LIMITS_SUPPORTED around API
    calls which don't exist without PNG_USER_LIMITS.

Signed-off-by: John Bowler <jbowler@acm.org>
2025-01-31 09:46:21 -08:00
John Bowler
68e090e700 fix: png_write_iCCP check on profile length
This is a regression of commit a8242dd9473a8da4d851623cf0b514a8ee4bee34
"PNGv3 colourspace precedence rules conformance".

Previously, `png_write_iCCP` used the length from the first four bytes
of the profile set by `png_set_iCCP`, rather than the actual data length
recorded by `png_set_iCCP`.

If the profile data were less than 4 bytes long, it would have caused
a read-beyond-end-of-malloc error.  This bug was in the libpng code even
before the changes introduced in the above-mentioned commit, but it was
inaccessible.  It became accessible when we removed the pre-PNGv3 colour
space checks in `png_set_iCCP`.

Reported-by: Bob Friesenhahn <bobjfriesenhahn@gmail.com>
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-30 23:22:42 +02:00
Cosmin Truta
8c7ed2e3b2 fix: Typo in a preprocessor directive
This is a regression of commit 2519a03418af2108d3bd8c269ba01ab72ae240ef
"refactor: Clean up the checking of chunk lengths and allocation limits"

Compilation would break under the "right" non-default configuration.
(Oopsie!)

Also clean up comments in the surrounding code.

Reported-by: chris0e3 <chris0e3@gmail.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-01-30 23:07:55 +02:00
John Bowler
2519a03418 refactor: Clean up the checking of chunk lengths and allocation limits
Internal changes only.

Move chunk length checks to fewer places:

Change `png_struct::user_chunk_malloc_max` to always have a non-zero
value, in order to avoid the need to check for zero in multiple places.

Add `png_chunk_max(png_ptr)`, a function-like macro defined in pngpriv.h
which expresses all the previous checks on the various USER_LIMITS and
system limitations.  Replace the code which implemented such checks with
`png_chunk_max`.

Move the malloc limit length check in `png_read_chunk_header` to
`png_handle_chunk` and make it conditional on the chunk type.

Progressive reader: call `png_read_chunk_header`.

Correct the handling of pHYs.

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-30 20:30:44 +02:00
John Bowler
c4b20d0a3a test: add configuration tests and fix bugs
The two new configuation tests, fixed.dfa and float-fixed.dfa verify
that the 'standard' configuration of libpng works without floating point
arithmetic.

Signed-off-by: John Bowler <jbowler@acm.org>
2025-01-27 10:59:58 -08:00
John Bowler
a8242dd947 PNGv3 colourspace precedence rules conformance
This is a major change required by the new PNGv3 colour chunk precedence
rules.  It **does not** change the libpng API (png.h) however it changes
the following handling of PNG files:

IFF the PNG file contains colour space information it changes from the
libpng v3 behaviour to the now compulsory PNG v3 behaviour:

1) libpng no longer invalidates colour space chunks because they are
   inconsistent.
2) libpng no longer responds to the "png_get_" APIs positively if they
   are not present in the PNG but can be deduced from the colour space
   chunks that are present.
2025-01-27 10:59:33 -08: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
Cosmin Truta
fcb0bca15f chore: Update the .editorconfig file; add/update README files
Add various missing pieces to their right places:
 * Update .editorconfig in order to let editorconfig-checker know that
   aclocal.m4 (which is auto-generated) may contain trailing whitespace.
 * Add ci/README.md.
 * Update scripts/README.txt.

TODO:
Integrate editorconfig-checker into the linting workflow on GitHub.
(See .github/workflows/lint.yml)
2025-01-22 23:19:49 +02:00
Cosmin Truta
deadeea7a2 chore: Fix a typo in Makefile.am; rerun ./autogen.sh --maintainer 2025-01-22 15:15:58 +02:00
Cosmin Truta
9cc729b523 build: Update scripts/makefile.*
Apply the following updates:
 * Tidy up the compiler flag definitions.
 * Update the Darwin, Linux and MSYS makefiles to match the compiler
   flags used in scripts/makefile.clang and scripts/makefile.gcc.
 * Add the `pngtest-static` target in the Darwin makefile, following
   on the Linux makefile.
 * Rewrite some of the implicit make rules to match one another more
   consistently.
 * Make corrections in the copyright years to match git log.
2025-01-21 19:06:43 +02:00
Cosmin Truta
36a16fd761 build: Add scripts/makefile.c89; update other makefiles
Add scripts/makefile.c89 and refactor scripts/makefile.emcc,
scripts/makefile.clang and scripts/makefile.gcc

Refactor variable definitions inside scripts/makefile.clang,
scripts/makefile.gcc and scripts/makefile.emcc, and start using
the option `-pedantic-errors` unconditionally. This option was
first implemented in GCC version 3.1, and it was available in
Clang and in other Clang-based compilers (e.g. Emscripten) from
the beginning.

Add scripts/makefile.c89, derived from the above makefiles, but
with `-pedantic-errors -std=c89`. We aren't enabling the C89 level
by default, to avoid any incompatibility, whether intentional or
accidental, with the compiler's default language level. However,
we are still continuing to support C89 in the 'libpng16' branch,
and this special makefile can be used for testing purposes.
2025-01-21 18:42:49 +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
Cosmin Truta
19a5a5eba3 pngminus: Remove a workaround for an old printer
A downgrade from 16-bit samples to 8-bit samples, or an expansion from
1- or 2-channel grayscale (or grayscale+alpha) to 3- or 4-channel
RGB (or RGB+alpha), etc., may be deemed generally useful. Such image
transforms could be made available to the user via command-line options.
On the other hand, keeping the decision to disable or enable these
transforms unconditionally at compile time (e.g. because they're needed
to work around a specific printer's limitations) is less than ideal.
2025-01-10 14:49:51 +02:00
Cosmin Truta
8a28d0558e pngminus: Fix a typo in png2pnm.c 2025-01-10 13:21:21 +02:00
Cosmin Truta
03660a516b pngminus: Add .editorconfig file; update the CMake file 2025-01-10 12:27:01 +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
Cosmin Truta
3714c584b1 chore: Rerun ./autogen.sh --maintainer 2025-01-06 19:48:56 +02:00
Cosmin Truta
2a845ff819 build: Move portions from the main CMake file to separate modules
In preparation for the upcoming changes in the build system, any parts
of the CMake file that are unlikely to be affected should be moved out
of the way. This should facilitate an easier resync between the branch
'libpng16' and its successor(s).

Specifically:
 * Move the functions `generate_chk`, `generate_out`, `generate_source`
   and `generate_copy` to scripts/cmake/PNGGenConfig.cmake.
 * Move the function `png_add_test` to scripts/cmake/PNGTest.cmake.
 * Leave the function `create_symlink` in place, but add a TODO note.
   As we raised the minimum required CMake version to 3.14, we should
   now be able to use CMake's built-in function instead.
2025-01-06 17:09:10 +02:00
John Bowler
0cc367aaea [libpng16] fix: Write order of colourspace chunks should conform to PNG v3
cICP was written after PLTE, not before.  The other chunks were output
in an order which does not match the new PNG-v3 "priority" order.

This change outputs all chunks in the "priority" order; highest
precedence first.  This means that the PNGs so written conform to
PNG v3 (cICP), and allow a streaming app to handle chunks in order,
without buffering data which may later be overridden.

Note that PNG-v3 establishes the idea of dropping ancillary chunks
which are inconveniently ordered in the definition of how APNG chunks
are handled.

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

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-03 22:28:23 +02:00
Cosmin Truta
3042f74de0 [libpng16] fix: Update the cICP implementation yet more
For the sake of completeness:
 * Add the cICP entry to the list of known chunks to ignore inside
   `png_set_keep_unknown_chunks`.
 * Handle cICP in `png_read_end`, alongside cHRM, gAMA, iCCP, sRGB.
 * In pngtest.c, move the cICP test code near cHRM, gaMA, iCCP, sRGB.

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

Reviewed-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-01-03 13:46:34 +02:00
Cosmin Truta
4599354be8 [libpng16] test: Move cicp-display-p3_reencoded.png to contrib/testpngs/png-3/
Update the main CMake file and the auxiliary test scripts accordingly.

This is a cherry-pick of commit fe277b7752990be35523832a546aec478437968a
from branch 'libpng18'.
2025-01-02 20:01:25 +02:00
Cosmin Truta
823c2d80dc [libpng16] fix: Update the cICP support for better compliance with PNG-3
Apply the following corrections and improvements:
 * Add a validity check in `png_set_cICP`.
 * Fix the ordering check in `png_handle_cICP`.
 * Add a multiplicity check in `png_handle_cICP`.
 * Optimize the implementation of `png_write_cICP`.
 * Remove an unnecessary preprocessor guard from pngtest.c.
 * Update the dependency declaration in pnglibconf.dfa.
 * Fix the indentation where necessary.

This is a cherry-pick of commit c2a02691df1ecf51b7c97142752a7034350cb1f6
from branch 'libpng18'.
2025-01-02 11:15:20 +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
Cosmin Truta
c1cc0f3f4c [libpng16] build: Rename a private function to benefit C++Builder
Embarcadero's compilers, old (Borland-based) and new (Clang-based),
do have full support for Standard C. The Clang-based compiler is
claiming, through the macro __STDC_VERSION__, to support C99 and C11,
whereas the Borland-based compiler supports ANSI C, as it has for
decades.

However, their run-time library is exposing global functions beyond
the scope of Standard C, for backwards compatibility with the older
Borland products. One of these functions is `randomize`, which clashes
with a function inside pngvalid.c that incidentally has the same name.

Building libpng in "Strict ANSI C" mode, in which all Borland-specific
globals are hidden (e.g. via `bcc32 -A`), would have been a workable
solution for the Borland-based ANSI C compiler, but no such solution
appears to exist for the Clang-based C90/C99/C11 compiler.

Fortunately, renaming a private function inside a test program is a
cost-free alternative fix.

This is a cherry-pick of commit 6184164aa73ee764b1822f44d3db7619cf84f3fa
from branch 'libpng18'.
2024-10-18 16:16:16 +03:00
Cosmin Truta
d9d70e6506 [libpng16] refactor: Deduplicate the interlace arrays png_pass_*
Move the definitions of interlace arrays to the top of their respective
translation units, to reduce their repeated copying in various places of
the codebase.

TODO:
As they still exist in three copies, in pngpread.c, in pngrutil.c, and
in pngwutil.c, they should all be further moved to a common place.

This is a cherry-pick of commit 620a2b73b22df66ed099e1faacac2d92f48252b7
from branch 'libpng18'.
2024-10-17 14:18:52 +03:00
John Bowler
76e5ec217f [libpng16] test: Add a compile-time check in pngimage.c to avoid a failure
Disable the check on `interlace_method` inside function `compare_read`
in pngimage.c, if WRITE_INTERLACING is not supported.

If interlaced encoding is disabled inside libpng, the encoded images
are non-interlaced silently and unconditionally.  This commit updates
the image comparison to skip the interlace check in the resultant
image; other behavior is still checked.

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

Reviewed-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-10-15 23:23:53 +03:00
John Bowler
65470ac86c fix: Avoid integer overflows in function png_xy_from_XYZ
This is a cherry-picked of commit f45531cc141dc20dc7a4046bbe92270b1e799a5d
from branch 'libpng18'.

Reviewed-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-10-13 17:32:20 +03:00
Cosmin Truta
8b1d489bce [libpng16] style: Resolve the remaining warnings issued by cmake-lint
Resolve the indentation issues raised by cmake-lint on a fragment of
CMakeLists.txt that no longer exists in branch 'libpng18'.
2024-10-12 19:37:50 +03:00
Cosmin Truta
a7a8faeefa [libpng16] style: Add a cmake-format config file and satisfy cmake-lint
Introduce CMake file linting, based on the cmakelang project by
Josh Bialkowski (@cheshirekow).

Fix various style issues in the CMake files:
 * Add the missing copyright header to PNGConfig.cmake.
 * Resolve a "missing docstring" warning raised by cmake-lint.
 * Rewrite all docstrings in the style of CMake's own documentation.
 * Fix whitespace inconsistencies.

References:
 * https://pypi.org/project/cmakelang
 * https://github.com/cheshirekow/cmake_format

This is a cherry-pick of commit c317fe31114d92d05d44bf98c9b559edf4656b9c
from branch 'libpng18'.
2024-10-12 19:37:50 +03: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
John Bowler
f14d5fcd1e [libpng16] fix: Correct the function png_fp_sub in png.c
The code erroneously evaluated `addend0+addend1` in the case where
`addend1` is less than zero.  The function is meant to subtract the
second argument from the first.

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

Reviewed-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-10-10 22:29:03 +03:00
Cosmin Truta
7c90057cfe [libpng16] ci: Verification should pass regardless of autoconf artifacts
Allow ci_verify_configure.sh to pass regardless whether the configure
script and the associated configure control files are present.
This is necessary for the branches newer than 'libpng16', where these
artifacts are no longer auto-generated by default.

This is a cherry-pick of commit 09ec97edc099538d548a67253b990660c912af4f
from branch 'libpng18'.
2024-10-07 21:48:04 +03:00
Cosmin Truta
1bf304c43c [libpng16] ci: Use modern CMake command options in ci_verify_cmake.sh
Due to raising the minimum CMake version to 3.14, we can now run the
CMake build verification (ci_verify_cmake.sh) from the libpng source
dir, just as in the other scripts (ci_verify_*.sh). This is possible
thanks to the modern CMake command options `cmake -B` and `cmake -S`.

We can finally simplify the implementation of ci_verify_cmake.sh by
removing a code complication that was annoying, and yet, necessary in
peculiar Bash-on-Windows setups.

Fun fact:
CMake version 3.14 was released on 2019-03-14. Reportedly, on purpose!

This is a cherry-pick of commit 558dfbb7570cb74205f978f11504b217a2c03c2c
from branch 'libpng18'.
2024-10-06 22:39:51 +03:00
Cosmin Truta
9ee82380da [libpng16] test: Tidy up the logging of test program arguments in CTest
This is a cherry-pick of commit 2e416c623d293659a102936870c4b36c00e1b347
from branch 'libpng18'.
2024-10-06 21:54:21 +03:00
Cosmin Truta
642b5d81e3 [libpng16] build: Raise the minimum required CMake version to 3.14
Start using the features guaranteed to be available in CMake 3.14.
Specifically, use the ability of `find_package(ZLIB)` to pick up zlib
from the ZLIB_ROOT variable (if given).

This is a cherry-pick of commit 00343a761e41e56acaeb0517aec5325d3b951837
from branch 'libpng18'.
2024-10-06 21:54:21 +03:00
John Bowler
d3cf9b6e22 [libpng16] arm: Use png_aligncastconst for an upcast in Neon intrinsics
This changes the arm/palette_neon_intrinsics.c code from using a bare
cast to using the portable macro `png_aligncastconst`.  This removes
the `-Wcast-align` warning.

The cast is safe because the pointer was allocated by `malloc(1024)`,
and `malloc` is required to return a pointer with sufficient alignment
for anything the allocation can accomodate.

Nevertheless, this is a quick and dirty fix; the use of `png_bytep` in
the `png_struct` declaration of the pointer is machine-specific.  Other
architectures may need different types and, consequently, the only type
which is portable to other companies' CPUs is `(void*)`.

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

Reviewed-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-09-27 16:54:09 +03:00
John Bowler
d288a1dd36 fix: Adjust colorspace calculations for ACES AP0
The subtracts in PNG_XYZ_from_xy are producing integer overflow with
some valid but extreme xy values.  This re-introduces the previous
checks, but with less limited bounds; sufficient to accomodate the
ACEScg end points (ACES AP1), but not for the ACES AP0 end points.
Those were not working anyway because libpng reads the cHRM parameters
as unsigned values, so they must always be at least 0.

A better solution requires recognizing reasonable negative values (ones
which violate the current spec) and allowing them too, at least on read.

Reviewed-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-09-27 13:02:54 +03:00
John Bowler
0a27b48e94 [libpng16] mips: Eliminate use of non-ISO-C90 features
The MIPS MSA code contains // comments and the use of an "asm"
directive, neither of which are part of ISO-C90.  This removes the //
comments and converts asm to __asm__, which GCC allows.

The code compiles but maintenance is required; it's not clear it will
work on anything other than one specific compiler/isa combination.  It
should be rewritten using intrinsics, not assembler; as it stands it is
a security risk.

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

Co-authored-by: Cosmin Truta <ctruta@gmail.com>
Reviewed-by: Chris Blume <ProgramMax@gmail.com>
Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-09-25 14:50:59 +03:00
Cosmin Truta
65cd5fa3e5 ci: Fix the configuration for Travis CI and AppVeyor CI 2024-09-24 22:12:25 +03:00
Cosmin Truta
f3a45ac2e9 [libpng16] chore: Update .gitignore
Ignore artifacts produced by IDEs such as Embarcadero RAD Studio,
JetBrains Fleet, Qt Creator, and possibly others.

Also update the list of artifacts produced by C/C++ workflows and
CMake workflows in Microsoft Visual Studio and Qt Creator.

This is a cherry-pick of commit 10c76f3a1a9096f9b7cf64dd7abf5035e379e47f
from branch 'libpng18'.
2024-09-24 17:25:37 +03:00
Cosmin Truta
d161ce6116 [libpng16] projects: Add a build launcher to the Visual Studio project
Add projects/vstudio/build.bat, a wrapper for `devenv [...] /build`.

This is a cherry-pick of commit f1c01b5c36fc4fdcd9238c5295cc5565a9caa43e
from branch 'libpng18'.
2024-09-24 17:24:38 +03:00
Cosmin Truta
b3bcbf9f82 [libpng16] projects: Adjust settings in the Visual Studio project
Adjust the warning levels across the entire solution in order to tidy
up the build log.

Also remove the vestigial macro definition _USRDLL and add the missing
macro definition _CRT_SECURE_NO_WARNINGS.

This is a cherry-pick of commit 719705a2ab932a353748371c2e57f39ebc4bb8a3
from branch 'libpng18'.
2024-09-24 17:23:47 +03:00
John Bowler
b8a0a5401f [libpng16] test: Fix "make check" in all branches beyond 'libpng16'
This corrects the checks to that libpng 10800 does not turn on the
enhanced transform checks in either pngvalid or pngstest.  The correct
fix is to change the 10700 code for comments which explain what aspect
or aspects of the transforms are broken (ideally) or at least state that
the transforms are broken.

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

Reviewed-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-09-20 23:47:36 +03:00
Cosmin Truta
529e69e76a Revert "oss-fuzz: Update the README file, the Docker file and the build script"
This reverts commit 3117b5f94a06aaf52a7365074e8199909680e52e.

A regression was introduced. (Oopsie!)

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-09-19 21:37:52 +03:00
Cosmin Truta
cd5e582fd6 Revert "oss-fuzz: Transfer to an external repo and remove from this repo"
This reverts commit b7276eca0182bb6ad174ef044bb5f6f0504451af.

Although the brand new pngfuzz repo is coming up next, it turned out
that the deletion of contrib/oss-fuzz/ from the 'libpng16' branch was
premature. (Oopsie!)

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-09-19 21:26:25 +03:00
Cosmin Truta
bcb3124141 [libpng16] ci: Update ci_lint.sh to recognize .editorconfig-checker.json
As the editorconfig-checker program is transitioning from using
the .ecrc config file to the .editorconfig-checker.json config file,
the older program versions do not recognize the new config file name.

Update ci_lint.sh to instruct editorconfig-checker to pick up its
configuration from the new config file name, regardless of the program
version.

Also update ci_lint.sh to instruct yamllint to check all *.json files,
including .editorconfig-checker.json.

This is a cherry-pick of commit 77f88338a19a223cc678e1a6a04888a31c78dabf
from branch 'libpng18'.
2024-09-17 19:14:28 +03:00
Cosmin Truta
cb08862674 [libpng16] chore: Set the indent_size fields in .editorconfig
Also add an .editorconfig-checker.json file. We need to instruct the
editorconfig-checker program to skip the checks for the indent size.
(As of this commit time, editorconfig-checker is too rigid to recognize
"smart indentations".)

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

Co-authored-by: John Bowler <jbowler@acm.org>
Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-09-17 19:14:28 +03:00
Cosmin Truta
18ab7d09dd [libpng16] chore: Reorganize and update .gitignore
Ignore the files and the directories that are typically produced by
text editors, development tools, development environments, etc.

This is a cherry-pick of commit 050aa7bb936c8889a41942b0b83f5db8582bce17
from branch 'libpng18'.
2024-09-15 20:26:18 +03:00
Cosmin Truta
68d7ce8040 ci: Get ready for the upcoming branch 'libpng18' 2024-09-14 22:41:01 +03:00
Cosmin Truta
c0f3dd43d8 doc: Update the README and TODO files 2024-09-14 22:35:51 +03:00
Cosmin Truta
222dd7ca49 doc: Make a small correction about branches in the libpng manual 2024-09-14 18:53:00 +03:00
Cosmin Truta
e3c7b26fbd ci: Fix bad (but innocuous) copy pasta in ci_verify_version.sh 2024-09-14 16:38:02 +03:00
Cosmin Truta
b7276eca01 oss-fuzz: Transfer to an external repo and remove from this repo
A new repository named "pngfuzz", dedicated to fuzz testing PNG
processing software in general and libpng in particular, has been
created:

https://github.com/pnggroup/pngfuzz

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-09-14 13:40:59 +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
88ab4f592d chore: Rerun ./autogen.sh --maintainer 2024-09-12 21:44:11 +03:00
Cosmin Truta
3117b5f94a oss-fuzz: Update the README file, the Docker file and the build script 2024-09-12 18:26:10 +03:00
John Bowler
5a7e87fc04 fix: Prevent overflow in chromaticity calculations
In `png_xy_from_XYZ` X+Y+Z was calculated without checking for overflow.
This fixes that by moving the correct code from `png_XYZ_normalize` into
a static function which is now used from `png_xy_from_XYZ`.

Reviewed-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-09-12 12:14:01 +03:00
Green Sky
8cc22a8c15 cmake: Fix an error in the declaration of target include directories
Properly declare target include directories for generated includes.
Previously the non targeted `include_directories()` was used, which
had issue when using the `png_static` target in a submodule.

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-09-10 23:50:55 +03:00
Cosmin Truta
843dbb7579 Revert "cmake: Fix an error in the declaration of target include directories"
This reverts commit 1d1cc9ae18f677201bf7e47928c30562df967756.

The verification has failed. (Oopsie!)
2024-09-10 22:41:03 +03:00
Green Sky
1d1cc9ae18 cmake: Fix an error in the declaration of target include directories
Properly declare target include directories for generated includes.
Previously the non targeted `include_directories()` was used, which
had issue when using the `png_static` target in a submodule.

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-09-10 22:03:13 +03:00
Cosmin Truta
1964d560e9 Deprecate PNGARG and remove all of its remaining uses 2024-09-10 19:15:13 +03:00
Mikhail Khachayants
68ba4f1f7d oss-fuzz: Add fuzzing targets for simplified READ API
New target added to libpng_read_fuzzer.cc for simplified READ API.
2024-09-09 23:45:06 +03:00
Benjamin Buch
0e204b7364 build: Add a CMake config file compatible with the FindPNG module
Co-authored-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-09-08 21:57:37 +03:00
Cosmin Truta
53a7f4e320 ci: Simplify the Travis CI configuration matrix
Going forward, we will continue to verify the cmake build and the
configure build with the hardware optimizations enabled by default,
and the makefile build with the hardware optimizations disabled by
default.

The Travis CI configuration file is simpler, and, more importantly,
the Travis CI verification process will be shorter and cheaper.
2024-09-08 15:58:08 +03:00
Cosmin Truta
fcdec9c66e chore: Delete contrib/tools/chkfmt.sh
Going forward, we will continue developing and using ci/ci_lint.sh
2024-09-08 15:35:10 +03:00
Cosmin Truta
222086586b chore: Pacify editorconfig-checker version 3.0 2024-09-08 15:22:58 +03:00
Ben Wagner
40878fd6dc fix: Restore STDERR in pngtest.c
In "test: Add consistency checks for the PNG_LIBPNG_VER* number" [0] the
`STDERR` macro was moved from outside an `ifdef` to inside an `ifdef`.
This broke the code in the `else` of this `ifdef` which also uses the
`STDERR` macro. Move `STDERR` back to where it was to avoid compile
errors in the `else` case.

[0] cc8006c48d

Fixes: #560
Reviewed-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-09-08 10:47:44 +03:00
John Bowler
20f819c29e fix: Remove cHRM check to accomodate ACES AP1
ACES AP1 has a red endpoint with a negative Z, this triggers the checks
in libpng that ensure that x, y and z (chromaticities) are all >=0.
This removes the checks on the sign of the chromaticities since it is
valid to use negative values for any of them and converts the "internal"
error code return to external (because the internal cases correspond to
negative x, y or z.)

Reviewed-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-09-07 13:07:21 +03:00
Cosmin Truta
7e18d14296 ci: Add the targets/ subdirectory to facilitate cross-platform testing
Considering that a non-trivial amount of libpng code is arch-specific,
we should perform cross-platform builds (with cross-platform toolchains)
and test runs (on emulated architectures) in our routine verification.

The content of ci/targets/ shall consist of target description files,
written in the standard shell language. These files may be source'd as
needed, before running the verification scripts ci/ci_verify_*.sh.

Here is the initial list of target systems:
Android, Cygwin, FreeBSD, Linux, MSDOS, Windows.

And here is the initial list of target architectures:
ARM, MIPS, PowerPC, RISC-V, x86.
2024-09-05 22:23:30 +03:00
Eric Riff
43d6ad3e15 cmake: Honor CMAKE_SYSROOT if set
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-09-05 18:35:46 +03:00
Cosmin Truta
33ef48b6d6 cmake: Fix the handling of PNG_HARDWARE_OPTIMIZATIONS on FreeBSD/amd64
Because of a missing "amd64" string (in lowercase) in a regex match,
the CMake build was unable to pick up the PNG_HARDWARE_OPTIMIZATIONS
flag on FreeBSD/amd64 (and possibly other amd64 systems as well).

Rename the target arch variable from TARGET_ARCH to a more idiomatic
PNG_TARGET_ARCHITECTURE, and set it to an always-lowercase string.
The follow-on checks are now simpler and easier to get right.
2024-09-04 18:32:03 +03:00
Cosmin Truta
532fec0214 ci: Fix the verification of the msys2 toolchain on AppVeyor CI
Initialize the arch-specific MSYSTEM environment variable, to ensure
that msys2 bash picks up and executes /etc/profile correctly.

Install and use the host-specific cmake and ninja, to ensure that
msys2 cmake picks up the host-specific zlib build correctly.
2024-09-03 14:48:50 +03:00
Cosmin Truta
e4a31f024b arm: Add a placeholder file in lieu of the former filter_neon.S
In the previous commit 9e538750d99c8f1accf7e93878e4fde47c069908
we removed the obsolete assembler implementation `filter_neon.S`.

In this commit we add a stand-in for the original file, restoring
the original source tree structure, for the benefit of continuing
hassle-free libpng source upgrades in the 1.6.x line.
2024-06-17 15:28:38 +03:00
Ross Burton
9e538750d9 arm: Remove obsolete assembler implementation filter_neon.S
This file contains hand-coded assembler implementations of the filter
functions for 32-bit Arm platforms.  These are only used when the
compiler doesn't support neon intrinsics (added to GCC 4.3 in 2008) or
is exactly GCC 4.5.4 (released 2012), both of which are sufficiently
unlikely to be true that it's fair to say the assembler is no longer
used.

This commit deletes filter_neon.S and removes the now obsolete
preprocessor logic in pngpriv.h.

Signed-off-by: Bill Roberts <bill.roberts@arm.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-06-15 23:09:34 +03:00
John Bowler
ceed2a3cf6 SECURITY: disable build of filter_neon.S on arm
This fixes the bug https://github.com/pnggroup/libpng/issues/505
"libpng does not support PAC/BTI on aarch64 targets" which arises
because the build mechanisms (both cmake and configure) assemble
arm/filter_neon.S even though it ends up completely empty.  The empty
file effectively poisons the so that the PAC/BTI support gets disabled.

The fix is minimal; it simply removes arm/filter_neon.S from the list of
sources included in the 64-bit ARM builds build.  Note that this was
already done in cmake for MSVC - it's not clear whether this change was
a partial fix for the same issue.

This version of the fix ONLY affects aarch64 (arm64) builds; 32-bit ARM
systems can still invoke the assembler if required and, indeed, there
should be no change whatsover to those builds.

The assembler code could not be used on 64-bit systems in any case so
in practice there is no material change to 64-bit builds either.

TESTING: pull the changes then type "autoreconf" if using configure (not
required for cmake).

TESTS: cmake has not been tested because cross-builds with cmake
currently fail to find the zlib installation from the cmake system root
path.  The following has been tested with configure cross builds:

armv7-linux-gnueabi [no neon support]
armv7a-linux-gnueabi [no neon support]
armv7a-hardfloat-linux-gnueabi [neon support not enabled]
armv7a-hardfloat-linux-gnueabi -mfpu=neon [uses intrinics]
armv7a-hardfloat-linux-gnueabi -mfpu=neon
        -DPNG_ARM_NEON_IMPLEMENTATION=2 [uses assembler]
aarch64-linux-gnu [uses intrinsics]
aarch64-linux-gnu -DPNG_ARM_NEON_OPT=0 [neon support disabled]

Signed-off-by: John Bowler <jbowler@acm.org>
2024-05-31 10:18:28 -07: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
e1fa61daa8 ci: Add the libpng release tags to the list of exclusions
The release tags are redundant in the CI process. It is the main branch
that is always verified.
2024-02-23 11:12:03 +02:00
Cosmin Truta
80691b9da2 test: Fix a compiler warning in pngtest.c 2024-02-23 11:09:51 +02:00
Cosmin Truta
890231026d chore: Delete comments and config settings and stuff from here and there 2024-02-22 17:00:05 +02:00
Cosmin Truta
3b9a73ed3e doc: Review the libpng history and update scripts/cmake/AUTHORS.md 2024-02-22 16:47:51 +02:00
Cosmin Truta
e05ebfba7c doc: Update the README file 2024-02-22 12:30:50 +02:00
Cosmin Truta
ec2e58c16a pngexif: Import pngexifinfo as an externally-contributed project
We used this experimental project in the development of the PNG-EXIF
("eXIf") specification, back in 2017. The project evolved together
with the draft specification, which was finalized on 2017-Jun-15 and
approved by the PNG Group on 2017-Jul-13.

The EXIF specification, outside of the scope of PNG and libpng, is
quite complex. The libpng implementation cannot grow too much beyond
performing basic integrity checks on top of serialization. In order
to create and manipulate PNG-EXIF image files, the use of external
libraries and tools such as ExifTool is necessary.

Now, with the addition of contrib/pngexif to the libpng repository,
offline tasks like metadata inspection and linting can be performed
without importing external dependencies.
2024-02-22 11:32:53 +02:00
Benjamin Buch
7b888092b9 build: Mark the installed libpng headers as system headers in CMake
Modern compilers can disable the warnings that originate from system
headers. This change allows them to do so with the libpng headers.

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-02-21 23:26:07 +02:00
Cosmin Truta
14a348ddc8 build: Checking for compiler support of LoongArch LSX should be guarded
In the configure script, checking whether the LoongArch LSX intrinsics
are supported by the compiler was done unconditionally, regardless of
the targetted host platform. Compared to how we support the other SIMD
platforms and compilers, this is rather unconventional.

We are placing this check under the guard of its own platform, for the
time being. A full solution, in line with the rest of the configure.ac
patterns concering SIMD optimizations, is TODO.

We also do an overall cleanup in the SIMD section of configure.ac, and,
finally, we regenerate the configure script.
2024-02-20 23:30:12 +02:00
Cosmin Truta
29e31f622f build: Add an explicit declaration of the AWK variable to configure.ac
Declare AWK explicitly via the AC_ARG_VAR directive, in order to make
it "precious", and to include it in the list of influential variables
at the end of the configure help text.

Rephrase a few comments and config traces.

Finally, regenerate the configure script.
2024-02-20 15:10:12 +02:00
Cosmin Truta
d165a20ae4 build: Improve the search for an AWK processor in the CMake build
Add nawk to the list of AWK-processing programs that are known to work,
and show the search result in the CMake log.
2024-02-19 20:51:26 +02:00
Cosmin Truta
aa95dee697 build: Update the CMake build options PNG_TOOLS and PNG_FRAMEWORK
Update the PNG_TOOLS option: set it to OFF by default when the
target is an embedded system, yet still allow it to be overridden.

Update the PNG_FRAMEWORK option: force it back to OFF and print a
warning if the option was ON but the target is not an Apple system.
2024-02-19 14:25:55 +02:00
Dan Rosser
e7ba9c0dfc build: Fix a CMake build regression introduced in version 1.6.41
This fixes commit 4edbb4da81626a7342a22824d7a8f60a3ea71bd0.

During the move of CMake scripts to the scripts/cmake/ subdirectory,
some of the workflows have been broken.

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-02-19 11:19:52 +02:00
Cosmin Truta
6b5a2da072 Fix "ci: Fix the reporting in ci_lint.sh"
This fixes commit dddaf0c625a8daea4d027cb57380b7fac6f58285.

The way to reliably `find` executable files is different on BSD, Mac
and Linux, unfortunately.
2024-02-17 18:28:01 +02:00
Cosmin Truta
dddaf0c625 ci: Fix the reporting in ci_lint.sh
The variable `CI_LINT_COUNTER` was incremented inside subshells, but
remained unchanged in the main shell process. The errors detected by
the internal linters remained unreported by the main script. (Oopsie!)

Besides fixing this defect, considering that only a pass/fail status
is needed, we are replacing `CI_LINT_COUNTER` with `CI_LINT_STATUS`.
2024-02-17 16:32:21 +02:00
Cosmin Truta
72c4520d3c ci: Allow the user to force an in-tree cleanup before verification
Introduce the environment option CI_FORCE:
 * ci_verify_configure.sh is known to fail if an existing build
   configuration is found in the top-level directory.
   Setting CI_FORCE=1 will run `make distclean` before verification.
 * ci_verify_makefiles.sh cannot be reliably executed if random
   object files are found in the top-level directory.
   Setting CI_FORCE=1 will run `rm *.o *.obj` before verification.
 * ci_verify_cmake.sh is not known at this time to fail for similar
   reasons; but if it does, we will use CI_FORCE to trigger any
   necessary pre-build cleanup.
2024-02-17 11:56:35 +02:00
Cosmin Truta
0fa3c0f698 chore: Clean up the spurious uses of sizeof(png_byte); fix the manual
By definition, `sizeof(png_byte)` is 1.

Remove all the occurences of `sizeof(png_byte)` from the code, and fix
a related typo in the libpng manual.

Also update the main .editorconfig file to reflect the fixing expected
by a FIXME note.
2024-02-15 21:53:24 +02:00
Cosmin Truta
4191872d0d chore: Update the .editorconfig files and pacify editorconfig-checker 2024-02-15 18:29:26 +02:00
Cosmin Truta
42c8fcbff9 Add a GitHub Action for linting 2024-02-15 15:43:54 +02:00
Cosmin Truta
f74d5ecce8 ci: Pacify shellcheck version 0.8 and apply other linting improvements
Work around a limitation in the `shellcheck source` directive, which
does not recognize quotes in shellcheck versions older than 0.9.

Also extend the checks for YAML files over the entire source tree, in
preparation for the introduction of the GitHub Actions config file.
2024-02-15 14:37:24 +02:00
Cosmin Truta
fb65436e06 ci: Fix the check of PNG_LIBPNG_VER_BUILD in ci_verify_version.sh
`PNG_LIBPNG_VER_BUILD` should be zero for public releases and non-zero
for development versions. The ci_verify_version.sh script should check
this requirement as such.
2024-02-12 12:22:43 +02:00
Cosmin Truta
63c715b7d7 ci: Remove the workaround for CI_AR from ci_verify_makefiles.sh 2024-02-11 23:49:08 +02:00
Cosmin Truta
1cdde11877 build: Update the makefiles for the benefit of cross-compilation
Split AR_RC into AR and ARFLAGS. The variables AR and ARFLAGS are
de-facto standards (like CC and CFLAGS, LD and LDFLAGS, etc.) that
may be overridden when running make. Moreover, configuring CC, LD,
AR, etc., to point to a cross-platform compiler, linker, librarian,
etc., is a de-facto standard practice as well.

Also remove the MKDIR_P variable definitions from all makefiles.
They've been leftovers from the removal of the "install*" targets.
2024-02-11 23:14:09 +02:00
Cosmin Truta
8120345c89 ci: Update (again) the ci_verify_*.sh scripts; update .shellcheckrc
Apply stylistic improvements and remove a shellcheck exclusion.
2024-02-11 15:24:03 +02:00
Cosmin Truta
7a6148290f ci: Update the ci_verify_*.sh scripts.
Bring the coding patterns in line with the newest scripts.
2024-02-10 16:45:26 +02:00
Cosmin Truta
c6ee62af2e ci: Add ci_verify_version.sh
This program verifies the libpng source tree, expecting consistent
definitions of version numbers in the C source code, in the Autoconf
scripts, and in the CMake scripts.

The version verification is performed as follows. (Please note that
the version definitions in png.h are checked twice.)
 * The files png.h, configure.ac and CMakeLists.txt are checked by
   the ci_verify_version.sh program.
 * The files png.h, png.c and pngtest.c are checked by the pngtest
   program.
2024-02-09 18:00:24 +02:00
Cosmin Truta
46b79d4716 ci: Update and rename ci_lint_ci.sh to ci_lint.sh; update .shellcheckrc
The ci_lint.sh program can now lint the entire libpng source tree.
2024-02-08 21:37:42 +02:00
Cosmin Truta
49eeb1f8ba ci: Add ci_shellify.sh
This program can shellify png.h, configure.ac and CMakeLists.txt.
2024-02-08 19:17:33 +02:00
Cosmin Truta
366c9c6a24 ci: Reformat all scripts using 1TBS
One may truly embrace the stylishness of the One True Brace Style.
2024-02-06 16:20:33 +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
cc8006c48d test: Add consistency checks for the PNG_LIBPNG_VER* numbers
Trigger a compile-time error in pngtest.c if there is any disagreement
among `PNG_LIBPNG_VER`, `PNG_LIBPNG_VER_MAJOR`, `PNG_LIBPNG_VER_MINOR`,
etc.
2024-02-05 21:31:23 +02:00
Cosmin Truta
aa9023bbd0 test: Remove compile-time option SINGLE_ROWBUF_ALLOC from pngtest.c
We have been running address-sanitized CI verifications for a while.
We can finally afford to simplify pngtest.c by removing a compile-time
option and the associated code branches that used to serve (only to a
limited extent) the purpose of bounds checking.

Also change the brief description of pngtest.c at the top of the file.
This is no longer just a simple test program.
2024-02-05 18:02:08 +02:00
Cosmin Truta
c9ac5bdba4 ci: Add a pre-build checkup stage to ci_verify_configure.sh
Also update comments and tracing printouts in ci/ci_*.sh
2024-02-04 21:53:15 +02:00
Cameron Cawley
ab6d97b7c8 build: Update and rename makefile.acorn to makefile.riscos
Co-authored-by: Cosmin Truta <ctruta@gmail.com>
Reviewed-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-02-02 21:36:53 +02:00
Cosmin Truta
9138be341b Improve, refactor and clean up pngtest.c
Improve:
The pngtest program used to be rather relaxed upon seeing invalid
parameters in callbacks: it either ignored them, or it bailed out
of the callbacks, essentially sweeping the bug under the rug.
But no more. Now it terminates with a severe `png_error`, in which
it says what's broken and where.

Improve:
`PNG_DEBUG`, defined externally at build time, and defaulting to zero,
was assumed to be non-negative. Now it's checked.

Clean up:
In a very distant past, the pngtest program used to "travel" across
libpng versions, on its own, not necessarily accompanied by the actual
library version that it was meant to test. However, this stopped being
the case, and now is as good a time as any to remove the compatibility
workarounds that had made the aforementioned "travel" possible.

Other chores include:
 * The refactoring of the user-defined chunk handling routines;
 * The cleanup of an unnecessary use of volatile;
 * The various cosmetic improvements of code and comments.
2024-02-02 21:32:48 +02:00
John Bowler
ce1f1f001e API usage: add 'basic' configuration
This adds a new configuration file, 'contrib/conftest/basic.dfa' which
disables unused APIs on a test Linux-based system.  So support the
configuration several fixes were necessary in the test programs so that
the tests are skipped correctly when APIs are not available.

The configuration has been tested on a range of common Linux apps
including web browser code (qtwebengine), image processing code (e.g.
ImageMagick) and general display code (X11, Qt5 and Qt6, KDE).  Overall
this first step reduces libpng linked code and data size to about 2/3 of
the full configuration.

To use the new test simply copy basic.dfa to 'pngusr.dfa' in the root of
the source directory and build.

Signed-off-by: John Bowler <jbowler@acm.org>
2024-02-02 13:24:02 +02:00
John Bowler
805ed7a2d4 Correct row width check in png_check_IHDR
This changes the mask used in the IHDR width check from ~7U to
~(png_alloc_size_t)7 which is a quantity at least as big as both
png_uint_32 and size_t whereas "7U" will be 16 bits on a 16 bit system.
The change both corrects a bug in the code (on 16 bit systems) and
removes compiler warnings about the test always being false on 64-bit
architectures.

Signed-off-by: John Bowler <jbowler@acm.org>
2024-02-02 01:39:48 -08:00
guxiwei
2aebfb4aa9 loongarch: Add cmake support 2024-02-01 21:17:37 +02:00
Chris Blume
7f1f960d4f Add eXIf support to push mode
libpng already supports eXIf as of v1.6.31.
However, it seems like support was added for normal mode and not added
to push mode.

Notice PNG_READ_eXIfJSUPPORTED is in pngread.c:
https://github.com/pnggroup/libpng/blob/libpng16/pngread.c#L178
but is missing from pngpread.c:
https://github.com/pnggroup/libpng/blob/libpng16/pngpread.c#L274

This commit adds eXIf support to push mode.

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-02-01 20:49:15 +02:00
John Bowler
59a68c83f0 Fix contrib/conftest/pngcp.dfa
This was broken by the corrections to the 'palette max' handling; if
that is disabled the test of num_palette_max must be removed in pnread.c

Signed-off-by: John Bowler <jbowler@acm.org>
2024-01-31 15:17:49 +02:00
Cosmin Truta
3bd304e5f4 chore: Split lines in scripts/*.awk to pacify the editorconfig checker 2024-01-31 15:02:42 +02:00
Cosmin Truta
f0c578748b chore: Fix a comment in pngrtran.c 2024-01-31 14:51:52 +02:00
Cosmin Truta
2d7da9db8a chore: Add .editorconfig files 2024-01-31 13:04:26 +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
31439b6b8d chore: Fix whitespace in pngpriv.h 2024-01-29 20:36:36 +02:00
Cosmin Truta
537c66660e chore: Fix and update the libpng manual
Fix various typos and whitespace errors, and clean up obsolete
formulations such as `(png_infopp)NULL`.

Bring all URLs up to date.
2024-01-29 17:53:21 +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
Cosmin Truta
92b2128a75 chore: Add, relocate or rephrase debug statements, for better clarity 2024-01-23 02:33:54 +02:00
Cosmin Truta
6159bad8a9 ci: Relicense again the CI scripts, from Boost License to MIT License
Many build scripts, ports and other third-party add-ons that are
circulating around appear to be distributed under the MIT License.
Examples include the Vcpkg build system (including the libpng port)
and the Meson build definitions (including the libpng definition).

I am, therefore, relicensing our CI scripts once more, as the sole
author (so far), just in case that any of the CI code might travel
from/to such projects. Hopefully, this one last license will stick.

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-01-22 23:55:18 +02:00
Cosmin Truta
3285bf0d4c ci: Add help options; add checks for the boolean environment options 2024-01-22 23:45:23 +02:00
Cosmin Truta
4edbb4da81 build: Move scripts/*.cmake.in to scripts/cmake/; add cmake/AUTHORS.md
From the libpng licensing point of view, the build projects, the build
scripts, the test scripts, the CI verification scripts, et cetera, have
not traditionally been part of libpng proper, although some of these,
including the CMake-based build, have been released under the libpng
license.

Considering how the CMake build grew as a result of many contributions
from many contributing authors over a long time, one may argue that it
almost became an individual piece of software in its own right.

Moving on, everything CMake-related shall be placed in the subdirectory
scripts/cmake/ (except, of course, the main CMakeLists.txt). Moreover,
contributing authors shall be acknowledged in scripts/cmake/AUTHORS.md.

Please see scripts/cmake/README.md for more information.
2024-01-22 17:24:59 +02:00
Cosmin Truta
9a774b9156 chore: Rerun ./autogen.sh --maintainer and update .gitignore
Bring the auto-generated scripts up to date with the autoconf upgrade
from version 2.71 to version 2.72.

Make the .gitignore exclusions better tailored to the autoconf- and
configure-generated artifacts.
2024-01-22 15:22:50 +02:00
Cosmin Truta
671661849a build: Move scripts/*.m4 to scripts/autoconf/
Move all Autoconf macro files (except for those that need to be in
the top-level directory) to their own subdirectory scripts/autoconf/

In this commit, we introduce a better way to organize the scripts dir,
and we make a better separation between the build scripts under the
libpng license vs. the build scripts that fall under other licenses.

Please see scripts/autoconf/README.md for more information.
2024-01-22 15:16:10 +02:00
Cosmin Truta
438a518611 Update the main AUTHORS file 2024-01-20 19:09:38 +02:00
John Bowler
8fb49b8b94 Relax pngtest-all message testing
Previously the 'make check' test pngtest-all looked for given messages
at EOL.  The match failed with Windows/MSYS2 because of the Windows
<cr><lf> line endings output by pngtest.  This changes the test to look
for the message anywhere in a line; this might give false matches but
the specific messages being searched for are not likely to cause this
problem.

Signed-off-by: John Bowler <jbowler@acm.org>
2024-01-19 15:31:53 -08:00
John Bowler
144b348e07 Use --xfail for Adler32 check in pngtest-all
The test always failed on systems with no support for zlib
inflateValidate and on systems where the png_set_option setting was
disabled, however pngtest-all succeeded because the failure was ignored.
The latter is now fixed so the badadler.png check needs to use --xfail,
not --relaxed.

Signed-off-by: John Bowler <jbowler@acm.org>
2024-01-19 11:10:00 -08:00
John Bowler
1a0d7a7481 Correct regression-palette-8.png
This corrects contrib/testpngs/badpal/regression-palette-8.png.  Despite
the comment in commit da109d3e the file checked in had 255 PLTE entries
so failed to perform the regression test.  This version of the PNG has
254 entries.

Signed-off-by: John Bowler <jbowler@acm.org>
2024-01-19 08:55:56 -08:00
Adam Richter
866fdf6f8f Fix an off-by-one error in png_do_check_palette_indexes
The last byte of each row was ignored in a function that was executed
under the build flags `PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED` and
`PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED`.

This is a revert of a change previously applied in libpng-1.6.33beta01.
See SourceForge bug #269 at https://sourceforge.net/p/libpng/bugs/269/

Reviewed-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-01-19 17:45:27 +02:00
John Bowler
6f8257e437 tests/pngtest-all: detect failures add tests
This change is only verifiable in configure builds; cmake only executes
the basic test.

The previous version of tests/pngtest-all only returned the status code
of the final test.  Apparently it could never fail.  This adds checking
of all return status codes.

The change also adds a basic approach for regression testing with PNGs
that should fail a test; --strict ensures that PNGs which are valid do
not start to be reported as erroneous, this is the inverse.

At present the code (minimal traditional Bourne shell) only tests the
palette index checking code, a potentially important check if apps rely
on it.

The changes have been tested using the configure build both with a
regression which causes the libpng checking to cease to work and with a
corrected (reverted regression).  The regression test verifies that the
intended check works as expected.

Signed-off-by: John Bowler <jbowler@acm.org>
2024-01-18 17:36:59 -08: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
John Bowler
2b814cde29 Regression test for off-by-one palette check error
This adds a file to regression-test the previously introduced off-by-one
error in the check on read for a colormapped PNG with an out-of-range
index (equal or greater than the length of the PLTE).

Previous tests covered all cases except the 8-bit palette case; the
"small" test file contains the "bad" entry at index 254, not 255 so it
passes even if the final byte is not checked.  The new file has the
erroneous entry in the last byte.

Signed-off-by: John Bowler <jbowler@acm.org>
2024-01-18 23:17:51 +02:00
Zixu Wang
893b8113f0 Fix unused platform check and configuration for macOS
In a similar manner as zlib (https://github.com/madler/zlib/pull/895),
libpng contains a header configuration that's no longer valid and
hasn't been exercised for the macOS target.

- The target OS conditional macros are misused. Specifically
  `TARGET_OS_MAC` covers all Apple targets, including iOS, and it
  should not be checked with `#if defined` as they would always be
  defined (to either 1 or 0) on Apple platforms.
- `#include <fp.h>` no longer works for the macOS target and results
  in a compilation failure. macOS ships all required functions in
  `math.h`, and clients should use `math.h` instead.

This problem has not been noticed until a recent extension in clang
(https://github.com/llvm/llvm-project/pull/74676) exposed the issue
and broke libpng builds on Apple platforms. The failure can be
reproduced now by adding `#include <TargetConditionals.h>` before the
block.

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-01-18 22:24:30 +02:00
Cosmin Truta
7ec2bd28c7 Update the main Authors file 2024-01-18 18:13:38 +02:00
gxw
70d10da35c MIPS: Fixed undefined MSA interfaces
When compiling on the MIPS platform using the following command:
./configure --enable-hardware-optimizations && make
The options '-mmsa -mfp64' are not being passed.
PNG_MIPS_MSA_IMPLEMENTATION is defined as 2, leading to
the initialization of unimplemented MSA interfaces.
2024-01-18 18:13:23 +02:00
gxw
064f992187 Loongson: Fixed compilation warnings for undefined macros. 2024-01-18 17:58:38 +02:00
gxw
46f1106a3f Loongson-mips: Fixed typo 2024-01-18 10:24:57 +08:00
Cosmin Truta
a7fe3414e5 mips: Wrap up the MIPS/Loongson port and acknowledge the contributors
Completion of this port required a rerun of `./autogen.sh --maintainer`
followed by a rebuild of scripts/pnglibconf.h.prebuilt.
2024-01-17 23:24:05 +02:00
gxw
ce4b632dd7 Optimize png16 with loongson mmi for 64-bit os 2024-01-17 22:46:16 +02:00
jinbo
6b0d1bd75b Add loongarch support and LSX SIMD optimizations
Enable LSX by default:
    ./configure && make

Disable LSX:
    ./configure --enable-loongarch-lsx=no && make

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-01-17 22:42:02 +02:00
Cosmin Truta
2a4f0f5aee De-volatilize the internal implementation of png_safe_execute
`png_safe_execute` called `setjmp` in a context where the result was
undefined (an assignment statement). This corrects the code and removes
volatile statements that were introduced previously to quell warnings
from earlier versions of GCC.

Co-authored-by: John Bowler <jbowler@acm.org>
2024-01-17 18:06:47 +02:00
Cosmin Truta
7dacc4d5aa Rewrite various initializations for the benefit of various compilers
Mark the initialization of `png_signature[]` as static const inside the
function `png_sig_cmp`. This might be helpful to optimizing compilers.

Initialize the arrays `number_buf[]`, `digits[]` and `buffer[]` inside
the functions `png_convert_to_rfc1123_buffer`, `png_ascii_from_fixed`,
`png_warning_parameter_unsigned` and `png_warning_parameter_signed`.
Although these initializations are redundant, compilers such as gcc-13
fail to see the redundancy.
2024-01-17 16:59:38 +02:00
John Bowler
da109d3e6e Improve test coverage with a "correctly" damaged palette index test
The PNG IDAT did not include a '255' entry, the highest entry is '254',
this corrects the test PNG to have a palette with only 254 entries so
that it triggers the palette index checks.

Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-01-17 12:43:31 +02:00
John Bowler
f9348b77da write palette check corrections
The write palette check is off-by-one when checking the maximum palette
index against the number of entries however, because of the
implementation, the simple correction would fail if no palette check had
been performed (for example for a non-palette image).  This corrects
both errors so that the code outputs a warning (but not an error) if a
user of libpng writes an image with a PLTE which is one entry short.

The write palette check can be turned off on colour type 3 images
(colour mapping images) but this is done by setting the 'maximum'
palette index in the image to (-1).  The ammended code works because it
only executes for paletted images, it is dependent on palette checks
being compiled in and they will always be checked unless the stored
'max' value is less than 0.

Signed-off-by: John Bowler <jbowler@acm.org>
2024-01-16 16:15:23 -08:00
John Bowler
2ea11e2235 Palette index checking fixes
The palette index checking function is called by default but only if
some *other* transformation is happening.  This makes the 'get palette
max' public API disfunctional (sometimes it works, sometimes it returns
0) and causes the supposed default behaviour of checking the palette
index only to work sometimes.  It works in pngtest, it doesn't work in
pngcp.

The check in pngread also has an off-by-one error; the number recorded
is the highest index found so it should be checked to ensure that it is
less than the palette length but it was checked for being greater.

The pull request includes a set of 8 files which all have the full range
of possible indices including one (the highest) which is invalid because
the PLTE chunk is one short of the maximum for each bit depth.

Signed-off-by: John Bowler <jbowler@acm.org>
2024-01-16 14:59:02 -08:00
John Bowler
b60316f4ee Remove GCC7.1 arithmetic overflow fixup
This removes pragmas and the controlling code that quelled warnings
generated by GCC7.1 (only) with -Wstrict-overflow=3 and possibly other
levels.  Tested with GCC13.2, GCC7.1 is no longer the current version of
GCC7 (GCC7.5) and GCC7.1 was replaced by GCC7.2 on August 14, 2017.

Signed-off-by: John Bowler <jbowler@acm.org>
2024-01-15 21:42:05 +02:00
John Bowler
050ce505e4 pngfix: del workround for GCC7.1 -Wstrict-overflow
Previously pngfix had been made warning-free in GCC7.1 by marking auto
variables (volatile).  This prevented the arithmetic optimizations which
caused warnings from GCC7.1 with higher values -Wstrict-overflow=<n>

GCC has moved on a lot since 7.1 and pngfix.c now compiles with just one
warning using -Wstrict-overflow=5.  The change includes a change to make
this go away by performing the rearrangement GCC was using in the code:

   i == ndigits-1

becomes:

   i+1 == ndigits

i is initialized to ndigits and has been decremented at least once so
this is fine.

Test, configure:

  CFLAGS="-Wall -Wextra -Wno-maybe-uninitialized -Wstrict-overflow=5" \
    ../configure --enable-werror
  make
  make cehck

Test, cmake:

  cmake ..
  make
  make test

Signed-off-by: John Bowler <jbowler@acm.org>
2024-01-15 09:50:24 -08:00
John Bowler
2a23247420 pngcp: remove GNU setjmp warning workround
Prior versons of the GCC warned about the 'dest' parameter of
contrib/tools/pngcp.c not being volatile, which isn't necessary because
it isn't modified.  This removes the GCC specific fixup.

The function which calls setjmp, cppng() also relied on undefined
behavior because it assigned the result of setjmp() to a variable; this
is not one of the four uses of setjmp permitted by ANSI-C.  This passes
the result previously returned by longjmp via (struct display).  It's
very very unlikely that any compiler could have got the code wrong but
it is technically undefined.
2024-01-14 15:47:20 -08: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
b3521c60af pngminus: Delete the incomplete output files upon premature termination
Defer the program termination on error until all files are closed and
(if applicable) all incompletely-written output files are deleted.

In addition, perform the following maintenance tasks:
 * Rename and document the internal helpers used by the functions
   `png2pnm` and `pnm2png`.
 * Unset the executable permission bits for the *.bat test programs.
2024-01-09 18:54:02 +02:00
Cosmin Truta
6beae586d6 pngminus: Expect all image transformations to be available in libpng
The pngminus programs use several PNG image transformations:
`png_set_expand`, `png_set_expand_1_2_4_to_8`, etc. (in png2pnm.c);
`png_set_packing`, `png_set_invert_mono`, etc. (in pnm2png.c).
The availability of all of these transformations in libpng is now
required at compile time.

On the topic of transformations, apply an unrelated fix to the use
of `png_set_gamma`.
2024-01-09 00:33:39 +02:00
Cosmin Truta
bdbbcaa457 pngminus: Improve and modernize the PNG processing
Improve and modernize png2pnm.c:

 * Remove the explicit reading of the input PNG file signature.
   Libpng is now able to read it, check it, and issue an appropriate
   error message in case of magic number mismatch or file corruption.
   (See the function `png_read_sig`.)

 * Remove the explicit allocation and dealocation of the image data.
   Libpng is now able to manage all the image data automatically.
   (See the function `png_read_png`.)

 * Specify the needed image transformations without a-priori checking
   the image type for applicability.

 * Use the `png_set_expand_gray_1_2_4_to_8` transformation.
   Since libpng version 1.2.9, this transformation (if needed) must
   be enabled separately from `png_set_expand`.

Improve and modernize pnm2png.c:

 * Modify the allocation of image data, in order to match libpng's
   internal allocation model.

 * Transfer the ownership of the image data from the `pnm2png` function
   to libpng, which will manage and dealocate it at the right time.
   (See the functions `png_set_image_rows` and `png_data_freer`.)

Refactor, clean up, etc.
2024-01-08 20:31:18 +02:00
Cosmin Truta
abb8d4a71f pngminus: Fix and improve the PNM processing
Improve png2pnm.c:

 * Add support for writing 16-bit raw PNM image files.

Fix and improve pnm2png.c:

 * Add support for reading 16-bit raw PNM image files.

 * Fix the parsing of arbitrarily long numeric strings.
   In the parsing of PNM tokens, we can and we should avoid storing
   more than one leading '0' in the token buffer. All valid (in-range)
   numeric strings must fit in this limited-size buffer, regardless of
   their actual length in the input file.

 * Refactor the PNM parsing in order to make it more capable to handle
   various kinds of input file errors.

 * Remove the volatile qualifiers from all variable declarations.
   Their original purpose was to appease old (and incorrect) warnings
   issued by ancient optimizing compilers.

 * Print a note about the program's lack of support for the PAM ("P7")
   file format when the input is in this format.

 * Add FIXME notes about the need to signal incorrect or incomplete
   input files. (For png2pnm, this is done inside libpng.)
2024-01-08 14:14:33 +02:00
Cosmin Truta
c993ae4c67 pngminus: Update CMake file; rename test scripts; add .gitignore
Raise the minimum required CMake version to 3.5.

Add the configuration option `PNGMINUS_USE_SYSTEM_PNG` for compiling
and linking with the system libpng library instead of the internal one.

Remove the old configuration option `PNGMINUS_USE_STATIC_LIBRARIES`.
When using the internal libpng (via `PNGMINUS_USE_SYSTEM_PNG=OFF`),
simply enforce static linking and produce single-file executables.

Rename the scripts "png2pnm.sh" (etc.) to "test_png2pnm.sh" (etc.),
to make it obvious that they are test drivers, not program launchers.

Add a .gitignore file for project-specific build and test artifacts.
2024-01-05 19:59:07 +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
John Bowler
71b9b5e16e pngfix: ensure fclose happens last on file close
This reverts the code to a variant of my old style of doing an 'fclose'
correctly and adds comments explaining why it is so difficult.  Thanks
to @ihsinme for pointing out the error on github.com

Signed-off-by: John Bowler <jbowler@acm.org>
2023-12-30 11:06:34 -08:00
Stephen Kitt
9f9f8d8e63 Fix bashisms
makepngs.sh relies on a Bash feature in one of its case statements,
";;&"; this should be made explicit in the shebang.

intgamma.sh declares a function in a manner which may fail in non-Bash
sh implementations, this patch uses the correct syntax.

Based on a patch by Roflcopter4:
https://github.com/joncampbell123/dosbox-x/pull/3850

Signed-off-by: Stephen Kitt <steve@sk2.org>
2023-12-27 12:53:48 +02:00
Cosmin Truta
437b24a958 mips: Fix the build for generic ANSI C89 compilers
The <stdint.h> header is a standard C99 header, and a MIPS-specific
header, but it is not a standard C89 header. It should not be included
until ensuring that the code being compiled is MIPS-specific.
2023-12-20 21:09:27 +02:00
Sui Jingfeng
2ed5a70bca mips: Implement the run-time MIPS MSA discovery function correctly
The old implementation of png_have_msa() caused a bus error,
if a word in /proc/cpuinfo was longer than 10 characters.

In the original implementation, `word[10]` was too short, and
`word[i++] = ch` caused a stack smash if the characters between
spaces were more than 10.

And also, fclose(f) should be called before leaving.

For example on loongson ls3a4000 cpu platform:

$ cat /proc/cpuinfo

system type             : Generic Loongson64 System
machine                 : loongson,loongson64g-4core-ls7a
processor               : 0
cpu model               : ICT Loongson-3 V0.1  FPU V0.1
BogoMIPS                : 3594.02
wait instruction        : yes
microsecond timers      : yes
tlb_entries             : 2112
extra interrupt vector  : no
hardware watchpoint     : no
isa                     : mips1 mips2 mips3 mips4 mips5 mips32r1 mips32r2 mips64r1 mips64r2
ASEs implemented        : vz msa loongson-mmi loongson-cam loongson-ext loongson-ext2
shadow register sets    : 1
kscratch registers      : 6
package                 : 0
core                    : 0
VCED exceptions         : not available
VCEI exceptions         : not available
processor               : 1
cpu model               : ICT Loongson-3 V0.1  FPU V0.1
BogoMIPS                : 3611.26
wait instruction        : yes
microsecond timers      : yes
tlb_entries             : 2112
extra interrupt vector  : no
hardware watchpoint     : no
isa                     : mips1 mips2 mips3 mips4 mips5 mips32r1 mips32r2 mips64r1 mips64r2
ASEs implemented        : vz msa loongson-mmi loongson-cam loongson-ext loongson-ext2
shadow register sets    : 1
kscratch registers      : 6
package                 : 0
core                    : 1
VCED exceptions         : not available
VCEI exceptions         : not available

Co-authored-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: Sui Jingfeng <15330273260@189.cn>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2023-12-20 21:09:27 +02:00
Cosmin Truta
85f866dea3 cmake: Enable policy CMP0074 for ZLIB_ROOT; deprecate PNG_BUILD_ZLIB
Although the minimum required CMake version is 3.6, this policy will
only have effect under CMake 3.12 or newer.

Reported-by: Jacob Harding <54728054+jacobharding@users.noreply.github.com>
2023-12-20 19:12:42 +02:00
Cosmin Truta
2fff013a69 cmake: Raise the minimum required version to 3.6 and use its features
Use the `CMAKE_HOST_SOLARIS` variable, introduced in CMake 3.6, and
raise `cmake_minimum_required` accordingly.
2023-12-13 20:24:33 +02:00
Cosmin Truta
acfd50ae0b cmake: Clean up functions, string operations, regular expressions, etc.
Remove the inclusion of the external module `CMakeParseArguments`.
Function argument parsing became a first-class feature in CMake 3.5.

Delete the function `find_symbol_prefix`. It is no longer used.

Use variables instead of strings in string operations where possible.
Prevent CMake from getting confused by string values that might be
accidentally identical to unrelated keywords.

Clean up spurious `.*` sequences in regex matching operations.

Rephrase a comment.
2023-12-11 20:51:06 +02:00
Cosmin Truta
8fc13a8704 cmake: Enable the libpng framework build by default on Apple systems
The PNG_FRAMEWORK option used to be off by default. It was possible to
turn it on, regardless of the underlying operating system, but doing so
outside of an Apple OS broke the libpng build.

PNG_FRAMEWORK is now on by default, conditionally defined on Apple
systems only, and it is ignored (without breaking the build) elsewhere.

Other minor changes have also been applied.
2023-12-08 23:22:39 +02:00
Timothy Lyanguzov
1460b3ce78 cmake: Use Zlib as a package
1. automatic linking of the library and add include directory
2. properly specify include directories

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2023-12-08 14:57:36 +02:00
Cosmin Truta
e1088f99d4 Redo "cmake: Fix CPU architecture regexes"
Co-authored-by: Clinton Ingram <clinton.ingram@outlook.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2023-12-07 23:17:56 +02:00
Cosmin Truta
d65b3ebf00 Revert "cmake: Fix CPU architecture regexes"
This reverts commit 9c1dc4d13dab823d6441d417546ebeee3994389b.

The new regex for Intel can match "x86_64", but it fails with "x86".
Moreover, the new regex for MIPS needs more testing on all MIPS ISAs.

Reported-by: Clinton Ingram <clinton.ingram@outlook.com>
2023-12-07 23:17:56 +02:00
Clinton Ingram
a3d1a35b98 cmake: Don't add Unix ASM file to the ARM-specific source list for MSVC
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2023-12-07 16:11:12 +02:00
Cosmin Truta
9c1dc4d13d cmake: Fix CPU architecture regexes
Co-authored-by: Clinton Ingram <clinton.ingram@outlook.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2023-12-07 16:11:12 +02:00
Cosmin Truta
e755fb79ba ci: Quick-fix ci_verify_cmake.sh
Avoid using `cmake --option=value` and `ctest --option=value`, to stay
compatible with older versions of CMake.
2023-10-19 00:26:54 +03:00
Cosmin Truta
f79c85e22d Update the configuration for Travis CI and AppVeyor CI
Update the Travis CI matrix:
 * Run ASan and UBSan unconditionally on FreeBSD and Linux, and
   not at all on Mac.
 * Remove the `CI_NO_TEST=1` runs from the environment column.

Update the AppVeyor CI matrix:
 * Replace `CI_NO_TEST=1` with `CI_CMAKE_VARS=-DPNG_TESTS=0` when
   testing Visual Studio on ARM64.

Also apply minor stylistic changes.
2023-10-18 22:31:49 +03:00
Cosmin Truta
53d2188fa5 ci: Update the support for cross-build verifications; refactor
Rename `CI_HOST_ARCH` and `CI_HOST_SYSTEM`, to `CI_BUILD_ARCH` and
`CI_BUILD_SYSTEM`, following the nomenclature used by GNU Autotools.
Unfortunately, the word "host" has confusingly opposite meanings in
CMake (and Bazel, etc.) vs. Autotools (and Meson, etc.)

Remove `CI_TARGET_TRIPLET` and `CI_TARGET_ABI` (for now).

Introduce the function `ci_expr` as a fast and easy equivalent of
`expr >/dev/null`.

Rephrase the assertions using an implementation pattern that is more
expressive, yet (arguably) just as readable. Remove `ci_assert`.

Modify the main functions to display more useful information in case
of usage error.
2023-10-18 19:36:38 +03:00
Timothy Lyanguzov
f2294569cf Use CMake 3.5 features
1. Set `cmake_minimum_required` to 3.5
   (see https://cmake.org/cmake/help/latest/release/3.27.html)
2. Specify the version of CMake project
3. Remove the redundant call to `cmake_policy`
4. Use `CMAKE_INSTALL_BINDIR` and `CMAKE_INSTALL_INCLUDEDIR`
5. Use private library linking for tools and test programs
6. Don't activate testing if it was not enabled

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2023-10-02 23:24:00 +03:00
Tyler Kropp
1547b335e4 cmake: Fix copying targets on Windows in multi-config build systems
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2023-10-02 00:00:03 +03:00
Cosmin Truta
b2ef6edbe8 cmake: Rename PNG_EXECUTABLES to PNG_TOOLS
For the sake of consistency with a recent addition to the configure
script, the option name PNG_EXECUTABLES (introduced in libpng-1.6.38)
shall become PNG_TOOLS.

PNG_EXECUTABLES is still maintained as a deprecated option, allowing
the applications that use it to be built without modification, but a
deprecation warning will be issued.
2023-08-03 21:08:29 +03:00
Cosmin Truta
5a6ea1822b configure: Rerun "./autogen.sh --maintainer" 2023-08-02 21:42:10 +03:00
Cosmin Truta
22ad62c25e configure: Rename the recently-added options
Rename
    --enable-png-tests/--disable-png-tests
    --enable-png-tools/--disable-png-tools
to
    --enable-tests/--disable-tests
    --enable-tools/--disable-tools
respectively.

While the `PNG_` prefix is necessary in CMakeLists.txt, a corresponding
`--...-png-` option qualifier would be redundant in a configure script.
2023-08-02 21:42:10 +03:00
Carlo Bramini
71475b064f configure: allow to disable building of tools and test
This PR adds two set of options to the configure script:
    --enable-png-tests/--disable-png-tests
and
    --enable-png-tools/--disable-png-tools

By using this feature, a user will be allowed to build only library if
needed, which will be useful on platforms not able to build the tools
and/or the tests.
This PR leaves the existing behaviour as default setting, by building
both the tools and the tests if the options are not used.

CMakeLists.txt already supports this feature with the options PNG_TESTS
and PNG_EXECUTABLES. After this commit, Autotools will provide the same
feature.

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2023-08-02 17:39:36 +03:00
Cosmin Truta
ee9d6d7bf2 ci: Improve the support for cross-build verifications
Introduce CI_TARGET_TRIPLET and CI_TARGET_ABI.

Rename CI_HOST_MACHINE and CI_TARGET_MACHINE, respectively, to
CI_HOST_ARCH and CI_TARGET_ARCH, following on the conventional
target triplet nomenclature.

Introduce CI_BUILD_SYSTEM and CI_BUILD_ARCH, following on the
GNU Autotools (host/build/target) practice and nomenclature.

Ensure that CI_TARGET_SYSTEM, CI_TARGET_ARCH and CI_TARGET_ABI
are all initialized when verifying a cross-platform build.

Work around an obscure CMake error by ensuring that CMake variables
(CMAKE_AR and CMAKE_RANLIB) are initialized to the full executable
paths of their CI_* equivalents (CI_AR and CI_RANLIB).

Implement other general-purpose improvements:
 * Check all CI_NO_* variables in an arithmetic context, to allow
   setting them explicitly to zero in external configurations.
 * Label the assertions with descriptions of what's being asserted.
 * Add more comments and tracing printouts.
2023-07-30 17:07:25 +03:00
Cosmin Truta
f8e5fa92b0 ci: Fix ci_verify_cmake.sh; improve ci.lib.sh
Fix ci_verify_cmake.sh: sync up CI_BUILD_TO_INSTALL_RELDIR with
CI_INSTALL_DIR. (Oopsie!)

Replace slashes, backslashes and dots with underlines in system
names and machine hardware names. These names are now included in
the output directory naming scheme.
2023-07-09 12:27:51 +03:00
Cosmin Truta
c81516e943 ci: Fix bad copy pasta in ci_verify_configure.sh 2023-07-08 23:46:53 +03:00
Cosmin Truta
0b7bc40de1 ci: Introduce CI_HOST_* and CI_TARGET_*
Replace CI_SYSTEM_NAME and CI_MACHINE_NAME with CI_HOST_SYSTEM and
CI_HOST_MACHINE, respectively.

Introduce CI_TARGET_SYSTEM and CI_TARGET_MACHINE, defaulting to
CI_HOST_SYSTEM and CI_HOST_MACHINE, respectively.

Use CI_TARGET_SYSTEM and CI_TARGET_MACHINE in the naming scheme of
target build and install directories, in order to allow concurrent
verification builds for multiple cross-platform targets.
2023-07-04 19:40:05 +03:00
Cosmin Truta
82414985c1 ci: Add ci_lint_ci.sh and .shellcheckrc
Add ci_lint_ci.sh for linting the CI config files and scripts.
The linting is based on yamllint and shellcheck.
2023-07-04 00:12:32 +03:00
Cosmin Truta
c0616f1017 ci: Add ci.lib.ch; update ci_verify_*.sh accordingly
Move the common declarations and initializations from ci_verify_*.sh
to ci.lib.sh, and update them as follows:
 * Simplify the ci_ function names.
 * Refactor the CI_ variable names:
    - Add the new variable CI_TOPLEVEL_DIR.
    - Rename the variables CI_SCRIPTNAME, CI_SCRIPTDIR, etc.,
      to CI_SCRIPT_NAME, CI_SCRIPT_DIR, etc.
    - Rename the variables CI_SRCDIR_FROM_BUILDDIR, etc., to
      CI_BUILD_TO_SRC_RELDIR, etc.
 * Add new functions inside ci.lib.sh:
    - Replace ci_err with ci_err_usage, ci_err_fatal, ci_err_internal.
    - Add the new functions ci_warn and ci_assert.
 * Simplify the ci_ function names inside ci_verify_*.sh.
2023-07-03 22:59:24 +03:00
Cosmin Truta
c741d1e392 ci: Relicense the CI scripts to the Boost Software License version 1.0
Fetch LICENSE_BSL_1_0.txt from http://www.boost.org/LICENSE_1_0.txt
and update the copyright notice in all ci_* scripts.

Append "SPDX-License-Identifier" tags after each copyright notice;
see https://github.com/david-a-wheeler/spdx-tutorial/#spdx-tutorial
2023-07-03 19:14:33 +03:00
Cosmin Truta
ad9e42a877 Add .yamllint.yml, a configuration file for yamllint 2023-07-03 13:38:40 +03: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
afc6c595bf Fix a build regression on Solaris
Fix a regression introduced in commit aeb26da4cb64c0e75c8d.

On an Illumos test machine, running the GCC compiler and the Solaris
link editor, the CMake build failed with the following error:

    ld: fatal: unrecognized option '--version-script=/.../libpng.vers'

The fix consists in avoiding the use of CMAKE_SHARED_LIBRARY_C_FLAGS
in version script checks on Solaris.

Also clean up the surrounding code, as follows:
 * Rename CMAKE_REQUIRED_FLAGS_SAVE to _SAVED_CMAKE_REQUIRED_FLAGS.
   (The name of an internal variable should not begin with "CMAKE_".)
 * Reformat the version script to optimize the vertical space.
2023-06-21 21:08:40 +03:00
Cosmin Truta
e6c5bf46c4 Ensure that only one eXIf chunk is written in the entire datastream
EXIF data can be stored in an eXIf chunk before IDAT, or after IDAT,
but the entire PNG datastream may contain one eXIf chunk at most.

Introduce the private mode flag PNG_WROTE_eXIf, which is meant to be
used like the PNG_WROTE_tIME flag. The eXIf chunk and the tIME chunk
have the same ordering rules (i.e. no constraints are imposed), and
the same multiplicity rules (i.e. no multiples are allowed), and they
should be initialized and checked using the same algorithm.

This fixes commit cd03aaf7bf0e0c748b8c6cb34a56b402b40d61d0,
previously reverted in 3d57708c9166419b7f5e0bbda2f7a2149112c844.

Reported-by: Ben Bullock <benkasminbullock@gmail.com>
2023-06-21 16:16:07 +03:00
Wan-Teh Chang
8be5c147d5 Don't report a valid tRNS chunk if it was canceled
Add special handling of the PNG_INFO_tRNS flag to png_get_valid() to
not report a canceled tRNS chunk as valid.

Fix https://github.com/glennrp/libpng/issues/482

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2023-06-20 19:20:38 +03:00
Cosmin Truta
f7abe3c419 Avoid a memory leak when allocation of a pCAL buffer fails
Set the PNG_FREE_PCAL flag immediately after the allocation of the
first pCAL buffer, so that, if any one of the subsequent allocations
fail, all pCAL buffers still get deallocated by png_free_data.

Also reorder the initialization of other PNG_FREE_ flags (without
altering the semantics) to improve the overall consistency inside
the pngset.c module.

Co-authored-by: Philippe Antoine <contact@catenacyber.fr>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2023-06-20 15:09:36 +03:00
Jesús González
82097c2108 Fix a doc typo in pnglibconf.dfa
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2023-02-16 15:34:29 +02:00
Cosmin Truta
e519af8b49 cmake: Allow overwriting the debug postfix of library filenames
Users may opt to change the debug suffix, e.g., from "d" to "_debug".

Rather than making CMAKE_DEBUG_POSTFIX a cache variable (which is
an antipattern in CMake), we introduce a new cache variable, named
PNG_DEBUG_POSTFIX.

Suggested-by: Diego Barrios Romero <eldruin@gmail.com>
2023-02-12 22:31:11 +02:00
Cosmin Truta
efc96c9d59 cmake: Redo the fix for Clang support on Windows
Redo commit 70fda1837d5de802ce5f7e04be239192b6a74d92, with a redesign.

Define the variables PNG_SHARED_OUTPUT_NAME and PNG_STATIC_OUTPUT_NAME
for the benefit of the OUTPUT_NAME target properties of, respectively,
the shared libpng build and the static libpng build. Fix and improve
not only Clang, but also other Windows toolchains, such as Embarcadero.

Rename the variable PNGLIB_SHARED_SOVERSION to PNG_ABI_VERSION.
The applicability of this variable, which is much wider than the old
name used to suggest, includes the definitions of PNG_*_OUTPUT_NAME.

Delete the confusingly-named variables PNGLIB_NAME and PNG_LIB_NAME,
and rename PNG_LIB_TARGETS to PNG_LIBRARY_TARGETS.

Set the macros _CRT_SECURE_NO_DEPRECATE and _CRT_NONSTDC_NO_DEPRECATE,
for all compilers that use MSVC run-time library headers. Currently,
these compilers are MSVC and Clang/Windows.

Add or improve the comments that accompany user-serviceable variables
and options.

Co-authored-by: B. Scott Michel <scooter.phd@gmail.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2023-02-12 17:22:08 +02:00
Cosmin Truta
aab24fa1b3 Clean up CMakeLists.txt
* Rename the target `png` to `png_shared`. The main targets are now
   named `png_shared`, `png_static` and `png_framework`.
 * Rename the function symbol_prefix() to find_symbol_prefix().
 * Rename the prefix `S` to `_SYM` in the function create_symlink().
 * Rewrite the precondition checks in the function create_symlink().
 * Add precondition checks to the function generate_copy().
 * Delete the vestigial property CLEAN_DIRECT_OUTPUT.
 * Delete the variables PNG_LIB_NAME_STATIC and PNG_LIB_NAME_FRAMEWORK.
 * Initialize and use PNG_LIB_TARGETS consistently as a list.
 * Move all include() commands to the top of the file.
 * Acknowledge a former contributor.
 * Reformat.
2023-02-08 19:44:31 +02:00
Jeremy Maitin-Shepard
efa9c2e920 cmake: Rename the custom targets to have the png_ prefix
This avoids taget namespace pollution when including libpng as a
sub-project.

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2023-02-08 17:10:52 +02:00
Cosmin Truta
c22ef3b2e3 Revert "cmake: Fix the Clang support on Windows"
This reverts commit 70fda1837d5de802ce5f7e04be239192b6a74d92.

Fixing Clang on Windows is important. However, in the previous fix,
the name of the compiled libpng library file was changed, incorrectly,
on all platforms except Windows. A proper fix will follow up.
2023-02-07 17:49:06 +02:00
Cosmin Truta
66fede80d2 ci: Update the CI scripts
Apply the following changes:
 * Update CI_BUILDDIR and CI_INSTALLDIR to reflect the new script
   names.
 * Introduce CI_SRCDIR_FROM_BUILDDIR and CI_INSTALLDIR_FROM_BUILDDIR
   to the cmake build, to ensure that the Windows tools can handle
   native Windows paths correctly when executed via Bash-on-Windows.
 * Stop guessing and using CI_SRCDIR_NATIVE and CI_INSTALLDIR_NATIVE
   in the cmake build, since we now have a better solution.
 * Show the ninja program version in ninja-based cmake builds.
 * Move the cleanup of previous builds into separate functions, and
   do it in a cleaner manner. No pun intended.
2023-02-05 17:09:00 +02:00
Cosmin Truta
59fa76e164 ci: Add CMake+Ninja+Clang to the AppVeyor CI matrix 2023-02-04 20:33:23 +02:00
B. Scott Michel
70fda1837d cmake: Fix the Clang support on Windows
Fix a build error that occurs with the Ninja code generator and the
Clang compiler on Windows:

    ninja: error: build.ninja: multiple rules generate png16.lib

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2023-02-03 16:32:32 +02:00
Gunther Nikl
aeb26da4cb cmake: Use CMAKE_SHARED_LIBRARY_C_FLAGS in version script checks
Building the version script test executable may fail in the link step
with GNU ld as linker like this:

  ld: final link failed: Nonrepresentable section on output

Building the test excutable with CMAKE_SHARED_LIBRARY_C_FLAGS makes the
test succeed with GNU ld since this adds -fpic/-fPIC.

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2023-01-31 22:25:23 +02:00
Jon Creighton
cd0ea2a7f5 Fix for universal binaries on macOS
Fix the issue of a
    clang: error: no such file or directory: 'x86_64'
error on building universal binaries on macOS.

It is also necessary to specify:
    -DCMAKE_C_FLAGS="-DPNG_ARM_NEON_OPT=0"

Example CMake command:
    cmake -S libpng \
          -B build_libpng \
          -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
          -DCMAKE_C_FLAGS="-DPNG_ARM_NEON_OPT=0"

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2023-01-09 19:55:04 +02:00
Cosmin Truta
9923515ff4 Update the copyright year 2023-01-09 19:50:00 +02:00
Cosmin Truta
61bfdb0cb0 Update the configuration for Travis CI and AppVeyor CI
Simplify the test matrix on Travis CI to reduce the testing time.

Use CI_CMAKE_TOOLCHAIN_FILE on AppVeyor CI.
2022-11-29 12:38:45 +02:00
Cosmin Truta
9db8cff6ef ci: Fix verification under Cygwin Bash + CMake + Visual Studio; update
Fix autodetection and use of the cygpath executable on Windows.

Add a new variable CI_CMAKE_TOOLCHAIN_FILE to ci_verify_cmake.sh.
This should help in future cross-platform testing.

Remove the implicit initialization of CI_CC, CI_LD and CI_LIBS from
ci_verify_makefiles.sh. This should help the testing of default values
of their respective make variables (CC, LD and LIBS).
2022-11-27 21:58:07 +02:00
Cosmin Truta
b445aade83 ci: Rename the ci_* scripts
Give the CI scripts new names that better reflect what they do, and
make room for activities such as linting or dependency installation:
 * Rename ci_autotools.sh to ci_verify_configure.sh.
 * Rename ci_cmake.sh to ci_verify_cmake.sh.
 * Rename ci_legacy.sh to ci_verify_makefiles.sh.

Also rename CI_LEGACY_MAKEFILES to CI_MAKEFILES.

Update the config files for Travis CI and AppVeyor CI accordingly.
2022-11-27 21:05:42 +02:00
musvaage
3c152a8ef7 Fix typos
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2022-11-27 17:39:19 +02:00
Cosmin Truta
5a0b7e9c29 manuals: Remove references to libpngpf(3); update links
From libpng-1.5.0 onwards, the private libpng functions are no longer
accessible to the libpng users, and the content of libpngpf(3) is no
longer relevant.

Update links, introducing the new canonical location of the libpng
source repository:
https://github.com/pnggroup/libpng
2022-11-27 16:20:31 +02:00
Cosmin Truta
b126f80710 Reorganize and update the README file; add Markdown formatting 2022-11-27 16:20:31 +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
32f465a66b Update the file list in README 2022-11-20 23:53:23 +02:00
Paul Eggert
074e2eaab0 configure: Fix possible regressions with trunk autoconf (vs 2.71)
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2022-11-20 23:20:10 +02:00
John Bowler
790fef342b tools: Fix a memory leak in pngcp
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2022-11-20 23:03:43 +02:00
Alberto Barbaro
8a5732fcb3 tools: Fix a buffer overflow involving a file name in pngfix
Reported-by: Guoxiang Niu (@niugx), EaglEye Team
Reported-by: Riccardo Mori <patacca@autistici.org>
Reviewed-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2022-11-20 22:28:03 +02:00
Cosmin Truta
77c3a39299 Clean up comments and whitespace characters in source files
Remove all remaining "last changed" version info from source comments.
(The version control system maintains this information automatically.)

Delete the trailing whitespace characters.
2022-11-20 21:23:33 +02:00
Cosmin Truta
8cfdb5436d Clean up oss-fuzz
With the caveat that oss-fuzz needs a full sync with upstream, here
are the changes applied to our old copy:
 * Add a missing #include directive.
 * Remove the "last changed" version info.
 * Clean up the trailing whitespace.

Co-authored-by: Ilya Yegorov <hkctkuy@gmail.com>
Co-authored-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2022-11-20 21:13:14 +02:00
Cosmin Truta
f6036c0aeb Update, rename and clean up various scripts
Rename contrib/tools/chkfmt to contrib/tools/chkfmt.sh; refactor:
 * Increase the max line length for contrib/**/*.[ch] from 96 to 100.
 * Set the max line length for ci_*.sh to 100.
 * Use `basename $0` instead of the hard-coded script name.
 * Update comments.

Remove contrib/tools/reindent. For automated code formatting, including
indentation, we need a robust solution.

Add an empty line after the hashbang line in all scripts.

Remove the "last changed" version info from comment headers.
(The version control system maintains this information automatically.)
2022-11-20 20:21:41 +02:00
Cosmin Truta
689e06516b Clean up vestigial uses of png_size_tp 2022-11-20 17:51:33 +02:00
Cosmin Truta
33de006e12 Turn large PNG chunks into benign errors
Import Chromium commit
e87a029871

Add the author to the list of libpng contributing authors.

Portions from the original commit message follow:

***

A recent change to libpng [1] (included in Chromium with the recent
libpng update [2]) turns chunks that are bigger than
PNG_USER_CHUNK_MALLOC_MAX into failures. Although this matches the
intent of PNG_USER_CHUNK_MALLOC_MAX, it also causes images which used to
be viewable in Chromium to fail. Changing to a benign error allows us to
display these images once again. Though it means we do allow libpng to
allocate more than PNG_USER_CHUNK_MALLOC_MAX, it matches the behavior
prior to [2] (when we were using 1.6.22), and it does not regress
crbug.com/117369

[1] 347538efbd
[2] f82653a473

***

Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=827754
Co-authored-by: Leon Scroggins III <scroggo@google.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2022-11-20 00:56:35 +02:00
tangyaofang
9b5488054b Fix comments
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2022-11-16 01:51:34 +02:00
Felix Hanau
04c016d79f scripts: Fix the remaining instance of ZLIB_INCLUDE_DIR 2022-10-23 23:10:07 +03:00
Cosmin Truta
b8ca9108ac arm: Add a compile-time assertion about PNG_ARM_NEON_CHECK_SUPPORTED
Following up on the previous commit by Martin Storsjö:

If the availability of ARM Neon is not only known at compile time,
but also expected by the compiler's target architecture, there should
be no further need for a run-time check. In fact, such a check would
be counter-productive.
2022-10-12 12:42:09 +03:00
Martin Storsjö
e56f79c0c6 cmake: Default to PNG_ARM_NEON=off for arm targets
This matches the configure script - unless the user has requested
anything, no hardware optimizations are autoenabled.

Defaulting to "check" is brittle (that configuration is deprecated
and poorly supported) - and for configurations where it would
make sense (where NEON isn't universally enabled in the compiler)
it didn't end up setting ARM_NEON_OPT to 1 in pnglibconf.h anyway.

This fixes default builds with cmake for iOS and Windows on armv7,
where NEON is universally available (but there's no runtime check
implemented) - but actually using NEON on this architecture
requires explicitly opting in to it when configuring, just like
with the configure script.

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2022-10-12 12:35:33 +03:00
Cosmin Truta
12222e6fbd scripts: Add missing makefile.clang reference to README.txt 2022-09-18 23:51:58 +03:00
Cosmin Truta
9b65ad49d3 scripts: Remove the support for "install" targets from all makefiles
In most of the legacy makefiles (with only a few notable exceptions
such as makefile.linux), the "install" targets have been broken since
libpng-1.5.0beta01. Specifically, the "install-shared" targets produced
incorrect library names, due to a missing symbol in the definition of
the LIBSOREL macro.

Rather than correcting this long-standing and long-untested error, we
decided to remove the support for "make install" altogether, from all
legacy makefiles. Further use of "make install", "make install-static"
or "make install-shared" will fail with an error message.

Going forward, the only tested and supported manners to install libpng
shall be the conventional build and install procedures driven by the
configure script or by the CMake file.
2022-09-18 19:37:40 +03:00
Cosmin Truta
3f991d5092 scripts: Remove makefile.cegcc
It is obsolete and unlikely to be still working
2022-09-18 16:26:26 +03:00
Cosmin Truta
b422bc1181 .gitignore: Ignore the autoreconf artifacts 2022-09-18 11:35:35 +03: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
Cosmin Truta
50d7a85154 Acknowledge the contributors of bug fixes applied to the EXIF support
Considering that the EXIF support is part of the core libpng library
(which excludes scripts, tests, and other independent programs), its
contributors should be acknowledged in the AUTHORS file.
2022-09-14 22:00:42 +03:00
Cosmin Truta
2733482d8e Fix a last-minute bug in the checking of the EXIF byte-order header
The check should fail if the EXIF byte-order header doesn't start with
a correct character, or if the two heading characters aren't identical.

Rewrite the check to make the code logic easier to follow.
2022-09-14 22:00:42 +03:00
Cosmin Truta
3d57708c91 Revert "Remove second call to write_eXIf"
The second call to png_write_eXIf should not have been removed.

The first call to png_write_eXIf is for writing the eXIf chunk that is
positioned before IDAT, while the second call is for writing the eXIf
chunk that is positioned after IDAT.

TODO:
Implement a correct fix which consists in ensuring that there are no
eXIf chunks simultaneously before and after IDAT.

This reverts commit cd03aaf7bf0e0c748b8c6cb34a56b402b40d61d0.
2022-09-14 22:00:42 +03:00
Cosmin Truta
abccfd7968 .gitignore: Update 2022-09-14 21:56:47 +03:00
Cosmin Truta
823ef44f01 scripts: Remove leftover references to the ci_* scripts from README.txt 2022-09-14 21:56:47 +03:00
Cosmin Truta
d72cda543c ci: Trace the paths of executable files found on the build machine
Also add markers to trace the boundaries of configuration and build
steps.
2022-09-14 21:56:47 +03:00
Cosmin Truta
3c67eeca51 scripts: Add makefile.emcc for building libpng with Emscripten
Adapt makefile.clang to invoke the Emscripten toolchain utilities.

Co-authored-by: Kirk Roerig <mr.possoms@gmail.com>
Co-authored-by: Cosmin Truta <ctruta@gmail.com>
2022-09-14 21:50:02 +03:00
Cosmin Truta
b60656ecdc scripts: Disable the hardware-optimized compilation in legacy makefiles
Fix the legacy makefile builds on ARM, MIPS and PowerPC, where
hardware-optimized compilation was enabled by default in the generic
source files, but without including the machine-specific source files.

Delete scripts/makefile.linux-opt.
2022-09-14 21:35:33 +03:00
Cosmin Truta
c64655d058 scripts: Set the compiler warning options to "-Wall -Wextra -Wundef"
Considering that "-Wextra" is a more descriptive alternative to "-W",
and that "-Wundef" is a highly useful warning option that has been
available in ancient versions of gcc (version 2.x), we replace all
occurrences of "-W -Wall" with "-Wall -Wextra -Wundef".

Also clean up the makefiles.
2022-09-14 21:18:20 +03:00
Cosmin Truta
8b7b99c1db scripts: Clean up the logging in makefile.std and pnglibconf.mak
The console logs produced by these scripts should be easy to follow,
especially on CI bots.

Delete the unnecessary macros ECHO and SED.
Add a new macro MV_F (for "mv -f"), alongside RM_F (for "rm -f").
2022-09-14 11:53:47 +03:00
Cosmin Truta
62c027d4df Fix handling incorrect hIST chunks of uneven size
The hIST chunks, used for storing image histograms, contain arrays of
16-bit unsigned integers, and the chunk size is expected to be an even
number. Raise a png_chunk_benign_error() if a hIST chunk fails to meet
this expectation.

Reported-by: Eugene Kliuchnikov <eustas@google.com>
2022-09-14 11:30:14 +03:00
Cosmin Truta
e9e9801a84 Simplify the definition of png_isaligned and avoid compiler warnings
The following pointer subtraction was unnecessary:
((const char*)(ptr)-(const char*)0)

In order to avoid further warnings about casting a wide pointer type
to a narrower integer type, we cast the pointer to the target integer
type through (size_t).

Also fix a comment and reformat the surrounding code.
2022-09-14 11:07:36 +03:00
Cosmin Truta
0c2388cdae projects: Delete the definition of _WINDOWS from the VStudio project
The _WINDOWS macro should not be defined on a modern Windows platform.
This macro was predefined by 16-bit Windows compilers only.
2022-09-14 08:54:57 +03:00
Cosmin Truta
9cb84c4cb9 Delete vestigial declarations formerly used on 16-bit platforms
Delete the structure members used in the 16-bit Turbo C memory models.
Delete the PNG_ABORT declaration used in the 16-bit Windows build.

Stop checking macros (e.g. _WINDOWS) predefined by 16-bit Windows
compilers (but do check the __NT__ macro, which was the only one
predefined by ancient Windows NT compilers).
2022-09-14 08:54:57 +03:00
Cosmin Truta
8c542ad9df arm: Do not allow PNG_ARM_NEON_CHECK_SUPPORTED on ARM64
ARM Neon is expected to be unconditionally available on ARM64.
Issue an #error if PNG_ARM_NEON_CHECK_SUPPORTED is defined on an
ARM64-based platform.

For the plain ARM platforms where ARM Neon checking is not yet
implemented, issue a slightly more descriptive #error, including
a suggested course of action.
2022-09-14 00:42:48 +03:00
Cosmin Truta
2abaf81e0f arm: Avoid compiler warnings in palette_neon_intrinsics.c
Use correct int types; wrap PNG_UNUSED around unused arguments.
2022-09-14 00:12:11 +03:00
Vadim Zeitlin
ad0245bb96 Avoid -Wundef for MIPS and PPC symbols too
This is similar to d532334ef (Avoid -Wundef warnings when building
libpng, 2017-11-13), but for the similar symbols used under the other
architectures: always define them, even if just as 0, to avoid gcc
warnings when comparing them with 0 later.
2022-09-14 00:12:11 +03:00
Vadim Zeitlin
1f974dd2a9 Avoid -Wundef warnings for PNG_ARM_NEON_IMPLEMENTATION
Define this symbol as 0 instead of leaving it undefined when not using
ARM NEON optimizations.

No real changes, but just avoid a bunch of

"PNG_ARM_NEON_IMPLEMENTATION" is not defined, evaluates to 0 [-Wundef]

warnings when building the library.
2022-09-14 00:12:11 +03:00
Sami Boukortt
3ec225dd41 Fix a memory leak in png_set_tRNS
This leak was discovered by OSS-Fuzz.

The old structure of the code was along the lines of:

  allocate trans_alpha;
  if (problem) {
    // Jumps away from this function
    png_warning("tRNS chunk has out-of-range samples for bit_depth");
  }
  mark trans_alpha as to-free;

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2022-09-13 14:11:33 +03:00
Cosmin Truta
36bd1bbd54 Fix a crash in png_convert_from_time_t with an invalid time_t argument
This bug was found by FUTAG, a program for generating automated
fuzz-targets of libraries.

TODO:
Implement a safe function, alternative to png_convert_from_time_t,
which takes a png_ptr argument and raises a png_error if the time_t
argument is invalid.

Reported-by: Tran Chi Thien <thientc@ispras.ru>
Reported-by: Shamil Kurmangaleev <kursh@ispras.ru>
2022-09-13 13:49:02 +03:00
Cosmin Truta
0406deb1ca Fix private macro png_constcast; delete private type png_ptruint
In order to appease the compiler warnings that might affect the uses
of png_constcast, it should be sufficient to cast the source pointer
type to (const void*), and then to (void*), and then to the destination
pointer type. An intermediate cast through an integer type, such as
(png_ptruint), should not be needed.
2022-09-13 01:54:17 +03:00
Peter Kasting
5f5f98a1a9 Fix an instance of -Wunused-but-set-variable.
Bug: chromium:1203071
2022-09-13 01:49:33 +03:00
xmuli
f10c6bb603 Add spaces around '/*' and '*/'
Like most other Qt coding styles, the necessary spaces should be added
to the sides of '/*' and '*/'
2022-09-13 01:37:02 +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
6aff792b66 projects: Update the README file of the Visual Studio project 2022-09-13 01:23:52 +03:00
Gabor Kertesz
ed8840a36f projects: Add ARM64 to Visual Studio project 2022-09-13 01:23:52 +03:00
Gabor Kertesz
efdb24e54b projects: Fix C2220 warning errors for VS2019
It sets warning level lower and not treat as errors because of
C2220 warnings are escalated to errors in Visual Studio 2019.
2022-09-13 01:23:52 +03:00
Gabor Kertesz
1f20bc1e85 projects: Upgrade to Visual Studio 2019 2022-09-13 01:23:52 +03:00
Gabor Kertesz
bbab57105b scripts: Add makefile for win-arm64
This makefile is based on makefile.vcwin32, but includes Neon
intrinsic optimization.

Co-authored-by: Gabor Kertesz <gabor.kertesz@linaro.org>
Co-authored-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2022-09-13 01:23:52 +03:00
Gabor Kertesz
a1a81cc2ac Fix arm neon config for win-arm64 with MSVC
Fixes #398
It adds win-arm64 as an arm64 platform, by using a define which
is set to 1 for compilations that target 64-bit ARM processors,
otherwise undefined.
2022-09-13 01:23:52 +03:00
Cosmin Truta
c3a1d8424c Update INSTALL 2022-09-13 00:56:32 +03:00
Samanta Navarro
eda0f47f46 Fix typo in libpng manual 2022-09-13 00:34:27 +03:00
Cosmin Truta
3848c73ab4 cmake: Refactor the PNGLIB variables that define the versioning scheme 2022-09-12 13:50:32 +03:00
Cosmin Truta
dd8db8105c cmake: Fix the shared build on Android
The ld version script should not be generated on Android.

Co-authored-by: Volker Krause <vkrause@kde.org>
Co-authored-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2022-09-10 23:50:49 +03:00
Cameron Cawley
763c77e628 cmake: Fix compilation on systems without libm
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2022-09-10 22:31:28 +03:00
Christopher Sean Morrison
840af2eda6 cmake: Fix the build on Unix with source files checked out on Windows
The issue is that, by default, Git for Windows checks out text files
with CRLF line endings. This is a problem for awk, which is expecting
Unix-style LF line endings. When cloning on Windows and attempting to
compile on WSL, Mingw or Cygwin, there may be an error from awk.

The fix is to leverage CMake's ability to configure a file and perform
EOL conversions. We copy the awk scripts from the source directory to
the build directory. This portable method ensures they have LF endings,
and the build logic is updated to use the build directory version.

Intentionally avoiding .gitattributes to avoid setting precedent.

Co-authored-by: Christopher Sean Morrison <brlcad@gmail.com>
Co-authored-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2022-09-10 22:02:00 +03:00
Owen Rudge
8a354b41e9 cmake: Fix cross-compilation on macOS
Co-authored-by: Owen Rudge <owen@owenrudge.net>
Co-authored-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2022-09-10 21:31:13 +03:00
Cosmin Truta
0fe598d2f6 cmake: Rename the target "symbol-check" to "scripts_symbols_chk"
Follow the general conventions for naming CMake targets.
2022-09-10 20:45:21 +03:00
Gleb Mazovetskiy
cbf8c64b58 cmake: Correctly handle generated files
Generated files depend on other generated files, and this previously
resulted in the same custom command output being a dependency of
multiple other custom commands without a shared custom targets.

Adds a top-level target for each generated file and ensures that
commands that depend on generated files also depend on the corresponding
custom targets.

Per CMake documentation:

> Do not list the output in more than one independent target
> that may build in parallel or the two instances of the rule
> may conflict (instead use add_custom_target to drive the command
> and make the other targets depend on that one).

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2022-09-10 20:39:05 +03:00
Cosmin Truta
6a42bc1c8e configure: Initialize PNG_ARM_NEON_OPT and PNG_MIPS_MSA_OPT correctly 2022-09-05 21:03:20 +03:00
Cosmin Truta
9e32b6f1ad Rerun "./autogen.sh --maintainer" 2022-09-05 17:30:06 +03:00
Cosmin Truta
cc0e959722 Clean up configure.ac
Remove the obsolete autoconf macros:
AC_C_CONST, AC_HEADER_STDC, AC_TYPE_SIZE_T, AC_FUNC_STRTOD.

Clean up comments and whitespace.
2022-09-05 17:30:06 +03:00
Dan Field
403422674d Remove obsolete/incorrect __LLVM,__asm section
Contributed-by: Dan Field <dnfield@google.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2022-09-05 13:46:00 +03:00
Cosmin Truta
bfb0abe4d9 Update the configuration for Travis CI and AppVeyor CI
Apply the following changes:
 * Add FreeBSD (besides Linux and Mac) to the Travis CI testing.
 * Use cc instead of clang for Xcode in the Travis CI testing.
 * Upgrade the Windows test image from Visual Studio 2019 to
   Visual Studio 2022 for AppVeyor CI.
2022-09-04 20:21:30 +03:00
Cosmin Truta
081e6751ab ci: Update the CI scripts
Apply the following changes:
 * Set CI_CMAKE_GENERATOR to "Ninja" by default in ci_cmake.sh.
 * Set CI_CC to cc by default in ci_autotools.sh.
 * Rename CI_SYSNAME to CI_SYSTEM_NAME; add CI_MACHINE_NAME.
 * Apply other minor changes and fixes.
2022-09-04 19:41:33 +03:00
Cosmin Truta
103f8346e3 cmake: Set PNG_ARM_NEON to "on" by default on ARM64
Avoid build failures on all ARM64-based non-Linux systems.
PNG_ARM_NEON can be set to "check" on Linux/ARM32 only.
2022-08-26 03:27:42 +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
8c3fdb0ac1 ci: Update the CI scripts
Implement the following updates:
 * Add CI_SYSNAME and set it to `uname -s`.
 * Set the default CI_CC value to "clang" on all BSD systems.
 * Replace CI_SRCDIR_REL_BUILDDIR and CI_INSTALLDIR_REL_BUILDDIR
   with CI_SRCDIR_NATIVE and CI_INSTALLDIR_NATIVE.
   The former variables were hard-coded and error-prone; the new
   variables are computed and safe to use.
2021-03-15 20:23:26 -04:00
Ben Bullock
a37d483651 Eliminate spaces between function name and ( 2021-03-13 02:37:00 -05:00
Ben Bullock
3796518809 Remove duplicate line 2021-03-13 02:37:00 -05:00
Ben Bullock
8ca01083d6 Fix typo in README 2021-03-13 02:37:00 -05:00
Ben Bullock
cd03aaf7bf Remove second call to write_eXIf
The second call to write_eXIf doesn't check whether the first call
succeeded; no other chunks except tIME and the text chunks seem to be
doubled like this.

The second call causes the eXIf chunk to incorrectly be written twice.
2021-03-13 02:37:00 -05:00
Qiang Zhou
c4bd411c35 Fix decode fail on image with invalid eXIf chunk 2021-03-13 02:10:50 -05:00
Kleber Tarcísio
2224c8ea7b Add a check to pngimage.c
Check the result of png_get_IHDR inside the compare_read function.

Contributed-by: Kleber Tarcísio
Signed-off-by: Cosmin Truta
2021-03-13 01:56:32 -05:00
Cosmin Truta
e2bb5e7512 contrib: Apply various fixes to libtests
pngimage.c:
Initialize sig_bits on a NOTREACHED path to avoid warnings about using
uninitialized variables.

pngstest.c:
Enlarge buffers and fix signedness to avoid legitimate warnings about
potential buffer overflows.

pngunknown.c:
pngvalid.c:
Use NULL instead of 0 for pointers and apply other style fixes.

makepng.c:
tarith.c:
Apply various style fixes.

Also remove the "last changed" version info from source comments.
The version control system maintains this information automatically.
2021-03-12 22:54:32 -05:00
Cosmin Truta
d6e13b2acd .gitignore: Add 2020-12-31 04:08:35 -05:00
Cosmin Truta
c2e2cd2ec5 ci: Fix the Visual Studio verification on AppVeyor CI
The Unix paths in Bash do not mix well with the Windows paths in CMake.
The uppercase and the lowercase environment variables do not mix well
in MSBuild. Et cetera.

On AppVeyor CI, verification of Windows builds with the Visual Studio
toolchain used to work, perhaps due to one or more lucky coincidences,
but it stopped working after an upgrade on the AppVeyor CI site.

Update ci_cmake.sh as follows:
 * Use POSIX commands like "mkdir" and "rm" instead of CMake commands
   like "make_directory" and "remove_directory".
 * Avoid using absolute paths in the CMake command line; use relative
   paths that are accessible from both Bash and Windows.
 * Clean up incidental mixtures of Windows and Bash-on-Windows
   environment variables like {$TEMP,$Temp,$temp} and {$TMP,$Tmp,$tmp}.
2020-12-31 03:29:11 -05:00
Cosmin Truta
c3f209178b ci: Recognize more CI_ variables for better cross-platform verification
For ci_autotools.sh, customize CPP, CPPFLAGS, AR, RANLIB, LD, LDFLAGS
via CI_CPP, CI_CPP_FLAGS, CI_AR, CI_RANLIB, CI_LD, CI_LD_FLAGS.

For ci_cmake.sh and ci_legacy.sh, customize AR, AR_RC and RANLIB via
CI_AR and CI_RANLIB.

Rewrite portions of ci_legacy.sh to match the style of ci_cmake.sh.
2020-12-31 00:41:01 -05:00
Cristian Rodríguez
dbe3e0c43e libpng.pc.in: zlib dependency is private
zlib should be injected only when pkgconfig is ran with the --static
option.
2020-05-24 23:28:35 -04:00
Cosmin Truta
2f753e260c ci: Verify the install target
Add support for the install target in ci_autotools.sh and ci_cmake.sh.
Also add the environment option CI_NO_INSTALL.
2020-05-24 22:09:45 -04:00
Cosmin Truta
f5d5f5ae0e cmake: Refactor the install target; reformat
Use standard CMake variables in the install target.
Reformulate comments and error messages.
Move all CMake keywords in front of their arguments.
Fix indentation.
2020-05-24 22:01:40 -04:00
Cosmin Truta
3676fd324a ci: Add a new top-level directory, dedicated for CI verification
Update the ci_*.sh scripts and move them to the more conventional
ci/ directory. Update .appveyor.yml and .travis.yml, as well as
the AUTHORS file, accordingly.

Speed up ci_cmake.sh: add "-DPNG_TESTS=OFF" to the list of CMake
variables if CI_NO_TEST is true.

Remove "sudo: false" from .travis.yml.

Refactor .appveyor.yml.
2020-05-18 21:30:30 -04:00
Alex Gaynor
28c0f8895e cmake: Add an option to enable/disable building of executables
Add the CMake option PNG_EXECUTABLES (on by default) in order to
allow or disallow the building of non-essential executable programs
associated with libpng.

Contributed-by: Alex Gaynor <alex.gaynor@gmail.com>
Contributed-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2020-05-18 18:46:32 -04:00
Cosmin Truta
87378bc21d mips: Remove "last changed" version information from source comment
This information is maintained by the version control system.
2020-05-17 20:26:28 -04:00
gxw
6c6f7d105a mips: Fix initialization: always close "/proc/cpuinfo" 2020-05-17 20:26:28 -04:00
Simon Hausmann
6842c58adc Fix CMake build with Emscripten
When building with Emscripten, linkage to libm is neither required
nor working. As find_library will fail, M_LIBRARY will be set to
NOTFOUND and the build would fail later. The build works just fine
without libm linkage.
2020-05-17 20:13:17 -04:00
Dan Field
a6fc80300f Add an __LLVM,__asm section for clang builds on ARM 2020-05-17 20:00:46 -04:00
Steve Robinson
5e8b45c436 cmake: Fix a build error on iOS
Avoid the awk-based configuration when cross-compiling from macOS
to iOS.
2020-05-17 19:50:18 -04:00
Zack Middleton
6dd99ca9c8 Fix example.c 2020-04-27 01:27:07 -04:00
willson-chen
52ee167644 Fix a warning on Linux caused by _BSD_SOURCE
I got a warning while compiling under Ubuntu 18.04 and gcc 7.4:
"__BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"

Quote from the Linux Programmer's Manual:
"To allow code that requires _BSD_SOURCE in glibc 2.19 and earlier and
_DEFAULT_SOURCE in glibc 2.20 and later to compile without warnings,
define both _BSD_SOURCE and _DEFAULT_SOURCE."
2020-04-27 00:46:06 -04:00
skal
eb6767273a Fix memory leak if eXIf has incorrect crc
Problem description:
Imagine a bitstream with an eXIf data segment that has invalid CRC.
If png_crc_finish() fails at line 2090, info_ptr->eXIf_buf is not freed
(despite the free_me setting at line 2062) because png_free_data() is
not called. png_read_info() is actually looping several time over the
png_eXIf chunk, calling png_handle_eXIf() several time in a row without
freeing the buffer.

This patch fixes the problem by leaving info_ptr's content in a clean
state in case of failure, as it is done at line 2084.
2020-04-27 00:16:36 -04:00
David Callu
9f734b13f4 cmake: Use the correct ZLIB_* variable names
ZLIB_LIBRARIES and ZLIB_INCLUDE_DIRS are the official cmake variable
names.
2020-04-26 23:54:11 -04:00
Cosmin Truta
3cec1a16f5 scripts: Clean up the makefiles
Delete variables (ALIGN, ARCH, DOCS) and targets (writelock) that are
no longer necessary.

Reorder the object file lists alphabetically, consistently across all
makefiles and build scripts.

Apply other minor fixes.
2020-03-29 23:58:29 -04:00
Cosmin Truta
50bd1abdb1 scripts: Fix makefile.std and include it in the CI verification 2020-03-29 22:26:32 -04:00
Cosmin Truta
2dd5630eae Update configuration for Travis CI; add configuration for AppVeyor CI
Exclude the branch "libpng16" from testing. It's identical to "master".
Also exclude the other (non-current) "libpng[0-1][0-7]" branches.

Parallelize the builds and the unit tests.

For Travis CI, update the build matrix as follows:
 * On Linux, use both clang and gcc.
 * On macOS, use clang only, with and without Xcode.

For AppVeyor CI, add a build matrix as follows:
 * On Windows, use Microsoft Visual Studio 2019 on x86, x64 and arm64.
 * Also on Windows, use MSYS2 on x86 and x64.

Use the new scripts/ci_*.sh; remove the old scripts/travis.sh.
2020-03-29 01:11:42 -04:00
Cosmin Truta
b9155ce3fd scripts: Add general-purpose utilities for continuous integration
Currently, libpng supports three different types of build automation:
the GNU autotools, CMake, and a legacy of hand-made makefiles.

In order to simplify the continous integration of all of the above
build options, we introduce the following scripts:
 * ci_autotools.sh: CI utility for the Autotools build
 * ci_cmake.sh: CI utility for the CMake build
 * ci_legacy.sh: CI utility for the legacy makefiles
2020-03-29 00:41:33 -04:00
Cosmin Truta
2c0aee56a0 Update the copyright year 2020-02-02 20:02:00 -05:00
Christopher Thompson
301f7a1429 oss-fuzz: Add custom malloc with max limit to prevent OOM
This adds the custom malloc/free functions from the old
libpng_read_fuzzer to the upstream fuzzer to prevent clusterfuzz
running into OOM.

Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=904054
Contributed-by: Christopher Thompson <cthomp@chromium.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2019-04-25 00:37:57 -04:00
Ryan VanderMeulen
386707c6d1 arm: Use <arm_neon.h> when compiling aarch64 intrinsics with clang-cl
MSVC's <arm64_neon.h> header contains cl.exe intrinsics that are not
recognized by clang-cl.

Contributed-by: Ryan VanderMeulen <rvandermeulen@mozilla.com>
Contributed-by: Mike Klein <mtklein@google.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2019-04-24 23:57:14 -04:00
Cosmin Truta
216387f6f7 arm: Move a png_debug statement to its correct place
It should be placed immediately after all variable declarations.
2019-04-22 23:56:57 -04:00
Cosmin Truta
b9e811fa99 scripts: Delete makefile.clang-asan and makefile.gcc-asan
Travis CI is now running sanitizer-enabled test jobs.
2019-04-22 23:00:58 -04:00
Cosmin Truta
cdbb8ec7aa Add support for Travis CI 2019-04-22 23:00:58 -04:00
Cosmin Truta
72fa126446 Avoid random test failures by running pngtest sequentially only
It is unreliable to run pngtest in parallel, due to competing writes
to the same intermediate/output file ("pngout.png").

Customization of this output file name should be possible, but it is
currently broken.
2019-04-21 00:30:14 -04: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
27e8b99287 pngminus: Use the system zlib by default
If a zlib source tree exists besides the libpng source tree in the
same parent directory, the pngminus build may fail, unless the zlib
tree is built fully. In order to avoid this failing scenario, do not
use the custom-built zlib by default.

(The custom-built zlib is still necessary on platforms that lack a
system-built zlib.)
2019-04-10 22:23:25 -04:00
Willem van Schaik
62a56d4fcc pngminus: Change license to MIT, etc.
Change the license to MIT.
Move the license text from the source files to a LICENSE file.
Move the change log from the source files to a CHANGES file.
Delete the Turbo C makefile and simplify the Linux makefile heavily.
Create explicitly named static and shared executables in the makefile.
Refresh the README file a bit from the twenty year old one.

Signed-off-by: Willem van Schaik <willem@schaik.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2019-04-10 22:23:25 -04:00
Cosmin Truta
3342fafa60 pngminus: Add a CMakeLists file 2019-04-10 22:23:25 -04:00
Cosmin Truta
3f0f1d5579 pngminus: Improve portability and fix style (cont'd) 2019-04-10 22:23:25 -04:00
Cosmin Truta
dcefbc7dcd pngminus: Improve portability and fix style 2019-04-10 22:23:25 -04:00
Cosmin Truta
1f0221fad7 pngminus: Fix a buffer overflow in tokenizer 2019-04-10 22:23:25 -04:00
Cosmin Truta
a627bd26a3 arm: Partially revert "Fix a memory leak in the riffled palette [...]"
The memory leak remains fixed, but the associated refactoring is
being reverted. Moving the initialization of the riffled palette
from png_do_read_transformations to png_init_palette_transformations
has caused a regression in some of the test programs.

Although png_init_palette_transformations is the proper place to
perform this initialization, and the test programs are technically
incorrect to fail, we are still undoing that refactoring for the
time being.
2019-04-07 19:50:12 -04:00
Cosmin Truta
82ae623ec9 arm: Rename all functions to the pattern png_*_neon; add debug traces 2019-03-31 09:44:45 -04:00
Cosmin Truta
9c0d5c77bf Call png_image_free_function without guarding it with png_safe_execute
png_image_free_function (or any other destructor) should never fail.
Destructors need not and must not be executed under png_safe_execute.

Reference: CVE-2019-7317, use-after-free in png_image_free
2019-02-03 22:40:56 -05:00
Cosmin Truta
8439534daa Fix a memory leak in pngtest.c
Ensure that row_buf is deallocated not only after a read error, but
also after a write error.

Use the format "%p" instead of "0x%08lx" for printf-ing row_buf in
a portable manner.
2019-02-03 21:00:49 -05:00
Cosmin Truta
70d122aac4 Fix a memory leak in the riffled palette optimization on ARM; refactor
Move deallocation of riffled_palette from png_write_destroy to
png_read_destroy. The reader (not the writer) is the owner of
riffled_palette.

Move allocation and initialization of riffled_palette from
png_do_read_transformations to png_init_palette_transformations.

Allow riffled_palette inside png_struct only if the ARM Neon
optimizations are enabled.

Rename png_riffle_palette_rgba to png_riffle_palette_rgba8, etc.,
to better indicate the strict applicability of these routines.

Fix an unused parameter warning in the build configurations where
riffled palette optimization is not enabled.

Fix indentation.
2019-02-03 19:51:18 -05:00
Cosmin Truta
0a882b5787 scripts: Add makefile.clang, makefile.clang-asan and makefile.gcc-asan
Also apply minor updates to makefile.gcc and makefile.msys
2019-01-20 22:21:48 -05:00
Cosmin Truta
fef895aa28 Update the copyright year 2019-01-19 19:01:19 -05:00
Cosmin Truta
43b4141839 scripts: Delete makefile.ne12bsd; clean up makefile.*bsd 2018-12-30 13:34:15 -05:00
Cosmin Truta
6a94d14567 Bump version to 1.6.37.git 2018-12-30 12:00:41 -05:00
Cosmin Truta
0e13545712 Join the branches 'libpng16' and 'master'
The branch 'libpng16' is for tracking libpng version 1.6.x.
The branch 'master' is for tracking the latest stable libpng version.

These branches will diverge again at the next major libpng upgrade.
2018-12-01 09:36:00 -05:00
Cosmin Truta
eddf902320 Release libpng version 1.6.36 2018-12-01 09:36:00 -05:00
Cosmin Truta
85acd919b9 [master] Imported from libpng-1.6.36.tar 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
Cosmin Truta
81a65de25d Clean up config, scripts, examples, etc. 2018-11-25 20:27:04 -05:00
Kyle Bentley
702a07e716 CMakeLists: Fix incorrect creation of pkg-config file
(Contributed by Kyle Bentley)
2018-11-23 18:58:18 +00:00
Cosmin Truta
7b2224cb6e CMakeLists: Require CMake version 3.1 or newer
Although CMake version 3.0.2 was previously required, the policies
CMP0053 and CMP0054, introduced only in CMake version 3.1 and used
in this CMakeLists file, can have surprising effects under an older
CMake version.

Simplify the CMakeLists file by setting the global policy version
to 3.1, and remove the specific policy settings.

As an added bonus, remove the vestigial workarounds for all ancient
CMake versions.
2018-11-17 23:39:15 -05:00
Cosmin Truta
ee7967eea4 CMakeLists: Fix detection of libm
Only use libm on Unix and Unix-like systems, except for Apple (where
it's unnecessary), and BeOS and Haiku (where it's unavailable).

Avoid searching for libm at explicit locations. They may be incorrect,
especially for cross-platform builds.
2018-11-17 21:31:55 -05:00
Cosmin Truta
a54a0562c5 Rerun autogen.sh 2018-09-04 01:10:21 -04:00
Cosmin Truta
94429a335b Remove the "last changed" version information from source comments 2018-09-04 00:58:55 -04:00
Cosmin Truta
1ceaa83a84 Fix the build with MSVC ARM64 2018-09-04 00:53:38 -04:00
Cosmin Truta
b66ed71131 Restore the ANSI C compliance after adding the ARM optimization
Also apply style and formatting fixes
2018-09-04 00:15:30 -04:00
Richard Townsend
7734cda20c Optimize png_do_expand_palette for ARM
ARM-specific optimization processes 8 or 4 pixels at once.
Improves performance by around 10-22% on a recent ARM Chromebook.
2018-09-04 00:04:58 -04:00
Cosmin Truta
2fc5ddff18 Restore the ANSI C compliance after applying the MSVC ARM64 fix 2018-09-03 22:27:45 -04:00
zzzzRuby
8033c96f32 Fix build errors with MSVC ARM64
(Contributed by Zhijie Liang)
2018-09-03 22:26:06 -04:00
Samuel Williams
d3d1baadb4 Prefer memcpy to manual pointer arithmetic. 2018-08-19 01:16:22 -04: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
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
58eedced25 CMakeLists: Update the contributor list 2018-08-18 19:49:56 -04:00
Cosmin Truta
1d89a5db66 CMakeLists: Fix style 2018-08-18 19:49:56 -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
6c059f8f5b configure: Remove the memset check and the HAVE_MEMSET macro
The compatibility workaround png_memset() has been removed long ago.
The availability of memset() is a platform requirement.
2018-08-11 00:47:18 -04:00
Cosmin Truta
f5d48df418 CMakeLists: Remove the PNGARG option
Pre-ANSI function prototypes are no longer supported.
2018-08-11 00:47:18 -04:00
Cosmin Truta
9730362202 CMakeLists: Avoid symlinks on MSYS
create_symlink breaks the MSYS generator in the Windows CMake.
2018-08-10 00:58:48 -04:00
Cameron Cawley
7cb7afb43d CMake: Fix compilation on systems without libm 2018-08-01 00:24:48 -04:00
Cosmin Truta
1bd4214a42 Clean up the scripts/ directory
Delete the files that are unused, redundant, or fundamentally broken:
def.c, makefile.bor, makefile.knr, makefile.msc, makefile.solaris-x86,
makefile.tc3
2018-07-29 22:19:43 -04:00
Cosmin Truta
6d55a14c58 Update projects/vstudio 2018-07-29 21:51:48 -04:00
Cosmin Truta
8440326590 Update the documentation 2018-07-29 00:33:12 -04:00
Cosmin Truta
b729fff4a3 Remove the Y2K compliance statement
As of July 2018, this statement is no longer necessary.
2018-07-28 23:39:55 -04:00
Cosmin Truta
c36c09f004 Update the export control information
Also reformat the license text.
2018-07-28 23:00:48 -04:00
Cosmin Truta
a873893279 Remove the "last changed" version information from source comments
This information is maintained by the version control system.
2018-07-28 18:47:21 -04:00
Cosmin Truta
47f18784e4 Rerun autogen.sh 2018-07-28 18:34:58 -04:00
Cosmin Truta
d4fb621429 Bump version to 1.6.36.git and update copyright notice 2018-07-28 18:34:58 -04:00
Vicki Pfau
fb6312a9f9 ARM: Disable hand-written AArch32 NEON on AArch64 2018-07-16 22:52:24 -04:00
Vicki Pfau
ddc842bf06 CMakeLists: Fix passing "off" for PNG optimizations 2018-07-16 22:52:04 -04:00
Vicki Pfau
46924bd877 CMakeLists: Fix disabling hardware optimizations 2018-07-16 22:50:32 -04:00
Cosmin Truta
8da397423e [master] Imported from libpng-1.6.35.tar 2018-07-15 23:58:00 -04:00
Cosmin Truta
c17d164b44 Run autogen.sh 2018-07-15 23:58:00 -04:00
Cosmin Truta
46aedd8961 Release libpng version 1.6.35 2018-07-15 23:58:00 -04:00
Cosmin Truta
2471434d29 [libpng16] Added missing parentheses to a macro definition
(Contributed by github.com/irwir)
2018-07-01 23:32:08 -04:00
Cosmin Truta
8a05766cb7 [libpng16] Fix the calculation of row_factor in png_check_chunk_length
(Bug report by Thuan Pham, SourceForge issue #278)
2018-06-17 22:56:29 -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
Glenn Randers-Pehrson
916117d970 [libpng16] Allow compresion-type to be NULL in png_set_iCCP(). 2018-03-29 10:37:12 -05:00
Glenn Randers-Pehrson
7784cd3f6f [libpng16] Fix png_get_iCCP() to allow null compression-type 2018-03-28 18:02:32 -05:00
Glenn Randers-Pehrson
cde1e1fe79 [libpng16] Bump version to 1.6.35beta02 2018-03-06 14:06:57 -06:00
Glenn Randers-Pehrson
0e06b5948c [libpng16] Imported from libpng-1.6.35beta01.tar 2018-03-06 14:06:24 -06:00
Glenn Randers-Pehrson
3fecfeada1 Merge branch 'more-misc-typos' of git://github.com/luzpaz/libpng into libpng16 2018-03-05 11:18:16 -06:00
taigacon
140f3aa280 Fix png_set_option to work. 2018-03-05 22:10:41 +08:00
luz.paz
eb91c0e4ed More misc. typos
found via `codespell-q 3`
please review
2018-02-09 06:57:29 -05:00
Glenn Randers-Pehrson
d5e4915ebe [libpng16] Update copyright year to 2018 in png.c 2018-01-07 20:06:11 -06:00
Glenn Randers-Pehrson
fe669f6f38 [libpng16] Update copyright year 2018-01-07 19:55:19 -06:00
Glenn Randers-Pehrson
84e6e35675 [libpng16] Fix potential problem with bKGD (Cosmin Truta) 2018-01-07 17:43:09 -06:00
Glenn Randers-Pehrson
28d0ee757d [libpng16] temporarily disable 16-to-8 downscaling in the fuzzer 2017-12-17 17:52:45 -06:00
Glenn Randers-Pehrson
f07b985ddb [libpng16] CHange "ASM C" to "C ASM" in CMakelists.txt 2017-12-17 17:49:26 -06:00
Vadim Zeitlin
d532334ef5 Avoid -Wundef warnings when building libpng
Always define PNG_INTEL_SSE_OPT and PNG_INTEL_SSE_IMPLEMENTATION before
comparing them with 0.
2017-11-13 22:06:01 +01:00
Glenn Randers-Pehrson
7292c861b1 [master] Imported from libpng-1.6.34.tar 2017-11-06 16:10:16 -06:00
Glenn Randers-Pehrson
fc32eb1662 [libpng16] Initialize entire 256-entry palette in png_set_PLTE(). 2017-11-04 16:31:45 -05:00
Glenn Randers-Pehrson
7ca2f0e078 [libpng16] Fix one more typo 2017-11-03 11:31:39 -05:00
Glenn Randers-Pehrson
babae66b48 [libpng16] Update CHANGES and ANNOUNCE 2017-11-03 11:30:36 -05:00
Glenn Randers-Pehrson
3403a6e387 Merge branch 'typos' of git://github.com/luzpaz/libpng into libpng16 2017-11-03 10:57:27 -05:00
Glenn Randers-Pehrson
b196bd6566 [Libpng16] Add typecast to NULL argument to png_do_expand() 2017-11-03 10:50:38 -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
7125401411 [libpng16] Undo recent pngrutil.c change that did not fix oss-fuzz issue 2017-10-31 20:58:19 -05:00
Glenn Randers-Pehrson
4b52ef8e76 [libpng16] Removed some unnecessary brackets in pngrtran.c 2017-10-31 20:57:23 -05:00
Glenn Randers-Pehrson
5d7b4ab289 [libpng16] Replace png_set_add_alpha with png_set_trns_to_alpha in fuzzer. 2017-10-30 15:16:33 -05:00
Glenn Randers-Pehrson
7ee802a5a2 [libpng16] Initialize trans_color.red, green, and blue == trans_color.gray
in attempt to stop an oss-fuzz "use of ininitialized value" issue
2017-10-29 17:49:38 -05:00
Glenn Randers-Pehrson
2f8b82ebca [libpng16] Revert recent changes that did not help with oss-fuzz issues 2017-10-29 10:30:42 -05:00
Glenn Randers-Pehrson
aea0ec4346 [libpng16] Initialize tRNS read buffers in pngrutil.c 2017-10-20 19:38:03 -05:00
Glenn Randers-Pehrson
af08094ba6 [libpng16] Use png_calloc instead of png_malloc in png_set_tRNS 2017-10-19 20:59:40 -05:00
Glenn Randers-Pehrson
9bddba26de [libpng16] Initialize entire palette array to zero in png_handle_PLTE(). 2017-10-17 16:22:22 -05:00
Glenn Randers-Pehrson
3b5bcea010 [libpng16] Revert recent changes to pngset.c 2017-10-17 15:20:31 -05:00
Glenn Randers-Pehrson
adefba1b03 [libpng16] Free tRNS chunk data when abandoning it 2017-10-16 21:03:43 -05:00
Glenn Randers-Pehrson
48a2460393 [libpng16] Do not enable tRNS having trans_color with out-of-range value. 2017-10-16 07:25:58 -05:00
Glenn Randers-Pehrson
2be0f33e7c [libpng16] Nullify trans_color with out-of-range value, to stop oss-fuzz issue. 2017-10-15 11:04:53 -05:00
Glenn Randers-Pehrson
ccc77d2a8d [libpng16] Add a call to png_set_packing() to the fuzzer. 2017-10-14 11:33:59 -05:00
Glenn Randers-Pehrson
f648294931 [libpng16] Removed call to png_read_start_image() from the fuzzer. In libpng16
it is an error to call that along with png_read_update_info().
2017-10-13 14:00:36 -05:00
Glenn Randers-Pehrson
83f27f018c [libpng16] Relocate png_read_update_info() wrt png_start_image() in fuzzer. 2017-10-12 20:10:40 -05:00
Glenn Randers-Pehrson
fefe0affc1 [libpng16] Update CHANGES and ANNOUNCE and last-changed date in the fuzzer. 2017-10-12 14:30:36 -05:00
Glenn Randers-Pehrson
a3d1057a73 [libpng16] Fix typo in fuzzer (png_info_ptr should be info_ptr) 2017-10-11 16:58:39 -05:00
Glenn Randers-Pehrson
12384eae6f [libpng16] Relocate malloc of row_ptr after png_read_update_info() in fuzzer 2017-10-11 16:28:14 -05:00
Glenn Randers-Pehrson
357af1f095 ]libpng16] Add png_read_update_info() where needed in the fuzzer 2017-10-11 11:56:30 -05:00
Glenn Randers-Pehrson
ab791fc9d6 [libpng16] Add some commonly-used transforms to the libpng fuzzer 2017-10-10 20:30:54 -05:00
Glenn Randers-Pehrson
f5f8b98dbb [libpng16] Remove "cd ../libpng" from oss-fuzz build.sh 2017-10-09 21:02:15 -05:00
Glenn Randers-Pehrson
293b6aaa59 [libpng16] Revert to using the system zlib with the libpng fuzzer 2017-10-07 12:38:04 -05:00
Glenn Randers-Pehrson
98a3b2a5c2 [libpng16] Use --with-libpng-prefix=OSS_FUZZ_ while building the fuzzer 2017-10-07 09:46:51 -05:00
Glenn Randers-Pehrson
78ad1208d6 [libpng16] Use "--with-zlib-prefix=z_" while building oss-fuzz fuzzer 2017-10-05 08:31:26 -05:00
Glenn Randers-Pehrson
477a241c10 [libpng16] Use --zprefix in oss-fuzz libpng build to avoid conflict with system libz. 2017-10-03 09:51:09 -05:00
Glenn Randers-Pehrson
edb1f47139 [libpng16] Clone zlib into the oss-fuzz zlib project and build zlib alongside libpng. 2017-10-01 16:21:16 -05:00
Glenn Randers-Pehrson
0f9f170e9f [libpng16] Restore bad interlaced files, in contrib/pngsuite/interlaced 2017-09-29 18:15:53 -05:00
Glenn Randers-Pehrson
99d4a62c9a [libpng16] Restored 21 of the contrib/pngsuite/i*.png, which were correct. 2017-09-29 11:06:17 -05:00
Glenn Randers-Pehrson
2227793efc [libpng16] Bump version to 1.6.35beta01 2017-09-29 10:52:22 -05:00
Glenn Randers-Pehrson
b78804f9a2 [libpng16] Imported from libpng-1.6.34.tar 2017-09-29 03:42:33 -05:00
Glenn Randers-Pehrson
345fc37fdc [libpng16] Bump version to 1.6.34beta01 2017-09-28 17:51:45 -05:00
Glenn Randers-Pehrson
c1effe1bbf [master] Imported from libpng-1.6.33.tar 2017-09-28 13:58:53 -05:00
Glenn Randers-Pehrson
f8110669f0 [master] Imported from libpng-1.6.32.tar 2017-08-24 16:39:24 -05:00
Glenn Randers-Pehrson
fbff8986e7 [master] Imported from libpng-1.6.31.tar 2017-07-27 05:27:39 -05:00
Glenn Randers-Pehrson
8c552ddf5b [master] Imported from libpng-1.6.30.tar 2017-06-28 13:50:50 -05:00
Glenn Randers-Pehrson
b363e01e6b [master] Imported from libpng-1.6.29.tar 2017-03-16 07:27:43 -05:00
Glenn Randers-Pehrson
0a181e1665 [master] Imported from libpng-1.6.28.tar 2017-01-05 11:50:11 -05:00
Glenn Randers-Pehrson
e4b59e5583 [master] Imported from libpng-1.6.27.tar 2016-12-29 08:10:06 -06:00
Glenn Randers-Pehrson
35cbe7640b [master] Imported from libpng-1.6.26.tar 2016-10-19 19:11:48 -05:00
Glenn Randers-Pehrson
eb5cdf0c64 [master] Imported from libpng-1.6.25.tar 2016-08-31 22:30:55 -05:00
Glenn Randers-Pehrson
0c29ab2b31 [master] Imported from libpng-1.6.24.tar 2016-08-03 21:42:00 -05:00
Glenn Randers-Pehrson
5a8b04137f [master] Imported from libpng-1.6.23.tar 2016-06-09 07:08:36 -05:00
Glenn Randers-Pehrson
87c14c528a [master] Imported from libpng-1.6.22.tar 2016-05-26 07:25:22 -05:00
Glenn Randers-Pehrson
5756fcab2f [master] Imported from libpng-1.6.21.tar 2016-01-15 14:04:53 -06:00
Glenn Randers-Pehrson
047737496a [master] Imported from libpng-1.6.20.tar 2015-12-02 22:37:04 -06:00
Glenn Randers-Pehrson
b9c62013ef [master] Imported from libpng-1.6.19.tar 2015-11-12 07:18:03 -06:00
Glenn Randers-Pehrson
287fb89248 [master] Imported from libpng-1.6.18.tar 2015-07-22 22:41:05 -05:00
Glenn Randers-Pehrson
2b667e4923 [master] Imported from libpng-1.6.17.tar 2015-03-26 08:11:22 -05:00
Glenn Randers-Pehrson
070a616b82 [master] Imported from libpng-1.6.16.tar 2015-01-15 12:47:40 -05:00
Glenn Randers-Pehrson
da7a1e79af [master] Imported from libpng-1.6.15.tar 2014-11-20 10:23:30 -06:00
Glenn Randers-Pehrson
eed640dbe8 [master] Imported from libpng-1.6.14.tar 2014-10-22 19:33:27 -05:00
Glenn Randers-Pehrson
d55c4f32fc [master] Imported from libpng-1.6.13.tar 2014-08-21 05:59:56 -05:00
Glenn Randers-Pehrson
238e7646a8 [master] Imported from libpng-1.6.12.tar 2014-06-11 20:42:07 -05:00
Glenn Randers-Pehrson
d21eae44e7 [master] Imported from libpng-1.6.11.tar 2014-06-05 10:01:04 -05:00
Glenn Randers-Pehrson
1cc02f0395 [master] Imported from libpng-1.6.10.tar 2014-03-06 13:15:45 -06:00
Glenn Randers-Pehrson
a710317d2f [master] Imported from libpng-1.6.9.tar 2014-02-05 22:34:07 -06:00
Glenn Randers-Pehrson
339ef1ec97 [master] Imported from libpng-1.6.8.tar 2013-12-19 09:13:08 -06:00
Glenn Randers-Pehrson
0e60f06b7c [master] Update version number in CHANGES file. 2013-11-14 12:52:10 -06:00
Glenn Randers-Pehrson
a066d49b01 [master] Imported from libpng-1.6.7.tar 2013-11-14 12:28:22 -06:00
Glenn Randers-Pehrson
05f3788b7a [master] Imported from libpng-1.6.5.tar 2013-09-14 09:44:17 -05:00
Glenn Randers-Pehrson
90e288241d [master] Imported from libpng-1.6.4.tar 2013-09-12 07:44:55 -05:00
Glenn Randers-Pehrson
fca68966b2 [master] Imported from libpng-1.6.3.tar 2013-07-17 19:43:57 -05:00
Glenn Randers-Pehrson
a4f7ea0d11 [master] Imported from libpng-1.6.2.tar 2013-04-25 11:06:20 -05:00
Glenn Randers-Pehrson
41db297e63 [master] Imported from libpng-1.6.1.tar 2013-03-27 20:39:36 -05:00
Glenn Randers-Pehrson
0da9cf38cd [master] Imported from libpng-1.6.0.tar 2013-02-13 23:32:06 -06:00
Glenn Randers-Pehrson
d14caad2e9 [master] Imported from libpng-1.5.14.tar 2013-02-02 17:14:54 -06:00
Glenn Randers-Pehrson
c2ac10b502 [master] Imported from libpng-1.5.13.tar 2012-09-27 18:59:32 -05:00
Glenn Randers-Pehrson
c86cf4b7e4 [master] Imported from libpng-1.5.12.tar 2012-07-12 13:13:01 -05:00
Glenn Randers-Pehrson
981560ae60 [master] Imported from libpng-1.5.11.tar 2012-06-14 12:53:06 -05:00
Glenn Randers-Pehrson
d5a80e0944 [master] Imported from libpng-1.5.10.tar 2012-03-29 06:35:58 -05:00
Glenn Randers-Pehrson
5a13159bfc [master] Imported from libpng-1.5.10rc01.tar 2012-03-19 18:16:05 -05:00
Glenn Randers-Pehrson
ae1b45a046 [master] Imported from libpng-1.5.10beta04.tar 2012-03-10 07:08:54 -06:00
Glenn Randers-Pehrson
187694b9ec [master] Imported from libpng-1.5.10beta03.tar 2012-03-06 12:26:33 -06:00
Glenn Randers-Pehrson
3484a760f4 [master] Bump version to 1.5.10beta01 2012-02-22 09:06:29 -06:00
Glenn Randers-Pehrson
715423c8d6 Merge branch 'libpng15'
Conflicts:
	ANNOUNCE
	CHANGES
	CMakeLists.txt
	INSTALL
	LICENSE
	Makefile.am
	Makefile.in
	README
	TODO
	aclocal.m4
	config.guess
	config.h.in
	config.sub
	configure
	configure.ac
	contrib/gregbook/COPYING
	contrib/gregbook/Makefile.sgi
	contrib/gregbook/Makefile.unx
	contrib/gregbook/README
	contrib/gregbook/readpng2.c
	contrib/gregbook/rpng-x.c
	contrib/gregbook/rpng2-win.c
	contrib/gregbook/rpng2-x.c
	contrib/pngminim/decoder/README
	contrib/pngminim/decoder/makefile
	contrib/pngminim/decoder/pngusr.h
	contrib/pngminim/encoder/README
	contrib/pngminim/encoder/makefile
	contrib/pngminim/encoder/pngusr.h
	contrib/pngminim/preader/README
	contrib/pngminim/preader/makefile
	contrib/pngminim/preader/pngusr.h
	contrib/pngminus/makefile.std
	contrib/pngsuite/README
	contrib/visupng/PngFile.c
	contrib/visupng/PngFile.h
	contrib/visupng/VisualPng.c
	depcomp
	example.c
	install-sh
	libpng-1.4.9beta01.txt
	libpng-manual.txt
	libpng.3
	libpng.txt
	libpngpf.3
	ltmain.sh
	png.5
	png.c
	png.h
	pngconf.h
	pngerror.c
	pngget.c
	pngmem.c
	pngpread.c
	pngpriv.h
	pngread.c
	pngrio.c
	pngrtran.c
	pngrutil.c
	pngset.c
	pngtest.c
	pngtest.png
	pngtrans.c
	pngwio.c
	pngwrite.c
	pngwtran.c
	pngwutil.c
	projects/visualc6/README.txt
	projects/visualc6/libpng.dsp
	projects/visualc6/pngtest.dsp
	projects/visualc71/README.txt
	projects/visualc71/libpng.sln
	projects/visualc71/libpng.vcproj
	projects/visualc71/pngtest.vcproj
	projects/visualc71/zlib.vcproj
	projects/vstudio/libpng/libpng.vcxproj
	projects/vstudio/pngtest/pngtest.vcxproj
	projects/vstudio/readme.txt
	projects/vstudio/vstudio.sln
	projects/vstudio/zlib.props
	projects/vstudio/zlib/zlib.vcxproj
	scripts/README.txt
	scripts/descrip.mms
	scripts/libpng-config-head.in
	scripts/libpng.pc.in
	scripts/makefile.32sunu
	scripts/makefile.64sunu
	scripts/makefile.aix
	scripts/makefile.amiga
	scripts/makefile.bc32
	scripts/makefile.beos
	scripts/makefile.bor
	scripts/makefile.cegcc
	scripts/makefile.cygwin
	scripts/makefile.darwin
	scripts/makefile.dec
	scripts/makefile.dj2
	scripts/makefile.elf
	scripts/makefile.freebsd
	scripts/makefile.gcc
	scripts/makefile.hp64
	scripts/makefile.hpgcc
	scripts/makefile.hpux
	scripts/makefile.ibmc
	scripts/makefile.intel
	scripts/makefile.knr
	scripts/makefile.linux
	scripts/makefile.mingw
	scripts/makefile.mips
	scripts/makefile.msc
	scripts/makefile.ne12bsd
	scripts/makefile.netbsd
	scripts/makefile.openbsd
	scripts/makefile.os2
	scripts/makefile.sco
	scripts/makefile.sggcc
	scripts/makefile.sgi
	scripts/makefile.so9
	scripts/makefile.solaris
	scripts/makefile.solaris-x86
	scripts/makefile.std
	scripts/makefile.sunos
	scripts/makefile.tc3
	scripts/makefile.vcwin32
	scripts/makefile.watcom
	scripts/makevms.com
	scripts/png32ce.def
	scripts/pngos2.def
2012-02-22 09:01:10 -06:00
Glenn Randers-Pehrson
d57dc304c4 [libpng15] Eliminated redundant png_push_read_tEXt|zTXt|iTXt|unknown code 2012-02-22 08:29:19 -06:00
Glenn Randers-Pehrson
8a2033d77f [libpng15] Eliminated redundant png_push_read_tEXt|zTXt|iTXt|unknown code from
pngpread.c and use the sequential png_handle_tEXt, etc., in pngrutil.c;
now that png_ptr->buffer is inaccessible to applications, the special
handling is no longer useful.

Fixed bug with png_handle_hIST with odd chunk length (Frank Busse).
2012-02-21 14:22:01 -06:00
Glenn Randers-Pehrson
932d7ac5e9 [libpng15]
Always put the CMAKE_LIBRARY in "lib" (removed special WIN32 case).

  Removed empty vstudio/pngstest directory (Clifford Yapp).
2012-02-21 14:19:52 -06:00
Glenn Randers-Pehrson
f9accb9df2 [libpng15] Bump version to 1.5.10beta01 2012-02-18 23:33:18 -06:00
Glenn Randers-Pehrson
7a4e497b62 [libpng15] Imported from libpng-1.5.9.tar 2012-02-18 23:32:59 -06:00
Glenn Randers-Pehrson
0207529f27 [libpng15] Imported from libpng-1.5.9rc01.tar 2012-02-18 23:32:49 -06:00
Glenn Randers-Pehrson
a08f60352c [libpng15] Removed tests for no-longer-used *_EMPTY_PLTE_SUPPORTED
from pngstruct.h
2012-02-11 07:27:34 -06:00
Glenn Randers-Pehrson
0bddb27e75 [libpng15] Removed unused macro definition from pngread.c 2012-02-11 07:26:03 -06:00
Glenn Randers-Pehrson
a67ddd4b9f [libpng15] Removed two unused definitions from scripts/pnglibconf.h.prebuilt 2012-02-06 09:10:06 -06:00
Glenn Randers-Pehrson
a7e9d7bfc2 Merge branch 'libpng15' of ssh://libpng.git.sourceforge.net/gitroot/libpng/libpng into libpng15 2012-02-03 16:01:32 -06:00
Glenn Randers-Pehrson
28c3a2f9f9 [libpng15] Imported from libpng-1.5.9beta01.tar 2012-02-03 15:59:42 -06:00
Glenn Randers-Pehrson
df0773c1b9 [libpng15] Rebuilt configure scripts with automake-1.11.2 2012-02-03 15:56:22 -06:00
Glenn Randers-Pehrson
902dbe619e Merge branch 'libpng15' of ssh://libpng.git.sourceforge.net/gitroot/libpng/libpng into libpng15
Conflicts:
	ANNOUNCE
2012-01-31 23:22:09 -06:00
Glenn Randers-Pehrson
0f59bbb5b6 [libpng15] Imported from libpng-1.5.8.tar 2012-01-31 23:12:47 -06:00
Glenn Randers-Pehrson
9ca5f1bdc8 [libpng15] Added missing date to final CHANGES entry. 2012-01-25 16:31:13 -06:00
Glenn Randers-Pehrson
9f01d0d665 [libpng15] Imported from libpng-1.5.8rc02.tar 2012-01-25 16:11:54 -06:00
Glenn Randers-Pehrson
da544d7d3e [libpng15] Conditionalize install rules for MINGW and CYGWIN in CMakeLists.txt 2012-01-25 16:08:04 -06:00
Glenn Randers-Pehrson
ea8d0b9408 [libpng15] Imported from libpng-1.5.8beta01.tar 2012-01-14 20:59:14 -06:00
Glenn Randers-Pehrson
9287447cef [libpng15] Updated some "last changed" dates 2011-12-21 09:03:30 -06:00
Glenn Randers-Pehrson
d35a3a826e [libpng15] Removed '#include config.h"' from contrib/libtests/pngvalid.c.
It's not needed and causes trouble for VPATH building.
2011-12-16 14:19:39 -06:00
Glenn Randers-Pehrson
e23fedc9de Merge branch 'libpng15' of ssh://libpng.git.sourceforge.net/gitroot/libpng/libpng into libpng15 2011-12-15 09:54:00 -06:00
Glenn Randers-Pehrson
cd3f5bb507 [libpng15] Imported from libpng-1.5.7.tar 2011-12-15 09:50:23 -06:00
Glenn Randers-Pehrson
b0270a9e47 Merge branch 'libpng15' of ssh://libpng.git.sourceforge.net/gitroot/libpng/libpng into libpng15 2011-12-08 08:50:29 -06:00
Glenn Randers-Pehrson
52cbf46f30 [libpng15] Imported from libpng-1.5.7rc03.tar 2011-12-08 08:44:15 -06:00
John Bowler
d61b42c81d [libpng15] Updated CMakeLists.txt to account for the relocation of pngvalid.c 2011-12-07 20:35:48 -06:00
Glenn Randers-Pehrson
8fd9c16642 Merge branch 'libpng15' of ssh://www.simplesystems.org/git/libpng into libpng15
Conflicts:
	ANNOUNCE
	CHANGES
2011-12-04 19:31:52 -06:00
Glenn Randers-Pehrson
e22ea758e4 [libpng15] Imported from libpng-1.5.7rc02.tar 2011-12-04 19:29:29 -06:00
Glenn Randers-Pehrson
f22c0ac2a5 [libpng15] Put CRLF line endings in the owatcom project files. 2011-12-03 20:16:12 -06:00
Glenn Randers-Pehrson
4f547b7177 [libpng15] Fixed incorrect character count in projects/owatcom/pngvalid.tgt 2011-12-02 20:14:21 -06:00
Glenn Randers-Pehrson
c4fe32016c [libpng15] Revised pngconf.h to use " __declspec(restrict)" if MSC_VER >= 1400,
as in libpng-1.5.4.
2011-12-01 21:32:15 -06:00
Glenn Randers-Pehrson
1be5c22e5c [libpng15] Bump version to libpng-1.5.7rc02 2011-12-01 19:27:35 -06:00
Glenn Randers-Pehrson
956c0599e6 [libpng15] Revised project files and contrib/pngvalid/pngvalid.c to account for
the relocation of pngvalid into contrib/libtests.
2011-12-01 19:25:46 -06:00
Glenn Randers-Pehrson
97c8fbb949 Merge branch 'libpng15' of ssh://www.simplesystems.org/git/libpng into libpng15 2011-12-01 09:08:30 -06:00
Glenn Randers-Pehrson
a50ce74850 [libpng15] Imported from libpng-1.5.7rc01.tar 2011-12-01 09:06:22 -06:00
Glenn Randers-Pehrson
8973ee17bb [libpng15] Fixed two other instances of "#if PNG_DO_BC" in png.c 2011-11-28 11:05:54 -06:00
Glenn Randers-Pehrson
2e31b96a5a [libpng15] Revised #if PNG_DO_BC block in png.c (use #ifdef and add #else) 2011-11-28 10:51:29 -06:00
Glenn Randers-Pehrson
0222124801 [libpng15] Replaced an "#if" with "ifdef" in pngrtran.c 2011-11-28 10:31:42 -06:00
Glenn Randers-Pehrson
61b23d59b1 [libpng15] Bump version to libpng-1.5.7beta06 2011-11-25 07:02:48 -06:00
Glenn Randers-Pehrson
cc1fa5df3a [libpng15] Imported from libpng-1.5.7beta05.tar 2011-11-25 06:56:01 -06:00
Glenn Randers-Pehrson
cc5664ddad [libpng15] Updated release number in png.h 2011-11-24 14:36:49 -06:00
Glenn Randers-Pehrson
e209df47c4 Relocate pngvalid.c to contrib/libtests 2011-11-24 12:24:45 -06:00
John Bowler
585f8b49b5 [libpng15] Removed some leftover "simple interface" files 2011-11-23 15:45:11 -06:00
John Bowler
4491fa237f [libpng15] Remove simplified interface 2011-11-23 15:41:29 -06:00
Glenn Randers-Pehrson
59d3ef11ed [libpng14] Fixed typo in Makefile.am ("-M Wl" should be "-M -Wl")." 2011-10-05 17:06:15 -05:00
Glenn Randers-Pehrson
6bc7fc80da [master] Added SunOS support to configure.ac and Makefile.am
but configure and Makefile.in were not updated.
2011-09-01 20:01:51 -05:00
Glenn Randers-Pehrson
5b03469a93 [master] Minor editing of libpng.3 and libpng-*.txt 2011-07-13 09:37:01 -05:00
Glenn Randers-Pehrson
f5b9abde98 [master] Reverted non-portable GNU syntax in makefile (?=, +=) 2011-07-12 06:22:29 -05:00
Glenn Randers-Pehrson
340c9b237b [master] Updated contrib/pngminus/makefile.std 2011-07-11 17:36:18 -05:00
Glenn Randers-Pehrson
fb2bd00859 [master] Bump version to libpng-1.4.9beta01 2011-07-08 13:13:00 -05:00
Glenn Randers-Pehrson
5109688803 [master] Added vstudio/* and CMakeLists to EXTRA_DIST in Makefile.in
and Makefile.am
2011-07-08 13:09:41 -05:00
Glenn Randers-Pehrson
8fdd2fcef6 [master] Changed some incorrect "last changed" dates. 2011-07-07 12:46:23 -05:00
Glenn Randers-Pehrson
e7625063dc [master] Imported from libpng-1.4.8.tar 2011-07-07 06:41:17 -05:00
Glenn Randers-Pehrson
24f40e321c [master] Imported from libpng-1.4.8rc01.tar 2011-06-30 19:58:41 -05:00
Glenn Randers-Pehrson
0bb898a885 [master] Imported from libpng-1.4.8beta05.tar 2011-06-19 07:22:01 -05:00
Glenn Randers-Pehrson
61a2d8a2a7 [master] Check for sCAL chunk too short. 2011-06-18 14:51:09 -05:00
John Bowler
af96543688 [devel] Removed double increment of pointers in the accurate scaling. 2011-06-18 13:25:46 -05:00
Glenn Randers-Pehrson
34f5449736 [master] Imported from libpng-1.4.8beta05.tar 2011-06-18 00:39:53 -05:00
John Bowler
484a48e221 [master] Fixed error in "ACCURATE" 16-to-8 scaling. 2011-06-17 21:36:09 -05:00
Glenn Randers-Pehrson
cc5226bf2a [master] Imported from libpng-1.4.8beta05.tar 2011-06-07 19:53:23 -05:00
Glenn Randers-Pehrson
8fbb563f4e [master] Imported from libpng-1.4.8beta04.tar 2011-06-07 14:59:33 -05:00
Glenn Randers-Pehrson
65e6d5a34f [master] Fixed 1-byte uninitialized memory reference in png_format_buffer()
(Bug report by Frank Busse, related to CVE-2004-0421).
2011-06-07 14:58:07 -05:00
Glenn Randers-Pehrson
47be2e7c3a [master] Imported from libpng-1.4.8beta04.tar 2011-06-06 00:02:11 -05:00
Glenn Randers-Pehrson
4d694dadd8 [master] Issue warning instead of error for out of range coefficients
for rgb_to_gray transform
2011-06-05 23:44:05 -05:00
Glenn Randers-Pehrson
59397f985e [master] Imported from libpng-1.4.8beta03.tar 2011-06-05 23:27:22 -05:00
Glenn Randers-Pehrson
cc1d4d0dbc [master] Check for integer overflow in png_set_rgb_to_gray(). 2011-06-05 23:26:14 -05:00
Glenn Randers-Pehrson
070434c045 [master] Imported from libpng-1.4.8beta02.tar 2011-06-05 17:21:29 -05:00
Glenn Randers-Pehrson
0dc882d7c3 [master] Ported bugfix in pngrtran.c from 1.5.3: Ensure coefficients are OK for
png_rgb_to_gray_fixed().
2011-06-05 17:19:17 -05:00
Glenn Randers-Pehrson
c3ac9a507a [master] Bump to version bumpify-1.4.8rc01 2011-06-03 21:36:28 -05:00
Glenn Randers-Pehrson
a6afebc718 [master] Imported from libpng-1.4.8beta01.tar 2011-06-03 21:21:15 -05:00
Glenn Randers-Pehrson
d41915dc2a [master] Port change to pngrtran.c from 1.5.3: when expanding a paletted image,
always expand to RGBA if transparency is present.
2011-06-03 21:17:49 -05:00
Glenn Randers-Pehrson
5a5ad7a5fa [master] Check for up->location !PNG_AFTER_IDAT when writing unknown chunks
before IDAT.
2011-06-03 21:16:45 -05:00
Glenn Randers-Pehrson
9dad5e37ae [master] Pass "" instead of '\0' to png_default_error() in png_err().
This mistake was introduced in libpng-1.2.20beta01.
2011-06-03 21:14:55 -05:00
Glenn Randers-Pehrson
adde7b5c1e [master] Fix typo in pngwutil.c comment 2011-05-23 06:29:49 -05:00
Glenn Randers-Pehrson
3bdde42e40 [master] Copied png_debug macros from pngpriv.h into pngtest.c and removed
"#include pngpriv.h" from pngtest.c, to avoid setting a bad example.
2011-05-02 14:11:10 -05:00
Glenn Randers-Pehrson
6b4dee12f5 [master] Hard-coded the name of libpng-version.txt in Makefile.am, .in 2011-05-02 12:38:48 -05:00
Glenn Randers-Pehrson
355b90387b [master] Undef "_ALL_SOURCE" for AIX, to prevent "jmpbuf" from being redefined. 2011-05-02 12:29:20 -05:00
Glenn Randers-Pehrson
f512ca7625 [master] Bump to version 1.4.8beta01 2011-05-02 12:23:29 -05:00
Glenn Randers-Pehrson
16ee3e9870 [master] Imported from libpng-1.4.7.tar 2011-04-10 06:44:29 -05:00
Glenn Randers-Pehrson
c8444775b1 [devel] Disabled PNG_PEDANTIC_WARNINGS for all MSC versions as in libpng-1.4.5. 2011-04-10 06:43:27 -05:00
Glenn Randers-Pehrson
784d80b509 [master] Imported from libpng-1.4.7rc01.tar 2011-04-08 20:54:20 -05:00
Glenn Randers-Pehrson
98aacb16c3 [master] Relocated new misplaced declarations in pngwutil.c 2011-04-08 20:41:48 -05:00
Glenn Randers-Pehrson
8a35e25852 [master] Imported from libpng-1.4.6.tar 2011-04-08 12:03:08 -05:00
Glenn Randers-Pehrson
97eb073189 [master] Imported from libpng-1.4.6rc02.tar 2011-04-06 07:09:52 -05:00
Glenn Randers-Pehrson
28534bd47a [master] Improved the optimization of the zlib CMF byte
(see libpng-1.2.6beta03).
2011-04-06 07:07:42 -05:00
Glenn Randers-Pehrson
2053a26873 [master] Updated vstudio/zlib.props to zlib-1.2.5 2011-04-04 15:41:32 -05:00
Glenn Randers-Pehrson
736a230890 [master] Bump to version 1.4.6rc02 2011-04-03 11:36:05 -05:00
Glenn Randers-Pehrson
3926448598 [devel] Fixed a typo in the manual about dithering 2011-04-03 11:34:40 -05:00
Glenn Randers-Pehrson
11130874d4 [master] Imported from libpng-1.4.6rc01.tar 2011-03-31 13:46:06 -05:00
Glenn Randers-Pehrson
ef5a57119a [master] Imported from libpng-1.4.6beta07.tar 2011-03-22 06:31:58 -05:00
Glenn Randers-Pehrson
31f4e52842 [master] Fixed a bug (present since libpng-1.0.7) that makes png_handle_sPLT()
fail to compile when PNG_NO_POINTER_INDEXING is defined.
2011-03-21 18:20:24 -05:00
Glenn Randers-Pehrson
0e1aad158a [master] Removed "strip" from contrib/pngminim/*/makefile. 2011-03-19 22:37:30 -05:00
Glenn Randers-Pehrson
5f5d6d637b [master] Fixed incorrect examples of callback prototypes in the manual,
that were introduced in libpng-1.0.0.
2011-03-19 09:30:41 -05:00
Glenn Randers-Pehrson
a2336bcf05 [master] Bump to version 1.4.6beta07 2011-03-19 09:11:21 -05:00
Glenn Randers-Pehrson
20e6003290 [master] Added a request in the manual that applications do not use "png_" or
"PNG_" to begin any of their own symbols.
Fixed mistake in the descriptions of user read_transform and write_transform
function prototypes in the manual.  The row_info struct is png_row_infop.
2011-03-19 09:08:45 -05:00
Glenn Randers-Pehrson
54c633b810 [master] Added -D_CRT_SECURE_NO_DEPRECATE to CFLAGS in makefile.vcwin32 2011-03-19 08:58:33 -05:00
Glenn Randers-Pehrson
f0c2cc32b1 [master] Added attribute definition (warnings) for MSC_VER >= 1300 in pngconf.h 2011-03-19 08:48:07 -05:00
Glenn Randers-Pehrson
8709982e22 [master] Bump to version 1.4.6beta06 2011-03-18 22:25:49 -05:00
Glenn Randers-Pehrson
686d45dcfd [master] Imported from libpng-1.4.6beta06.tar 2011-03-18 22:22:18 -05:00
Glenn Randers-Pehrson
8502e1ff25 [master] Moved the definition of the new PNG_USED macro into pngconf.h
It really belongs in pngpriv.h and will be moved there in libpng-1.5.x
2011-03-14 12:49:20 -05:00
Glenn Randers-Pehrson
603c9fd959 [master] Added the private PNG_UNUSED() macro definition in pngpriv.h. 2011-03-08 11:33:28 -06:00
Glenn Randers-Pehrson
86946fdc03 [master] Updated contrib/pngsuite/README to add the word "modify". 2011-03-08 11:28:35 -06:00
Glenn Randers-Pehrson
af4c99b21a [master] Bump to version 1.4.6beta06 2011-01-22 21:49:52 -06:00
Glenn Randers-Pehrson
97d2d68428 [master] Imported from libpng-1.4.6beta05.tar 2011-01-22 21:22:48 -06:00
Glenn Randers-Pehrson
ce5d7cb7aa [master] Updated the synopses in the manual to reflect recent changes.
Fixed a typo in the *.def files and deleted entries that are now
declared in pngpriv.h
2011-01-22 21:10:03 -06:00
Glenn Randers-Pehrson
c4ff4e7167 [master] Imported from libpng-1.4.6beta04.tar 2011-01-21 22:20:15 -06:00
Glenn Randers-Pehrson
b94d24eb25 [master] Changed argument of png_get_io_ptr() back to png_struct
because we promised not to change its signature, so it can be used
safely in configure scripts to detect libpng.
2011-01-21 22:17:18 -06:00
Glenn Randers-Pehrson
379d0160ea [master] Added const_png_structp and const_png_infop types, and used them in
prototypes for most png_get_*() functions.
In the manual, describe the png_get_IHDR() arguments in the correct order.
2011-01-21 11:09:07 -06:00
Glenn Randers-Pehrson
23c2ea38a6 [master] Bump to version 1.4.6beta04 2011-01-15 12:05:31 -06:00
Glenn Randers-Pehrson
d486eb18c5 [master] Updated documentation of png_set|get_tRNS() and png_set|get_iCCP(). 2011-01-15 11:15:38 -06:00
Glenn Randers-Pehrson
a10d488a32 [master] Imported from libpng-1.4.6beta03.tar 2011-01-14 21:04:40 -06:00
Glenn Randers-Pehrson
25d754e86d [master] Bump to version 1.4.6beta02 2011-01-14 20:26:03 -06:00
Glenn Randers-Pehrson
bba85637d7 [master] Imported from libpng-1.4.6beta02.tar 2011-01-14 17:26:54 -06:00
Glenn Randers-Pehrson
94c3a45f4c [master] Updated CMakeLists.txt (Clifford Yapp) 2011-01-14 17:25:06 -06:00
Glenn Randers-Pehrson
221be3def1 [master] Fixed misspelled macros in contrib/pngminim (Cosmin) 2010-12-31 09:05:59 -06:00
Glenn Randers-Pehrson
1daf8980dd [master] Bump to version 1.4.6beta02 2010-12-31 09:04:02 -06:00
Glenn Randers-Pehrson
5945408a93 [master] Imported from libpng-1.4.6beta01.tar 2010-12-31 08:06:37 -06:00
Glenn Randers-Pehrson
9a8c568e3c [master] Fixed bug in background transformation handling in pngrtran.c
(it was looking for the flag in png_ptr->transformations instead of in
png_ptr->flags).
2010-12-28 21:45:08 -06:00
Glenn Randers-Pehrson
fb05477e11 [master] Bump version to 1.4.6beta01 2010-12-27 09:04:59 -06:00
Glenn Randers-Pehrson
df68ef4d5e [master] Imported from libpng-1.4.5.tar 2010-12-09 07:49:40 -06:00
Glenn Randers-Pehrson
d857ed275e [master] Reverted removal of PNG_NO_WRITE_gAMA 2010-12-09 07:42:25 -06:00
Glenn Randers-Pehrson
14181b7f48 [master] Removed PNG_NO_WRITE_gAMA from pngminim/encoder/pngusr.h, again. 2010-12-09 07:27:49 -06:00
Glenn Randers-Pehrson
6916ec5fa9 [master] Bump to version 1.4.5rc04 2010-12-09 07:12:52 -06:00
Glenn Randers-Pehrson
acb4822f6b [master] Removed PNG_NO_WRITE_GAMMA from pngminim/encoder/pngusr.h
and some cosmetic changes to some source files.
2010-12-09 06:43:24 -06:00
Glenn Randers-Pehrson
79fb836d66 [master] Imported from libpng-1.4.5rc03.tar 2010-12-03 10:02:23 -06:00
Glenn Randers-Pehrson
010110a0be [master] Imported from libpng-1.4.5rc02.tar 2010-12-02 07:05:34 -06:00
Glenn Randers-Pehrson
756f873a25 [master] Added comment about the potential API incompatibility in
png.h, libpng.3, and libpng-*.txt.
2010-11-25 07:38:30 -06:00
Glenn Randers-Pehrson
e2d740ae04 [master] Reverted png_get_uint_16 macro to beta05 and added a
comment about the potential API incompatibility.
2010-11-24 15:08:39 -06:00
Glenn Randers-Pehrson
ff244b6181 [master] Bump to version 1.4.5beta07 2010-11-24 15:04:15 -06:00
Glenn Randers-Pehrson
d3494d172c [master] Imported from libpng-1.4.5beta06.tar 2010-11-21 15:05:12 -06:00
Glenn Randers-Pehrson
2922c07e67 [master] Changes to remove gcc warnings (John Bowler) 2010-11-21 14:02:16 -06:00
Glenn Randers-Pehrson
c03a949a0d [master] Make the "png_get_uint_16" macro return a png_uint_32 in libpng-1.4
for API compatibility.
2010-11-21 13:31:52 -06:00
Glenn Randers-Pehrson
377e3ca5e6 [master] Added a comment about the parentheses in pngrutil.c 2010-11-20 22:56:49 -06:00
Glenn Randers-Pehrson
f320728911 [master] Restored the parentheses in pngrutil.c; they are needed when the
png_get_*int_*() functions are compiled (i.e., when PNG_USE_READ_MACROS
is not defined).
2010-11-20 21:41:51 -06:00
Glenn Randers-Pehrson
b4a5d88e0a [master] Updated png_get_uint_32 like the others (i -> val). 2010-11-20 18:01:52 -06:00
Glenn Randers-Pehrson
7ea0b3b9e2 [master] Bump to version 1.4.5rc02 2010-11-20 18:01:01 -06:00
Glenn Randers-Pehrson
aa3725c860 [master] Fixed spelling in ANNOUNCE and CHANGES 2010-11-20 17:38:14 -06:00
Glenn Randers-Pehrson
8aa84c7fce [master] Imported from libpng-1.4.5beta05.tar 2010-11-20 17:15:36 -06:00
Glenn Randers-Pehrson
453ceae85f [master] Fixed atomicity of chunk header serialization (Cosmin)
and added test for io_state in pngtest.c (Cosmin)
2010-11-20 16:13:12 -06:00
Glenn Randers-Pehrson
1f5a0b9fa6 [master] Moved reading of file signature into png_read_sig (Cosmin) 2010-11-20 15:50:51 -06:00
Glenn Randers-Pehrson
820a8d1de9 [master] Changed prototypes for png_git_int_16() and png_get_int_32(). 2010-11-20 15:07:51 -06:00
Glenn Randers-Pehrson
6bb02b28a1 [master] Revised png_get_int_32 and png_get_int_16 functions. 2010-11-20 15:00:35 -06:00
Glenn Randers-Pehrson
60ba227d57 [master] Removed some extraneous parentheses that appeared in pngrutil.c of
libpng-1.4.3bet01
2010-11-20 14:47:36 -06:00
Glenn Randers-Pehrson
175e21f5e1 [master] Imported from libpng-1.4.5rc01.tar 2010-11-18 22:11:18 -06:00
Glenn Randers-Pehrson
97db6709e4 [master] Imported from libpng-1.4.5beta04.tar 2010-11-08 12:44:03 -06:00
Glenn Randers-Pehrson
c0fc0dfc45 [master] Check for out-of-range text compression mode in png_set_text(). 2010-10-13 07:34:30 -05:00
Glenn Randers-Pehrson
f3eadd1737 [master] Bump to version 1.4.5beta04 2010-10-13 07:13:45 -05:00
Glenn Randers-Pehrson
c4ec48281c [master] Imported from libpng-1.4.5beta03.tar 2010-10-07 20:52:27 -05:00
Glenn Randers-Pehrson
1a006390d9 [master] Wrapped long lines in CMakeLists.txt
and introduced ${libpng_public_hdrs}
2010-10-05 08:36:49 -05:00
Glenn Randers-Pehrson
953f265513 [master] Bump to version 1.4.5beta03 2010-10-04 23:16:06 -05:00
Glenn Randers-Pehrson
468877578a [master] Imported from libpng-1.4.5beta02.tar 2010-10-04 23:15:57 -05:00
Glenn Randers-Pehrson
ff14eeb4f2 [master] Revised CHANGES about the last bugfix. 2010-10-04 22:18:50 -05:00
Glenn Randers-Pehrson
5f3eabf4cd [master] Fixed problem with symbols creation in Makefile.ac (Martin Banky). 2010-10-04 21:51:57 -05:00
Glenn Randers-Pehrson
bbc70d2471 [master] Reverted configure scripts to autoconf-2.65 2010-10-04 17:00:31 -05:00
Glenn Randers-Pehrson
a0cafa3d0b [master] Bump to version 1.4.5beta02 2010-09-25 06:38:06 -05:00
Glenn Randers-Pehrson
58219ca22f [master] Imported from libpng-1.4.5beta01.tar 2010-09-25 06:35:14 -05:00
Glenn Randers-Pehrson
50b28f3bf2 [master] Rebuilt configure scripts with autoconf-2.68 instead of autoconf-2.65 2010-09-24 15:22:09 -05:00
Glenn Randers-Pehrson
0f8345abf7 [master] Bump to version 1.4.5beta01 2010-09-24 10:22:16 -05:00
Glenn Randers-Pehrson
4f213e08aa [master] Fixed configure.ac bug introduced in version 1.4.4rc05. 2010-09-24 09:51:01 -05:00
Glenn Randers-Pehrson
8493de3cee [master] Imported from libpng-1.4.4.tar 2010-09-23 07:22:01 -05:00
Glenn Randers-Pehrson
fee6e7428f [master] Imported from libpng-1.4.4rc05.tar 2010-09-20 10:21:28 -05:00
Glenn Randers-Pehrson
d10616d364 [master] Imported from libpng-1.4.4rc04.tar 2010-09-16 09:51:06 -05:00
Glenn Randers-Pehrson
85d143a273 [master] Revised autogen.sh to recognize and use $AUTOCONF, $AUTOMAKE,
$AUTOHEADER, $AUTOPOINT, $ACLOCAL and $LIBTOOLIZE
2010-09-15 06:44:47 -05:00
Glenn Randers-Pehrson
6e72bc46d3 [master] Fixed indentation and removed debugging message from CMakeLists.txt 2010-09-15 06:43:23 -05:00
Glenn Randers-Pehrson
b8eed1d830 [master] Imported from libpng-1.4.4rc03.tar 2010-09-13 20:58:20 -05:00
Glenn Randers-Pehrson
a64ecdfa5b [master] Eliminated another deprecated reference to png_ptr->io_ptr
in pngtest.c
2010-09-13 10:19:20 -05:00
Glenn Randers-Pehrson
bcfc0ce5f6 [master] Removed an extraneous close-double-quote from CMakeLists.txt 2010-09-13 09:57:13 -05:00
Glenn Randers-Pehrson
8bc0719dde [master] Imported from libpng-1.4.4rc02.tar 2010-09-13 08:14:27 -05:00
Glenn Randers-Pehrson
185cd6c058 [master] Revised CMakeLists.txt (Philip Lowman). 2010-09-13 08:13:09 -05:00
Glenn Randers-Pehrson
afb77541b4 [master] Bump to version 1.4.4rc02 2010-09-13 08:11:54 -05:00
Glenn Randers-Pehrson
c4a5c2de26 [master] Imported from libpng-1.4.4rc01.tar 2010-09-10 08:50:36 -05:00
Glenn Randers-Pehrson
87bc4b08ff [master] Imported from libpng-1.4.4beta08.tar 2010-09-02 06:54:37 -05:00
Glenn Randers-Pehrson
65cdb3dfa8 [master] Updated the xcode project to work with libpng-1.4.x and added iOS
targets for simulator and device (Philippe Hausler).
2010-09-02 06:41:40 -05:00
Glenn Randers-Pehrson
cc411ae004 [master] Bump to version 1.4.4beta08 2010-08-26 08:50:32 -05:00
Glenn Randers-Pehrson
f521b99b09 [master] Imported from libpng-1.4.4beta07.tar 2010-08-26 08:46:53 -05:00
Glenn Randers-Pehrson
b08f330d62 [master] Eliminated new unnecessary #if tests regarding the sCAL chunk
from pngrutil.c
2010-08-24 12:38:36 -05:00
Glenn Randers-Pehrson
41ffb1c950 [master] Eliminated a deprecated reference to png_ptr->io_ptr in pngtest.c 2010-08-23 16:54:35 -05:00
Glenn Randers-Pehrson
ebe3ea3204 [master] Restored the documentation of PNG_USER_PRIVATEBUILD in pngconf.h 2010-08-23 06:46:18 -05:00
Glenn Randers-Pehrson
d94c4516c6 [master] Corrected handling and documentation of PNG_USER_PRIVATEBUILD flag. 2010-08-22 12:36:25 -05:00
Glenn Randers-Pehrson
b0f8d9bb97 [master] Changed PNG_LIB_NAME from pngNN to libpngNN in CMakeLists.txt
(Philip Lowman)
2010-08-21 18:55:08 -05:00
Glenn Randers-Pehrson
04dfe7b3f6 [master] Revised CMakeLists.txt to make symlinks instead of copies
when installing.
2010-08-21 18:49:50 -05:00
Glenn Randers-Pehrson
547afcfc74 [master] Revised CMakeLists.txt to put the man pages in share/man/man*
not in man/man*
2010-08-21 18:36:29 -05:00
Glenn Randers-Pehrson
48afdb4eef [master] Update CMakelists.txt to use CMAKE_INSTALL_LIBDIR variable;
useful for installing libpng in /usr/lib64 (FundaWang).
2010-08-21 18:29:47 -05:00
Glenn Randers-Pehrson
9ee96e3ba9 [master] Updated prebuilt aclocal.m4 and ltmain.sh 2010-08-17 13:36:20 -05:00
Glenn Randers-Pehrson
0311f5412e [master] Add .dll.a to symlinks installed by Makefile.am (Yaakov) 2010-08-13 08:14:13 -05:00
Glenn Randers-Pehrson
e734eba51e [master] Bump to version 1.4.4beta07 2010-08-13 07:56:59 -05:00
Glenn Randers-Pehrson
7ed40716cb [master] Imported from libpng-1.4.4beta06.tar 2010-08-11 09:10:35 -05:00
Glenn Randers-Pehrson
155889b318 [master] Revised contrib/gregbook to work under cygwin/mingw. 2010-08-11 06:50:11 -05:00
Glenn Randers-Pehrson
4dd011f6d0 [master] Don't try to use version-script with cygwin/mingw. 2010-08-11 06:48:37 -05:00
Glenn Randers-Pehrson
e45a5d3a32 [master] Bump to version 1.4.4beta06 2010-08-06 06:43:59 -05:00
Glenn Randers-Pehrson
80a1050237 [master] Bump to version 1.4.4beta05 2010-08-06 06:40:31 -05:00
Glenn Randers-Pehrson
54592bba4d [master] Don't depend only _WINDOWS_ in pngconf.h to detect Windows 2010-08-06 06:36:56 -05:00
Glenn Randers-Pehrson
902d4d109a [master] Correct use of _WINDOWS_ in pngconf.h 2010-08-03 21:10:04 -05:00
Glenn Randers-Pehrson
d8daacf157 [master] Removed unused png_mem_* defines from pngconf.h. 2010-08-03 20:47:46 -05:00
Glenn Randers-Pehrson
0da5bcb414 [master] Imported from libpng-1.4.4beta05.tar 2010-08-03 20:46:46 -05:00
Glenn Randers-Pehrson
ac6555fa3c [master] Updated projects/visualc71 so it can find scripts/pnglibconf.h 2010-08-03 08:53:13 -05:00
Glenn Randers-Pehrson
2af7ef63c3 [master] Updated the read macros and functions from 1.5.0beta38. 2010-07-31 16:37:38 -05:00
Glenn Randers-Pehrson
6da5b35fca [master] Bump to version 1.4.4beta04 2010-07-24 18:20:21 -05:00
Glenn Randers-Pehrson
abd68eb92b [master] Imported from libpng-1.4.4beta03.tar 2010-07-24 18:16:54 -05:00
Glenn Randers-Pehrson
bf451ffc9a [master] Eliminated the new special case typedef of png_longjmp_ptr for WATCOM
and made a special case "#define PNGAPI" in pngconf.h instead.
2010-07-24 18:13:55 -05:00
Glenn Randers-Pehrson
be734f5592 [master] Removed reference to cbuilder5/* from Makefile.in and Makefile.am 2010-07-24 15:31:38 -05:00
Glenn Randers-Pehrson
9f0c080847 [master] Bump to version 1.4.4beta03 2010-07-24 08:34:34 -05:00
Glenn Randers-Pehrson
3a1ba773b0 [master] Imported from libpng-1.4.4beta02.tar 2010-07-24 08:30:30 -05:00
Glenn Randers-Pehrson
849a1ab845 [master] Added a special case typedef of png_longjmp_ptr for WATCOM. 2010-07-24 08:02:03 -05:00
Glenn Randers-Pehrson
940de5ab02 [master] Moved the definition of png_snprintf()
outside of the enclosing #ifdef blocks in pngconf.h
2010-07-24 07:56:36 -05:00
Glenn Randers-Pehrson
dd9578f379 [master] Update copyright year in documentation 2010-07-22 07:55:00 -05:00
Glenn Randers-Pehrson
0ce807691b [master] Added -DNO_PNG_SNPRINTF to CFLAGS in scripts/makefile.dj2 2010-07-16 21:17:50 -05:00
Glenn Randers-Pehrson
4f8ea5eede [master] Bump to version 1.4.4beta02 2010-07-12 06:41:34 -05:00
Glenn Randers-Pehrson
7869e676af [master] Imported from libpng-1.4.4beta01.tar 2010-07-12 06:37:08 -05:00
Glenn Randers-Pehrson
af0a726689 [master] Changed "extern PNG_EXPORT" to "PNG_EXPORT" in png.h (Jan Nijtmans)
Changed "extern" to "PNG_EXTERN" in pngpriv.h (except for the 'extern "C" {')
Put #ifndef PNG_EXTERN, #endif around the define PNG_EXTERN in pngpriv.h
2010-07-12 06:22:55 -05:00
Glenn Randers-Pehrson
8d9263fca6 [master] Added some "(" that were missing in README and scripts/README.txt 2010-06-30 23:11:34 -05:00
Glenn Randers-Pehrson
d6a0cbaade [master] Removed some newly-added TAB characters from pngpread.c
and pngrtran.c, and fixed some indentation in pngpread.c and pngrutil.c
2010-06-30 23:07:02 -05:00
Glenn Randers-Pehrson
2302a4d04f [master] Revised the "SEE ALSO" style of libpng.3, libpngpf.3, and png.5 2010-06-27 13:53:25 -05:00
Glenn Randers-Pehrson
8f9a2d08ea [master] Bump version to libpng-1.4.4beta01 2010-06-25 22:18:15 -05:00
Glenn Randers-Pehrson
30c73195b5 [master] Tag the recent releases 2010-06-25 20:44:31 -05:00
Glenn Randers-Pehrson
097485195c [master] Imported from libpng-1.4.3.tar 2010-06-25 20:22:08 -05:00
Glenn Randers-Pehrson
c5f6fa110a [master] Imported from libpng-1.4.3rc03.tar 2010-06-25 20:20:16 -05:00
Glenn Randers-Pehrson
90cfcecc09 [master] Imported from libpng-1.4.3rc02.tar 2010-06-25 20:20:14 -05:00
Glenn Randers-Pehrson
dee0e2ed0f [master] Imported from libpng-1.4.3rc01.tar 2010-06-25 20:20:12 -05:00
Glenn Randers-Pehrson
5ad9884ff1 [master] Imported from libpng-1.4.3beta05.tar 2010-06-25 20:20:09 -05:00
Glenn Randers-Pehrson
188eb6b426 [master] Imported from libpng-1.4.3beta04.tar 2010-06-25 20:20:07 -05:00
Glenn Randers-Pehrson
8361f64dbf [master] Imported from libpng-1.4.3beta02.tar 2010-06-25 20:20:04 -05:00
Glenn Randers-Pehrson
2a6227941e [master] Imported from libpng-1.4.3beta01.tar 2010-06-25 20:20:02 -05:00
Glenn Randers-Pehrson
a582b8f840 [master] Imported from libpng-1.4.3.tar 2010-06-25 20:19:59 -05:00
Glenn Randers-Pehrson
5316f66005 [master] The "vstudio" project was missing from the .zip and .7z distributions 2010-05-17 08:31:53 -05:00
Glenn Randers-Pehrson
f86905457a [master] Added missing quotation marks in the aix block of configure.ac 2010-05-14 15:40:31 -05:00
Glenn Randers-Pehrson
abb211c4e8 [master] Bump to version 1.4.3beta01 2010-05-14 15:38:51 -05:00
Glenn Randers-Pehrson
bb56c39d16 [master] Imported from libpng-1.4.2.tar 2010-05-06 06:48:47 -05:00
Glenn Randers-Pehrson
77237196c7 [master] Imported from libpng-1.4.2rc06.tar 2010-05-04 09:34:13 -05:00
Glenn Randers-Pehrson
a310a3b398 [master] Moved declarations of umsg[] inside the proper #ifdef blocks
in pngrutil.c
2010-05-04 09:32:02 -05:00
Glenn Randers-Pehrson
e0f6c7d90b [master] Revert to version 1.4.2rc05 2010-05-04 09:24:32 -05:00
Glenn Randers-Pehrson
a1587302aa [master] Use bitwise AND instead of integer arithmetic MOD in pngrutil.c
calculation  of the png_ptr->rowbuf pointer into png_ptr->big_row_buf.
2010-05-03 21:57:13 -05:00
Glenn Randers-Pehrson
cc0bff446b [master] Changed a typecast in pngrutil.c to stifle compiler warning
in the calculation of the png_ptr->rowbuf pointer into png_ptr->big_row_buf.
2010-05-03 21:28:50 -05:00
Glenn Randers-Pehrson
9b8ddff5b7 [master] Added a typecast in pngrutil.c to stifle compiler warning
in the calculation of the png_ptr->rowbuf pointer into png_ptr->big_row_buf.
2010-05-03 15:19:11 -05:00
Glenn Randers-Pehrson
ac4942e26b [master] Moved declarations of umsg[] inside proper #ifdef blocks in pngrutil.c 2010-05-03 15:18:09 -05:00
Glenn Randers-Pehrson
2c55e3e917 [master] Bump to version 1.4.2rc06 2010-04-29 11:47:15 -05:00
Glenn Randers-Pehrson
db082802c6 [master] Bump to version 1.4.2rc05 2010-04-29 11:44:55 -05:00
Glenn Randers-Pehrson
b367fb5ac6 [master] Bump to version 1.4.2rc06 2010-04-29 11:20:42 -05:00
Glenn Randers-Pehrson
e9ab2f8d94 [master] Imported from libpng-1.4.2rc05.tar 2010-04-29 11:08:01 -05:00
Glenn Randers-Pehrson
a845cca037 [master] Corrected protection of png_get_user_transform_ptr.
The API declaration in
png.h is removed if both READ and WRITE USER_TRANSFORM are turned off
but was left defined in pngtrans.c
2010-04-29 10:43:23 -05:00
Glenn Randers-Pehrson
3ab6ef0aa1 [master] Corrected PNG_UNKNOWN_CHUNKS_SUPPORTED in gregbook/readpng2.c
to PNG_HANDLE_AS_UNKNOWN_SUPPORTED
2010-04-29 10:34:18 -05:00
Glenn Randers-Pehrson
198ed18b9e [master] Bump to version 1.4.2rc05 2010-04-29 09:41:01 -05:00
Glenn Randers-Pehrson
9110473f93 [master] Removed dummy_inflate.c and uncompr.c from contrib/pngminim/encoder 2010-04-29 09:38:05 -05:00
Glenn Randers-Pehrson
97313e0aab [master] Include png_reset_zstream() in png.c only when PNG_READ_SUPPORTED
is defined.
2010-04-29 09:22:01 -05:00
Glenn Randers-Pehrson
8876e74e43 [master] Remove mislocated files from projects/visualc6 2010-04-26 23:02:39 -05:00
Glenn Randers-Pehrson
510227e39e [master] Imported from libpng-1.4.2rc04.tar 2010-04-26 22:51:30 -05:00
Glenn Randers-Pehrson
7a1f214166 [master] Set PNG_NO_READ_BGR, PNG_NO_IO_STATE, and PNG_NO_TIME_RFC1123 in
contrib/pngminim/decoder/pngusr.h to make a smaller decoder application.
2010-04-26 22:41:53 -05:00
Glenn Randers-Pehrson
5913dd10f1 [master] Added the "vstudio" project to replace "visualc6" and "visualc71"
which will be removed from libpng-1.5.0.
2010-04-26 16:28:35 -05:00
Glenn Randers-Pehrson
087ebd80da [master] Imported from libpng-1.4.2rc03.tar 2010-04-24 13:58:16 -05:00
Glenn Randers-Pehrson
bc9267e3a6 [master] Move png_set_quantize and png_do_quantize to proper locations in docs. 2010-04-16 10:41:02 -05:00
Glenn Randers-Pehrson
a019c335c9 [master] Bump to version 1.4.2rc03 2010-04-16 10:25:20 -05:00
Glenn Randers-Pehrson
ed49c8c1b6 [master] Trivial revision of documentation. 2010-04-16 10:04:53 -05:00
Glenn Randers-Pehrson
2a243fc074 [master] Added some "(long)" typecasts to printf calls in png_handle_cHRM(). 2010-04-16 09:41:27 -05:00
Glenn Randers-Pehrson
47045ce402 [master] Bump to version 1.4.2rc02 2010-04-16 07:45:21 -05:00
Glenn Randers-Pehrson
d6e67586bf [master] Imported from libpng-1.4.2rc02.tar 2010-04-16 07:28:21 -05:00
Glenn Randers-Pehrson
6e9783bd25 [master] Updated the scripts/*.def lists to include png_set_quantize() 2010-04-16 07:26:01 -05:00
Glenn Randers-Pehrson
8dc3729522 [master] Reenabled png_set_dither() but renamed it to png_set_quantize() to
reflect more accurately what it actually does.  At the same time, renamed
the PNG_DITHER_[RED,GREEN_BLUE]_BITS macros to
PNG_QUANTIZE_[RED,GREEN,BLUE]_BITS.
2010-04-16 07:24:52 -05:00
Glenn Randers-Pehrson
7aad4e7fb4 [master] Expanded CHANGES entry about disabling dithering support. 2010-04-13 22:31:25 -05:00
Glenn Randers-Pehrson
930af7d50b [master] Documented the fact that png_set_dither() is no longer supported. 2010-04-13 22:08:21 -05:00
Glenn Randers-Pehrson
0f544f62d6 [master] Imported from libpng-1.4.2rc01.tar 2010-04-10 06:43:07 -05:00
Glenn Randers-Pehrson
398c212955 [master] Bump to version 1.4.2beta02 2010-04-01 07:52:00 -05:00
Glenn Randers-Pehrson
2ec1fc60c3 [master] Imported from libpng-1.4.2beta01.tar 2010-04-01 07:41:11 -05:00
Glenn Randers-Pehrson
c01ee053b1 [master] Imported from libpng-1.4.1.tar 2010-02-25 05:45:01 -06:00
Glenn Randers-Pehrson
b0baee5e36 [master] Removed unused gzio.c from contrib/pngminim gather and makefile
scripts.  This is necessary when libz is updated to version 1.2.4.
2010-02-21 23:12:32 -06:00
Glenn Randers-Pehrson
b55295cb12 [master] Imported from libpng-1.4.1rc04.tar 2010-02-19 19:23:47 -06:00
Glenn Randers-Pehrson
5928ee97ca [master] Define _ALL_SOURCE in configure.ac, makefile.aix, and CMakeLists.txt
when using the AIX compiler.
2010-02-19 19:22:08 -06:00
Glenn Randers-Pehrson
2445ad4331 [master] Imported from libpng-1.4.1rc03.tar 2010-02-19 15:09:07 -06:00
Glenn Randers-Pehrson
93d6d9d835 [master] Define _ALLSOURCE in pngconf.h when building with nonANSI AIX compiler.
otherwise AIX reserves "jmpbuf" and renames it to "__jmpbuf".
2010-02-19 15:02:46 -06:00
Glenn Randers-Pehrson
d207e6a6ad [master] Removed obsolete unused MMX-querying support from contrib/gregbook 2010-02-19 07:52:06 -06:00
Glenn Randers-Pehrson
df6f3f404a [master] Noted in scripts/makefile.mingw that it expects to be run under MSYS. 2010-02-18 23:04:25 -06:00
Glenn Randers-Pehrson
357c1c8c53 [master] Imported from libpng-1.4.1rc02.tar 2010-02-18 07:07:19 -06:00
Glenn Randers-Pehrson
44827ccad8 [master] Fixed typo in ANNOUNCE and CHANGES. 2010-02-14 07:43:22 -06:00
Glenn Randers-Pehrson
0d1a2dd7a9 [master] Bump to version 1.4.1beta13 2010-02-14 07:42:15 -06:00
Glenn Randers-Pehrson
471c9b47fe [master] Imported from libpng-1.4.1beta12.tar 2010-02-14 07:05:57 -06:00
Glenn Randers-Pehrson
23b9a2fda0 [master] Fixed incorrect typecast of png_get_user_malloc_max() in pngget.c 2010-02-14 06:48:09 -06:00
Glenn Randers-Pehrson
7d6103ad6c [master] Imported from libpng-1.4.1beta11.tar 2010-02-12 21:33:07 -06:00
Glenn Randers-Pehrson
ec39f8f8d7 [master] Update announcements about png_decompress_chunk(). 2010-02-12 21:25:37 -06:00
Glenn Randers-Pehrson
a2cde53c87 [master] 2010-02-12 21:07:14 -06:00
Glenn Randers-Pehrson
13714e87f2 [master] Imported from libpng-1.4.1beta10.tar 2010-02-08 15:58:31 -06:00
Glenn Randers-Pehrson
9101d75316 [master] Return allocated "old_buffer" in png_push_save_buffer()
before calling png_error(), to avoid a potential memory leak.
2010-02-08 15:56:17 -06:00
Glenn Randers-Pehrson
233edbf415 [master] Imported from libpng-1.4.1beta09.tar 2010-02-07 23:05:33 -06:00
Glenn Randers-Pehrson
bd209f75fa [master] Reverted to original png_push_save_buffer() code. 2010-02-07 23:02:42 -06:00
Glenn Randers-Pehrson
27854a478e [master] Fixed incorrect test in new png_push_save_buffer() code. 2010-02-07 20:02:02 -06:00
Glenn Randers-Pehrson
f12a87a96c [master] Imported from libpng-1.4.1beta08.tar 2010-02-06 19:48:53 -06:00
Glenn Randers-Pehrson
cb4358ddbb [master] Revert to version 1.4.1beta07 2010-02-06 13:48:45 -06:00
Glenn Randers-Pehrson
c4819d78ba [master] Fix scripting typo in pngwrite.c 2010-02-06 13:44:20 -06:00
Glenn Randers-Pehrson
0b721cd4c4 [master] Bump to version libpng-1.4.1beta08 2010-02-06 13:03:51 -06:00
Glenn Randers-Pehrson
b025757328 [master] Bump to version libpng-1.4.1beta07 2010-02-06 12:17:51 -06:00
Glenn Randers-Pehrson
4bd73b6947 [master] Revised png_push_save_buffer() to do fewer but larger png_mallocs
Eliminated use of png_ptr->irowbytes and reused the slot in png_ptr as
png_ptr->png_user_chunk_malloc_max.
2010-02-06 12:15:07 -06:00
Glenn Randers-Pehrson
f3c42680db [master] Fixed an incorrect #ifdef in pngwrite.c 2010-02-06 10:44:22 -06:00
Glenn Randers-Pehrson
c10066205d [master] Fixed indentation in some png.h comments. 2010-02-05 17:31:42 -06:00
Glenn Randers-Pehrson
21b7aaa428 [master] Imported from libpng-1.4.1beta07.tar 2010-02-05 16:30:38 -06:00
Glenn Randers-Pehrson
d7225fdfce [master] Folded some long lines in png.h
Most of them were too long because of recent insertion of PNG_DEPSTRUCT.
2010-02-05 15:35:41 -06:00
Glenn Randers-Pehrson
deb870c77d [master] Added defineable PNG_USER_CHUNK_CACHE_MAX and PNG_USER_CHUNK_MALLOC_MAX 2010-02-05 15:32:42 -06:00
Glenn Randers-Pehrson
c05538959b [master] Revised documentation to mention the change in
the prototype for the user malloc_fn().
2010-02-02 06:47:13 -06:00
Glenn Randers-Pehrson
f6c761dda1 [master] Imported from libpng-1.4.1beta06.tar 2010-01-28 07:22:50 -06:00
Glenn Randers-Pehrson
877b08d6d2 [master] Implement two-pass png_decompress_chunk() function
suggested by John Bowler.  Does not waste memory, does only one malloc()
to the measured decompressed size.
2010-01-28 07:16:15 -06:00
Glenn Randers-Pehrson
a69064328b [master] Undo recent pngtest changes
The problem was with a buggy compiler (gcc-4.0.1) not a libpng problem
and not worth attempting to work around.
2010-01-27 07:05:02 -06:00
Glenn Randers-Pehrson
01b9566e50 [master] Use int copies instead of longs in pngtest.c
to try to appease the Mac compiler
2010-01-26 23:27:21 -06:00
Glenn Randers-Pehrson
ca3a100be6 [master] Revised pngtest.c for the sake of an optimizing compiler 2010-01-26 22:45:58 -06:00
Glenn Randers-Pehrson
1655e4ddb0 [master] Imported from libpng-1.4.1beta05.tar 2010-01-26 06:56:04 -06:00
Glenn Randers-Pehrson
526f839764 [master] Relocated "int k" declaration in pngtest.c
to work around a compiler optimization bug.
2010-01-26 06:51:00 -06:00
Glenn Randers-Pehrson
1a86bd2a09 [master] Revised png_decompress_chunk() to improve speed and memory
usage when decoding large chunks.
2010-01-22 22:50:46 -06:00
Glenn Randers-Pehrson
610e7b5bd6 [master] Added png_set|get_chunk_malloc_max() functions. 2010-01-22 19:48:40 -06:00
Glenn Randers-Pehrson
86f6c04d84 [master] Imported from libpng-1.4.1beta04.tar 2010-01-22 19:34:44 -06:00
Glenn Randers-Pehrson
fb3a1da4bb [master] Bump to version 1.4.1beta04 2010-01-22 19:29:47 -06:00
Glenn Randers-Pehrson
525efcbb7b [master] Imported from libpng-1.4.1rc01.tar 2010-01-16 08:05:12 -06:00
Glenn Randers-Pehrson
ea4340e1ec [master] Imported from libpng-1.4.1beta03.tar 2010-01-10 16:53:46 -06:00
Glenn Randers-Pehrson
91f3864fbd [master] Removed png_set_premultiply_alpha() from scripts/*.def
Implementation of this function was postponed.
2010-01-10 16:51:01 -06:00
Glenn Randers-Pehrson
14fa704caf [master] Imported from libpng-1.4.1beta02.tar 2010-01-09 13:13:30 -06:00
Glenn Randers-Pehrson
ad1f8180a5 [master] Updated makefiles to link to libpng14.so.14.1 2010-01-07 23:28:16 -06:00
Glenn Randers-Pehrson
e364f899af [master] Imported from libpng-1.4.1beta01.tar 2010-01-07 22:39:45 -06:00
Glenn Randers-Pehrson
40683870ea [master] Update PNG_LIBPNG_VER_NUM to 1.4.1 2010-01-07 22:27:30 -06:00
Glenn Randers-Pehrson
7569d7c069 [master] Updated documentation about png_set_compression_buffer_size(). 2010-01-07 11:37:53 -06:00
Glenn Randers-Pehrson
c87ddbb3ce [master] Make png_set|get_compression_buffer_size() available even
when PNG_WRITE_SUPPORTED is not enabled.  There was no good reason
for this restriction, and PNG readers can gain a speed benefit in
reading large iCCP chunks by increasing png_ptr->zbuf_size via
these functions.
2010-01-07 11:10:16 -06:00
Glenn Randers-Pehrson
793fedcf57 [master] Revise makefile.linux to build libpng.so.14.1 2010-01-07 11:00:07 -06:00
Glenn Randers-Pehrson
74fd86a69e [master] Updated copyright year in revised makefiles. 2010-01-07 08:19:31 -06:00
Glenn Randers-Pehrson
f234091207 [master] Restored "; \" that was lost from makefiles in the previous change 2010-01-07 08:14:16 -06:00
Glenn Randers-Pehrson
772b72139a [master] Revised the makefiles to install the same files and symbolic
links as configure, except for libpng.la and libpng14.la.
2010-01-06 23:11:53 -06:00
Glenn Randers-Pehrson
6e6a844baf [master] Revise scripts/makefile.linux to not make libpng.so.NN 2010-01-06 22:30:32 -06:00
Glenn Randers-Pehrson
2f2f80273b [master] Undid recent change to the Makefiles.
People don't need libpng.so.NN
2010-01-06 17:39:57 -06:00
Glenn Randers-Pehrson
353d8860ac [master] Revised scripts/makefile.linux to make the same files as configure,
except for libpng.la and libpng14.la.  Many other scripts to be fixed soon.
2010-01-06 14:45:03 -06:00
Glenn Randers-Pehrson
fab96cb72a [master] Revised Makefile.am and Makefile.in to make libpng.so.14,
libpng.sl.14, and libpng.14.dylib links in the installed library directory.
2010-01-06 14:16:49 -06:00
Glenn Randers-Pehrson
2203e41900 [master] Revised Makefile.am and Makefile.in to remove references to Y2KINFO,
KNOWNBUG, and libpng.la (Robert Schwebel).
2010-01-04 06:26:41 -06:00
Glenn Randers-Pehrson
e16f2bc5f7 [master] Updated CMakeLists.txt for consistent indentation and to avoid an
unclosed if-statement warning (Philip Lowman).
2010-01-04 06:25:28 -06:00
Glenn Randers-Pehrson
2381cf3269 [master] Bump to version 1.4.1beta01 2010-01-03 17:02:38 -06:00
Glenn Randers-Pehrson
7e3a82cd9c [master] Imported from libpng-1.4.0.tar 2010-01-02 23:15:33 -06:00
Glenn Randers-Pehrson
115817d118 [master] Imported from libpng-1.2.42.tar 2010-01-02 23:15:22 -06:00
Glenn Randers-Pehrson
5cfea4fc98 [master] Imported from libpng-1.2.42rc05.tar 2010-01-01 18:29:51 -06:00
Glenn Randers-Pehrson
a87c870f99 [master] Avoid deprecated references to png_ptr-io_ptr and png_ptr->error_ptr
in pngtest.c
2010-01-01 18:28:50 -06:00
Glenn Randers-Pehrson
b9d671326b [master] Imported from libpng-1.2.42rc04.tar 2010-01-01 10:50:04 -06:00
Glenn Randers-Pehrson
8e4e070151 [master] Updated copyright year to 2010 and made some trivial cosmetic changes 2010-01-01 10:48:33 -06:00
Glenn Randers-Pehrson
4607e1386f [master] Imported from libpng-1.2.42rc03.tar 2009-12-25 14:23:21 -06:00
Glenn Randers-Pehrson
9686172872 [master] Swapped PNG_UNKNOWN_CHUNKS_SUPPORTED and PNG_HANDLE_AS_UNKNOWN_SUPPORTED
in pngset.c to be consistent with other changes in version 1.2.38.
2009-12-25 14:22:08 -06:00
Glenn Randers-Pehrson
8563ac1664 [master] Bump to version 1.2.42rc03 2009-12-25 14:20:39 -06:00
Glenn Randers-Pehrson
9a80a35f4b [master] Imported from libpng-1.2.42rc02.tar 2009-12-23 07:43:15 -06:00
Glenn Randers-Pehrson
4cde19b0c9 [master] Renamed libpng-pc.in back to libpng.pc.in and revised CMakeLists.txt
(revising changes made in 1.2.41beta17 and 1.2.41rc01)
2009-12-22 08:09:39 -06:00
Glenn Randers-Pehrson
230e8b436f [master] Bump to version libpng-1.2.42rc02 2009-12-22 08:07:11 -06:00
Glenn Randers-Pehrson
dbb86efac3 [master] Imported from libpng-1.2.42rc01.tar 2009-12-17 05:53:39 -06:00
Glenn Randers-Pehrson
e8d28e1b1c [master] Bump to version 1.2.42rc01 2009-12-13 07:37:24 -06:00
Glenn Randers-Pehrson
a3a5d0d1f4 [master] Imported from libpng-1.2.42beta02.tar 2009-12-11 17:58:22 -06:00
Glenn Randers-Pehrson
4cf1ca4338 [master] Relocated png_do_chop() to its original position in pngrtran.c
The change in version 1.2.41beta08 caused transparency to be handled wrong
in some 16-bit datastreams (Yusaku Sugai).
2009-12-11 07:29:18 -06:00
Glenn Randers-Pehrson
f174f27096 [master] Removed leftover "-DPNG_CONFIGURE_LIBPNG"
from contrib/pngminim/*/makefile
2009-12-11 07:26:31 -06:00
Glenn Randers-Pehrson
1a15762c59 [master] Bump to version 1.2.42beta02 2009-12-11 07:21:54 -06:00
Glenn Randers-Pehrson
fec6a4ca4e [master] Removed leftover "-DPNG_CONFIGURE_LIBPNG" from scripts/makefile.darwin 2009-12-04 08:26:21 -06:00
Glenn Randers-Pehrson
bcc878bb81 [master] Imported from libpng-1.2.42beta01.tar 2009-12-04 07:16:38 -06:00
Glenn Randers-Pehrson
df61a00acc [master] Revised scripts/makefile.netbsd, makefile.openbsd, and makefile.sco
to put png.h and pngconf.h in $prefix/include, like the other scripts,
    instead of in $prefix/include/libpng.
2009-12-04 06:54:36 -06:00
Glenn Randers-Pehrson
878fea5403 [master] Removed "#define PNG_NO_ERROR_NUMBERS" that was inadvertently added
to pngconf.h in version 1.2.41.
2009-12-04 06:03:57 -06:00
Glenn Randers-Pehrson
804cc98cd1 [master] Bump to version 1.2.42beta01 2009-12-04 06:03:15 -06:00
Glenn Randers-Pehrson
6e00020a9f [master] Imported from libpng-1.2.41.tar 2009-12-02 19:48:27 -06:00
Glenn Randers-Pehrson
2aac9a1fa3 [master] Brought README up to date. 2009-11-27 15:48:31 -06:00
Glenn Randers-Pehrson
5aa8676122 [master] Bump to version 1.2.41rc04 2009-11-27 15:47:49 -06:00
Glenn Randers-Pehrson
ea88d94dcf [master] Imported from libpng-1.2.41rc03.tar 2009-11-25 16:00:51 -06:00
Glenn Randers-Pehrson
eaa1b0a5f2 [master] Removed test for PNG_CONFIGURE_LIBPNG from pngconf.h 2009-11-25 09:27:48 -06:00
Glenn Randers-Pehrson
de5c932283 [master] Disabled the new pedantic warnings
about deprecated function use and deprecated structure access unless the
user defines PNG_PEDANTIC_WARNINGS.  Added "#define PNG_NO_PEDANTIC_WARNINGS"
in the libpng source files.  Removed "-DPNG_CONFIGURE_LIBPNG" from the
makefiles and projects since the warnings no longer depend on this.
2009-11-25 08:51:04 -06:00
Glenn Randers-Pehrson
3b673e0fb0 [master] Bump to version libpng-1.2.41rc03 2009-11-25 08:42:36 -06:00
Glenn Randers-Pehrson
83b84d65c2 [master] Removed some trailing blanks
in Makefile.ac and Makefile.in
2009-11-22 11:37:19 -06:00
Glenn Randers-Pehrson
c31e04e2f8 [master] Rebuilt the configure scripts with autoconf-2.65 2009-11-22 08:55:10 -06:00
Glenn Randers-Pehrson
a460e00574 [master] Bump to version 1.2.41rc02 2009-11-22 08:31:00 -06:00
Glenn Randers-Pehrson
c593d488f9 [master] Imported from libpng-1.2.41rc01.tar 2009-11-18 09:58:36 -06:00
Glenn Randers-Pehrson
44a7c89e02 [master] Moved descriptions of makefiles and other scripts out of INSTALL
into scripts/README.txt
  and updated the copyright year in scripts/pngw32.rc from 2004 to 2009.
2009-11-15 08:31:00 -06:00
Glenn Randers-Pehrson
88bbbfa567 [master] Bump to version 1.2.41rc01 2009-11-14 07:41:19 -06:00
Glenn Randers-Pehrson
e3f9ce59eb [master] Bump to version 1.2.41beta20 2009-11-12 20:24:32 -06:00
Glenn Randers-Pehrson
12f0c2f580 [master] Imported from libpng-1.2.41beta19.tar 2009-11-12 20:11:04 -06:00
Glenn Randers-Pehrson
6099e57b07 [master] Restore pngtest.png, CHANGES, and ANNOUNCE to 1.2.41beta19 version. 2009-11-12 12:20:41 -06:00
Glenn Randers-Pehrson
e53ecd35c0 [master] Restored pngtest.png to the libpng-1.4.0beta7 version. 2009-11-12 12:16:23 -06:00
Glenn Randers-Pehrson
8397b45b20 [master] Removed reference to some non-exported functions from scripts/*.def
These functions won't be exported until libpng-1.4.0
2009-11-12 11:31:09 -06:00
Glenn Randers-Pehrson
bcb1b414ed [master] Fixed up some line-wrapping in the documentation. 2009-11-12 11:30:03 -06:00
Glenn Randers-Pehrson
bef02a89ea [master] Bump to version 1.2.41beta19 2009-11-11 15:09:22 -06:00
Glenn Randers-Pehrson
1aae1bf9fd [master] Updated CHANGES and ANNOUNCE about PNG_PRIVATE macro. 2009-11-11 15:03:20 -06:00
Glenn Randers-Pehrson
078f2aecfb [master] Imported from libpng-1.2.41beta18.tar 2009-11-11 14:26:32 -06:00
Glenn Randers-Pehrson
c87f913eb9 [master] Marked "internally exported" functions with PNG_PRIVATE. 2009-11-11 14:24:27 -06:00
Glenn Randers-Pehrson
a5fc3eb9d4 [master] Bump to version libpng-1.2.41beta18 2009-11-11 14:21:39 -06:00
Glenn Randers-Pehrson
780dc06584 [master] Renamed scripts/makefile.wce to scripts/makefile.cegcc 2009-11-10 09:30:18 -06:00
Glenn Randers-Pehrson
365cddf35f [master] Bump to version libpng-1.2.41rc01 2009-11-10 09:25:53 -06:00
Glenn Randers-Pehrson
c099ea497a [master] Imported from libpng-1.2.41beta17.tar 2009-11-10 06:11:31 -06:00
Glenn Randers-Pehrson
336b43d278 [master] Moved "rm pnggccrd.c pnggvrd.c" to a separate line
in contrib/pngminim/*/gather.sh
2009-11-09 13:42:16 -06:00
Glenn Randers-Pehrson
08e585d948 [master] Added "-DPNG_CONFIGURE_LIBPNG" to the contrib/pngminum makefiles. 2009-11-09 11:20:01 -06:00
Glenn Randers-Pehrson
7aacd895ee [master] Fixed deprecated usages in contrib directory. 2009-11-09 10:47:12 -06:00
Glenn Randers-Pehrson
3130af0e2b [master] Fixed a typo in a comment in CMakeLists.txt 2009-11-09 08:31:05 -06:00
Glenn Randers-Pehrson
02a58af3c0 [master] Marked memory allocation function prototypes with PNG_ALLOCATED. 2009-11-09 08:25:36 -06:00
Glenn Randers-Pehrson
86645a3f19 [master] Marked deprecated function prototypes with PNG_DEPRECATED. 2009-11-09 08:10:22 -06:00
Glenn Randers-Pehrson
edc3994cfd [master] In CMakeLists.txt, add "-DPNG_CONFIGURE_LIBPNG" to the definitions. 2009-11-09 07:18:26 -06:00
Glenn Randers-Pehrson
71f29b701d [master] Bump to version 1.2.41beta17 2009-11-09 06:50:36 -06:00
Glenn Randers-Pehrson
b4b853b4c5 [master] Imported from libpng-1.2.41beta16.tar 2009-11-09 06:50:25 -06:00
Glenn Randers-Pehrson
d5483f3352 [master] Make PNG_DEPSTRUCT, etc., configurable.
Only #define PNG_DEPSTRUCT, etc. in pngconf.h if not already defined.
2009-11-08 20:37:37 -06:00
Glenn Randers-Pehrson
2522de8594 [master] Restore new pngtest.c 2009-11-08 20:07:41 -06:00
Glenn Randers-Pehrson
e5e60564cf [master] Bump to version 1.2.41beta16 2009-11-08 20:06:21 -06:00
Glenn Randers-Pehrson
bf2dabe6f1 [master] Removed three direct references to read_info_ptr members
in pngtest.c that were detected by the new PNG_DEPSTRUCT macro.
2009-11-08 20:01:55 -06:00
Glenn Randers-Pehrson
70c873bcac [master] Remove some extra text from CHANGES 2009-11-08 19:55:14 -06:00
Glenn Randers-Pehrson
5aabf5b8eb [master] Imported from libpng-1.2.41beta15.tar 2009-11-08 19:31:21 -06:00
Glenn Randers-Pehrson
20e82ae2a2 [master] Added deprectated-use reporting
ported from libpng-1.4.0
2009-11-08 19:18:45 -06:00
Glenn Randers-Pehrson
e890cb118c [master] Bump to version bump-to-1.2.41beta15.tar 2009-11-08 17:05:27 -06:00
Glenn Randers-Pehrson
275d1aa94e [master] Imported from libpng-1.2.41beta14.tar 2009-11-08 17:05:18 -06:00
Glenn Randers-Pehrson
f748fda0ed [master] Reverted iTXt compatibility stuff
from 1.2.41beta05, 1.2.41beta11, and 1.2.41beta12.
2009-11-08 16:51:11 -06:00
Glenn Randers-Pehrson
87480bf6d4 [master] Removed reference to png_calloc from scripts/*.def 2009-11-08 15:15:37 -06:00
Glenn Randers-Pehrson
bd6f1edea8 [master] Update png.h and pngconf.h to revert iTXt support. 2009-11-08 15:14:32 -06:00
Glenn Randers-Pehrson
ed4c9fc4e9 [master] Remove mention of empty pngpriv.h in CHANGES 2009-11-03 19:18:56 -06:00
Glenn Randers-Pehrson
8f8be84024 [master] Removed the empty pngpriv.h
due to popular demand.
2009-11-03 19:13:59 -06:00
Glenn Randers-Pehrson
ead562ed05 [master] Make PNG_CONVERT_tIME_SUPPORTED depend on PNG_WRITE_tIME_SUPPORTED 2009-11-03 12:28:14 -06:00
Glenn Randers-Pehrson
8cf8726c7c [master] Make #define PNG_CONVERT_tIME_SUPPORTED depend on PNG_tIME_SUPPORTED 2009-11-03 11:42:47 -06:00
Glenn Randers-Pehrson
b83df4e711 [master] Added empty pngpriv.h file
as an aid to migration to 1.4.x
2009-11-03 10:10:20 -06:00
Glenn Randers-Pehrson
7e64470a71 [master] Bump version to libpng-1.2.41beta14 2009-11-03 07:05:11 -06:00
Glenn Randers-Pehrson
fd3d717df5 [master] Imported from libpng-1.2.41beta13.tar 2009-11-03 06:53:07 -06:00
Glenn Randers-Pehrson
d4ebb803fa [master] Added scripts/makefile.wce and scripts/png32ce.def
to support WindowsCE.
2009-11-02 21:03:14 -06:00
Glenn Randers-Pehrson
5d276731e6 [master] Use the new PNG_CONVERT_tIME_SUPPORTED macro in pngwrite.c. 2009-11-02 11:35:26 -06:00
Glenn Randers-Pehrson
6dcfbc479d [master] Added PNG_CONVERT_tIME_SUPPORTED macro. 2009-11-02 11:26:10 -06:00
Glenn Randers-Pehrson
d8bf20d9ac [master] Updated scripts/pngw32.def and added CE support to ltmain.sh 2009-11-02 09:19:11 -06:00
Glenn Randers-Pehrson
38453101f0 [master] Bump version to 1.2.41beta13 2009-11-02 06:26:40 -06:00
Glenn Randers-Pehrson
8e46375186 [master] Free png_ptr->user_png_ver when destroying png_ptr. 2009-11-02 06:04:47 -06:00
Glenn Randers-Pehrson
c75d7fb32e [master] Bump version to 1.2.41beta12 2009-11-02 05:54:39 -06:00
Glenn Randers-Pehrson
6e0cf087ad [master] Imported from libpng-1.2.41beta11.tar 2009-11-01 21:46:17 -06:00
Glenn Randers-Pehrson
af9a41d770 [master] Store user's user_png_ver in new png_ptr->user_png_ver element.
Revised iTXt support. To ensure binary compatibility with
previous versions, the "lang" and "lang_key" members will be assumed
to be omitted from versions prior to 1.2.41beta11 whenever there is a
library mismatch.
2009-11-01 21:22:01 -06:00
Glenn Randers-Pehrson
d6dc43db7d [master] Removed some dead code from pngconf.h
(inside an #if 0/#endif block)
2009-11-01 16:41:09 -06:00
Glenn Randers-Pehrson
4c49647788 [master] Revise pngconf.h (iTXt handling)
and avoid reference to time.h "tm" structure in png.h and pngwrite.c
2009-11-01 16:32:57 -06:00
Glenn Randers-Pehrson
3de7bde0e1 [master] Revised iTXt support and documentation 2009-11-01 08:47:04 -06:00
Glenn Randers-Pehrson
dc38e24fed [master] Bump version to 1.2.41beta11 2009-10-31 23:29:58 -05:00
Glenn Randers-Pehrson
a61724c004 [master] Imported from libpng-1.2.41beta10.tar 2009-10-31 23:24:15 -05:00
Glenn Randers-Pehrson
29b738b4e6 [master] Enabled iTXt support by default.
To ensure binary compatibility with
    previous versions, the "lang" and "lang_key" members will be assumed
    to be omitted from previous versions unless the current libpng
    version was built with PNG_iTXt_SUPPORTED (which is otherwise no
    longer necessary to gain iTXt support), as a signal that the user has
    been building previous versions with PNG_iTXt_SUPPORTED as well.
2009-10-31 23:20:11 -05:00
Glenn Randers-Pehrson
602d314ba0 [master] Bump version to libpng-1.2.41beta10 2009-10-31 21:43:03 -05:00
Glenn Randers-Pehrson
a68974409c [master] Imported from libpng-1.2.41beta09.tar 2009-10-31 21:42:50 -05:00
Glenn Randers-Pehrson
5d67107c79 [master] Fix typo in pngconf.h 2009-10-31 21:32:42 -05:00
Glenn Randers-Pehrson
da9b591621 [master] Updated documentation
Merged libpng-1.2.41.txt with libpng-1.4.0.txt where appropriate.
2009-10-31 19:21:30 -05:00
Glenn Randers-Pehrson
2e8aa25844 [master] Apply png_user_chunk_cache_max within png_decompress_chunk(). 2009-10-31 19:20:20 -05:00
Glenn Randers-Pehrson
6611322a8b [master] Moved CMakeLists.txt from scripts
into the main libpng directory.  More bugfixes and improvements to
CMakeLists.txt (Philip Lowman)
2009-10-31 12:50:05 -05:00
Glenn Randers-Pehrson
948c6ee88d [master] Removed a harmless extra png_set_invert_alpha()
from pngwrite.c
2009-10-31 12:28:23 -05:00
Glenn Randers-Pehrson
b7a9d80f28 [master] Bump version to libpng-1.2.41beta09 2009-10-30 06:54:53 -05:00
Glenn Randers-Pehrson
277f6fbe49 [master] Revert version to 1.2.41beta08 2009-10-30 06:14:45 -05:00
Glenn Randers-Pehrson
e05080f5a8 [master] Added png_get_user_cache_max()
and png_set_user_cache_max() from libpng-1.4.0rc01.
2009-10-30 05:49:16 -05:00
Glenn Randers-Pehrson
4de250dd75 [master] Put new png_struct members at the end. 2009-10-30 05:41:34 -05:00
Glenn Randers-Pehrson
8f2f7f431c [master] Bump version to 1.2.41beta09 2009-10-30 00:10:54 -05:00
Glenn Randers-Pehrson
4f67b78853 [master] Imported from libpng-1.2.41beta08.tar 2009-10-29 23:54:16 -05:00
Glenn Randers-Pehrson
4b14b35208 [master] Ported functions from libpng-1.4.0rc01:
png_calloc(), png_get_io_state(),
    png_get_io_chunk_name(), png_set_premultiply_alpha, and
    png_do_read_premultiply_alpha().
2009-10-29 23:47:05 -05:00
Glenn Randers-Pehrson
bc2ab12f99 [master] Bump version to 1.2.41beta08 2009-10-29 23:41:29 -05:00
Glenn Randers-Pehrson
c3166b2a48 [master] Imported from libpng-1.2.41beta07.tar 2009-10-21 10:42:32 -05:00
Glenn Randers-Pehrson
1eef1e5b2f [master} Ported some cosmetic changes from libpng-1.4.0rc01
changing "#if defined(x)" to "#ifdef x" in png.h and pngconf.h.
2009-10-21 10:32:04 -05:00
Glenn Randers-Pehrson
8191965555 [master] Fixed "DATE" comment in pngrtran.c 2009-10-19 06:39:35 -05:00
Glenn Randers-Pehrson
f1c9244dfd [master] Bump version to 1.2.41beta07 2009-10-18 14:38:38 -05:00
Glenn Randers-Pehrson
58155a9921 [master] Imported from libpng-1.2.41beta06.tar 2009-10-18 14:36:31 -05:00
Glenn Randers-Pehrson
5d398a69fb [master] Converted all PNG_NO_* tests to PNG_*_SUPPORTED
everywhere except pngconf.h as in libpng-1.4.0beta78 and later.
2009-10-18 14:30:53 -05:00
Glenn Randers-Pehrson
4560de58f4 [master] Update CHANGES and ANNOUNCE 2009-10-18 08:07:48 -05:00
Glenn Randers-Pehrson
7f9f605781 [master] Restored PNG_USE_LOCAL_ARRAYS block of pngread.c
that was inadvertently deleted by the previous checkin.
2009-10-18 08:03:07 -05:00
Glenn Randers-Pehrson
41cad5fbed [master] Bump version to 1.2.41beta06 2009-10-17 19:20:53 -05:00
Glenn Randers-Pehrson
e4f15b0f0e [master] Ported cosmetic changes to pngread.c
from libpng-1.4.0beta87.
2009-10-17 19:02:45 -05:00
Glenn Randers-Pehrson
d4e3ef6eae [master] Ported cosmetic changes to pngwrite.c
from libpng-1.4.0beta87.
2009-10-17 18:30:44 -05:00
Glenn Randers-Pehrson
eda90ace80 [master] Port cosmetic changes in png.c
from libpng-1.4.0beta87
2009-10-13 20:12:37 -05:00
Glenn Randers-Pehrson
0c127348e1 [master] Ported cosmetic changes in pngrtran.c
from libpng-1.4.0beta87
2009-10-13 18:31:01 -05:00
Glenn Randers-Pehrson
eb6b59af64 [master] Fixed some indentation in pngrtran.c 2009-10-13 18:29:46 -05:00
Glenn Randers-Pehrson
11066e33f8 [master] Port cosmetic changes in pngrutil.c
from libpng-1.4.0beta87
2009-10-13 09:09:11 -05:00
Glenn Randers-Pehrson
51a32d64d8 [master] Ported cosmetic changes in pngpread.c and pngrtran.c
from libpng-1.4.0beta87.
2009-10-12 13:41:14 -05:00
Glenn Randers-Pehrson
77a9f59487 [master] Ported some cosmetic changes from libpng-1.4.0beta87/pngrutil.c,
changing many "#if defined(x)" to "#ifdef x".
2009-10-11 08:26:03 -05:00
Glenn Randers-Pehrson
1814c4e45b [master] Imported from libpng-1.2.41beta05.tar 2009-10-11 07:49:17 -05:00
Glenn Randers-Pehrson
722f5fd8d4 [master] Ported some cosmetic changes from libpng-1.4.0beta87
changing many "#if defined(x)" to "#ifdef x" in pngtest.c and pngwutil.c.
2009-10-10 09:27:12 -05:00
Glenn Randers-Pehrson
e9c8dcf96c [master] Revised pngconf.h to make it easier to enable iTXt support
by defining PNG_iTXT_SUPPORTED
2009-10-10 08:13:01 -05:00
Glenn Randers-Pehrson
89e0d95883 [master] Bump version to 1.2.41beta05 2009-10-10 06:29:47 -05:00
Glenn Randers-Pehrson
aeb9906717 [master] Imported from libpng-1.2.41beta04.tar 2009-10-10 06:29:36 -05:00
Glenn Randers-Pehrson
368971ec8b [master] Eliminated a shadowed declaration
of "pp" in png_handle_sPLT().
2009-10-07 12:48:44 -05:00
Glenn Randers-Pehrson
0112826daf [master] Change xcode project library name
from libpng.0.dylib to libpng.3.dylib to be consistent with makefile.darwin.
2009-10-05 14:56:46 -05:00
Glenn Randers-Pehrson
9023e8f7bb [master] Ported some cosmetic changes from the devel branch 2009-10-05 13:53:19 -05:00
Glenn Randers-Pehrson
48fac4e8ce [master] Added projects/xcode/libpng.xcodeproj/.gitignore 2009-10-04 16:01:53 -05:00
Glenn Randers-Pehrson
edeccce619 [master] Added "xcode" project
similar one already in libpng-1.4.0beta (Alam Arias).
2009-10-02 14:12:54 -05:00
Glenn Randers-Pehrson
60668aa210 [master] Bump version to 1.2.4beta04 2009-10-02 09:41:34 -05:00
Glenn Randers-Pehrson
455e8a4281 [master] Imported from libpng-1.2.41beta03.tar 2009-09-30 23:14:24 -05:00
Glenn Randers-Pehrson
5d7fe7a718 [master] Revised png_check_IHDR() again
to check info_ptr members instead of the contents of the returned parameters.
2009-09-30 23:10:28 -05:00
Glenn Randers-Pehrson
64ca95e375 [master] Bump version to 1.2.41beta03 2009-09-30 16:03:06 -05:00
Glenn Randers-Pehrson
837eecbc91 [master] Revised png_check_IHDR()
to avoid bogus complaints about filter method.
2009-09-30 14:45:33 -05:00
Glenn Randers-Pehrson
26cc10a00c [master] Reverted recent test in png_get_IHDR(). 2009-09-30 14:35:05 -05:00
Glenn Randers-Pehrson
f12abe957d [master] Revised png_check_IHDR() 2009-09-30 14:29:00 -05:00
Glenn Randers-Pehrson
caaf688582 [master] Imported from libpng-1.2.41beta02.tar 2009-09-30 13:40:53 -05:00
Glenn Randers-Pehrson
3dfd0cd62a [master] Add a test to make sure the user isn't trying to stuff height into
a 16-bit int (assuming height immediately follows width).
2009-09-30 13:38:37 -05:00
Glenn Randers-Pehrson
18bd86f154 [master] Revise documentation to mention not using TAB character 2009-09-25 14:21:52 -05:00
Glenn Randers-Pehrson
338f465019 [master] Expand TAB characters in pngrtran.c 2009-09-25 14:11:33 -05:00
Glenn Randers-Pehrson
ac13f5e6f9 [master] Imported from libpng-1.2.41beta01.tar 2009-09-25 12:07:58 -05:00
Glenn Randers-Pehrson
1b6f6d80ea [master] Imported from libpng-1.2.40.tar 2009-09-10 09:01:41 -05:00
Glenn Randers-Pehrson
18b078414a [master] Imported from libpng-1.2.40rc01.tar 2009-09-02 07:09:11 -05:00
Glenn Randers-Pehrson
f6ce318061 [master] CMakeLists.txt updated with bugfixes and improvements 2009-08-28 07:06:45 -05:00
Glenn Randers-Pehrson
a21c94e3dc [master] Bump version to libpng-1.2.40beta02 2009-08-22 09:26:42 -05:00
Glenn Randers-Pehrson
38b92d56e7 [master] Imported from libpng-1.2.40beta01.tar 2009-08-20 17:39:42 -05:00
Glenn Randers-Pehrson
a08d95b971 [master] Fixed incorrect #ifdef in pngset.c
PNG_UNKNOWN_CHUNKS_SUPPORTED should be PNG_HANDLE_AS_UNKNOWN_SUPPORTED
2009-08-20 16:13:58 -05:00
Glenn Randers-Pehrson
339416b38b [master] Trivial cosmetic changes in comments 2009-08-19 08:42:06 -05:00
Glenn Randers-Pehrson
7e2f07486a [master] Remove an extra png_debug() statement
that was recently added to png_write_find_filter() in pngwutil.c
2009-08-13 17:54:20 -05:00
Glenn Randers-Pehrson
a3e569cdda [master] Bump libpng.3 and ANNOUNCE to version 1.2.40beta01 2009-08-13 17:52:49 -05:00
Glenn Randers-Pehrson
d68d8d82e6 [master] Bump version to libpng-1.2.40beta01 2009-08-13 17:41:35 -05:00
Glenn Randers-Pehrson
997b4a544d [master] Update ANNOUNCE to mention .tar.xz instead of .tgz 2009-08-13 06:15:22 -05:00
Glenn Randers-Pehrson
176d2b622e [master] Imported from libpng-1.2.39.tar 2009-08-13 05:51:34 -05:00
Glenn Randers-Pehrson
3a9ab23713 [master] Imported from libpng-1.2.39rc01.tar 2009-08-05 21:26:48 -05:00
Glenn Randers-Pehrson
9e88fcd58c [master] Imported from libpng-1.2.39beta05.tar 2009-08-01 08:57:10 -05:00
Glenn Randers-Pehrson
39ffc1c3c7 [master] Imported from libpng-1.2.39beta04.tar 2009-08-01 08:57:08 -05:00
Glenn Randers-Pehrson
69d0e44295 [master] Imported from libpng-1.2.39beta03.tar 2009-07-29 05:50:25 -05:00
Glenn Randers-Pehrson
d2d5e540ac [master] Update configure scripts to autoconf-2.64 2009-07-28 16:51:57 -05:00
Glenn Randers-Pehrson
d7bd2d2b2c [master] Relocated prototype for png_64bit_product()
into png.h and revised the documenatation (in the libpng style section) about
placement of prototypes.
2009-07-28 08:18:31 -05:00
Glenn Randers-Pehrson
ddf5fc8a42 [master] Bump version to libpng-1.2.39beta03 2009-07-28 08:05:11 -05:00
Glenn Randers-Pehrson
0841c63e0d [master] Imported from libpng-1.2.39beta02.tar 2009-07-27 22:31:10 -05:00
Glenn Randers-Pehrson
a4d439b975 [master] Avoid a possible NULL dereference in debug build,
in png_set_text_2() (bug introduced in libpng-0.95, discovered by Evan Rouault)
2009-07-27 22:27:30 -05:00
Glenn Randers-Pehrson
8de509a837 [master] Bump version to libpng-1.2.39beta02 2009-07-27 22:26:15 -05:00
Glenn Randers-Pehrson
219760639a [master] Imported from libpng-1.2.39beta01.tar 2009-07-25 09:27:58 -05:00
Glenn Randers-Pehrson
38ed8795ab [master] Added a prototype for png_16bit_product()
(suggested by Peter Breitenlohner)
2009-07-23 13:18:55 -05:00
Glenn Randers-Pehrson
55697d7dc9 [master] Update some dates. 2009-07-23 13:17:27 -05:00
Glenn Randers-Pehrson
a7fb782aea [master] Bump version to libpng-1.2.39beta01 2009-07-23 13:01:03 -05:00
Glenn Randers-Pehrson
d91c64e428 [master] Imported from libpng-1.2.38.tar 2009-07-16 06:01:45 -05:00
Glenn Randers-Pehrson
4aa911abc6 [master] Imported from libpng-1.2.38rc03.tar 2009-07-11 09:16:28 -05:00
Glenn Randers-Pehrson glennrp@comcast.net
64c72bb919 [master] Updated configuration scripts to autoconf-2.63
from autoconf-2.62
2009-07-11 09:07:35 -05:00
Glenn Randers-Pehrson glennrp@comcast.net
fec191d3cc [master] Revised references to libpng license in contrib/visupng
to be consistent with the rest of the source files.
2009-07-11 07:13:56 -05:00
Glenn Randers-Pehrson
7430bcbc44 [master] Add a reference to the "libpng license" in each source file. 2009-06-28 21:38:35 -05:00
Glenn Randers-Pehrson
eba11d2ba5 [master] Imported from libpng-1.2.38rc02.tar 2009-06-28 20:28:53 -05:00
Glenn Randers-Pehrson
a3a724f805 [master] Imported from libpng-1.2.38rc01.tar 2009-06-24 06:59:36 -05:00
Glenn Randers-Pehrson
a770d71890 [master] Bump version to bump-to-libpng-1.2.38beta02 2009-06-18 16:53:56 -05:00
Glenn Randers-Pehrson
1de866cd09 [master] Imported from libpng-1.2.38beta01.tar 2009-06-17 07:46:44 -05:00
Glenn Randers-Pehrson
54380f53a2 [master] Fixed some indentation in pngset.c 2009-06-16 17:53:00 -05:00
Glenn Randers-Pehrson
7d870524d3 [master] Changed PNG_HANDLE_AS_UNKNOWN to PNG_UNKNOWN_CHUNKS_SUPPORTED
in pngset.c
2009-06-16 17:28:01 -05:00
Glenn Randers-Pehrson
d28aad9a58 [master] Added an "#ifdef PNG_WRITE_SUPPORTED/#endif" block in pngconf.h 2009-06-16 17:27:14 -05:00
Glenn Randers-Pehrson
8be63adbc8 [master] Relocated various UNKNOWN_CHUNK macro definitions
outside of the PNG_READ|WRITE_ANCILLARY_CHUNK_SUPPORTED macros and
updated CHANGES and ANNOUNCE.  The definitions were actually relocated
in the previous commit but I forgot to mention it.
2009-06-16 16:13:42 -05:00
Glenn Randers-Pehrson
7d8f352e0a Added a PNG_NO_HANDLE_AS_UNKNOWN inside the LEGACY block of pngconf.h 2009-06-16 13:54:57 -05:00
Glenn Randers-Pehrson
587382c0ba [master] Added 2 "defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)" tests in png.h 2009-06-16 13:35:47 -05:00
Glenn Randers-Pehrson
0f714ca6bc [master] Reformatted some comments. 2009-06-15 22:01:39 -05:00
Glenn Randers-Pehrson
63da1df6fe [master] png.c should have been included in the previous checkin 2009-06-15 20:58:37 -05:00
Glenn Randers-Pehrson
bbe589da44 [master] Change some instances of PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
to PNG_HANDLE_AS_UNKNOWN to make it possible to build a libpng that can
use the png_set_keep_unknown_chunks() mechanism to ignore unused chunks
without having to save unknown chunks.
2009-06-15 20:50:00 -05:00
Glenn Randers-Pehrson
b278e91338 about calling png_set_IHDR() multiple times and about the order
of color samples in the tRNS chunk.
2009-06-08 08:37:58 -05:00
Glenn Randers-Pehrson
f2609e133d [master] Revise libpng*.txt
about calling png_set_IHDR() multiple times and about the order
of color samples in the tRNS chunk.
2009-06-08 08:33:46 -05:00
Glenn Randers-Pehrson
e14fdbbddb [master] Bump version to bump-to-libpng-1.2.38beta01 2009-06-05 17:27:14 -05:00
Glenn Randers-Pehrson
a162155919 Imported from libpng-1.2.37.tar 2009-06-04 06:11:58 -05:00
Glenn Randers-Pehrson
4d7ae382a8 [master] Added a section in documentation
about using png_set_io_ptr() in configure scripts for detecting libpng
2009-06-02 13:48:22 -05:00
Glenn Randers-Pehrson
0c86eb2dc7 Update pngminim/*/pngusr.h
to add PNG_NO_READ_SWAP, PNG_NO_WRITE_SWAP
2009-06-02 06:50:00 -05:00
Glenn Randers-Pehrson
70c2db8b9f Updated documentation about the git repository and libpng coding style. 2009-06-02 06:41:57 -05:00
Glenn Randers-Pehrson
c1dd118d2c Reformatted several "if () statment;"
and "else statement;" into two lines.
2009-05-30 20:25:20 -05:00
Glenn Randers-Pehrson
2d21d91abd Imported from libpng-1.2.37rc01.tar 2009-05-27 06:47:59 -05:00
Glenn Randers-Pehrson
e5ee05dc0d Imported from libpng-1.2.37beta03.tar 2009-05-20 17:19:00 -05:00
Glenn Randers-Pehrson
c0d53e176b Change version from libpng-1.2.37rc01 to libpng-1.2.37beta03
Because of many cosmetic changes, drop back to beta and do rc01 later.
2009-05-20 17:16:46 -05:00
Glenn Randers-Pehrson
b26d188190 Rename contrib/pngminim/*/makefile.std to makefile. 2009-05-19 18:51:08 -05:00
Glenn Randers-Pehrson
0a6382e2af Bump version to libpng-1.2.37rc01 2009-05-19 18:48:06 -05:00
Glenn Randers-Pehrson
1214d8cd26 Fix "AVE" -> "AVG" typo in libpng docs again.
Evidently the fix didn't go into the real master copy.
2009-05-19 07:18:06 -05:00
Glenn Randers-Pehrson
65a30ab0a2 Imported from libpng-1.2.37beta02.tar 2009-05-19 07:05:20 -05:00
Glenn Randers-Pehrson
61616abef2 Fixed cut-and-paste error in contrib/pngminim/preader/README
"pngminus" should be "gregbook"
2009-05-18 15:19:29 -05:00
Glenn Randers-Pehrson
bb1fcd1ba8 Fixed a glitch in contrib/pngminim/preader/README. 2009-05-18 14:57:07 -05:00
Glenn Randers-Pehrson
6d65121993 Add contrib/pngminim/preader files
(README, gather.sh, makefile.std, and pngusr.h)
2009-05-18 14:50:48 -05:00
Glenn Randers-Pehrson
ecf0bffb79 Added contrib/pngminim/preader demo of gregbook/rpng2-x with embedded libpng
also minor editing of encoder/pngusr.h and decoder/pngusr.h
2009-05-18 14:46:35 -05:00
Glenn Randers-Pehrson
af2ea0a1f2 Revise ANNOUNCE to reflect conditional compile of png_read_finish_row(). 2009-05-18 14:43:36 -05:00
Glenn Randers-Pehrson
286467db82 Restored compiling png_combine_row() for progressive readers.
Only png_read_finish_row() can be omitted.
2009-05-18 13:40:23 -05:00
Glenn Randers-Pehrson
6b60a31ebf Restore png_memset() call
This stuff should be handled in the APNG fork.
2009-05-18 11:55:55 -05:00
Glenn Randers-Pehrson
54028e5943 Revert "png_reset_prev_row" from png.h and pngrutil.c
This should be handled in the APNG fork, not in libpng proper.
2009-05-18 11:49:19 -05:00
Glenn Randers-Pehrson
0c062e839d Conditionally compile png_combine_row() and png_read_finish_row()
which are only used by sequential PNG readers.  This can save some
resources in applications that only do progressive reading.
2009-05-18 10:31:21 -05:00
Glenn Randers-Pehrson
0fcbf05b6d Revert "Set png_ptr->old_prev_row_size=0 to force prev_row to be cleared"
This reverts commit f4276c36c93e9a257f0780a3590886d5fa411f1d.
2009-05-18 10:18:00 -05:00
Glenn Randers-Pehrson
f4276c36c9 Set png_ptr->old_prev_row_size=0 to force prev_row to be cleared 2009-05-16 08:47:20 -05:00
Glenn Randers-Pehrson
ba05bddf92 Relocate misplaced #endif directives in pngwrite.c
having to do with sCAL chunk handling
2009-05-16 08:40:25 -05:00
Glenn Randers-Pehrson glennrp@comcast.net
7a63d75a83 Fixed typo in libpng documentation: AVE filter should be AVG filter. 2009-05-15 20:56:43 -05:00
Glenn Randers-Pehrson glennrp@comcast.net
da3f74a70e Bump version to libpng-1.2.37beta02 2009-05-15 20:53:04 -05:00
Glenn Randers-Pehrson
5f26656fc5 Imported from libpng-1.2.37beta01.tar 2009-05-14 05:23:07 -05:00
Glenn Randers-Pehrson
2f76e90d1a Reformatted comments in example.c
Added advice about setting pointers to NULL after png_free(),
capitalized sentences, reformatted long comments in libpng style.
2009-05-13 15:20:53 -05:00
Glenn Randers-Pehrson
1296329f02 Revised commentary in example.c 2009-05-13 07:42:05 -05:00
Glenn Randers-Pehrson
e38b432846 Clarified usage of sig_bit as struct vs sig_bit_p as pointer in example.c
sig_bit was not declared in write_png() and was used differently from
sig_bit in read_png(), as reported by Vincent Torri.  This update changes
sig_bit to sig_bit_p in read_png() and declares sig_bit in write_png().
2009-05-13 05:18:48 -05:00
Glenn Randers-Pehrson
549a5101e7 Fixed inconsistency in use of "row_bytes" in pngrutil.c
The memset() should use "row_bytes" instead of "png_ptr->rowbytes".
This bug was introduced in libpng-1.2.36.
2009-05-12 05:49:10 -05:00
Glenn Randers-Pehrson glennrp@comcast.net
031a8648cb Merged scripts/makefiles and other scripts with libpng-1.4.0beta57.
These are mostly just cosmetic changes.
2009-05-07 17:12:33 -05:00
Glenn Randers-Pehrson glennrp@comcast.net
a8476a8404 Bump internal version to libpng-1.2.37beta01. 2009-05-07 17:09:14 -05:00
Glenn Randers-Pehrson
25c8491fc8 Imported from libpng-1.2.36.tar 2009-05-07 10:59:02 -05:00
Glenn Randers-Pehrson
d0d637dd47 Imported from libpng-1.2.36rc01.tar 2009-04-30 15:29:29 -05:00
Glenn Randers-Pehrson
977c6bd44c Imported from libpng-1.2.36beta05.tar 2009-04-24 15:09:41 -05:00
Glenn Randers-Pehrson
89ad3aa168 Suppress "shadowed declaration" warnings about "gamma" in pngset.c
The variable "gamma" is also defined in math.h on some platforms.
2009-04-20 13:23:24 -05:00
Glenn Randers-Pehrson
55b921dab2 Suppress "shadowed declaration" warnings in pngtest.c
Changed some local variable names such as "buffer" to "buff".
2009-04-20 13:12:07 -05:00
Glenn Randers-Pehrson
92d0fe938f Add PNG_SKIP_SETJMP_CHECK macro 2009-04-20 13:07:01 -05:00
Glenn Randers-Pehrson
d07e9b03c4 Bump versioning to 1.2.36beta05 2009-04-20 13:02:18 -05:00
Glenn Randers-Pehrson
6cbd1cba68 Imported from libpng-1.2.36beta04.tar 2009-04-06 16:18:42 -05:00
Glenn Randers-Pehrson
3b8df1f143 Imported from libpng-1.2.36beta03.tar 2009-04-06 16:18:40 -05:00
Glenn Randers-Pehrson
85f7d0a8d5 Imported from libpng-1.2.36beta02.tar 2009-04-06 16:18:37 -05:00
Glenn Randers-Pehrson
556450a2ff Imported from libpng-1.2.36beta01.tar 2009-04-06 16:18:34 -05:00
Glenn Randers-Pehrson
6048b12510 Imported from libpng-1.2.35.tar 2009-04-06 16:18:32 -05:00
Glenn Randers-Pehrson
8cafc1e1ac Imported from libpng-1.2.35rc02.tar 2009-04-06 16:18:30 -05:00
Glenn Randers-Pehrson
51807d7608 Imported from libpng-1.2.35rc01.tar 2009-04-06 16:18:28 -05:00
Glenn Randers-Pehrson
e104df5bb7 Imported from libpng-1.2.35beta03.tar 2009-04-06 16:18:26 -05:00
Glenn Randers-Pehrson
c6df7e5899 Imported from libpng-1.2.35beta02.tar 2009-04-06 16:18:23 -05:00
Glenn Randers-Pehrson
d0a4300dde Imported from libpng-1.2.35beta01.tar 2009-04-06 16:18:21 -05:00
Glenn Randers-Pehrson
d8865433f9 Imported from libpng-1.2.34.tar 2009-04-06 16:18:19 -05:00
Glenn Randers-Pehrson
9c2bd642ba Imported from libpng-1.2.34rc01.tar 2009-04-06 16:18:17 -05:00
Glenn Randers-Pehrson
09883db208 Imported from libpng-1.2.34beta07.tar 2009-04-06 16:18:14 -05:00
Glenn Randers-Pehrson
f7f68f7160 Imported from libpng-1.2.34beta06.tar 2009-04-06 16:18:12 -05:00
Glenn Randers-Pehrson
31f744a8c0 Imported from libpng-1.2.34beta05.tar 2009-04-06 16:18:10 -05:00
Glenn Randers-Pehrson
bc66c96275 Imported from libpng-1.2.34beta04.tar 2009-04-06 16:18:07 -05:00
Glenn Randers-Pehrson
87c2acdeae Imported from libpng-1.2.34beta03.tar 2009-04-06 16:18:05 -05:00
Glenn Randers-Pehrson
6b90023764 Imported from libpng-1.2.34beta02.tar 2009-04-06 16:18:02 -05:00
Glenn Randers-Pehrson
e502bca962 Imported from libpng-1.2.34beta01.tar 2009-04-06 16:18:00 -05:00
Glenn Randers-Pehrson
c4d44b72e8 Imported from libpng-1.2.33.tar 2009-04-06 16:17:58 -05:00
Glenn Randers-Pehrson
e7324bb94f Imported from libpng-1.2.33rc02.tar 2009-04-06 16:17:56 -05:00
Glenn Randers-Pehrson
8431b2c190 Imported from libpng-1.2.33rc01.tar 2009-04-06 16:17:53 -05:00
Glenn Randers-Pehrson
7d376ccd8c Imported from libpng-1.2.33beta01.tar 2009-04-06 16:17:51 -05:00
Glenn Randers-Pehrson
382410249d Imported from libpng-1.2.32.tar 2009-04-06 16:17:49 -05:00
Glenn Randers-Pehrson
bfb5132362 Imported from libpng-1.2.32rc01.tar 2009-04-06 16:17:47 -05:00
Glenn Randers-Pehrson
4489dbc630 Imported from libpng-1.2.32beta01.tar 2009-04-06 16:17:45 -05:00
Glenn Randers-Pehrson
5c31bc8ffc Imported from libpng-1.2.31.tar 2009-04-06 16:17:42 -05:00
Glenn Randers-Pehrson
baee5f46cf Imported from libpng-1.2.31rc03.tar 2009-04-06 16:17:40 -05:00
Glenn Randers-Pehrson
66ab7ffa15 Imported from libpng-1.2.31rc02.tar 2009-04-06 16:17:37 -05:00
Glenn Randers-Pehrson
32df7eb346 Imported from libpng-1.2.31rc01.tar 2009-04-06 16:17:35 -05:00
Glenn Randers-Pehrson
576b532b45 Imported from libpng-1.2.30.tar 2009-04-06 16:17:33 -05:00
Glenn Randers-Pehrson
b520414d5a Imported from libpng-1.2.30rc08.tar 2009-04-06 16:17:31 -05:00
Glenn Randers-Pehrson
b54fd5c588 Imported from libpng-1.2.30rc07.tar 2009-04-06 16:17:28 -05:00
Glenn Randers-Pehrson
d9b4c01719 Imported from libpng-1.2.30rc06.tar 2009-04-06 16:17:26 -05:00
Glenn Randers-Pehrson
84d5d968a6 Imported from libpng-1.2.30rc05.tar 2009-04-06 16:17:24 -05:00
Glenn Randers-Pehrson
9c8717e42f Imported from libpng-1.2.30rc04.tar 2009-04-06 16:17:21 -05:00
Glenn Randers-Pehrson
3215e97b17 Imported from libpng-1.2.30rc03.tar 2009-04-06 16:17:19 -05:00
Glenn Randers-Pehrson
975e721432 Imported from libpng-1.2.30rc02.tar 2009-04-06 16:17:17 -05:00
Glenn Randers-Pehrson
b8bccdd081 Imported from libpng-1.2.30rc01.tar 2009-04-06 16:17:15 -05:00
Glenn Randers-Pehrson
4310a4d813 Imported from libpng-1.2.30beta04.tar 2009-04-06 16:17:12 -05:00
Glenn Randers-Pehrson
b96b342561 Imported from libpng-1.2.30beta03.tar 2009-04-06 16:17:10 -05:00
Glenn Randers-Pehrson
eb1cd11d57 Imported from libpng-1.2.30beta02.tar 2009-04-06 16:17:07 -05:00
Glenn Randers-Pehrson
a55c72890d Imported from libpng-1.2.30beta01.tar 2009-04-06 16:17:05 -05:00
Glenn Randers-Pehrson
247e230581 Imported from libpng-1.2.29.tar 2009-04-06 16:17:03 -05:00
Glenn Randers-Pehrson
1586ea6fe9 Imported from libpng-1.2.29rc01.tar 2009-04-06 16:17:01 -05:00
Glenn Randers-Pehrson
ae505c50b0 Imported from libpng-1.2.29beta03.tar 2009-04-06 16:16:58 -05:00
Glenn Randers-Pehrson
fce1b4b1fb Imported from libpng-1.2.29beta02.tar 2009-04-06 16:16:55 -05:00
Glenn Randers-Pehrson
c6bcbf4951 Imported from libpng-1.2.29beta01.tar 2009-04-06 16:16:53 -05:00
Glenn Randers-Pehrson
6ed6086da5 Imported from libpng-1.2.28.tar 2009-04-06 16:16:51 -05:00
Glenn Randers-Pehrson
9f7b16ad19 Imported from libpng-1.2.27.tar 2009-04-06 16:16:49 -05:00
Glenn Randers-Pehrson
fc70a92071 Imported from libpng-1.2.27rc01.tar 2009-04-06 16:16:46 -05:00
Glenn Randers-Pehrson
ccaaab2898 Imported from libpng-1.2.27beta06.tar 2009-04-06 16:16:43 -05:00
Glenn Randers-Pehrson
8d36e630f2 Imported from libpng-1.2.27beta05.tar 2009-04-06 16:16:41 -05:00
Glenn Randers-Pehrson
eb1f347bca Imported from libpng-1.2.27beta04.tar 2009-04-06 16:16:38 -05:00
Glenn Randers-Pehrson
7db798186c Imported from libpng-1.2.27beta03.tar 2009-04-06 16:16:36 -05:00
Glenn Randers-Pehrson
a1cd94bfbb Imported from libpng-1.2.27beta02.tar 2009-04-06 16:16:34 -05:00
Glenn Randers-Pehrson
d9d2a6f6d9 Imported from libpng-1.2.27beta01.tar 2009-04-06 16:16:31 -05:00
Glenn Randers-Pehrson
b8c4b82d18 Imported from libpng-1.2.26.tar 2009-04-06 16:16:29 -05:00
Glenn Randers-Pehrson
b8f615d7a1 Imported from libpng-1.2.26rc01.tar 2009-04-06 16:16:27 -05:00
Glenn Randers-Pehrson
35d97eb5c5 Imported from libpng-1.2.26beta06.tar 2009-04-06 16:16:24 -05:00
Glenn Randers-Pehrson
fc15b2e479 Imported from libpng-1.2.26beta05.tar 2009-04-06 16:16:22 -05:00
Glenn Randers-Pehrson
936df0d290 Imported from libpng-1.2.26beta04.tar 2009-04-06 16:16:20 -05:00
Glenn Randers-Pehrson
3236beddf8 Imported from libpng-1.2.26beta03.tar 2009-04-06 16:16:18 -05:00
Glenn Randers-Pehrson
c13f8f10e6 Imported from libpng-1.2.26beta02.tar 2009-04-06 16:16:15 -05:00
Glenn Randers-Pehrson
d8b530b93c Imported from libpng-1.2.26beta01.tar 2009-04-06 16:16:13 -05:00
Glenn Randers-Pehrson
2296f211e8 Imported from libpng-1.2.25.tar 2009-04-06 16:16:10 -05:00
Glenn Randers-Pehrson
a5136b8863 Imported from libpng-1.2.25rc02.tar 2009-04-06 16:16:08 -05:00
Glenn Randers-Pehrson
913bc38217 Imported from libpng-1.2.25beta06.tar 2009-04-06 16:16:05 -05:00
Glenn Randers-Pehrson
4b7dca3d2c Imported from libpng-1.2.25beta05.tar 2009-04-06 16:16:03 -05:00
Glenn Randers-Pehrson
5c58e3ee31 Imported from libpng-1.2.25beta04.tar 2009-04-06 16:16:00 -05:00
Glenn Randers-Pehrson
49f304bd07 Imported from libpng-1.2.25beta03.tar 2009-04-06 16:15:58 -05:00
Glenn Randers-Pehrson
c95be42221 Imported from libpng-1.2.25rc01.tar 2009-04-06 16:15:56 -05:00
Glenn Randers-Pehrson
dbc07e13bb Imported from libpng-1.2.25beta02.tar 2009-04-06 16:15:54 -05:00
Glenn Randers-Pehrson
5ca40ebc22 Imported from libpng-1.2.25beta01.tar 2009-04-06 16:15:51 -05:00
Glenn Randers-Pehrson
a8e07274ae Imported from libpng-1.2.24.tar 2009-04-06 16:15:49 -05:00
Glenn Randers-Pehrson
af99dba018 Imported from libpng-1.2.24rc01.tar 2009-04-06 16:15:46 -05:00
Glenn Randers-Pehrson
03dfa028d2 Imported from libpng-1.2.24beta02.tar 2009-04-06 16:15:44 -05:00
Glenn Randers-Pehrson
541b47ac2a Imported from libpng-1.2.24beta01.tar 2009-04-06 16:15:42 -05:00
Glenn Randers-Pehrson
507a35a9be Imported from libpng-1.2.23.tar 2009-04-06 16:15:39 -05:00
Glenn Randers-Pehrson
1eddb5463e Imported from libpng-1.2.23rc01.tar 2009-04-06 16:15:37 -05:00
Glenn Randers-Pehrson
d91769efd4 Imported from libpng-1.2.23beta05.tar 2009-04-06 16:15:34 -05:00
Glenn Randers-Pehrson
134a8eb272 Imported from libpng-1.2.23beta04.tar 2009-04-06 16:15:32 -05:00
Glenn Randers-Pehrson
930be98598 Imported from libpng-1.2.23beta03.tar 2009-04-06 16:15:30 -05:00
Glenn Randers-Pehrson
28e3cb3e93 Imported from libpng-1.2.23beta02.tar 2009-04-06 16:15:28 -05:00
Glenn Randers-Pehrson
6328671ef8 Imported from libpng-1.2.23beta01.tar 2009-04-06 16:15:25 -05:00
Glenn Randers-Pehrson
fab1959d00 Imported from libpng-1.2.22.tar 2009-04-06 16:15:23 -05:00
Glenn Randers-Pehrson
5ab788cd84 Imported from libpng-1.2.22rc1.tar 2009-04-06 16:15:21 -05:00
Glenn Randers-Pehrson
ce2a6d3739 Imported from libpng-1.2.22beta4.tar 2009-04-06 16:15:18 -05:00
Glenn Randers-Pehrson
40dd10dfb2 Imported from libpng-1.2.22beta3.tar 2009-04-06 16:15:16 -05:00
Glenn Randers-Pehrson
e41076e082 Imported from libpng-1.2.22beta2.tar 2009-04-06 16:15:14 -05:00
Glenn Randers-Pehrson
582fec4e11 Imported from libpng-1.2.22beta1.tar 2009-04-06 16:15:11 -05:00
Glenn Randers-Pehrson
42ae02aa08 Imported from libpng-1.2.21.tar 2009-04-06 16:15:08 -05:00
Glenn Randers-Pehrson
79e3fc64c4 Imported from libpng-1.2.21rc3.tar 2009-04-06 16:15:06 -05:00
Glenn Randers-Pehrson
b188d671d1 Imported from libpng-1.2.21rc2.tar 2009-04-06 16:15:04 -05:00
Glenn Randers-Pehrson
5ecf1b53ea Imported from libpng-1.2.21rc1.tar 2009-04-06 16:15:01 -05:00
Glenn Randers-Pehrson
0636311d37 Imported from libpng-1.2.21beta2.tar 2009-04-06 16:14:59 -05:00
Glenn Randers-Pehrson
219d3b449f Imported from libpng-1.2.21beta1.tar 2009-04-06 16:14:57 -05:00
Glenn Randers-Pehrson
22eaa89c5a Imported from libpng-1.2.20.tar 2009-04-06 16:14:55 -05:00
Glenn Randers-Pehrson
79e28a4c2e Imported from libpng-1.2.20rc6.tar 2009-04-06 16:14:52 -05:00
Glenn Randers-Pehrson
db05b1eb2b Imported from libpng-1.2.20rc5.tar 2009-04-06 16:14:50 -05:00
Glenn Randers-Pehrson
d20666a228 Imported from libpng-1.2.20rc4.tar 2009-04-06 16:14:48 -05:00
Glenn Randers-Pehrson
9cc7b03503 Imported from libpng-1.2.20rc3.tar 2009-04-06 16:14:45 -05:00
Glenn Randers-Pehrson
b38f12d519 Imported from libpng-1.2.20rc2.tar 2009-04-06 16:14:43 -05:00
Glenn Randers-Pehrson
e736f1ead9 Imported from libpng-1.2.20rc1.tar 2009-04-06 16:14:40 -05:00
Glenn Randers-Pehrson
b56c1f6023 Imported from libpng-1.2.20beta04.tar 2009-04-06 16:14:37 -05:00
Glenn Randers-Pehrson
268f0d64fc Imported from libpng-1.2.20beta03.tar 2009-04-06 16:14:35 -05:00
Glenn Randers-Pehrson
b3ea17736b Imported from libpng-1.2.20beta02.tar 2009-04-06 16:14:33 -05:00
Glenn Randers-Pehrson
963daeaec5 Imported from libpng-1.2.20beta01.tar 2009-04-06 16:14:30 -05:00
Glenn Randers-Pehrson
249bd44ebc Imported from libpng-1.2.19.tar 2009-04-06 16:14:28 -05:00
Glenn Randers-Pehrson
04a1b1c123 Imported from libpng-1.2.19rc6.tar 2009-04-06 16:14:25 -05:00
Glenn Randers-Pehrson
3922e7afc3 Imported from libpng-1.2.19rc5.tar 2009-04-06 16:14:23 -05:00
Glenn Randers-Pehrson
f0a97a0d80 Imported from libpng-1.2.19rc4.tar 2009-04-06 16:14:21 -05:00
Glenn Randers-Pehrson
88713fd590 Imported from libpng-1.2.19rc3.tar 2009-04-06 16:14:18 -05:00
Glenn Randers-Pehrson
394759e0c8 Imported from libpng-1.2.19rc2.tar 2009-04-06 16:14:16 -05:00
Glenn Randers-Pehrson
c229f65dcf Imported from libpng-1.2.19rc1.tar 2009-04-06 16:14:13 -05:00
Glenn Randers-Pehrson
f929861609 Imported from libpng-1.2.19beta31.tar 2009-04-06 16:14:10 -05:00
Glenn Randers-Pehrson
f024ce7675 Imported from libpng-1.2.19beta30.tar 2009-04-06 16:14:08 -05:00
Glenn Randers-Pehrson
f3fcf00392 Imported from libpng-1.2.19beta29.tar 2009-04-06 16:14:05 -05:00
Glenn Randers-Pehrson
08313ef870 Imported from libpng-1.2.19beta28.tar 2009-04-06 16:14:03 -05:00
Glenn Randers-Pehrson
911c469d69 Imported from libpng-1.2.19beta27.tar 2009-04-06 16:14:00 -05:00
Glenn Randers-Pehrson
07c089ee04 Imported from libpng-1.2.19beta26.tar 2009-04-06 16:13:58 -05:00
Glenn Randers-Pehrson
dadc944810 Imported from libpng-1.2.19beta25.tar 2009-04-06 16:13:55 -05:00
Glenn Randers-Pehrson
80663032a9 Imported from libpng-1.2.19beta24.tar 2009-04-06 16:13:53 -05:00
Glenn Randers-Pehrson
67c75ee7f0 Imported from libpng-1.2.19beta23.tar 2009-04-06 16:13:51 -05:00
Glenn Randers-Pehrson
62626737a5 Imported from libpng-1.2.19beta22.tar 2009-04-06 16:13:48 -05:00
Glenn Randers-Pehrson
e404eed318 Imported from libpng-1.2.19beta21.tar 2009-04-06 16:13:46 -05:00
Glenn Randers-Pehrson
3c115428ea Imported from libpng-1.2.19beta20.tar 2009-04-06 16:13:43 -05:00
Glenn Randers-Pehrson
db40ca4aca Imported from libpng-1.2.19beta19.tar 2009-04-06 16:13:41 -05:00
Glenn Randers-Pehrson
f456d0d6bb Imported from libpng-1.2.19beta18.tar 2009-04-06 16:13:38 -05:00
Glenn Randers-Pehrson
06fe17eb9f Imported from libpng-1.2.19beta17.tar 2009-04-06 16:13:36 -05:00
Glenn Randers-Pehrson
7945bdb88f Imported from libpng-1.2.19beta16.tar 2009-04-06 16:13:33 -05:00
Glenn Randers-Pehrson
f7794ec181 Imported from libpng-1.2.19beta15.tar 2009-04-06 16:13:31 -05:00
Glenn Randers-Pehrson
16851b3eb3 Imported from libpng-1.2.19beta14.tar 2009-04-06 16:13:29 -05:00
Glenn Randers-Pehrson
c72d8d4d29 Imported from libpng-1.2.19beta13.tar 2009-04-06 16:13:26 -05:00
Glenn Randers-Pehrson
2b7436558e Imported from libpng-1.2.19beta12.tar 2009-04-06 16:13:24 -05:00
Glenn Randers-Pehrson
e59c47d5b1 Imported from libpng-1.2.19beta11.tar 2009-04-06 16:13:22 -05:00
Glenn Randers-Pehrson
c1523ad16d Imported from libpng-1.2.19beta10.tar 2009-04-06 16:13:19 -05:00
Glenn Randers-Pehrson
d0be8e27de Imported from libpng-1.2.19beta9.tar 2009-04-06 16:13:17 -05:00
Glenn Randers-Pehrson
5c66b81289 Imported from libpng-1.2.19beta8.tar 2009-04-06 16:13:15 -05:00
Glenn Randers-Pehrson
1a42cb2013 Imported from libpng-1.2.19beta7.tar 2009-04-06 16:13:12 -05:00
Glenn Randers-Pehrson
cf2978cbbb Imported from libpng-1.2.19beta6.tar 2009-04-06 16:13:10 -05:00
Glenn Randers-Pehrson
8a9733e777 Imported from libpng-1.2.19beta5.tar 2009-04-06 16:13:07 -05:00
Glenn Randers-Pehrson
ba880c5501 Imported from libpng-1.2.19beta4.tar 2009-04-06 16:13:05 -05:00
Glenn Randers-Pehrson
788f962fbd Imported from libpng-1.2.19beta3.tar 2009-04-06 16:13:03 -05:00
Glenn Randers-Pehrson
12f8283560 Imported from libpng-1.2.19beta2.tar 2009-04-06 16:13:01 -05:00
Glenn Randers-Pehrson
4d27f6b77b Imported from libpng-1.2.19beta1.tar 2009-04-06 16:12:58 -05:00
Glenn Randers-Pehrson
413ed28246 Imported from libpng-1.2.18.tar 2009-04-06 16:12:56 -05:00
Glenn Randers-Pehrson
ad084f559a Imported from libpng-1.2.17.tar 2009-04-06 16:12:54 -05:00
Glenn Randers-Pehrson
3832ab1c21 Imported from libpng-1.2.17rc4.tar 2009-04-06 16:12:52 -05:00
Glenn Randers-Pehrson
999bceb413 Imported from libpng-1.2.17rc3.tar 2009-04-06 16:12:49 -05:00
Glenn Randers-Pehrson
e8f6605642 Imported from libpng-1.2.17rc2.tar 2009-04-06 16:12:47 -05:00
Glenn Randers-Pehrson
3148c65323 Imported from libpng-1.2.17rc1.tar 2009-04-06 16:12:45 -05:00
Glenn Randers-Pehrson
0a3d2cc68b Imported from libpng-1.2.17beta2.tar 2009-04-06 16:12:43 -05:00
Glenn Randers-Pehrson
11cf76edb3 Imported from libpng-1.2.17beta1.tar 2009-04-06 16:12:40 -05:00
Glenn Randers-Pehrson
8833ad415c Imported from libpng-1.2.16.tar 2009-04-06 16:12:38 -05:00
Glenn Randers-Pehrson
bc290d8e6c Imported from libpng-1.2.16rc1.tar 2009-04-06 16:12:35 -05:00
Glenn Randers-Pehrson
9c5b3a4060 Imported from libpng-1.2.16beta2.tar 2009-04-06 16:12:33 -05:00
Glenn Randers-Pehrson
04bbba55c7 Imported from libpng-1.2.16beta1.tar 2009-04-06 16:12:31 -05:00
Glenn Randers-Pehrson
40b70d5373 Imported from libpng-1.2.15.tar 2009-04-06 16:12:29 -05:00
Glenn Randers-Pehrson
833d32646e Imported from libpng-1.2.15rc5.tar 2009-04-06 16:12:27 -05:00
Glenn Randers-Pehrson
6cdefb3cac Imported from libpng-1.2.15rc4.tar 2009-04-06 16:12:25 -05:00
Glenn Randers-Pehrson
f959d3ee7a Imported from libpng-1.2.15rc3.tar 2009-04-06 16:12:22 -05:00
Glenn Randers-Pehrson
b0952eabc7 Imported from libpng-1.2.15rc2.tar 2009-04-06 16:12:20 -05:00
Glenn Randers-Pehrson
43bb4ba4bf Imported from libpng-1.2.15rc1.tar 2009-04-06 16:12:18 -05:00
Glenn Randers-Pehrson
c2de22abeb Imported from libpng-1.2.15beta6.tar 2009-04-06 16:12:15 -05:00
Glenn Randers-Pehrson
a0113ee049 Imported from libpng-1.2.15beta5.tar 2009-04-06 16:12:13 -05:00
Glenn Randers-Pehrson
05db10fda3 Imported from libpng-1.2.15beta4.tar 2009-04-06 16:12:11 -05:00
Glenn Randers-Pehrson
948ee23a2a Imported from libpng-1.2.15beta3.tar 2009-04-06 16:12:08 -05:00
Glenn Randers-Pehrson
271a2931b6 Imported from libpng-1.2.15beta2.tar 2009-04-06 16:12:06 -05:00
Glenn Randers-Pehrson
9fe05edd47 Imported from libpng-1.2.15beta1.tar 2009-04-06 16:12:04 -05:00
Glenn Randers-Pehrson
c2573702cf Imported from libpng-1.2.14.tar 2009-04-06 16:12:02 -05:00
Glenn Randers-Pehrson
b8e76b586e Imported from libpng-1.2.14rc1.tar 2009-04-06 16:11:59 -05:00
Glenn Randers-Pehrson
11a89964b9 Imported from libpng-1.2.14beta2.tar 2009-04-06 16:11:57 -05:00
Glenn Randers-Pehrson
b5bfcbae59 Imported from libpng-1.2.14beta1.tar 2009-04-06 16:11:55 -05:00
Glenn Randers-Pehrson
efe95a6953 Imported from libpng-1.2.13.tar 2009-04-06 16:11:53 -05:00
Glenn Randers-Pehrson
e88a5eca8b Imported from libpng-1.2.13rc2.tar 2009-04-06 16:11:51 -05:00
Glenn Randers-Pehrson
2e3980e1de Imported from libpng-1.2.13rc1.tar 2009-04-06 16:11:49 -05:00
Glenn Randers-Pehrson
0ff85c6923 Imported from libpng-1.2.13beta1.tar 2009-04-06 16:11:47 -05:00
Glenn Randers-Pehrson
e3358d1839 Imported from libpng-1.2.12.tar 2009-04-06 16:11:45 -05:00
Glenn Randers-Pehrson
f5eac0c7fa Imported from libpng-1.2.11.tar 2009-04-06 16:11:42 -05:00
Glenn Randers-Pehrson
6034592a27 Imported from libpng-1.2.11rc5.tar 2009-04-06 16:11:40 -05:00
Glenn Randers-Pehrson
7b00d826d3 Imported from libpng-1.2.11rc3.tar 2009-04-06 16:11:37 -05:00
Glenn Randers-Pehrson
52ef3586b9 Imported from libpng-1.2.11rc2.tar 2009-04-06 16:11:35 -05:00
Glenn Randers-Pehrson
4118fcdd14 Imported from libpng-1.2.11rc1.tar 2009-04-06 16:11:33 -05:00
Glenn Randers-Pehrson
d9e18047d3 Imported from libpng-1.2.11beta4.tar 2009-04-06 16:11:31 -05:00
Glenn Randers-Pehrson
734f320ade Imported from libpng-1.2.11beta3.tar 2009-04-06 16:11:29 -05:00
Glenn Randers-Pehrson
79f25cdeb2 Imported from libpng-1.2.11beta2cos.tar 2009-04-06 16:11:27 -05:00
Glenn Randers-Pehrson
413f3db617 Imported from libpng-1.2.11beta2.tar 2009-04-06 16:11:25 -05:00
Glenn Randers-Pehrson
4db11d5143 Imported from libpng-1.2.11beta1.tar 2009-04-06 16:11:23 -05:00
Glenn Randers-Pehrson
78d28c6b96 Imported from libpng-1.2.10.tar 2009-04-06 16:11:21 -05:00
Glenn Randers-Pehrson
24df7333a2 Imported from libpng-1.2.10rc3.tar 2009-04-06 16:11:18 -05:00
Glenn Randers-Pehrson
8694cd8bf5 Imported from libpng-1.2.10rc2.tar 2009-04-06 16:11:16 -05:00
335 changed files with 68150 additions and 14313 deletions

81
.appveyor.yml Normal file
View File

@ -0,0 +1,81 @@
version: 1.6.x-{build}
branches:
except:
- /libpng[0-1][0-8]/
- /v[0-1][.][0-8][.][0-9]+/
image:
- Visual Studio 2022
shallow_clone: true
environment:
matrix:
- TOOLCHAIN: vstudio
AUTOMATION: cmake
ARCH: x86
- TOOLCHAIN: vstudio
AUTOMATION: cmake
ARCH: x64
- TOOLCHAIN: vstudio
AUTOMATION: cmake
ARCH: arm64
- TOOLCHAIN: llvm
AUTOMATION: cmake
ARCH: x64
- TOOLCHAIN: msys2
AUTOMATION: cmake
ARCH: i686
- TOOLCHAIN: msys2
AUTOMATION: cmake
ARCH: x86_64
- TOOLCHAIN: msys2
AUTOMATION: configure
ARCH: i686
- TOOLCHAIN: msys2
AUTOMATION: configure
ARCH: x86_64
- TOOLCHAIN: msys2
AUTOMATION: makefiles
ARCH: i686
- TOOLCHAIN: msys2
AUTOMATION: makefiles
ARCH: x86_64
install:
- 'if "%TOOLCHAIN%"=="vstudio" C:\tools\vcpkg\vcpkg.exe install zlib:%ARCH%-windows'
- 'if "%TOOLCHAIN%"=="vstudio" C:\tools\vcpkg\vcpkg.exe integrate install'
- 'if "%TOOLCHAIN%"=="llvm" C:\tools\vcpkg\vcpkg.exe install zlib:%ARCH%-windows'
- 'if "%TOOLCHAIN%"=="llvm" C:\tools\vcpkg\vcpkg.exe integrate install'
- 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="cmake" C:\msys64\usr\bin\pacman.exe -S --noconfirm mingw-w64-%ARCH%-cmake mingw-w64-%ARCH%-ninja'
before_build:
- 'if "%TOOLCHAIN%"=="vstudio" set CI_CMAKE_GENERATOR=Visual Studio 17 2022'
- 'if "%TOOLCHAIN%"=="vstudio" set CI_CMAKE_TOOLCHAIN_FILE=C:\tools\vcpkg\scripts\buildsystems\vcpkg.cmake'
- 'if "%TOOLCHAIN%"=="vstudio" if "%ARCH%"=="x86" set CI_CMAKE_GENERATOR_PLATFORM=Win32'
- 'if "%TOOLCHAIN%"=="vstudio" if "%ARCH%"=="x64" set CI_CMAKE_GENERATOR_PLATFORM=x64'
- 'if "%TOOLCHAIN%"=="vstudio" if "%ARCH%"=="arm64" set CI_CMAKE_GENERATOR_PLATFORM=ARM64'
- 'if "%TOOLCHAIN%"=="vstudio" if "%ARCH%"=="arm64" set CI_CMAKE_VARS=-DPNG_TESTS=0'
- 'if "%TOOLCHAIN%"=="llvm" set CI_CMAKE_GENERATOR=Ninja'
- 'if "%TOOLCHAIN%"=="llvm" set CI_CMAKE_TOOLCHAIN_FILE=C:\tools\vcpkg\scripts\buildsystems\vcpkg.cmake'
- 'if "%TOOLCHAIN%"=="llvm" set CI_CC=clang'
- 'if "%TOOLCHAIN%"=="msys2" set CI_CMAKE_GENERATOR=Ninja'
- 'if "%TOOLCHAIN%"=="msys2" set CI_CC=gcc'
- 'if "%TOOLCHAIN%"=="msys2" if "%ARCH%"=="i686" set MSYSTEM=MINGW32'
- 'if "%TOOLCHAIN%"=="msys2" if "%ARCH%"=="x86_64" set MSYSTEM=MINGW64'
- 'set CI_CMAKE_BUILD_FLAGS=-j2'
- 'set CI_CTEST_FLAGS=-j2'
- 'set CI_MAKE_FLAGS=-j2'
- 'set CI_MAKEFILES=scripts/makefile.gcc scripts/makefile.msys scripts/makefile.std'
build_script:
- 'if "%TOOLCHAIN%"=="vstudio" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_verify_cmake.sh"'
- 'if "%TOOLCHAIN%"=="llvm" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_verify_cmake.sh"'
- 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="cmake" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_verify_cmake.sh"'
- 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="configure" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_verify_configure.sh"'
- 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="makefiles" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_verify_makefiles.sh"'
cache:
- 'C:\tools\vcpkg\installed'
- 'C:\msys64\var\cache\pacman'

94
.cmake-format.yaml Normal file
View File

@ -0,0 +1,94 @@
# https://pypi.org/project/cmakelang
# https://github.com/cheshirekow/cmake_format
# ----------------------
# Options for formatting
# ----------------------
# How wide to allow formatted cmake files
# TODO: Reflow the CMake files to allow setting the maximum line width to 100.
line_width: 255
# How many spaces to tab for indent
tab_size: 2
# If true, lines are indented using tab characters (utf-8 0x09) instead of
# <tab_size> space characters (utf-8 0x20). In cases where the layout would
# require a fractional tab character, the behavior of the fractional
# indentation is governed by <fractional_tab_policy>
use_tabchars: false
# If <use_tabchars> is True, then the value of this variable indicates how
# fractional indentions are handled during whitespace replacement. If set to
# 'use-space', fractional indentation is left as spaces (utf-8 0x20). If set
# to `round-up` fractional indentation is replaced with a single tab character
# (utf-8 0x09) effectively shifting the column to the next tabstop
fractional_tab_policy: "use-space"
# Enable comment markup parsing and reflow
enable_markup: false
# -------------------
# Options for linting
# -------------------
# Lint codes to disable
disabled_codes: [
# TODO:
# Reconcile the CMake variable names with the patterns below, then
# re-enable the "invalid variable name XXX" messages.
"C0103",
# TODO:
# Add brief COMMENT arguments to the `add_custom_target` commands.
"C0113",
]
# Regular expression pattern describing valid function names
function_pattern: "[0-9a-z_]+"
# Regular expression pattern describing valid macro names
macro_pattern: "[0-9A-Z_]+"
# Regular expression pattern describing valid names for variables with global
# (cache) scope
global_var_pattern: "[A-Z][0-9A-Z_]+"
# Regular expression pattern describing valid names for variables with global
# scope (but internal semantic)
internal_var_pattern: "_[A-Z][0-9A-Z_]+"
# Regular expression pattern describing valid names for variables with local
# scope
local_var_pattern: "[a-z][a-z0-9_]+"
# Regular expression pattern describing valid names for privatedirectory
# variables
private_var_pattern: "_[0-9a-z_]+"
# Regular expression pattern describing valid names for public directory
# variables
public_var_pattern: "[A-Z][0-9A-Z_]+"
# Regular expression pattern describing valid names for function/macro
# arguments and loop variables.
argument_var_pattern: "[a-z][a-z0-9_]+"
# Regular expression pattern describing valid names for keywords used in
# functions or macros
keyword_pattern: "[A-Z][0-9A-Z_]+"
# In the heuristic for C0201, how many conditionals to match within a loop in
# before considering the loop a parser
max_conditionals_custom_parser: 2
# Require at least this many newlines between statements;
# require no more than this many newlines between statements;
# etc.
min_statement_spacing: 1
max_statement_spacing: 2
max_returns: 6
max_branches: 12
max_arguments: 5
max_localvars: 15
max_statements: 50

55
.editorconfig Normal file
View File

@ -0,0 +1,55 @@
# https://editorconfig.org
root = true
[*]
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true
[*.txt]
indent_size = unset
indent_style = space
[*.[chS]]
indent_size = 3
indent_style = space
max_doc_length = 80
max_line_length = 80
[*.dfa]
indent_size = 3
indent_style = space
max_doc_length = 80
max_line_length = 80
[*.awk]
indent_size = 3
indent_style = space
max_doc_length = 80
max_line_length = 100
[*.cmake]
indent_size = 2
indent_style = space
max_doc_length = 80
max_line_length = 100
[*.sh]
indent_size = 4
indent_style = space
max_doc_length = 100
max_line_length = 100
[{Makefile.in,aclocal.m4,ltmain.sh}]
indent_size = unset
indent_style = unset
insert_final_newline = unset
max_doc_length = unset
max_line_length = unset
trim_trailing_whitespace = unset
[COMMIT_EDITMSG]
indent_style = space
max_doc_length = unset
max_line_length = 72

View File

@ -0,0 +1,9 @@
{
"Disable": {
"IndentSize": true
},
"Exclude": [
".git/",
"out/"
]
}

31
.github/workflows/lint.yml vendored Normal file
View File

@ -0,0 +1,31 @@
name: Linting libpng
on:
push:
branches:
- libpng16
- libpng18
pull_request:
branches:
- libpng16
- libpng18
jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Set up the cache
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/pip.txt') }}
restore-keys: ${{ runner.os }}-pip-
- name: Install yamllint
run: pip install yamllint
- name: Install editorconfig-checker
uses: editorconfig-checker/action-editorconfig-checker@main
- name: Check out the code
uses: actions/checkout@v4
- name: Run the linting script
run: bash ./ci/ci_lint.sh

159
.gitignore vendored Normal file
View File

@ -0,0 +1,159 @@
# Prerequisites
*.d
# Precompiled headers
*.gch
*.pch
# Object files
*.slo
*.lo
*.o
*.obj
# Linker output files
*.exp
*.ilk
*.map
# Compiled dynamic libraries
*.dll
*.dylib
*.so
*.so.*
# Compiled static libraries
*.a
*.la
*.lai
*.lib
# Compiled executables
*.app/
*.exe
a.out
# Debug files
*.dSYM/
*.idb
*.pdb
*.su
# Tag files
TAGS
.TAGS
!TAGS/
tags
.tags
!tags/
gtags.files
GTAGS
GRTAGS
GPATH
GSYMS
cscope.files
cscope.out
cscope.*.out
# Text editing and text processing artifacts
\#*\#
.\#*
[._]*.sw[a-p]
[._]sw[a-p]
*.bak
*.orig
*.rej
*.tmp
*~
# IDE files and directories
## Eclipse
.cproject/
.project/
.settings/
## Embarcadero RAD Studio
*.cbproj.*
__recovery/
## JetBrains
.idea/
## NetBeans
nbbuild/
nbdist/
nbproject/
## Visual Studio
.vs/
### Visual Studio user files
*.rsuser
*.sln.docstates
*.suo
*.user
*.userprefs
### Visual Studio cache files (for older versions)
*.aps
*.ncb
*.opensdf
*.sdf
*.VC.db
*.VC.opendb
ipch/
## Visual Studio Code
.vscode/*
!.vscode/extensions.json
!.vscode/launch.json
!.vscode/settings.json
!.vscode/tasks.json
## (Various)
*.*cache
*.cache*
[._]*_history
.history/
[Bb]ackup*/
# Build, test and CI output directories
*[Dd]ebug/
[Dd]ebug*/
*[Rr]elease/
[Rr]elease*/
[._]build*/
/[Bb]uild*/
/[Oo]ut/
# Libpng configuration and auxiliary build artifacts
*.out
*out.png
[._]deps/
[._]libs/
.dirstamp
/Makefile
/autom4te.cache/
/config*~
/config.h
/config.log
/config.status
/install*~
/libpng*-config
/libpng*.pc
/libpng.vers
/libtool
/stamp-h1
CMake*.json
!CMakePresets.json
CMakeLists.txt.*
pnglibconf.[ch]
pnglibconf.dfn
pnglibconf.pre
pngprefix.h
# Libpng test programs, scripts and artifacts
/test-suite.log
/tests/*.log
/tests/*.trs
/png-fix-itxt
/pngcp
/pngfix
/pngimage
/pngstest
/pngtest
/pngunknown
/pngvalid
/timepng

7
.yamllint.yml Normal file
View File

@ -0,0 +1,7 @@
extends: default
rules:
document-start: disable
document-end: disable
line-length: disable
truthy:
check-keys: false

View File

@ -1,64 +1,53 @@
Libpng 1.6.33 - September 28, 2017 libpng 1.6.51.git
=================
This is a public release of libpng, intended for use in production codes. This is a development version, not intended to be a public release.
It will be replaced by a public release, or by another development
version, at a later time.
Files available for download:
Source files with LF line endings (for Unix/Linux) and with a libpng 1.6.50 - July 1, 2025
"configure" script ============================
libpng-1.6.33.tar.xz (LZMA-compressed, recommended) This is a public release of libpng, intended for use in production code.
libpng-1.6.33.tar.gz
Source files with CRLF line endings (for Windows), without the
"configure" script
lpng1633.7z (LZMA-compressed, recommended) Files available for download
lpng1633.zip ----------------------------
Source files with LF line endings (for Unix/Linux):
* libpng-1.6.50.tar.xz (LZMA-compressed, recommended)
* libpng-1.6.50.tar.gz (deflate-compressed)
Source files with CRLF line endings (for Windows):
* lpng1650.7z (LZMA-compressed, recommended)
* lpng1650.zip (deflate-compressed)
Other information: Other information:
libpng-1.6.33-README.txt * README.md
libpng-1.6.33-LICENSE.txt * LICENSE.md
libpng-1.6.33-*.asc (armored detached GPG signatures) * AUTHORS.md
* TRADEMARK.md
Changes since the last public release (1.6.32):
Added PNGMINUS_UNUSED macro to contrib/pngminus/p*.c and added missing
parenthesis in contrib/pngminus/pnm2png.c (bug report by Christian Hesse).
Fixed off-by-one error in png_do_check_palette_indexes() (Bug report
by Mick P., Source Forge Issue #269).
Initialize png_handler.row_ptr in contrib/oss-fuzz/libpng_read_fuzzer.cc
to fix shortlived oss-fuzz issue 3234.
Compute a larger limit on IDAT because some applications write a deflate
buffer for each row (Bug report by Andrew Church).
Use current date (DATE) instead of release-date (RDATE) in last
changed date of contrib/oss-fuzz files.
Enabled ARM support in CMakeLists.txt (Bernd Kuhls).
Fixed incorrect typecast of some arguments to png_malloc() and
png_calloc() that were png_uint_32 instead of png_alloc_size_t
(Bug report by "irwir" in Github libpng issue #175).
Use pnglibconf.h.prebuilt when building for ANDROID with cmake (Github
issue 162, by rcdailey).
Initialize memory allocated by png_inflate to zero, using memset, to
stop an oss-fuzz "use of uninitialized value" detection in png_set_text_2()
due to truncated iTXt or zTXt chunk.
Initialize memory allocated by png_read_buffer to zero, using memset, to
stop an oss-fuzz "use of uninitialized value" detection in
png_icc_check_tag_table() due to truncated iCCP chunk.
Removed a redundant test (suggested by "irwir" in Github issue #180).
Added an interlaced version of each file in contrib/pngsuite.
Relocate new memset() call in pngrutil.c.
Removed more redundant tests (suggested by "irwir" in Github issue #180).
Add support for loading images with associated alpha in the Simplified
API (Samuel Williams).
Revert contrib/oss-fuzz/libpng_read_fuzzer.cc to libpng-1.6.32 state.
Initialize png_handler.row_ptr in contrib/oss-fuzz/libpng_read_fuzzer.cc
Add end_info structure and png_read_end() to the libpng fuzzer.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Changes from version 1.6.49 to version 1.6.50
(subscription required; visit ---------------------------------------------
* Improved the detection of the RVV Extension on the RISC-V platform.
(Contributed by Filip Wasil)
* Replaced inline ASM with C intrinsics in the RVV code.
(Contributed by Filip Wasil)
* Fixed a decoder defect in which unknown chunks trailing IDAT, set
to go through the unknown chunk handler, incorrectly triggered
out-of-place IEND errors.
(Contributed by John Bowler)
* Fixed the CMake file for cross-platform builds that require `libm`.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
Subscription is required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe) to subscribe.
or to glennrp at users.sourceforge.net
Glenn R-P

66
AUTHORS Normal file
View File

@ -0,0 +1,66 @@
PNG REFERENCE LIBRARY AUTHORS
=============================
This is the list of PNG Reference Library ("libpng") Contributing
Authors, for copyright and licensing purposes.
* Adam Richter
* Andreas Dilger
* Chris Blume
* Cosmin Truta
* Dave Martindale
* Eric S. Raymond
* Gilles Vollant
* Glenn Randers-Pehrson
* Greg Roelofs
* Guy Eric Schalnat
* James Yu
* John Bowler
* Kevin Bracey
* Lucas Chollet
* Magnus Holmgren
* Mandar Sahastrabuddhe
* Manfred Schlaegl
* Mans Rullgard
* Matt Sarett
* Mike Klein
* Pascal Massimino
* Paul Schmidt
* Philippe Antoine
* Qiang Zhou
* Sam Bushell
* Samuel Williams
* Simon-Pierre Cadieux
* Tim Wegner
* Tom Lane
* Tom Tanner
* Vadim Barkov
* Willem van Schaik
* Zhijie Liang
* Apple Inc.
- Zixu Wang (王子旭)
* Arm Holdings
- Richard Townsend
* Google LLC
- Dan Field
- Dragoș Tiselice
- Leon Scroggins III
- Matt Sarett
- Mike Klein
- Sami Boukortt
- Wan-Teh Chang
* Loongson Technology Corporation Ltd.
- GuXiWei (顾希伟)
- JinBo (金波)
- ZhangLixia (张利霞)
* Samsung Group
- Filip Wasil
The build projects, the build scripts, the test scripts, and other
files in the "projects", "scripts" and "tests" directories, have
other copyright owners, but are released under the libpng license.
Some files in the "ci" and "contrib" directories, as well as some
of the tools-generated files that are distributed with libpng, have
other copyright owners, and are released under other open source
licenses.

295
CHANGES
View File

@ -1,4 +1,3 @@
#if 0
CHANGES - changes for libpng CHANGES - changes for libpng
version 0.1 [March 29, 1995] version 0.1 [March 29, 1995]
@ -205,7 +204,7 @@ Version 0.97 [January, 1998]
Added simple sRGB support (Glenn R-P) Added simple sRGB support (Glenn R-P)
Easier conditional compiling, e.g., Easier conditional compiling, e.g.,
define PNG_READ/WRITE_NOT_FULLY_SUPPORTED; define PNG_READ/WRITE_NOT_FULLY_SUPPORTED;
all configurable options can be selected from command-line instead all configurable options can be selected from command line instead
of having to edit pngconf.h (Glenn R-P) of having to edit pngconf.h (Glenn R-P)
Fixed memory leak in pngwrite.c (free info_ptr->text) (Glenn R-P) Fixed memory leak in pngwrite.c (free info_ptr->text) (Glenn R-P)
Added more conditions for png_do_background, to avoid changing Added more conditions for png_do_background, to avoid changing
@ -943,7 +942,7 @@ Version 1.0.8 [July 24, 2000]
Version 1.0.9beta1 [November 10, 2000] Version 1.0.9beta1 [November 10, 2000]
Fixed typo in scripts/makefile.hpux Fixed typo in scripts/makefile.hpux
Updated makevms.com in scripts and contrib/* and contrib/* (Martin Zinser) Updated makevms.com in scripts and contrib/* and contrib/* (Martin Zinser)
Fixed seqence-point bug in contrib/pngminus/png2pnm (Martin Zinser) Fixed sequence-point bug in contrib/pngminus/png2pnm (Martin Zinser)
Changed "cdrom.com" in documentation to "libpng.org" Changed "cdrom.com" in documentation to "libpng.org"
Revised pnggccrd.c to get it all working, and updated makefile.gcmmx (Greg). Revised pnggccrd.c to get it all working, and updated makefile.gcmmx (Greg).
Changed type of "params" from voidp to png_voidp in png_read|write_png(). Changed type of "params" from voidp to png_voidp in png_read|write_png().
@ -1454,7 +1453,7 @@ Version 1.2.6beta4 [July 28, 2004]
sequential read support. sequential read support.
Added some "#if PNG_WRITE_SUPPORTED" blocks. Added some "#if PNG_WRITE_SUPPORTED" blocks.
Added #ifdef to remove some redundancy in png_malloc_default(). Added #ifdef to remove some redundancy in png_malloc_default().
Use png_malloc instead of png_zalloc to allocate the pallete. Use png_malloc instead of png_zalloc to allocate the palette.
Version 1.0.16rc1 and 1.2.6rc1 [August 4, 2004] Version 1.0.16rc1 and 1.2.6rc1 [August 4, 2004]
Fixed buffer overflow vulnerability (CVE-2004-0597) in png_handle_tRNS(). Fixed buffer overflow vulnerability (CVE-2004-0597) in png_handle_tRNS().
@ -2296,7 +2295,7 @@ Version 1.4.0beta58 [May 14, 2009]
Clarified usage of sig_bit versus sig_bit_p in example.c (Vincent Torri) Clarified usage of sig_bit versus sig_bit_p in example.c (Vincent Torri)
Version 1.4.0beta59 [May 15, 2009] Version 1.4.0beta59 [May 15, 2009]
Reformated sources in libpng style (3-space intentation, comment format) Reformatted sources in libpng style (3-space indentation, comment format)
Fixed typo in libpng docs (PNG_FILTER_AVE should be PNG_FILTER_AVG) Fixed typo in libpng docs (PNG_FILTER_AVE should be PNG_FILTER_AVG)
Added sections about the git repository and our coding style to the Added sections about the git repository and our coding style to the
documentation documentation
@ -2662,7 +2661,7 @@ Version 1.4.1beta06 [January 28, 2010]
Version 1.4.1beta07 [February 6, 2010] Version 1.4.1beta07 [February 6, 2010]
Folded some long lines in the source files. Folded some long lines in the source files.
Added defineable PNG_USER_CHUNK_CACHE_MAX, PNG_USER_CHUNK_MALLOC_MAX, Added definable PNG_USER_CHUNK_CACHE_MAX, PNG_USER_CHUNK_MALLOC_MAX,
and a PNG_USER_LIMITS_SUPPORTED flag. and a PNG_USER_LIMITS_SUPPORTED flag.
Eliminated use of png_ptr->irowbytes and reused the slot in png_ptr as Eliminated use of png_ptr->irowbytes and reused the slot in png_ptr as
png_ptr->png_user_chunk_malloc_max. png_ptr->png_user_chunk_malloc_max.
@ -3259,7 +3258,7 @@ Version 1.5.2beta01 [February 13, 2011]
Revised PNG_EXPORTA macro to not use an empty parameter, to accommodate the Revised PNG_EXPORTA macro to not use an empty parameter, to accommodate the
old VisualC++ preprocessor. old VisualC++ preprocessor.
Turned on interlace handling in png_read_png(). Turned on interlace handling in png_read_png().
Fixed gcc pendantic warnings. Fixed gcc pedantic warnings.
Handle longjmp in Cygwin. Handle longjmp in Cygwin.
Fixed png_get_current_row_number() in the interlaced case. Fixed png_get_current_row_number() in the interlaced case.
Cleaned up ALPHA flags and transformations. Cleaned up ALPHA flags and transformations.
@ -3359,7 +3358,7 @@ Version 1.5.3beta05 [May 6, 2011]
Pass "" instead of '\0' to png_default_error() in png_err(). This mistake Pass "" instead of '\0' to png_default_error() in png_err(). This mistake
was introduced in libpng-1.2.20beta01. This fixes CVE-2011-2691. was introduced in libpng-1.2.20beta01. This fixes CVE-2011-2691.
Added PNG_WRITE_OPTIMIZE_CMF_SUPPORTED macro to make the zlib "CMF" byte Added PNG_WRITE_OPTIMIZE_CMF_SUPPORTED macro to make the zlib "CMF" byte
optimization configureable. optimization configurable.
IDAT compression failed if preceded by a compressed text chunk (bug IDAT compression failed if preceded by a compressed text chunk (bug
introduced in libpng-1.5.3beta01-02). This was because the attempt to introduced in libpng-1.5.3beta01-02). This was because the attempt to
reset the zlib stream in png_write_IDAT happened after the first IDAT reset the zlib stream in png_write_IDAT happened after the first IDAT
@ -3643,7 +3642,7 @@ Version 1.5.6beta05 [October 12, 2011]
Fixed bug in png_write_chunk_header() debug print, introduced in 1.5.6beta01. Fixed bug in png_write_chunk_header() debug print, introduced in 1.5.6beta01.
Version 1.5.6beta06 [October 17, 2011] Version 1.5.6beta06 [October 17, 2011]
Removed two redundant tests for unitialized row. Removed two redundant tests for uninitialized row.
Fixed a relatively harmless memory overwrite in compressed text writing Fixed a relatively harmless memory overwrite in compressed text writing
with a 1 byte zlib buffer. with a 1 byte zlib buffer.
Add ability to call png_read_update_info multiple times to pngvalid.c. Add ability to call png_read_update_info multiple times to pngvalid.c.
@ -3689,7 +3688,7 @@ Version 1.5.7beta01 [November 4, 2011]
crash. The pngmem.c implementation of png_malloc() included a cast crash. The pngmem.c implementation of png_malloc() included a cast
to png_size_t which would fail on large allocations on 16-bit systems. to png_size_t which would fail on large allocations on 16-bit systems.
Fix for the preprocessor of the Intel C compiler. The preprocessor Fix for the preprocessor of the Intel C compiler. The preprocessor
splits adjacent @ signs with a space; this changes the concatentation splits adjacent @ signs with a space; this changes the concatenation
token from @-@-@ to PNG_JOIN; that should work with all compiler token from @-@-@ to PNG_JOIN; that should work with all compiler
preprocessors. preprocessors.
Paeth filter speed improvements from work by Siarhei Siamashka. This Paeth filter speed improvements from work by Siarhei Siamashka. This
@ -3735,7 +3734,7 @@ Version 1.5.7beta03 [November 17, 2011]
gray (on palette) itself. gray (on palette) itself.
Fixes for C++ compilation using g++ When libpng source is compiled Fixes for C++ compilation using g++ When libpng source is compiled
using g++. The compiler imposes C++ rules on the C source; thus it using g++. The compiler imposes C++ rules on the C source; thus it
is desireable to make the source work with either C or C++ rules is desirable to make the source work with either C or C++ rules
without throwing away useful error information. This change adds without throwing away useful error information. This change adds
png_voidcast to allow C semantic (void*) cases or the corresponding png_voidcast to allow C semantic (void*) cases or the corresponding
C++ static_cast operation, as appropriate. C++ static_cast operation, as appropriate.
@ -3887,7 +3886,7 @@ Version 1.6.0beta06 [January 24, 2012]
Version 1.6.0beta07 [January 28, 2012] Version 1.6.0beta07 [January 28, 2012]
Eliminated Intel icc/icl compiler warnings. The Intel (GCC derived) Eliminated Intel icc/icl compiler warnings. The Intel (GCC derived)
compiler issues slightly different warnings from those issued by the compiler issues slightly different warnings from those issued by the
current vesions of GCC. This eliminates those warnings by current versions of GCC. This eliminates those warnings by
adding/removing casts and small code rewrites. adding/removing casts and small code rewrites.
Updated configure.ac from autoupdate: added --enable-werror option. Updated configure.ac from autoupdate: added --enable-werror option.
Also some layout regularization and removal of introduced tab characters Also some layout regularization and removal of introduced tab characters
@ -3920,7 +3919,7 @@ Version 1.6.0beta08 [February 1, 2012]
version checking to configure.ac version checking to configure.ac
Improved pngstest speed by not doing redundant tests and add const to Improved pngstest speed by not doing redundant tests and add const to
the background parameter of png_image_finish_read. The --background the background parameter of png_image_finish_read. The --background
option is now done automagically only when required, so that commandline option is now done automagically only when required, so that command-line
option no longer exists. option no longer exists.
Cleaned up pngpriv.h to consistently declare all functions and data. Cleaned up pngpriv.h to consistently declare all functions and data.
Also eliminated PNG_CONST_DATA, which is apparently not needed but we Also eliminated PNG_CONST_DATA, which is apparently not needed but we
@ -4061,7 +4060,7 @@ Version 1.6.0beta17 [March 10, 2012]
possible to call png_inflate() incrementally. A warning is no longer possible to call png_inflate() incrementally. A warning is no longer
issued if the language tag or translated keyword in the iTXt chunk issued if the language tag or translated keyword in the iTXt chunk
has zero length. has zero length.
If benign errors are disabled use maximum window on ancilliary inflate. If benign errors are disabled use maximum window on ancillary inflate.
This works round a bug introduced in 1.5.4 where compressed ancillary This works round a bug introduced in 1.5.4 where compressed ancillary
chunks could end up with a too-small windowBits value in the deflate chunks could end up with a too-small windowBits value in the deflate
header. header.
@ -4176,7 +4175,7 @@ Version 1.6.0beta27 [August 11, 2012]
declared even though the functions are never actually defined. This declared even though the functions are never actually defined. This
change provides a dummy definition so that the declarations work, yet any change provides a dummy definition so that the declarations work, yet any
implementation will fail to compile because of an incomplete type. implementation will fail to compile because of an incomplete type.
Re-eliminated the use of strcpy() in pngtest.c. An unncessary use of Re-eliminated the use of strcpy() in pngtest.c. An unnecessary use of
strcpy() was accidentally re-introduced in libpng16; this change replaces strcpy() was accidentally re-introduced in libpng16; this change replaces
it with strncpy(). it with strncpy().
Eliminated use of png_sizeof(); use sizeof() instead. Eliminated use of png_sizeof(); use sizeof() instead.
@ -4309,7 +4308,7 @@ Version 1.6.0beta31 [November 1, 2012]
resulting in VS2010 having to update the files. resulting in VS2010 having to update the files.
Removed non-working ICC profile support code that was mostly added to Removed non-working ICC profile support code that was mostly added to
libpng-1.6.0beta29 and beta30. There was too much code for too little libpng-1.6.0beta29 and beta30. There was too much code for too little
gain; implementing full ICC color correction may be desireable but is left gain; implementing full ICC color correction may be desirable but is left
up to applications. up to applications.
Version 1.6.0beta32 [November 25, 2012] Version 1.6.0beta32 [November 25, 2012]
@ -4592,7 +4591,7 @@ Version 1.6.3beta07 [June 8, 2013]
the optimizations ('check' vs 'api') are exposed in the public header files the optimizations ('check' vs 'api') are exposed in the public header files
except that the new setting PNG_ARM_NEON_OPT documents how libpng makes the except that the new setting PNG_ARM_NEON_OPT documents how libpng makes the
decision about whether or not to use the optimizations. decision about whether or not to use the optimizations.
Protect symbol prefixing against CC/CPPFLAGS/CFLAGS useage. Protect symbol prefixing against CC/CPPFLAGS/CFLAGS usage.
Previous iOS/Xcode fixes for the ARM NEON optimizations moved the test Previous iOS/Xcode fixes for the ARM NEON optimizations moved the test
on __ARM_NEON__ from configure time to compile time. This breaks symbol on __ARM_NEON__ from configure time to compile time. This breaks symbol
prefixing because the definition of the special png_init_filter_functions prefixing because the definition of the special png_init_filter_functions
@ -5635,7 +5634,7 @@ Version 1.6.24beta02 [June 23, 2016]
to All and adds a list of the warnings that need to be turned off. This is to All and adds a list of the warnings that need to be turned off. This is
semi-documentary; the intent is to tell libpng users which warnings have semi-documentary; the intent is to tell libpng users which warnings have
been examined and judged non-fixable at present. The warning about been examined and judged non-fixable at present. The warning about
structure padding is fixable, but it would be a signficant change (moving structure padding is fixable, but it would be a significant change (moving
structure members around). structure members around).
Version 1.6.24beta03 [July 4, 2016] Version 1.6.24beta03 [July 4, 2016]
@ -5781,7 +5780,7 @@ Version 1.6.28rc01 [January 3, 2017]
Added option to Cmake build allowing a custom location of zlib to be Added option to Cmake build allowing a custom location of zlib to be
specified in a scenario where libpng is being built as a subproject specified in a scenario where libpng is being built as a subproject
alongside zlib by another project (Sam Serrels). alongside zlib by another project (Sam Serrels).
Changed png_ptr->options from a png_byte to png_uint_32, to accomodate Changed png_ptr->options from a png_byte to png_uint_32, to accommodate
up to 16 options. up to 16 options.
Version 1.6.28rc02 [January 4, 2017] Version 1.6.28rc02 [January 4, 2017]
@ -5928,11 +5927,11 @@ Version 1.6.32beta03 [August 2, 2017]
(Bug report from the OSS-fuzz project). (Bug report from the OSS-fuzz project).
Version 1.6.32beta04 [August 2, 2017] Version 1.6.32beta04 [August 2, 2017]
Replaced local eXIf_buf with info_ptr-eXIf_buf in png_handle_eXIf(). Replaced local eXIf_buf with info_ptr->eXIf_buf in png_handle_eXIf().
Update libpng.3 and libpng-manual.txt about eXIf functions. Update libpng.3 and libpng-manual.txt about eXIf functions.
Version 1.6.32beta05 [August 2, 2017] Version 1.6.32beta05 [August 2, 2017]
Restored png_get_eXIf() and png_set_eXIf() to maintain API compatability. Restored png_get_eXIf() and png_set_eXIf() to maintain API compatibility.
Version 1.6.32beta06 [August 2, 2017] Version 1.6.32beta06 [August 2, 2017]
Removed png_get_eXIf_1() and png_set_eXIf_1(). Removed png_get_eXIf_1() and png_set_eXIf_1().
@ -6037,11 +6036,251 @@ Version 1.6.33 [September 28, 2017]
Initialize png_handler.row_ptr in contrib/oss-fuzz/libpng_read_fuzzer.cc Initialize png_handler.row_ptr in contrib/oss-fuzz/libpng_read_fuzzer.cc
Add end_info structure and png_read_end() to the libpng fuzzer. Add end_info structure and png_read_end() to the libpng fuzzer.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Version 1.6.34 [September 29, 2017]
(subscription required; visit Removed contrib/pngsuite/i*.png; some of them caused test failures.
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe)
or to glennrp at users.sourceforge.net
Glenn R-P Version 1.6.35beta01 [March 6, 2018]
#endif Restored 21 of the contrib/pngsuite/i*.png, which do not cause test
failures. Placed the remainder in contrib/pngsuite/interlaced/i*.png.
Added calls to png_set_*() transforms commonly used by browsers to
the fuzzer.
Removed some unnecessary brackets in pngrtran.c
Fixed miscellaneous typos (Patch by github user "luzpaz").
Change "ASM C" to "C ASM" in CMakeLists.txt
Fixed incorrect handling of bKGD chunk in sub-8-bit files (Cosmin)
Added hardware optimization directories to zip and 7z distributions.
Fixed incorrect bitmask for options.
Fixed many spelling typos.
Version 1.6.35beta02 [March 28, 2018]
Make png_get_iCCP consistent with man page (allow compression-type argument
to be NULL, bug report by Lenard Szolnoki).
Version 1.6.35 [July 15, 2018]
Replaced the remaining uses of png_size_t with size_t (Cosmin)
Fixed the calculation of row_factor in png_check_chunk_length
(reported by Thuan Pham in SourceForge issue #278)
Added missing parentheses to a macro definition
(suggested by "irwir" in GitHub issue #216)
Version 1.6.36 [December 1, 2018]
Optimized png_do_expand_palette for ARM processors.
Improved performance by around 10-22% on a recent ARM Chromebook.
(Contributed by Richard Townsend, ARM Holdings)
Fixed manipulation of machine-specific optimization options.
(Contributed by Vicki Pfau)
Used memcpy instead of manual pointer arithmetic on Intel SSE2.
(Contributed by Samuel Williams)
Fixed build errors with MSVC on ARM64.
(Contributed by Zhijie Liang)
Fixed detection of libm in CMakeLists.
(Contributed by Cameron Cawley)
Fixed incorrect creation of pkg-config file in CMakeLists.
(Contributed by Kyle Bentley)
Fixed the CMake build on Windows MSYS by avoiding symlinks.
Fixed a build warning on OpenBSD.
(Contributed by Theo Buehler)
Fixed various typos in comments.
(Contributed by "luz.paz")
Raised the minimum required CMake version from 3.0.2 to 3.1.
Removed yet more of the vestigial support for pre-ANSI C compilers.
Removed ancient makefiles for ancient systems that have been broken
across all previous libpng-1.6.x versions.
Removed the Y2K compliance statement and the export control
information.
Applied various code style and documentation fixes.
Version 1.6.37 [April 14, 2019]
Fixed a use-after-free vulnerability (CVE-2019-7317) in png_image_free.
Fixed a memory leak in the ARM NEON implementation of png_do_expand_palette.
Fixed a memory leak in pngtest.c.
Fixed two vulnerabilities (CVE-2018-14048, CVE-2018-14550) in
contrib/pngminus; refactor.
Changed the license of contrib/pngminus to MIT; refresh makefile and docs.
(Contributed by Willem van Schaik)
Fixed a typo in the libpng license v2.
(Contributed by Miguel Ojeda)
Added makefiles for AddressSanitizer-enabled builds.
Cleaned up various makefiles.
Version 1.6.38 [September 14, 2022]
Added configurations and scripts for continuous integration.
Fixed various errors in the handling of tRNS, hIST and eXIf.
Implemented many stability improvements across all platforms.
Updated the internal documentation.
Version 1.6.39 [November 20, 2022]
Changed the error handler of oversized chunks (i.e. larger than
PNG_USER_CHUNK_MALLOC_MAX) from png_chunk_error to png_benign_error.
Fixed a buffer overflow error in contrib/tools/pngfix.
Fixed a memory leak (CVE-2019-6129) in contrib/tools/pngcp.
Disabled the ARM Neon optimizations by default in the CMake file,
following the default behavior of the configure script.
Allowed configure.ac to work with the trunk version of autoconf.
Removed the support for "install" targets from the legacy makefiles;
removed the obsolete makefile.cegcc.
Cleaned up the code and updated the internal documentation.
Version 1.6.40 [June 21, 2023]
Fixed the eXIf chunk multiplicity checks.
Fixed a memory leak in pCAL processing.
Corrected the validity report about tRNS inside png_get_valid().
Fixed various build issues on *BSD, Mac and Windows.
Updated the configurations and the scripts for continuous integration.
Cleaned up the code, the build scripts, and the documentation.
Version 1.6.41 [January 24, 2024]
Added SIMD-optimized code for the LoongArch LSX hardware.
(Contributed by GuXiWei, JinBo and ZhangLixia)
Fixed the run-time discovery of MIPS MSA hardware.
(Contributed by Sui Jingfeng)
Fixed an off-by-one error in the function png_do_check_palette_indexes(),
which failed to recognize errors that might have existed in the first
column of a broken palette-encoded image. This was a benign regression
accidentally introduced in libpng-1.6.33. No pixel was harmed.
(Contributed by Adam Richter; reviewed by John Bowler)
Fixed, improved and modernized the contrib/pngminus programs, i.e.,
png2pnm.c and pnm2png.c
Removed old and peculiar portability hacks that were meant to silence
warnings issued by gcc version 7.1 alone.
(Contributed by John Bowler)
Fixed and modernized the CMake file, and raised the minimum required
CMake version from 3.1 to 3.6.
(Contributed by Clinton Ingram, Timothy Lyanguzov, Tyler Kropp, et al.)
Allowed the configure script to disable the building of auxiliary tools
and tests, thus catching up with the CMake file.
(Contributed by Carlo Bramini)
Fixed a build issue on Mac.
(Contributed by Zixu Wang)
Moved the Autoconf macro files to scripts/autoconf.
Moved the CMake files (except for the main CMakeLists.txt) to
scripts/cmake and moved the list of their contributing authors to
scripts/cmake/AUTHORS.md
Updated the CI configurations and scripts.
Relicensed the CI scripts to the MIT License.
Improved the test coverage.
(Contributed by John Bowler)
Version 1.6.42 [January 29, 2024]
Fixed the implementation of the macro function png_check_sig().
This was an API regression, introduced in libpng-1.6.41.
(Reported by Matthieu Darbois)
Fixed and updated the libpng manual.
Version 1.6.43 [February 23, 2024]
Fixed the row width check in png_check_IHDR().
This corrected a bug that was specific to the 16-bit platforms,
and removed a spurious compiler warning from the 64-bit builds.
(Reported by Jacek Caban; fixed by John Bowler)
Added eXIf chunk support to the push-mode reader in pngpread.c.
(Contributed by Chris Blume)
Added contrib/pngexif for the benefit of the users who would like
to inspect the content of eXIf chunks.
Added contrib/conftest/basic.dfa, a basic build-time configuration.
(Contributed by John Bowler)
Fixed a preprocessor condition in pngread.c that broke build-time
configurations like contrib/conftest/pngcp.dfa.
(Contributed by John Bowler)
Added CMake build support for LoongArch LSX.
(Contributed by GuXiWei)
Fixed a CMake build error that occurred under a peculiar state of the
dependency tree. This was a regression introduced in libpng-1.6.41.
(Contributed by Dan Rosser)
Marked the installed libpng headers as system headers in CMake.
(Contributed by Benjamin Buch)
Updated the build support for RISCOS.
(Contributed by Cameron Cawley)
Updated the makefiles to allow cross-platform builds to initialize
conventional make variables like AR and ARFLAGS.
Added various improvements to the CI scripts in areas like version
consistency verification and text linting.
Added version consistency verification to pngtest.c also.
Version 1.6.44 [September 12, 2024]
Hardened calculations in chroma handling to prevent overflows, and
relaxed a constraint in cHRM validation to accomodate the standard
ACES AP1 set of color primaries.
(Contributed by John Bowler)
Removed the ASM implementation of ARM Neon optimizations and updated
the build accordingly. Only the remaining C implementation shall be
used from now on, thus ensuring the support of the PAC/BTI security
features on ARM64.
(Contributed by Ross Burton and John Bowler)
Fixed the pickup of the PNG_HARDWARE_OPTIMIZATIONS option in the
CMake build on FreeBSD/amd64. This is an important performance fix
on this platform.
Applied various fixes and improvements to the CMake build.
(Contributed by Eric Riff, Benjamin Buch and Erik Scholz)
Added fuzzing targets for the simplified read API.
(Contributed by Mikhail Khachayants)
Fixed a build error involving pngtest.c under a custom config.
This was a regression introduced in a code cleanup in libpng-1.6.43.
(Contributed by Ben Wagner)
Fixed and improved the config files for AppVeyor CI and Travis CI.
Version 1.6.45 [January 7, 2025]
Added support for the cICP chunk.
(Contributed by Lucas Chollet and John Bowler)
Adjusted and improved various checks in colorspace calculations.
(Contributed by John Bowler)
Rearranged the write order of colorspace chunks for better conformance
with the PNG v3 draft specification.
(Contributed by John Bowler)
Raised the minimum required CMake version from 3.6 to 3.14.
Forked off a development branch for libpng version 1.8.
Version 1.6.46 [January 23, 2025]
Added support for the mDCV and cLLI chunks.
(Contributed by John Bowler)
Fixed a build issue affecting C89 compilers.
This was a regression introduced in libpng-1.6.45.
(Contributed by John Bowler)
Added makefile.c89, specifically for testing C89 compilers.
Cleaned up contrib/pngminus: corrected an old typo, removed an old
workaround, and updated the CMake file.
Version 1.6.47 [February 18, 2025]
Modified the behaviour of colorspace chunks in order to adhere
to the new precedence rules formulated in the latest draft of
the PNG Specification.
(Contributed by John Bowler)
Fixed a latent bug in `png_write_iCCP`.
This would have been a read-beyond-end-of-malloc vulnerability,
introduced early in the libpng-1.6.0 development, yet (fortunately!)
it was inaccessible before the above-mentioned modification of the
colorspace precedence rules, due to pre-existing colorspace checks.
(Reported by Bob Friesenhahn; fixed by John Bowler)
Version 1.6.48 [April 30, 2025]
Fixed the floating-point version of the mDCv setter `png_set_mDCv`.
(Reported by Mohit Bakshi; fixed by John Bowler)
Added #error directives to discourage the inclusion of private
libpng implementation header files in PNG-supporting applications.
Added the CMake build option `PNG_LIBCONF_HEADER`, to be used as an
alternative to `DFA_XTRA`.
Removed the Travis CI configuration files, with heartfelt thanks for
their generous support of our project over the past five years!
Version 1.6.49 [June 12, 2025]
Added SIMD-optimized code for the RISC-V Vector Extension (RVV).
(Contributed by Manfred Schlaegl, Dragos Tiselice and Filip Wasil)
Added various fixes and improvements to the build scripts and to
the sample code.
Version 1.6.50 [July 1, 2025]
Improved the detection of the RVV Extension on the RISC-V platform.
(Contributed by Filip Wasil)
Replaced inline ASM with C intrinsics in the RVV code.
(Contributed by Filip Wasil)
Fixed a decoder defect in which unknown chunks trailing IDAT, set
to go through the unknown chunk handler, incorrectly triggered
out-of-place IEND errors.
(Contributed by John Bowler)
Fixed the CMake file for cross-platform builds that require `libm`.
Version 1.6.51 [TODO]
Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
Subscription is required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe.

File diff suppressed because it is too large Load Diff

100
INSTALL
View File

@ -1,4 +1,3 @@
Installing libpng Installing libpng
Contents Contents
@ -128,16 +127,18 @@ Your directory structure should look like this:
README README
*.h, *.c => libpng source files *.h, *.c => libpng source files
CMakeLists.txt => "cmake" script CMakeLists.txt => "cmake" script
ci
ci_*.sh
configuration files: configuration files:
configure.ac, configure, Makefile.am, Makefile.in, configure.ac, configure, Makefile.am, Makefile.in,
autogen.sh, config.guess, ltmain.sh, missing, libpng.pc.in, autogen.sh, config.guess, ltmain.sh, missing, libpng.pc.in,
libpng-config.in, aclocal.m4, config.h.in, config.sub, libpng-config.in, aclocal.m4, config.h.in, config.sub,
depcomp, install-sh, mkinstalldirs, test-pngtest.sh depcomp, install-sh, mkinstalldirs, test-pngtest.sh, etc.
contrib contrib
arm-neon, conftest, examples, gregbook, libtests, pngminim, arm-neon, conftest, examples, gregbook, libtests, pngminim,
pngminus, pngsuite, tools, visupng pngminus, pngsuite, tools, visupng, riscv-rvv
projects projects
cbuilder5, owatcom, visualc71, vstudio, xcode owatcom, visualc71, vstudio
scripts scripts
makefile.* makefile.*
*.def (module definition files) *.def (module definition files)
@ -145,7 +146,7 @@ Your directory structure should look like this:
pngtest.png pngtest.png
etc. etc.
zlib zlib
README, *.h, *.c contrib, etc. README, *.h, *.c, contrib, etc.
If the line endings in the files look funny, you may wish to get the other If the line endings in the files look funny, you may wish to get the other
distribution of libpng. It is available in both tar.gz (UNIX style line distribution of libpng. It is available in both tar.gz (UNIX style line
@ -153,28 +154,27 @@ endings) and zip (DOS style line endings) formats.
VI. Building with project files VI. Building with project files
If you are building libpng with MSVC, you can enter the If you are building libpng with Microsoft Visual Studio, you can enter
libpng projects\visualc71 or vstudio directory and follow the instructions the directory projects\visualc71 or projects\vstudio and follow the
in README.txt. instructions in README.txt.
Otherwise enter the zlib directory and follow the instructions in zlib/README, Otherwise, enter the zlib directory and follow the instructions in
then come back here and run "configure" or choose the appropriate zlib/README, then come back here and run "configure" or choose the
makefile.sys in the scripts directory. appropriate makefile in the scripts directory.
VII. Building with makefiles VII. Building with makefiles
Copy the file (or files) that you need from the Copy the file (or files) that you need from the
scripts directory into this directory, for example scripts directory into this directory, for example
MSDOS example:
copy scripts\makefile.msc makefile
copy scripts\pnglibconf.h.prebuilt pnglibconf.h
UNIX example: UNIX example:
cp scripts/makefile.std makefile cp scripts/makefile.std Makefile
cp scripts/pnglibconf.h.prebuilt pnglibconf.h make
Windows example:
nmake -f scripts\makefile.vcwin32
Read the makefile to see if you need to change any source or Read the makefile to see if you need to change any source or
target directories to match your preferences. target directories to match your preferences.
@ -191,36 +191,33 @@ test. For more confidence, you can run another test by typing
Also, you can run "pngtest -m contrib/pngsuite/*.png" and compare Also, you can run "pngtest -m contrib/pngsuite/*.png" and compare
your output with the result shown in contrib/pngsuite/README. your output with the result shown in contrib/pngsuite/README.
Most of the makefiles will allow you to run "make install" to Most of the makefiles used to allow you to run "make install" to put
put the library in its final resting place (if you want to the library in its final resting place, but that feature is no longer
do that, run "make install" in the zlib directory first if necessary). supported. The only tested and supported manners to install libpng are
Some also allow you to run "make test-installed" after you have the conventional build and install procedures driven by the configure
run "make install". script or by the CMake file.
VIII. Configuring libpng for 16-bit platforms VIII. Configuring for DOS and other 16-bit platforms
You will want to look into zconf.h to tell zlib (and thus libpng) that Officially, the support for 16-bit platforms has been removed.
it cannot allocate more than 64K at a time. Even if you can, the memory
won't be accessible. So limit zlib and libpng to 64K by defining MAXSEG_64K.
IX. Configuring for DOS
For DOS users who only have access to the lower 640K, you will For DOS users who only have access to the lower 640K, you will
have to limit zlib's memory usage via a png_set_compression_mem_level() have to limit zlib's memory usage via a png_set_compression_mem_level()
call. See zlib.h or zconf.h in the zlib library for more information. call. See zlib.h or zconf.h in the zlib library for more information.
X. Configuring for Medium Model You may be or may not be in luck if you target the "large" memory model,
but all the smaller models ("small", "compact" and "medium") are known
to be unworkable. For DOS users who have access beyond the lower 640K,
a "flat" 32-bit DOS model (such as DJGPP) is strongly recommended.
Libpng's support for medium model has been tested on most of the popular For DOS users who only have access to the lower 640K, you will have to
compilers. Make sure MAXSEG_64K gets defined, USE_FAR_KEYWORD gets limit zlib's memory usage via a png_set_compression_mem_level() call.
defined, and FAR gets defined to far in pngconf.h, and you should be You will also have to look into zconf.h to tell zlib (and thus libpng)
all set. Everything in the library (except for zlib's structure) is that it cannot allocate more than 64K at a time. Even if you can, the
expecting far data. You must use the typedefs with the p or pp on memory won't be accessible. Therefore, you should limit zlib and libpng
the end for pointers (or at least look at them and be careful). Make to 64K by defining MAXSEG_64K.
note that the rows of data are defined as png_bytepp, which is
an "unsigned char far * far *".
XI. Prepending a prefix to exported symbols IX. Prepending a prefix to exported symbols
Starting with libpng-1.6.0, you can configure libpng (when using the Starting with libpng-1.6.0, you can configure libpng (when using the
"configure" script) to prefix all exported symbols by means of the "configure" script) to prefix all exported symbols by means of the
@ -231,7 +228,7 @@ identifier). This creates a set of macros in pnglibconf.h, so this is
transparent to applications; their function calls get transformed by transparent to applications; their function calls get transformed by
the macros to use the modified names. the macros to use the modified names.
XII. Configuring for compiler xxx: X. Configuring for compiler xxx:
All includes for libpng are in pngconf.h. If you need to add, change All includes for libpng are in pngconf.h. If you need to add, change
or delete an include, this is the place to do it. or delete an include, this is the place to do it.
@ -243,7 +240,7 @@ As of libpng-1.5.0, pngpriv.h also includes three other private header
files, pngstruct.h, pnginfo.h, and pngdebug.h, which contain material files, pngstruct.h, pnginfo.h, and pngdebug.h, which contain material
that previously appeared in the public headers. that previously appeared in the public headers.
XIII. Removing unwanted object code XI. Removing unwanted object code
There are a bunch of #define's in pngconf.h that control what parts of There are a bunch of #define's in pngconf.h that control what parts of
libpng are compiled. All the defines end in _SUPPORTED. If you are libpng are compiled. All the defines end in _SUPPORTED. If you are
@ -282,9 +279,9 @@ library to fail if they call functions not available in your library.
The size of the library itself should not be an issue, because only The size of the library itself should not be an issue, because only
those sections that are actually used will be loaded into memory. those sections that are actually used will be loaded into memory.
XIV. Enabling or disabling hardware optimizations XII. Enabling or disabling hardware optimizations
Certain hardware capabilites, such as the Intel SSE instructions, Certain hardware capabilities, such as the Intel SSE instructions,
are normally detected at run time. Enable them with configure options are normally detected at run time. Enable them with configure options
such as one of such as one of
@ -292,6 +289,7 @@ such as one of
--enable-mips-msa=yes --enable-mips-msa=yes
--enable-intel-sse=yes --enable-intel-sse=yes
--enable-powerpc-vsx=yes --enable-powerpc-vsx=yes
--enable-riscv-rvv=yes
or enable them all at once with or enable them all at once with
@ -304,6 +302,7 @@ or more of
CPPFLAGS += "-DPNG_MIPS_MSA" CPPFLAGS += "-DPNG_MIPS_MSA"
CPPFLAGS += "-DPNG_INTEL_SSE" CPPFLAGS += "-DPNG_INTEL_SSE"
CPPFLAGS += "-DPNG_POWERPC_VSX" CPPFLAGS += "-DPNG_POWERPC_VSX"
CPPFLAGS += "-DPNG_RISCV_RVV"
See for example scripts/makefile.linux-opt See for example scripts/makefile.linux-opt
@ -320,19 +319,21 @@ to disable a particular one,
or via compiler-command options such as or via compiler-command options such as
CPPFLAGS += "-DPNG_ARM_NEON_OPT=0, -DPNG_MIPS_MSA_OPT=0, CPPFLAGS += "-DPNG_ARM_NEON_OPT=0, -DPNG_MIPS_MSA_OPT=0,
-DPNG_INTEL_SSE_OPT=0, -DPNG_POWERPC_VSX_OPT=0" -DPNG_INTEL_SSE_OPT=0, -DPNG_POWERPC_VSX_OPT=0,
-DPNG_RISCV_RVV_OPT=0"
If you are using cmake, hardware optimizations are "on" If you are using cmake, hardware optimizations are "on"
by default. To disable them, use by default. To disable them, use
cmake . -DPNG_ARM_NEON=no -DPNG_INTEL_SSE=no \ cmake . -DPNG_ARM_NEON=no -DPNG_INTEL_SSE=no \
-DPNG_MIPS_MSA=no -DPNG_POWERPC_VSX=no -DPNG_MIPS_MSA=no -DPNG_POWERPC_VSX=no \
-DPNG_RISCV_RVV=no
or disable them all at once with or disable them all at once with
cmake . -DPNG_HARDWARE_OPTIMIZATIONS=no cmake . -DPNG_HARDWARE_OPTIMIZATIONS=no
XV. Changes to the build and configuration of libpng in libpng-1.5.x XIII. Changes to the build and configuration of libpng in libpng-1.5.x
Details of internal changes to the library code can be found in the CHANGES Details of internal changes to the library code can be found in the CHANGES
file and in the GIT repository logs. These will be of no concern to the vast file and in the GIT repository logs. These will be of no concern to the vast
@ -423,7 +424,7 @@ $PREFIX/include directory). Do not edit pnglibconf.h after you have built
libpng, because than the settings would not accurately reflect the settings libpng, because than the settings would not accurately reflect the settings
that were used to build libpng. that were used to build libpng.
XVI. Setjmp/longjmp issues XIV. Setjmp/longjmp issues
Libpng uses setjmp()/longjmp() for error handling. Unfortunately setjmp() Libpng uses setjmp()/longjmp() for error handling. Unfortunately setjmp()
is known to be not thread-safe on some platforms and we don't know of is known to be not thread-safe on some platforms and we don't know of
@ -441,7 +442,7 @@ This requires setjmp/longjmp, so you must either build the library
with PNG_SETJMP_SUPPORTED defined, or with PNG_SIMPLIFIED_READ_SUPPORTED with PNG_SETJMP_SUPPORTED defined, or with PNG_SIMPLIFIED_READ_SUPPORTED
and PNG_SIMPLIFIED_WRITE_SUPPORTED undefined. and PNG_SIMPLIFIED_WRITE_SUPPORTED undefined.
XVII. Common linking failures XV. Common linking failures
If your application fails to find libpng or zlib entries while linking: If your application fails to find libpng or zlib entries while linking:
@ -453,12 +454,13 @@ If your application fails to find libpng or zlib entries while linking:
If you are using the vstudio project, observe the WARNING in If you are using the vstudio project, observe the WARNING in
project/vstudio/README.txt. project/vstudio/README.txt.
XVIII. Other sources of information about libpng: XVI. Other sources of information about libpng:
Further information can be found in the README and libpng-manual.txt Further information can be found in the README and libpng-manual.txt
files, in the individual makefiles, in png.h, and the manual pages files, in the individual makefiles, in png.h, and the manual pages
libpng.3 and png.5. libpng.3 and png.5.
Copyright (c) 2022 Cosmin Truta
Copyright (c) 1998-2002,2006-2016 Glenn Randers-Pehrson Copyright (c) 1998-2002,2006-2016 Glenn Randers-Pehrson
This document is released under the libpng license. This document is released under the libpng license.
For conditions of distribution and use, see the disclaimer For conditions of distribution and use, see the disclaimer

177
LICENSE
View File

@ -1,53 +1,82 @@
COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
=========================================
This copy of the libpng notices is provided for your convenience. In case of PNG Reference Library License version 2
any discrepancy between this copy and the notices in the file png.h that is ---------------------------------------
included in the libpng distribution, the latter shall prevail.
COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: * Copyright (c) 1995-2025 The PNG Reference Library Authors.
* Copyright (c) 2018-2025 Cosmin Truta.
* Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
* Copyright (c) 1996-1997 Andreas Dilger.
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
If you modify libpng you may insert additional notices immediately following The software is supplied "as is", without warranty of any kind,
this sentence. express or implied, including, without limitation, the warranties
of merchantability, fitness for a particular purpose, title, and
non-infringement. In no event shall the Copyright owners, or
anyone distributing the software, be liable for any damages or
other liability, whether in contract, tort or otherwise, arising
from, out of, or in connection with the software, or the use or
other dealings in the software, even if advised of the possibility
of such damage.
This code is released under the libpng license. Permission is hereby granted to use, copy, modify, and distribute
this software, or portions hereof, for any purpose, without fee,
subject to the following restrictions:
libpng versions 1.0.7, July 1, 2000 through 1.6.33, September 28, 2017 are 1. The origin of this software must not be misrepresented; you
Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are must not claim that you wrote the original software. If you
use this software in a product, an acknowledgment in the product
documentation would be appreciated, but is not required.
2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software.
3. This Copyright notice may not be removed or altered from any
source or altered source distribution.
PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35)
-----------------------------------------------------------------------
libpng versions 1.0.7, July 1, 2000, through 1.6.35, July 15, 2018 are
Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are
derived from libpng-1.0.6, and are distributed according to the same derived from libpng-1.0.6, and are distributed according to the same
disclaimer and license as libpng-1.0.6 with the following individuals disclaimer and license as libpng-1.0.6 with the following individuals
added to the list of Contributing Authors: added to the list of Contributing Authors:
Simon-Pierre Cadieux Simon-Pierre Cadieux
Eric S. Raymond Eric S. Raymond
Mans Rullgard Mans Rullgard
Cosmin Truta Cosmin Truta
Gilles Vollant Gilles Vollant
James Yu James Yu
Mandar Sahastrabuddhe Mandar Sahastrabuddhe
Google Inc. Google Inc.
Vadim Barkov Vadim Barkov
and with the following additions to the disclaimer: and with the following additions to the disclaimer:
There is no warranty against interference with your enjoyment of the There is no warranty against interference with your enjoyment of
library or against infringement. There is no warranty that our the library or against infringement. There is no warranty that our
efforts or the library will fulfill any of your particular purposes efforts or the library will fulfill any of your particular purposes
or needs. This library is provided with all faults, and the entire or needs. This library is provided with all faults, and the entire
risk of satisfactory quality, performance, accuracy, and effort is with risk of satisfactory quality, performance, accuracy, and effort is
the user. with the user.
Some files in the "contrib" directory and some configure-generated Some files in the "contrib" directory and some configure-generated
files that are distributed with libpng have other copyright owners and files that are distributed with libpng have other copyright owners, and
are released under other open source licenses. are released under other open source licenses.
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
libpng-0.96, and are distributed according to the same disclaimer and libpng-0.96, and are distributed according to the same disclaimer and
license as libpng-0.96, with the following individuals added to the list license as libpng-0.96, with the following individuals added to the
of Contributing Authors: list of Contributing Authors:
Tom Lane Tom Lane
Glenn Randers-Pehrson Glenn Randers-Pehrson
Willem van Schaik Willem van Schaik
libpng versions 0.89, June 1996, through 0.96, May 1997, are libpng versions 0.89, June 1996, through 0.96, May 1997, are
Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88, Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
@ -55,14 +84,14 @@ and are distributed according to the same disclaimer and license as
libpng-0.88, with the following individuals added to the list of libpng-0.88, with the following individuals added to the list of
Contributing Authors: Contributing Authors:
John Bowler John Bowler
Kevin Bracey Kevin Bracey
Sam Bushell Sam Bushell
Magnus Holmgren Magnus Holmgren
Greg Roelofs Greg Roelofs
Tom Tanner Tom Tanner
Some files in the "scripts" directory have other copyright owners Some files in the "scripts" directory have other copyright owners,
but are released under this license. but are released under this license.
libpng versions 0.5, May 1995, through 0.88, January 1996, are libpng versions 0.5, May 1995, through 0.88, January 1996, are
@ -71,63 +100,35 @@ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
For the purposes of this copyright and license, "Contributing Authors" For the purposes of this copyright and license, "Contributing Authors"
is defined as the following set of individuals: is defined as the following set of individuals:
Andreas Dilger Andreas Dilger
Dave Martindale Dave Martindale
Guy Eric Schalnat Guy Eric Schalnat
Paul Schmidt Paul Schmidt
Tim Wegner Tim Wegner
The PNG Reference Library is supplied "AS IS". The Contributing Authors The PNG Reference Library is supplied "AS IS". The Contributing
and Group 42, Inc. disclaim all warranties, expressed or implied, Authors and Group 42, Inc. disclaim all warranties, expressed or
including, without limitation, the warranties of merchantability and of implied, including, without limitation, the warranties of
fitness for any purpose. The Contributing Authors and Group 42, Inc. merchantability and of fitness for any purpose. The Contributing
assume no liability for direct, indirect, incidental, special, exemplary, Authors and Group 42, Inc. assume no liability for direct, indirect,
or consequential damages, which may result from the use of the PNG incidental, special, exemplary, or consequential damages, which may
Reference Library, even if advised of the possibility of such damage. result from the use of the PNG Reference Library, even if advised of
the possibility of such damage.
Permission is hereby granted to use, copy, modify, and distribute this Permission is hereby granted to use, copy, modify, and distribute this
source code, or portions hereof, for any purpose, without fee, subject source code, or portions hereof, for any purpose, without fee, subject
to the following restrictions: to the following restrictions:
1. The origin of this source code must not be misrepresented. 1. The origin of this source code must not be misrepresented.
2. Altered versions must be plainly marked as such and must not 2. Altered versions must be plainly marked as such and must not
be misrepresented as being the original source. be misrepresented as being the original source.
3. This Copyright notice may not be removed or altered from any 3. This Copyright notice may not be removed or altered from any
source or altered source distribution. source or altered source distribution.
The Contributing Authors and Group 42, Inc. specifically permit, without The Contributing Authors and Group 42, Inc. specifically permit,
fee, and encourage the use of this source code as a component to without fee, and encourage the use of this source code as a component
supporting the PNG file format in commercial products. If you use this to supporting the PNG file format in commercial products. If you use
source code in a product, acknowledgment is not required but would be this source code in a product, acknowledgment is not required but would
appreciated. be appreciated.
END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
TRADEMARK:
The name "libpng" has not been registered by the Copyright owner
as a trademark in any jurisdiction. However, because libpng has
been distributed and maintained world-wide, continually since 1995,
the Copyright owner claims "common-law trademark protection" in any
jurisdiction where common-law trademark is recognized.
OSI CERTIFICATION:
Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
a certification mark of the Open Source Initiative. OSI has not addressed
the additional disclaimers inserted at version 1.0.7.
EXPORT CONTROL:
The Copyright owner believes that the Export Control Classification
Number (ECCN) for libpng is EAR99, which means not subject to export
controls or International Traffic in Arms Regulations (ITAR) because
it is open source, publicly available software, that does not contain
any encryption software. See the EAR, paragraphs 734.3(b)(3) and
734.7(b).
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
September 28, 2017

View File

@ -1,7 +1,7 @@
# Makefile.am, the source file for Makefile.in (and hence Makefile), is # Makefile.am, the source file for Makefile.in (and hence Makefile), is
# #
# Copyright (c) 2018-2025 Cosmin Truta
# Copyright (c) 2004-2016 Glenn Randers-Pehrson # Copyright (c) 2004-2016 Glenn Randers-Pehrson
# Last changed in libpng 1.6.25 [September 1, 2016]
# #
# This code is released under the libpng license. # This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer # For conditions of distribution and use, see the disclaimer
@ -9,16 +9,24 @@
PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
ACLOCAL_AMFLAGS = -I scripts ACLOCAL_AMFLAGS = -I scripts/autoconf
# test programs - run on make check, make distcheck # test programs - run on make check, make distcheck
if ENABLE_TESTS
check_PROGRAMS= pngtest pngunknown pngstest pngvalid pngimage pngcp check_PROGRAMS= pngtest pngunknown pngstest pngvalid pngimage pngcp
if HAVE_CLOCK_GETTIME if HAVE_CLOCK_GETTIME
check_PROGRAMS += timepng check_PROGRAMS += timepng
endif endif
else
check_PROGRAMS=
endif
# Utilities - installed # Utilities - installed
if ENABLE_TOOLS
bin_PROGRAMS= pngfix png-fix-itxt bin_PROGRAMS= pngfix png-fix-itxt
else
bin_PROGRAMS=
endif
# This ensures that pnglibconf.h gets built at the start of 'make all' or # This ensures that pnglibconf.h gets built at the start of 'make all' or
# 'make check', but it does not add dependencies to the individual programs, # 'make check', but it does not add dependencies to the individual programs,
@ -30,6 +38,7 @@ bin_PROGRAMS= pngfix png-fix-itxt
# always wrong and always very confusing. # always wrong and always very confusing.
BUILT_SOURCES = pnglibconf.h BUILT_SOURCES = pnglibconf.h
if ENABLE_TESTS
pngtest_SOURCES = pngtest.c pngtest_SOURCES = pngtest.c
pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
@ -48,19 +57,22 @@ pngimage_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
timepng_SOURCES = contrib/libtests/timepng.c timepng_SOURCES = contrib/libtests/timepng.c
timepng_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la timepng_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
pngcp_SOURCES = contrib/tools/pngcp.c
pngcp_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
endif
if ENABLE_TOOLS
pngfix_SOURCES = contrib/tools/pngfix.c pngfix_SOURCES = contrib/tools/pngfix.c
pngfix_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la pngfix_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
png_fix_itxt_SOURCES = contrib/tools/png-fix-itxt.c png_fix_itxt_SOURCES = contrib/tools/png-fix-itxt.c
endif
pngcp_SOURCES = contrib/tools/pngcp.c
pngcp_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
# Generally these are single line shell scripts to run a test with a particular # Generally these are single line shell scripts to run a test with a particular
# set of parameters: # set of parameters:
if ENABLE_TESTS
TESTS =\ TESTS =\
tests/pngtest\ tests/pngtest-all\
tests/pngtest-badpngs\
tests/pngvalid-gamma-16-to-8 tests/pngvalid-gamma-alpha-mode\ tests/pngvalid-gamma-16-to-8 tests/pngvalid-gamma-alpha-mode\
tests/pngvalid-gamma-background tests/pngvalid-gamma-expand16-alpha-mode\ tests/pngvalid-gamma-background tests/pngvalid-gamma-expand16-alpha-mode\
tests/pngvalid-gamma-expand16-background\ tests/pngvalid-gamma-expand16-background\
@ -76,6 +88,7 @@ TESTS =\
tests/pngunknown-discard tests/pngunknown-if-safe tests/pngunknown-sAPI\ tests/pngunknown-discard tests/pngunknown-if-safe tests/pngunknown-sAPI\
tests/pngunknown-sTER tests/pngunknown-save tests/pngunknown-vpAg\ tests/pngunknown-sTER tests/pngunknown-save tests/pngunknown-vpAg\
tests/pngimage-quick tests/pngimage-full tests/pngimage-quick tests/pngimage-full
endif
# man pages # man pages
dist_man_MANS= libpng.3 libpngpf.3 png.5 dist_man_MANS= libpng.3 libpngpf.3 png.5
@ -95,7 +108,8 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngerror.c\
if PNG_ARM_NEON if PNG_ARM_NEON
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += arm/arm_init.c\ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += arm/arm_init.c\
arm/filter_neon.S arm/filter_neon_intrinsics.c arm/filter_neon_intrinsics.c \
arm/palette_neon_intrinsics.c
endif endif
if PNG_MIPS_MSA if PNG_MIPS_MSA
@ -103,6 +117,13 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += mips/mips_init.c\
mips/filter_msa_intrinsics.c mips/filter_msa_intrinsics.c
endif endif
if PNG_MIPS_MMI
if !PNG_MIPS_MSA
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += mips/mips_init.c
endif
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += mips/filter_mmi_inline_assembly.c
endif
if PNG_INTEL_SSE if PNG_INTEL_SSE
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += intel/intel_init.c\ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += intel/intel_init.c\
intel/filter_sse2_intrinsics.c intel/filter_sse2_intrinsics.c
@ -113,6 +134,22 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += powerpc/powerpc_init.c\
powerpc/filter_vsx_intrinsics.c powerpc/filter_vsx_intrinsics.c
endif endif
if PNG_RISCV_RVV
noinst_LTLIBRARIES= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@rvv.la
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@rvv_la_SOURCES = riscv/riscv_init.c\
riscv/filter_rvv_intrinsics.c
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@rvv_la_CFLAGS = -march=rv64gv
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LIBADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@rvv.la
endif
if PNG_LOONGARCH_LSX
noinst_LTLIBRARIES= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx.la
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_SOURCES = loongarch/loongarch_lsx_init.c\
loongarch/filter_lsx_intrinsics.c
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_CFLAGS = -mlsx
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LIBADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx.la
endif
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined -export-dynamic \ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined -export-dynamic \
@ -133,6 +170,14 @@ else
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.sym libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.sym
endif endif
if PNG_RISCV_RVV
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES += libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@rvv.la
endif
if PNG_LOONGARCH_LSX
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES += libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx.la
endif
#distribute headers in /usr/include/libpng/* #distribute headers in /usr/include/libpng/*
pkgincludedir= $(includedir)/$(PNGLIB_BASENAME) pkgincludedir= $(includedir)/$(PNGLIB_BASENAME)
pkginclude_HEADERS= png.h pngconf.h pkginclude_HEADERS= png.h pngconf.h
@ -147,9 +192,9 @@ pkgconfig_DATA = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc
# from those directories being included. This only works if the configure is # from those directories being included. This only works if the configure is
# not done in the source directory! # not done in the source directory!
EXTRA_DIST= \ EXTRA_DIST= \
ANNOUNCE CHANGES INSTALL LICENSE README TODO \ ANNOUNCE AUTHORS CHANGES INSTALL LICENSE README TODO TRADEMARK \
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \ pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \ ${srcdir}/ci ${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
$(TESTS) $(XFAIL_TESTS) tests/pngstest \ $(TESTS) $(XFAIL_TESTS) tests/pngstest \
CMakeLists.txt example.c libpng-manual.txt CMakeLists.txt example.c libpng-manual.txt
@ -165,7 +210,7 @@ MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
config.sub configure depcomp install-sh ltmain.sh missing config.sub configure depcomp install-sh ltmain.sh missing
# PNG_COPTS give extra options for the C compiler to be used on all compilation # PNG_COPTS give extra options for the C compiler to be used on all compilation
# steps (unless targe_CFLAGS is specified; that will take precedence over # steps (unless target_CFLAGS is specified; that will take precedence over
# AM_CFLAGS) # AM_CFLAGS)
PNG_COPTS = @PNG_COPTS@ PNG_COPTS = @PNG_COPTS@
AM_CFLAGS = ${PNG_COPTS} AM_CFLAGS = ${PNG_COPTS}

2610
Makefile.in Normal file

File diff suppressed because it is too large Load Diff

350
README
View File

@ -1,56 +1,88 @@
README for libpng version 1.6.33 - September 28, 2017 (shared library 16.0) README for libpng version 1.6.51.git
See the note about version numbers near the top of png.h ====================================
See INSTALL for instructions on how to install libpng. See the note about version numbers near the top of `png.h`.
See `INSTALL` for instructions on how to install libpng.
Libpng comes in several distribution formats. Get libpng-*.tar.gz or Libpng comes in several distribution formats. Get `libpng-*.tar.gz`
libpng-*.tar.xz or if you want UNIX-style line endings in the text files, or `libpng-*.tar.xz` if you want UNIX-style line endings in the text
or lpng*.7z or lpng*.zip if you want DOS-style line endings. files, or `lpng*.7z` or `lpng*.zip` if you want DOS-style line endings.
Version 0.89 was the first official release of libpng. Don't let the For a detailed description on using libpng, read `libpng-manual.txt`.
fact that it's the first release fool you. The libpng library has been in For examples of libpng in a program, see `example.c` and `pngtest.c`.
extensive use and testing since mid-1995. By late 1997 it had For usage information and restrictions (what little they are) on libpng,
finally gotten to the stage where there hadn't been significant see `png.h`. For a description on using zlib (the compression library
changes to the API in some time, and people have a bad feeling about used by libpng) and zlib's restrictions, see `zlib.h`.
libraries with versions < 1.0. Version 1.0.0 was released in
March 1998.
**** You should use zlib 1.0.4 or later to run this, but it _may_ work with
Note that some of the changes to the png_info structure render this versions as old as zlib 0.95. Even so, there are bugs in older zlib
versions which can cause the output of invalid compression streams for
some images.
You should also note that zlib is a compression library that is useful
for more things than just PNG files. You can use zlib as a drop-in
replacement for `fread()` and `fwrite()`, if you are so inclined.
zlib should be available at the same place that libpng is, or at
https://zlib.net .
You may also want a copy of the PNG specification. It is available
as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find
these at http://www.libpng.org/pub/png/pngdocs.html .
This code is currently being archived at https://libpng.sourceforge.io
in the download area, and at http://libpng.download/src .
This release, based in a large way on Glenn's, Guy's and Andreas'
earlier work, was created and will be supported by myself and the PNG
development group.
Send comments, corrections and commendations to `png-mng-implement`
at `lists.sourceforge.net`. (Subscription is required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe.)
Send general questions about the PNG specification to `png-mng-misc`
at `lists.sourceforge.net`. (Subscription is required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-misc
to subscribe.)
Historical notes
----------------
The libpng library has been in extensive use and testing since mid-1995.
Version 0.89, published a year later, was the first official release.
By late 1997, it had finally gotten to the stage where there hadn't
been significant changes to the API in some time, and people have a bad
feeling about libraries with versions below 1.0. Version 1.0.0 was
released in March 1998.
Note that some of the changes to the `png_info` structure render this
version of the library binary incompatible with libpng-0.89 or version of the library binary incompatible with libpng-0.89 or
earlier versions if you are using a shared library. The type of the earlier versions if you are using a shared library. The type of the
"filler" parameter for png_set_filler() has changed from png_byte to `filler` parameter for `png_set_filler()` has changed from `png_byte`
png_uint_32, which will affect shared-library applications that use to `png_uint_32`, which will affect shared-library applications that
this function. use this function.
To avoid problems with changes to the internals of the png info_struct, To avoid problems with changes to the internals of the `info_struct`,
new APIs have been made available in 0.95 to avoid direct application new APIs have been made available in 0.95 to avoid direct application
access to info_ptr. These functions are the png_set_<chunk> and access to `info_ptr`. These functions are the `png_set_<chunk>` and
png_get_<chunk> functions. These functions should be used when `png_get_<chunk>` functions. These functions should be used when
accessing/storing the info_struct data, rather than manipulating it accessing/storing the `info_struct` data, rather than manipulating it
directly, to avoid such problems in the future. directly, to avoid such problems in the future.
It is important to note that the APIs did not make current programs It is important to note that the APIs did not make current programs
that access the info struct directly incompatible with the new that access the info struct directly incompatible with the new
library, through libpng-1.2.x. In libpng-1.4.x, which was meant to library, through libpng-1.2.x. In libpng-1.4.x, which was meant to
be a transitional release, members of the png_struct and the be a transitional release, members of the `png_struct` and the
info_struct can still be accessed, but the compiler will issue a `info_struct` can still be accessed, but the compiler will issue a
warning about deprecated usage. Since libpng-1.5.0, direct access warning about deprecated usage. Since libpng-1.5.0, direct access
to these structs is not allowed, and the definitions of the structs to these structs is not allowed, and the definitions of the structs
reside in private pngstruct.h and pnginfo.h header files that are not reside in private `pngstruct.h` and `pnginfo.h` header files that are
accessible to applications. It is strongly suggested that new not accessible to applications. It is strongly suggested that new
programs use the new APIs (as shown in example.c and pngtest.c), and programs use the new APIs (as shown in `example.c` and `pngtest.c`),
older programs be converted to the new format, to facilitate upgrades and older programs be converted to the new format, to facilitate
in the future. upgrades in the future.
****
Additions since 0.90 include the ability to compile libpng as a
Windows DLL, and new APIs for accessing data in the info struct.
Experimental functions include the ability to set weighting and cost
factors for row filter selection, direct reads of integers from buffers
on big-endian processors that support misaligned data access, faster
methods of doing alpha composition, and more accurate 16->8 bit color
conversion.
The additions since 0.89 include the ability to read from a PNG stream The additions since 0.89 include the ability to read from a PNG stream
which has had some (or all) of the signature bytes read by the calling which has had some (or all) of the signature bytes read by the calling
@ -60,163 +92,93 @@ the library action on the detection of chunk CRC errors. It is possible
to set different actions based on whether the CRC error occurred in a to set different actions based on whether the CRC error occurred in a
critical or an ancillary chunk. critical or an ancillary chunk.
The changes made to the library, and bugs fixed are based on discussions The additions since 0.90 include the ability to compile libpng as a
on the PNG-implement mailing list and not on material submitted Windows DLL, and new APIs for accessing data in the `info_struct`.
privately to Guy, Andreas, or Glenn. They will forward any good Experimental functions included the ability to set weighting and cost
suggestions to the list. factors for row filter selection, direct reads of integers from buffers
on big-endian processors that support misaligned data access, faster
methods of doing alpha composition, and more accurate 16-to-8 bit color
conversion. Some of these experimental functions, such as the weighted
filter heuristics, have since been removed.
For a detailed description on using libpng, read libpng-manual.txt. For Files included in this distribution
examples of libpng in a program, see example.c and pngtest.c. For usage -----------------------------------
information and restrictions (what little they are) on libpng, see
png.h. For a description on using zlib (the compression library used by
libpng) and zlib's restrictions, see zlib.h
I have included a general makefile, as well as several machine and ANNOUNCE => Announcement of this version, with recent changes
compiler specific ones, but you may have to modify one for your own needs. AUTHORS => List of contributing authors
CHANGES => Description of changes between libpng versions
INSTALL => Instructions to install libpng
LICENSE => License to use and redistribute libpng
README => This file
TODO => Things not implemented in the current library
TRADEMARK => Trademark information
example.c => Example code for using libpng functions
libpng.3 => Manual page for libpng (includes libpng-manual.txt)
libpng-manual.txt => Description of libpng and its functions
libpngpf.3 => Manual page for libpng's private functions (deprecated)
png.5 => Manual page for the PNG format
png.c => Basic interface functions common to library
png.h => Library function and interface declarations (public)
pngpriv.h => Library function and interface declarations (private)
pngconf.h => System specific library configuration (public)
pngstruct.h => png_struct declaration (private)
pnginfo.h => png_info struct declaration (private)
pngdebug.h => debugging macros (private)
pngerror.c => Error/warning message I/O functions
pngget.c => Functions for retrieving info from struct
pngmem.c => Memory handling functions
pngbar.png => PNG logo, 88x31
pngnow.png => PNG logo, 98x31
pngpread.c => Progressive reading functions
pngread.c => Read data/helper high-level functions
pngrio.c => Lowest-level data read I/O functions
pngrtran.c => Read data transformation functions
pngrutil.c => Read data utility functions
pngset.c => Functions for storing data into the info_struct
pngtest.c => Library test program
pngtest.png => Library test sample image
pngtrans.c => Common data transformation functions
pngwio.c => Lowest-level write I/O functions
pngwrite.c => High-level write functions
pngwtran.c => Write data transformations
pngwutil.c => Write utility functions
arm/ => Optimized code for ARM Neon
intel/ => Optimized code for INTEL SSE2
loongarch/ => Optimized code for LoongArch LSX
mips/ => Optimized code for MIPS MSA and MIPS MMI
powerpc/ => Optimized code for PowerPC VSX
riscv/ => Optimized code for the RISC-V platform
ci/ => Scripts for continuous integration
contrib/ => External contributions
arm-neon/ => Optimized code for the ARM-NEON platform
mips-msa/ => Optimized code for the MIPS-MSA platform
powerpc-vsx/ => Optimized code for the POWERPC-VSX platform
examples/ => Examples of libpng usage
gregbook/ => Source code for PNG reading and writing, from
"PNG: The Definitive Guide" by Greg Roelofs,
O'Reilly, 1999
libtests/ => Test programs
pngexif/ => Program to inspect the EXIF information in PNG files
pngminim/ => Minimal decoder, encoder, and progressive decoder
programs demonstrating the use of pngusr.dfa
pngminus/ => Simple pnm2png and png2pnm programs
pngsuite/ => Test images
riscv-rvv/ => Optimized code for the RISC-V Vector platform
testpngs/ => Test images
tools/ => Various tools
visupng/ => VisualPng, a Windows viewer for PNG images
projects/ => Project files and workspaces for various IDEs
owatcom/ => OpenWatcom project
visualc71/ => Microsoft Visual C++ 7.1 workspace
vstudio/ => Microsoft Visual Studio workspace
scripts/ => Scripts and makefiles for building libpng
(see scripts/README.txt for the complete list)
tests/ => Test scripts
You should use zlib 1.0.4 or later to run this, but it MAY work with Good luck, and happy coding!
versions as old as zlib 0.95. Even so, there are bugs in older zlib
versions which can cause the output of invalid compression streams for
some images. You will definitely need zlib 1.0.4 or later if you are
taking advantage of the MS-DOS "far" structure allocation for the small
and medium memory models. You should also note that zlib is a
compression library that is useful for more things than just PNG files.
You can use zlib as a drop-in replacement for fread() and fwrite() if
you are so inclined.
zlib should be available at the same place that libpng is, or at zlib.net. * Cosmin Truta (current maintainer, since 2018)
* Glenn Randers-Pehrson (former maintainer, 1998-2018)
You may also want a copy of the PNG specification. It is available * Andreas Eric Dilger (former maintainer, 1996-1997)
as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find * Guy Eric Schalnat (original author and former maintainer, 1995-1996)
these at http://www.libpng.org/pub/png/pngdocs.html . (formerly of Group 42, Inc.)
This code is currently being archived at libpng.sourceforge.io in the
[DOWNLOAD] area, and at http://libpng.download/src . If you
can't find it in any of those places, e-mail me, and I'll help you find it.
I am not a lawyer, but I believe that the Export Control Classification
Number (ECCN) for libpng is EAR99, which means not subject to export
controls or International Traffic in Arms Regulations (ITAR) because it
is open source, publicly available software, that does not contain any
encryption software. See the EAR, paragraphs 734.3(b)(3) and 734.7(b).
If you have any code changes, requests, problems, etc., please e-mail
them to me. Also, I'd appreciate any make files or project files,
and any modifications you needed to make to get libpng to compile,
along with a #define variable to tell what compiler/system you are on.
If you needed to add transformations to libpng, or wish libpng would
provide the image in a different way, drop me a note (and code, if
possible), so I can consider supporting the transformation.
Finally, if you get any warning messages when compiling libpng
(note: not zlib), and they are easy to fix, I'd appreciate the
fix. Please mention "libpng" somewhere in the subject line. Thanks.
This release was created and will be supported by myself (of course
based in a large way on Guy's and Andreas' earlier work), and the PNG
development group.
Send comments/corrections/commendations to png-mng-implement at
lists.sourceforge.net (subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe) or to glennrp at users.sourceforge.net
You can't reach Guy, the original libpng author, at the addresses
given in previous versions of this document. He and Andreas will
read mail addressed to the png-implement list, however.
Please do not send general questions about PNG. Send them to
png-mng-misc at lists.sf.net (subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-misc to
subscribe). If you have a question about something
in the PNG specification that is related to using libpng, send it
to me. Send me any questions that start with "I was using libpng,
and ...". If in doubt, send questions to me. I'll bounce them
to others, if necessary.
Please do not send suggestions on how to change PNG. We have
been discussing PNG for twenty years now, and it is official and
finished. If you have suggestions for libpng, however, I'll
gladly listen. Even if your suggestion is not used immediately,
it may be used later.
Files in this distribution:
ANNOUNCE => Announcement of this version, with recent changes
CHANGES => Description of changes between libpng versions
KNOWNBUG => List of known bugs and deficiencies
LICENSE => License to use and redistribute libpng
README => This file
TODO => Things not implemented in the current library
Y2KINFO => Statement of Y2K compliance
example.c => Example code for using libpng functions
libpng.3 => manual page for libpng (includes libpng-manual.txt)
libpng-manual.txt => Description of libpng and its functions
libpngpf.3 => manual page for libpng's private functions
png.5 => manual page for the PNG format
png.c => Basic interface functions common to library
png.h => Library function and interface declarations (public)
pngpriv.h => Library function and interface declarations (private)
pngconf.h => System specific library configuration (public)
pngstruct.h => png_struct declaration (private)
pnginfo.h => png_info struct declaration (private)
pngdebug.h => debugging macros (private)
pngerror.c => Error/warning message I/O functions
pngget.c => Functions for retrieving info from struct
pngmem.c => Memory handling functions
pngbar.png => PNG logo, 88x31
pngnow.png => PNG logo, 98x31
pngpread.c => Progressive reading functions
pngread.c => Read data/helper high-level functions
pngrio.c => Lowest-level data read I/O functions
pngrtran.c => Read data transformation functions
pngrutil.c => Read data utility functions
pngset.c => Functions for storing data into the info_struct
pngtest.c => Library test program
pngtest.png => Library test sample image
pngtrans.c => Common data transformation functions
pngwio.c => Lowest-level write I/O functions
pngwrite.c => High-level write functions
pngwtran.c => Write data transformations
pngwutil.c => Write utility functions
arm => Contains optimized code for the ARM platform
powerpc => Contains optimized code for the PowerPC platform
contrib => Contributions
arm-neon => Optimized code for ARM-NEON platform
powerpc-vsx => Optimized code for POWERPC-VSX platform
examples => Example programs
gregbook => source code for PNG reading and writing, from
Greg Roelofs' "PNG: The Definitive Guide",
O'Reilly, 1999
libtests => Test programs
mips-msa => Optimized code for MIPS-MSA platform
pngminim => Minimal decoder, encoder, and progressive decoder
programs demonstrating use of pngusr.dfa
pngminus => Simple pnm2png and png2pnm programs
pngsuite => Test images
testpngs
tools => Various tools
visupng => Contains a MSVC workspace for VisualPng
intel => Optimized code for INTEL-SSE2 platform
mips => Optimized code for MIPS platform
projects => Contains project files and workspaces for
building a DLL
owatcom => Contains a WATCOM project for building libpng
visualc71 => Contains a Microsoft Visual C++ (MSVC)
workspace for building libpng and zlib
vstudio => Contains a Microsoft Visual C++ (MSVC)
workspace for building libpng and zlib
scripts => Directory containing scripts for building libpng:
(see scripts/README.txt for the list of scripts)
Good luck, and happy coding.
-Glenn Randers-Pehrson (current maintainer, since 1998)
Internet: glennrp at users.sourceforge.net
-Andreas Eric Dilger (former maintainer, 1996-1997)
Internet: adilger at enel.ucalgary.ca
Web: http://www-mddsp.enel.ucalgary.ca/People/adilger/
-Guy Eric Schalnat (original author and former maintainer, 1995-1996)
(formerly of Group 42, Inc)
Internet: gschal at infinet.com

50
TODO
View File

@ -1,30 +1,22 @@
/* TODO list for libpng
TODO - list of things to do for libpng: --------------------
Final bug fixes. * Fix all defects (duh!)
Better C++ wrapper/full C++ implementation? * cHRM transformation.
Fix problem with C++ and EXTERN "C". * Palette creation.
cHRM transformation. * "grayscale->palette" transformation and "palette->grayscale" detection.
Remove setjmp/longjmp usage in favor of returning error codes. As a start on * Improved dithering.
this, minimize the use of png_error(), replacing them with * Multi-lingual error and warning message support.
png_warning(); return(0); or similar. * Complete sRGB transformation. (Currently it simply uses gamma=0.45455.)
Palette creation. * Man pages for function calls.
Add "grayscale->palette" transformation and "palette->grayscale" detection. * Better documentation.
Improved dithering. * Better filter selection
Multi-lingual error and warning message support. (e.g., counting huffman bits/precompression; filter inertia; filter costs).
Complete sRGB transformation (presently it simply uses gamma=0.45455). * Histogram creation.
Man pages for function calls. * Text conversion between different code pages (e.g., Latin-1 to Mac).
Better documentation. * Avoid building gamma tables whenever possible.
Better filter selection * Greater precision in changing to linear gamma for compositing against
(counting huffman bits/precompression? filter inertia? filter costs?). background, and in doing rgb-to-gray transformations.
Histogram creation. * Investigate pre-incremented loop counters and other loop constructions.
Text conversion between different code pages (Latin-1 -> Mac and DOS). * Interpolated method of handling interlacing.
Avoid building gamma tables whenever possible. * More validations for libpng transformations.
Use greater precision when changing to linear gamma for compositing against
background and doing rgb-to-gray transformation.
Investigate pre-incremented loop counters and other loop constructions.
Add interpolated method of handling interlacing.
Extend pngvalid.c to validate more of the libpng transformations.
Refactor preprocessor conditionals to compile entire statements
*/

8
TRADEMARK Normal file
View File

@ -0,0 +1,8 @@
TRADEMARK
=========
The name "libpng" has not been registered by the Copyright owners
as a trademark in any jurisdiction. However, because libpng has
been distributed and maintained world-wide, continually since 1995,
the Copyright owners claim "common-law trademark protection" in any
jurisdiction where common-law trademark is recognized.

1378
aclocal.m4 vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,17 +1,15 @@
/* arm_init.c - NEON optimised filter functions /* arm_init.c - NEON optimised filter functions
* *
* Copyright (c) 2018-2022 Cosmin Truta
* Copyright (c) 2014,2016 Glenn Randers-Pehrson * Copyright (c) 2014,2016 Glenn Randers-Pehrson
* Written by Mans Rullgard, 2011. * Written by Mans Rullgard, 2011.
* Last changed in libpng 1.6.22 [May 26, 2016]
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
* and license in png.h * and license in png.h
*/ */
/* Below, after checking __linux__, various non-C90 POSIX 1003.1 functions are
* called. /* This module requires POSIX 1003.1 functions. */
*/
#define _POSIX_SOURCE 1 #define _POSIX_SOURCE 1
#include "../pngpriv.h" #include "../pngpriv.h"
@ -32,25 +30,30 @@
* has partial support is contrib/arm-neon/linux.c - a generic Linux * has partial support is contrib/arm-neon/linux.c - a generic Linux
* implementation which reads /proc/cpufino. * implementation which reads /proc/cpufino.
*/ */
#include <signal.h> /* for sig_atomic_t */
#ifndef PNG_ARM_NEON_FILE #ifndef PNG_ARM_NEON_FILE
# ifdef __linux__ # if defined(__aarch64__) || defined(_M_ARM64)
# define PNG_ARM_NEON_FILE "contrib/arm-neon/linux.c" /* ARM Neon is expected to be unconditionally available on ARM64. */
# error PNG_ARM_NEON_CHECK_SUPPORTED must not be defined on ARM64
# elif defined(__ARM_NEON__) || defined(__ARM_NEON)
/* ARM Neon is expected to be available on the target CPU architecture. */
# error PNG_ARM_NEON_CHECK_SUPPORTED must not be defined on this CPU arch
# elif defined(__linux__)
# define PNG_ARM_NEON_FILE "contrib/arm-neon/linux.c"
# else
# error No support for run-time ARM Neon checking; use compile-time options
# endif # endif
#endif #endif
#ifdef PNG_ARM_NEON_FILE
#include <signal.h> /* for sig_atomic_t */
static int png_have_neon(png_structp png_ptr); static int png_have_neon(png_structp png_ptr);
#include PNG_ARM_NEON_FILE #ifdef PNG_ARM_NEON_FILE
# include PNG_ARM_NEON_FILE
#else /* PNG_ARM_NEON_FILE */ #endif
# error "PNG_ARM_NEON_FILE undefined: no support for run-time ARM NEON checks"
#endif /* PNG_ARM_NEON_FILE */
#endif /* PNG_ARM_NEON_CHECK_SUPPORTED */ #endif /* PNG_ARM_NEON_CHECK_SUPPORTED */
#ifndef PNG_ALIGNED_MEMORY_SUPPORTED #ifndef PNG_ALIGNED_MEMORY_SUPPORTED
# error "ALIGNED_MEMORY is required; set: -DPNG_ALIGNED_MEMORY_SUPPORTED" # error ALIGNED_MEMORY is required; please define PNG_ALIGNED_MEMORY_SUPPORTED
#endif #endif
void void

View File

@ -1,253 +1,60 @@
/* filter_neon.S - placeholder file
/* filter_neon.S - NEON optimised filter functions
* *
* Copyright (c) 2014,2017 Glenn Randers-Pehrson * Copyright (c) 2024 Cosmin Truta
* Written by Mans Rullgard, 2011.
* Last changed in libpng 1.6.31 [July 27, 2017]
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
* and license in png.h * and license in png.h
*/ */
/* IMPORTANT NOTE:
*
* Historically, the hand-coded assembler implementation of Neon optimizations
* in this module had not been in sync with the intrinsics-based implementation
* in filter_neon_intrinsics.c and palette_neon_intrinsics.c, at least since
* the introduction of riffled palette optimizations. Moreover, the assembler
* code used to work on 32-bit ARM only, and it caused problems, even if empty,
* on 64-bit ARM.
*
* All references to this module from our internal build scripts and projects
* have been removed.
*
* For the external projects that might still expect this module to be present,
* we leave this stub in place, for the remaining lifetime of libpng-1.6.x.
* Everything should continue to function normally, as long as there are no
* deliberate attempts to use the old hand-made assembler code. A build error
* will be raised otherwise.
*/
/* This is required to get the symbol renames, which are #defines, and the /* This is required to get the symbol renames, which are #defines, and the
* definitions (or not) of PNG_ARM_NEON_OPT and PNG_ARM_NEON_IMPLEMENTATION. * definitions (or not) of PNG_ARM_NEON_OPT and PNG_ARM_NEON_IMPLEMENTATION.
*/ */
#define PNG_VERSION_INFO_ONLY #define PNG_VERSION_INFO_ONLY
#include "../pngpriv.h" #include "../pngpriv.h"
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits /* mark stack as non-executable */
#endif
#ifdef PNG_READ_SUPPORTED #ifdef PNG_READ_SUPPORTED
/* Assembler NEON support - only works for 32-bit ARM (i.e. it does not work for
* ARM64). The code in arm/filter_neon_intrinsics.c supports ARM64, however it
* only works if -mfpu=neon is specified on the GCC command line. See pngpriv.h
* for the logic which sets PNG_USE_ARM_NEON_ASM:
*/
#if PNG_ARM_NEON_IMPLEMENTATION == 2 /* hand-coded assembler */ #if PNG_ARM_NEON_IMPLEMENTATION == 2 /* hand-coded assembler */
#if PNG_ARM_NEON_OPT > 0 #if PNG_ARM_NEON_OPT > 0
#ifdef __ELF__ #if defined(__clang__)
# define ELF #define GNUC_VERSION 0 /* not gcc, although it might pretend to be */
#elif defined(__GNUC__)
#define GNUC_MAJOR (__GNUC__ + 0)
#define GNUC_MINOR (__GNUC_MINOR__ + 0)
#define GNUC_PATCHLEVEL (__GNUC_PATCHLEVEL__ + 0)
#define GNUC_VERSION (GNUC_MAJOR * 10000 + GNUC_MINOR * 100 + GNUC_PATCHLEVEL)
#else #else
# define ELF @ #define GNUC_VERSION 0 /* not gcc */
#endif #endif
.arch armv7-a #if (GNUC_VERSION > 0) && (GNUC_VERSION < 40300)
.fpu neon #error "PNG_ARM_NEON is not supported with gcc versions earlier than 4.3.0"
#elif GNUC_VERSION == 40504
#error "PNG_ARM_NEON is not supported with gcc version 4.5.4"
#else
#error "Please use 'arm/*_neon_intrinsics.c' for PNG_ARM_NEON support"
#endif
.macro func name, export=0
.macro endfunc
ELF .size \name, . - \name
.endfunc
.purgem endfunc
.endm
.text
/* Explicitly specifying alignment here because some versions of
* GAS don't align code correctly. This is harmless in correctly
* written versions of GAS.
*/
.align 2
.if \export
.global \name
.endif
ELF .type \name, STT_FUNC
.func \name
\name:
.endm
func png_read_filter_row_sub4_neon, export=1
ldr r3, [r0, #4] @ rowbytes
vmov.i8 d3, #0
1:
vld4.32 {d4[],d5[],d6[],d7[]}, [r1,:128]
vadd.u8 d0, d3, d4
vadd.u8 d1, d0, d5
vadd.u8 d2, d1, d6
vadd.u8 d3, d2, d7
vst4.32 {d0[0],d1[0],d2[0],d3[0]},[r1,:128]!
subs r3, r3, #16
bgt 1b
bx lr
endfunc
func png_read_filter_row_sub3_neon, export=1
ldr r3, [r0, #4] @ rowbytes
vmov.i8 d3, #0
mov r0, r1
mov r2, #3
mov r12, #12
vld1.8 {q11}, [r0], r12
1:
vext.8 d5, d22, d23, #3
vadd.u8 d0, d3, d22
vext.8 d6, d22, d23, #6
vadd.u8 d1, d0, d5
vext.8 d7, d23, d23, #1
vld1.8 {q11}, [r0], r12
vst1.32 {d0[0]}, [r1,:32], r2
vadd.u8 d2, d1, d6
vst1.32 {d1[0]}, [r1], r2
vadd.u8 d3, d2, d7
vst1.32 {d2[0]}, [r1], r2
vst1.32 {d3[0]}, [r1], r2
subs r3, r3, #12
bgt 1b
bx lr
endfunc
func png_read_filter_row_up_neon, export=1
ldr r3, [r0, #4] @ rowbytes
1:
vld1.8 {q0}, [r1,:128]
vld1.8 {q1}, [r2,:128]!
vadd.u8 q0, q0, q1
vst1.8 {q0}, [r1,:128]!
subs r3, r3, #16
bgt 1b
bx lr
endfunc
func png_read_filter_row_avg4_neon, export=1
ldr r12, [r0, #4] @ rowbytes
vmov.i8 d3, #0
1:
vld4.32 {d4[],d5[],d6[],d7[]}, [r1,:128]
vld4.32 {d16[],d17[],d18[],d19[]},[r2,:128]!
vhadd.u8 d0, d3, d16
vadd.u8 d0, d0, d4
vhadd.u8 d1, d0, d17
vadd.u8 d1, d1, d5
vhadd.u8 d2, d1, d18
vadd.u8 d2, d2, d6
vhadd.u8 d3, d2, d19
vadd.u8 d3, d3, d7
vst4.32 {d0[0],d1[0],d2[0],d3[0]},[r1,:128]!
subs r12, r12, #16
bgt 1b
bx lr
endfunc
func png_read_filter_row_avg3_neon, export=1
push {r4,lr}
ldr r12, [r0, #4] @ rowbytes
vmov.i8 d3, #0
mov r0, r1
mov r4, #3
mov lr, #12
vld1.8 {q11}, [r0], lr
1:
vld1.8 {q10}, [r2], lr
vext.8 d5, d22, d23, #3
vhadd.u8 d0, d3, d20
vext.8 d17, d20, d21, #3
vadd.u8 d0, d0, d22
vext.8 d6, d22, d23, #6
vhadd.u8 d1, d0, d17
vext.8 d18, d20, d21, #6
vadd.u8 d1, d1, d5
vext.8 d7, d23, d23, #1
vld1.8 {q11}, [r0], lr
vst1.32 {d0[0]}, [r1,:32], r4
vhadd.u8 d2, d1, d18
vst1.32 {d1[0]}, [r1], r4
vext.8 d19, d21, d21, #1
vadd.u8 d2, d2, d6
vhadd.u8 d3, d2, d19
vst1.32 {d2[0]}, [r1], r4
vadd.u8 d3, d3, d7
vst1.32 {d3[0]}, [r1], r4
subs r12, r12, #12
bgt 1b
pop {r4,pc}
endfunc
.macro paeth rx, ra, rb, rc
vaddl.u8 q12, \ra, \rb @ a + b
vaddl.u8 q15, \rc, \rc @ 2*c
vabdl.u8 q13, \rb, \rc @ pa
vabdl.u8 q14, \ra, \rc @ pb
vabd.u16 q15, q12, q15 @ pc
vcle.u16 q12, q13, q14 @ pa <= pb
vcle.u16 q13, q13, q15 @ pa <= pc
vcle.u16 q14, q14, q15 @ pb <= pc
vand q12, q12, q13 @ pa <= pb && pa <= pc
vmovn.u16 d28, q14
vmovn.u16 \rx, q12
vbsl d28, \rb, \rc
vbsl \rx, \ra, d28
.endm
func png_read_filter_row_paeth4_neon, export=1
ldr r12, [r0, #4] @ rowbytes
vmov.i8 d3, #0
vmov.i8 d20, #0
1:
vld4.32 {d4[],d5[],d6[],d7[]}, [r1,:128]
vld4.32 {d16[],d17[],d18[],d19[]},[r2,:128]!
paeth d0, d3, d16, d20
vadd.u8 d0, d0, d4
paeth d1, d0, d17, d16
vadd.u8 d1, d1, d5
paeth d2, d1, d18, d17
vadd.u8 d2, d2, d6
paeth d3, d2, d19, d18
vmov d20, d19
vadd.u8 d3, d3, d7
vst4.32 {d0[0],d1[0],d2[0],d3[0]},[r1,:128]!
subs r12, r12, #16
bgt 1b
bx lr
endfunc
func png_read_filter_row_paeth3_neon, export=1
push {r4,lr}
ldr r12, [r0, #4] @ rowbytes
vmov.i8 d3, #0
vmov.i8 d4, #0
mov r0, r1
mov r4, #3
mov lr, #12
vld1.8 {q11}, [r0], lr
1:
vld1.8 {q10}, [r2], lr
paeth d0, d3, d20, d4
vext.8 d5, d22, d23, #3
vadd.u8 d0, d0, d22
vext.8 d17, d20, d21, #3
paeth d1, d0, d17, d20
vst1.32 {d0[0]}, [r1,:32], r4
vext.8 d6, d22, d23, #6
vadd.u8 d1, d1, d5
vext.8 d18, d20, d21, #6
paeth d2, d1, d18, d17
vext.8 d7, d23, d23, #1
vld1.8 {q11}, [r0], lr
vst1.32 {d1[0]}, [r1], r4
vadd.u8 d2, d2, d6
vext.8 d19, d21, d21, #1
paeth d3, d2, d19, d18
vst1.32 {d2[0]}, [r1], r4
vmov d4, d19
vadd.u8 d3, d3, d7
vst1.32 {d3[0]}, [r1], r4
subs r12, r12, #12
bgt 1b
pop {r4,pc}
endfunc
#endif /* PNG_ARM_NEON_OPT > 0 */ #endif /* PNG_ARM_NEON_OPT > 0 */
#endif /* PNG_ARM_NEON_IMPLEMENTATION == 2 (assembler) */ #endif /* PNG_ARM_NEON_IMPLEMENTATION == 2 */
#endif /* READ */ #endif /* READ */

View File

@ -1,12 +1,10 @@
/* filter_neon_intrinsics.c - NEON optimised filter functions /* filter_neon_intrinsics.c - NEON optimised filter functions
* *
* Copyright (c) 2018 Cosmin Truta
* Copyright (c) 2014,2016 Glenn Randers-Pehrson * Copyright (c) 2014,2016 Glenn Randers-Pehrson
* Written by James Yu <james.yu at linaro.org>, October 2013. * Written by James Yu <james.yu at linaro.org>, October 2013.
* Based on filter_neon.S, written by Mans Rullgard, 2011. * Based on filter_neon.S, written by Mans Rullgard, 2011.
* *
* Last changed in libpng 1.6.22 [May 26, 2016]
*
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
* and license in png.h * and license in png.h
@ -19,7 +17,11 @@
/* This code requires -mfpu=neon on the command line: */ /* This code requires -mfpu=neon on the command line: */
#if PNG_ARM_NEON_IMPLEMENTATION == 1 /* intrinsics code from pngpriv.h */ #if PNG_ARM_NEON_IMPLEMENTATION == 1 /* intrinsics code from pngpriv.h */
#include <arm_neon.h> #if defined(_MSC_VER) && !defined(__clang__) && defined(_M_ARM64)
# include <arm64_neon.h>
#else
# include <arm_neon.h>
#endif
/* libpng row pointers are not necessarily aligned to any particular boundary, /* libpng row pointers are not necessarily aligned to any particular boundary,
* however this code will only work with appropriate alignment. arm/arm_init.c * however this code will only work with appropriate alignment. arm/arm_init.c
@ -33,6 +35,11 @@
* 'type'. This is written this way just to hide the GCC strict aliasing * 'type'. This is written this way just to hide the GCC strict aliasing
* warning; note that the code is safe because there never is an alias between * warning; note that the code is safe because there never is an alias between
* the input and output pointers. * the input and output pointers.
*
* When compiling with MSVC ARM64, the png_ldr macro can't be passed directly
* to vst4_lane_u32, because of an internal compiler error inside MSVC.
* To avoid this compiler bug, we use a temporary variable (vdest_val) to store
* the result of png_ldr.
*/ */
#define png_ldr(type,pointer)\ #define png_ldr(type,pointer)\
(temp_pointer = png_ptr(type,pointer), *temp_pointer) (temp_pointer = png_ptr(type,pointer), *temp_pointer)
@ -125,12 +132,15 @@ png_read_filter_row_sub4_neon(png_row_infop row_info, png_bytep row,
uint8x8x4_t *vrpt = png_ptr(uint8x8x4_t,&vtmp); uint8x8x4_t *vrpt = png_ptr(uint8x8x4_t,&vtmp);
uint8x8x4_t vrp = *vrpt; uint8x8x4_t vrp = *vrpt;
uint32x2x4_t *temp_pointer; uint32x2x4_t *temp_pointer;
uint32x2x4_t vdest_val;
vdest.val[0] = vadd_u8(vdest.val[3], vrp.val[0]); vdest.val[0] = vadd_u8(vdest.val[3], vrp.val[0]);
vdest.val[1] = vadd_u8(vdest.val[0], vrp.val[1]); vdest.val[1] = vadd_u8(vdest.val[0], vrp.val[1]);
vdest.val[2] = vadd_u8(vdest.val[1], vrp.val[2]); vdest.val[2] = vadd_u8(vdest.val[1], vrp.val[2]);
vdest.val[3] = vadd_u8(vdest.val[2], vrp.val[3]); vdest.val[3] = vadd_u8(vdest.val[2], vrp.val[3]);
vst4_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2x4_t,&vdest), 0);
vdest_val = png_ldr(uint32x2x4_t, &vdest);
vst4_lane_u32(png_ptr(uint32_t,rp), vdest_val, 0);
} }
PNG_UNUSED(prev_row) PNG_UNUSED(prev_row)
@ -223,6 +233,7 @@ png_read_filter_row_avg4_neon(png_row_infop row_info, png_bytep row,
uint8x8x4_t *vrpt, *vppt; uint8x8x4_t *vrpt, *vppt;
uint8x8x4_t vrp, vpp; uint8x8x4_t vrp, vpp;
uint32x2x4_t *temp_pointer; uint32x2x4_t *temp_pointer;
uint32x2x4_t vdest_val;
vtmp = vld4_u32(png_ptr(uint32_t,rp)); vtmp = vld4_u32(png_ptr(uint32_t,rp));
vrpt = png_ptr(uint8x8x4_t,&vtmp); vrpt = png_ptr(uint8x8x4_t,&vtmp);
@ -240,7 +251,8 @@ png_read_filter_row_avg4_neon(png_row_infop row_info, png_bytep row,
vdest.val[3] = vhadd_u8(vdest.val[2], vpp.val[3]); vdest.val[3] = vhadd_u8(vdest.val[2], vpp.val[3]);
vdest.val[3] = vadd_u8(vdest.val[3], vrp.val[3]); vdest.val[3] = vadd_u8(vdest.val[3], vrp.val[3]);
vst4_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2x4_t,&vdest), 0); vdest_val = png_ldr(uint32x2x4_t, &vdest);
vst4_lane_u32(png_ptr(uint32_t,rp), vdest_val, 0);
} }
} }
@ -359,6 +371,7 @@ png_read_filter_row_paeth4_neon(png_row_infop row_info, png_bytep row,
uint8x8x4_t *vrpt, *vppt; uint8x8x4_t *vrpt, *vppt;
uint8x8x4_t vrp, vpp; uint8x8x4_t vrp, vpp;
uint32x2x4_t *temp_pointer; uint32x2x4_t *temp_pointer;
uint32x2x4_t vdest_val;
vtmp = vld4_u32(png_ptr(uint32_t,rp)); vtmp = vld4_u32(png_ptr(uint32_t,rp));
vrpt = png_ptr(uint8x8x4_t,&vtmp); vrpt = png_ptr(uint8x8x4_t,&vtmp);
@ -378,7 +391,8 @@ png_read_filter_row_paeth4_neon(png_row_infop row_info, png_bytep row,
vlast = vpp.val[3]; vlast = vpp.val[3];
vst4_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2x4_t,&vdest), 0); vdest_val = png_ldr(uint32x2x4_t, &vdest);
vst4_lane_u32(png_ptr(uint32_t,rp), vdest_val, 0);
} }
} }

View File

@ -0,0 +1,150 @@
/* palette_neon_intrinsics.c - NEON optimised palette expansion functions
*
* Copyright (c) 2018-2019 Cosmin Truta
* Copyright (c) 2017-2018 Arm Holdings. All rights reserved.
* Written by Richard Townsend <Richard.Townsend@arm.com>, February 2017.
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/
#include "../pngpriv.h"
#if PNG_ARM_NEON_IMPLEMENTATION == 1
#if defined(_MSC_VER) && !defined(__clang__) && defined(_M_ARM64)
# include <arm64_neon.h>
#else
# include <arm_neon.h>
#endif
/* Build an RGBA8 palette from the separate RGB and alpha palettes. */
void
png_riffle_palette_neon(png_structrp png_ptr)
{
png_const_colorp palette = png_ptr->palette;
png_bytep riffled_palette = png_ptr->riffled_palette;
png_const_bytep trans_alpha = png_ptr->trans_alpha;
int num_trans = png_ptr->num_trans;
int i;
/* Initially black, opaque. */
uint8x16x4_t w = {{
vdupq_n_u8(0x00),
vdupq_n_u8(0x00),
vdupq_n_u8(0x00),
vdupq_n_u8(0xff),
}};
png_debug(1, "in png_riffle_palette_neon");
/* First, riffle the RGB colours into an RGBA8 palette.
* The alpha component is set to opaque for now.
*/
for (i = 0; i < 256; i += 16)
{
uint8x16x3_t v = vld3q_u8((png_const_bytep)(palette + i));
w.val[0] = v.val[0];
w.val[1] = v.val[1];
w.val[2] = v.val[2];
vst4q_u8(riffled_palette + (i << 2), w);
}
/* Fix up the missing transparency values. */
for (i = 0; i < num_trans; i++)
riffled_palette[(i << 2) + 3] = trans_alpha[i];
}
/* Expands a palettized row into RGBA8. */
int
png_do_expand_palette_rgba8_neon(png_structrp png_ptr, png_row_infop row_info,
png_const_bytep row, png_bytepp ssp, png_bytepp ddp)
{
png_uint_32 row_width = row_info->width;
const png_uint_32 *riffled_palette =
png_aligncastconst(png_const_uint_32p, png_ptr->riffled_palette);
const png_uint_32 pixels_per_chunk = 4;
png_uint_32 i;
png_debug(1, "in png_do_expand_palette_rgba8_neon");
PNG_UNUSED(row)
if (row_width < pixels_per_chunk)
return 0;
/* This function originally gets the last byte of the output row.
* The NEON part writes forward from a given position, so we have
* to seek this back by 4 pixels x 4 bytes.
*/
*ddp = *ddp - ((pixels_per_chunk * sizeof(png_uint_32)) - 1);
for (i = 0; i < row_width; i += pixels_per_chunk)
{
uint32x4_t cur;
png_bytep sp = *ssp - i, dp = *ddp - (i << 2);
cur = vld1q_dup_u32 (riffled_palette + *(sp - 3));
cur = vld1q_lane_u32(riffled_palette + *(sp - 2), cur, 1);
cur = vld1q_lane_u32(riffled_palette + *(sp - 1), cur, 2);
cur = vld1q_lane_u32(riffled_palette + *(sp - 0), cur, 3);
vst1q_u32((void *)dp, cur);
}
if (i != row_width)
{
/* Remove the amount that wasn't processed. */
i -= pixels_per_chunk;
}
/* Decrement output pointers. */
*ssp = *ssp - i;
*ddp = *ddp - (i << 2);
return i;
}
/* Expands a palettized row into RGB8. */
int
png_do_expand_palette_rgb8_neon(png_structrp png_ptr, png_row_infop row_info,
png_const_bytep row, png_bytepp ssp, png_bytepp ddp)
{
png_uint_32 row_width = row_info->width;
png_const_bytep palette = (png_const_bytep)png_ptr->palette;
const png_uint_32 pixels_per_chunk = 8;
png_uint_32 i;
png_debug(1, "in png_do_expand_palette_rgb8_neon");
PNG_UNUSED(row)
if (row_width <= pixels_per_chunk)
return 0;
/* Seeking this back by 8 pixels x 3 bytes. */
*ddp = *ddp - ((pixels_per_chunk * sizeof(png_color)) - 1);
for (i = 0; i < row_width; i += pixels_per_chunk)
{
uint8x8x3_t cur;
png_bytep sp = *ssp - i, dp = *ddp - ((i << 1) + i);
cur = vld3_dup_u8(palette + sizeof(png_color) * (*(sp - 7)));
cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 6)), cur, 1);
cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 5)), cur, 2);
cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 4)), cur, 3);
cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 3)), cur, 4);
cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 2)), cur, 5);
cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 1)), cur, 6);
cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 0)), cur, 7);
vst3_u8((void *)dp, cur);
}
if (i != row_width)
{
/* Remove the amount that wasn't processed. */
i -= pixels_per_chunk;
}
/* Decrement output pointers. */
*ssp = *ssp - i;
*ddp = *ddp - ((i << 1) + i);
return i;
}
#endif /* PNG_ARM_NEON_IMPLEMENTATION */

View File

@ -77,13 +77,14 @@ libpng_autotools_files="Makefile.in aclocal.m4 config.guess config.h.in
config.sub configure depcomp install-sh ltmain.sh missing\ config.sub configure depcomp install-sh ltmain.sh missing\
test-driver" test-driver"
# #
# Files generated by versions of configue >2.68 or automake >1.13 (i.e. later # Files generated by versions of autoconf >2.68 or automake >1.13 (i.e. later
# versions than those required by configure.ac): # versions than those required by configure.ac):
libpng_autotools_extra="compile config.h.in~" libpng_autotools_extra="compile config.h.in~"
# #
# These are separate because 'maintainer-clean' does not remove them. # These are separate because 'maintainer-clean' does not remove them.
libpng_libtool_files="scripts/libtool.m4 scripts/ltoptions.m4\ libpng_libtool_files="scripts/autoconf/libtool.m4 scripts/autoconf/ltoptions.m4\
scripts/ltsugar.m4 scripts/ltversion.m4 scripts/lt~obsolete.m4" scripts/autoconf/ltsugar.m4 scripts/autoconf/ltversion.m4\
scripts/autoconf/lt~obsolete.m4"
libpng_autotools_dirs="autom4te.cache" # not required libpng_autotools_dirs="autom4te.cache" # not required
# #
@ -194,7 +195,7 @@ case "$mode" in
if test -d .git if test -d .git
then then
exec >&2 exec >&2
echo "ERROR: running autoreconf on an initialized sytem" echo "ERROR: running autoreconf on an initialized system"
echo " This is not necessary; it is only necessary to remake the" echo " This is not necessary; it is only necessary to remake the"
echo " autotools generated files if Makefile.am or configure.ac" echo " autotools generated files if Makefile.am or configure.ac"
echo " change and make does the right thing with:" echo " change and make does the right thing with:"

11
ci/.shellcheckrc Normal file
View File

@ -0,0 +1,11 @@
# Disable the "expressions don't expand in single quotes, use double quotes"
# advice. We need the regular expressions to remain uninterpolated.
disable=SC2016
# Disable the "variable appears unused" warning caused by the use of getopts
# with an obligatory (but unused) variable name in the main function.
disable=SC2034
# Disable all the "quote to prevent globbing or word splitting" advice.
# We need word splitting for well-known variables like MAKEFLAGS and CFLAGS.
disable=SC2086,SC2206

19
ci/LICENSE_MIT.txt Normal file
View File

@ -0,0 +1,19 @@
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

25
ci/README.md Normal file
View File

@ -0,0 +1,25 @@
Scripts for the Continuous Integration of the PNG Reference Library
===================================================================
Copyright Notice
----------------
Copyright (c) 2019-2025 Cosmin Truta.
Use, modification and distribution are subject to the MIT License.
Please see the accompanying file `LICENSE_MIT.txt` or visit
https://opensource.org/license/mit
File List
---------
LICENSE_MIT.txt ==> The License file
README.md ==> This file
ci_lint.sh ==> Lint the source code
ci_shellify.sh ==> Convert select definitions to shell syntax
ci_verify_cmake.sh ==> Verify the build driven by CMakeLists.txt
ci_verify_configure.sh ==> Verify the build driven by configure
ci_verify_makefiles.sh ==> Verify the build driven by scripts/makefile.*
ci_verify_version.sh ==> Verify the consistency of version definitions
lib/ci.lib.sh ==> Shell utilities for the main ci_*.sh scripts
targets/*/ci_env.*.sh ==> Shell environments for cross-platform testing

142
ci/ci_lint.sh Executable file
View File

@ -0,0 +1,142 @@
#!/usr/bin/env bash
set -o errexit -o pipefail -o posix
# Copyright (c) 2019-2025 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
# shellcheck source=ci/lib/ci.lib.sh
source "$(dirname "$0")/lib/ci.lib.sh"
cd "$CI_TOPLEVEL_DIR"
# Initialize the global constants CI_{...}{CHECK,CHECKER,LINT}.
CI_SHELLCHECK="${CI_SHELLCHECK:-shellcheck}"
CI_EDITORCONFIG_CHECKER="${CI_EDITORCONFIG_CHECKER:-editorconfig-checker}"
CI_YAMLLINT="${CI_YAMLLINT:-yamllint}"
# Initialize the global lint status.
CI_LINT_STATUS=0
function ci_init_lint {
ci_info "## START OF LINTING ##"
local my_program
# Complete the initialization of CI_SHELLCHECK.
# Set it to the empty string if the shellcheck program is unavailable.
my_program="$(command -v "$CI_SHELLCHECK")" || {
ci_warn "program not found: '$CI_SHELLCHECK'"
}
CI_SHELLCHECK="$my_program"
# Complete the initialization of CI_EDITORCONFIG_CHECKER.
# Set it to the empty string if the editorconfig-checker program is unavailable.
my_program="$(command -v "$CI_EDITORCONFIG_CHECKER")" || {
ci_warn "program not found: '$CI_EDITORCONFIG_CHECKER'"
}
CI_EDITORCONFIG_CHECKER="$my_program"
# Complete the initialization of CI_YAMLLINT.
# Set it to the empty string if the yamllint program is unavailable.
my_program="$(command -v "$CI_YAMLLINT")" || {
ci_warn "program not found: '$CI_YAMLLINT'"
}
CI_YAMLLINT="$my_program"
}
function ci_finish_lint {
ci_info "## END OF LINTING ##"
if [[ $CI_LINT_STATUS -eq 0 ]]
then
ci_info "## SUCCESS ##"
else
ci_info "linting failed"
fi
return "$CI_LINT_STATUS"
}
function ci_lint_ci_scripts {
[[ -x $CI_SHELLCHECK ]] || {
ci_warn "## NOT LINTING: CI scripts ##"
return 0
}
ci_info "## LINTING: CI scripts ##"
ci_spawn "$CI_SHELLCHECK" --version
find ./ci -name "ci_*.sh" -not -name "ci_env.*.sh" | {
local my_file
while IFS="" read -r my_file
do
ci_spawn "$CI_SHELLCHECK" -x "$my_file" || {
# Linting failed.
return 1
}
done
}
}
function ci_lint_text_files {
[[ -x $CI_EDITORCONFIG_CHECKER ]] || {
ci_warn "## NOT LINTING: text files ##"
return 0
}
ci_info "## LINTING: text files ##"
ci_spawn "$CI_EDITORCONFIG_CHECKER" --version
ci_spawn "$CI_EDITORCONFIG_CHECKER" --config .editorconfig-checker.json || {
# Linting failed.
return 1
}
}
function ci_lint_yaml_files {
[[ -x $CI_YAMLLINT ]] || {
ci_warn "## NOT LINTING: YAML files ##"
return 0
}
ci_info "## LINTING: YAML files ##"
ci_spawn "$CI_YAMLLINT" --version
# Considering that the YAML format is an extension of the JSON format,
# we can lint both the YAML files and the plain JSON files here.
find . \( -iname "*.yml" -o -iname "*.yaml" -o -iname "*.json" \) -not -path "./out/*" | {
local my_file
while IFS="" read -r my_file
do
ci_spawn "$CI_YAMLLINT" --strict "$my_file" || {
# Linting failed.
return 1
}
done
}
}
function ci_lint {
ci_init_lint
ci_lint_ci_scripts || CI_LINT_STATUS=1
ci_lint_text_files || CI_LINT_STATUS=1
ci_lint_yaml_files || CI_LINT_STATUS=1
# TODO: ci_lint_png_files, etc.
ci_finish_lint
}
function usage {
echo "usage: $CI_SCRIPT_NAME [<options>]"
echo "options: -?|-h|--help"
exit "${@:-0}"
}
function main {
local opt
while getopts ":" opt
do
# This ain't a while-loop. It only pretends to be.
[[ $1 == -[?h]* || $1 == --help || $1 == --help=* ]] && usage 0
ci_err "unknown option: '$1'"
done
shift $((OPTIND - 1))
[[ $# -eq 0 ]] || {
echo >&2 "error: unexpected argument: '$1'"
usage 2
}
# And... go!
ci_lint
}
main "$@"

209
ci/ci_verify_cmake.sh Executable file
View File

@ -0,0 +1,209 @@
#!/usr/bin/env bash
set -o errexit -o pipefail -o posix
# Copyright (c) 2019-2025 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
# shellcheck source=ci/lib/ci.lib.sh
source "$(dirname "$0")/lib/ci.lib.sh"
cd "$CI_TOPLEVEL_DIR"
CI_SRC_DIR="$CI_TOPLEVEL_DIR"
CI_OUT_DIR="$CI_TOPLEVEL_DIR/out"
CI_BUILD_DIR="$CI_OUT_DIR/ci_verify_cmake.$CI_TARGET_SYSTEM.$CI_TARGET_ARCH.build"
CI_INSTALL_DIR="$CI_OUT_DIR/ci_verify_cmake.$CI_TARGET_SYSTEM.$CI_TARGET_ARCH.install"
function ci_init_build {
# Ensure that the mandatory variables are initialized.
CI_CMAKE="${CI_CMAKE:-cmake}"
CI_CTEST="${CI_CTEST:-ctest}"
CI_CMAKE_BUILD_TYPE="${CI_CMAKE_BUILD_TYPE:-Release}"
if [[ $CI_CMAKE_GENERATOR == "Visual Studio"* ]]
then
# Clean up incidental mixtures of Windows and Bash-on-Windows
# environment variables, to avoid confusing MSBuild.
[[ $TEMP && ( $Temp || $temp ) ]] && unset TEMP
[[ $TMP && ( $Tmp || $tmp ) ]] && unset TMP
# Ensure that CI_CMAKE_GENERATOR_PLATFORM is initialized for this generator.
[[ $CI_CMAKE_GENERATOR_PLATFORM ]] || {
ci_err_internal "missing \$CI_CMAKE_GENERATOR_PLATFORM"
}
elif [[ -x $(command -v ninja) ]]
then
CI_CMAKE_GENERATOR="${CI_CMAKE_GENERATOR:-Ninja}"
fi
}
function ci_trace_build {
ci_info "## START OF CONFIGURATION ##"
ci_info "build arch: $CI_BUILD_ARCH"
ci_info "build system: $CI_BUILD_SYSTEM"
[[ "$CI_TARGET_SYSTEM.$CI_TARGET_ARCH" != "$CI_BUILD_SYSTEM.$CI_BUILD_ARCH" ]] && {
ci_info "target arch: $CI_TARGET_ARCH"
ci_info "target system: $CI_TARGET_SYSTEM"
}
ci_info "source directory: $CI_SRC_DIR"
ci_info "build directory: $CI_BUILD_DIR"
ci_info "install directory: $CI_INSTALL_DIR"
ci_info "environment option: \$CI_CMAKE: '$CI_CMAKE'"
ci_info "environment option: \$CI_CMAKE_GENERATOR: '$CI_CMAKE_GENERATOR'"
ci_info "environment option: \$CI_CMAKE_GENERATOR_PLATFORM: '$CI_CMAKE_GENERATOR_PLATFORM'"
ci_info "environment option: \$CI_CMAKE_BUILD_TYPE: '$CI_CMAKE_BUILD_TYPE'"
ci_info "environment option: \$CI_CMAKE_BUILD_FLAGS: '$CI_CMAKE_BUILD_FLAGS'"
ci_info "environment option: \$CI_CMAKE_TOOLCHAIN_FILE: '$CI_CMAKE_TOOLCHAIN_FILE'"
ci_info "environment option: \$CI_CMAKE_VARS: '$CI_CMAKE_VARS'"
ci_info "environment option: \$CI_CTEST: '$CI_CTEST'"
ci_info "environment option: \$CI_CTEST_FLAGS: '$CI_CTEST_FLAGS'"
ci_info "environment option: \$CI_CC: '$CI_CC'"
ci_info "environment option: \$CI_CC_FLAGS: '$CI_CC_FLAGS'"
ci_info "environment option: \$CI_AR: '$CI_AR'"
ci_info "environment option: \$CI_RANLIB: '$CI_RANLIB'"
ci_info "environment option: \$CI_SANITIZERS: '$CI_SANITIZERS'"
ci_info "environment option: \$CI_FORCE: '$CI_FORCE'"
ci_info "environment option: \$CI_NO_BUILD: '$CI_NO_BUILD'"
ci_info "environment option: \$CI_NO_TEST: '$CI_NO_TEST'"
ci_info "environment option: \$CI_NO_INSTALL: '$CI_NO_INSTALL'"
ci_info "environment option: \$CI_NO_CLEAN: '$CI_NO_CLEAN'"
ci_info "executable: \$CI_CMAKE: $(command -V "$CI_CMAKE")"
ci_info "executable: \$CI_CTEST: $(command -V "$CI_CTEST")"
[[ $CI_CC ]] && {
ci_info "executable: \$CI_CC: $(command -V "$CI_CC")"
}
[[ $CI_AR ]] && {
ci_info "executable: \$CI_AR: $(command -V "$CI_AR")"
}
[[ $CI_RANLIB ]] && {
ci_info "executable: \$CI_RANLIB: $(command -V "$CI_RANLIB")"
}
ci_info "## END OF CONFIGURATION ##"
}
function ci_cleanup_old_build {
ci_info "## START OF PRE-BUILD CLEANUP ##"
[[ ! -e $CI_BUILD_DIR && ! -e $CI_INSTALL_DIR ]] || {
ci_spawn rm -fr "$CI_BUILD_DIR"
ci_spawn rm -fr "$CI_INSTALL_DIR"
}
ci_info "## END OF PRE-BUILD CLEANUP ##"
}
function ci_build {
ci_info "## START OF BUILD ##"
# Adjust the CI environment variables, as needed.
CI_CMAKE="$(command -v "$CI_CMAKE")" || ci_err "bad or missing \$CI_CMAKE"
ci_spawn "$CI_CMAKE" --version
CI_CTEST="$(command -v "$CI_CTEST")" || ci_err "bad or missing \$CI_CTEST"
ci_spawn "$CI_CTEST" --version
[[ $CI_CMAKE_GENERATOR == *"Ninja"* ]] && {
CI_NINJA="$(command -v ninja)" || ci_err "bad or missing ninja, no pun intended"
ci_spawn "$CI_NINJA" --version
}
[[ $CI_AR ]] && {
# Use the full path of CI_AR to work around a mysterious CMake error.
CI_AR="$(command -v "$CI_AR")" || ci_err "bad or missing \$CI_AR"
}
[[ $CI_RANLIB ]] && {
# Use the full path of CI_RANLIB to work around a mysterious CMake error.
CI_RANLIB="$(command -v "$CI_RANLIB")" || ci_err "bad or missing \$CI_RANLIB"
}
# Export the CMake environment variables.
[[ $CI_CMAKE_GENERATOR ]] && {
ci_spawn export CMAKE_GENERATOR="$CI_CMAKE_GENERATOR"
}
[[ $CI_CMAKE_GENERATOR_PLATFORM ]] && {
ci_spawn export CMAKE_GENERATOR_PLATFORM="$CI_CMAKE_GENERATOR_PLATFORM"
}
# Initialize and populate the local arrays.
local all_cmake_vars=()
local all_cmake_build_flags=()
local all_ctest_flags=()
[[ $CI_CMAKE_TOOLCHAIN_FILE ]] && {
all_cmake_vars+=("-DCMAKE_TOOLCHAIN_FILE=$CI_CMAKE_TOOLCHAIN_FILE")
}
[[ $CI_CC ]] && {
all_cmake_vars+=("-DCMAKE_C_COMPILER=$CI_CC")
}
[[ $CI_CC_FLAGS || $CI_SANITIZERS ]] && {
[[ $CI_SANITIZERS ]] && CI_CC_FLAGS+="${CI_CC_FLAGS:+" "}-fsanitize=$CI_SANITIZERS"
all_cmake_vars+=("-DCMAKE_C_FLAGS=$CI_CC_FLAGS")
}
[[ $CI_AR ]] && {
all_cmake_vars+=("-DCMAKE_AR=$CI_AR")
}
[[ $CI_RANLIB ]] && {
all_cmake_vars+=("-DCMAKE_RANLIB=$CI_RANLIB")
}
all_cmake_vars+=("-DCMAKE_BUILD_TYPE=$CI_CMAKE_BUILD_TYPE")
all_cmake_vars+=("-DCMAKE_VERBOSE_MAKEFILE=ON")
all_cmake_vars+=($CI_CMAKE_VARS)
all_cmake_build_flags+=($CI_CMAKE_BUILD_FLAGS)
all_ctest_flags+=($CI_CTEST_FLAGS)
# And... build!
ci_spawn mkdir -p "$CI_BUILD_DIR"
# Spawn "cmake ...".
ci_spawn "$CI_CMAKE" -B "$CI_BUILD_DIR" \
-S . \
-DCMAKE_INSTALL_PREFIX="$CI_INSTALL_DIR" \
"${all_cmake_vars[@]}"
ci_expr $((CI_NO_BUILD)) || {
# Spawn "cmake --build ...".
ci_spawn "$CI_CMAKE" --build "$CI_BUILD_DIR" \
--config "$CI_CMAKE_BUILD_TYPE" \
"${all_cmake_build_flags[@]}"
}
ci_expr $((CI_NO_TEST)) || {
# Spawn "ctest" if testing is not disabled.
ci_spawn pushd "$CI_BUILD_DIR"
ci_spawn "$CI_CTEST" --build-config "$CI_CMAKE_BUILD_TYPE" \
"${all_ctest_flags[@]}"
ci_spawn popd
}
ci_expr $((CI_NO_INSTALL)) || {
# Spawn "cmake --build ... --target install" if installation is not disabled.
ci_spawn "$CI_CMAKE" --build "$CI_BUILD_DIR" \
--config "$CI_CMAKE_BUILD_TYPE" \
--target install \
"${all_cmake_build_flags[@]}"
}
ci_expr $((CI_NO_CLEAN)) || {
# Spawn "make --build ... --target clean" if cleaning is not disabled.
ci_spawn "$CI_CMAKE" --build "$CI_BUILD_DIR" \
--config "$CI_CMAKE_BUILD_TYPE" \
--target clean \
"${all_cmake_build_flags[@]}"
}
ci_info "## END OF BUILD ##"
}
function usage {
echo "usage: $CI_SCRIPT_NAME [<options>]"
echo "options: -?|-h|--help"
exit "${@:-0}"
}
function main {
local opt
while getopts ":" opt
do
# This ain't a while-loop. It only pretends to be.
[[ $1 == -[?h]* || $1 == --help || $1 == --help=* ]] && usage 0
ci_err "unknown option: '$1'"
done
shift $((OPTIND - 1))
# And... go!
ci_init_build
ci_trace_build
[[ $# -eq 0 ]] || {
echo >&2 "error: unexpected argument: '$1'"
echo >&2 "note: this program accepts environment options only"
usage 2
}
ci_cleanup_old_build
ci_build
}
main "$@"

182
ci/ci_verify_configure.sh Executable file
View File

@ -0,0 +1,182 @@
#!/usr/bin/env bash
set -o errexit -o pipefail -o posix
# Copyright (c) 2019-2025 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
# shellcheck source=ci/lib/ci.lib.sh
source "$(dirname "$0")/lib/ci.lib.sh"
cd "$CI_TOPLEVEL_DIR"
CI_SRC_DIR="$CI_TOPLEVEL_DIR"
CI_OUT_DIR="$CI_TOPLEVEL_DIR/out"
CI_BUILD_DIR="$CI_OUT_DIR/ci_verify_configure.$CI_TARGET_SYSTEM.$CI_TARGET_ARCH.build"
CI_INSTALL_DIR="$CI_OUT_DIR/ci_verify_configure.$CI_TARGET_SYSTEM.$CI_TARGET_ARCH.install"
function ci_init_build {
# Ensure that the mandatory variables are initialized.
CI_MAKE="${CI_MAKE:-make}"
[[ "$CI_TARGET_SYSTEM.$CI_TARGET_ARCH" != "$CI_BUILD_SYSTEM.$CI_BUILD_ARCH" ]] || {
# For native builds, set CI_CC to "cc" by default if the cc command is available.
# The configure script defaults CC to "gcc", which is not always a good idea.
[[ -x $(command -v cc) ]] && CI_CC="${CI_CC:-cc}"
}
# Ensure that the CI_ variables that cannot be customized reliably are not initialized.
[[ ! $CI_CONFIGURE_VARS ]] || {
ci_err "unsupported: \$CI_CONFIGURE_VARS='$CI_CONFIGURE_VARS'"
}
[[ ! $CI_MAKE_VARS ]] || {
ci_err "unsupported: \$CI_MAKE_VARS='$CI_MAKE_VARS'"
}
}
function ci_trace_build {
ci_info "## START OF CONFIGURATION ##"
ci_info "build arch: $CI_BUILD_ARCH"
ci_info "build system: $CI_BUILD_SYSTEM"
[[ "$CI_TARGET_SYSTEM.$CI_TARGET_ARCH" != "$CI_BUILD_SYSTEM.$CI_BUILD_ARCH" ]] && {
ci_info "target arch: $CI_TARGET_ARCH"
ci_info "target system: $CI_TARGET_SYSTEM"
}
ci_info "source directory: $CI_SRC_DIR"
ci_info "build directory: $CI_BUILD_DIR"
ci_info "install directory: $CI_INSTALL_DIR"
ci_info "environment option: \$CI_CONFIGURE_FLAGS: '$CI_CONFIGURE_FLAGS'"
ci_info "environment option: \$CI_MAKE: '$CI_MAKE'"
ci_info "environment option: \$CI_MAKE_FLAGS: '$CI_MAKE_FLAGS'"
ci_info "environment option: \$CI_CC: '$CI_CC'"
ci_info "environment option: \$CI_CC_FLAGS: '$CI_CC_FLAGS'"
ci_info "environment option: \$CI_CPP: '$CI_CPP'"
ci_info "environment option: \$CI_CPP_FLAGS: '$CI_CPP_FLAGS'"
ci_info "environment option: \$CI_AR: '$CI_AR'"
ci_info "environment option: \$CI_RANLIB: '$CI_RANLIB'"
ci_info "environment option: \$CI_LD: '$CI_LD'"
ci_info "environment option: \$CI_LD_FLAGS: '$CI_LD_FLAGS'"
ci_info "environment option: \$CI_SANITIZERS: '$CI_SANITIZERS'"
ci_info "environment option: \$CI_FORCE: '$CI_FORCE'"
ci_info "environment option: \$CI_NO_BUILD: '$CI_NO_BUILD'"
ci_info "environment option: \$CI_NO_TEST: '$CI_NO_TEST'"
ci_info "environment option: \$CI_NO_INSTALL: '$CI_NO_INSTALL'"
ci_info "environment option: \$CI_NO_CLEAN: '$CI_NO_CLEAN'"
ci_info "executable: \$CI_MAKE: $(command -V "$CI_MAKE")"
[[ $CI_CC ]] && {
ci_info "executable: \$CI_CC: $(command -V "$CI_CC")"
}
[[ $CI_CPP ]] && {
ci_info "executable: \$CI_CPP: $(command -V "$CI_CPP")"
}
[[ $CI_AR ]] && {
ci_info "executable: \$CI_AR: $(command -V "$CI_AR")"
}
[[ $CI_RANLIB ]] && {
ci_info "executable: \$CI_RANLIB: $(command -V "$CI_RANLIB")"
}
[[ $CI_LD ]] && {
ci_info "executable: \$CI_LD: $(command -V "$CI_LD")"
}
ci_info "## END OF CONFIGURATION ##"
}
function ci_cleanup_old_build {
ci_info "## START OF PRE-BUILD CLEANUP ##"
[[ ! -e $CI_BUILD_DIR && ! -e $CI_INSTALL_DIR ]] || {
ci_spawn rm -fr "$CI_BUILD_DIR"
ci_spawn rm -fr "$CI_INSTALL_DIR"
}
[[ ! -e "$CI_SRC_DIR/config.status" ]] || {
ci_warn "unexpected build configuration file: '$CI_SRC_DIR/config.status'"
if ci_expr $((CI_FORCE))
then
# Delete the old config and (possibly) the old build.
ci_info "note: forcing an in-tree build cleanup"
if [[ -f $CI_SRC_DIR/Makefile ]]
then
ci_spawn make -C "$CI_SRC_DIR" distclean
else
ci_spawn rm -fr "$CI_SRC_DIR"/config.{log,status}
fi
else
# Alert the user, but do not delete their files.
ci_warn "the configure script might fail"
ci_info "hint: consider using the option \$CI_FORCE=1"
fi
}
ci_info "## END OF PRE-BUILD CLEANUP ##"
}
function ci_build {
ci_info "## START OF BUILD ##"
# Export the configure build environment.
[[ $CI_CC ]] && ci_spawn export CC="$CI_CC"
[[ $CI_CC_FLAGS ]] && ci_spawn export CFLAGS="$CI_CC_FLAGS"
[[ $CI_CPP ]] && ci_spawn export CPP="$CI_CPP"
[[ $CI_CPP_FLAGS ]] && ci_spawn export CPPFLAGS="$CI_CPP_FLAGS"
[[ $CI_AR ]] && ci_spawn export AR="$CI_AR"
[[ $CI_RANLIB ]] && ci_spawn export RANLIB="$CI_RANLIB"
[[ $CI_LD ]] && ci_spawn export LD="$CI_LD"
[[ $CI_LD_FLAGS ]] && ci_spawn export LDFLAGS="$CI_LD_FLAGS"
[[ $CI_SANITIZERS ]] && {
ci_spawn export CFLAGS="${CFLAGS:-"-O2"} -fsanitize=$CI_SANITIZERS"
ci_spawn export LDFLAGS="${LDFLAGS}${LDFLAGS:+" "}-fsanitize=$CI_SANITIZERS"
}
# Spawn "autogen.sh" if the configure script is not available.
[[ -x "$CI_SRC_DIR/configure" ]] || {
ci_spawn "$CI_SRC_DIR/autogen.sh" --maintainer
}
# And... build!
ci_spawn mkdir -p "$CI_BUILD_DIR"
ci_spawn cd "$CI_BUILD_DIR"
# Spawn "configure".
ci_spawn "$CI_SRC_DIR/configure" --prefix="$CI_INSTALL_DIR" $CI_CONFIGURE_FLAGS
ci_expr $((CI_NO_BUILD)) || {
# Spawn "make".
ci_spawn "$CI_MAKE" $CI_MAKE_FLAGS
}
ci_expr $((CI_NO_TEST)) || {
# Spawn "make test" if testing is not disabled.
ci_spawn "$CI_MAKE" $CI_MAKE_FLAGS test
}
ci_expr $((CI_NO_INSTALL)) || {
# Spawn "make install" if installation is not disabled.
ci_spawn "$CI_MAKE" $CI_MAKE_FLAGS install
}
ci_expr $((CI_NO_CLEAN)) || {
# Spawn "make clean" and "make distclean" if cleaning is not disabled.
ci_spawn "$CI_MAKE" $CI_MAKE_FLAGS clean
ci_spawn "$CI_MAKE" $CI_MAKE_FLAGS distclean
}
ci_info "## END OF BUILD ##"
}
function usage {
echo "usage: $CI_SCRIPT_NAME [<options>]"
echo "options: -?|-h|--help"
exit "${@:-0}"
}
function main {
local opt
while getopts ":" opt
do
# This ain't a while-loop. It only pretends to be.
[[ $1 == -[?h]* || $1 == --help || $1 == --help=* ]] && usage 0
ci_err "unknown option: '$1'"
done
shift $((OPTIND - 1))
# And... go!
ci_init_build
ci_trace_build
[[ $# -eq 0 ]] || {
echo >&2 "error: unexpected argument: '$1'"
echo >&2 "note: this program accepts environment options only"
usage 2
}
ci_cleanup_old_build
ci_build
}
main "$@"

200
ci/ci_verify_makefiles.sh Executable file
View File

@ -0,0 +1,200 @@
#!/usr/bin/env bash
set -o errexit -o pipefail -o posix
# Copyright (c) 2019-2025 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
# shellcheck source=ci/lib/ci.lib.sh
source "$(dirname "$0")/lib/ci.lib.sh"
cd "$CI_TOPLEVEL_DIR"
CI_SRC_DIR="$CI_TOPLEVEL_DIR"
function ci_init_build {
# Ensure that the mandatory variables are initialized.
CI_MAKE="${CI_MAKE:-make}"
case "$CI_CC" in
( *clang* )
CI_MAKEFILES="${CI_MAKEFILES:-"scripts/makefile.clang"}" ;;
( *gcc* )
CI_MAKEFILES="${CI_MAKEFILES:-"scripts/makefile.gcc"}" ;;
( * )
CI_MAKEFILES="${CI_MAKEFILES:-"scripts/makefile.std"}" ;;
esac
}
function ci_trace_build {
ci_info "## START OF CONFIGURATION ##"
ci_info "build arch: $CI_BUILD_ARCH"
ci_info "build system: $CI_BUILD_SYSTEM"
[[ "$CI_TARGET_SYSTEM.$CI_TARGET_ARCH" != "$CI_BUILD_SYSTEM.$CI_BUILD_ARCH" ]] && {
ci_info "target arch: $CI_TARGET_ARCH"
ci_info "target system: $CI_TARGET_SYSTEM"
}
ci_info "source directory: $CI_SRC_DIR"
ci_info "environment option: \$CI_MAKEFILES: '$CI_MAKEFILES'"
ci_info "environment option: \$CI_MAKE: '$CI_MAKE'"
ci_info "environment option: \$CI_MAKE_FLAGS: '$CI_MAKE_FLAGS'"
ci_info "environment option: \$CI_MAKE_VARS: '$CI_MAKE_VARS'"
ci_info "environment option: \$CI_CC: '$CI_CC'"
ci_info "environment option: \$CI_CC_FLAGS: '$CI_CC_FLAGS'"
ci_info "environment option: \$CI_CPP: '$CI_CPP'"
ci_info "environment option: \$CI_CPP_FLAGS: '$CI_CPP_FLAGS'"
ci_info "environment option: \$CI_AR: '$CI_AR'"
ci_info "environment option: \$CI_RANLIB: '$CI_RANLIB'"
ci_info "environment option: \$CI_LD: '$CI_LD'"
ci_info "environment option: \$CI_LD_FLAGS: '$CI_LD_FLAGS'"
ci_info "environment option: \$CI_LIBS: '$CI_LIBS'"
ci_info "environment option: \$CI_SANITIZERS: '$CI_SANITIZERS'"
ci_info "environment option: \$CI_FORCE: '$CI_FORCE'"
ci_info "environment option: \$CI_NO_BUILD: '$CI_NO_BUILD'"
ci_info "environment option: \$CI_NO_TEST: '$CI_NO_TEST'"
ci_info "environment option: \$CI_NO_CLEAN: '$CI_NO_CLEAN'"
ci_info "executable: \$CI_MAKE: $(command -V "$CI_MAKE")"
[[ $CI_CC ]] && {
ci_info "executable: \$CI_CC: $(command -V "$CI_CC")"
}
[[ $CI_CPP ]] && {
ci_info "executable: \$CI_CPP: $(command -V "$CI_CPP")"
}
[[ $CI_AR ]] && {
ci_info "executable: \$CI_AR: $(command -V "$CI_AR")"
}
[[ $CI_RANLIB ]] && {
ci_info "executable: \$CI_RANLIB: $(command -V "$CI_RANLIB")"
}
[[ $CI_LD ]] && {
ci_info "executable: \$CI_LD: $(command -V "$CI_LD")"
}
ci_info "## END OF CONFIGURATION ##"
}
function ci_cleanup_old_build {
# Any old makefile-based build will most likely leave a mess
# of object files behind if interrupted, e.g., via Ctrl+C.
# There may be other files behind, depending on what makefile
# had been used. We cannot easily enumerate all of those.
# Fortunately, for a clean makefiles-based build, it should be
# sufficient to remove the old object files only.
ci_info "## START OF PRE-BUILD CLEANUP ##"
local find_args=(-maxdepth 1 \( -iname "*.o" -o -iname "*.obj" \))
[[ ! $(find "$CI_SRC_DIR" "${find_args[@]}" | head -n1) ]] || {
ci_warn "unexpected build found in '$CI_SRC_DIR'"
if ci_expr $((CI_FORCE))
then
# Delete the old build.
local my_file
find "$CI_SRC_DIR" "${find_args[@]}" |
while IFS="" read -r my_file
do
ci_spawn rm -fr "$my_file"
done
ci_info "## END OF PRE-BUILD CLEANUP ##"
else
# Alert the user, but do not delete their existing files,
# and do not mess up their existing build.
ci_info "hint: consider using the option \$CI_FORCE=1"
ci_err "unable to continue"
fi
}
}
function ci_build {
ci_info "## START OF BUILD ##"
# Initialize and populate the local arrays.
local all_make_flags=()
local all_make_vars=()
[[ $CI_MAKE_FLAGS ]] && {
all_make_flags+=($CI_MAKE_FLAGS)
}
[[ $CI_CC ]] && {
all_make_vars+=("CC=$CI_CC")
}
[[ $CI_CC_FLAGS || $CI_SANITIZERS ]] && {
[[ $CI_SANITIZERS ]] && CI_CC_FLAGS="${CI_CC_FLAGS:-"-O2"} -fsanitize=$CI_SANITIZERS"
all_make_vars+=("CFLAGS=$CI_CC_FLAGS")
}
[[ $CI_CPP ]] && {
all_make_vars+=("CPP=$CI_CPP")
}
[[ $CI_CPP_FLAGS ]] && {
all_make_vars+=("CPPFLAGS=$CI_CPP_FLAGS")
}
[[ $CI_AR ]] && {
all_make_vars+=("AR=$CI_AR")
}
[[ $CI_RANLIB ]] && {
all_make_vars+=("RANLIB=$CI_RANLIB")
}
[[ $CI_LD ]] && {
all_make_vars+=("LD=$CI_LD")
}
[[ $CI_LD_FLAGS || $CI_SANITIZERS ]] && {
[[ $CI_SANITIZERS ]] && CI_LD_FLAGS+="${CI_LD_FLAGS:+" "}-fsanitize=$CI_SANITIZERS"
all_make_vars+=("LDFLAGS=$CI_LD_FLAGS")
}
[[ $CI_LIBS ]] && {
all_make_vars+=("LIBS=$CI_LIBS")
}
all_make_vars+=($CI_MAKE_VARS)
# And... build!
local my_makefile
for my_makefile in $CI_MAKEFILES
do
ci_info "using makefile: $my_makefile"
ci_expr $((CI_NO_BUILD)) || {
# Spawn "make".
ci_spawn "$CI_MAKE" -f "$my_makefile" \
"${all_make_flags[@]}" \
"${all_make_vars[@]}"
}
ci_expr $((CI_NO_TEST)) || {
# Spawn "make test" if testing is not disabled.
ci_spawn "$CI_MAKE" -f "$my_makefile" \
"${all_make_flags[@]}" \
"${all_make_vars[@]}" \
test
}
ci_expr $((CI_NO_CLEAN)) || {
# Spawn "make clean" if cleaning is not disabled.
ci_spawn "$CI_MAKE" -f "$my_makefile" \
"${all_make_flags[@]}" \
"${all_make_vars[@]}" \
clean
}
done
ci_info "## END OF BUILD ##"
}
function usage {
echo "usage: $CI_SCRIPT_NAME [<options>]"
echo "options: -?|-h|--help"
exit "${@:-0}"
}
function main {
local opt
while getopts ":" opt
do
# This ain't a while-loop. It only pretends to be.
[[ $1 == -[?h]* || $1 == --help || $1 == --help=* ]] && usage 0
ci_err "unknown option: '$1'"
done
shift $((OPTIND - 1))
# And... go!
ci_init_build
ci_trace_build
[[ $# -eq 0 ]] || {
echo >&2 "error: unexpected argument: '$1'"
echo >&2 "note: this program accepts environment options only"
usage 2
}
ci_cleanup_old_build
ci_build
}
main "$@"

191
ci/ci_verify_version.sh Executable file
View File

@ -0,0 +1,191 @@
#!/usr/bin/env bash
set -o errexit -o pipefail -o posix
# Copyright (c) 2019-2025 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
# shellcheck source=ci/lib/ci.lib.sh
source "$(dirname "$0")/lib/ci.lib.sh"
cd "$CI_TOPLEVEL_DIR"
# Declare the global environments collected from various sources.
declare CI_ENV_LIBPNG_VER # collected from png.h
declare CI_ENV_AUTOCONF_VER # collected from configure.ac
declare CI_ENV_CMAKE_VER # collected from CMakeLists.txt
declare CI_ENV_LIBPNGCONFIG_VER # collected from scripts/libpng-config-head.in
function ci_run_shellify {
local my_script my_result
my_script="$CI_SCRIPT_DIR/libexec/ci_shellify_${1#--}.sh"
shift 1
[[ -f $my_script ]] || {
ci_err_internal "missing script: '$my_script'"
}
ci_info "shellifying:" "$@"
"$BASH" "$my_script" "$@"
echo "$my_result" | "$BASH" --posix || ci_err "bad shellify output"
echo "$my_result"
}
function ci_init_version_verification {
ci_info "## START OF VERIFICATION ##"
CI_ENV_LIBPNG_VER="$(ci_run_shellify --c png.h)"
echo "$CI_ENV_LIBPNG_VER"
CI_ENV_AUTOCONF_VER="$(ci_run_shellify --autoconf configure.ac)"
echo "$CI_ENV_AUTOCONF_VER"
CI_ENV_CMAKE_VER="$(ci_run_shellify --cmake CMakeLists.txt)"
echo "$CI_ENV_CMAKE_VER"
CI_ENV_LIBPNGCONFIG_VER="$(ci_run_shellify --shell scripts/libpng-config-head.in)"
echo "$CI_ENV_LIBPNGCONFIG_VER"
}
# shellcheck disable=SC2154
function ci_do_version_verification {
local my_expect
ci_info "## VERIFYING: version definitions in 'png.h' ##"
eval "$CI_ENV_LIBPNG_VER"
my_expect="${PNG_LIBPNG_VER_MAJOR}.${PNG_LIBPNG_VER_MINOR}.${PNG_LIBPNG_VER_RELEASE}"
if [[ "$PNG_LIBPNG_VER_STRING" == "$my_expect"* ]]
then
ci_info "matched: \$PNG_LIBPNG_VER_STRING == $my_expect*"
else
ci_err "mismatched: \$PNG_LIBPNG_VER_STRING != $my_expect*"
fi
my_expect=$((PNG_LIBPNG_VER_MAJOR*10000 + PNG_LIBPNG_VER_MINOR*100 + PNG_LIBPNG_VER_RELEASE))
if [[ "$PNG_LIBPNG_VER" == "$my_expect" ]]
then
ci_info "matched: \$PNG_LIBPNG_VER == $my_expect"
else
ci_err "mismatched: \$PNG_LIBPNG_VER != $my_expect"
fi
my_expect=$((PNG_LIBPNG_VER_MAJOR*10 + PNG_LIBPNG_VER_MINOR))
if [[ "$PNG_LIBPNG_VER_SHAREDLIB" == "$my_expect" ]]
then
ci_info "matched: \$PNG_LIBPNG_VER_SHAREDLIB == $my_expect"
else
ci_err "mismatched: \$PNG_LIBPNG_VER_SHAREDLIB != $my_expect"
fi
if [[ "$PNG_LIBPNG_VER_SONUM" == "$my_expect" ]]
then
ci_info "matched: \$PNG_LIBPNG_VER_SONUM == $my_expect"
else
ci_err "mismatched: \$PNG_LIBPNG_VER_SONUM != $my_expect"
fi
if [[ "$PNG_LIBPNG_VER_DLLNUM" == "$my_expect" ]]
then
ci_info "matched: \$PNG_LIBPNG_VER_DLLNUM == $my_expect"
else
ci_err "mismatched: \$PNG_LIBPNG_VER_DLLNUM != $my_expect"
fi
if [[ "$PNG_LIBPNG_VER_BUILD" == [01] ]]
then
ci_info "matched: \$PNG_LIBPNG_VER_BUILD == [01]"
else
ci_err "mismatched: \$PNG_LIBPNG_VER_BUILD != [01]"
fi
ci_info "## VERIFYING: build definitions in 'png.h' ##"
my_expect="${PNG_LIBPNG_VER_MAJOR}.${PNG_LIBPNG_VER_MINOR}.${PNG_LIBPNG_VER_RELEASE}"
if [[ "$PNG_LIBPNG_VER_STRING" == "$my_expect" ]]
then
if [[ $PNG_LIBPNG_VER_BUILD -eq 0 ]]
then
ci_info "matched: \$PNG_LIBPNG_VER_BUILD -eq 0"
else
ci_err "mismatched: \$PNG_LIBPNG_VER_BUILD -ne 0"
fi
if [[ $PNG_LIBPNG_BUILD_BASE_TYPE -eq $PNG_LIBPNG_BUILD_STABLE ]]
then
ci_info "matched: \$PNG_LIBPNG_BUILD_BASE_TYPE -eq \$PNG_LIBPNG_BUILD_STABLE"
else
ci_err "mismatched: \$PNG_LIBPNG_BUILD_BASE_TYPE -ne \$PNG_LIBPNG_BUILD_STABLE"
fi
elif [[ "$PNG_LIBPNG_VER_STRING" == "$my_expect".git ]]
then
if [[ $PNG_LIBPNG_VER_BUILD -ne 0 ]]
then
ci_info "matched: \$PNG_LIBPNG_VER_BUILD -ne 0"
else
ci_err "mismatched: \$PNG_LIBPNG_VER_BUILD -eq 0"
fi
if [[ $PNG_LIBPNG_BUILD_BASE_TYPE -ne $PNG_LIBPNG_BUILD_STABLE ]]
then
ci_info "matched: \$PNG_LIBPNG_BUILD_BASE_TYPE -ne \$PNG_LIBPNG_BUILD_STABLE"
else
ci_err "mismatched: \$PNG_LIBPNG_BUILD_BASE_TYPE -eq \$PNG_LIBPNG_BUILD_STABLE"
fi
else
ci_err "unexpected: \$PNG_LIBPNG_VER_STRING == '$PNG_LIBPNG_VER_STRING'"
fi
ci_info "## VERIFYING: type definitions in 'png.h' ##"
my_expect="$(echo "png_libpng_version_${PNG_LIBPNG_VER_STRING}" | tr . _)"
ci_spawn grep -w -e "$my_expect" png.h
ci_info "## VERIFYING: version definitions in 'configure.ac' ##"
eval "$CI_ENV_AUTOCONF_VER"
if [[ "$PNGLIB_VERSION" == "$PNG_LIBPNG_VER_STRING" ]]
then
ci_info "matched: \$PNGLIB_VERSION == \$PNG_LIBPNG_VER_STRING"
else
ci_err "mismatched: \$PNGLIB_VERSION != \$PNG_LIBPNG_VER_STRING"
fi
ci_info "## VERIFYING: version definitions in 'CMakeLists.txt' ##"
eval "$CI_ENV_CMAKE_VER"
if [[ "$PNGLIB_VERSION" == "$PNG_LIBPNG_VER_STRING" && "$PNGLIB_SUBREVISION" == 0 ]]
then
ci_info "matched: \$PNGLIB_VERSION == \$PNG_LIBPNG_VER_STRING"
ci_info "matched: \$PNGLIB_SUBREVISION == 0"
elif [[ "$PNGLIB_VERSION.$PNGLIB_SUBREVISION" == "$PNG_LIBPNG_VER_STRING" ]]
then
ci_info "matched: \$PNGLIB_VERSION.\$PNGLIB_SUBREVISION == \$PNG_LIBPNG_VER_STRING"
else
ci_err "mismatched: \$PNGLIB_VERSION != \$PNG_LIBPNG_VER_STRING"
fi
ci_info "## VERIFYING: version definitions in 'scripts/libpng-config-head.in' ##"
eval "$CI_ENV_LIBPNGCONFIG_VER"
if [[ "$version" == "$PNG_LIBPNG_VER_STRING" ]]
then
ci_info "matched: \$version == \$PNG_LIBPNG_VER_STRING"
else
ci_err "mismatched: \$version != \$PNG_LIBPNG_VER_STRING"
fi
}
function ci_finish_version_verification {
ci_info "## END OF VERIFICATION ##"
# Relying on "set -o errexit" to not reach here in case of error.
ci_info "## SUCCESS ##"
}
function ci_verify_version {
ci_init_version_verification
ci_do_version_verification
ci_finish_version_verification
}
function usage {
echo "usage: $CI_SCRIPT_NAME [<options>]"
echo "options: -?|-h|--help"
exit "${@:-0}"
}
function main {
local opt
while getopts ":" opt
do
# This ain't a while-loop. It only pretends to be.
[[ $1 == -[?h]* || $1 == --help || $1 == --help=* ]] && usage 0
ci_err "unknown option: '$1'"
done
shift $((OPTIND - 1))
[[ $# -eq 0 ]] || {
echo >&2 "error: unexpected argument: '$1'"
usage 2
}
# And... go!
ci_verify_version
}
main "$@"

111
ci/lib/ci.lib.sh Normal file
View File

@ -0,0 +1,111 @@
# Copyright (c) 2019-2025 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
test -f "$BASH_SOURCE" || {
echo >&2 "warning: this module requires Bash version 3 or newer"
}
test "${#BASH_SOURCE[@]}" -gt 1 || {
echo >&2 "warning: this module should be sourced from a Bash script"
}
# Reset the locale to avoid surprises from locale-dependent commands.
export LC_ALL=C
export LANG=C
export LANGUAGE=C
# Reset CDPATH to avoid surprises from the "cd" command.
export CDPATH=""
# Initialize the global constants CI_SCRIPT_{NAME,DIR} and CI_TOPLEVEL_DIR.
CI_SCRIPT_NAME="$(basename -- "$0")"
CI_SCRIPT_DIR="$(cd "$(dirname -- "$0")" && pwd)"
CI_TOPLEVEL_DIR="$(cd "$(dirname -- "${BASH_SOURCE[0]}")/../.." && pwd)"
# Initialize the global constants CI_BUILD_{...} for the host build platform.
CI_BUILD_ARCH="${CI_BUILD_ARCH:-"$(uname -m | tr 'A-Z/\.-' 'a-z____')"}"
CI_BUILD_SYSTEM="${CI_BUILD_SYSTEM:-"$(uname -s | tr 'A-Z/\.-' 'a-z____')"}"
# Initialize the global constants CI_TARGET_{...} for the target platform.
CI_TARGET_ARCH="${CI_TARGET_ARCH:-"$CI_BUILD_ARCH"}"
CI_TARGET_SYSTEM="${CI_TARGET_SYSTEM:-"$CI_BUILD_SYSTEM"}"
function ci_info {
printf >&2 "%s: %s\\n" "$CI_SCRIPT_NAME" "$*"
}
function ci_warn {
printf >&2 "%s: warning: %s\\n" "$CI_SCRIPT_NAME" "$*"
}
function ci_err {
printf >&2 "%s: error: %s\\n" "$CI_SCRIPT_NAME" "$*"
exit 2
}
function ci_err_internal {
printf >&2 "%s: internal error: %s\\n" "$CI_SCRIPT_NAME" "$*"
printf >&2 "ABORTED\\n"
# Exit with the conventional SIGABRT code.
exit 134
}
function ci_expr {
if [[ ${*:-0} == [0-9] ]]
then
# This is the same as in the else-branch below, albeit much faster
# for our intended use cases.
return $((!$1))
else
# The funny-looking compound command "... && return $? || return $?"
# allows the execution to continue uninterrupted under "set -e".
expr >/dev/null "$@" && return $? || return $?
fi
}
function ci_spawn {
printf >&2 "%s: executing:" "$CI_SCRIPT_NAME"
printf >&2 " %q" "$@"
printf >&2 "\\n"
"$@"
}
# Ensure that the internal initialization is correct.
[[ $CI_TOPLEVEL_DIR/ci/lib/ci.lib.sh -ef ${BASH_SOURCE[0]} ]] || {
ci_err_internal "bad or missing \$CI_TOPLEVEL_DIR"
}
[[ $CI_SCRIPT_DIR/$CI_SCRIPT_NAME -ef $0 ]] || {
ci_err_internal "bad or missing \$CI_SCRIPT_DIR/\$CI_SCRIPT_NAME"
}
[[ $CI_BUILD_ARCH && $CI_BUILD_SYSTEM ]] || {
ci_err_internal "missing \$CI_BUILD_ARCH or \$CI_BUILD_SYSTEM"
}
[[ $CI_TARGET_ARCH && $CI_TARGET_SYSTEM ]] || {
ci_err_internal "missing \$CI_TARGET_ARCH or \$CI_TARGET_SYSTEM"
}
# Ensure that the user initialization is correct.
[[ ${CI_FORCE:-0} == [01] ]] || {
ci_err "bad boolean option: \$CI_FORCE: '$CI_FORCE'"
}
[[ ${CI_NO_BUILD:-0} == [01] ]] || {
ci_err "bad boolean option: \$CI_NO_BUILD: '$CI_NO_BUILD'"
}
[[ ${CI_NO_TEST:-0} == [01] ]] || {
ci_err "bad boolean option: \$CI_NO_TEST: '$CI_NO_TEST'"
}
[[ ${CI_NO_INSTALL:-0} == [01] ]] || {
ci_err "bad boolean option: \$CI_NO_INSTALL: '$CI_NO_INSTALL'"
}
[[ ${CI_NO_CLEAN:-0} == [01] ]] || {
ci_err "bad boolean option: \$CI_NO_CLEAN: '$CI_NO_CLEAN'"
}
if ci_expr $((CI_NO_BUILD))
then
ci_expr $((CI_NO_TEST && CI_NO_INSTALL)) || {
ci_err "\$CI_NO_BUILD requires \$CI_NO_TEST and \$CI_NO_INSTALL"
}
fi

View File

@ -0,0 +1,48 @@
#!/usr/bin/env bash
set -o errexit -o pipefail -o posix
# Copyright (c) 2019-2025 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
# shellcheck source=ci/lib/ci.lib.sh
source "$(dirname "$0")/../lib/ci.lib.sh"
function ci_shellify_autoconf {
# Convert autoconf (M4) text, specifically originating
# from configure.ac, to shell scripting text.
# Select only the easy-to-parse definitions of PNGLIB_*.
sed -n -e '/^ *PNGLIB_[^ ]*=[$"0-9A-Za-z_]/ p' |
sed -e 's/^ *PNG\([0-9A-Za-z_]*\)=\([^# ]*\).*$/PNG\1=\2/' \
-e 's/^\([^ ]*=[^ ]*\).*$/export \1;/'
}
function usage {
echo "usage: $CI_SCRIPT_NAME [<options>] configure.ac"
echo "options: -?|-h|--help"
exit "${@:-0}"
}
function main {
local opt
while getopts ":" opt
do
# This ain't a while-loop. It only pretends to be.
[[ $1 == -[?h]* || $1 == --help || $1 == --help=* ]] && usage 0
ci_err "unknown option: '$1'"
done
shift $((OPTIND - 1))
[[ $# -eq 0 ]] && usage 2
[[ $# -eq 1 ]] || ci_err "too many operands"
# And... go!
test -e "$1" || ci_err "no such file: '$1'"
[[ $(basename -- "$1") == configure.ac ]] || {
ci_err "incorrect operand: '$1' (expecting: 'configure.ac')"
}
ci_shellify_autoconf <"$1"
}
main "$@"

49
ci/libexec/ci_shellify_c.sh Executable file
View File

@ -0,0 +1,49 @@
#!/usr/bin/env bash
set -o errexit -o pipefail -o posix
# Copyright (c) 2019-2025 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
# shellcheck source=ci/lib/ci.lib.sh
source "$(dirname "$0")/../lib/ci.lib.sh"
function ci_shellify_c {
# Convert C preprocessor text, specifically originating
# from png.h, to shell scripting text.
# Select only the easy-to-parse definitions of PNG_LIBPNG_*.
sed -n -e '/^\# *define * PNG_LIBPNG_[^ ]* * ["0-9A-Za-z_]/ p' |
sed -e 's/^\# *define * PNG\([^ ]*\) * \([^ ]*\)/PNG\1=\2/' \
-e 's/=PNG\([0-9A-Za-z_]*\)/=\${PNG\1}/' \
-e 's/^\([^ ]*=[^ ]*\).*$/export \1;/'
}
function usage {
echo "usage: $CI_SCRIPT_NAME [<options>] png.h"
echo "options: -?|-h|--help"
exit "${@:-0}"
}
function main {
local opt
while getopts ":" opt
do
# This ain't a while-loop. It only pretends to be.
[[ $1 == -[?h]* || $1 == --help || $1 == --help=* ]] && usage 0
ci_err "unknown option: '$1'"
done
shift $((OPTIND - 1))
[[ $# -eq 0 ]] && usage 2
[[ $# -eq 1 ]] || ci_err "too many operands"
# And... go!
test -e "$1" || ci_err "no such file: '$1'"
[[ $(basename -- "$1") == png.h ]] || {
ci_err "incorrect operand: '$1' (expecting: 'png.h')"
}
ci_shellify_c <"$1"
}
main "$@"

49
ci/libexec/ci_shellify_cmake.sh Executable file
View File

@ -0,0 +1,49 @@
#!/usr/bin/env bash
set -o errexit -o pipefail -o posix
# Copyright (c) 2019-2025 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
# shellcheck source=ci/lib/ci.lib.sh
source "$(dirname "$0")/../lib/ci.lib.sh"
function ci_shellify_cmake {
# Convert CMake lists text, specifically originating
# from CMakeLists.txt, to shell scripting text.
# Select only the easy-to-parse definitions of PNGLIB_*.
sed -n -e '/^ *set *(PNGLIB_[^ ]* * [$"0-9A-Za-z_].*)/ p' |
sed -e 's/^ *set *(PNG\([^ ]*\) * \([^() ]*\)).*$/PNG\1=\2/' \
-e 's/^\([^ ]*=[^ ]*\).*$/export \1;/'
}
function usage {
echo "usage: $CI_SCRIPT_NAME [<options>] CMakeLists.txt"
echo "options: -?|-h|--help"
exit "${@:-0}"
}
function main {
local opt
while getopts ":" opt
do
# This ain't a while-loop. It only pretends to be.
[[ $1 == -[?h]* || $1 == --help || $1 == --help=* ]] && usage 0
ci_err "unknown option: '$1'"
done
shift $((OPTIND - 1))
[[ $# -eq 0 ]] && usage 2
[[ $# -eq 1 ]] || ci_err "too many operands"
# And... go!
test -e "$1" || ci_err "no such file: '$1'"
filename="$(basename -- "$1")"
[[ $filename == [Cc][Mm]ake[Ll]ists.txt ]] || {
ci_err "incorrect operand: '$1' (expecting: 'CMakeLists.txt')"
}
ci_shellify_cmake <"$1"
}
main "$@"

46
ci/libexec/ci_shellify_shell.sh Executable file
View File

@ -0,0 +1,46 @@
#!/usr/bin/env bash
set -o errexit -o pipefail -o posix
# Copyright (c) 2019-2025 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
# shellcheck source=ci/lib/ci.lib.sh
source "$(dirname "$0")/../lib/ci.lib.sh"
function ci_shellify_shell {
# Convert shell scripting text to shell scripting text.
# Select only the easy-to-parse version definitions.
sed -n -e '/^ *[A-Za-z_][0-9A-Za-z_]*=[0-9][^ #]* *$/ p' |
sed -e 's/^ *\([^ ]*=[^ ]*\) *$/export \1;/'
}
function usage {
echo "usage: $CI_SCRIPT_NAME [<options>] libpng-config-head.in"
echo "options: -?|-h|--help"
exit "${@:-0}"
}
function main {
local opt
while getopts ":" opt
do
# This ain't a while-loop. It only pretends to be.
[[ $1 == -[?h]* || $1 == --help || $1 == --help=* ]] && usage 0
ci_err "unknown option: '$1'"
done
shift $((OPTIND - 1))
[[ $# -eq 0 ]] && usage 2
[[ $# -eq 1 ]] || ci_err "too many operands"
# And... go!
test -e "$1" || ci_err "no such file: '$1'"
[[ $(basename -- "$1") == libpng-config-head.in ]] || {
ci_err "incorrect operand: '$1' (expecting: 'libpng-config-head.in')"
}
ci_shellify_shell <"$1"
}
main "$@"

View File

@ -0,0 +1,16 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=aarch64
export CI_TARGET_ARCHVER=aarch64
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=android
export CI_TARGET_ABIVER=android29
export CI_CC="$CI_TARGET_ARCHVER-$CI_TARGET_SYSTEM-$CI_TARGET_ABIVER-clang"
export CI_AR="llvm-ar"
export CI_RANLIB="llvm-ranlib"

View File

@ -0,0 +1,16 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=arm
export CI_TARGET_ARCHVER=armv7a
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=androideabi
export CI_TARGET_ABIVER=androideabi29
export CI_CC="$CI_TARGET_ARCHVER-$CI_TARGET_SYSTEM-$CI_TARGET_ABIVER-clang"
export CI_AR="llvm-ar"
export CI_RANLIB="llvm-ranlib"

View File

@ -0,0 +1,16 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=i686
export CI_TARGET_ARCHVER=i686
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=android
export CI_TARGET_ABIVER=android29
export CI_CC="$CI_TARGET_ARCHVER-$CI_TARGET_SYSTEM-$CI_TARGET_ABIVER-clang"
export CI_AR="llvm-ar"
export CI_RANLIB="llvm-ranlib"

View File

@ -0,0 +1,16 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=x86_64
export CI_TARGET_ARCHVER=x86_64
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=android
export CI_TARGET_ABIVER=android29
export CI_CC="$CI_TARGET_ARCHVER-$CI_TARGET_SYSTEM-$CI_TARGET_ABIVER-clang"
export CI_AR="llvm-ar"
export CI_RANLIB="llvm-ranlib"

View File

@ -0,0 +1,18 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=i686
export CI_TARGET_SYSTEM=cygwin
export CI_CC="$CI_TARGET_ARCH-pc-$CI_TARGET_SYSTEM-gcc"
export CI_AR="$CI_CC-ar"
export CI_RANLIB="$CI_CC-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=CYGWIN
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,18 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=x86_64
export CI_TARGET_SYSTEM=cygwin
export CI_CC="$CI_TARGET_ARCH-pc-$CI_TARGET_SYSTEM-gcc"
export CI_AR="$CI_CC-ar"
export CI_RANLIB="$CI_CC-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=CYGWIN
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,15 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=arm64
export CI_TARGET_SYSTEM=darwin
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Darwin
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
-DCMAKE_OSX_ARCHITECTURES=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,15 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=x86_64
export CI_TARGET_SYSTEM=darwin
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Darwin
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
-DCMAKE_OSX_ARCHITECTURES=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,14 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=aarch64
export CI_TARGET_SYSTEM=freebsd
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=FreeBSD
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,14 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=i686
export CI_TARGET_SYSTEM=freebsd
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=FreeBSD
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,14 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=riscv64
export CI_TARGET_SYSTEM=freebsd
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=FreeBSD
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,14 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=x86_64
export CI_TARGET_SYSTEM=freebsd
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=FreeBSD
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,21 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=aarch64
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnu
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,21 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=arm
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnueabi
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,21 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=arm
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnueabihf
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,21 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=i686
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnu
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,21 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=mips
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnu
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,21 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=mips64
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnuabi64
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,21 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=mips64el
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnuabi64
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,21 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=mipsel
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnu
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,21 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=mipsisa32r6
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnu
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,21 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=mipsisa32r6el
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnu
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,21 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=mipsisa64r6
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnuabi64
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,21 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=mipsisa64r6el
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnuabi64
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,21 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=powerpc
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnu
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,21 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=powerpc64
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnu
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,21 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=powerpc64le
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnu
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,21 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=riscv64
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnu
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,21 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=x86_64
export CI_TARGET_SYSTEM=linux
export CI_TARGET_ABI=gnu
export CI_GCC="${CI_GCC-gcc}"
export CI_CC="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-$CI_GCC"
export CI_AR="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ar"
export CI_RANLIB="$CI_TARGET_ARCH-$CI_TARGET_SYSTEM-$CI_TARGET_ABI-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,18 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=i386
export CI_TARGET_SYSTEM=msdoswatcom
export CI_CC="wcl386"
# Open Watcom V2 CMake build
# https://github.com/open-watcom/open-watcom-v2/discussions/716
export CI_CMAKE_GENERATOR="Watcom WMake"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=DOS
"

View File

@ -0,0 +1,18 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=i586
export CI_TARGET_SYSTEM=msdosdjgpp
export CI_CC="$CI_TARGET_ARCH-pc-$CI_TARGET_SYSTEM-gcc"
export CI_AR="$CI_CC-ar"
export CI_RANLIB="$CI_CC-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Generic
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,19 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=i86
export CI_TARGET_SYSTEM=msdoswatcom
export CI_CC="wcl"
# Open Watcom V2 CMake build
# https://github.com/open-watcom/open-watcom-v2/discussions/716
export CI_CMAKE_GENERATOR="Watcom WMake"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=DOS
-DCMAKE_SYSTEM_PROCESSOR=I86
"

View File

@ -0,0 +1,18 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=aarch64
export CI_TARGET_SYSTEM=windows
export CI_CC="clang"
export CI_AR="llvm-ar"
export CI_RANLIB="llvm-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Windows
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,21 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=i686
export CI_TARGET_SYSTEM=mingw32
# The output of `uname -s` on MSYS2 is understandable, and so is
# CI_TARGET_SYSTEM above, in simplified form. (See also Cygwin.)
# But aside from that, the Mingw-w64 nomenclature is rather messy.
export CI_CC="$CI_TARGET_ARCH-w64-mingw32-gcc"
export CI_AR="$CI_CC-ar"
export CI_RANLIB="$CI_CC-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Windows
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,18 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=i686
export CI_TARGET_SYSTEM=windows
export CI_CC="clang"
export CI_AR="llvm-ar"
export CI_RANLIB="llvm-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Windows
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,21 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=x86_64
export CI_TARGET_SYSTEM=mingw64
# The output of `uname -s` on MSYS2 is understandable, and so is
# CI_TARGET_SYSTEM above, in simplified form. (See also Cygwin.)
# But aside from that, the Mingw-w64 nomenclature is rather messy.
export CI_CC="$CI_TARGET_ARCH-w64-mingw32-gcc"
export CI_AR="$CI_CC-ar"
export CI_RANLIB="$CI_CC-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Windows
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

View File

@ -0,0 +1,18 @@
# Copyright (c) 2023-2024 Cosmin Truta.
#
# Use, modification and distribution are subject to the MIT License.
# Please see the accompanying file LICENSE_MIT.txt
#
# SPDX-License-Identifier: MIT
export CI_TARGET_ARCH=x86_64
export CI_TARGET_SYSTEM=windows
export CI_CC="clang"
export CI_AR="llvm-ar"
export CI_RANLIB="llvm-ranlib"
export CI_CMAKE_VARS="
-DCMAKE_SYSTEM_NAME=Windows
-DCMAKE_SYSTEM_PROCESSOR=$CI_TARGET_ARCH
"

364
compile Executable file
View File

@ -0,0 +1,364 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2025-06-18.21; # UTC
# Copyright (C) 1999-2025 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file unneeded_conversions
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) UNNEEDED_CONVERSIONS, no
# conversion will take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
if test -n "$MSYSTEM" && (cygpath --version) >/dev/null 2>&1; then
# MSYS2 environment.
file_conv=cygwin
else
# Original MinGW environment.
file_conv=mingw
fi
;;
MSYS*)
# Old MSYS environment, or MSYS2 with 32-bit MSYS2 shell.
file_conv=cygwin
;;
CYGWIN*)
# Cygwin environment.
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
# This is the optimization mentioned above:
# If UNNEEDED_CONVERSIONS contains $file_conv, don't convert.
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/*)
file=`cygpath -w "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}
# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
if test -f "$dir/lib$lib.a"; then
found=yes
lib=$dir/lib$lib.a
break
fi
done
IFS=$save_IFS
if test "$found" != yes; then
lib=$lib.lib
fi
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.lo | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-L*)
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}
eat=
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
GNU Automake home page: <https://www.gnu.org/software/automake/>.
General help using GNU software: <https://www.gnu.org/gethelp/>.
EOF
exit $?
;;
-v | --v*)
echo "compile (GNU Automake) $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
clang-cl | *[/\\]clang-cl | clang-cl.exe | *[/\\]clang-cl.exe | \
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
# So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no '-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp nil t)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%Y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

1815
config.guess vendored Executable file

File diff suppressed because it is too large Load Diff

138
config.h.in Normal file
View File

@ -0,0 +1,138 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the 'feenableexcept' function. */
#undef HAVE_FEENABLEEXCEPT
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the 'm' library (-lm). */
#undef HAVE_LIBM
/* Define to 1 if you have the 'z' library (-lz). */
#undef HAVE_LIBZ
/* Define to 1 if you have the 'pow' function. */
#undef HAVE_POW
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdio.h> header file. */
#undef HAVE_STDIO_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#undef LT_OBJDIR
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Turn on ARM Neon optimizations at run-time */
#undef PNG_ARM_NEON_API_SUPPORTED
/* Check for ARM Neon support at run-time */
#undef PNG_ARM_NEON_CHECK_SUPPORTED
/* Enable ARM Neon optimizations */
#undef PNG_ARM_NEON_OPT
/* Enable Intel SSE optimizations */
#undef PNG_INTEL_SSE_OPT
/* Enable LOONGARCH LSX optimizations */
#undef PNG_LOONGARCH_LSX_OPT
/* Turn on MIPS MMI optimizations at run-time */
#undef PNG_MIPS_MMI_API_SUPPORTED
/* Check for MIPS MMI support at run-time */
#undef PNG_MIPS_MMI_CHECK_SUPPORTED
/* Enable MIPS MMI optimizations */
#undef PNG_MIPS_MMI_OPT
/* Turn on MIPS MSA optimizations at run-time */
#undef PNG_MIPS_MSA_API_SUPPORTED
/* Check for MIPS MSA support at run-time */
#undef PNG_MIPS_MSA_CHECK_SUPPORTED
/* Enable MIPS MSA optimizations */
#undef PNG_MIPS_MSA_OPT
/* Turn on POWERPC VSX optimizations at run-time */
#undef PNG_POWERPC_VSX_API_SUPPORTED
/* Check for POWERPC VSX support at run-time */
#undef PNG_POWERPC_VSX_CHECK_SUPPORTED
/* Enable POWERPC VSX optimizations */
#undef PNG_POWERPC_VSX_OPT
/* Enable RISCV RVV optimizations */
#undef PNG_RISCV_RVV_OPT
/* Define to 1 if all of the C89 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#undef STDC_HEADERS
/* Define to 1 if your <sys/time.h> declares 'struct tm'. */
#undef TM_IN_SYS_TIME
/* Version number of package */
#undef VERSION
/* Define to the equivalent of the C99 'restrict' keyword, or to
nothing if this is not supported. Do not define if restrict is
supported only directly. */
#undef restrict
/* Work around a bug in older versions of Sun C++, which did not
#define __restrict__ or support _Restrict or __restrict__
even though the corresponding Sun C compiler ended up with
"#define restrict _Restrict" or "#define restrict __restrict__"
in the previous line. This workaround can be removed once
we assume Oracle Developer Studio 12.5 (2016) or later. */
#if defined __SUNPRO_CC && !defined __RESTRICT && !defined __restrict__
# define _Restrict
# define __restrict__
#endif

2354
config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

18185
configure vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
# configure.ac # configure.ac
# Copyright (c) 2018-2024 Cosmin Truta
# Copyright (c) 2004-2016 Glenn Randers-Pehrson # Copyright (c) 2004-2016 Glenn Randers-Pehrson
# Last changed in libpng 1.6.25 [September 1, 2016]
# This code is released under the libpng license. # This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer # For conditions of distribution and use, see the disclaimer
@ -25,8 +25,8 @@ AC_PREREQ([2.68])
dnl Version number stuff here: dnl Version number stuff here:
AC_INIT([libpng],[1.6.33],[png-mng-implement@lists.sourceforge.net]) AC_INIT([libpng],[1.6.51.git],[png-mng-implement@lists.sourceforge.net])
AC_CONFIG_MACRO_DIR([scripts]) AC_CONFIG_MACRO_DIR([scripts/autoconf])
# libpng does not follow GNU file name conventions (hence 'foreign') # libpng does not follow GNU file name conventions (hence 'foreign')
# color-tests requires automake 1.11 or later # color-tests requires automake 1.11 or later
@ -46,17 +46,17 @@ dnl automake, so the following is not necessary (and is not defined anyway):
dnl AM_PREREQ([1.11.2]) dnl AM_PREREQ([1.11.2])
dnl stop configure from automagically running automake dnl stop configure from automagically running automake
PNGLIB_VERSION=1.6.33 PNGLIB_VERSION=1.6.51.git
PNGLIB_MAJOR=1 PNGLIB_MAJOR=1
PNGLIB_MINOR=6 PNGLIB_MINOR=6
PNGLIB_RELEASE=33 PNGLIB_RELEASE=51
dnl End of version number stuff dnl End of version number stuff
AC_CONFIG_SRCDIR([pngget.c]) AC_CONFIG_SRCDIR([pngget.c])
AC_CONFIG_HEADERS([config.h]) AC_CONFIG_HEADERS([config.h])
# Checks for programs. # Check the basic programs.
AC_LANG([C]) AC_LANG([C])
AC_PROG_CC AC_PROG_CC
AM_PROG_AS AM_PROG_AS
@ -72,16 +72,19 @@ dnl compatible later version may be used
LT_INIT([win32-dll]) LT_INIT([win32-dll])
LT_PREREQ([2.4.2]) LT_PREREQ([2.4.2])
# Some awks crash when confronted with pnglibconf.dfa, do a test run now dnl Declare the AWK variable.
# to make sure this doesn't happen AC_ARG_VAR(AWK, [AWK language processor])
AC_MSG_CHECKING([that AWK works])
# Some awk implementations crash when confronted with pnglibconf.dfa.
# Run a test now, to make sure this doesn't happen.
AC_MSG_CHECKING([if awk ($AWK) works])
if ${AWK} -f ${srcdir}/scripts/options.awk out="/dev/null" version=search\ if ${AWK} -f ${srcdir}/scripts/options.awk out="/dev/null" version=search\
${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\ ${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\
${srcdir}/pngusr.dfa 1>&2 ${srcdir}/pngusr.dfa 1>&2
then then
AC_MSG_RESULT([ok]) AC_MSG_RESULT([yes])
else else
AC_MSG_FAILURE([failed], 1) AC_MSG_FAILURE([no], 1)
fi fi
# This is a remnant of the old cc -E validation, where it may have been # This is a remnant of the old cc -E validation, where it may have been
@ -89,11 +92,29 @@ fi
DFNCPP="$CPP" DFNCPP="$CPP"
AC_SUBST(DFNCPP) AC_SUBST(DFNCPP)
# -Werror cannot be passed to GCC in CFLAGS because configure will fail (it AC_ARG_ENABLE([tests],
# checks the compiler with a program that generates a warning), add the AS_HELP_STRING([--disable-tests],
# following option to deal with this [do not build the test programs (default is to build)]),
[enable_tests="$enableval"],
[enable_tests=yes])
AM_CONDITIONAL([ENABLE_TESTS],
[test "$enable_tests" != "no"])
AC_ARG_ENABLE([tools],
AS_HELP_STRING([--disable-tools],
[do not build the auxiliary tools (default is to build)]),
[enable_tools="$enableval"],
[enable_tools=yes])
AM_CONDITIONAL([ENABLE_TOOLS],
[test "$enable_tools" != "no"])
# -Werror cannot be passed to GCC in CFLAGS because configure will fail
# (it checks the compiler with a program that generates a warning).
# Add the following option to deal with this:
AC_ARG_VAR(PNG_COPTS, AC_ARG_VAR(PNG_COPTS,
[additional flags for the C compiler, use this for options that would] [additional flags for the C compiler, to be used for options that would]
[cause configure itself to fail]) [cause configure itself to fail])
AC_ARG_ENABLE(werror, AC_ARG_ENABLE(werror,
AS_HELP_STRING([[[--enable-werror[=OPT]]]], AS_HELP_STRING([[[--enable-werror[=OPT]]]],
@ -114,10 +135,10 @@ AC_ARG_ENABLE(werror,
CFLAGS="$sav_CFLAGS" CFLAGS="$sav_CFLAGS"
fi],) fi],)
# For GCC 5 the default mode for C is -std=gnu11 instead of -std=gnu89 # For GCC 5 the default mode for C is -std=gnu11 instead of -std=gnu89.
# In pngpriv.h we request just the POSIX 1003.1 and C89 APIs by defining _POSIX_SOURCE to 1 # In pngpriv.h we request just the POSIX 1003.1 and C89 APIs by defining
# This is incompatible with the new default mode, so we test for that and force the # _POSIX_SOURCE to 1. This is incompatible with the new default mode, so
# "-std=c89" compiler option: # we test for that and force the "-std=c89" compiler option:
AC_MSG_CHECKING([if we need to force back C standard to C89]) AC_MSG_CHECKING([if we need to force back C standard to C89])
AC_COMPILE_IFELSE( AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([ [AC_LANG_PROGRAM([
@ -133,23 +154,17 @@ AC_COMPILE_IFELSE(
CFLAGS="$CFLAGS -std=c89" CFLAGS="$CFLAGS -std=c89"
]) ])
# Checks for header files. # Checks for structures and compiler characteristics.
AC_HEADER_STDC
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_STRUCT_TM AC_STRUCT_TM
AC_C_RESTRICT AC_C_RESTRICT
# Checks for library functions. # Checks for library functions.
AC_FUNC_STRTOD AC_CHECK_FUNCS([pow], ,
AC_CHECK_FUNCS([memset], , AC_MSG_ERROR(memset not found in libc)) [AC_CHECK_LIB([m], [pow], , [AC_MSG_ERROR([cannot find pow])])])
AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_MSG_ERROR(cannot find pow)) )
# Some later POSIX 1003.1 functions are required for test programs, failure here # Some later POSIX 1003.1 functions are required for test programs, failure
# is soft (the corresponding test program is not built). # here is soft (the corresponding test program is not built).
AC_CHECK_FUNC([clock_gettime],,[AC_MSG_WARN([not building timepng])]) AC_CHECK_FUNC([clock_gettime], , [AC_MSG_WARN([not building timepng])])
AM_CONDITIONAL([HAVE_CLOCK_GETTIME], [test "$ac_cv_func_clock_gettime" = "yes"]) AM_CONDITIONAL([HAVE_CLOCK_GETTIME], [test "$ac_cv_func_clock_gettime" = "yes"])
AC_ARG_WITH(zlib-prefix, AC_ARG_WITH(zlib-prefix,
@ -157,8 +172,9 @@ AC_ARG_WITH(zlib-prefix,
[prefix that may have been used in installed zlib]), [prefix that may have been used in installed zlib]),
[ZPREFIX=${withval}], [ZPREFIX=${withval}],
[ZPREFIX='z_']) [ZPREFIX='z_'])
AC_CHECK_LIB(z, zlibVersion, , AC_CHECK_LIB([z], [zlibVersion], ,
AC_CHECK_LIB(z, ${ZPREFIX}zlibVersion, , AC_MSG_ERROR(zlib not installed))) [AC_CHECK_LIB([z], [${ZPREFIX}zlibVersion], ,
[AC_MSG_ERROR([zlib not installed])])])
# The following is for pngvalid, to ensure it catches FP errors even on # The following is for pngvalid, to ensure it catches FP errors even on
# platforms that don't enable FP exceptions, the function appears in the math # platforms that don't enable FP exceptions, the function appears in the math
@ -210,9 +226,9 @@ AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
if test "$have_ld_version_script" = "yes"; then if test "$have_ld_version_script" = "yes"; then
AC_MSG_CHECKING([for symbol prefix]) AC_MSG_CHECKING([for symbol prefix])
SYMBOL_PREFIX=`echo "PREFIX=__USER_LABEL_PREFIX__" \ SYMBOL_PREFIX=`echo "PREFIX=__USER_LABEL_PREFIX__" \
| ${CPP-${CC-gcc} -E} - 2>&1 \ | ${CPP:-${CC:-gcc} -E} - 2>&1 \
| ${EGREP-grep} "^PREFIX=" \ | ${EGREP:-grep} "^PREFIX=" \
| ${SED-sed} -e "s:^PREFIX=::" -e "s:__USER_LABEL_PREFIX__::"` | ${SED:-sed} -e "s:^PREFIX=::" -e "s:__USER_LABEL_PREFIX__::"`
AC_SUBST(SYMBOL_PREFIX) AC_SUBST(SYMBOL_PREFIX)
AC_MSG_RESULT($SYMBOL_PREFIX) AC_MSG_RESULT($SYMBOL_PREFIX)
fi fi
@ -297,7 +313,7 @@ AC_ARG_ENABLE([unversioned-libpng-config],
AM_CONDITIONAL([DO_INSTALL_LIBPNG_CONFIG], AM_CONDITIONAL([DO_INSTALL_LIBPNG_CONFIG],
[test "$enable_unversioned_libpng_config" != "no"]) [test "$enable_unversioned_libpng_config" != "no"])
# HOST SPECIFIC OPTIONS # HOST-SPECIFIC OPTIONS
# ===================== # =====================
# #
# DEFAULT # DEFAULT
@ -305,7 +321,7 @@ AM_CONDITIONAL([DO_INSTALL_LIBPNG_CONFIG],
# #
AC_ARG_ENABLE([hardware-optimizations], AC_ARG_ENABLE([hardware-optimizations],
AS_HELP_STRING([[[--enable-hardware-optimizations]]], AS_HELP_STRING([[[--enable-hardware-optimizations]]],
[Enable hardware optimizations: =no/off, yes/on:]), [Enable hardware optimizations: =no/off, yes/on.]),
[case "$enableval" in [case "$enableval" in
no|off) no|off)
# disable hardware optimization on all systems: # disable hardware optimization on all systems:
@ -315,24 +331,36 @@ AC_ARG_ENABLE([hardware-optimizations],
enable_mips_msa=no enable_mips_msa=no
AC_DEFINE([PNG_MIPS_MSA_OPT], [0], AC_DEFINE([PNG_MIPS_MSA_OPT], [0],
[Disable MIPS_MSA optimizations]) [Disable MIPS_MSA optimizations])
enable_mips_mmi=no
AC_DEFINE([PNG_MIPS_MMI_OPT], [0],
[Disable MIPS_MMI optimizations])
enable_powerpc_vsx=no enable_powerpc_vsx=no
AC_DEFINE([PNG_POWERPC_VSX_OPT], [0], AC_DEFINE([PNG_POWERPC_VSX_OPT], [0],
[Disable POWERPC VSX optimizations]) [Disable POWERPC VSX optimizations])
enable_intel_sse=no enable_intel_sse=no
AC_DEFINE([PNG_INTEL_SSE_OPT], [0], AC_DEFINE([PNG_INTEL_SSE_OPT], [0],
[Disable INTEL_SSE optimizations]) [Disable INTEL_SSE optimizations])
enable_loongarch_lsx=no
AC_DEFINE([PNG_LOONGARCH_LSX_OPT], [0],
[Disable LOONGARCH_LSX optimizations])
enable_riscv_rvv=no
AC_DEFINE([PNG_RISCV_RVV_OPT], [0],
[Disable RISC-V Vector optimizations])
;; ;;
*) *)
# allow enabling hardware optimization on any system: # allow enabling hardware optimization on any system:
case "$host_cpu" in case "$host_cpu" in
arm*|aarch64*) arm*|aarch64*)
enable_arm_neon=yes enable_arm_neon=yes
AC_DEFINE([PNG_ARM_NEON_OPT], [0], AC_DEFINE([PNG_ARM_NEON_OPT], [2],
[Enable ARM_NEON optimizations]) [Enable ARM_NEON optimizations])
;; ;;
mipsel*|mips64el*) mipsel*|mips64el*)
enable_mips_mmi=yes
enable_mips_msa=yes enable_mips_msa=yes
AC_DEFINE([PNG_MIPS_MSA_OPT], [0], AC_DEFINE([PNG_MIPS_MMI_OPT], [1],
[Enable MIPS_MMI optimizations])
AC_DEFINE([PNG_MIPS_MSA_OPT], [2],
[Enable MIPS_MSA optimizations]) [Enable MIPS_MSA optimizations])
;; ;;
i?86|x86_64) i?86|x86_64)
@ -345,21 +373,30 @@ AC_ARG_ENABLE([hardware-optimizations],
AC_DEFINE([PNG_POWERPC_VSX_OPT], [2], AC_DEFINE([PNG_POWERPC_VSX_OPT], [2],
[Enable POWERPC VSX optimizations]) [Enable POWERPC VSX optimizations])
;; ;;
loongarch*)
enable_loongarch_lsx=yes
AC_DEFINE([PNG_LOONGARCH_LSX_OPT], [1],
[Enable LOONGARCH_LSX optimizations])
;;
riscv64)
enable_riscv_rvv=yes
AC_DEFINE([PNG_RISCV_RVV_OPT], [2],
[Enable RISC-V Vector optimizations])
;;
esac esac
;; ;;
esac]) esac])
# ARM # ARM NEON
# === # ========
#
# ARM NEON (SIMD) support.
AC_ARG_ENABLE([arm-neon], AC_ARG_ENABLE([arm-neon],
AS_HELP_STRING([[[--enable-arm-neon]]], AS_HELP_STRING([[[--enable-arm-neon]]],
[Enable ARM NEON optimizations: =no/off, check, api, yes/on:] [Enable ARM NEON optimizations: =no/off, check, api, yes/on.]
[no/off: disable the optimizations; check: use internal checking code] [no/off: disable the optimizations;]
[(deprecated and poorly supported); api: disable by default, enable by] [check: use internal checking code (deprecated and poorly supported);]
[a call to png_set_option; yes/on: turn on unconditionally.] [api: disable by default, enable by a call to png_set_option;]
[yes/on: turn on unconditionally.]
[If not specified: determined by the compiler.]), [If not specified: determined by the compiler.]),
[case "$enableval" in [case "$enableval" in
no|off) no|off)
@ -367,7 +404,7 @@ AC_ARG_ENABLE([arm-neon],
AC_DEFINE([PNG_ARM_NEON_OPT], [0], AC_DEFINE([PNG_ARM_NEON_OPT], [0],
[Disable ARM Neon optimizations]) [Disable ARM Neon optimizations])
# Prevent inclusion of the assembler files below: # Prevent inclusion of the assembler files below:
enable_arm_neon=no;; enable_arm_neon=no ;;
check) check)
AC_DEFINE([PNG_ARM_NEON_CHECK_SUPPORTED], [], AC_DEFINE([PNG_ARM_NEON_CHECK_SUPPORTED], [],
[Check for ARM Neon support at run-time]);; [Check for ARM Neon support at run-time]);;
@ -377,35 +414,35 @@ AC_ARG_ENABLE([arm-neon],
yes|on) yes|on)
AC_DEFINE([PNG_ARM_NEON_OPT], [2], AC_DEFINE([PNG_ARM_NEON_OPT], [2],
[Enable ARM Neon optimizations]) [Enable ARM Neon optimizations])
AC_MSG_WARN([--enable-arm-neon: please specify 'check' or 'api', if] AC_MSG_WARN([--enable-arm-neon: please specify 'check' or 'api';]
[you want the optimizations unconditionally pass -mfpu=neon] [if you want the optimizations unconditionally,]
[to the compiler.]);; [pass '-mfpu=neon' to the compiler.]);;
*) *)
AC_MSG_ERROR([--enable-arm-neon=${enable_arm_neon}: invalid value]) AC_MSG_ERROR([--enable-arm-neon=${enable_arm_neon}:]
[invalid argument])
esac]) esac])
# Add ARM specific files to all builds where the host_cpu is arm ('arm*') or # Add ARM-specific files to all builds where $host_cpu is arm ('arm*') or
# where ARM optimizations were explicitly requested (this allows a fallback if a # where ARM optimizations were explicitly requested. (This allows a fallback
# future host CPU does not match 'arm*') # if a future host CPU does not match 'arm*'.)
AM_CONDITIONAL([PNG_ARM_NEON], AM_CONDITIONAL([PNG_ARM_NEON],
[test "$enable_arm_neon" != 'no' && [test "$enable_arm_neon" != 'no' &&
case "$host_cpu" in case "$host_cpu" in
arm*|aarch64*) :;; arm*|aarch64*) : ;;
*) test "$enable_arm_neon" != '';; *) test "$enable_arm_neon" != '' ;;
esac]) esac])
# MIPS # MIPS MSA
# === # ========
#
# MIPS MSA (SIMD) support.
AC_ARG_ENABLE([mips-msa], AC_ARG_ENABLE([mips-msa],
AS_HELP_STRING([[[--enable-mips-msa]]], AS_HELP_STRING([[[--enable-mips-msa]]],
[Enable MIPS MSA optimizations: =no/off, check, api, yes/on:] [Enable MIPS MSA optimizations: =no/off, check, api, yes/on.]
[no/off: disable the optimizations; check: use internal checking code] [no/off: disable the optimizations;]
[(deprecated and poorly supported); api: disable by default, enable by] [check: use internal checking code (deprecated and poorly supported);]
[a call to png_set_option; yes/on: turn on unconditionally.] [api: disable by default, enable by a call to png_set_option;]
[yes/on: turn on unconditionally.]
[If not specified: determined by the compiler.]), [If not specified: determined by the compiler.]),
[case "$enableval" in [case "$enableval" in
no|off) no|off)
@ -413,7 +450,7 @@ AC_ARG_ENABLE([mips-msa],
AC_DEFINE([PNG_MIPS_MSA_OPT], [0], AC_DEFINE([PNG_MIPS_MSA_OPT], [0],
[Disable MIPS MSA optimizations]) [Disable MIPS MSA optimizations])
# Prevent inclusion of the assembler files below: # Prevent inclusion of the assembler files below:
enable_mips_msa=no;; enable_mips_msa=no ;;
check) check)
AC_DEFINE([PNG_MIPS_MSA_CHECK_SUPPORTED], [], AC_DEFINE([PNG_MIPS_MSA_CHECK_SUPPORTED], [],
[Check for MIPS MSA support at run-time]);; [Check for MIPS MSA support at run-time]);;
@ -423,31 +460,75 @@ AC_ARG_ENABLE([mips-msa],
yes|on) yes|on)
AC_DEFINE([PNG_MIPS_MSA_OPT], [2], AC_DEFINE([PNG_MIPS_MSA_OPT], [2],
[Enable MIPS MSA optimizations]) [Enable MIPS MSA optimizations])
AC_MSG_WARN([--enable-mips-msa: please specify 'check' or 'api', if] AC_MSG_WARN([--enable-mips-msa: please specify 'check' or 'api';]
[you want the optimizations unconditionally pass '-mmsa -mfp64'] [if you want the optimizations unconditionally,]
[to the compiler.]);; [pass '-mmsa -mfp64' to the compiler.]);;
*) *)
AC_MSG_ERROR([--enable-mips-msa=${enable_mips_msa}: invalid value]) AC_MSG_ERROR([--enable-mips-msa=${enable_mips_msa}:]
[invalid argument])
esac]) esac])
# Add MIPS specific files to all builds where the host_cpu is mips ('mips*') or # Add MIPS-specific files to all builds where $host_cpu is mips ('mips*') or
# where MIPS optimizations were explicitly requested (this allows a fallback if a # where MIPS optimizations were explicitly requested. (This allows a fallback
# future host CPU does not match 'mips*') # if a future host CPU does not match 'mips*'.)
AM_CONDITIONAL([PNG_MIPS_MSA], AM_CONDITIONAL([PNG_MIPS_MSA],
[test "$enable_mips_msa" != 'no' && [test "$enable_mips_msa" != 'no' &&
case "$host_cpu" in case "$host_cpu" in
mipsel*|mips64el*) :;; mipsel*|mips64el*) : ;;
esac]) esac])
# INTEL # MIPS MMI
# ===== # ========
#
# INTEL SSE (SIMD) support. AC_ARG_ENABLE([mips-mmi],
AS_HELP_STRING([[[--enable-mips-mmi]]],
[Enable MIPS MMI optimizations: =no/off, check, api, yes/on.]
[no/off: disable the optimizations;]
[check: use internal checking code (deprecated and poorly supported);]
[api: disable by default, enable by a call to png_set_option;]
[yes/on: turn on unconditionally.]
[If not specified: determined by the compiler.]),
[case "$enableval" in
no|off)
# disable the default enabling on __mips_mmi systems:
AC_DEFINE([PNG_MIPS_MMI_OPT], [0],
[Disable MIPS MMI optimizations])
# Prevent inclusion of the assembler files below:
enable_mips_mmi=no;;
check)
AC_DEFINE([PNG_MIPS_MMI_CHECK_SUPPORTED], [],
[Check for MIPS MMI support at run-time]);;
api)
AC_DEFINE([PNG_MIPS_MMI_API_SUPPORTED], [],
[Turn on MIPS MMI optimizations at run-time]);;
yes|on)
AC_DEFINE([PNG_MIPS_MMI_OPT], [1],
[Enable MIPS MMI optimizations])
AC_MSG_WARN([--enable-mips-mmi: please specify 'check' or 'api';]
[if you want the optimizations unconditionally]
[pass '-mloongson-mmi -march=loongson3a' to the compiler.]);;
*)
AC_MSG_ERROR([--enable-mips-mmi=${enable_mips_mmi}:]
[invalid argument])
esac])
# Add MIPS specific files to all builds where the host_cpu is mips ('mips*') or
# where MIPS optimizations were explicitly requested. (This allows a fallback
# if a future host CPU does not match 'mips*'.)
AM_CONDITIONAL([PNG_MIPS_MMI],
[test "$enable_mips_mmi" != 'no' &&
case "$host_cpu" in
mipsel*|mips64el*) : ;;
esac])
# INTEL SSE
# =========
AC_ARG_ENABLE([intel-sse], AC_ARG_ENABLE([intel-sse],
AS_HELP_STRING([[[--enable-intel-sse]]], AS_HELP_STRING([[[--enable-intel-sse]]],
[Enable Intel SSE optimizations: =no/off, yes/on:] [Enable Intel SSE optimizations: =no/off, yes/on.]
[no/off: disable the optimizations;] [no/off: disable the optimizations;]
[yes/on: enable the optimizations.] [yes/on: enable the optimizations.]
[If not specified: determined by the compiler.]), [If not specified: determined by the compiler.]),
@ -457,34 +538,34 @@ AC_ARG_ENABLE([intel-sse],
AC_DEFINE([PNG_INTEL_SSE_OPT], [0], AC_DEFINE([PNG_INTEL_SSE_OPT], [0],
[Disable Intel SSE optimizations]) [Disable Intel SSE optimizations])
# Prevent inclusion of the assembler files below: # Prevent inclusion of the assembler files below:
enable_intel_sse=no;; enable_intel_sse=no ;;
yes|on) yes|on)
AC_DEFINE([PNG_INTEL_SSE_OPT], [1], AC_DEFINE([PNG_INTEL_SSE_OPT], [1],
[Enable Intel SSE optimizations]);; [Enable Intel SSE optimizations]);;
*) *)
AC_MSG_ERROR([--enable-intel-sse=${enable_intel_sse}: invalid value]) AC_MSG_ERROR([--enable-intel-sse=${enable_intel_sse}:]
[invalid argument])
esac]) esac])
# Add Intel specific files to all builds where the host_cpu is Intel ('x86*') # Add Intel-specific files to all builds where $host_cpu is Intel ('x86*') or
# or where Intel optimizations were explicitly requested (this allows a # where Intel optimizations were explicitly requested. (This allows a fallback
# fallback if a future host CPU does not match 'x86*') # if a future host CPU does not match 'x86*'.)
AM_CONDITIONAL([PNG_INTEL_SSE], AM_CONDITIONAL([PNG_INTEL_SSE],
[test "$enable_intel_sse" != 'no' && [test "$enable_intel_sse" != 'no' &&
case "$host_cpu" in case "$host_cpu" in
i?86|x86_64) :;; i?86|x86_64) : ;;
*) test "$enable_intel_sse" != '';; *) test "$enable_intel_sse" != '' ;;
esac]) esac])
# PowerPC # POWERPC VSX
# === # ===========
#
# PowerPC VSX (SIMD) support.
AC_ARG_ENABLE([powerpc-vsx], AC_ARG_ENABLE([powerpc-vsx],
AS_HELP_STRING([[[--enable-powerpc-vsx]]], AS_HELP_STRING([[[--enable-powerpc-vsx]]],
[Enable POWERPC VSX optimizations: =no/off, check, api, yes/on:] [Enable POWERPC VSX optimizations: =no/off, check, api, yes/on.]
[no/off: disable the optimizations; check: use internal checking code] [no/off: disable the optimizations;]
[api: disable by default, enable by a call to png_set_option] [check: use internal checking code;]
[api: disable by default, enable by a call to png_set_option;]
[yes/on: turn on unconditionally.] [yes/on: turn on unconditionally.]
[If not specified: determined by the compiler.]), [If not specified: determined by the compiler.]),
[case "$enableval" in [case "$enableval" in
@ -492,36 +573,171 @@ AS_HELP_STRING([[[--enable-powerpc-vsx]]],
# disable the default enabling on __ppc64__ systems: # disable the default enabling on __ppc64__ systems:
AC_DEFINE([PNG_POWERPC_VSX_OPT], [0], AC_DEFINE([PNG_POWERPC_VSX_OPT], [0],
[Disable POWERPC VSX optimizations]) [Disable POWERPC VSX optimizations])
# Prevent inclusion of the platform specific files below: # Prevent inclusion of the platform-specific files below:
enable_powerpc_vsx=no;; enable_powerpc_vsx=no ;;
check) check)
AC_DEFINE([PNG_POWERPC_VSX_CHECK_SUPPORTED], [], AC_DEFINE([PNG_POWERPC_VSX_CHECK_SUPPORTED], [],
[Check for POWERPC VSX support at run-time]) [Check for POWERPC VSX support at run-time])
AC_MSG_WARN([--enable-powerpc-vsx Please check contrib/powerpc/README file] AC_MSG_WARN([--enable-powerpc-vsx: please see contrib/powerpc/README]
[for the list of supported OSes.]);; [for the list of supported systems.]);;
api) api)
AC_DEFINE([PNG_POWERPC_VSX_API_SUPPORTED], [], AC_DEFINE([PNG_POWERPC_VSX_API_SUPPORTED], [],
[Turn on POWERPC VSX optimizations at run-time]);; [Turn on POWERPC VSX optimizations at run-time]);;
yes|on) yes|on)
AC_DEFINE([PNG_POWERPC_VSX_OPT], [2], AC_DEFINE([PNG_POWERPC_VSX_OPT], [2],
[Enable POWERPC VSX optimizations]) [Enable POWERPC VSX optimizations])
AC_MSG_WARN([--enable-powerpc-vsx: please specify 'check' or 'api', if] AC_MSG_WARN([--enable-powerpc-vsx: please specify 'check' or 'api';]
[you want the optimizations unconditionally pass '-maltivec -mvsx'] [if you want the optimizations unconditionally,]
[or '-mcpu=power8'to the compiler.]);; [pass '-maltivec -mvsx' or '-mcpu=power8' to the compiler.]);;
*) *)
AC_MSG_ERROR([--enable-powerpc-vsx=${enable_powerpc_vsx}: invalid value]) AC_MSG_ERROR([--enable-powerpc-vsx=${enable_powerpc_vsx}:]
[invalid argument])
esac]) esac])
# Add PowerPC specific files to all builds where the host_cpu is powerpc('powerpc*') or # Add PowerPC-specific files to all builds where $host_cpu is powerpc
# where POWERPC optimizations were explicitly requested (this allows a fallback if a # ('powerpc*') or where PowerPC optimizations were explicitly requested.
# future host CPU does not match 'powerpc*') # (This allows a fallback if a future host CPU does not match 'powerpc*'.)
AM_CONDITIONAL([PNG_POWERPC_VSX], AM_CONDITIONAL([PNG_POWERPC_VSX],
[test "$enable_powerpc_vsx" != 'no' && [test "$enable_powerpc_vsx" != 'no' &&
case "$host_cpu" in case "$host_cpu" in
powerpc*|ppc64*) :;; powerpc*|ppc64*) : ;;
esac]) esac])
# LOONGARCH LSX
# =============
AC_ARG_ENABLE([loongarch-lsx],
AS_HELP_STRING([[[--enable-loongarch-lsx]]],
[Enable LOONGARCH LSX optimizations: =no/off, yes/on:]
[no/off: disable the optimizations;]
[yes/on: turn on unconditionally.]
[If not specified: determined by the compiler.]),
[case "$enableval" in
no|off)
# disable the default enabling on __loongarch_simd systems:
AC_DEFINE([PNG_LOONGARCH_LSX_OPT], [0],
[Disable LOONGARCH LSX optimizations])
# Prevent inclusion of the assembler files below:
enable_loongarch_lsx=no;;
yes|on)
AC_DEFINE([PNG_LOONGARCH_LSX_OPT], [1],
[Enable LOONGARCH LSX optimizations])
;;
*)
AC_MSG_ERROR([--enable-loongarch-lsx=${enable_loongarch_lsx}:]
[invalid argument])
esac])
if test "$enable_loongarch_lsx" != "no" &&
case "$host_cpu" in
loongarch*) : ;;
*) test "$enable_loongarch_lsx" != '' ;;
esac
then
compiler_support_loongarch_lsx=no
AC_MSG_CHECKING(whether to use LoongArch LSX intrinsics)
save_CFLAGS="$CFLAGS"
LSX_CFLAGS="${LSX_CFLAGS:-"-mlsx"}"
CFLAGS="$CFLAGS $LSX_CFLAGS"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <lsxintrin.h>
int main(){
__m128i a, b, c;
a = __lsx_vadd_w(b, c);
return 0;
}]])],compiler_support_loongarch_lsx=yes)
CFLAGS="$save_CFLAGS"
AC_MSG_RESULT($compiler_support_loongarch_lsx)
if test "$compiler_support_loongarch_lsx" = "yes"; then
AC_DEFINE([PNG_LOONGARCH_LSX_OPT], [1],
[Enable LOONGARCH LSX optimizations])
else
AC_MSG_WARN([Compiler does not support loongarch LSX.])
fi
fi
# Add LoongArch specific files to all builds where the host_cpu is loongarch
# ('loongarch*') or where LoongArch optimizations were explicitly requested.
# (This allows a fallback if a future host CPU does not match 'loongarch*'.)
AM_CONDITIONAL([PNG_LOONGARCH_LSX],
[test "$enable_loongarch_lsx" != "no" &&
test "$compiler_support_loongarch_lsx" = "yes" &&
case "$host_cpu" in
loongarch*) : ;;
*) test "$enable_loongarch_lsx" != '' ;;
esac])
# RISC-V
# ======
#
# RISC-V Vector support.
AC_ARG_ENABLE([riscv-rvv],
AS_HELP_STRING([[[--enable-riscv-rvv]]],
[Enable RISC-V Vector optimizations: =no/off, check, api, yes/on:]
[no/off: disable the optimizations; check: use internal checking code]
[api: disable by default, enable by a call to png_set_option]
[yes/on: turn on. If not specified: determined by the compiler.]),
[case "$enableval" in
no|off)
# disable the default enabling on __riscv systems:
AC_DEFINE([PNG_RISCV_RVV_OPT], [0],
[Disable RISC-V Vector optimizations])
# Prevent inclusion of the platform-specific files below:
enable_riscv_rvv=no ;;
yes|on)
AC_DEFINE([PNG_RISCV_RVV_OPT], [2],
[Enable RISC-V Vector optimizations])
AC_MSG_WARN([--enable-riscv-rvv:]
[if you want the optimizations pass e.g. '-march=rv64gv1p0' to the compiler.]);;
*)
AC_MSG_ERROR([--enable-riscv-rvv=${enable_riscv_rvv}: invalid value])
esac])
if test "$enable_riscv_rvv" != "no" &&
case "$host_cpu" in
riscv64) : ;;
*) test "$enable_riscv_rvv" != '' ;;
esac
then
compiler_support_riscv_rvv=no
AC_MSG_CHECKING(whether to use RISC-V RVV intrinsics)
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <riscv_vector.h>
#include <asm/hwcap.h>
#ifndef COMPAT_HWCAP_ISA_V /* added in linux-6.5 */
#error "COMPAT_HWCAP_ISA_V is not available"
#endif
int main() {
const float src[] = { 0.0f, 0.0f, 0.0f, 0.0f };
uint64_t ptr[2] = {0x0908060504020100, 0xFFFFFFFF0E0D0C0A};
vuint8m1_t a = __riscv_vreinterpret_v_u64m1_u8m1(__riscv_vle64_v_u64m1(ptr, 2));
vfloat32m1_t val = __riscv_vle32_v_f32m1((const float*)(src), 4);
return (int)__riscv_vfmv_f_s_f32m1_f32(val);
}]])],compiler_support_riscv_rvv=yes)
AC_MSG_RESULT($compiler_support_riscv_rvv)
if test "$compiler_support_riscv_rvv" = "yes"; then
AC_DEFINE([PNG_RISCV_RVV_OPT], [1],
[Enable RISCV RVV optimizations])
else
AC_MSG_WARN([Compiler does not support riscv rvv.])
fi
fi
# Add RISC-V-specific files to all builds where $host_cpu is riscv ('riscv64')
# or where RISC-V optimizations were explicitly requested (this allows a fallback
# if a future host CPU does not match 'riscv64')
AM_CONDITIONAL([PNG_RISCV_RVV],
[test "$enable_riscv_rvv" != "no" &&
test "$compiler_support_riscv_rvv" = "yes" &&
case "$host_cpu" in
riscv64) : ;;
*) test "$compiler_support_riscv_rvv" != '' ;;
esac])
AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]]) AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]])

9
contrib/.editorconfig Normal file
View File

@ -0,0 +1,9 @@
# https://editorconfig.org
root = false
[*.[ch]]
indent_size = unset
indent_style = unset
max_doc_length = unset
max_line_length = unset

View File

@ -1,3 +1,5 @@
External contributions to libpng
--------------------------------
This "contrib" directory contains contributions which are not necessarily under This "contrib" directory contains contributions which are not necessarily under
the libpng license, although all are open source. They are not part of the libpng license, although all are open source. They are not part of

View File

@ -2,7 +2,6 @@
* *
* Copyright (c) 2014 Glenn Randers-Pehrson * Copyright (c) 2014 Glenn Randers-Pehrson
* Written by John Bowler, 2014. * Written by John Bowler, 2014.
* Last changed in libpng 1.6.10 [March 6, 2014]
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
@ -24,6 +23,7 @@
* has been compiled only, not linked: no version of the library has been found, * has been compiled only, not linked: no version of the library has been found,
* only the header files exist in the NDK. * only the header files exist in the NDK.
*/ */
#include <cpu-features.h> #include <cpu-features.h>
static int static int

View File

@ -2,7 +2,6 @@
* *
* Copyright (c) 2014 Glenn Randers-Pehrson * Copyright (c) 2014 Glenn Randers-Pehrson
* Written by Mans Rullgard, 2011. * Written by Mans Rullgard, 2011.
* Last changed in libpng 1.6.10 [March 6, 2014]
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
@ -22,6 +21,7 @@
* This generic __linux__ implementation requires reading /proc/self/auxv and * This generic __linux__ implementation requires reading /proc/self/auxv and
* looking at each element for one that records NEON capabilities. * looking at each element for one that records NEON capabilities.
*/ */
#include <unistd.h> /* for POSIX 1003.1 */ #include <unistd.h> /* for POSIX 1003.1 */
#include <errno.h> /* for EINTR */ #include <errno.h> /* for EINTR */

View File

@ -1,6 +1,5 @@
/* contrib/arm-neon/linux.c /* contrib/arm-neon/linux.c
* *
* Last changed in libpng 1.6.31 [July 27, 2017]
* Copyright (c) 2014, 2017 Glenn Randers-Pehrson * Copyright (c) 2014, 2017 Glenn Randers-Pehrson
* Written by John Bowler, 2014, 2017. * Written by John Bowler, 2014, 2017.
* *
@ -19,6 +18,7 @@
* This code is strict ANSI-C and is probably moderately portable; it does * This code is strict ANSI-C and is probably moderately portable; it does
* however use <stdio.h> and it assumes that /proc/cpuinfo is never localized. * however use <stdio.h> and it assumes that /proc/cpuinfo is never localized.
*/ */
#include <stdio.h> #include <stdio.h>
static int static int

133
contrib/conftest/basic.dfa Normal file
View File

@ -0,0 +1,133 @@
# basic.dfa
# Build time configuration of libpng
#
# Author: John Bowler
# Copyright: (c) John Bowler, 2024
# Usage rights:
# To the extent possible under law, the author has waived all copyright and
# related or neighboring rights to this work. This work is published from:
# United States.
#
# Build libpng with basic read and write support. This enables the lowest
# level libpng read and write APIs - the "row-by-row" ones.
#
# Support is enabled only for those transformations that are observed to be
# required by widely used apps or are in the v3 specification.
#
everything = off
# The sequential read code is enabled here; the progressive code can be used
# instead but there is no point enabling both.
option READ on
option SEQUENTIAL_READ on
option EASY_ACCESS on
option SET_USER_LIMITS on
option INFO_IMAGE on
option READ_16BIT on
# Errors: these can be disabled but then there won't be any error messages
# just failures and the error messages are really needed for apps:
option WARNINGS on
option ERROR_TEXT on
option BENIGN_READ_ERRORS on
# Required for many display programs such as web browsers:
option PROGRESSIVE_READ on
# Switch on the write code - this makes a minimalist encoder but with
# interlace support turned on; otherwise png_read_png..png_write_png will
# fail on an interlaced image.
option WRITE on
option WRITE_INTERLACING on
option WRITE_16BIT on
# Usages of the 'fixed' APIs are relatively rare but they do occur
# one or the other for both the API and the internal math.
#Fixed point:
option FIXED_POINT on
#Floating point:
option FLOATING_POINT on
option FLOATING_ARITHMETIC on
# Basic error handling, IO and user memory support. The latter allows the
# application program to provide its own implementations of 'malloc' and 'free'.
option SETJMP on
option STDIO on
option USER_MEM on
# Gamma handling: this needs to be on for the gamma handling
option READ_GAMMA on
# The supported chunks
chunk bKGD on
chunk cHRM on
chunk eXIf on
chunk gAMA on
chunk iCCP on
chunk iTXt on
chunk pHYs on
chunk sBIT on
chunk sRGB on
chunk tEXt on
chunk tIME on
chunk tRNS on
chunk zTXt on
# These don't seem to be used anywhere:
# chunk pCAL
# chunk sCAL
# chunk sPLT
# The rest of this is app dependent: none of these options are required for
# read/write of the full range of PNG files and the normal chunk handling on
# read.
option WRITE_CUSTOMIZE_ZTXT_COMPRESSION on
option WRITE_CUSTOMIZE_COMPRESSION on
option READ_EXPAND on
option READ_FILLER on
option READ_GRAY_TO_RGB on
option READ_INVERT on
option READ_PACK on
option READ_RGB_TO_GRAY on
option READ_SCALE_16_TO_8 on
option READ_SHIFT on
option READ_STRIP_16_TO_8 on
option READ_STRIP_ALPHA on
option READ_SWAP on
option CONVERT_tIME on
# optipng
option IO_STATE on
option STORE_UNKNOWN_CHUNKS on
option HANDLE_AS_UNKNOWN on
# pngcrush
option READ_USER_TRANSFORM on
option WRITE_FLUSH on
# pnmtopng
chunk hIST on
# cairo
option WRITE_PACKSWAP on
option WRITE_USER_TRANSFORM on
# graphicsmagick
option READ_USER_CHUNKS on
# Qt5.15 qtgui (gentoo package split) Qt6.6 qtbase
option READ_BGR on
option WRITE_BGR on
option READ_SWAP_ALPHA on
option WRITE_SWAP_ALPHA on
chunk oFFs on
# ghostscript-gpl
option WRITE_INVERT_ALPHA on
option WRITE_INVERT on

View File

@ -0,0 +1,15 @@
# fixed.dfa
# Build time configuration of libpng
#
# Author: John Bowler
# Copyright: (c) John Bowler, 2025
# Usage rights:
# To the extent possible under law, the author has waived all copyright and
# related or neighboring rights to this work. This work is published from:
# United States.
#
# Test the standard libpng configuration without floating point (the internal
# fixed point implementations are used instead).
#
option FLOATING_ARITHMETIC off
option FLOATING_POINT off

View File

@ -0,0 +1,14 @@
# fixed-float.dfa
# Build time configuration of libpng
#
# Author: John Bowler
# Copyright: (c) John Bowler, 2025
# Usage rights:
# To the extent possible under law, the author has waived all copyright and
# related or neighboring rights to this work. This work is published from:
# United States.
#
# Test the standard libpng configuration with the fixed point internal
# implementation in place of the default floating point
#
option FLOATING_ARITHMETIC off

View File

@ -0,0 +1,21 @@
# nolimits.dfa
# Build time configuration of libpng
#
# Author: John Bowler
# Copyright: (c) John Bowler, 2025
#
# Usage rights:
# To the extent possible under law, the author has waived all copyright and
# related or neighboring rights to this work. This work is published from:
# United States.
#
# Build libpng without any limits and without run-time settable limits. Turning
# USER_LIMITS off reduces libpng code size by allowing compile-time elimination
# of some checking code.
#
option USER_LIMITS off
@# define PNG_USER_WIDTH_MAX PNG_UINT_31_MAX
@# define PNG_USER_HEIGHT_MAX PNG_UINT_31_MAX
@# define PNG_USER_CHUNK_CACHE_MAX 0
@# define PNG_USER_CHUNK_MALLOC_MAX 0

View File

@ -0,0 +1,19 @@
# nolimits.dfa
# Build time configuration of libpng
#
# Author: John Bowler
# Copyright: (c) John Bowler, 2025
#
# Usage rights:
# To the extent possible under law, the author has waived all copyright and
# related or neighboring rights to this work. This work is published from:
# United States.
#
# Build libpng without any limits. With these settigs run-time limits are still
# possible.
#
@# define PNG_USER_WIDTH_MAX PNG_UINT_31_MAX
@# define PNG_USER_HEIGHT_MAX PNG_UINT_31_MAX
@# define PNG_USER_CHUNK_CACHE_MAX 0
@# define PNG_USER_CHUNK_MALLOC_MAX 0

View File

@ -33,7 +33,7 @@ option WRITE_16BIT on
option WRITE_FILTER on option WRITE_FILTER on
# pngcp needs this to preserve unknown chunks, switching all these on means that # pngcp needs this to preserve unknown chunks, switching all these on means that
# pngcp can work without explicit known chunk reading suppport # pngcp can work without explicit known chunk reading support
option UNKNOWN_CHUNKS on option UNKNOWN_CHUNKS on
option SET_UNKNOWN_CHUNKS on option SET_UNKNOWN_CHUNKS on
option HANDLE_AS_UNKNOWN on option HANDLE_AS_UNKNOWN on
@ -52,6 +52,6 @@ option TEXT on
option USER_LIMITS on option USER_LIMITS on
option SET_USER_LIMITS on option SET_USER_LIMITS on
# these are are just required for specific customizations # these are just required for specific customizations
option WRITE_CUSTOMIZE_ZTXT_COMPRESSION on option WRITE_CUSTOMIZE_ZTXT_COMPRESSION on
option WRITE_CUSTOMIZE_COMPRESSION on option WRITE_CUSTOMIZE_COMPRESSION on

View File

@ -0,0 +1,13 @@
# read-full.dfa
# Build time configuration of libpng
#
# Author: John Bowler
# Copyright: (c) John Bowler, 2025
# Usage rights:
# To the extent possible under law, the author has waived all copyright and
# related or neighboring rights to this work. This work is published from:
# United States.
#
# Build libpng with no write support and full read support.
#
option WRITE off

View File

@ -0,0 +1,13 @@
# write-full.dfa
# Build time configuration of libpng
#
# Author: John Bowler
# Copyright: (c) John Bowler, 2025
# Usage rights:
# To the extent possible under law, the author has waived all copyright and
# related or neighboring rights to this work. This work is published from:
# United States.
#
# Build libpng with no read support and full write support.
#
option READ off

View File

@ -0,0 +1,143 @@
---
Language: Cpp
AccessModifierOffset: -3
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveAssignments:
Enabled: false
AlignConsecutiveBitFields:
Enabled: false
AlignConsecutiveDeclarations:
Enabled: false
AlignConsecutiveMacros:
Enabled: false
AlignConsecutiveShortCaseStatements:
Enabled: false
AlignEscapedNewlines: DontAlign
AlignOperands: false
AlignTrailingComments:
Kind: Never
OverEmptyLines: 0
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowBreakBeforeNoexceptSpecifier: Never
AllowShortBlocksOnASingleLine: Never
AllowShortCaseExpressionOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortCompoundRequirementOnASingleLine: true
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AllowShortNamespacesOnASingleLine: false
AlwaysBreakBeforeMultilineStrings: false
BinPackArguments: true
BinPackParameters: BinPack
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: Always
AfterEnum: true
AfterExternBlock: false
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakAdjacentStringLiterals: true
BreakAfterAttributes: Leave
BreakAfterJavaFieldAnnotations: false
BreakAfterReturnType: TopLevel
BreakArrays: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: Always
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: false
BreakStringLiterals: false
BreakTemplateDeclarations: MultiLine
ColumnLimit: 79
ContinuationIndentWidth: 3
DerivePointerAlignment: true
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
FixNamespaceComments: true
IncludeBlocks: Preserve
IndentAccessModifiers: false
IndentCaseBlocks: true
IndentCaseLabels: true
IndentExportBlock: true
IndentExternBlock: AfterExternBlock
IndentGotoLabels: false
IndentPPDirectives: None
IndentRequiresClause: true
IndentWidth: 3
IndentWrappedFunctionNames: false
KeepEmptyLines:
AtEndOfFile: false
AtStartOfBlock: false
AtStartOfFile: false
KeepFormFeed: false
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
PackConstructorInitializers: Never
PointerAlignment: Left
QualifierAlignment: Custom
QualifierOrder: [static, inline, constexpr, const, volatile, restrict, type]
ReferenceAlignment: Pointer
ReflowComments: Never
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SortIncludes: false
SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeJsonColon: false
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterOverloadedOperator: false
AfterPlacementOperator: true
AfterRequiresInClause: false
AfterRequiresInExpression: false
BeforeNonEmptyParentheses: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInContainerLiterals: true
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParens: Never
SpacesInParensOptions:
ExceptDoubleParentheses: false
InCStyleCasts: false
InConditionalStatements: false
InEmptyParentheses: false
Other: false
SpacesInSquareBrackets: false
Standard: Latest
TabWidth: 8
UseTab: Never
WrapNamespaceBodyWithEmptyLines: Leave
...

View File

@ -1,4 +1,3 @@
This directory (contrib/examples) contains examples of libpng usage. This directory (contrib/examples) contains examples of libpng usage.
NO COPYRIGHT RIGHTS ARE CLAIMED TO ANY OF THE FILES IN THIS DIRECTORY. NO COPYRIGHT RIGHTS ARE CLAIMED TO ANY OF THE FILES IN THIS DIRECTORY.

View File

@ -10,7 +10,7 @@
* without processing the image. Notice that some header information may occur * without processing the image. Notice that some header information may occur
* after the image data. Textual data and comments are an example; the approach * after the image data. Textual data and comments are an example; the approach
* in this file won't work reliably for such data because it only looks for the * in this file won't work reliably for such data because it only looks for the
* information in the section of the file that preceeds the image data. * information in the section of the file that precedes the image data.
* *
* Compile and link against libpng and zlib, plus anything else required on the * Compile and link against libpng and zlib, plus anything else required on the
* system you use. * system you use.
@ -26,8 +26,9 @@
#include <png.h> #include <png.h>
#if defined(PNG_READ_SUPPORTED) && defined(PNG_STDIO_SUPPORTED) && \ #if !defined(PNG_iCCP_SUPPORTED) || !defined(PNG_READ_SUPPORTED)
defined (PNG_iCCP_SUPPORTED) #error This program requires libpng supporting the iCCP chunk and the read API
#endif
static int verbose = 1; static int verbose = 1;
@ -36,7 +37,8 @@ static png_byte no_profile[] = "no profile";
static png_bytep static png_bytep
extract(FILE *fp, png_uint_32 *proflen) extract(FILE *fp, png_uint_32 *proflen)
{ {
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,0,0,0); png_structp png_ptr =
png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
png_infop info_ptr = NULL; png_infop info_ptr = NULL;
png_bytep result = NULL; png_bytep result = NULL;
@ -69,7 +71,7 @@ extract(FILE *fp, png_uint_32 *proflen)
png_bytep profile; png_bytep profile;
if (png_get_iCCP(png_ptr, info_ptr, &name, &compression_type, &profile, if (png_get_iCCP(png_ptr, info_ptr, &name, &compression_type, &profile,
proflen) & PNG_INFO_iCCP) proflen) & PNG_INFO_iCCP)
{ {
result = malloc(*proflen); result = malloc(*proflen);
if (result != NULL) if (result != NULL)
@ -80,7 +82,7 @@ extract(FILE *fp, png_uint_32 *proflen)
} }
else else
result = no_profile; result = no_profile;
} }
png_destroy_read_struct(&png_ptr, &info_ptr, NULL); png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
@ -107,7 +109,7 @@ extract_one_file(const char *filename)
const char *ep = strrchr(filename, '.'); const char *ep = strrchr(filename, '.');
if (ep != NULL) if (ep != NULL)
len = ep-filename; len = ep - filename;
else else
len = strlen(filename); len = strlen(filename);
@ -119,14 +121,14 @@ extract_one_file(const char *filename)
FILE *of; FILE *of;
memcpy(output, filename, len); memcpy(output, filename, len);
strcpy(output+len, ".icc"); strcpy(output + len, ".icc");
of = fopen(output, "wb"); of = fopen(output, "wb");
if (of != NULL) if (of != NULL)
{ {
if (fwrite(profile, proflen, 1, of) == 1 && if (fwrite(profile, proflen, 1, of) == 1 &&
fflush(of) == 0 && fflush(of) == 0 &&
fclose(of) == 0) fclose(of) == 0)
{ {
if (verbose) if (verbose)
printf("%s -> %s\n", filename, output); printf("%s -> %s\n", filename, output);
@ -155,12 +157,15 @@ extract_one_file(const char *filename)
} }
else if (verbose && profile == no_profile) else if (verbose && profile == no_profile)
printf("%s has no profile\n", filename); printf("%s has no profile\n", filename);
} }
else else
fprintf(stderr, "%s: could not open file\n", filename); fprintf(stderr, "%s: could not open file\n", filename);
if (fp != NULL)
fclose(fp);
return result; return result;
} }
@ -170,7 +175,7 @@ main(int argc, char **argv)
int i; int i;
int extracted = 0; int extracted = 0;
for (i=1; i<argc; ++i) for (i = 1; i < argc; ++i)
{ {
if (strcmp(argv[i], "-q") == 0) if (strcmp(argv[i], "-q") == 0)
verbose = 0; verbose = 0;
@ -182,4 +187,3 @@ main(int argc, char **argv)
/* Exit code is true if any extract succeeds */ /* Exit code is true if any extract succeeds */
return extracted == 0; return extracted == 0;
} }
#endif /* READ && STDIO && iCCP */

View File

@ -15,8 +15,8 @@
* images. Normally you would call png_set_interlace_handling() to have libpng * images. Normally you would call png_set_interlace_handling() to have libpng
* deal with the interlace for you, but that obliges you to buffer half of the * deal with the interlace for you, but that obliges you to buffer half of the
* image to assemble the interlaced rows. In this code * image to assemble the interlaced rows. In this code
* png_set_interlace_handling() is not called and, instead, the code handles the * png_set_interlace_handling() is not called and, instead, the code handles
* interlace passes directly looking for the required pixel. * the interlace passes directly looking for the required pixel.
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
@ -27,34 +27,37 @@
*/ */
#include "../../png.h" #include "../../png.h"
#if defined(PNG_READ_SUPPORTED) && defined(PNG_SEQUENTIAL_READ_SUPPORTED) #if !defined(PNG_READ_SUPPORTED) || !defined(PNG_SEQUENTIAL_READ_SUPPORTED)
#error This program requires libpng supporting the read and sequential read API
#endif
/* Return component 'c' of pixel 'x' from the given row. */ /* Return component 'c' of pixel 'x' from the given row. */
static unsigned int static unsigned int
component(png_const_bytep row, png_uint_32 x, unsigned int c, component(png_const_bytep row, png_uint_32 x, unsigned int c,
unsigned int bit_depth, unsigned int channels) unsigned int bit_depth, unsigned int channels)
{ {
/* PNG images can be up to 2^31 pixels wide, but this means they can be up to /* PNG images can be up to 2^31 pixels wide, which means they can be up to
* 2^37 bits wide (for a 64-bit pixel - the largest possible) and hence 2^34 * 2^37 bits wide (for a 64-bit pixel - the largest possible) and hence
* bytes wide. Since the row fitted into memory, however, the following must * 2^34 bytes wide. Since the row fitted into memory, the following must
* work: * work:
*/ */
png_uint_32 bit_offset_hi = bit_depth * ((x >> 6) * channels); png_uint_32 bit_offset_hi = bit_depth * ((x >> 6) * channels);
png_uint_32 bit_offset_lo = bit_depth * ((x & 0x3f) * channels + c); png_uint_32 bit_offset_lo = bit_depth * ((x & 0x3f) * channels + c);
row = (png_const_bytep)(((PNG_CONST png_byte (*)[8])row) + bit_offset_hi); row = (png_const_bytep)(((const png_byte(*)[8])row) + bit_offset_hi);
row += bit_offset_lo >> 3; row += bit_offset_lo >> 3;
bit_offset_lo &= 0x07; bit_offset_lo &= 0x07;
/* PNG pixels are packed into bytes to put the first pixel in the highest /* PNG pixels are packed into bytes to put the first pixel in the highest
* bits of the byte and into two bytes for 16-bit values with the high 8 bits * bits of the byte, and into two bytes for 16-bit values with the high
* first, so: * 8 bits first, so:
*/ */
switch (bit_depth) switch (bit_depth)
{ {
case 1: return (row[0] >> (7-bit_offset_lo)) & 0x01; case 1: return (row[0] >> (7 - bit_offset_lo)) & 0x01;
case 2: return (row[0] >> (6-bit_offset_lo)) & 0x03; case 2: return (row[0] >> (6 - bit_offset_lo)) & 0x03;
case 4: return (row[0] >> (4-bit_offset_lo)) & 0x0f; case 4: return (row[0] >> (4 - bit_offset_lo)) & 0x0f;
case 8: return row[0]; case 8: return row[0];
case 16: return (row[0] << 8) + row[1]; case 16: return (row[0] << 8) + row[1];
default: default:
@ -71,9 +74,9 @@ component(png_const_bytep row, png_uint_32 x, unsigned int c,
*/ */
static void static void
print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row, print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
png_uint_32 x) png_uint_32 x)
{ {
PNG_CONST unsigned int bit_depth = png_get_bit_depth(png_ptr, info_ptr); unsigned int bit_depth = png_get_bit_depth(png_ptr, info_ptr);
switch (png_get_color_type(png_ptr, info_ptr)) switch (png_get_color_type(png_ptr, info_ptr))
{ {
@ -87,27 +90,29 @@ print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
*/ */
case PNG_COLOR_TYPE_PALETTE: case PNG_COLOR_TYPE_PALETTE:
{ {
PNG_CONST int index = component(row, x, 0, bit_depth, 1); int index = component(row, x, 0, bit_depth, 1);
png_colorp palette = NULL; png_colorp palette = NULL;
int num_palette = 0; int num_palette = 0;
if ((png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette) & if ((png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette) &
PNG_INFO_PLTE) && num_palette > 0 && palette != NULL) PNG_INFO_PLTE) &&
(num_palette > 0) &&
(palette != NULL))
{ {
png_bytep trans_alpha = NULL; png_bytep trans_alpha = NULL;
int num_trans = 0; int num_trans = 0;
if ((png_get_tRNS(png_ptr, info_ptr, &trans_alpha, &num_trans, if ((png_get_tRNS(png_ptr, info_ptr, &trans_alpha, &num_trans,
NULL) & PNG_INFO_tRNS) && num_trans > 0 && NULL) & PNG_INFO_tRNS) &&
trans_alpha != NULL) (num_trans > 0) &&
(trans_alpha != NULL))
printf("INDEXED %u = %d %d %d %d\n", index, printf("INDEXED %u = %d %d %d %d\n", index,
palette[index].red, palette[index].green, palette[index].red, palette[index].green,
palette[index].blue, palette[index].blue,
index < num_trans ? trans_alpha[index] : 255); index < num_trans ? trans_alpha[index] : 255);
else /* no transparency */ else /* no transparency */
printf("INDEXED %u = %d %d %d\n", index, printf("INDEXED %u = %d %d %d\n", index, palette[index].red,
palette[index].red, palette[index].green, palette[index].green, palette[index].blue);
palette[index].blue);
} }
else else
@ -117,20 +122,20 @@ print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
case PNG_COLOR_TYPE_RGB: case PNG_COLOR_TYPE_RGB:
printf("RGB %u %u %u\n", component(row, x, 0, bit_depth, 3), printf("RGB %u %u %u\n", component(row, x, 0, bit_depth, 3),
component(row, x, 1, bit_depth, 3), component(row, x, 1, bit_depth, 3),
component(row, x, 2, bit_depth, 3)); component(row, x, 2, bit_depth, 3));
return; return;
case PNG_COLOR_TYPE_GRAY_ALPHA: case PNG_COLOR_TYPE_GRAY_ALPHA:
printf("GRAY+ALPHA %u %u\n", component(row, x, 0, bit_depth, 2), printf("GRAY+ALPHA %u %u\n", component(row, x, 0, bit_depth, 2),
component(row, x, 1, bit_depth, 2)); component(row, x, 1, bit_depth, 2));
return; return;
case PNG_COLOR_TYPE_RGB_ALPHA: case PNG_COLOR_TYPE_RGB_ALPHA:
printf("RGBA %u %u %u %u\n", component(row, x, 0, bit_depth, 4), printf("RGBA %u %u %u %u\n", component(row, x, 0, bit_depth, 4),
component(row, x, 1, bit_depth, 4), component(row, x, 1, bit_depth, 4),
component(row, x, 2, bit_depth, 4), component(row, x, 2, bit_depth, 4),
component(row, x, 3, bit_depth, 4)); component(row, x, 3, bit_depth, 4));
return; return;
default: default:
@ -138,7 +143,8 @@ print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
} }
} }
int main(int argc, const char **argv) int
main(int argc, const char **argv)
{ {
/* This program uses the default, <setjmp.h> based, libpng error handling /* This program uses the default, <setjmp.h> based, libpng error handling
* mechanism, therefore any local variable that exists before the call to * mechanism, therefore any local variable that exists before the call to
@ -146,7 +152,7 @@ int main(int argc, const char **argv)
* be declared with 'volatile' to ensure that their values don't get * be declared with 'volatile' to ensure that their values don't get
* destroyed by longjmp: * destroyed by longjmp:
*/ */
volatile int result = 1/*fail*/; volatile int result = 1 /*fail*/;
if (argc == 4) if (argc == 4)
{ {
@ -163,8 +169,8 @@ int main(int argc, const char **argv)
* writes error messages to stderr. Creating the png_struct is a * writes error messages to stderr. Creating the png_struct is a
* little tricky; just copy the following code. * little tricky; just copy the following code.
*/ */
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, png_structp png_ptr =
NULL, NULL, NULL); png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (png_ptr != NULL) if (png_ptr != NULL)
{ {
@ -184,11 +190,11 @@ int main(int argc, const char **argv)
compression_method, filter_method; compression_method, filter_method;
png_bytep row_tmp; png_bytep row_tmp;
/* Now associate the recently opened (FILE*) with the default /* Now associate the recently opened FILE object with the
* libpng initialization functions. Sometimes libpng is * default libpng initialization functions. Sometimes libpng
* compiled without stdio support (it can be difficult to do * is compiled without stdio support (it can be difficult to
* in some environments); in that case you will have to write * do in some environments); in that case you will have to
* your own read callback to read data from the (FILE*). * write your own read callback to read data from the stream.
*/ */
png_init_io(png_ptr, f); png_init_io(png_ptr, f);
@ -202,21 +208,21 @@ int main(int argc, const char **argv)
* space. In this case png_malloc is used - it will not * space. In this case png_malloc is used - it will not
* return if memory isn't available. * return if memory isn't available.
*/ */
row = png_malloc(png_ptr, png_get_rowbytes(png_ptr, row =
info_ptr)); png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr));
/* To avoid the overhead of using a volatile auto copy row_tmp /* Avoid the overhead of using a volatile auto copy row_tmp
* to a local here - just use row for the png_free below. * to a local here - just use row for the png_free below.
*/ */
row_tmp = row; row_tmp = row;
/* All the information we need is in the header is returned by /* All the information we need is in the header returned by
* png_get_IHDR, if this fails we can now use 'png_error' to * png_get_IHDR. If this fails, we can use 'png_error' to
* signal the error and return control to the setjmp above. * signal the error and return control to the setjmp above.
*/ */
if (png_get_IHDR(png_ptr, info_ptr, &width, &height, if (png_get_IHDR(png_ptr, info_ptr, &width, &height,
&bit_depth, &color_type, &interlace_method, &bit_depth, &color_type, &interlace_method,
&compression_method, &filter_method)) &compression_method, &filter_method))
{ {
int passes, pass; int passes, pass;
@ -242,7 +248,7 @@ int main(int argc, const char **argv)
/* Now read the pixels, pass-by-pass, row-by-row: */ /* Now read the pixels, pass-by-pass, row-by-row: */
png_start_read_image(png_ptr); png_start_read_image(png_ptr);
for (pass=0; pass<passes; ++pass) for (pass = 0; pass < passes; ++pass)
{ {
png_uint_32 ystart, xstart, ystep, xstep; png_uint_32 ystart, xstart, ystep, xstep;
png_uint_32 py; png_uint_32 py;
@ -299,19 +305,27 @@ int main(int argc, const char **argv)
* are, of course, much better ways of doing this * are, of course, much better ways of doing this
* than using a for loop: * than using a for loop:
*/ */
if (y == py) for (px = xstart, ppx = 0; if (y == py)
px < width; px += xstep, ++ppx) if (x == px)
{ {
/* 'ppx' is the index of the pixel in the row for (px = xstart, ppx = 0;
* buffer. px < width;
*/ px += xstep, ++ppx)
print_pixel(png_ptr, info_ptr, row_tmp, ppx); {
if (x == px)
{
/* 'ppx' is the index of the pixel in the
* row buffer.
*/
print_pixel(png_ptr, info_ptr, row_tmp,
ppx);
/* Now terminate the loops early - we have /* Now terminate the loops early - we have
* found and handled the required data. * found and handled the required data.
*/ */
goto pass_loop_end; goto pass_loop_end;
} /* x loop */ } /* x loop */
}
}
} /* y loop */ } /* y loop */
} /* pass loop */ } /* pass loop */
@ -323,7 +337,6 @@ int main(int argc, const char **argv)
else else
png_error(png_ptr, "pngpixel: png_get_IHDR failed"); png_error(png_ptr, "pngpixel: png_get_IHDR failed");
} }
else else
@ -349,7 +362,8 @@ int main(int argc, const char **argv)
} }
else else
fprintf(stderr, "pngpixel: out of memory allocating png_info\n"); fprintf(stderr,
"pngpixel: out of memory allocating png_info\n");
png_destroy_read_struct(&png_ptr, NULL, NULL); png_destroy_read_struct(&png_ptr, NULL, NULL);
} }
@ -368,4 +382,3 @@ int main(int argc, const char **argv)
return result; return result;
} }
#endif /* READ && SEQUENTIAL_READ */

View File

@ -5,13 +5,11 @@
* related or neighboring rights to this work. This work is published from: * related or neighboring rights to this work. This work is published from:
* United States. * United States.
* *
* Last changed in libpng 1.6.29 [March 16, 2017]
*
* Read a PNG and write it out in a fixed format, using the 'simplified API' * Read a PNG and write it out in a fixed format, using the 'simplified API'
* that was introduced in libpng-1.6.0. * that was introduced in libpng-1.6.0.
* *
* This sample code is just the code from the top of 'example.c' with some error * This sample code is just the code from 'example.c' with some error handling
* handling added. See example.c for more comments. * added. See example.c in the top-level libpng directory for more comments.
*/ */
#include <stddef.h> #include <stddef.h>
#include <stdlib.h> #include <stdlib.h>
@ -22,10 +20,15 @@
* ensure the code picks up the local libpng implementation: * ensure the code picks up the local libpng implementation:
*/ */
#include "../../png.h" #include "../../png.h"
#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) && \
defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
int main(int argc, const char **argv) #if !defined(PNG_SIMPLIFIED_READ_SUPPORTED) || \
!defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
#error This program requires libpng supporting the simplified read/write API
#endif
int
main(int argc, const char **argv)
{ {
int result = 1; int result = 1;
@ -50,22 +53,22 @@ int main(int argc, const char **argv)
if (buffer != NULL) if (buffer != NULL)
{ {
if (png_image_finish_read(&image, NULL/*background*/, buffer, if (png_image_finish_read(&image, NULL /*background*/, buffer,
0/*row_stride*/, NULL/*colormap for PNG_FORMAT_FLAG_COLORMAP */)) 0 /*row_stride*/, NULL /*colormap */))
{ {
if (png_image_write_to_file(&image, argv[2], if (png_image_write_to_file(
0/*convert_to_8bit*/, buffer, 0/*row_stride*/, &image, argv[2], 0 /*convert_to_8bit*/, buffer,
NULL/*colormap*/)) 0 /*row_stride*/, NULL /*colormap*/))
result = 0; result = 0;
else else
fprintf(stderr, "pngtopng: write %s: %s\n", argv[2], fprintf(stderr, "pngtopng: write %s: %s\n", argv[2],
image.message); image.message);
} }
else else
fprintf(stderr, "pngtopng: read %s: %s\n", argv[1], fprintf(stderr, "pngtopng: read %s: %s\n", argv[1],
image.message); image.message);
free(buffer); free(buffer);
} }
@ -73,7 +76,7 @@ int main(int argc, const char **argv)
else else
{ {
fprintf(stderr, "pngtopng: out of memory: %lu bytes\n", fprintf(stderr, "pngtopng: out of memory: %lu bytes\n",
(unsigned long)PNG_IMAGE_SIZE(image)); (unsigned long)PNG_IMAGE_SIZE(image));
/* This is the only place where a 'free' is required; libpng does /* This is the only place where a 'free' is required; libpng does
* the cleanup on error and success, but in this case we couldn't * the cleanup on error and success, but in this case we couldn't
@ -95,4 +98,3 @@ int main(int argc, const char **argv)
return result; return result;
} }
#endif /* READ && WRITE */

View File

@ -6,9 +6,9 @@
* United States. * United States.
* *
* Read several PNG files, which should have an alpha channel or transparency * Read several PNG files, which should have an alpha channel or transparency
* information, and composite them together to produce one or more 16-bit linear * information, and composite them together to produce one or more 16-bit
* RGBA intermediates. This involves doing the correct 'over' composition to * linear RGBA intermediates. This involves doing the 'over' compositing
* combine the alpha channels and corresponding data. * operation to combine the alpha channels and corresponding data.
* *
* Finally read an output (background) PNG using the 24-bit RGB format (the * Finally read an output (background) PNG using the 24-bit RGB format (the
* PNG will be composited on green (#00ff00) by default if it has an alpha * PNG will be composited on green (#00ff00) by default if it has an alpha
@ -28,8 +28,8 @@
* correctly. Apart from the libpng Simplified API the only work done in here * correctly. Apart from the libpng Simplified API the only work done in here
* is to combine multiple input PNG images into a single sprite; this involves * is to combine multiple input PNG images into a single sprite; this involves
* a Porter-Duff 'over' operation and the input PNG images may, as a result, * a Porter-Duff 'over' operation and the input PNG images may, as a result,
* be regarded as being layered one on top of the other with the first (leftmost * be regarded as being layered one on top of the other with the first
* on the command line) being at the bottom and the last on the top. * (leftmost on the command line) being at the bottom and the last on the top.
*/ */
#include <stddef.h> #include <stddef.h>
#include <stdlib.h> #include <stdlib.h>
@ -44,54 +44,61 @@
*/ */
#include "../../png.h" #include "../../png.h"
#ifdef PNG_SIMPLIFIED_READ_SUPPORTED #if !defined(PNG_SIMPLIFIED_READ_SUPPORTED)
#error This program requires libpng supporting the simplified read API
#endif
#define sprite_name_chars 15 #define sprite_name_chars 15
struct sprite { struct sprite
FILE *file; {
png_uint_16p buffer; FILE *file;
unsigned int width; png_uint_16p buffer;
unsigned int height; unsigned int width;
char name[sprite_name_chars+1]; unsigned int height;
char name[sprite_name_chars + 1];
}; };
#if 0 /* div by 65535 test program */ #if 0 /* div by 65535 test program */
#include <math.h> #include <math.h>
#include <stdio.h> #include <stdio.h>
int main(void) { int
main(void)
{
double err = 0; double err = 0;
unsigned int xerr = 0; unsigned int xerr = 0;
unsigned int r = 32769; unsigned int r = 32769;
unsigned int x = 0;
do
{ {
unsigned int x = 0; unsigned int t = x + (x >> 16) /*+ (x >> 31)*/ + r;
double v = x, errtest;
do { if (t < x)
unsigned int t = x + (x >> 16) /*+ (x >> 31)*/ + r; {
double v = x, errtest; fprintf(stderr, "overflow: %u+%u -> %u\n", x, r, t);
return 1;
}
if (t < x) { v /= 65535;
fprintf(stderr, "overflow: %u+%u -> %u\n", x, r, t); errtest = v;
return 1; t >>= 16;
errtest -= t;
if (errtest > err)
{
err = errtest;
xerr = x;
if (errtest >= .5)
{
fprintf(stderr, "error: %u/65535 = %f, not %u, error %f\n",
x, v, t, errtest);
return 0;
} }
}
v /= 65535; } while (++x <= 65535U * 65535U);
errtest = v;
t >>= 16;
errtest -= t;
if (errtest > err) {
err = errtest;
xerr = x;
if (errtest >= .5) {
fprintf(stderr, "error: %u/65535 = %f, not %u, error %f\n",
x, v, t, errtest);
return 0;
}
}
} while (++x <= 65535U*65535U);
}
printf("error %f @ %u\n", err, xerr); printf("error %f @ %u\n", err, xerr);
@ -101,7 +108,7 @@ int main(void) {
static void static void
sprite_op(const struct sprite *sprite, int x_offset, int y_offset, sprite_op(const struct sprite *sprite, int x_offset, int y_offset,
png_imagep image, const png_uint_16 *buffer) png_imagep image, const png_uint_16 *buffer)
{ {
/* This is where the Porter-Duff 'Over' operator is evaluated; change this /* This is where the Porter-Duff 'Over' operator is evaluated; change this
* code to change the operator (this could be parameterized). Any other * code to change the operator (this could be parameterized). Any other
@ -112,8 +119,8 @@ sprite_op(const struct sprite *sprite, int x_offset, int y_offset,
/* Check for an x or y offset that pushes any part of the image beyond the /* Check for an x or y offset that pushes any part of the image beyond the
* right or bottom of the sprite: * right or bottom of the sprite:
*/ */
if ((y_offset < 0 || (unsigned)/*SAFE*/y_offset < sprite->height) && if ((y_offset < 0 || /*SAFE*/ (unsigned)y_offset < sprite->height) &&
(x_offset < 0 || (unsigned)/*SAFE*/x_offset < sprite->width)) (x_offset < 0 || /*SAFE*/ (unsigned)x_offset < sprite->width))
{ {
unsigned int y = 0; unsigned int y = 0;
@ -130,7 +137,7 @@ sprite_op(const struct sprite *sprite, int x_offset, int y_offset,
do do
{ {
/* In and out are RGBA values, so: */ /* In and out are RGBA values, so: */
const png_uint_16 *in_pixel = buffer + (y * image->width + x)*4; const png_uint_16 *in_pixel = buffer + (y * image->width + x) * 4;
png_uint_32 in_alpha = in_pixel[3]; png_uint_32 in_alpha = in_pixel[3];
/* This is the optimized Porter-Duff 'Over' operation, when the /* This is the optimized Porter-Duff 'Over' operation, when the
@ -139,10 +146,10 @@ sprite_op(const struct sprite *sprite, int x_offset, int y_offset,
if (in_alpha > 0) if (in_alpha > 0)
{ {
png_uint_16 *out_pixel = sprite->buffer + png_uint_16 *out_pixel = sprite->buffer +
((y+y_offset) * sprite->width + (x+x_offset))*4; ((y + y_offset) * sprite->width + (x + x_offset)) * 4;
/* This is the weight to apply to the output: */ /* This is the weight to apply to the output: */
in_alpha = 65535-in_alpha; in_alpha = 65535 - in_alpha;
if (in_alpha > 0) if (in_alpha > 0)
{ {
@ -159,9 +166,9 @@ sprite_op(const struct sprite *sprite, int x_offset, int y_offset,
*/ */
png_uint_32 tmp; png_uint_32 tmp;
# define compose(c)\ # define compose(c) \
tmp = out_pixel[c] * in_alpha;\ tmp = out_pixel[c] * in_alpha; \
tmp = (tmp + (tmp >> 16) + 32769) >> 16;\ tmp = (tmp + (tmp >> 16) + 32769) >> 16; \
out_pixel[c] = tmp + in_pixel[c] out_pixel[c] = tmp + in_pixel[c]
/* The following is very vectorizable... */ /* The following is very vectorizable... */
@ -172,15 +179,15 @@ sprite_op(const struct sprite *sprite, int x_offset, int y_offset,
} }
else else
out_pixel[0] = in_pixel[0], {
out_pixel[1] = in_pixel[1], out_pixel[0] = in_pixel[0];
out_pixel[2] = in_pixel[2], out_pixel[1] = in_pixel[1];
out_pixel[2] = in_pixel[2];
out_pixel[3] = in_pixel[3]; out_pixel[3] = in_pixel[3];
}
} }
} } while (++x < image->width);
while (++x < image->width); } while (++y < image->height);
}
while (++y < image->height);
} }
} }
@ -224,9 +231,8 @@ create_sprite(struct sprite *sprite, int *argc, const char ***argv)
if (buffer != NULL) if (buffer != NULL)
{ {
if (png_image_finish_read(&image, NULL/*background*/, buffer, if (png_image_finish_read(&image, NULL /*background*/, buffer,
0/*row_stride*/, 0 /*row_stride*/, NULL /*colormap*/))
NULL/*colormap for PNG_FORMAT_FLAG_COLORMAP*/))
{ {
/* This is the place where the Porter-Duff 'Over' operator /* This is the place where the Porter-Duff 'Over' operator
* needs to be done by this code. In fact, any image * needs to be done by this code. In fact, any image
@ -245,14 +251,14 @@ create_sprite(struct sprite *sprite, int *argc, const char ***argv)
{ {
free(buffer); free(buffer);
fprintf(stderr, "simpleover: read %s: %s\n", (*argv)[0], fprintf(stderr, "simpleover: read %s: %s\n", (*argv)[0],
image.message); image.message);
} }
} }
else else
{ {
fprintf(stderr, "simpleover: out of memory: %lu bytes\n", fprintf(stderr, "simpleover: out of memory: %lu bytes\n",
(unsigned long)PNG_IMAGE_SIZE(image)); (unsigned long)PNG_IMAGE_SIZE(image));
/* png_image_free must be called if we abort the Simplified API /* png_image_free must be called if we abort the Simplified API
* read because of a problem detected in this code. If problems * read because of a problem detected in this code. If problems
@ -290,8 +296,9 @@ create_sprite(struct sprite *sprite, int *argc, const char ***argv)
save.flags = PNG_IMAGE_FLAG_FAST; save.flags = PNG_IMAGE_FLAG_FAST;
save.colormap_entries = 0; save.colormap_entries = 0;
if (png_image_write_to_stdio(&save, sprite->file, 1/*convert_to_8_bit*/, if (png_image_write_to_stdio(&save, sprite->file, 1 /*convert_to_8_bit*/,
sprite->buffer, 0/*row_stride*/, NULL/*colormap*/)) sprite->buffer, 0 /*row_stride*/,
NULL /*colormap*/))
{ {
/* Success; the buffer is no longer needed: */ /* Success; the buffer is no longer needed: */
free(sprite->buffer); free(sprite->buffer);
@ -301,19 +308,20 @@ create_sprite(struct sprite *sprite, int *argc, const char ***argv)
else else
fprintf(stderr, "simpleover: write sprite %s: %s\n", sprite->name, fprintf(stderr, "simpleover: write sprite %s: %s\n", sprite->name,
save.message); save.message);
} }
else else
fprintf(stderr, "simpleover: sprite %s: could not allocate tmpfile: %s\n", fprintf(stderr,
sprite->name, strerror(errno)); "simpleover: sprite %s: could not allocate tmpfile: %s\n",
sprite->name, strerror(errno));
return 0; /* fail */ return 0; /* fail */
} }
static int static int
add_sprite(png_imagep output, png_bytep out_buf, struct sprite *sprite, add_sprite(png_imagep output, png_bytep out_buf, struct sprite *sprite,
int *argc, const char ***argv) int *argc, const char ***argv)
{ {
/* Given a --add argument naming this sprite, perform the operations listed /* Given a --add argument naming this sprite, perform the operations listed
* in the following arguments. The arguments are expected to have the form * in the following arguments. The arguments are expected to have the form
@ -334,13 +342,13 @@ add_sprite(png_imagep output, png_bytep out_buf, struct sprite *sprite,
* will fit. * will fit.
*/ */
if (x < 0 || y < 0 || if (x < 0 || y < 0 ||
(unsigned)/*SAFE*/x >= output->width || /*SAFE*/ (unsigned)x >= output->width ||
(unsigned)/*SAFE*/y >= output->height || /*SAFE*/ (unsigned)y >= output->height ||
sprite->width > output->width-x || sprite->width > output->width - x ||
sprite->height > output->height-y) sprite->height > output->height - y)
{ {
fprintf(stderr, "simpleover: sprite %s @ (%d,%d) outside image\n", fprintf(stderr, "simpleover: sprite %s @ (%d,%d) outside image\n",
sprite->name, x, y); sprite->name, x, y);
/* Could just skip this, but for the moment it is an error */ /* Could just skip this, but for the moment it is an error */
return 0; /* error */ return 0; /* error */
} }
@ -359,10 +367,10 @@ add_sprite(png_imagep output, png_bytep out_buf, struct sprite *sprite,
{ {
in.format = PNG_FORMAT_RGB; /* force compose */ in.format = PNG_FORMAT_RGB; /* force compose */
if (png_image_finish_read(&in, NULL/*background*/, if (png_image_finish_read(
out_buf + (y*output->width + x)*3/*RGB*/, &in, NULL /*background*/,
output->width*3/*row_stride*/, out_buf + (y * output->width + x) * 3 /*RGB*/,
NULL/*colormap for PNG_FORMAT_FLAG_COLORMAP*/)) output->width * 3 /*row_stride*/, NULL /*colormap*/))
{ {
++*argv, --*argc; ++*argv, --*argc;
continue; continue;
@ -371,7 +379,7 @@ add_sprite(png_imagep output, png_bytep out_buf, struct sprite *sprite,
/* The read failed: */ /* The read failed: */
fprintf(stderr, "simpleover: add sprite %s: %s\n", sprite->name, fprintf(stderr, "simpleover: add sprite %s: %s\n", sprite->name,
in.message); in.message);
return 0; /* error */ return 0; /* error */
} }
} }
@ -379,7 +387,7 @@ add_sprite(png_imagep output, png_bytep out_buf, struct sprite *sprite,
else else
{ {
fprintf(stderr, "simpleover: --add='%s': invalid position %s\n", fprintf(stderr, "simpleover: --add='%s': invalid position %s\n",
sprite->name, (*argv)[0]); sprite->name, (*argv)[0]);
return 0; /* error */ return 0; /* error */
} }
} }
@ -389,10 +397,10 @@ add_sprite(png_imagep output, png_bytep out_buf, struct sprite *sprite,
static int static int
simpleover_process(png_imagep output, png_bytep out_buf, int argc, simpleover_process(png_imagep output, png_bytep out_buf, int argc,
const char **argv) const char **argv)
{ {
int result = 1; /* success */ int result = 1; /* success */
# define csprites 10/*limit*/ # define csprites 10 /*limit*/
# define str(a) #a # define str(a) #a
int nsprites = 0; int nsprites = 0;
struct sprite sprites[csprites]; struct sprite sprites[csprites];
@ -412,23 +420,25 @@ simpleover_process(png_imagep output, png_bytep out_buf, int argc,
sprites[nsprites].width = sprites[nsprites].height = 0; sprites[nsprites].width = sprites[nsprites].height = 0;
sprites[nsprites].name[0] = 0; sprites[nsprites].name[0] = 0;
n = sscanf(argv[0], "--sprite=%u,%u,%" str(sprite_name_chars) "s%c", n = sscanf(argv[0],
&sprites[nsprites].width, &sprites[nsprites].height, "--sprite=%u,%u,%" str(sprite_name_chars) "s%c",
sprites[nsprites].name, &tombstone); &sprites[nsprites].width, &sprites[nsprites].height,
sprites[nsprites].name, &tombstone);
if ((n == 2 || n == 3) && if ((n == 2 || n == 3) &&
sprites[nsprites].width > 0 && sprites[nsprites].height > 0) (sprites[nsprites].width > 0) &&
(sprites[nsprites].height > 0))
{ {
size_t buf_size, tmp; size_t buf_size, tmp;
/* Default a name if not given. */ /* Default a name if not given. */
if (sprites[nsprites].name[0] == 0) if (sprites[nsprites].name[0] == 0)
sprintf(sprites[nsprites].name, "sprite-%d", nsprites+1); sprintf(sprites[nsprites].name, "sprite-%d", nsprites + 1);
/* Allocate a buffer for the sprite and calculate the buffer /* Allocate a buffer for the sprite and calculate the buffer
* size: * size:
*/ */
buf_size = sizeof (png_uint_16 [4]); buf_size = sizeof(png_uint_16[4]);
buf_size *= sprites[nsprites].width; buf_size *= sprites[nsprites].width;
buf_size *= sprites[nsprites].height; buf_size *= sprites[nsprites].height;
@ -437,7 +447,7 @@ simpleover_process(png_imagep output, png_bytep out_buf, int argc,
tmp /= sprites[nsprites].width; tmp /= sprites[nsprites].width;
tmp /= sprites[nsprites].height; tmp /= sprites[nsprites].height;
if (tmp == sizeof (png_uint_16 [4])) if (tmp == sizeof(png_uint_16[4]))
{ {
sprites[nsprites].buffer = malloc(buf_size); sprites[nsprites].buffer = malloc(buf_size);
/* This buffer must be initialized to transparent: */ /* This buffer must be initialized to transparent: */
@ -448,7 +458,7 @@ simpleover_process(png_imagep output, png_bytep out_buf, int argc,
sprites[nsprites].file = NULL; sprites[nsprites].file = NULL;
++argv, --argc; ++argv, --argc;
if (create_sprite(sprites+nsprites++, &argc, &argv)) if (create_sprite(sprites + nsprites++, &argc, &argv))
{ {
result = 1; /* still ok */ result = 1; /* still ok */
continue; continue;
@ -466,7 +476,8 @@ simpleover_process(png_imagep output, png_bytep out_buf, int argc,
else else
{ {
fprintf(stderr, "simpleover: %s: invalid sprite (%u,%u)\n", fprintf(stderr, "simpleover: %s: invalid sprite (%u,%u)\n",
argv[0], sprites[nsprites].width, sprites[nsprites].height); argv[0],
sprites[nsprites].width, sprites[nsprites].height);
break; break;
} }
} }
@ -480,7 +491,7 @@ simpleover_process(png_imagep output, png_bytep out_buf, int argc,
else if (strncmp(argv[0], "--add=", 6) == 0) else if (strncmp(argv[0], "--add=", 6) == 0)
{ {
const char *name = argv[0]+6; const char *name = argv[0] + 6;
int isprite = nsprites; int isprite = nsprites;
++argv, --argc; ++argv, --argc;
@ -489,7 +500,8 @@ simpleover_process(png_imagep output, png_bytep out_buf, int argc,
{ {
if (strcmp(sprites[isprite].name, name) == 0) if (strcmp(sprites[isprite].name, name) == 0)
{ {
if (!add_sprite(output, out_buf, sprites+isprite, &argc, &argv)) if (!add_sprite(output, out_buf, sprites + isprite,
&argc, &argv))
goto out; /* error in add_sprite */ goto out; /* error in add_sprite */
break; break;
@ -498,7 +510,8 @@ simpleover_process(png_imagep output, png_bytep out_buf, int argc,
if (isprite < 0) /* sprite not found */ if (isprite < 0) /* sprite not found */
{ {
fprintf(stderr, "simpleover: --add='%s': sprite not found\n", name); fprintf(stderr, "simpleover: --add='%s': sprite not found\n",
name);
break; break;
} }
} }
@ -526,7 +539,8 @@ out:
return result; return result;
} }
int main(int argc, const char **argv) int
main(int argc, const char **argv)
{ {
int result = 1; /* default to fail */ int result = 1; /* default to fail */
@ -536,7 +550,7 @@ int main(int argc, const char **argv)
const char *output = NULL; const char *output = NULL;
png_image image; png_image image;
if (argc > 2 && argv[2][0] != '-'/*an operation*/) if (argc > 2 && argv[2][0] != '-' /*an operation*/)
{ {
output = argv[2]; output = argv[2];
argi = 3; argi = 3;
@ -558,7 +572,7 @@ int main(int argc, const char **argv)
png_color background = {0, 0xff, 0}; /* fully saturated green */ png_color background = {0, 0xff, 0}; /* fully saturated green */
if (png_image_finish_read(&image, &background, buffer, if (png_image_finish_read(&image, &background, buffer,
0/*row_stride*/, NULL/*colormap for PNG_FORMAT_FLAG_COLORMAP */)) 0 /*row_stride*/, NULL /*colormap*/))
{ {
/* At this point png_image_finish_read has cleaned up the /* At this point png_image_finish_read has cleaned up the
* allocated data in png_image, and only the buffer needs to be * allocated data in png_image, and only the buffer needs to be
@ -566,22 +580,24 @@ int main(int argc, const char **argv)
* *
* Perform the remaining operations: * Perform the remaining operations:
*/ */
if (simpleover_process(&image, buffer, argc-argi, argv+argi)) if (simpleover_process(&image, buffer,
argc - argi, argv + argi))
{ {
/* Write the output: */ /* Write the output: */
if ((output != NULL && if ((output != NULL &&
png_image_write_to_file(&image, output, png_image_write_to_file(
0/*convert_to_8bit*/, buffer, 0/*row_stride*/, &image, output, 0 /*convert_to_8bit*/, buffer,
NULL/*colormap*/)) || 0 /*row_stride*/, NULL /*colormap*/)) ||
(output == NULL && (output == NULL &&
png_image_write_to_stdio(&image, stdout, png_image_write_to_stdio(
0/*convert_to_8bit*/, buffer, 0/*row_stride*/, &image, stdout, 0 /*convert_to_8bit*/, buffer,
NULL/*colormap*/))) 0 /*row_stride*/, NULL /*colormap*/)))
result = 0; result = 0;
else else
fprintf(stderr, "simpleover: write %s: %s\n", fprintf(stderr, "simpleover: write %s: %s\n",
output == NULL ? "stdout" : output, image.message); output == NULL ? "stdout" : output,
image.message);
} }
/* else simpleover_process writes an error message */ /* else simpleover_process writes an error message */
@ -589,7 +605,7 @@ int main(int argc, const char **argv)
else else
fprintf(stderr, "simpleover: read %s: %s\n", argv[1], fprintf(stderr, "simpleover: read %s: %s\n", argv[1],
image.message); image.message);
free(buffer); free(buffer);
} }
@ -597,7 +613,7 @@ int main(int argc, const char **argv)
else else
{ {
fprintf(stderr, "simpleover: out of memory: %lu bytes\n", fprintf(stderr, "simpleover: out of memory: %lu bytes\n",
(unsigned long)PNG_IMAGE_SIZE(image)); (unsigned long)PNG_IMAGE_SIZE(image));
/* This is the only place where a 'free' is required; libpng does /* This is the only place where a 'free' is required; libpng does
* the cleanup on error and success, but in this case we couldn't * the cleanup on error and success, but in this case we couldn't
@ -617,7 +633,8 @@ int main(int argc, const char **argv)
else else
{ {
/* Usage message */ /* Usage message */
fprintf(stderr, fprintf(
stderr,
"simpleover: usage: simpleover background.png [output.png]\n" "simpleover: usage: simpleover background.png [output.png]\n"
" Output 'background.png' as a 24-bit RGB PNG file in 'output.png'\n" " Output 'background.png' as a 24-bit RGB PNG file in 'output.png'\n"
" or, if not given, stdout. 'background.png' will be composited\n" " or, if not given, stdout. 'background.png' will be composited\n"
@ -628,13 +645,13 @@ int main(int argc, const char **argv)
" --sprite=width,height,name {[--at=x,y] {sprite.png}}\n" " --sprite=width,height,name {[--at=x,y] {sprite.png}}\n"
" Produce a transparent sprite of size (width,height) and with\n" " Produce a transparent sprite of size (width,height) and with\n"
" name 'name'.\n" " name 'name'.\n"
" For each sprite.png composite it using a Porter-Duff 'Over'\n" " For each sprite.png composite it is using a Porter-Duff 'Over'\n"
" operation at offset (x,y) in the sprite (defaulting to (0,0)).\n" " operation at offset (x,y) in the sprite, defaulting to (0,0).\n"
" Input PNGs will be truncated to the area of the sprite.\n" " Input PNGs will be truncated to the area of the sprite.\n"
"\n" "\n"
" --add='name' {x,y}\n" " --add='name' {x,y}\n"
" Optionally, before output, composite a sprite, 'name', which\n" " Optionally, before output, composite a sprite, 'name', which\n"
" must have been previously produced using --sprite, at each\n" " must have been previously produced using --sprite at each\n"
" offset (x,y) in the output image. Each sprite must fit\n" " offset (x,y) in the output image. Each sprite must fit\n"
" completely within the output image.\n" " completely within the output image.\n"
"\n" "\n"
@ -645,4 +662,3 @@ int main(int argc, const char **argv)
return result; return result;
} }
#endif /* SIMPLIFIED_READ */

View File

@ -146,7 +146,7 @@ int readpng2_init(mainprog_info *mainprog_ptr)
/* These byte strings were copied from png.h. If a future version /* These byte strings were copied from png.h. If a future version
* of readpng2.c recognizes more chunks, add them to this list. * of readpng2.c recognizes more chunks, add them to this list.
*/ */
static PNG_CONST png_byte chunks_to_process[] = { static const png_byte chunks_to_process[] = {
98, 75, 71, 68, '\0', /* bKGD */ 98, 75, 71, 68, '\0', /* bKGD */
103, 65, 77, 65, '\0', /* gAMA */ 103, 65, 77, 65, '\0', /* gAMA */
115, 82, 71, 66, '\0', /* sRGB */ 115, 82, 71, 66, '\0', /* sRGB */

Some files were not shown because too many files have changed in this diff Show More