Compare commits

..

804 Commits

Author SHA1 Message Date
Glenn Randers-Pehrson
1c2e35ab73 [libpng17] Imported from libpng-1.7.0beta88.tar 2017-08-07 09:45:14 -05:00
Glenn Randers-Pehrson
58cd558a43 [libpng17] Added some bad PNGs to the test directory and to the test/pngtest script 2017-08-06 14:16:17 -05:00
Glenn Randers-Pehrson
bdca749e35 [libpng17] Added private png_check_chunk_name() and png_check_chunk_length()
functions.
2017-08-06 14:13:18 -05:00
Glenn Randers-Pehrson
19855cd8b1 [libpng17] Fix URL in documentation. 2017-05-22 17:39:22 -05:00
Glenn Randers-Pehrson
9bda575f69 [libpng17] Change http: urls to https: in libpng.3 2017-04-03 16:58:43 -05:00
Glenn Randers-Pehrson
66def3fb3c [libpng17] Bump version to 1.7.0beta88 2017-04-01 11:29:32 -05:00
Glenn Randers-Pehrson
8f4d83a881 [libpng17] Imported from libpng-1.7.0beta87.tar 2017-04-01 11:29:12 -05:00
Glenn Randers-Pehrson
a9b02399ac [libpng17] Added missing "$(CPPFLAGS)" to the compile line for c.pic.o in
makefile.linux and makefile.solaris-x86 (Cosmin).
2017-03-21 20:12:09 -05:00
Glenn Randers-Pehrson
ba42eccb05 [libpng17] Merge contrib/examples/pngtopng.c with libpng-1.6.29beta02 2017-02-24 09:25:27 -06:00
Glenn Randers-Pehrson
7345c50aaa [libpng17] Fixed arm/aarch64 detection in CMakeLists.txt (Gianfranco Costamagna) 2016-12-31 13:02:01 -06:00
Glenn Randers-Pehrson
20be5b5411 [libpng16] Mention CVE-2016-10087 in CHANGES. 2016-12-30 14:00:44 -06:00
Glenn Randers-Pehrson
750a023377 [libpng17] Merge license info from libpng-1.6.27 2016-12-30 12:10:45 -06:00
Glenn Randers-Pehrson
e00c39596a [libpng17] Update license info from libpng-1.6.27 2016-12-30 10:27:53 -06:00
Glenn Randers-Pehrson
448fad2d02 [libpng17] Bump version to 1.7.0beta87 2016-12-30 08:29:13 -06:00
Glenn Randers-Pehrson
76a1f4bb3f [libpng17] Imported from libpng-1.7.0beta86.tar 2016-12-29 07:58:43 -06:00
Glenn Randers-Pehrson
243d4e5f3f [libpng17] Fixed a potential null pointer dereference in png_set_text_2()
(bug report and patch by Patrick Keshishian)
2016-12-29 07:57:58 -06:00
Glenn Randers-Pehrson
48f8ca26e4 [libpng17] Bump version to 1.7.0beta86 2016-12-29 07:56:24 -06:00
Glenn Randers-Pehrson
6c9ecd348d [libpng17] Removed clutter 2016-12-28 06:13:59 -06:00
Glenn Randers-Pehrson
e6470a8876 [libpng17] Ported new ARM support in CMakeLists.txt from libpng16 2016-12-27 11:35:56 -06:00
John Bowler
b14987b483 Merge branch 'libpng17' of ../../libpng into libpng17 2016-12-27 08:24:04 -08:00
Glenn Randers-Pehrson
7ed5c08fad [libpng17] Imported from libpng-1.7.0beta86.tar 2016-12-27 08:24:34 -06:00
John Bowler
5a1f75289e Merge branch 'libpng17' of ../../libpng into libpng17 2016-12-26 18:04:54 -08:00
Glenn Randers-Pehrson
4caddaafbb [libpng17] Update CHANGES and ANNOUNCE 2016-12-26 19:56:53 -06:00
John Bowler
512336676e Remove 'defined' within macro
This eliminates the use of 'defined' within macros that get substituted
on #if lines; see the previous patch for a more detailed discussion.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-12-26 16:46:30 -08:00
John Bowler
0ea7a09ced Remove 'defined' within macro
This removes the use of a macro containing the pre-processor 'defined'
operator.  It is unclear whether this is valid; a macro which
"generates" 'defined' is not permitted, but the use of the work
"generates" within the C90 standard seems to imply more than simple
substitution of an expression itself containing a well-formed defined
operation.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-12-26 16:45:31 -08:00
Glenn Randers-Pehrson
0b02a667cf [libpng17] Fix some indentation in pngrutil.c
(bug report and patch by Patrick Keshishian).
2016-12-26 18:38:13 -06:00
Glenn Randers-Pehrson
e1c7c0402c [libpng17] Quieted warnings from clang-3.8 in pngunknown.c and pngvalid.c. 2016-10-01 20:09:52 -05:00
Glenn Randers-Pehrson
2127ecd0fa [libpng17 Updated the documentation about CRC and ADLER32 handling. 2016-09-26 11:16:08 -05:00
Glenn Randers-Pehrson
1757736115 [libpng17] Bump version to 1.7.0beta85 2016-09-26 08:58:31 -05:00
Glenn Randers-Pehrson
6f9a39848e [libpng17] Imported from libpng-1.7.0beta84.tar 2016-09-26 08:58:23 -05:00
Glenn Randers-Pehrson
517fe770e2 [libpng17] Changed bad CRC from 0x00000000 to 0xabadcc32 and bad ADLER32
from 0x00000000 to 0xabadad32 in badcrc.png and badadler.png, to make
them recognizable in hex dumps.
2016-09-26 08:07:21 -05:00
Glenn Randers-Pehrson
f911c1146a [libpng17] Warn about ADLER32 checksum mismatch instead of issuing png_error().
Add tests/badcrc.png and tests/badadler.png to tests/pngtest.
2016-09-25 22:22:47 -05:00
Glenn Randers-Pehrson
28de8bf6cd [libpng17] Changed PNG_ZLIB_VERNUM to ZLIB_VERNUM in pngrutil.c.
Conditionally compile png_set_benign_errors() in pngtest.c
2016-09-19 17:02:26 -05:00
Glenn Randers-Pehrson
6f39846891 [libpng17] Conditionally compile png_set_benign_errors() in pngread.c 2016-09-11 19:33:34 -05:00
Glenn Randers-Pehrson
07e2cf117f [libpng17] Fixed handling zero length IDAT in pngfix (bug report by Agostino Sarubbo,
bugfix by John Bowler).
2016-09-01 17:36:36 -05:00
Glenn Randers-Pehrson
f0ada4edee [libpng17] Minor editing of INSTALL, (whitespace, added copyright line) 2016-08-18 18:45:35 -05:00
Glenn Randers-Pehrson
3220f9c5a5 [libpng17] Bump version to 1.7.0beta84 2016-08-07 19:54:00 -05:00
Glenn Randers-Pehrson
5096cac90c [libpng17] Imported from libpng-1.7.0beta83.tar 2016-08-07 19:45:17 -05:00
Glenn Randers-Pehrson
2a2373c1ec [libpng17] Update CHANGES and ANNOUNCE, fix typos in pngrutil.c 2016-07-23 16:41:19 -05:00
John Bowler
4283e2bf66 Fix debug test of output gamma
The test would fire when a gamma transform was eliminated because it was not
significant if other transforms remained.  This is a debug-only change to alter
the test to check for an insignificant mis-match of the actual output gamma from
the requested output gamma.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-07-23 10:03:48 -07:00
Glenn Randers-Pehrson
8ffea2e56b [libpng17] Update CHANGES and ANNOUNCE 2016-07-16 11:37:48 -05:00
John Bowler
99eb6b5d5d Remove/rearrange png_struct fields
Certain fields are only used in reading.  This attempts to do some minor
cleanup/rearrangement.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-07-16 08:26:14 -07:00
Glenn Randers-Pehrson
096dbf8335 [libpng17] Fixed more indentation to comply with our coding style. 2016-07-15 14:43:19 -05:00
Glenn Randers-Pehrson
9743d58bc0 [libpng17] Fix one incorrect indent in pngvalid.c 2016-07-13 17:19:58 -05:00
Glenn Randers-Pehrson
bdb730a593 [libng17] Undo bad indentation change in example.c 2016-07-13 16:30:28 -05:00
Glenn Randers-Pehrson
f1fb09c406 [libpng17] Fixed some indentation to comply with our coding style (synced
with libpng-1.6.24beta05).
2016-07-13 15:27:04 -05:00
Glenn Randers-Pehrson
83ca33b017 [libpng17] Minor update of INSTALL 2016-07-04 20:39:41 -05:00
Glenn Randers-Pehrson
aa78bc36d9 [libpng17] Bump version to 1.7.0beta83 2016-07-04 14:30:59 -05:00
Glenn Randers-Pehrson
f7b1d9a172 [libpng17] Imported from libpng-1.7.0beta82.tar 2016-07-04 14:30:52 -05:00
Glenn Randers-Pehrson
ce67b437ea [libpng17] Fixed two Coverity issues in pngcp.c. 2016-07-04 12:30:10 -05:00
Glenn Randers-Pehrson
86a3c4fb14 [libpng17] Don't call png_icc_set_sRGB() when it's not compiled. 2016-07-03 10:26:38 -05:00
Glenn Randers-Pehrson
4b846be113 [libpng17] Relocated misplaced #endif in png.c sRGB profile checking. 2016-07-02 21:33:25 -05:00
Glenn Randers-Pehrson
b9d7d5525b [libpng17] Added "Common linking failures" section to INSTALL 2016-07-02 12:01:27 -05:00
John Bowler
0ecbe53243 pngimage: correct #define checking
In libpng 1.7 pngimage needs to check PNG_WRITE_PNG_SUPPORTED (new in 1.7), not
PNG_WRITE_SUPPORTED because png_write_png can be disabled without disabling
PNG_WRITE_SUPPORTED.  Copied the approach from 1.6 pngcp.c (so this still works
in 1.6 as well.)
2016-07-02 07:37:37 -07:00
Glenn Randers-Pehrson
53bda5a7af [libpng17] Sync contrib/libtests/pngimage.c with libpng16; update CHANGES and ANNOUNCE 2016-07-02 08:53:21 -05:00
John Bowler
6a574a84bd pngcp minimal configuration changes
Corrections for the pngcp minimal configuration in libpng 1.7 and corrections to
the libpng 1.7 code to fix bugs revealed by the reduced configuration.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-07-01 22:39:13 -07:00
John Bowler
eaf7abfdc3 pngcp: tool to copy PNG files
This adds pngcp to the build together with a pngcp.dfa configuration test; the
test revealed some configuration bugs which are fixed by corrections to the
_SUPPORTED macros.

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

Signed-off-by: John Bowler <jbowler@acm.org>
2016-07-01 11:44:08 -07:00
John Bowler
0f5992051f Move pngcp to contrib/tools
Signed-off-by: John Bowler <jbowler@acm.org>
2016-07-01 11:38:03 -07:00
Glenn Randers-Pehrson
12c3c2e136 [libpng17] Sync pngvalid.c with libpng16; update CHANGES and ANNOUNCE 2016-06-24 21:36:29 -05:00
Glenn Randers-Pehrson
d6037dcb09 [libpng17] Update CHANGES and ANNOUNCE 2016-06-23 12:14:15 -05:00
John Bowler
9dfdb2270b SKIP definition in pngstest.c misplaced
The SKIP definition needs to come after the png.h include (see all the other .c
files in contrib/libtests) because it depends on PNG_LIBPNG_VER.  This commit
puts it in the correct place.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-06-23 09:13:10 -07:00
Glenn Randers-Pehrson
29be8f11ed [libpng17] Bump version to 1.7.0beta82 2016-06-11 18:47:04 -05:00
Glenn Randers-Pehrson
8592a85535 [libpng17] Imported from libpng-1.7.0beta81.tar 2016-06-11 18:46:56 -05:00
John Bowler
b21a37323f [libpng17] Avoid potential overflow of the PNG_IMAGE_SIZE macro. This macro
is not used within libpng, but is used in some of the examples.
2016-06-11 14:21:08 -05:00
John Bowler
7a0fe97841 Change image size checks
This covers the case where PNG_IMAGE_BUFFER_SIZE can overflow in the application
as a result of the application using an increased 'row_stride'; previously
png_image_finish_read only checked for overflow on the base calculation of
components.  (I.e. it checked for overflow of a png_alloc_size_t number on the
total number of pixel components in the output format, not the possibly padded
row length and not the number of bytes, which for linear formats is twice the
number of components.)
2016-06-11 10:12:59 -07:00
Glenn Randers-Pehrson
9a137f332f [libpng17] Update CHANGES and ANNOUNCE 2016-06-08 13:45:37 -05:00
John Bowler
8c8aea7fd4 png_app_warning fix
The implementations of png_app_error and png_app_warning were swapped.  The
non-release behavior of using PNG_ERROR on both doesn't work in practice because
there are some cases where the warnings are very mild (specifically the one
about writing an iCCP chunk when sRGB could be used.)  png_app_warning now does
PNG_WARN by default in all cases.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-06-08 10:43:25 -07:00
John Bowler
d52c8eba99 Compression changes/fixes
Simplified API: change handling of PNG_IMAGE_FLAG_FAST to use
PNG_COMPRESSION_HIGH_SPEED, and PNG_COMPRESSION_HIGH otherwise.

Compression: add missing break statements that caused some compression settings
to fall through to the 'HIGH' setting.

Internal: remove png_struct::flags, it only stored the 'library mismatch' flag
and that could never be accessed (because immediately after it was set the
png_struct, which was on the stack, was eliminated.)

Signed-off-by: John Bowler <jbowler@acm.org>
2016-06-08 08:37:20 -07:00
Glenn Randers-Pehrson
b70b51ba17 [libpng17] Update CHANGES and ANNOUNCE 2016-06-07 14:46:42 -05:00
John Bowler
2b711a751c LOW_MEMORY and COMPAT bug fixes
The LOW_MEMORY PNG_COMPRESSION option should not be setting HUFFMAN_ONLY or
using a low deflate 'level'; according to the comments in zconf.h only
windowBits and memLevel affect the memory.  pngwutil.c has been changed to use
the same values as HIGH compression.

The COMPAT option turned on the old optimize_cmf code (now in fix_cinfo),
however there was a serious bug in that code; it put the wrong value in z_cmf.
The setting was also not handled correctly in pz_compression_settings.

pngtest now verifies the operation of COMPAT and, as a result, pngtest.png has
been reverted to the libpng 1.6 (etc) version.

IDAT size handling has been improved; if not explicitly set values appropriate
to png_level are now chosen (in addition to the handling for the COMPAT
setting).  HIGH and HIGH_READ_SPEED now create unlimited size IDAT chunks, which
requires buffering the whole of the IDAT data in memory but reflects what other
programs and optimizers do.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-06-07 11:27:23 -07:00
Glenn Randers-Pehrson
2e68f96511 [libpng17] Update link to RFC-2083 in png.5 2016-06-07 11:03:26 -05:00
Glenn Randers-Pehrson
8c7b59f2b9 [libpng17] Update CHANGES and ANNOUNCE, fixed several new typos 2016-06-07 11:02:07 -05:00
John Bowler
01ff090760 API reduction, PNG compression level
PNG compression level setting API: this allows the various compression settings
controlling deflate, fitlering, and so on to be set via a single setting with
six values.  This is currently documented in png.h ("Write compression
settings").

Internally the compression settings have been tuned both for the overall setting
and for any specific settings made by the original APIs.

APIs to control iCCP chunk compression separately have been added.

contrib/examples/pngcp.c has been modified to accomodate the new compression
setting and to include options for separate control of iCCP chunk compression.

The new ABI, png_setting, has been modified to accomodate a wider range of
settings and most of the old compression control ABIs have been replaced by
function-like macros with the same API which call png_setting.  This is an API
check in 1.7.0 for png_setting (alone).  png_setting now handles all of
png_set_option.  This eliminates 19 ABIs at the cost of adding 1 (png_setting).

CRC and benign error checking has been updated internally to use bit-fields and
the CRC calculation skip when the CRC is not used has been improved slightly to
avoid the initialization of the CRC.  A new png_setting based API allows more
detailed control of benign error/warning messages (this may change, the internal
error handling seems too complex.)  The ERROR_NUMBERS support has been removed
with the intent of implementing proper i18n.

The memcpy-size-0 issue in png_push_fill_buffer has been fixed, with an
appropriate debug() assert if a fill for 0 bytes occurs.

Most PNG_FLAG_ values for png_struct::flags have been eliminated (as a result of
the benign error handling changes).  Only one remains.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-06-07 06:48:52 -07:00
Glenn Randers-Pehrson
120f80369b [libpng17] Port contrib/libtests/pngvalid.c from libpng16. 2016-05-31 10:14:08 -05:00
John Bowler
1982dc6c2f Back-port 1.6 pngvalid.c
No changes; files are identical

Signed-off-by: John Bowler <jbowler@acm.org>
2016-05-29 09:28:39 -07:00
Glenn Randers-Pehrson
a1296131fe [libpng17] Refactored duplicate coded in png_set_check_for_invalid_index()
to quiet a Coverity issue and save a few bytes of code.
2016-05-22 14:42:14 -05:00
Glenn Randers-Pehrson
5095b2adfb [libpng17] Update CHANGES and ANNOUNCE 2016-05-21 13:26:51 -05:00
John Bowler
5b19ac3019 Write fine tuning
Fine tuning of options so that the default settings are comparable with 1.6;
test set sizes are about 2% greater than 1.6 because of the use of FAST rather
than ALL filters (this mainly affects RGB images).

Signed-off-by: John Bowler <jbowler@acm.org>
2016-05-21 08:41:44 -07:00
John Bowler
a5b340e20b timepng: fix builds in certain 1.7 configs
Libpng 1.7 supports read without PNG de-interlace, however this means the old
checks on whether contrib/libtests/timepng.c (just checking for sequential read)
are inadequate.  1.7 also provides macros to explicitly turn off png_read_png
and png_read_image, so use these instead.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-05-21 08:40:04 -07:00
John Bowler
21f92eef89 timepng.c: check for clock_gettime
Signed-off-by: John Bowler <jbowler@acm.org>
2016-05-18 08:42:21 -07:00
John Bowler
bf101dcea1 Merge branch 'libpng17' into 20160506-write 2016-05-18 08:41:15 -07:00
John Bowler
764ae3995b Filter tuning, legacy option
png_level -1 sets the defaults for write compression/filters/IDAT size to those
used in pre-1.7 versions of libpng, producing results that with a few exceptions
are identical to earlier versions.  This commit also includes an important bug
fix for the previous commit which was erroneously using the greatest sum not the
least sum of absolute values when performing filter selection.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-05-16 22:59:20 -07:00
Glenn Randers-Pehrson
bd6fb5534f [libpng17] Update Makefile.am, fix typo in timepng.c 2016-05-16 19:39:55 -05:00
Glenn Randers-Pehrson
f05407d292 [libpng17] Check for CLOCK_PROCESS_CPUTIME_ID in /contrib/libtests/timepng.
Otherwise it does not build on platforms that don't supply clock_gettime().
2016-05-16 18:59:47 -05:00
John Bowler
5652acdd48 Filter selection, palette index checks
Palette index checking: checking on read was erroneously skipped.  pngcp can now
turn off the palette index checking or fix the errors (mainly to allow
comparison with libpng 1.6, which defaulted to ignoring it).  The API now
documents how the 'enabled' parameter works.  On read the check is on by default
(it was apparently off in libpng 1.6) however now if explicitly turned on the
warning message is stopped, this provides better interaction with
get_palette_max at the cost of a small API change (may need to be reviewed.)

Palette size errors: invalid entries in the palette are now set to #beaded to
make the errors more obvious and allow easy detection in memory.

Read transform pipeline caching: changes to fix the palette index check (which
are erroneously cached), the pipeline can now contain multiple caches.  E.g.
caching of packing of palette indices can be combined with caching of palette
RGB transforms.

Read code now checks for callbacks to read 0 data (and faults them).  Fixed the
reading of PNGs with multiple 0 length IDATs that failed as a result plus the
handling of zero length unknown.  (Which occurs, validly; the spurious warning
has been removed).

filter selection: the 1.6 and earlier sum of absolute differences algorithm has
been reintroduced with an option to disfavor some filters over others where the
sums are close (not yet exposed).  The selection code also logs the last known
occurence of each possible byte code across multiple lines.  This allows
detection of PNG images with lower bit depth than the format implies and,
therefore, allows the filtering to be turned off in those cases as well.

The default write zlib settings are still lower than libpng16.  The selection
algorithm is being refined (the overall results are worse than not doing any
filtering).

Signed-off-by: John Bowler <jbowler@acm.org>
2016-05-15 16:32:01 -07:00
John Bowler
cf46e3748f Implement base filter selection
Row buffering and a crude code-count algorithm.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-05-14 18:08:25 -07:00
John Bowler
52c9e4fdd6 signed/unsigned warning fix (GCC 4.8.5)
Signed-off-by: John Bowler <jbowler@acm.org>
2016-05-09 16:36:15 -07:00
John Bowler
4905ed4aae Reenable filter selection (dummy)
This implements the code for row-by-row filter selection but does not provide an
actual implementation; the selection function just chooses the lowest set filter
bit.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-05-09 13:08:50 -07:00
Glenn Randers-Pehrson
ba356b4e4d [libpng17] Bump version to 1.7.0beta81 2016-05-07 15:45:03 -05:00
Glenn Randers-Pehrson
d23207b866 [libpng17] Imported from libpng-1.7.0beta80.tar 2016-05-07 15:44:55 -05:00
John Bowler
a70f5053de [libpng17] Update CHANGES and ANNOUNCE about pngcp; sync timepng.c with libpng16 2016-05-06 19:09:58 -05:00
John Bowler
4cc89fb733 Minor write bug-fixes, remove unimplemented code
A debug() assert fired if windowBits was set to 8 for the Huffman only and
no-compression cases.  This commit changes it to do some extra checking.  Remove
unreachable code in pz_default_settings, eliminate a spurious warning in pngcp
for small files.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-05-06 14:35:35 -07:00
Glenn Randers-Pehrson
e966fac5ac [libpng17] Update CHANGES and ANNOUNCE for Write code update (John Bowler) 2016-05-04 22:02:52 -05:00
John Bowler
cde9b583a8 Write code update
Implemented better defaulting of zlib settings based on image properties.
Implemented pass-through of png_write_rows when the rows can be used directly (a
common case) optimizing the handling of previous-row buffering.

Removed the METHODICAL filter selection method and disabled the HEURISTIC one;
the first was ridiculously slow (though useful for experiments) the second
doesn't work.  Filter selection is temporarily disabled (it defaults to the
lowest numbered filter in the list; typically 'none').

New handling of compression settings (incomplete), new PNG compression level
(not yet visible in an API).

Back ported 'PNG_FAST_FILTERS' from 1.6 (in png.h).

There are minimal API changes beyond removal of the selection options.  Work is
still to be done to investigate a filter selection mechanism that is at least as
good as the previous one.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-05-04 17:02:20 -07:00
Glenn Randers-Pehrson
1fd42d849d [libpng17] Bump version to 1.7.0beta80 2016-03-09 12:05:09 -06:00
Glenn Randers-Pehrson
b6a1f48ab2 [libpng17] Imported from libpng-1.7.0beta79.tar 2016-03-09 12:05:00 -06:00
Glenn Randers-Pehrson
bbe8ea6eb0 [libpng17] Fixed some misleading indentation (Krishnaraj Bhat). 2016-03-07 07:49:09 -06:00
Glenn Randers-Pehrson
6d2e06f25f [libpng17] Changed PNG_INFO_cHNK and PNG_FREE_cHNK from 0xnnnn to 0xnnnnU in
png.h (Robert C. Seacord). Various other flags in png.h made unsigned as well.
2016-02-14 13:13:20 -06:00
Glenn Randers-Pehrson
3fb14ea53b [libpng17] Make cmake install pnglibconf.h; rename some tests to be
similar to the names generated by "configure"
2016-02-09 08:54:17 -06:00
John Bowler
af9ad9545d Write compression options
More sophisticated defaulting which helps significantly for some files along
with code to make it easier to control the compression defaults and to make the
settings honor the API calls the application makes (previously low windowBits
settings would get reset to higher values.)

Signed-off-by: John Bowler <jbowler@acm.org>
2016-02-02 05:58:38 -08:00
Glenn Randers-Pehrson
5e88e9c396 [libpng17] Update CHANGES and ANNOUNCE 2016-02-02 07:46:12 -06:00
John Bowler
8498aa1c97 Expand search logging
Output results during the search; not a perfect implementation but sufficient
for basic tests on zlib parameters.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-02-01 18:04:31 -08:00
Roger Leigh
8fb81acd98 [libpng17] Deleted pngstest-pngsuite from CMakeLists.txt 2016-01-30 21:20:55 -06:00
Glenn Randers-Pehrson
1a087bf921 [libpng17] Update copyright info in CMakeLists.txt 2016-01-30 17:19:49 -06:00
Roger Leigh
5a857b7d83 [libpng17] Remove extra pngvalid test from CMakeLists.txt 2016-01-30 17:04:51 -06:00
John Bowler
e2414effed pngcp: 1.6 support and better --search output
Some refinements for the search option and better (more consistent) reporting of
the results plus changes so that when compiled against libpng 1.6 the program
correctly copies text chunks; previously when a search option caused multiple
copies of the same file the copies after the first would not have the text
chunks.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-01-30 14:09:39 -08:00
Glenn Randers-Pehrson
023b399e40 [libpng17] Mention pngchunk.h in documentation 2016-01-30 09:47:13 -06:00
Glenn Randers-Pehrson
0b073f4a4d [libpng17] Add pngchunk.h dependency and remove some redundant
dependencies from CMakeLists.txt
2016-01-30 09:44:44 -06:00
Glenn Randers-Pehrson
a8b45d9f7e [libpng17] Removed pngstest-pngsuite test from CMakeLists.txt 2016-01-30 09:31:33 -06:00
Roger Leigh
c39c5640b4 [libpng17] Updated CMakeLists.txt, added supporting scripts/gen*.cmake.in
and test.cmake.in (Roger Leigh).
2016-01-29 17:27:39 -06:00
Glenn Randers-Pehrson
eb5e71cc8c [libpng17] Update CHANGES, ANNOUNCE, and some "last changed" dates 2016-01-29 16:20:34 -06:00
John Bowler
85cb69aa82 Forward port libpng16 fixes
Batched fixes from libpng16: PNG_IMAGE_PNG_SIZE_MAX macro fix, contrib/libtests
exit(77) change to just do that for configure and changes to pngstest to
(by default) make random backgrounds on a per-file, not per-session, basis.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-01-28 23:11:33 -08:00
Glenn Randers-Pehrson
dcb3f792d9 [libpng17] Bump version to 1.7.0beta79 2016-01-23 14:57:49 -06:00
Glenn Randers-Pehrson
9a6922896d [libpng17] Imported from libpng-1.7.0beta78.tar 2016-01-23 14:06:48 -06:00
Glenn Randers-Pehrson
55d3b3226e [libpng17] Document new png_image_write_to_memory() API 2016-01-23 13:59:24 -06:00
Glenn Randers-Pehrson
443694d7ac [libpng17] Revised workaround for Coverity issue in pngvalid.c 2016-01-23 10:10:52 -06:00
Glenn Randers-Pehrson
f26fa77ef8 [libpng17] Updated CHANGES and ANNOUNCE, fixed typo in pngunknown.c comment. 2016-01-19 08:32:18 -06:00
John Bowler
e46cd2e6bc Simplified API: use system appropriate types
This is an API change for 1.7, albeit a quiet one; it may produce compiler
warnings but should not result in errors, unless warnings are treated as errors.

On 64-bit systems it widens the results of the various PNG_IMAGE_ macros that
return size values (component counts, byte sizes) to 64 bits.  It also changes
the row_stride parameter, which is the pointer difference between adjacent rows
of the image buffer, to ptrdiff_t which is the ANSI-C90 defined type of the
difference of two pointers.  The existing (1.6.22) checks for overflow are
preserved but now accomdate images that require more than 32 bits of address
space when size_t/ptrdiff_t are 64 bit types.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-01-18 20:44:26 -08:00
John Bowler
f2a160299e pngunknown: update date 2016-01-18 12:02:40 -08:00
John Bowler
4697cbded6 Simplified API: write-to-memory, overflow handling
This implements an API and provides a number of assist macros to allow an
application which uses the simplified API write to bypass stdio and write
directly to memory.

It also includes some warnings (png.h) and some check code to detect *possible*
overflow in the ROW_STRIDE and simplified image SIZE macros.  This disallows
image width/height/format that *might* overflow.  A quiet API change that limits
in-memory image size (uncompressed) to less that 4GByte and image row size
(stride) to less than 2GByte.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-01-18 11:50:30 -08:00
John Bowler
033a0d7b49 pngunknown: fix NO_STDIO build
pngunknown.c calls png_init_io (always), skip the test if there is no stdio.h
support.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-01-18 11:34:13 -08:00
Glenn Randers-Pehrson
eacf6f9637 [libpng17] Changed PNG_USE_MKSTEMP to __COVERITY__ to select alternate
"tmpfile()" implementation in contrib/libtests/pngstest.c
2016-01-17 16:03:10 -06:00
Glenn Randers-Pehrson
7912bf3037 [libpng17] Bump version to 1.7.0beta78 2016-01-16 08:00:36 -06:00
Glenn Randers-Pehrson
e4fad63915 [libpng17] Imported from libpng-1.7.0beta77.tar 2016-01-16 08:00:23 -06:00
Glenn Randers-Pehrson
89287f10b8 [libpng17] Worked around a false-positive Coverity issue in pngvalid.c. 2016-01-13 09:48:41 -06:00
Glenn Randers-Pehrson
6271b4fc78 [libpng17] Updated CHANGES and ANNOUNCE 2016-01-12 14:44:47 -06:00
John Bowler
3d024874a5 Recently introduced palette sharing bug
The internal read code change to stop sharing the palette was incompletely
implemented.  The result is that unless palette index checking is turned off and
there are no read transformations the png_info palette gets deleted when the
png_struct is deleted.  This is normally harmless (png_info gets deleted first)
but in the case of pngcp it results in use-after-free of the palette and,
therefore, palette corruption and maybe on some operating systems and access
violation.

This also updated pngcp 'search' mode to check a restricted range of memLevels;
there is an unrelated bug which means that lower zlib memLevels result in memory
corruption under some circumstances, probably less often than 1:1000.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-01-12 09:36:10 -08:00
Glenn Randers-Pehrson
2fce16e5c4 [libpng17] Update CHANGES and ANNOUNCE, fix typo in png.h 2016-01-10 19:34:16 -06:00
John Bowler
fc322f6d48 Add pngcp IDAT size test
Also change the order of the 'level' and 'windowBits' searches to seach
windowBits first; this favours windowBits optimizations over compression level
ones on the basis that the latter should only affect the write code.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-01-10 13:53:47 -08:00
John Bowler
1afbb57994 IDAT read buffering correction
The sequential read code failed to read to the end of the IDAT stream in about
1/820 cases, resulting in a spurious warning.  The
png_set_compression_buffer_size API also would not work (or do bad things) if
the size of a zlib uInt was less than 32 bits.

This includes a quiet API change to alter png_set_compression_buffer_size to use
a png_alloc_size_t, not png_size_t and implement the correct checks.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-01-10 13:51:29 -08:00
John Bowler
e393f19527 Fix write problem with reduced size IDAT chunks
png_set_compression_buffer_size would result in a spurious debug assert if the
compression buffer size was set to something other than a multiple of
PNG_ROW_BUFFER_SIZE; the debug test failed to add the buffer 'start'

Signed-off-by: John Bowler <jbowler@acm.org>
2016-01-10 13:49:34 -08:00
John Bowler
79378d49b3 [libpng17] Changed copyright and license in pngcp.c to be nearly public domain
similar to the other files in the contrib/examples directory.
2016-01-10 12:09:38 -06:00
Glenn Randers-Pehrson
d9d6b6e361 [libpng17] Update CHANGES and ANNOUNCE 2016-01-10 08:00:00 -06:00
John Bowler
b9014ed336 contrib/examples/pngcp search mode
This is still a work-in-progress but it seems fairly stable (if not exactly 100%
optimal).  pngcp now allows 'all' for some options which iterates through all
possible settings (this reliably produces the smallest IDAT that libpng can
produce with those settings.)  It also contains a --search command line option
which attempts to optimize this by skipping pointless tests; it is close, most
of the time, but not perfect.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-01-09 17:40:55 -08:00
John Bowler
faf68f8d57 Fix for serious write bugs in pngwutil.c
There are two separate problems.  The first is that the CMINFO optimization code
gets run twice on any PNG IDAT stream longer than 2048 bytes and the second time
can overwrite bytes 2048,2049 destroying the output.

The second is that one of the (debug) checks was slightly wrong (< when <=
should have been used) and this causes write to abort maybe 1/2048 times.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-01-09 17:38:34 -08:00
Glenn Randers-Pehrson
09a1afbb3d [libpng17] Fixed another Coverity defect, NULL dereference "ps" in pngwutil.c 2016-01-08 18:59:36 -06:00
Glenn Randers-Pehrson
27e11dc8cf [libpng17] Bump version to 1.7.0beta77 2016-01-07 13:08:04 -06:00
Glenn Randers-Pehrson
df4568f84b [libpng17] Imported from libpng-1.7.0beta76.tar 2016-01-07 13:06:57 -06:00
Glenn Randers-Pehrson
6d5f00571d [libpng17] Fixed new Coverity defect, potential NULL dereference of "ps"
in pngwutil.c; Added temporary workaround for Coverity "Dead code" defect.
2016-01-07 09:24:56 -06:00
Glenn Randers-Pehrson
4705951df1 [libpng17] Relocate assert() in pngfix.c, update CHANGES and ANNOUNCE. 2016-01-06 16:16:09 -06:00
John Bowler
f33fe44b9f Mark 'limit' UNUSED in transform_range_check
Only affects release builds

Signed-off-by: John Bowler <jbowler@acm.org>
2016-01-06 13:00:08 -08:00
Glenn Randers-Pehrson
43d0aa7218 [libpng17] Removed redundant "option WRITE" from scripts/pnglibconf.dfa 2016-01-02 14:13:49 -06:00
Glenn Randers-Pehrson
89ebb4dd52 [libpng17] Happy 2016! Updated copyright year 2016-01-02 13:51:52 -06:00
Glenn Randers-Pehrson
8d18e76f2b [libpng17] Updated the manpage (libpng.3 and libpng-manual.txt) 2015-12-29 20:39:28 -06:00
Glenn Randers-Pehrson
fafbc6a458 [libpng17] Update CHANGES and ANNOUNCE, fix two trivial typos in comments 2015-12-29 19:50:41 -06:00
John Bowler
4253c4d759 tIME and text position handling
The handling of tIME and text chunks on read now records the location of the
chunks relative to PLTE and IDAT.  Behavior on write is unchanged except that if
the position was recorded on read it will be re-used.

This involves an ABI change to the png_text_struct; a one byte location field is
added (with the same meaning as the one used to record unknown chunk location.)
Because this field is only used on read there is no API change unless a png_info
from a libpng read is passed to a subsequent libpng write (this did not work
very well before 1.7; the tIME chunk could get duplicated.)

png_set_text ignores the new field, resetting it to the current position in the
read or write stream.  On write the position is set to the next location to be
written unless the write has not started (the position is before the signature)
in which case the location is set to PNG_HAVE_PLTE|PNG_AFTER_IDAT.  When the
chunk is written the position is set to the actual write location (effectively
the position is frozen.)

Signed-off-by: John Bowler <jbowler@acm.org>
2015-12-29 15:30:31 -08:00
Glenn Randers-Pehrson
c90572ee77 [libpng17] Updated CHANGES and ANNOUNCE 2015-12-28 19:57:26 -06:00
John Bowler
ef26a3f0fb pngcp.c: code to test zlib options
This adds code to iterate through the command line options when non-list options
have the 'all' parameter.  Used to rapidly test the effect of different zlib
options.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-12-28 16:17:12 -08:00
John Bowler
63ea57a796 Add NULL pz->list test to png_zlib_compress_validate
This seems safer; in fact a NULL dereference never happens because the test ends
up just doing arithmetic on NULL but it seems possible that the undefined
arithmetic can still happen if there is a bug elsewhere.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-12-28 16:15:36 -08:00
John Bowler
07c60a383a Correct the options handling
Setting the new, higher, option bits triggered the byte check (which is no
longer necessary).

Signed-off-by: John Bowler <jbowler@acm.org>
2015-12-28 16:14:15 -08:00
Glenn Randers-Pehrson
8d124a250a [libpng17] In projects/vstudio, merged readme.txt and WARNING into README.txt 2015-12-28 08:50:52 -06:00
Glenn Randers-Pehrson
0340dcdcbd [libpng17] Indented tables in projects/vstudio/WARNING 2015-12-27 20:50:18 -06:00
Glenn Randers-Pehrson
ff57ec2126 [libpng17] Minor update to vstudio documentation 2015-12-27 20:35:29 -06:00
Glenn Randers-Pehrson
745a926a38 [libpng17] Bump version to 1.7.0beta76 2015-12-25 08:48:02 -06:00
Glenn Randers-Pehrson
4b1d9e8c2a [libpng17] Imported from libpng-1.7.0beta75.tar 2015-12-25 08:31:37 -06:00
Glenn Randers-Pehrson
bb4bcecaa0 [libpng17] Updated CHANGES and ANNOUNCE 2015-12-21 09:21:31 -06:00
David Drysdale
28fa0d23c1 Reverse order of tests in png_zlib_compress_validate
Undefined behaviour sanitizer currently fires for this test
with an error about member access within null pointer to
struct; put the check that relies on pz->list being non-NULL
second.
2015-12-21 11:29:34 +00:00
Glenn Randers-Pehrson
1bfeb46881 [libpng17] Update CHANGES and ANNOUNCE 2015-12-19 14:49:48 -06:00
John Bowler
ace10ed9a2 Fix release builds (incorrect debug macro)
Signed-off-by: John Bowler <jbowler@acm.org>
2015-12-19 10:26:45 -08:00
John Bowler
156006bb1a Added an accurate 'methodical' measure
Also fix incorrect references to 'pngimage' in pngcp.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-12-19 09:51:41 -08:00
John Bowler
8d48a512bd Fix duplicate tIME chunk from png_write_png
Also add an example program, pngcp.c, which illustrates the problem when used to
copy pngtest.png (the result is an invalid PNG because the tIME chunk is
duplicated.)

Signed-off-by: John Bowler <jbowler@acm.org>
2015-12-19 09:51:07 -08:00
John Bowler
c75a0a40b4 Revert "Disable 'methodical' filter selection code"
This reverts commit 9c76207dbb86e04fd2f5eef088be72ba4a454a36.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-12-19 09:50:15 -08:00
Glenn Randers-Pehrson
fad9c9af47 [libpng17] Bump version to 1.7.0beta75 2015-12-19 09:25:12 -06:00
Glenn Randers-Pehrson
5695e897fd [libpng17] Imported from libpng-1.7.0beta74.tar 2015-12-19 09:25:01 -06:00
Glenn Randers-Pehrson
0e249e9d93 [libpng17] Updated CHANGES and ANNOUNCE 2015-12-18 22:28:13 -06:00
Glenn Randers-Pehrson
a78c4e286a Merge branch 'test17' of git://github.com/daviddrysdale/libpng into libpng17 2015-12-18 18:09:31 -06:00
Glenn Randers-Pehrson
16424d20b5 [libpng17] Update CHANGES and ANNOUNCE 2015-12-18 14:41:17 -06:00
John Bowler
9c76207dbb Disable 'methodical' filter selection code
It is incomplete; it works but does not do anything useful except, maybe, on
really enormous images.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-12-18 09:17:41 -08:00
David Drysdale
2023c4a0a5 Add Travis build configuration
Include sanitizers and coverage (via https://coveralls.io)
2015-12-18 07:23:56 +00:00
John Bowler
69ff249bc4 Merge branch 'libpng17' into libpng17-filter-selection 2015-12-17 20:06:48 -08:00
Glenn Randers-Pehrson
844e264234 [libpng17] Updated CHANGES and ANNOUNCE 2015-12-17 20:53:54 -06:00
John Bowler
61acc4c9ed Prototype implementation of filter selection
This rewrites the code used previously in the heuristics to make it easier to
debug and introduces the 'methodical' method, which is intended to be an
expensive but reliable way of reducing image size.

The code in this commit does not work; the 'methodical' test for success does
not take account of data buffered inside zlib and, anyway, it changes the
results of pngtest so that the test fails.  This commit is just a checkpoint of
the current state; another commit will temporarily disable the 'methodical'
code.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-12-17 17:47:29 -08:00
John Bowler
bd0bb3ca7f Fix undefined behavior in pngvalid.c
Undefined because (png_byte) << shift is undefined if it changes the signed bit
(because png_byte is promoted to int).  The libpng exported functions
png_get_uint_32 and png_get_uint_16 handle this.

Bug reported by David Drysdale as a result of reports from UBSAN in clang 3.8.

This changes pngvalid to use BE random numbers; this used to produce errors but
these should not be fixed as a result of the previous changes.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-12-17 12:58:36 -08:00
Glenn Randers-Pehrson
386b2b0a7b [libng17] Update CHANGES and ANNOUNCE 2015-12-15 12:26:54 -06:00
John Bowler
d103609ac5 pngvalid with 'limit' checks disabled in RC+
This widens the 'limit' check on the internally calculated error limits in the
'DIGITIZE' case (the code used prior to 1.7 for rgb_to_gray error checks) and it
changes the check to only operate in non-release builds (base build type not RC
or RELEASE.)

Signed-off-by: John Bowler <jbowler@acm.org>
2015-12-15 08:33:18 -08:00
Glenn Randers-Pehrson
639f8a4668 [libpng17] Update CHANGES and ANNOUNCE, fix date in pngvalid.c 2015-12-14 06:56:49 -06:00
John Bowler
aed7f7aaf9 Merge branch 'libpng17' of ../../libpng into libpng17 2015-12-13 22:28:27 -08:00
Glenn Randers-Pehrson
15b6717221 [libpng17] Update copyright years in source files. 2015-12-13 22:37:27 -06:00
Glenn Randers-Pehrson
c9fda22f76 [libpng16] Fix typo in "last-changed" date. 2015-12-13 18:25:36 -08:00
John Bowler
4891f1a5a8 Fix rgb_to_gray graylo==0 errors, build issues
Fixes to pngvalid for various reduced build configurations (eliminate unused
statics) and a fix for the case in rgb_to_gray when the digitize option reduces
graylo to 0, producing a large error.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-12-13 18:02:31 -08:00
John Bowler
abe4a4f049 Remove LE/BE dependencies in pngvalid
This 'fixes' the current problem in the BE tests by not testing it, making the
BE code the same as the LE version.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-12-13 18:00:21 -08:00
Glenn Randers-Pehrson
f3fa5dce47 [libpng17] Bump version to 1.7.0beta74 2015-12-11 16:13:00 -06:00
Glenn Randers-Pehrson
17bfbce61c [libpng17] Imported from libpng-1.7.0beta73.tar 2015-12-11 16:07:31 -06:00
Glenn Randers-Pehrson
2933c2e361 [libpng17] Changed png_struct->options from png_byte to png_uint_32, to hold
up to 16 2-bit options.
2015-12-11 14:53:54 -06:00
Glenn Randers-Pehrson
69f21bc6eb [libpng17] Combine tests for info_ptr==NULL in png_handle_PLTE(). 2015-12-11 14:28:54 -06:00
Glenn Randers-Pehrson
454408799b [libpng17] Updated ANNOUNCE and CHANGES to describe recent fix more accurately. 2015-12-09 15:55:11 -06:00
Glenn Randers-Pehrson
4c1ee27962 [libpng17] Fixed a syntax error in tests/pngstest that some shells other than
bash could not parse (Bug report by Nelson Beebe).
2015-12-09 13:29:02 -06:00
Glenn Randers-Pehrson
26090a5f43 [libpng17] Bump version to 1.7.0beta73 2015-12-08 13:03:30 -06:00
Glenn Randers-Pehrson
bfd8446816 [libpng17] Imported from libpng-1.7.0beta72.tar 2015-12-08 12:56:55 -06:00
Glenn Randers-Pehrson
605f8d046f [libpng17] Update CHANGES and ANNOUNCE 2015-12-06 20:12:23 -06:00
John Bowler
b8ab93dc6f Fix stack smaller in write png_copy_row
This also resulted in PNG data with random row bytes.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-12-06 11:12:17 -08:00
John Bowler
66b53bdd37 Merge remote-tracking branch 'code/libpng17-20151204' into libpng17-71-1 2015-12-06 10:41:58 -08:00
Glenn Randers-Pehrson
dcbc357c46 [libpng17] Bump version to 1.7.0beta72 2015-12-05 13:58:01 -06:00
Glenn Randers-Pehrson
8ac1821831 [libpng17] Imported from libpng-1.7.0beta71.tar 2015-12-05 13:52:36 -06:00
Glenn Randers-Pehrson
3407d0f7c4 [libpng17] Updated CHANGES and ANNOUNCE 2015-12-05 13:51:07 -06:00
John Bowler
c8d2efcb50 Fix g++ builds
enums are (int), G++ objects to (int) and (unsigned) being used together in ?:

Signed-off-by: John Bowler <jbowler@acm.org>
2015-12-03 17:17:42 -08:00
Glenn Randers-Pehrson
99436a407e [libpng17] Bump version to 1.7.0beta71 2015-12-03 17:54:53 -06:00
John Bowler
59136cc3b3 Fix build break in no-write-filters cases
Signed-off-by: John Bowler <jbowler@acm.org>
2015-12-03 14:12:05 -08:00
John Bowler
afbaf7150b Merge branch 'libpng17' into libpng17-20151201
MASSIVE merge conflicts; way beyond those reported here:

Conflicts:
	pngstruct.h
	pngwutil.c
	scripts/pnglibconf.h.prebuilt
2015-12-03 13:47:39 -08:00
John Bowler
86499967c3 Checkpoint for 'methodical' filter selection
This checkpoint is to allow the massive merge with the recent mainline libpng17
changes.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-12-03 13:25:11 -08:00
Glenn Randers-Pehrson
028d2c3fd6 [libpng17] Bump version to 1.7.0beta71 2015-12-03 10:15:25 -06:00
Glenn Randers-Pehrson
47ed19dfce [libpng17] Bump version to 1.7.0beta71 2015-12-02 22:31:19 -06:00
Glenn Randers-Pehrson
94a5189b1c [libpng17] Imported from libpng-1.7.0beta70.tar 2015-12-02 22:30:47 -06:00
John Bowler
9fce04fcd6 Change option (SUPPORTED) names, dummy code
The filter selection options are made more intuitive (IMO, but I am not an
Intuitive User).  Dummy code added for methodical filter selection.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-12-02 19:03:28 -08:00
John Bowler
71c5123a4d Merge branch 'libpng17' into libpng17-20151201 2015-12-02 17:10:45 -08:00
John Bowler
e9d567d9ec Filter heuristic implementation
This implements the heuristic part of filter selction, the methodic testing
approach is still not implemented.  png_set_option methods are incomplete.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-12-02 17:08:17 -08:00
Glenn Randers-Pehrson
37a50281cf [libpng17] Reverted recent manual change. The additional restrictions
on the order of png_set_PLTE, png_set_tRNS, and png_set_hIST are
not necessary.
2015-12-01 17:23:54 -06:00
Glenn Randers-Pehrson
aacda27449 [libpng17] Updated ANNOUNCE and CHANGES 2015-12-01 11:35:57 -06:00
Glenn Randers-Pehrson
b427d7216d Merge branch 'libpng17-20151130' of git://github.com/jbowler/libpng-1 into libpng17 2015-12-01 11:20:41 -06:00
Glenn Randers-Pehrson
c46bd30b51 [libpng17] Updated manual to require png_set_PLTE() to precede png_set_tRNS()
and png_set_hIST() if either is present.
2015-12-01 11:13:44 -06:00
John Bowler
0f2f0f7bbd Merge branch 'libpng17' into libpng17-20151130 2015-12-01 08:41:45 -08:00
John Bowler
84a8bb8244 Make png_struct palette, trans_alpha private
This removes the side-effect on the png_struct palette of calling png_set_PLTE
or png_set_tRNS.  NOTE: this is a quiet API change, it was possible before to
alter the palette on a PNG image by using png_set_PLTE, but this was unintended
and inconsistent with the other png_set APIs.

Fix a bug in palette index checking; png_struct::num_palette could, in
principle, get changed by the transformations (e.g. png_set_quantize) and this
would invalidate the check.  The palette checking init function now makes a copy
of png_struct::num_palette.

Fix a bug in pngvalid error handling.  A png_error in png_write_info is not
continuable (a valid image cannot necessarily be written afterward) because the
png_error aborts the write of subsequent pre-IDAT chunks.  In particular an
abort as a result of a bogus colorspace information (gAMA, cHRM, sBIT etc)
prevents the write of the PLTE chunk.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-12-01 08:16:53 -08:00
John Bowler
8fe2eac47f Separate png_compress_IDAT into w/c
I.e. write/compress, also remove some trailing spaces and clean up pnglibconf
stuff.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-30 21:00:22 -08:00
Glenn Randers-Pehrson
cb3402221b [libpng17] Updated PNG_ZBUF_SIZE definition in scripts/pnglibconf.h.prebuilt 2015-11-30 17:50:39 -06:00
Glenn Randers-Pehrson
8978eba436 [libpng17] Update CHANGES and ANNOUNCE, update dates in png.c and png.h 2015-11-30 16:57:23 -06:00
John Bowler
4792c8a751 compression code unification
Unify the compression code so that inflate calls are localized to a common
routine.  Ground work for filter selection support.  Minor API changes to use
void* not byte* for data parameters.  Unification of some of the compression
code with the decompression code; IDAT_size replaces IDAT_read_size and
zbuffer_size, IDAT reading and writing is no longer controlled by the size of
the compression buffer.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-30 13:39:49 -08:00
John Bowler
6bbc74d880 pngunknown fix for multiple IDAT chunks
Fixes the case where IDAT is treated as unknown and saved; the first IDAT chunk
ends up 'before' IDAT, the rest 'after', pngunknown has to take this into
account since it checks before and after.
2015-11-28 08:42:54 -08:00
John Bowler
b3a18efebf Filter code change prep.
This commit moves code round and changes the filter write interfaces that took
png_uint_32 buffer pixel counts to unsigned int.  Also moves compression code
and definitions into pngwutil.c so that the compression code is isolated from
other definitions.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-27 15:42:52 -08:00
John Bowler
14d11b9f35 contrib space removal
Remove all trailing spaces from source files in contrib

Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-26 09:55:37 -08:00
John Bowler
e41820cd0b Merge branch 'libpng17' into libpng17-20151124.0001 2015-11-25 16:08:20 -08:00
John Bowler
18211df70b [libpng17] Fix CMINFO bug in contrib/tools/pngfix.c 2015-11-25 16:03:47 -06:00
John Bowler
1775bdeb24 Better filter checking
Improve pngvalid coverage of filter combinations, remove the (new in 1.7) code
which disabled previous-row filters on the first row of an image in some cases.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-24 22:24:18 -08:00
John Bowler
8bffb48bc1 Add new pngvalid test case
This tests the 'size' images in the sequential reader, the existing test case
only uses the progressive reader which means that important parts of the filter
code never got tested.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-24 21:45:10 -08:00
Glenn Randers-Pehrson
edec44bfc4 [libpng17] Update CHANGES and ANNOUNCE 2015-11-24 20:45:26 -06:00
John Bowler
1c514557b6 Merge branch 'libpng17' of ../../libpng into libpng17 2015-11-24 18:17:31 -08:00
John Bowler
85d7eca204 Fix first row init on read.
The code failed to zero out the row buffer at the start of a pass where the AVG
filter is used because 'row_number' is not always zero (on interlaced images)
and, apparently, the assertion that the buffer had been zeroed when allocated
was not always correct for non-interlaced images.  Revealed by pngvalid --size
with a hack to make it always use AVG.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-24 17:56:06 -08:00
John Bowler
5357dd77f0 Fix significant bracketing problem
This error prevents the read of non-interlaced PNG files with height 1.  A
simple bracket problem caused by hasty multiple edits.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-24 17:18:46 -08:00
Glenn Randers-Pehrson
5db709d83c [libpng17] Updated CHANGES and ANNOUNCE, removed trailing blanks from *.c *.h 2015-11-24 14:38:52 -06:00
Glenn Randers-Pehrson
616ed1197b [libpng17] Bump version to 1.7.0beta70 2015-11-24 13:37:41 -06:00
Glenn Randers-Pehrson
0cb0a45721 [libpng17] Imported from libpng-1.7.0beta69.tar 2015-11-24 09:51:46 -06:00
Glenn Randers-Pehrson
f476f13488 [libpng17] Updated CHANGES and ANNOUNCE 2015-11-23 21:44:18 -06:00
John Bowler
8d93ec2eca pngvalid fixes and backward compat
This fix is to the PNG_MAX_GAMMA_8 handling and png_set_rgb_to_gray, which had
bugs which were likely to expose end cases of rgb-to-gray conversion errors.
This might explain some of the machine math dependencies we are seeing
(*might*).

Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-23 18:45:28 -08:00
John Bowler
b0076faf1f Backward compatibility with 1.6
1.6 did not define PNG_READ_PNG_SUPPORTED, ever; it doesn't matter there.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-23 18:14:57 -08:00
John Bowler
fa86bd2a61 Backward compatibility for pngtest.c
This version can be used in 1.6 and 1.5 with appropriate changes to the last
line.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-23 18:13:39 -08:00
John Bowler
961d60b067 Correct end-of-image test in pngread.c
This only changes the detection of invalid application behavior (too many calls
to png_read_row) from an affirm to a png_app_error.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-23 18:12:17 -08:00
John Bowler
764ae07652 Merge branch 'libpng17' into libpng17-buffer-enhancements 2015-11-22 21:40:13 -08:00
John Bowler
6803b09cb7 Fixes for !READ_INTERLACE/!READ_PNG interpendencies
The reliance of png_read_png on interlace handling and some minor issues in the
test programs where they failed to correctly check for interlace handling were
exposed by the ability to write interlaced images even if WRITE_INTERLACING is
turned off.  This is fixed here.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-22 21:37:16 -08:00
Glenn Randers-Pehrson
7a7e4367d0 [libpng17] Updated CHANGES and ANNOUNCE 2015-11-22 23:16:01 -06:00
John Bowler
b69df74b8e Re-remove PNG_WRITE_INTERLACE
Previous change backed out.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-22 20:48:23 -08:00
John Bowler
a42416de9c Merge branch 'libpng17' into libpng17-buffer-enhancements 2015-11-22 20:43:56 -08:00
Glenn Randers-Pehrson
e51652b4db [libpng17] Reverted 12 -> 12U again. 2015-11-22 22:41:10 -06:00
Glenn Randers-Pehrson
771eb7d01e [libpng17] Update CHANGES, ANNOUNCE, pnglibconf.h.prebuilt 2015-11-22 22:35:35 -06:00
John Bowler
368bb1b241 Fix certain minimal config builds
The removal of png_struct::row_buffer and png_struct::row_format from write
builds configured without filter or transform support (respectively) wasn't
complete; some of the png.c and pngwrite.c cleanup code needed to handle the
potentially removed members.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-22 20:34:00 -08:00
John Bowler
504ebd427d Back out READ/WRITE_INTERLACING changes
Now that the code works consistently so that these just switch off the support
for having libpng do the interlace/deinterlace the old names make more sense,
restoring them avoids cruft in the configuration file and avoids an unnecessary
version specific change.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-22 20:25:24 -08:00
John Bowler
caa716d859 Fix build break introduced from libpng17
12->12U in a compare when the other side is signed.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-22 19:52:12 -08:00
John Bowler
0f2554a5e6 Squashed commit of the following:
commit fc4b42b1d56f95efeb1b9fe42dc35b7d98d246bb
Merge: 74516c7 9eb1413
Author: John Bowler <jbowler@acm.org>
Date:   Sun Nov 22 19:37:54 2015 -0800

    Merge branch 'libpng17' into libpng17-filter-enhancements

commit 74516c7257f1a28a69985684c5673caa390c700a
Author: John Bowler <jbowler@acm.org>
Date:   Sun Nov 22 19:32:43 2015 -0800

    Make check full pass on gcc/g++ x86_64

    Signed-off-by: John Bowler <jbowler@acm.org>

commit e891e34737fc0bc9ee873a5d56b83c1e777b990c
Author: John Bowler <jbowler@acm.org>
Date:   Sun Nov 22 12:01:37 2015 -0800

    Checkpoint: write buffering changes

    This version fails in pngvalid --size because of an error handling very narrow
    images, otherwise a standard build passes make check.

    Signed-off-by: John Bowler <jbowler@acm.org>

commit 457a046ebdab737eefb477126cf855e49df6de50
Author: John Bowler <jbowler@acm.org>
Date:   Sun Nov 22 06:39:36 2015 -0800

    Fix previous bad merge

commit b4f426c97267317637d43f41fe0b05d1659bc63d
Merge: 07b9b90 a3458a6
Author: John Bowler <jbowler@acm.org>
Date:   Sun Nov 22 06:32:34 2015 -0800

    Merge branch 'libpng17' into libpng17-filter-enhancements

commit 07b9b90dfd653b744dbc3710b096facf6b4605f6
Merge: ed43306 5592e0b
Author: John Bowler <jbowler@acm.org>
Date:   Sat Nov 21 17:07:23 2015 -0800

    Merge branch 'libpng17' into libpng17-filter-enhancements

commit ed43306599f7039a90187862db82273fca3a4c3d
Merge: 772aed7 d3c0359
Author: John Bowler <jbowler@acm.org>
Date:   Tue Nov 17 17:47:26 2015 -0800

    Merge branch 'libpng17' into libpng17-filter-enhancements

commit 772aed72378df9c8fccc5a4594b095d02d410a9c
Merge: 73ae431 801608f
Author: John Bowler <jbowler@acm.org>
Date:   Mon Nov 16 14:26:38 2015 -0800

    Merge branch 'libpng17' into libpng17-filter-enhancements

commit 73ae4316cb6db7d7f6756583a1c213c35ca4e3f4
Merge: 687e6e3 c09b3ab
Author: John Bowler <jbowler@acm.org>
Date:   Sun Nov 15 09:31:30 2015 -0800

    Merge branch 'libpng17' into libpng17-filter-enhancements

commit 687e6e393e9d0220c2a12ec474aa01b83c5e9f25
Merge: fedd6da e916d9b
Author: John Bowler <jbowler@acm.org>
Date:   Thu Nov 5 08:45:14 2015 -0800

    Merge branch 'libpng17' into libpng17-filter-enhancements

commit fedd6da8798a14b2e002b0bc1379f5a09a03598a
Merge: 2e2fc5f ea41fd2
Author: John Bowler <jbowler@acm.org>
Date:   Tue Nov 3 21:05:01 2015 -0800

    Merge branch 'libpng17' into libpng17-filter-enhancements

commit 2e2fc5f6d7678b710c52b7ea081ac4add677d8d5
Merge: 990d5f8 5b05197
Author: John Bowler <jbowler@acm.org>
Date:   Mon Oct 12 08:28:30 2015 -0700

    Merge branch 'libpng17' into libpng17-filter-enhancements

commit 990d5f88688635dc0888657b689e30ffe7e7a7b3
Author: John Bowler <jbowler@acm.org>
Date:   Sun Oct 4 17:04:53 2015 -0700

    Read row buffer changes

    The read code now allocates one row buffer of the size of the input PNG row and,
    only if required, one buffer of the size of the output.

    The output buffer is required for the progressive reader (always) and for the
    sequential reader if libpng is de-interlacing an image (because the output row
    is used multiple times if png_read_row is called with a display row parameter.)

    This should reduce memory utilization by libpng significantly, but it has no
    detectable effect on overall performance figures of the test programs, these are
    probably dominated by memory allocations for the whole image within the test
    programs.

    Signed-off-by: John Bowler <jbowler@acm.org>

commit 527bf989bf0e30440f9e07a5544a6ebb1d6fd039
Merge: 50ebbc2 9099254
Author: John Bowler <jbowler@acm.org>
Date:   Sat Oct 3 13:39:17 2015 -0700

    Merge branch 'libpng17' into libpng17-filter-enhancements

commit 50ebbc2c9a24cf1a6b428db53d55fbd5af4d6be6
Merge: 21a7f40 2cd6d56
Author: John Bowler <jbowler@acm.org>
Date:   Sat Oct 3 11:16:32 2015 -0700

    Merge branch 'libpng17' into libpng17-filter-enhancements

commit 21a7f401ab40c79ead9e35882a8066e2cf1d6902
Merge: b512e1c 15a143e
Author: John Bowler <jbowler@acm.org>
Date:   Wed Sep 30 19:01:23 2015 -0700

    Merge branch 'libpng17' into libpng17-filter-enhancements

commit b512e1c2c5bfe6df8b6dca32f862d325ec22115e
Author: John Bowler <jbowler@acm.org>
Date:   Wed Sep 30 17:33:34 2015 -0700

    Transform rewrite: perform transforms in small chunks

    The intent of this change is to reduce the memory footprint during transform
    sequences by performing transforms in fixed (small) sized blocks of pixels.
    The change is incomplete; the filter code still works row-by-row, so the whole
    tranform also works row-by-row, the intent is to fix this so that everything
    works in small(ish) chunks.

    At present the change has no discernable effect on pngvalid --speed or pngstest
    with (e.g.) rgb-8-1.8.png; user time and (minor) page faults are the same in old
    and new versions.  The same applies to real-world 15MP PNG images; even on these
    the presence of the filter code causes a cyclical progress through memory which
    will interfere with any caching otherwise possible (useful word, 'otherwise'.)

    Signed-off-by: John Bowler <jbowler@acm.org>

commit 781cb3699b92beb0e6bc5e03cef8fba820267082
Author: John Bowler <jbowler@acm.org>
Date:   Wed Sep 30 17:12:53 2015 -0700

    Fix NO_WRITE_INTERLACE in pngvalid.c

    The support for writing interlaced images directly from libpng 1.7 was
    unintentionally disabled (INTERLACE_LAST was defined incorrectly, excluding the
    interlaced images).  This obscured the fact that the transform and error test
    case generators lacked the support for writing interlaced images from libpng.

    Signed-off-by: John Bowler <jbowler@acm.org>

commit 406ee2fd7946a384f1d7713712dc646080c5c52c
Author: John Bowler <jbowler@acm.org>
Date:   Wed Sep 30 17:11:40 2015 -0700

    Add pngvalid --transform --interlace test

    This increases code coverage by generating test cases with smaller length rows
    as a result of the interlacing.  Without this packswap handling was incompletely
    tested.

    Signed-off-by: John Bowler <jbowler@acm.org>

Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-22 19:41:41 -08:00
Glenn Randers-Pehrson
9eb14136d8 [libpng17] Fixed bug recently introduced in png_set_PLTE() that uses png_ptr
not info_ptr.
2015-11-22 20:44:58 -06:00
Glenn Randers-Pehrson
09c90236f4 [libpng17] Refactored conditional compilation in png_init_row_info(). 2015-11-22 09:19:06 -06:00
Glenn Randers-Pehrson
a3458a6ba0 [libpng17] Refactor conditional compilation of png_get_compression_buffer_size()
for readability
2015-11-22 07:18:05 -06:00
Glenn Randers-Pehrson
daf4b9dd18 [libpng17] Clean up some conditional compilation of parts of statements
and fixed some indentation
2015-11-21 19:14:37 -06:00
Glenn Randers-Pehrson
3a866cb451 [libpng17] Avoid conditionally compiling parts of statements in png.c (suggested
by flaviommedeiros).
2015-11-21 18:18:26 -06:00
Glenn Randers-Pehrson
5592e0bc96 [libpng17] Use unsigned constants in pngrutil.c buffer length comparisons 2015-11-21 14:30:35 -06:00
John Bowler
57e92a8432 [libpng17] Use "1U" not "1" in pointer calculations in png_handle_sPLT(). 2015-11-19 21:13:29 -06:00
Glenn Randers-Pehrson
d3c0359b23 [libpng17] Removed a redundant new check in png_handle_pCAL(). 2015-11-17 16:14:35 -06:00
Glenn Randers-Pehrson
801608f8f4 [libpng17] Rearrange terms to make it self-evident that overflow cannot happen 2015-11-16 09:34:20 -06:00
Glenn Randers-Pehrson
c09b3ab2c7 [lbpng17] Avoid potential pointer overflow in png_handle_sPLT() and
png_handle_pCAL() (Bug report by John Regehr).
2015-11-13 22:25:03 -06:00
Glenn Randers-Pehrson
722645fec5 [libpng17] Bump version to 1.7.0beta69 2015-11-13 10:19:36 -06:00
Glenn Randers-Pehrson
f72d0d01eb [libpng17] Imported from libpng-1.7.0beta68.tar 2015-11-12 07:13:47 -06:00
Glenn Randers-Pehrson
97c4072cce [libpng17] Clean up coding style in png_set_PLTE() 2015-11-05 11:20:12 -06:00
Glenn Randers-Pehrson
7a92725e17 [libpng17] Update ANNOUNCE and CHANGES 2015-11-05 07:06:01 -06:00
Glenn Randers-Pehrson
e916d9bb60 [libpng17] Fixed new bug with CRC error after reading an over-length palette. 2015-11-04 23:49:01 -06:00
Glenn Randers-Pehrson
ea41fd2161 [libpng17] Bump version to 1.7.0beta68 2015-11-03 09:55:12 -06:00
Glenn Randers-Pehrson
dbd98b8c68 [libpng17] Imported from libpng-1.7.0beta67.tar 2015-11-03 09:55:02 -06:00
Glenn Randers-Pehrson
5cf6ed45c8 [libpng17] Clarified COPYRIGHT information to state explicitly that versions
are derived from previous versions.
Removed much of the long list of previous versions from png.h and
    libpng.3.
2015-11-03 09:47:54 -06:00
Glenn Randers-Pehrson
9f7d5aa973 [libpng17] Prevent setting or writing over-length PLTE chunk (Cosmin Truta).
Silently truncate over-length PLTE chunk while reading.
2015-11-01 13:01:56 -06:00
Glenn Randers-Pehrson
5b05197604 [libpng17] Added sPLT support to pngtest.c 2015-10-10 12:04:50 -05:00
Glenn Randers-Pehrson
90992547c7 [libng17] Updated CHANGES and ANNOUNCE 2015-10-03 15:11:12 -05:00
John Bowler
13ce05daaf Fix 'pow' macros in pngvalid.c
It is legal for 'pow' to be a macro, therefore the argument list cannot contain
preprocessing directives.  Make sure pow is a function where this happens (this
is a minimal safe fix, the issue only arises in non-performance-critical code.)

Signed-off-by: John Bowler <jbowler@acm.org>
2015-10-03 11:08:03 -07:00
John Bowler
2cd6d56ff6 Merge remote-tracking branch 'local/libpng17' into libpng17 2015-10-03 11:04:31 -07:00
Glenn Randers-Pehrson
1af270dc19 [libpng17] Bump version to 1.7.0beta67 2015-10-02 14:06:12 -05:00
Glenn Randers-Pehrson
2ddd06c392 [libpng17] Imported from libpng-1.7.0beta66.tar 2015-10-02 13:44:50 -05:00
Glenn Randers-Pehrson
33d4b5b66d [libpng17] Another attempt (successful this time) to quiet the Coverity issue. 2015-10-02 13:43:36 -05:00
John Bowler
15a143e85e Merge remote-tracking branch 'local/libpng17' into libpng17 2015-09-30 19:00:43 -07:00
Glenn Randers-Pehrson
bd55022b2d [libng17] Stifle the last remaining Coverity issue in libpng17. 2015-09-28 15:41:47 -05:00
John Bowler
c5bc9b668d Fix (work round) rgb-to-gray issues in libpng 1.6
The previous attempts to ignore the errors in the code aren't quite enough to
deal with the 'channel selection' encoding added to libpng 1.7; abort.
pngvalid.c is changed to drop this encoding in prior versions.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-26 21:43:07 -07:00
Glenn Randers-Pehrson
975d8fac6d [libpng17] Update CHANGES and ANNOUNCE 2015-09-26 21:14:36 -05:00
John Bowler
e76a320539 Fix missing prototype for READ_GAMMA+!SIMPLIFIED_API
Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-26 17:17:13 -07:00
John Bowler
eab2c419fa makepng fixes for the palette case
Also allow extra command line arguments; convenient for testing odd things.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-26 16:44:29 -07:00
John Bowler
23324b8559 sBIT code coverage and fixes
Fixes for sBIT handling in the low-bit-depth gray and pngstest cases, extends
sBIT handling to the colormap code in the simplified API which is separately
implemented in pngread.c

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-26 15:24:20 -07:00
John Bowler
8dfa93beed Merge remote-tracking branch 'local/libpng17' into libpng17 2015-09-26 15:17:27 -07:00
Glenn Randers-Pehrson
ed44394ad0 [libpng17] Added "option READ_IMAGE on" to contrib/pngminim/decoder/pngusr.dfa
due to the new PNG_READ_IMAGE_SUPPORTED configuration in libpng-1.7.0beta65.
2015-09-26 07:55:54 -05:00
Glenn Randers-Pehrson
c23bdb1445 [libpng17] #ifdef out some dead code in pngrtran.c when sBIT is disabled. 2015-09-25 22:33:41 -05:00
John Bowler
cbf4adee5c Merge remote-tracking branch 'local/libpng17' into libpng17 2015-09-25 17:04:06 -07:00
John Bowler
1bc0781245 Merge remote-tracking branch 'local/libpng17' into libpng17 2015-09-25 17:01:16 -07:00
Glenn Randers-Pehrson
7441965463 [libpng17] Update CHANGES and ANNOUNCE 2015-09-25 18:54:12 -05:00
John Bowler
8d6c21ce96 pngvalid tests: add --strict, fix test names
Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-25 16:43:34 -07:00
Glenn Randers-Pehrson
8c94b1295f Merge branch 'libpng17' of https://github.com/jbowler/libpng-1 into libpng17 2015-09-25 18:43:07 -05:00
Glenn Randers-Pehrson
1932e16c21 [libpng17] Restored license output to pngstest.c 2015-09-25 18:37:44 -05:00
John Bowler
a6278e7c87 Merge remote-tracking branch 'glennrp/libpng17' into libpng17 2015-09-25 16:25:11 -07:00
John Bowler
a5b993aaed Enable low-bit-depth gray tests in pngvalid 2015-09-25 16:22:59 -07:00
John Bowler
53e537439f Fix png_set_tRNS_to_alpha for low-bit-depth gray
Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-25 16:22:17 -07:00
Glenn Randers-Pehrson
f1eec0ba62 [libng17] Updated CHANGES and ANNOUNCE, restored license info in
pngtest-errors.h
2015-09-25 17:40:48 -05:00
John Bowler
1e563f689c New test PNG files incorporated into make check
tests/pngstest-* are changed so that the new test files are divided into 8
groups by gamma and alpha channel.  This makes each test take just under 5
seconds on a moderately up-to-date x86_64 system using libpng16 (test times are
somewhat variable under libpng17 at present because of the lack of optimization
in some gamma processing paths.)

These tests have considerably better code and pixel-value coverage than
contrib/pngsuite however coverage is still incomplete.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-25 12:21:10 -07:00
John Bowler
0301cc2627 Update pngstest-errors.h for new make check tests
Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-25 12:20:36 -07:00
Glenn Randers-Pehrson
9ee0b63b09 [libpng17] Updated CHANGES and ANNOUNCE 2015-09-24 23:09:12 -05:00
John Bowler
2c13de800f Merge remote-tracking branch 'glennrp/libpng17' into libpng17
Changes from Glenn for legal reasons
2015-09-24 17:44:05 -07:00
John Bowler
d394d889e1 png_rgb_to_gray optimization fixes
This fixes the code that optimizes RGB to Gray transformations that only
selected on channel and clarifies the handling of max_depth in the transform
code.  It eliminates some UNTESTED cases and removes the write 'invert alpha'
UNTESTED macro because, while there are no test cases for it, code review
some months after writing it suggests it is ok.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-24 17:33:32 -07:00
Glenn Randers-Pehrson
40d90d34a8 [libpng17] Add copyright and license to contrib/testpngs/makepngs.sh 2015-09-22 16:04:26 -05:00
John Bowler
3f6efbd8e2 Squashed commit of the following:
commit bf51c644f7d29400d884e20def9a0bee74904308
Author: John Bowler <jbowler@acm.org>
Date:   Tue Sep 22 09:05:13 2015 -0700

    Updated contrib/testpngs/*.png

    Corrected copyright/licensing information, corrected filtering.

    Signed-off-by: John Bowler <jbowler@acm.org>

commit 05399c8c82d7b188357dc6fa05a8cdd89426b155
Author: John Bowler <jbowler@acm.org>
Date:   Tue Sep 22 09:04:03 2015 -0700

    makepng.c: correct the first row filter setting

    It needs to include the "UP" filter so that libpng knows to retain the first
    line for the UP filter on the next one.  Without this libpng ended up using NONE
    for the second line.

    Signed-off-by: John Bowler <jbowler@acm.org>

commit 8fae6609c063c7e0a5eeb592f8eec15849617ae9
Author: John Bowler <jbowler@acm.org>
Date:   Mon Sep 21 17:15:45 2015 -0700

    makepng: spelling corrections, single test output

    Corrections to some obvious mistakes, plus one output file.

    Signed-off-by: John Bowler <jbowler@acm.org>

commit a2245a2c54a679d25f8f1609f85654d155936863
Author: John Bowler <jbowler@acm.org>
Date:   Mon Sep 21 13:39:48 2015 -0700

    Updated testpngs files with new Licensing tag

    Signed-off-by: John Bowler <jbowler@acm.org>

commit 46d3f863cace5b7aa769c9b882fca49e2a821138
Author: John Bowler <jbowler@acm.org>
Date:   Mon Sep 21 13:38:34 2015 -0700

    Updated makepng.c

    This supports more test cases and a reduced licence keyword (now licensing).
    The extra text cases require more slack in pngstest.c

    Signed-off-by: John Bowler <jbowler@acm.org>

commit 7c9a08b8bc5e2542184d4abb25c33c516bc0adc7
Author: John Bowler <jbowler@acm.org>
Date:   Sun Sep 20 20:55:19 2015 -0700

    Test PNG files

    These files were generated by contrib/testpngs/makepngs.sh --small with MAKEPNG
    set to the makepng compiled from the current contrib/libtests/makepngs.sh

    Signed-off-by: John Bowler <jbowler@acm.org>

commit c2a8a01b2ac733b8029478d10f700f5ab8a713f2
Author: John Bowler <jbowler@acm.org>
Date:   Sun Sep 20 20:51:06 2015 -0700

    makepng --small

    This patch adds code to 'makepng' to allow the generation of smaller images that
    also give better test case coverage.  It also adds copyright and licence to the
    generated images, reflecting the fact that they are original works of the author
    of the code.  The licence used is the Creative Commons Public Domain one,
    appropriate to a non-source-code work.

    The resultant image were used to generate the updated pngstest-errors.h file in
    a prior commit.

    Signed-off-by: John Bowler <jbowler@acm.org>

commit 8c025bcf3fdfb68fb8b1e5fab4b7deb0f94453f6
Author: John Bowler <jbowler@acm.org>
Date:   Sun Sep 20 20:40:52 2015 -0700

    Simplified API sRGB gamma handling correction

    If a gamma encoded file that has a gamma not matching that of sRGB is passed to
    the simplified API the previous code simply interpreted it as a power law
    encoding.  However old Mac files had a power law correction of 1.45 built in to
    the encoding, even though the display devices were consistent with sRGB.
    Assuming a power law encoding results in substantial differences in the
    interpretation of low 8-bit values; below 10.  For example an Apple '5' which is
    equivalent to an sRGB '17' ends up as the value '8'.

    This patch provides some measure of correction for this by making the gamma
    correction done within the simplified API assume that any encoded data is
    encoded relative to an sRGB-like transfer function; the data is corrected back
    to the PNG-nominal 2.2 value then decoded to linear (if required) using the sRGB
    transfer function.

    This reduces the errors reported by pngstest for such files (colormapped ones)
    but still leaves the issue with files where the standard libpng code does the
    gamma decoding.  To cope with the latter cases the patch also includes a new
    pngstest-errors which allows the result, however this is still a
    work-in-progress; a better solution is possible.

    Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-22 13:46:19 -05:00
John Bowler
bf51c644f7 Updated contrib/testpngs/*.png
Corrected copyright/licensing information, corrected filtering.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-22 09:05:13 -07:00
John Bowler
05399c8c82 makepng.c: correct the first row filter setting
It needs to include the "UP" filter so that libpng knows to retain the first
line for the UP filter on the next one.  Without this libpng ended up using NONE
for the second line.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-22 09:04:03 -07:00
John Bowler
8fae6609c0 makepng: spelling corrections, single test output
Corrections to some obvious mistakes, plus one output file.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-21 17:15:45 -07:00
John Bowler
a2245a2c54 Updated testpngs files with new Licensing tag
Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-21 13:39:48 -07:00
John Bowler
46d3f863ca Updated makepng.c
This supports more test cases and a reduced licence keyword (now licensing).
The extra text cases require more slack in pngstest.c

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-21 13:38:34 -07:00
John Bowler
7c9a08b8bc Test PNG files
These files were generated by contrib/testpngs/makepngs.sh --small with MAKEPNG
set to the makepng compiled from the current contrib/libtests/makepngs.sh

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-20 20:55:19 -07:00
John Bowler
c2a8a01b2a makepng --small
This patch adds code to 'makepng' to allow the generation of smaller images that
also give better test case coverage.  It also adds copyright and licence to the
generated images, reflecting the fact that they are original works of the author
of the code.  The licence used is the Creative Commons Public Domain one,
appropriate to a non-source-code work.

The resultant image were used to generate the updated pngstest-errors.h file in
a prior commit.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-20 20:51:06 -07:00
John Bowler
8c025bcf3f Simplified API sRGB gamma handling correction
If a gamma encoded file that has a gamma not matching that of sRGB is passed to
the simplified API the previous code simply interpreted it as a power law
encoding.  However old Mac files had a power law correction of 1.45 built in to
the encoding, even though the display devices were consistent with sRGB.
Assuming a power law encoding results in substantial differences in the
interpretation of low 8-bit values; below 10.  For example an Apple '5' which is
equivalent to an sRGB '17' ends up as the value '8'.

This patch provides some measure of correction for this by making the gamma
correction done within the simplified API assume that any encoded data is
encoded relative to an sRGB-like transfer function; the data is corrected back
to the PNG-nominal 2.2 value then decoded to linear (if required) using the sRGB
transfer function.

This reduces the errors reported by pngstest for such files (colormapped ones)
but still leaves the issue with files where the standard libpng code does the
gamma decoding.  To cope with the latter cases the patch also includes a new
pngstest-errors which allows the result, however this is still a
work-in-progress; a better solution is possible.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-20 20:40:52 -07:00
Glenn Randers-Pehrson
d555056b24 [libng17] Suppressed bogus Coverity issues in pngrutil.c and pngwutil.c. 2015-09-19 22:47:59 -05:00
Glenn Randers-Pehrson
69f2152c0f [libpng17] Added license info to pngstest-errors.h and its generator. 2015-09-19 20:18:49 -05:00
Glenn Randers-Pehrson
e6a3e2456c [libpng17] Update CHANGES and ANNOUNCE with changes from pull request #20 2015-09-19 19:45:24 -05:00
John Bowler
493bfd14a2 gamma handling fixes
One serious bug; 8 was forced as a bit depth when caching a palette, even though
the palette have been expanded.  One less serious bug, the optimization for
avoiding gamma correction introduced significant errors if the app subsequently
did further corrections, only shown by using gAMA 1/1.52 files in pngstest.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-19 16:36:22 -07:00
John Bowler
8a9a3fb4dd pngstest: make error limits version specific
Splitting the machine generated error structs out to a file allows the values to
be updated without changing pngstest.c itself, sine libpng 1.6 and 1.7 have
slightly different error limits this simplifies maintenance.

makepngs.sh has also been updated to more accurately reflect current problems in
libpng 1.7

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-19 16:21:36 -07:00
John Bowler
3e46c31961 Coverity bug fix: dead code
Also fix the previous fix attempt; the intent was to limit the calls to crc32 to
ZLIB_IO_MAX, although it is not clear that this is optimal.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-19 16:19:18 -07:00
Glenn Randers-Pehrson
714515bc0c [libpng17] Improved description of filler-byte bug fix in CHANGES and ANNOUNCE. 2015-09-18 23:39:51 -05:00
John Bowler
38647d4b21 [libpng17] Fixed makepng.c so that it compiles with GCC 5.1.0.
Added contrib/testspngs/: a directory for additional test png files
2015-09-18 16:36:57 -05:00
John Bowler
f8d3e854cb Coverity related changes
These should fix most of the reported Coverity issues.  The remaining issues
should be the back_b etc assignments, which look like a Coverity bug, and
passing a pointer to a byte to a function that expects a pointer to one or more
bytes, which should (I believe) be fixed in one case and not the other
(next_filter) case; the latter case will probably go away as I am going to
rewrite that piece of code to avoid a spurious buffer allocation.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-17 22:04:30 -05:00
Glenn Randers-Pehrson
d280c3a6da [libpng17] Updated CHANGES and ANNOUNCE 2015-09-17 07:34:38 -05:00
John Bowler
62dff2f97e Merge branch 'libpng17' of /home/jbowler/src/libpng/libpng into libpng17 2015-09-16 21:42:04 -07:00
John Bowler
fea86b1c29 Remove memcpy of png_transform_background
Replaced by a structure copy which is safer since it doesn't depend on knowing
the first member to be copied, also the copies are improved to copy the
transform args too; not required at present but it may prevent a bug being
introduced in the future.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-16 21:33:43 -07:00
John Bowler
601ae5387e [libpng17] correct low-depth-gray code and enable tests
The low-bit-depth gray tests were disabled in prior versions of libpng because
of problems which should have been fixed by the recent changes to libpng17,
enabling the tests reveals bugs in those changes which are fixed by this commit.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-16 21:09:10 -07:00
Glenn Randers-Pehrson
36ada4acae [libpng17] Add pngchunk.h to contrib/pngminim makefiles. 2015-09-16 11:09:25 -05:00
Glenn Randers-Pehrson
bfc7affa0d [libpng17] Imported from libpng-1.7.0beta65.tar 2015-09-16 10:19:29 -05:00
Glenn Randers-Pehrson
dba870122c [libpng17] Updated makefiles to handle pngchunk.h 2015-09-16 08:34:56 -05:00
Glenn Randers-Pehrson
35abfe72d6 [libpng17] Fix debug statement in pngread.c 2015-09-15 23:54:55 -05:00
Glenn Randers-Pehrson
497ff3400c [libpng17] moved scripts/chunkdesc.h to pngchunk.h 2015-09-15 23:53:49 -05:00
Glenn Randers-Pehrson
bb4e79c947 [libpng17] Updated configure.ac was omitted from previous commit 2015-09-15 19:53:08 -05:00
Glenn Randers-Pehrson
b00bb570f8 [libpng17] Fix file permission for contrib/tools/intgamma.sh 2015-09-15 18:35:26 -05:00
Glenn Randers-Pehrson
c68de14844 [libpng17] Merge contrib/libtests and contrib/tools with libpng16. 2015-09-15 17:11:43 -05:00
Glenn Randers-Pehrson
cc7fa5e23f [libpng17] Added public domain declaration to contrib/libtests/fakepng.c 2015-09-15 15:21:12 -05:00
John Bowler
ec99b373dd Merge 3184947a25b78dee14b0dda09f368ab3f6107c8f into 1fc5345bff82118fd6f3138138805083e66656ca 2015-09-15 03:52:31 +00:00
John Bowler
3184947a25 chunk handling and transform rewrite
This implements a new chunk parse implementation that can be shared, it
is currently shared by the progressive reader and the sequential one
(not, yet, the writer).

The patch also implements shared transform handling that is used
throughout.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-14 20:42:40 -07:00
John Bowler
c5ead5d2cd Test changes
Most of these are back-portable to earlier versions (contrib/libtests
should just work with earlier versions), however the 1.7 specific
changes in pngvalid mean that it probably won't work against 1.7 without
the commits following this one.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-14 17:57:40 -07:00
John Bowler
76c5c11168 Test corrections: minor fixes to the test scripts
pngimage: add --list-combos
pngunknown: add --strict to catch warnings
pngvalid-standard: remove the spurious --progressive read (compare with
pngvalid-progressive-standard!)
This patch probably applies to 1.5 and 1.6 (where the tests exist) too.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-14 17:51:06 -07:00
John Bowler
ddcca52933 ARM NEON code moved to contrib
This patch contains changes to the build (configure) system and the code
required to support the move.  The patch is provided to isolate the
changes from the others that follow it; the code won't necessarily
compile after this patch (the next changes are required.)

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-14 17:31:51 -07:00
John Bowler
3bd90db79f Rename arm -> contrib/neon
libpng will not compile if ARM NEON support is enabled with this commit;
the commit is provided to isolate the rename of the directory from the
rest of the required changes.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-14 17:18:50 -07:00
Glenn Randers-Pehrson
1fc5345bff [libpng17] Mention dropping support for 16-bit platforms in libpng16.
Update some comments, fix example.c usage of png_set_sig_bytes().
2015-08-18 10:45:16 -05:00
Glenn Randers-Pehrson
81b1cff052 [libpng17] Fix links in man page 2015-08-11 15:35:17 -05:00
Glenn Randers-Pehrson
bc1d2b7d23 [libpng17] Fix links in man page 2015-08-11 13:04:50 -05:00
Glenn Randers-Pehrson
a16d1ef27a [libpng17] Update dead link in the man page 2015-08-11 12:16:36 -05:00
Glenn Randers-Pehrson
4b9fe200db [libpng17 Moved config.h.in~ from the "libpng_autotools_files" list to the
"libpng_autotools_extra" list in autogen.sh because it was causing a
false positive for missing files (bug report by Robert C. Seacord).
2015-08-02 21:52:21 -05:00
Glenn Randers-Pehrson
223aed9f90 [libpng17 Use nanosleep() instead of usleep() in contrib/gregbook/rpng2-x.c
because usleep() is deprecated (port from libpng16).
Fixed potential leak of png_pixels in contrib/pngminus/pnm2png.c
Fixed uninitialized variable in contrib/gregbook/rpng2-x.c
2015-07-30 11:41:47 -05:00
Glenn Randers-Pehrson
064ededa0f [libpng17] Bump version to 1.7.0beta65 2015-07-25 21:24:46 -05:00
Glenn Randers-Pehrson
92d7dd1ede [libpng17] Imported from libpng-1.7.0beta64.tar 2015-07-25 21:17:14 -05:00
Glenn Randers-Pehrson
1b3d312513 [libpng17] Belatedly added Mans Rullgard and James Yu to the list of
Contributing Authors.
2015-07-25 21:06:28 -05:00
Glenn Randers-Pehrson
47b6a93924 [libpng17] Rearranged png.h to put the major sections in the same order as
in libpng16.
2015-07-25 20:59:09 -05:00
Glenn Randers-Pehrson
e1ff1cc930 [libpng17] Revise comment about deprecated skip function in pngpread.c. 2015-06-11 21:55:19 -05:00
Glenn Randers-Pehrson
9acee8b4b2 [libpng17] Unlink temporary file immediately in pngstest (PNG_USE_MKSTEMP) 2015-06-11 16:30:44 -05:00
Glenn Randers-Pehrson
8ffa92dc25 [libpng17] Removed some unused WEIGHTED_FILTER macros from png.h and pngstruct.h 2015-06-10 07:02:36 -05:00
Glenn Randers-Pehrson
24382d838c [libpng17] Eliminated the final two Coverity defects (insecure temporary file
handling in contrib/libtests/pngstest.c; possible overflow of
unsigned char in contrib/tools/png-fix-itxt.c). To use the "secure"
file handling, define PNG_USE_MKSTEMP, otherwise "tmpfile()" will
be used.
2015-06-10 06:59:18 -05:00
John Bowler
9307eef199 [libpng17] Removed non-working progressive reader 'skip' function. This
function has apparently never been used. It was implemented
to support back-door modification of png_struct in libpng-1.4.x
but (because it does nothing and cannot do anything) was apparently
never tested (John Bowler).
2015-06-06 20:14:38 -05:00
Glenn Randers-Pehrson
3d1fec50e8 [libpng17] Bump version to 1.7.0beta64 2015-06-06 17:02:10 -05:00
Glenn Randers-Pehrson
0781bc4905 [libpng17] Imported from libpng-1.7.0beta63.tar 2015-06-06 16:30:46 -05:00
Glenn Randers-Pehrson
188962a93b [libpng17] Added #ifdef's to contrib/examples programs so people don't try
to compile them without the minimum required support enabled
(suggested by Flavio Medeiros).
2015-06-05 21:26:31 -05:00
John Bowler
e55c190818 [libpng17] Completed AArch64 support. Previous change to recognize __ARM_NEON
didn't touch all the required preprocessor lines. This change removes
support for __ARM_NEON__ completely and makes this consistent.
2015-06-04 21:55:35 -05:00
John Bowler
1a9eb510eb [libpng17] Moved READ_GAMMA to pngrtran.c. This makes everything in pngrtrans.c
depend on READ_TRANSFORMS and moves all the transform gamma (READ_GAMMA)
code from elsewhere to png_tran.c.  There are no code changes.
There is one remaining use of the gamma (16-bit) code in the simplified
API in pngread.c but that is because of a long-standing libpng bug,
namely that the gamma corrected palette is no produced by
png_read_update_info (John Bowler).
2015-06-04 21:49:54 -05:00
Glenn Randers-Pehrson
77476d3c37 [libpng16] Quieted Coverity issues in pngfix.c, png-fix-itxt.c, pngvalid.c,
pngstest.c, and pngimage.c. Most seem harmless, but png-fix-itxt
would only work with iTXt chunks with length 255 or less.

Fixed cexcept.h in which GCC 5 reported that one of the auto
variables in the Try macro needs to be volatile to prevent value
being lost over the setjmp, and fixed g++ build breaks (John Bowler).
2015-06-03 22:52:33 -05:00
Glenn Randers-Pehrson
a671f8baea [libpng17] Quieted Coverity issues in pngfix.c, png-fix-itxt.c, pngvalid.c,
pngstest.c, and pngimage.c. Most seem harmless, but png-fix-itxt
would only work with iTXt chunks with length 255 or less.
2015-06-03 16:21:57 -05:00
Glenn Randers-Pehrson
f32c657fc7 [libpng17] Bump version to 1.7.0beta63 2015-06-01 09:32:03 -05:00
Glenn Randers-Pehrson
381283fb5f [libpng17] Imported from libpng-1.7.0beta62.tar 2015-06-01 08:36:42 -05:00
Glenn Randers-Pehrson
3dd43ae670 [libpng17] Fix typo in CHANGES and ANNOUNCE. 2015-05-31 22:38:34 -05:00
Glenn Randers-Pehrson
13d83c6948 [libpng17] Removed WRITE_WEIGHTED_FILTERED code, to save a few kbytes of the
compiled library size. It never worked properly and as far as we can
tell, no one uses it. The png_set_filter_heuristics() and
png_set_filter_heuristics_fixed() APIs are retained but deprecated.
2015-05-31 16:22:44 -05:00
Glenn Randers-Pehrson
f19f7a6c95 [libpng17] Bump version to 1.7.0beta62 2015-05-30 23:08:34 -05:00
Glenn Randers-Pehrson
e0fea61cd8 [libpng17] Imported from libpng-1.7.0beta61.tar 2015-05-30 23:03:01 -05:00
Glenn Randers-Pehrson
689b9c58fe [libpng17] Avoid a harmless potential integer overflow in png_XYZ_from_xy(). 2015-05-20 13:18:54 -05:00
Glenn Randers-Pehrson
dc6cddd798 [libng17] Avoid Coverity issue 80858 (REVERSE NULL) in pngtest.c
PNG_DEBUG builds
2015-05-09 21:55:40 -05:00
Glenn Randers-Pehrson
5d2841d272 [libpng17] Document PNG_RELEASE_BUILD macro in the man page. 2015-05-06 20:36:12 -05:00
Glenn Randers-Pehrson
9012e3d108 [libpng17] Bump version to 1.7.0beta61 2015-05-06 16:17:19 -05:00
Glenn Randers-Pehrson
81d58f913e [libpng17] Imported from libpng-1.7.0beta60.tar 2015-05-06 15:59:29 -05:00
Glenn Randers-Pehrson
0ee7a07a85 [libpng17] merge pngpriv.h and pngset.c with libpng-1.6.18beta03. 2015-04-29 11:39:12 -05:00
Glenn Randers-Pehrson
6acc280403 [libpng17] Bump version to 1.7.0beta60 2015-04-19 06:32:37 -05:00
Glenn Randers-Pehrson
01358ecec2 [libpng17] Imported from libpng-1.7.0beta59.tar 2015-04-19 06:32:30 -05:00
Glenn Randers-Pehrson
7a35bcac1a [libpng17] Suppressed some warnings from the Borland C++ 5.5.1/5.82 compiler
(Bug report by Viktor Szaka'ts).
2015-04-04 08:45:34 -05:00
John Bowler
673ae608ab [libpng17] Transformed rewrite: changed row_info, added checks. This introduces an
internal struct (png_transform_control) to replace row_info and uses
    that to implement affirms correctly.  The change also adds checks on
    the rowbytes calculation and additional checks on most transform
    implementations.
Added png_uint_16 range checking, pngvalid tRNS, fixed png_uint_16:
    review of previous checks, removal of some where SAFE. pngvalid: add
    testing of tRNS for better code coverage pngvalid: correct rgb-to-gray
    error calculations. Code coverage is still incomplete: see /*UNTESTED*/
    in pngrtran.c
2015-03-30 21:32:41 -05:00
Glenn Randers-Pehrson
73ea393ab2 [libpng17] Bump version to 1.7.0beta59 2015-03-25 08:26:11 -05:00
Glenn Randers-Pehrson
dff4a834ce [libpng17] Imported from libpng-1.7.0beta58.tar 2015-03-25 08:26:02 -05:00
Glenn Randers-Pehrson
ad817b9b2b [libpng17] Revised comment about PNG_RELEASE_BUILD in pngpriv.h, to say
Use -DPNG_RELEASE_BUILD in CFLAGS or "#define PNG_RELEASE_BUILD 1" in
pngusr.h to turn on the release compile path.
2015-03-23 11:11:08 -05:00
Glenn Randers-Pehrson
218b2d7c70 [libpng17] Comment that PNG_RELEASE_BUILD has to be 0 or 1; illustrate
usage in contrib/pngminim/*/pngusr.h
2015-03-23 10:02:56 -05:00
Glenn Randers-Pehrson
67890a19f3 [libpng17] Committed pngvalid.c omitted from previous commit; fix trivial typos 2015-03-22 21:01:48 -05:00
John Bowler
53097f5bbb [libpng17] Check (png_uint_16) casts for overflow. Also removed png_muldiv_warn,
added RELEASE/!RELEASE convenience macros. png_muldiv_warn was used in
only one place, and the overflow condition is a genuine warning not
an internal error.  Four macros allow code or function parameters to be
condition on RELEASE (or not) builds and tidy up the #ifdef handling of
functions.
2015-03-22 20:26:13 -05:00
John Bowler
36562c1032 [libpng17] Improved some overflow handling. PNG_RELEASE_BUILD replaces tests
where the code depended on the build base type and can be defined on
the command line, allowing testing in beta builds.  Overflows previously
handled by png_warning in png.c have been changed to use new
macros/affirm functions so that beta builds will abort on overflow and
release builds will quietly ignore it.  This avoids release builds
producing warnings that are of no use to end users.
2015-03-22 16:05:56 -05:00
John Bowler
82fa6aed0e [libpng17] Added byte, short and other overflow checking
Added 'assert' based overflow checking for debug builds for char
and short assignments. Simply ignore the error in release builds
(a truncated value will be used without warning). Controlled by
PNG_RANGE_CHECK_SUPPORTED.
2015-03-22 15:57:53 -05:00
Glenn Randers-Pehrson
382de60042 [libpng17] Document affirm() and impossible() in the manual page. 2015-03-21 21:46:00 -05:00
Glenn Randers-Pehrson
06963c7841 [libpng16] Renamed "assert" to "affirm", not affected by NDEBUG. 2015-03-21 21:33:42 -05:00
Glenn Randers-Pehrson
9f2fb72c67 [libpng16] Made assert (and impossible) removeable by defining NDEBUG. 2015-03-21 16:04:23 -05:00
Glenn Randers-Pehrson
10ea5caef2 [libpng17] Remove pnglibconf.dfn and pnglibconf.pre with "make clean". 2015-03-21 15:57:21 -05:00
John Bowler
2460d9494d [libpng17] Implemented assert support and usage. 2015-03-20 16:39:56 -05:00
Glenn Randers-Pehrson
e8e7b6681e [libpng17] Restore missing ")" in pngerror.c 2015-03-18 14:34:47 -05:00
Glenn Randers-Pehrson
033dd3f20a [libpng17] Bump version to 1.7.0beta58 2015-03-17 08:13:42 -05:00
Glenn Randers-Pehrson
341e23c009 [libpng17] Imported from libpng-1.7.0beta57.tar 2015-03-17 08:00:27 -05:00
John Bowler
e4521a073c [libpng17] Revert change to png_default_read_data() made in libpng-1.7.0beta55. 2015-03-16 19:41:43 -05:00
Glenn Randers-Pehrson
5ff2d472e8 [libpng17] Also remove pnglibconf.c and pnglibconf.out 2015-03-15 16:55:42 -05:00
Cosmin Truta
f8eeac2b11 [libpng17] Remove pnglibconf.h, not pnglibconf.* in "make clean" (Cosmin). 2015-03-15 16:27:11 -05:00
Glenn Randers-Pehrson
e57ab4311b [libpng17] Bump version to 1.7.0beta57 2015-03-11 18:14:01 -05:00
Glenn Randers-Pehrson
9015c44736 [libpng17] Imported from libpng-1.7.0beta56.tar 2015-03-11 17:50:01 -05:00
Glenn Randers-Pehrson
1d7f037627 [libpng17] Updated CMakeLists.txt to add OSX framework, change YES/NO to ON/OFF
for consistency (Alexey Petruchik).
2015-03-11 11:37:59 -05:00
Glenn Randers-Pehrson
c4c28d7251 [libpng17] Bump version to 1.7.0beta56 2015-03-09 09:28:06 -05:00
Glenn Randers-Pehrson
0fba15c567 [libpng17] Imported from libpng-1.7.0beta55.tar 2015-03-09 09:16:18 -05:00
Glenn Randers-Pehrson
c062330846 [libpng16] Free the unknown_chunks structure even when it contains no data. 2015-03-09 09:05:39 -05:00
Glenn Randers-Pehrson
0448d90f01 [libpng17] Merged png_free_data() with libpng-1.6.17rc02. 2015-03-09 09:04:02 -05:00
Glenn Randers-Pehrson
127bede89c [libpng17] Reverted incorrect test on unknown chunk location. 2015-03-08 08:15:19 -05:00
Glenn Randers-Pehrson
3e4bd8c261 [libpng17] Spelling fixes ("then", "occured") reported by Lauri Nurmi. 2015-03-07 14:00:13 -06:00
Glenn Randers-Pehrson
cc085343ec [libpng17] Stopped a potential memory leak in png_set_unknown_chunks(). Breaks
tests/pngunknown-sAPI so it's temporarily marked SKIP.
2015-03-07 12:24:35 -06:00
Glenn Randers-Pehrson
ea0197a3e3 [libpng17] Removed some comments that the configure script did not handle
properly from scripts/pnglibconf.dfa and pnglibconf.h.prebuilt.
2015-03-05 21:20:32 -06:00
Glenn Randers-Pehrson
c2f0c9683f [libpng17] Work in progress, merging with libpng-1.6.17rc01. 2015-03-04 14:24:54 -06:00
Glenn Randers-Pehrson
79a332afd0 [libpng17] Bump version to 1.7.0beta55 2015-03-04 11:25:05 -06:00
Glenn Randers-Pehrson
352e2fe4c7 [libpng17] Imported from libpng-1.7.0beta54.tar 2015-03-04 11:19:43 -06:00
Glenn Randers-Pehrson
3077b5e049 [libpng17] Merged pngwrite.c with libpng-1.6.17beta06/pngwrite.c 2015-03-04 08:50:20 -06:00
Sergey Kosarevsky
98043c79a2 [libpng17] Avoid runtime checks when converting integer to png_byte with
Visual Studio (Sergey Kosarevsky)
2015-02-27 19:22:27 -06:00
Glenn Randers-Pehrson
2bf96d75ec [libpng17] Fixed some typos in the pngfix usage message. 2015-02-26 10:35:25 -06:00
Glenn Randers-Pehrson
678020ae18 [libpng17] Bump version to 1.7.0beta54 2015-02-25 15:42:29 -06:00
Glenn Randers-Pehrson
58e69e45ff [libpng17] Imported from libpng-1.7.0beta53.tar 2015-02-25 15:17:50 -06:00
Glenn Randers-Pehrson
7b51b8c13b [libng17] Put #ifdef/#endif around png_set_compression_level in pngwrite.c 2015-02-22 19:37:34 -06:00
Glenn Randers-Pehrson
5f7e71fa78 [libpng17] Restored compiling of png_reciprocal2 with PNG_NO_16BIT. 2015-02-22 16:42:54 -06:00
Glenn Randers-Pehrson
0cd3d25ae8 [libpng17] Bump version to 1.7.0beta53 2015-02-21 12:50:08 -06:00
Glenn Randers-Pehrson
83a2959908 [libpng17] Imported from libpng-1.7.0beta52.tar 2015-02-21 12:49:54 -06:00
Glenn Randers-Pehrson
ab2ef2ceb1 [libpng17] Minor editing of man page 2015-02-18 12:22:13 -06:00
Glenn Randers-Pehrson
f0341bae80 [libpng17] Corrected information recently added to the man page about row
pointer usage.
2015-02-17 21:29:22 -06:00
Glenn Randers-Pehrson
ed3543679a [libpng17] Added information about setjmp/simplified API interaction in the
manual page and INSTALL file. Added information about using
row_pointers with a single height*width*bpp allocated block
2015-02-17 20:15:21 -06:00
Glenn Randers-Pehrson
9c7aee825c [libpng17] Bump version to 1.7.0beta52 2015-02-17 10:52:59 -06:00
Glenn Randers-Pehrson
d8055d7123 [libpng17] Imported from libpng-1.7.0beta51.tar 2015-02-17 10:52:45 -06:00
Glenn Randers-Pehrson
92ef42d5e1 [libpng17] Display user limits in the output from pngtest. 2015-02-16 22:46:16 -06:00
Glenn Randers-Pehrson
1d3a1e36a7 [libpng17] Revised overflow detection in pngwutil.c 2015-02-16 22:43:52 -06:00
Glenn Randers-Pehrson
d368235da4 [libpng17] Bump version to 1.7.0beta51 2015-02-15 14:27:48 -06:00
Glenn Randers-Pehrson
06b0c83920 [libpng17] Imported from libpng-1.7.0beta50.tar 2015-02-15 13:20:53 -06:00
Glenn Randers-Pehrson
2130a3cd20 [libpng17] Combined several redundant lines of code in pngwutil.c 2015-02-15 13:18:50 -06:00
Glenn Randers-Pehrson
f1e4acb5b1 [libpng17] Combined sub_row, up_row, avg_row, and paeth_row buffers into a
single try_row buffer and in cases where two or more of those are
being tested, a second tst_row buffer.  This improves CPU speed
over that achieved by libpng-1.7.0beta49.
2015-02-15 12:44:16 -06:00
Glenn Randers-Pehrson
7e56f5858d [libpng17] Bump version to 1.7.0beta50 2015-02-11 07:25:31 -06:00
Glenn Randers-Pehrson
82fca45d27 [libpng17] Imported from libpng-1.7.0beta49.tar 2015-02-11 07:25:24 -06:00
Glenn Randers-Pehrson
f55ee011a2 [libpng17] Make some parameters "const" in new functions. 2015-02-11 06:18:30 -06:00
Glenn Randers-Pehrson
9c9009ec7d [libpng17] Deal with integer overflow of sum in pngwutil.c 2015-02-11 06:09:54 -06:00
Glenn Randers-Pehrson
01d91b4370 [libpng17] Consolidated redundant code in pngwutil.c 2015-02-10 22:49:31 -06:00
Glenn Randers-Pehrson
1fd10de101 [libpng17] Removed now-obsolete comments. 2015-02-10 19:55:20 -06:00
Glenn Randers-Pehrson
9149259041 [libpng17] Added PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED macro, on by default. 2015-02-10 17:09:48 -06:00
Glenn Randers-Pehrson
8bc832389a [libpng17] Combined sub_row, up_row, avg_row, and paeth_row buffers into a
single try_row buffer.
2015-02-10 17:03:27 -06:00
Glenn Randers-Pehrson
ba22b208ed [libpng17] Bump version to 1.7.0beta49 2015-02-07 09:16:28 -06:00
Glenn Randers-Pehrson
0f6d60e672 [libpng17] Imported from libpng-1.7.0beta48.tar 2015-02-07 09:07:19 -06:00
Glenn Randers-Pehrson
6ce2d220b4 [lipng17] Do not build png_product2() when it is unused and work around
one more Coverity-scan dead-code warning.
2015-02-07 08:54:07 -06:00
Glenn Randers-Pehrson
d7312be749 [libpng17] Improved the comments on some #ifdef lines. 2015-02-03 19:11:50 -06:00
Glenn Randers-Pehrson
125eac0ee4 [libpng17] Bump version to 1.7.0beta48 2015-01-28 19:30:45 -06:00
Glenn Randers-Pehrson
ab95226db8 [libpng17] Imported from libpng-1.7.0beta47.tar 2015-01-28 19:25:43 -06:00
Glenn Randers-Pehrson
3043819fb2 [libpng17] Quieted some Coverity warnings 2015-01-27 15:54:37 -06:00
Glenn Randers-Pehrson
565e1bc1ae [libpng17] Added #ifndef __COVERITY__ where needed in png.c, pngrutil.c and
pngset.c to avoid warnings about dead code.
2015-01-27 07:00:59 -06:00
Glenn Randers-Pehrson
5bdcb914a4 [libpng17] Updated CHANGES and ANNOUNCE 2015-01-13 09:05:53 -06:00
Glenn Randers-Pehrson
e8213aa68f [libpng17] Add recent CVE numbers to CHANGES and ANNOUNCE. 2015-01-10 19:12:46 -06:00
Glenn Randers-Pehrson
d4ac328617 [libpng17] Quiet a GCC compiler warning about sample_max in pngset.c 2015-01-09 13:10:14 -06:00
Glenn Randers-Pehrson
56e6741b25 [libpng17] Made the check for out-of-range values in png_set_tRNS() work on
16-bit platforms.
2015-01-07 18:59:10 -06:00
Glenn Randers-Pehrson
3e04e189d8 [libpng17] Bump version to 1.7.0beta47 2015-01-02 09:23:24 -06:00
Glenn Randers-Pehrson
eb67f8bcb1 [libpng17] Imported from libpng-1.7.0beta46.tar 2015-01-02 09:18:28 -06:00
Glenn Randers-Pehrson
9c078fb7d2 [libpng17] Allow calling png_get_IHDR() with NULL arguments (Reuben Hawkins). 2015-01-02 08:23:24 -06:00
Glenn Randers-Pehrson
ae31a1ebdb [libpng17] Happy 2014, continued. 2014-12-31 19:08:04 -06:00
Glenn Randers-Pehrson
b1d49de5bc [libpng17] Happy New Year -- update copyright year. 2014-12-31 18:43:44 -06:00
John Bowler
d7e9c1c584 [libpng17] Fixed byte order in 2-byte filler, in png_do_read_filler(). 2014-12-29 16:06:32 -06:00
John Bowler
28451a8797 [libpng17] Implement previously untested libpng transforms in pngvalid.c 2014-12-29 14:18:50 -06:00
Glenn Randers-Pehrson
e6eb1d6fda [libpng17] Bump version to 1.7.0beta46 2014-12-28 13:30:20 -06:00
Glenn Randers-Pehrson
82dd5d3575 [libpng17] Imported from libpng-1.7.0beta45.tar 2014-12-28 13:30:06 -06:00
John Bowler
a5b6764cea [libpng17] Added testing of png_set_packing() to pngvalid.c 2014-12-27 19:11:41 -06:00
John Bowler
56850aba35 [libpng17] Removed user limits from pngfix. Also pass NULL pointers to
png_read_row to skip the unnecessary row de-interlace stuff.
2014-12-24 17:45:38 -06:00
Glenn Randers-Pehrson
13f025c29a [libpng17] Restored the old 1-million default limit on rows and columns 2014-12-24 08:28:30 -06:00
Glenn Randers-Pehrson
d92b0f23e6 [libpng17] Updated comments and manual with elimination of PNG_SAFE_LIMITS 2014-12-23 22:43:57 -06:00
Glenn Randers-Pehrson
eeab1cfefc [libpng17] Eliminated the PNG_SAFE_LIMITS macro and set default limits in
pnglibconf.dfa, that can be reset by the user at build time or run time.
This provides a more robust defense against DOS and as-yet undiscovered
overflows.
2014-12-23 22:13:40 -06:00
Glenn Randers-Pehrson
38d22ef928 [libpng17] Bump version to 1.7.0beta45 2014-12-23 14:15:30 -06:00
Glenn Randers-Pehrson
ab1ad88ecc [libpng17] Imported from libpng-1.7.0beta44.tar 2014-12-23 14:15:23 -06:00
Glenn Randers-Pehrson
caa59e0007 [libpng17] Removed extraneous PNG_SAFE_LIMITS_SUPPORTED handling from pngconf.h 2014-12-23 14:13:35 -06:00
John Bowler
310ffb25f8 [libpng17] Corrected the width limit calculation in png_check_IHDR(). 2014-12-21 19:33:02 -06:00
John Bowler
c026b07529 [libpng17] Restored a test on width that was removed from png.c at libpng-1.6.9
(Bug report by Alex Eubanks).
Fixed an overflow in png_combine_row with very wide interlaced images.
2014-12-21 18:42:37 -06:00
Glenn Randers-Pehrson
6988b31244 [libpng17] Bump version to 1.7.0beta44 2014-12-18 09:00:26 -06:00
Glenn Randers-Pehrson
b23a10f565 [libpng17] Imported from libpng-1.7.0beta43.tar 2014-12-18 09:00:17 -06:00
John Bowler
201e9144a6 [libpng17] Quiet a "comparison always true" warning in pngstest.c (John Bowler). 2014-12-16 19:16:18 -06:00
Glenn Randers-Pehrson
ba8495bba9 [libpng17] Revised Makefile.am and scripts/*.dfn to work with MinGW/MSYS;
renamed scripts/*.dfn to scripts/*.c (Bob Friesenhahn and John Bowler).
2014-12-14 22:14:48 -06:00
Glenn Randers-Pehrson
3393042627 [libpng17] Update arm/*.c to libpng coding style. 2014-11-29 17:10:55 -06:00
Glenn Randers-Pehrson
a072dfee8e [libpng17] Added ".align 2" to arm/filter_neon.S to support old GAS assemblers
that don't do alignment correctly.
2014-11-29 16:25:15 -06:00
Glenn Randers-Pehrson
e39e182357 [libpng17] Bump version to 1.7.0beta43 2014-11-21 08:25:41 -06:00
Glenn Randers-Pehrson
ab71e135e7 [libpng17] Imported from libpng-1.7.0beta42.tar 2014-11-20 10:23:06 -06:00
Glenn Randers-Pehrson
1b577e9bc6 [libpng17] Merged clang no-warning fix from libpng-1.6.13: png_digit was defined
but never used in pngerror.c.
2014-11-17 13:46:27 -06:00
Cosmin Truta
238fdc197d [libpng17] Added "-D_CRT_SECURE_NO_WARNINGS" to CFLAGS in
scripts/makefile.vcwin32.
Removed the obsolete $ARCH variable from scripts/makefile.darwin.
2014-11-16 19:59:24 -06:00
Cosmin Truta
8cfee5fa78 [libpng17] The macros passed in the command line to Borland make were ignored if
similarly-named macros were already defined in makefiles. This behavior
is different from POSIX make and other make programs.  Surround the
macro definitions with ifndef guards (Cosmin).
2014-11-14 09:56:33 -06:00
Glenn Randers-Pehrson
44a9af81b0 [libpng17] Bump version to 1.7.0beta42 2014-11-07 07:58:35 -06:00
Glenn Randers-Pehrson
755f92fc41 [libpng17] Imported from libpng-1.7.0beta41.tar 2014-11-07 07:58:23 -06:00
Glenn Randers-Pehrson
d9d1c997d8 [libpng17] More "#endif" housecleaning, in *.h 2014-11-07 07:39:41 -06:00
Glenn Randers-Pehrson
aeb4a22975 [libpng17] Changed "#endif /* PNG_FEATURE_SUPPORTED */" to "#endif /* FEATURE */" 2014-11-06 23:09:14 -06:00
Glenn Randers-Pehrson
9c0b5ab848 [libpng17] Removed #ifdef PNG_16BIT_SUPPORTED/#endif around png_product2(); it is
needed by png_reciprocal2().
Added #ifdef PNG_16BIT_SUPPORTED/#endif around png_log16bit() and
    png_do_swap().
2014-11-06 21:14:16 -06:00
Glenn Randers-Pehrson
05dcaffd38 [libpng17] Bump version to 1.7.0beta41 2014-11-05 19:07:47 -06:00
Glenn Randers-Pehrson
cca25b182f [libpng17] Imported from libpng-1.7.0beta40.tar 2014-11-05 19:07:37 -06:00
John Bowler
f87df31c8c [libpng17] Fixed GCC unsigned int->float warnings. Various versions of GCC
seem to generate warnings when an unsigned value is implicitly
    converted to double. This is probably a GCC bug but this change
    avoids the issue by explicitly converting to (int) where safe.
  Free all allocated memory in pngimage. The file buffer cache was left
    allocated at the end of the program, harmless but it causes memory
    leak reports from clang.
  Fixed array size calculations to avoid warnings. At various points
    in the code the number of elements in an array is calculated using
    sizeof.  This generates a compile time constant of type (size_t) which
    is then typically assigned to an (unsigned int) or (int). Some versions
    of GCC on 64-bit systems warn about the apparent narrowing, even though
    the same compiler does apparently generate the correct, in-range,
    numeric constant.  This adds appropriate, safe, casts to make the
    warnings go away.
2014-11-05 18:53:01 -06:00
Glenn Randers-Pehrson
41547820e8 [libpng17] Simplified and future-proofed png_user_version_check(). 2014-11-05 15:08:31 -06:00
Glenn Randers-Pehrson
e5d462d829 [libpng17] Made a one-line revision to configure.ac to support ARM on aarch64
(bug report by Marcin Juszkiewicz, fix by John Bowler).
2014-11-04 08:43:34 -06:00
Glenn Randers-Pehrson
6f46730cb7 [libpng17] Bump version to 1.7.0beta40 2014-11-01 18:58:59 -05:00
Glenn Randers-Pehrson
67b88b8ee0 [libpng17] Imported from libpng-1.7.0beta39.tar 2014-11-01 18:58:47 -05:00
Glenn Randers-Pehrson
7a4bfbdec1 [libpng17] Ported cosmetic changes from libpng-1.6.15beta02. 2014-11-01 13:57:38 -05:00
Glenn Randers-Pehrson
859254054a [libpng17] Merge pngtest.c with libpng-1.6.15beta01 2014-10-28 10:29:44 -05:00
Glenn Randers-Pehrson
515659d638 [libpng17] Changed "if (!x)" to "if (x == 0)" and "if (x)" to "if (x !== 0)" 2014-10-25 19:30:02 -05:00
Glenn Randers-Pehrson
fd409c8019 [libpng17] Revised INSTALL document. 2014-10-24 22:33:51 -05:00
Glenn Randers-Pehrson
9ee6678e1f [libpng17] Bump version to 1.7.0beta39 2014-10-17 10:02:01 -05:00
Glenn Randers-Pehrson
9b36280e31 [libpng17] Imported from libpng-1.7.0beta38.tar 2014-10-17 09:57:47 -05:00
Glenn Randers-Pehrson
eaad9f9177 [libpng17] Minor editing of README and comments in example.c and pngtest.c. 2014-10-17 09:55:43 -05:00
Glenn Randers-Pehrson
70cd1a10f2 [libpng17] Also don't mark text chunks as written in the end_ptr until written. 2014-10-05 18:04:25 -05:00
Glenn Randers-Pehrson
7974d60f54 [libpng17] Merge with libpng-1.6.14beta07
Removed "option READ_COMPRESSED_TEXT enables READ_TEXT" from pnglibconf.dfa,
  to make it possible to configure a libpng that supports iCCP but not TEXT.
Removed "option WRITE_COMPRESSED_TEXT enables WRITE_TEXT" from pnglibconf.dfa
Only mark text chunks as written after successfully writing them.
2014-10-05 16:25:17 -05:00
Glenn Randers-Pehrson
c7e743d385 [libpng17] Merge recent changes from libpng-1.6.14beta06:
Added "option READ_iCCP enables READ_COMPRESSED_TEXT" to pnglibconf.dfa
Removed unused "text_len" parameter from private function png_write_zTXt().
Conditionally compile some code in png_deflate_claim(), when
  PNG_WARNINGS_SUPPORTED and PNG_ERROR_TEXT_SUPPORTED are disabled.
Replaced repeated code in pngpread.c with PNG_PUSH_SAVE_BUFFER_IF_FULL.
Added "chunk iTXt enables TEXT" and "chunk zTXt enables TEXT"
  to pnglibconf.dfa.
Edit and fix typos in comments.
2014-10-04 12:41:26 -05:00
Glenn Randers-Pehrson
b2e89f1af6 [libpng17] Bump version to libpng-1.7.0beta38.tar 2014-09-28 13:36:54 -05:00
Glenn Randers-Pehrson
ad30a1262b [libpng17] Imported from libpng-1.7.0beta37.tar 2014-09-28 13:33:11 -05:00
Glenn Randers-Pehrson
35f88c1341 [libpng17] Merged scripts/* with libpng-1.6.14beta04. 2014-09-28 12:49:42 -05:00
Glenn Randers-Pehrson
4f8050416f [libpng17] Merge pngvalid.c and pngfix.c with libpng-1.6.14beta04 2014-09-28 10:37:26 -05:00
Glenn Randers-Pehrson
776d1768aa [libpng17] Merge pngvalid.c with libpng-1.6.14beta04. 2014-09-27 19:30:35 -05:00
Glenn Randers-Pehrson
d7078c52e2 [libpng17] Bump version to 1.7.0beta37 2014-09-27 19:00:32 -05:00
Glenn Randers-Pehrson
4a67ac3f1e [libpng17] Imported from libpng-1.7.0beta36.tar 2014-09-27 18:52:47 -05:00
Glenn Randers-Pehrson
2799bf9a4f [libpng17] Merge recent changes to the manual and pngrutil.c from libpng-1.6.14beta04. 2014-09-27 18:49:42 -05:00
Glenn Randers-Pehrson
34e49ae1bc [libpng17] Updated scripts/makefiles from libpng-1.6.13beta04. 2014-08-08 09:30:23 -05:00
Glenn Randers-Pehrson
cea01951da [libpng17] Bump version to 1.7.0beta36 2014-08-06 09:10:16 -05:00
Glenn Randers-Pehrson
1a9c06b11a [libpng17] Imported from libpng-1.7.0beta35.tar 2014-08-06 09:10:02 -05:00
Glenn Randers-Pehrson
f3b1eb68a6 [libpng17] Added some CVE numbers to the January 2013 CHANGES and ANNOUNCE files 2014-04-10 16:40:40 -05:00
Glenn Randers-Pehrson
12845bc947 [libpng17] Fixed a typo in pngrutil.c, introduced in libpng-1.5.6, that
interferes with "blocky" expansion of sub-8-bit interlaced PNG files
(Eric Huss).
2014-04-06 09:40:04 -05:00
Glenn Randers-Pehrson
3ac960f128 [libpng17] Fixed syntax of Copy command in makefile.amiga 2014-03-22 18:35:25 -05:00
Glenn Randers-Pehrson
eb2b0248e2 [libpng17] Complete the update of scripts/makefile.ne12bsd. 2014-03-22 13:47:31 -05:00
Cosmin Truta
e529698d38 [libpng17] Allow an easy replacement of the default pre-built configuration
header with a custom header, via the make PNGLIBCONF_H_PREBUILT macro.
2014-03-22 13:08:31 -05:00
Cosmin Truta
1a9e897289 [libpng17] Port recent changes from libpng16 branch:
Silence 'unused parameter' build warnings (Cosmin).
  $(CP) is now used alongside $(RM_F).  Also, use 'copy' instead
    of 'cp' where applicable, and applied other minor makefile changes.
  Don't warn about invalid dimensions exceeding user limits.
2014-03-22 11:09:18 -05:00
Glenn Randers-Pehrson
3a81956ffe [libpng17] Mention scripts/pnglibconf.h.prebuilt in INSTALL. 2014-03-21 12:47:04 -05:00
Glenn Randers-Pehrson
0acf4f9770 [libpng17] Bump version to 1.7.0beta35 2014-03-17 13:21:10 -05:00
Glenn Randers-Pehrson
b407af6503 [libpng17] Imported from libpng-1.7.0beta34.tar 2014-03-17 13:19:20 -05:00
Glenn Randers-Pehrson
0fb41f05df [libpng17] Moved configuration information from the manual to the INSTALL
file.
2014-03-16 21:45:07 -05:00
Glenn Randers-Pehrson
8ebdaa0700 [libpng17] Changed ZlibSrcDir from 1.2.5 to 1.2.8 in projects/vstudio. 2014-03-09 18:32:05 -05:00
Glenn Randers-Pehrson
4e61b58980 [libpng17] Use "if (value != 0)" instead of "if (value)" consistently. 2014-03-08 13:25:55 -06:00
Glenn Randers-Pehrson
88e7d62fbc [libpng17] Remove CALLOC_SUPPORTED from scripts/pnglibconf.dfa and prebuilt 2014-03-07 11:54:59 -06:00
Glenn Randers-Pehrson
43cd0a0bb5 [libpng17] Treat CRC error handling with png_set_crc_action(), instead of with
png_set_benign_errors(), which has been the case since libpng-1.6.0beta18.
2014-02-27 15:40:30 -06:00
Glenn Randers-Pehrson
1345c5bff8 [libpng17] Bump version to 1.7.0beta34 2014-02-27 09:07:25 -06:00
Glenn Randers-Pehrson
39c420834f [libpng17] Imported from libpng-1.7.0beta33.tar 2014-02-27 08:27:24 -06:00
Glenn Randers-Pehrson
f898f69f46 [libpng17] Fixed typos in the manual and in scripts/pnglibconf.dfa
(CFLAGS -> CPPFLAGS and PNG_USR_CONFIG -> PNG_USER_CONFIG).
2014-02-26 22:24:20 -06:00
Glenn Randers-Pehrson
352f43cdc6 [libpng17] Bump version to 1.7.0beta33 2014-02-26 13:24:57 -06:00
Glenn Randers-Pehrson
f99393490d [libpng17] Imported from libpng-1.7.0beta32.tar 2014-02-26 12:54:47 -06:00
Glenn Randers-Pehrson
deb920b4a7 [libpng17] Don't recognize known sRGB profiles as sRGB if they have been hacked,
but don't reject them and don't issue a copyright violation warning.
2014-02-26 11:52:00 -06:00
Glenn Randers-Pehrson
148cdac18f [libpng17] Moved some documentation from png.h to libpng.3 and libpng-manual.txt
Minor editing of contrib/arm-neon/README and contrib/examples/*.c
2014-02-26 11:50:02 -06:00
Glenn Randers-Pehrson
51ecc14a8a [libpng17] Document how to use different crc_action after reading the image
data in the sequential reader.
2014-02-23 13:36:31 -06:00
Glenn Randers-Pehrson
713a20c57d [libpng17] Added png_ptr->process_mode = PNG_READ_IDAT_MODE in
png_push_read_chunk after recognizing the IDAT chunk, which avoids an
infinite loop while reading a datastream whose first IDAT chunk is of
zero-length.
2014-02-23 10:09:57 -06:00
Glenn Randers-Pehrson
4526f546ba [libpng17] Use a user warning handler in contrib/gregbook/readpng2.c instead
of default, so warnings will be put on stderr even if libpng has CONSOLE_IO
disabled.
2014-02-23 10:08:50 -06:00
Glenn Randers-Pehrson
0c5acfa19e [libpng17] Check for __has_extension before using it in pngconf.h, to
support older Clang versions (Jeremy Sequoia).
2014-02-20 07:11:17 -06:00
Glenn Randers-Pehrson
848eeacb41 [libpng17] Check for info_ptr == NULL early in png_read_end() so we don't need
to run all the png_handle_*() and depend on them to return if info_ptr == NULL.
This improves the performance of png_read_end(png_ptr, NULL) and makes
it more robust against future programming errors.
2014-02-17 11:53:35 -06:00
John Bowler
2ced844b0e [libpng17] Deleted a now-redundant #define png_error from pngvalid.c 2014-02-16 22:51:23 -06:00
Glenn Randers-Pehrson
e2c5ed8d1d [libpng17] Removed "#define PNG_NO_WARNINGS" from contrib/pngminim/*/pngusr.h
because warnings are already turned off in the *.dfa files.
2014-02-16 15:48:58 -06:00
John Bowler
76004ce6ed [libpng17] Moved OS dependent code from arm/arm_init.c, to allow the included
implementation of the ARM NEON discovery function to be set at
build-time and provide sample implementations from the current code in the
contrib/arm-neon subdirectory. The __linux__ code has also been changed to
compile and link on Android by using /proc/cpuinfo, and the old linux code
is in contrib/arm-neon/linux-auxv.c.  The new code avoids POSIX and Linux
dependencies apart from opening /proc/cpuinfo and is C90 compliant.
2014-02-16 15:41:51 -06:00
Glenn Randers-Pehrson
258b986917 [libpng17] Moved redefines of png_error(), png_warning(), png_chunk_error(),
and png_chunk_warning() from pngpriv.h to png.h to make them visible
to libpng-calling applications.
2014-02-16 08:36:28 -06:00
Glenn Randers-Pehrson
50a09830b8 [libpng17] Bump version to 1.7.0beta32 2014-02-05 23:32:25 -06:00
Glenn Randers-Pehrson
9a3f244085 [libpng17] Imported from libpng-1.7.0beta31.tar 2014-02-05 22:46:04 -06:00
John Bowler
fb1305faeb [libpng17] Support builds with unsupported PNG_TRANSFORM_* values. All of the
PNG_TRANSFORM_* values are always defined in png.h and, because they
are used for both read and write in some cases, it is not reliable
to #if out ones that are totally unsupported. This change adds error
detection in png_read_image() and png_write_image() to do a
png_app_error() if the app requests something that cannot be done
and it adds corresponding code to pngimage.c to handle such options
by not attempting to test them.
2014-02-05 20:13:19 -06:00
Glenn Randers-Pehrson
3d7f3bbab7 [libpng17] Deleted the other instance of "c = b;" which is the one that
triggered a scan-build warning in pngrutil.c.
2014-02-05 16:54:37 -06:00
Glenn Randers-Pehrson
2d032e966d [libpng17' Restored a line, "c = b;", that was inadvertently deleted from the
PAETH filtering code from libpng-1.7.0beta24/pngrutil.c and reenabled
the pngimage tests.
2014-02-05 15:19:13 -06:00
Glenn Randers-Pehrson
8dd3784f7c [libpng17] Disabled pngimage tests temporarily. 2014-02-05 13:22:13 -06:00
Glenn Randers-Pehrson
98b9371115 [libpng17] Fixed some typos in commentary of pngimage.c 2014-02-05 13:21:41 -06:00
John Bowler
d29413a2a9 [libpng17] Do not read invalid sBIT chunks. Previously libpng only checked sBIT
values on write, so a malicious PNG writer could therefore cause
the read code to return an invalid sBIT chunk, which might lead to
application errors or crashes.  Such chunks are now skipped (with
chunk_benign_error).
2014-02-05 12:15:42 -06:00
John Bowler
dc63b03da1 [libpng17] Completed full working pngimage test program and added two test
scripts.  Fixed combination of ~alpha with shift. On read invert alpha,
processing occurred after shift processing, which causes the final values to be
outside the range that should be produced by the shift. Reversing the
order on read makes the two transforms work together correctly and mirrors
the order used on write.
2014-02-05 11:39:59 -06:00
John Bowler
cf354c2c82 [libpng17] Make png_read_png() and png_write_png() prototypes in png.h depend
upon PNG_READ_SUPPORTED and PNG_WRITE_SUPPORTED.
Removed dependence on !PNG_READ_EXPAND_SUPPORTED for calling
png_set_packing() in png_read_png().
2014-02-05 10:55:35 -06:00
Glenn Randers-Pehrson
484dad1a19 [libpng17] Bump version to 1.7.0beta31 2014-02-02 15:27:04 -06:00
Glenn Randers-Pehrson
1695471118 [libpng17] Imported from libpng-1.7.0beta30.tar 2014-02-02 15:26:55 -06:00
Glenn Randers-Pehrson
ae14dcd404 [libpng17] Updated documentation about sCAL_s support. 2014-02-01 11:14:06 -06:00
Glenn Randers-Pehrson
302c58b8cf [libpng17] Added pngimage test program for png_read_png and png_write_png.
This is a work-in-progress; no tests are run automatically at present and
the program by virtue of exhaustively testing all the transforms is
very slow.
2014-01-31 22:00:27 -06:00
Glenn Randers-Pehrson
39fee3cee1 [libpng17] Fixed a large number of instances where PNGCBAPI was omitted from
function definitions.
2014-01-31 21:55:27 -06:00
Glenn Randers-Pehrson
b7362c6738 [libpng17] Bump version to 1.7.0beta30 2014-01-30 14:52:37 -06:00
Glenn Randers-Pehrson
f2d8561fdc [libpng17] Imported from libpng-1.7.0beta29.tar 2014-01-30 14:52:28 -06:00
Glenn Randers-Pehrson
1bd81ffa21 [libpng17] Quiet an uninitialized memory warning from VS2013 in png_get_png(). 2014-01-30 14:44:07 -06:00
Glenn Randers-Pehrson
6d2b1a7dbc [libpng17] Bump version to 1.7.0beta29 2014-01-20 13:57:46 -06:00
Glenn Randers-Pehrson
5daa97c2eb [libpng17] Imported from libpng-1.7.0beta28.tar 2014-01-20 13:57:38 -06:00
Glenn Randers-Pehrson
9e441e96b9 [libpng17] Checked in clang attribute support. 2014-01-18 19:55:44 -06:00
Glenn Randers-Pehrson
a0d314ce84 [libpng17] Correct a comment in pngconf.h 2014-01-13 21:40:47 -06:00
Glenn Randers-Pehrson
b871b25997 [libpng17] Added clang attribute support (Cosmin). 2014-01-13 21:13:16 -06:00
Glenn Randers-Pehrson
d38ebc9ded [libpng17] Updated scripts/makefile.* to use CPPFLAGS (Cosmin) 2014-01-12 12:28:20 -06:00
Glenn Randers-Pehrson
995402ca6e [libpng17] Fix typo in CHANGES and ANNOUNCE 2014-01-10 12:58:47 -06:00
Glenn Randers-Pehrson
1982968dad [libpng17] Bump version to 1.7.0beta28 2014-01-10 08:11:36 -06:00
Glenn Randers-Pehrson
32cd66d619 [libpng17] Imported from libpng-1.7.0beta27.tar 2014-01-10 08:11:26 -06:00
Glenn Randers-Pehrson
03a53fa429 [libpng17] Removed potentially misleading warning from png_check_IHDR(). 2014-01-10 06:22:41 -06:00
Glenn Randers-Pehrson
441de8f4fd [libpng17] Revised png_check_IHDR() to use PNG_SIZE_MAX instead of
PNG_UINT_32_MAX in the test for potential overflow in PNG_ROWBYTES.
2014-01-09 20:19:36 -06:00
Glenn Randers-Pehrson
4e5c80034e [libpng17] Only issue a warning about image width if an error has not already
been found in IHDR.
2014-01-08 11:44:48 -06:00
Glenn Randers-Pehrson
879d63156a [libpng17] Updated warning in png_check_IHDR() to say "may be too large"
instead of "is too large".
2014-01-07 11:44:41 -06:00
Glenn Randers-Pehrson
eb021245d0 [libpng17] Bump version to 1.7.0beta27 2014-01-01 11:19:28 -06:00
Glenn Randers-Pehrson
6607a3b905 [libpng17] Imported from libpng-1.7.0beta26.tar 2014-01-01 11:19:08 -06:00
Glenn Randers-Pehrson
28711dff2a [libpng17] Updated copyright year in recently-changed files. 2013-12-31 21:15:11 -06:00
John Bowler
4413d5dcd2 [libpng17] Allow unversioned links created on install to be disabled in
configure.  In configure builds 'make install' changes/adds links like png.h
and libpng.a to point to the newly installed, versioned, files (e.g.
libpng17/png.h and libpng17.a). Three new configure options and some
rearrangement of Makefile.am allow creation of these links to be disabled.
2013-12-29 19:40:13 -06:00
John Bowler
206d1eed42 [libpng17] Changed pngvalid.c to support libpng 1.5, which does not support
the PNG_MAXIMUM_INFLATE_WINDOW option, so #define it out when
appropriate in pngvalid.c
2013-12-29 15:57:30 -06:00
John Bowler
114fa16ab3 [libpng17] Fixed test programs for interlace options. Made pngvalid.c and
pngtest.c work correctly when READ_INTERLACING and/or WRITE_INTERLACING
are switched off.
2013-12-29 10:33:58 -06:00
Glenn Randers-Pehrson
eb2af04bd3 [libpng16] Merged pngrio.c, pngtrans.c, and pngwio.c with libpng-1.6.9 2013-12-28 13:11:47 -06:00
Glenn Randers-Pehrson
200fc68f52 [libpng17] Removed #error macro from contrib/tools/pngfix.c (Thomas Klausner). 2013-12-27 20:18:50 -06:00
John Bowler
4cfd01a288 [libpng17] Added dSIG to chunk list in png.h 2013-12-27 11:50:52 -06:00
John Bowler
e98229ceb0 [libpng17] Merged with 1.5 and 1.6 changes to create a single pngvalid.c 2013-12-27 08:04:49 -06:00
John Bowler
ad1a4c8cc3 [libpng17] Added libpng 1.5 checks to pngvalid.c 2013-12-27 07:53:50 -06:00
Glenn Randers-Pehrson
8df7c46e5b [libpng17] Removed configure-generated "compile" file. 2013-12-26 14:44:48 -06:00
Glenn Randers-Pehrson
99078ec8bd [libpng17] Bump version to 1.7.0beta26 2013-12-26 11:53:16 -06:00
Glenn Randers-Pehrson
a2c5f56e77 [libpng17] Imported from libpng-1.7.0beta25.tar 2013-12-26 11:53:02 -06:00
Glenn Randers-Pehrson
9e168ea2c9 [libpng17] Merged files with version 1.6.8 that have not changed since then. 2013-12-19 20:33:08 -06:00
Glenn Randers-Pehrson
06be739941 [libpng17] Bump version to 1.7.0beta25 2013-12-15 11:22:59 -06:00
Glenn Randers-Pehrson
448092b8eb [libpng17] Imported from libpng-1.7.0beta24.tar 2013-12-15 11:22:49 -06:00
Glenn Randers-Pehrson
1faa6ff32c [libpng17] Handle zero-length PLTE chunk or NULL palette with png_error()
instead of png_chunk_report(), which by default issues a warning
rather than an error, leading to later reading from a NULL pointer
(png_ptr->palette) in png_do_expand_palette().
2013-12-15 08:47:52 -06:00
John Bowler
3adf438f39 [libpng17] Made transform implementation functions static. This makes the
internal functions called by png_do_{read|write}_transformations static.
On an x86-64 DLL build (Gentoo Linux) this reduces the size of the text
segment of the DLL by 1208 bytes, about 0.6%. It also simplifies
maintenance by removing the declarations from pngpriv.h and allowing
easier changes to the internal interfaces.
2013-12-13 23:55:41 -06:00
John Bowler
d45a632529 [libpng17] Bookkeeping: Moved functions around (no changes). Moved transform
function definitions before the place where they are called so that
they can be masde static. Move the intrapixel functions and the
grayscale palette builder out of the png?tran.c files. The latter
isn't a transform function and is no longer used internally, and the
former MNG specific functions are better placed in pngread/pngwrite.c
2013-12-13 23:50:30 -06:00
John Bowler
5a1b8d106d [libpng17] Tidied up pngfix inits and fixed pngtest no-write builds. 2013-12-01 15:50:03 -06:00
Glenn Randers-Pehrson
05f896004f [libpng17] Changed tabs to 3 spaces in png_debug macros and changed '"%s"m'
to '"%s" m' to improve portability among compilers.
Changed png_free_default() to free() in pngtest.c
2013-11-28 16:14:03 -06:00
Glenn Randers-Pehrson
a4f1de9109 [libpng17] Avoid a scan-build warning in pngtest.c 2013-11-25 13:13:32 -06:00
Glenn Randers-Pehrson
7ebb353944 [libpng17] Removed or marked PNG_UNUSED some harmless "dead assignments"
reported by clang scan-build.
2013-11-25 11:08:56 -06:00
Glenn Randers-Pehrson
b1f0c7d0e5 [libpng17] Revised manual about handling of zlib CMF 2013-11-24 13:31:26 -06:00
Glenn Randers-Pehrson
55df049962 [libpng17] Updated CHANGES and ANNOUNCE 2013-11-23 19:26:57 -06:00
Glenn Randers-Pehrson
219ba1370e [libpng17] Bump version to 1.7.0beta24 2013-11-23 19:02:56 -06:00
Glenn Randers-Pehrson
4dc4471bb5 [libpng17] Imported from libpng-1.7.0beta23.tar 2013-11-23 19:01:01 -06:00
Glenn Randers-Pehrson
a199a15b28 [libpng17] Added another "assert()" to pngfix.c 2013-11-23 12:58:32 -06:00
Glenn Randers-Pehrson
e9446f2f95 [libpng17] Added an "assert()" to pngfix.c to quiet a clang scanner warning. 2013-11-23 12:14:02 -06:00
John Bowler
f70f2fcf48 [libpng17] Finished merging with libpng16 (pngrutil.c and pnglibconf.dfa) 2013-11-23 08:20:39 -06:00
John Bowler
158c947ce2 [libpng17] Revert recent change to pngvalid.c. 2013-11-22 18:34:37 -06:00
John Bowler
7e2707e2af [libpng17] Ported recent changes from libpng16 to libpng17
Fixed 'minimal' builds. Various obviously useful minimal configurations
  don't build because of missing contrib/libtests test programs and overly
  complex dependencies in scripts/pnglibconf.dfa. This change adds
  contrib/conftest/*.dfa files that can be used in automatic build
  scripts to ensure that these configurations continue to build.
Enabled WRITE_INVERT and WRITE_PACK in contrib/pngminim/encoder.
2013-11-22 18:01:30 -06:00
Glenn Randers-Pehrson
81824079b5 [libpng17] Added "-Wall" to CFLAGS in contrib/pngminim/*/makefile 2013-11-18 17:03:24 -06:00
Glenn Randers-Pehrson
e8e1add0a8 [libpng17] Moved prototype for png_handle_unknown() in pngpriv.h outside of
the #ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED/#endif block.
2013-11-18 15:35:55 -06:00
Glenn Randers-Pehrson
a549223f91 [libpng17] Added #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED/#endif in pngpread.c 2013-11-17 11:09:57 -06:00
Glenn Randers-Pehrson
ebe7945b96 [libpng17] Bump version to 1.7.0beta23 2013-11-07 08:33:41 -06:00
Glenn Randers-Pehrson
e3e35aa980 [libpng17] Imported from libpng-1.7.0beta22.tar 2013-11-07 08:33:31 -06:00
John Bowler
9f2fbcf5d8 [libpng17] Fixed #include in filter_neon_intrinsics.c and ctype macros. The
ctype char checking macros take an unsigned char argument, not a signed char.
2013-11-04 13:50:20 -06:00
Glenn Randers-Pehrson
264ba68afe [libpng17] Restored a line to the libpng-1.7.0beta21 entry in ANNOUNCE 2013-11-03 20:56:03 -06:00
Glenn Randers-Pehrson
3ef99c9316 [libpng17] Bump version to 1.7.0beta22 2013-11-02 15:39:27 -05:00
John Bowler
4b29f97f9b [libpng17] Port recent libpng-1.6.7beta03, beta04 changes to 1.7.0beta21
(mainly ARMv8 support)
2013-11-02 15:29:45 -05:00
Glenn Randers-Pehrson
fe6e6cf130 [libpng17] Fixed some typos in autogen.s that don't affect its behavior 2013-10-13 17:12:44 -05:00
Glenn Randers-Pehrson
547df4b9ca [libpng17] Bump version to 1.7.0beta21 2013-10-13 14:10:23 -05:00
Glenn Randers-Pehrson
a0d4a0b971 [libpng17] Imported from libpng-1.7.0beta20.tar 2013-10-13 14:02:50 -05:00
John Bowler
72c2577302 [libpng17] Make autogen.sh work with automake 1.13 as well as 1.14. Do this
by always removing the 1.14 'compile' script but never checking for it.
2013-10-06 09:02:09 -05:00
John Bowler
091fab713c [libpng17] Simplified error message code in pngunknown. The simplification has
the useful side effect of avoiding a bogus warning generated by the latest
version of the Intel C compiler (it objects to
condition ? string-literal : string-literal).
2013-10-06 08:51:42 -05:00
John Bowler
32aeb2cd4e [libpng17] Cleaned up (char*) casts of zlib messages. The latest version
of the Intel C compiler complains about casting a string literal as (char*),
so copied the treatment of z_const from the library code into pngfix.c
2013-10-06 08:47:43 -05:00
John Bowler
c1bcdc3a86 [libpng17] Made changes for compatibility with automake 1.14:
1) Added the 'compile' program to the list of programs that must be cleaned
       in autogen.sh
    2) Added 'subdir-objects' which causes .c files in sub-directories to be
       compiled such that the corresponding .o files are also in the
       sub-directory.  This is because automake 1.14 warns that the
       current behavior of compiling to the top level directory may be removed
       in the future.
    3) Updated dependencies on pnglibconf.h to match the new .o locations and
       added all the files in contrib/libtests and contrib/tools that depend
       on pnglibconf.h
    4) Added 'BUILD_SOURCES = pnglibconf.h'; this is the automake recommended
       way of handling the dependencies of sources that are machine generated;
       unfortunately it only works if the user does 'make all' or 'make check',
       so the dependencies (3) are still required.
2013-10-06 08:18:31 -05:00
Glenn Randers-Pehrson
553b8f85d3 [libpng17] Bump version to 1.7.0beta20 2013-10-02 13:47:20 -05:00
Glenn Randers-Pehrson
30666a6097 [libpng17] Imported from libpng-1.7.0beta19.tar 2013-09-30 17:17:59 -05:00
John Bowler
0bfa63cd0d [libpng17] Checked in missing update to pnglibconf.dfa 2013-09-30 15:58:53 -05:00
John Bowler
b37a7c6674 [libpng17] Updated pngunknown.c 2013-09-30 13:11:44 -05:00
John Bowler
7657ac14f2 [libpng17] Catch up with recent libpng16 changes; unknown handling and spelling
corrections
2013-09-30 11:18:13 -05:00
John Bowler
d9f60caf72 [libpng17] Fixed default behavior of ARM_NEON_API. If the ARM NEON API option is
compiled without the CHECK option it defaulted to on, not off.
2013-09-30 08:07:18 -05:00
Glenn Randers-Pehrson
88c20ada06 [libpng17] Reverted the change to unknown handling #defines; the change
breaks 'NOREAD' builds.
2013-09-20 14:30:16 -05:00
Glenn Randers-Pehrson
f3bfc4a142 [libpng17] Bump version to 1.7.0beta19 2013-09-16 11:47:36 -05:00
Glenn Randers-Pehrson
3fdef04d55 [libpng17] Imported from libpng-1.7.0beta18.tar 2013-09-16 11:47:26 -05:00
Glenn Randers-Pehrson
eae431e514 [libpng17] Bump version to 1.7.0beta18 2013-08-21 19:13:27 -05:00
Glenn Randers-Pehrson
003590c361 [libpng17] Imported from libpng-1.7.0beta17.tar 2013-08-21 19:13:18 -05:00
Glenn Randers-Pehrson
8e23262b2b [libpng17] Update comment in png_init_filter_functions() 2013-08-21 17:53:15 -05:00
Glenn Randers-Pehrson
157e0649e0 [libpng17] Delay calling png_init_filter_functions() until a row with nonzero
filter is found.
2013-08-20 21:28:19 -05:00
Glenn Randers-Pehrson
83f1287c02 [libpng17] Mention png_set_option() in the manual. 2013-08-17 15:56:01 -05:00
Glenn Randers-Pehrson
a1124a574a [libpng17] Use minus signs, not hyphens, in "--i" in libpng.3 2013-08-13 18:59:21 -05:00
Glenn Randers-Pehrson
6f27254a7e [libpng17] Change some hyphens to minus signs and fix other typos in libpng.3 2013-08-06 17:25:37 -05:00
Glenn Randers-Pehrson
79fc8fa0d9 [libpng17] Exit loop over tRNS array once a transparent pixel is found
(performance report by PoChun Chang).
2013-08-04 14:05:39 -05:00
Glenn Randers-Pehrson
394bc6cdee [libpng17] Port recent /*SAFE*/ comments and manual changes from libpng16 2013-07-15 10:28:48 -05:00
Glenn Randers-Pehrson
bb06552075 [libpng17] Bump version to 1.7.0beta17 2013-07-04 22:42:35 -05:00
Glenn Randers-Pehrson
a14071d814 [libpng17] Imported from libpng-1.7.0beta16.tar 2013-07-04 22:31:06 -05:00
John Bowler
23f3e46518 [libpng17] Ported pngfix.c patches from libpng16. 2013-07-03 07:50:24 -05:00
John Bowler
f97b2a6cde [libpng17] Ported ARM no-read patch from libpng16. 2013-07-03 07:46:02 -05:00
John Bowler
23f4320775 [libpng17] Added perfect hash code generation for lists of PNG chunks. This is
a work in progress; checked in for use in pngfix.c
2013-07-03 07:41:04 -05:00
Glenn Randers-Pehrson
fb411867b0 [libpng17] Updated documentation to show default behavior of benign errors
correctly.
2013-07-02 09:54:05 -05:00
Glenn Randers-Pehrson
5aa2ca454d [libpng17] Revised pngfix.c to use PNG_U32() instead of PNG_CHUNK() 2013-07-02 09:52:09 -05:00
Glenn Randers-Pehrson
7905286ffa [libpng17] Renamed contrib/tools/png-fix-too-far-back.c to pngfix.c and revised
it to check all compressed chunks known to libpng.
2013-07-01 15:11:36 -05:00
Glenn Randers-Pehrson
2edcb6ad0f [libpng17] Revised example.c to illustrate use of PNG_DEFAULT_sRGB and
PNG_GAMMA_MAC_18 as parameters for png_set_gamma().
2013-06-25 19:43:16 -05:00
Glenn Randers-Pehrson
0f1599e6e5 [libpng17] Fix spelling of "doclifter" in CHANGES and ANNOUNCE 2013-06-18 15:10:32 -05:00
Glenn Randers-Pehrson
cbf22f30b4 [libpng17] Bump version to 1.7.0beta16 2013-06-18 13:22:10 -05:00
Glenn Randers-Pehrson
9bf3c70730 [libpng17] Imported from libpng-1.7.0beta15.tar 2013-06-18 13:14:34 -05:00
Glenn Randers-Pehrson
1bc5747713 [libpng17] Bump version to 1.7.0beta15 2013-06-08 21:00:45 -05:00
Glenn Randers-Pehrson
4a7796faca [libpng17] Imported from libpng-1.7.0beta14.tar 2013-06-08 21:00:36 -05:00
John Bowler
34081a0e2f [libpng17] Port recent changes to ARM support from libpng-1.6.3beta07. 2013-06-08 14:20:46 -05:00
John Bowler
b88c94208a [libpng17] Make ARM NEON support work at compile time (not just configure time).
This moves the test on __ARM_NEON__ into pngconf.h to avoid issues when
using a compiler that compiles for multiple architectures at one time.
2013-06-06 14:57:14 -05:00
Glenn Randers-Pehrson
30662f5e92 [libpng17] Enclose the prototypes for the simplified write API in 2013-06-05 23:25:14 -05:00
Glenn Randers-Pehrson
46ad4c5bd4 [libpng17] Deleted contrib/tools/fixitxt.c, which has been renamed. 2013-06-05 17:03:38 -05:00
Glenn Randers-Pehrson
5c32606ec0 [libpng17] Update README to delete CompuServ and add simplesystems.org 2013-06-05 17:01:14 -05:00
John Bowler
a08ac031fc [libpng17] Fixed ICC compiler warning in tools/png-fix-itxt.c 2013-06-05 16:48:18 -05:00
John Bowler
c233ec8743 [libpng17] Deleted set(CMAKE_BUILD_TYPE) block from CMakeLists.txt 2013-06-05 11:45:55 -05:00
Glenn Randers-Pehrson
d594be641a [libpng17] Added set(CMAKE_CONFIGURATION_TYPES ...) to CMakeLists.txt
(Andrew Hundt)
2013-06-05 11:05:34 -05:00
Glenn Randers-Pehrson
4c9168875b [libpng17] Removed a redundant test in png_set_IHDR(). 2013-06-04 15:09:06 -05:00
Glenn Randers-Pehrson
3c051ee282 [libpng17] Update README with current info about arm, contrib, and projects
directories
2013-06-03 21:02:46 -05:00
Glenn Randers-Pehrson
e1ded944f0 [libpng17] Bump version to 1.7.0beta14 2013-05-12 19:25:30 -05:00
Glenn Randers-Pehrson
c09dddc0cd [libpng17] Imported from libpng-1.7.0beta13.tar 2013-05-12 19:25:16 -05:00
Glenn Randers-Pehrson
bd56d76417 [libpng17] Port recent zlib windowBits handling from libpng-1.6.3beta06 2013-05-10 17:43:59 -05:00
Glenn Randers-Pehrson
0cc23ac171 [libpng17] Updated contrib/pngminus/pnm2png.c (Paul Stewart):
Fixed whitespace handling
Added a call to png_set_packing()
Initialize dimension values so if sscanf fails at least we have known
      invalid values.
2013-05-09 23:30:46 -05:00
Glenn Randers-Pehrson
cb10e19725 [libpng17] Added a needed #ifdef/#endif pair. 2013-05-09 23:18:10 -05:00
Glenn Randers-Pehrson
9dba7219a0 [libpng17] Revised contrib/pngminim/*/makefile to generate pnglibconf.h with the
right zlib header files.
2013-05-09 22:59:08 -05:00
Glenn Randers-Pehrson
17c6af8c40 [libpng17] Check for EOF in contrib/pngminus/pnm2png.c (Paul Stewart).
Ignore "#" delimited comments in input file to pnm2png.c.
2013-05-07 14:38:19 -05:00
Glenn Randers-Pehrson
6a02eb6d2c [libpng17] Bump version to 1.7.0beta13 2013-04-29 21:32:33 -05:00
Glenn Randers-Pehrson
40d41fe6f8 [libpng17] Imported from libpng-1.7.0beta12.tar 2013-04-29 21:32:12 -05:00
Glenn Randers-Pehrson
7073d26e51 [libpng17] Avoid dereferencing NULL pointer possibly returned from
png_create_write_struct() (Andrew Church).
2013-04-29 08:58:15 -05:00
Glenn Randers-Pehrson
cf76fe8654 [libpng17] Expanded manual paragraph about writing private chunks. 2013-04-28 21:04:12 -05:00
Glenn Randers-Pehrson
b780b64fbf [libpng17] Bump version to 1.7.0beta12 2013-04-26 08:46:11 -05:00
Glenn Randers-Pehrson
b1876ab6e2 [libpng17] Imported from libpng-1.7.0beta11.tar 2013-04-26 08:46:00 -05:00
John Bowler
28a95d125f [libpng17] Test for 'arm*' not just 'arm' in the host_cpu configure variable. 2013-04-25 22:51:21 -05:00
Glenn Randers-Pehrson
993f68c006 [libpng17] Bump version to 1.7.0beta11 2013-04-24 08:34:00 -05:00
Glenn Randers-Pehrson
8d23524359 [libpng17] Imported from libpng-1.7.0beta10.tar 2013-04-24 08:33:48 -05:00
John Bowler
e0f4aaa668 [libpng17] Attempt to fix the arm-neon configuration mess. 2013-04-24 00:07:59 -05:00
Glenn Randers-Pehrson
3de174cd2f [libpng17] Imported from libpng-1.7.0beta10.tar 2013-04-23 23:52:30 -05:00
Glenn Randers-Pehrson
eaf2f1dcbe [libpng17] Imported from libpng-1.7.0beta09.tar 2013-04-23 20:43:09 -05:00
John Bowler
ea0b4c602e [libpng17] Port recent changes from libpng-1.6.2. 2013-04-23 20:40:42 -05:00
John Bowler
371c3d4dfd [libpng17] Install missing patch to contrib/libtests/pngunknown.c 2013-04-19 21:56:00 -05:00
John Bowler
0bcf5fb451 [libpng17] Exposed PNG chunk types in png.h, modified png_uint_32 macros/code
to make as few assumptions as possible
2013-04-19 07:06:02 -05:00
Glenn Randers-Pehrson
57d6907d89 [libpng17] Bump version to 1.7.0beta09 2013-04-18 07:40:10 -05:00
Glenn Randers-Pehrson
6cf97e37af [libpng17] Bump version to 1.7.0beta08 2013-04-18 07:39:57 -05:00
Glenn Randers-Pehrson
8ef61c4693 [libpng17] Added contrib/tools/fixitxt.c, to repair the erroneous iTXt
chunk length written by libpng-1.6.0 and 1.6.1.
2013-04-16 23:09:35 -05:00
Glenn Randers-Pehrson
25a116f97d [libpng17] Imported from libpng-1.7.0beta08.tar 2013-04-13 21:27:16 -05:00
Glenn Randers-Pehrson
d6d41c847a [libpng17] Imported from libpng-1.7.0beta07.tar 2013-04-13 20:54:54 -05:00
Glenn Randers-Pehrson
9e0297546f [libpng17] Removed extra line left over from recent patch to pngwutil.c 2013-04-13 20:07:29 -05:00
John Bowler
d529363d13 [libpng17] Revised last patch to work on 64-bit platforms. 2013-04-13 16:42:37 -05:00
Glenn Randers-Pehrson
55e93d7090 [libpng17] Fixed length written to uncompressed iTXt chunks (Samuli Suominen). 2013-04-13 16:23:48 -05:00
John Bowler
23674b75be [libpng17] Added "{ }" that were omitted from previous patch to pngtrans.c 2013-04-13 12:28:30 -05:00
Glenn Randers-Pehrson
0ddf350360 [libpng17] Corrected a misplaced closing bracket in contrib/libtests/pngvalid.c
(Flavio Medeiros).
2013-04-13 11:42:52 -05:00
John Bowler
066f9862f0 [libpng17] Corrected the test on user transform changes on read. It was in the
png_set of the transform function, but that doesn't matter unless the
transform function changes the rowbuf size, and that is only valid if
transform_info is called.
2013-04-12 22:10:38 -05:00
Glenn Randers-Pehrson
ae1a5c811c [libpng17] Updated the URL of the GIT repository in the manual. 2013-04-11 19:00:10 -05:00
John Bowler
5a1ce92c0c [libpng16] Fixed incorrect warning of excess deflate data. End condition - the
warning would be produced if the end of the deflate stream wasn't read
in the last row.  The warning is harmless.
2013-04-07 21:37:52 -05:00
Glenn Randers-Pehrson
7a498039c5 [libpng17]Updated documentation of 1.5.x to 1.6.x changes in iCCP chunk
handling.
2013-03-31 23:03:32 -05:00
Glenn Randers-Pehrson
40a93652aa [libpng17] Bump version to 1.7.0beta07 2013-03-13 09:52:06 -05:00
Glenn Randers-Pehrson
a1362f38de [libpng17] Imported from libpng-1.7.0beta06.tar 2013-03-13 09:51:58 -05:00
John Bowler
30bc0333fe [libpng17] Eliminated two warnings from the Intel C compiler. 2013-03-13 09:50:48 -05:00
Claudio Bley
55794013d4 [libpng16] Fixed CMakelists.txt to allow building a single variant of the
library (Claudio Bley):
  Introduced a PNG_LIB_TARGETS variable that lists all activated library
    targets.  It is an error if this variable ends up empty, ie. you have
    to build at least one library variant.
  Made the *_COPY targets only depend on library targets actually being build.
  Use PNG_LIB_TARGETS to unify a code path.
  Changed the CREATE_SYMLINK macro to expect the full path to a file as the
    first argument. When symlinking the filename component of that path is
    determined and used as the link target.
  Use copy_if_different in the CREATE_SYMLINK macro.
2013-03-07 11:23:12 -06:00
John Bowler
2e92b4dfa0 [libpng16] Corrected simplified API default gamma for color-mapped output, added
a flag to change default. In 1.6.0 when the simplified API was used
to produce color-mapped output from an input image with no gamma
information the gamma assumed for the input could be different from
that assumed for non-color-mapped output.  In particular 16-bit depth
input files were assumed to be sRGB encoded, whereas in the 'direct'
case they were assumed to have linear data.  This was an error.  The
fix makes the simplified API treat all input files the same way and
adds a new flag to the png_image::flags member to allow the
application/user to specify that 16-bit files contain sRGB data
rather than the default linear.
Fixed bugs in the pngpixel and makepng test programs.
2013-03-06 22:23:40 -06:00
Glenn Randers-Pehrson
f46106fa04 [libpng17] Bump version to 1.7.0beta06 2013-03-04 18:23:04 -06:00
Glenn Randers-Pehrson
0dcd32f39c [libpng17] Imported from libpng-1.7.0beta05.tar 2013-03-04 18:22:54 -06:00
John Bowler
808ea281a4 [libpng17] Corrected Android builds and corrected libpng.vers with symbol
prefixing. This adds an API to set optimization options externally,
providing an alternative and general solution for the non-portable
run-time tests used by the ARM Neon code.  It also makes those tests
compile and link on Android.  The order of settings vs options in
pnglibconf.h is reversed to allow settings to depend on options and
options can now set (or override) the defaults for settings.
2013-03-03 21:29:36 -06:00
John Bowler
ec89aefb44 [libpng17] Changed user chunk callback API to respect global and per chunk
defaults.  Previously a return of 0 from a user chunk callback would result in
the chunk being saved (if this was safe, even if the chunk was unsafe-to-copy);
this change respects the defaults set by the application, so unknown chunks
can be discarded by default and known-safe ones preserved.
2013-03-02 21:39:44 -06:00
Glenn Randers-Pehrson
6152dbd424 [libpng17] Fixed bug introduced in libpng-1.6.0beta28 that causes libpng to
handle chunks even when they have been tagged PNG_HANDLE_CHUNK_NEVER.
Also fixed two typos (SUPPOPRTED should be SUPPORTED) in pngrutil.c
2013-03-01 20:08:33 -06:00
Glenn Randers-Pehrson
fe18c0d9ea [libpng17] Avoid a possible memory leak in contrib/gregbook/readpng.c 2013-03-01 13:28:20 -06:00
Glenn Randers-Pehrson
1b0358302d [libpng17] Bump version to 1.7.0beta05 2013-02-27 14:53:47 -06:00
Glenn Randers-Pehrson
d20f9d5030 [libpng17] Imported from libpng-1.7.0beta04.tar 2013-02-27 14:40:40 -06:00
John Bowler
fc447311aa [libpng17] Revised scripts/dfn.awk to work with the buggy MSYS awk that
has trouble with CRLF line endings.
2013-02-27 13:30:52 -06:00
Glenn Randers-Pehrson
8e30e43587 [libpng17] Add info about order of png_set_* calls to the manual. 2013-02-26 08:34:45 -06:00
Glenn Randers-Pehrson
0403ccf1de [libpng16] Revised INSTALL to recommend using CPPFLAGS instead of INCLUDES.
Revised scripts/makefile.freebsd to respect ZLIBDIR and ZLIBINC.
2013-02-22 20:32:03 -06:00
Glenn Randers-Pehrson
1a321cc088 [libpng17] Bump version to 1.7.0beta04 2013-02-22 17:29:54 -06:00
Glenn Randers-Pehrson
c9f99f487b [libpng17] Imported from libpng-1.7.0beta03.tar 2013-02-22 17:29:03 -06:00
Glenn Randers-Pehrson
8360e60abc [libpng17] Update scripts/pnglibconf.h.prebuilt 2013-02-19 10:07:56 -06:00
John Bowler
2799f74489 [libpng17] Fixed ALIGNED_MEMORY support and
Allow run-time ARM NEON checking to be disabled. A new configure option:
--enable-arm-neon=always will stop the run-time checks. New checks
within arm/arm_init.c will cause the code not to be compiled unless
__ARM_NEON__ is set. This should make it fail safe (if someone asks
for it on then the build will fail if it can't be done.)
2013-02-19 09:52:30 -06:00
John Bowler
7363babe4f [libpng17] Reenabled code to allow zero length PLTE chunks for MNG. 2013-02-18 21:36:25 -06:00
Glenn Randers-Pehrson
e3a526f789 [libpng17] Eliminated references to "png_sizeof()" in the documentation. 2013-02-18 15:25:08 -06:00
Glenn Randers-Pehrson
8f0935b8dc [libpng17] Bump version to 1.7.0beta03 2013-02-18 13:02:33 -06:00
Glenn Randers-Pehrson
ae6503fe0e [libpng17] Imported from libpng-1.7.0beta02.tar 2013-02-18 13:02:25 -06:00
Glenn Randers-Pehrson
851a6265a8 [libpng17] Use parentheses consistently with #if defined()
and wrapped some long lines.
2013-02-17 15:25:29 -06:00
Glenn Randers-Pehrson
ffa24d4108 [libpng17] Fixed double-underscore typo in an #ifdef in png.c 2013-02-16 16:38:24 -06:00
John Bowler
206f4d2678 [libpng17] Use approved/supported Android method to check for NEON, use
Linux/POSIX 1003.1 API to check /proc/self/auxv avoiding buffer allocation
and other library calls (ported from libpng15).
2013-02-16 07:53:19 -06:00
John Bowler
bb040784c2 [libpng17] Fixed a race condition in the creation of the build 'scripts'
directory while building with a parallel make.
2013-02-16 07:52:15 -06:00
Glenn Randers-Pehrson
70e1af50ed [libpng17] Bump version to 1.7.0beta02 2013-02-15 11:00:16 -06:00
Glenn Randers-Pehrson
eb4a645eda [libpng17] Imported from libpng-1.7.0beta01.tar 2013-02-15 11:00:07 -06:00
John Bowler
9f7f03a3c4 [libpng17] Accept "," as separator in options.awk 2013-02-10 18:04:16 -06:00
John Bowler
395ddbd318 [libpng17] Fix typos of PNG_GET_PALLETE_MAX_SUPPORTED
in png.h and pnglibconf.dfa
2013-02-10 17:24:46 -06:00
Glenn Randers-Pehrson
9f0d36c85f [libpng17] Fix typo, indentation of #ifdef PNG_GET_PALETTE_MAX_SUPPORTED
in png.h and pnglibconf.dfa
2013-02-10 16:57:38 -06:00
Glenn Randers-Pehrson
e9760e5e95 [libpng17] Enclosed the new png_get_palette_max API
in #ifdef PNG_GET_PALETTE_MAX_SUPPORTED
block, and revised pnglibconf.h and pnglibconf.h.prebuilt accordingly.
2013-02-10 15:59:15 -06:00
John Bowler
b96b2b7e90 [libpng17] Fixed missing dependency in --prefix builds. The intermediate
internal 'prefix.h' file can only be generated correctly after pnglibconf.h,
however the dependency was not in Makefile.am.  The symptoms are
unpredictable depending on the order make chooses to build pngprefix.h and
pnglibconf.h, often the error goes unnoticed because there is a system
pnglibconf.h to use instead.
2013-02-09 07:53:57 -06:00
John Bowler
9bb705e0a8 [libpng17] Fixed make distcheck to skip over the test result files. They were
being included because the whole of the 'tests' directory is included,
fixed to just include the actual test files and tests/pngstest.  Also
reverted the previous erroneous change to remove the ${srcdir} from the
front of contrib, scripts, projects and added an explanation of what is
going on to Makefile.am
2013-02-08 11:16:06 -06:00
Glenn Randers-Pehrson
e860f77393 [libpng17] Updated manual page about png_get_palette_max() API. 2013-02-08 09:24:35 -06:00
Glenn Randers-Pehrson
b5a7565908 [libpng17] Removed some obsolete test scripts. 2013-02-08 08:00:11 -06:00
John Bowler
e88e221d91 [libpng17] Make tests/pngstest* work with the original Bourne shell 2013-02-07 21:59:36 -06:00
Glenn Randers-Pehrson
b10867cdc2 [libpng17] Enable parallel tests and rearrange TESTS order to take advantage of
the massive speed improvements use a make capable of parallel builds
on a multi-CPU machine and pass the right arguments to make (-j10000
for GNU make) to get the build to run in parallel.
2013-02-07 08:26:34 -06:00
Glenn Randers-Pehrson
bf7084b80d [libpng17] Bump version to 1.7.0alpha11 2013-02-06 22:23:37 -06:00
Glenn Randers-Pehrson
6afcee826f [libpng17] Imported from libpng-1.7.0alpha10.tar 2013-02-06 19:51:21 -06:00
John Bowler
f15a5006c8 [libpng17] Removed cc -E workround, corrected png_get_palette_max API. Tested
on SUN OS cc 5.9, which demonstrates the tokenization problem previously
avoided by using /lib/cpp.  Since all .dfn output is now protected
in double quotes unless it is to be macro substituted the fix should work
everywhere.
2013-02-06 17:52:30 -06:00
John Bowler
cdbd5174bd [libpng17] Minor fixes to assembler changes, verified with a dummy .S file 2013-02-06 17:40:52 -06:00
John Bowler
7a9b6203ef [libpng16] Removed new test-driver from autogen.sh 2013-02-06 17:16:49 -06:00
John Bowler
803493e19c [libpng17] Ported libpng 1.5 options.awk/dfn file handling to 1.7, fixed one
bug.
2013-02-05 10:16:42 -06:00
Mans Rullgard
4245e6b1b2 [libpng17] Fixed ARM support (Mans Rullgard).
Also removed stray out-of-order #endif and #ifdef
2013-02-05 09:55:36 -06:00
John Bowler
81892f6b90 [libpng17] Fix typos in png_get_palette_max name and prototype 2013-02-05 08:10:01 -06:00
John Bowler
862993827d [libpng17] Changed png_size_t to size_t throughout headers, make sRGB check
numbers consistent.
2013-02-04 20:04:10 -06:00
Glenn Randers-Pehrson
d304125332 [libpng17] Added png_get_palette_max() function. 2013-02-04 19:55:53 -06:00
John Bowler
9124f3e29a [libpng17] Make symbol prefixing work with the ARM neon optimizations. Also
allow pngpriv.h to be included for preprocessor definitions only, so
it can be used in non-C/C++ files.
2013-02-04 18:00:34 -06:00
Glenn Randers-Pehrson
2969375aa6 [libpng17] Restored a "return" statement accidentally deleted from pngset.c 2013-01-22 07:03:51 -06:00
Glenn Randers-Pehrson
5e8ba1cbbf [libpng17] Set counter to prevent additional attempts to cache a chunk
after running out of memory or reaching a potential overflow condition.
2013-01-21 16:37:54 -06:00
Glenn Randers-Pehrson
8aee43d10a [libpng17] Bump version to 1.7.0alpha10 2013-01-21 09:21:36 -06:00
Glenn Randers-Pehrson
e355657bbe [libpng17] Imported from libpng-1.7.0alpha09.tar 2013-01-21 09:21:21 -06:00
John Bowler
fb6ba9acf4 [libpng17] Pulled changes to multi-chunk handling from libpng-1.6.0beta40. 2013-01-21 09:11:17 -06:00
Glenn Randers-Pehrson
815173a0b5 [libpng17] Bump version to 1.7.0alpha09 2013-01-17 13:50:32 -06:00
Glenn Randers-Pehrson
7f489a77bb [libpng17] Imported from libpng-1.7.0alpha08.tar 2013-01-17 13:50:23 -06:00
John Bowler
8ec8e8fcd5 [libpng17] Corrected previous attempt at overflow detection in
png_set_unknown_chunks().
2013-01-17 13:42:42 -06:00
Glenn Randers-Pehrson
a4e606dd5f [libpng17] Bump version to 1.7.0alpha08 2013-01-10 12:05:08 -06:00
Glenn Randers-Pehrson
646de7962b [libpng17] Imported from libpng-1.7.0alpha07.tar 2013-01-10 12:04:54 -06:00
John Bowler
4accd423c2 [libpng17]Fixed conceivable but difficult to repro overflow. Also added
two test programs to generate and test a PNG which should have the problem.
2013-01-10 11:01:00 -06:00
Glenn Randers-Pehrson
f62caaf4dc [libpng17] Fixed typo in copyright year and version in pngmem.c 2013-01-01 10:55:18 -06:00
Glenn Randers-Pehrson
b789bb84bb [libpng17] Bump version to 1.7.0alpha07 2013-01-01 09:02:35 -06:00
Glenn Randers-Pehrson
ce60ad642b [libpng17] Imported from libpng-1.7.0alpha06.tar 2013-01-01 09:02:25 -06:00
Glenn Randers-Pehrson
ab097b1168 [libpng17] Updated copyright year to 2013 in changed files. 2013-01-01 08:54:06 -06:00
John Bowler
3a737d86c7 [libpng17] Fixed 'make distcheck' on SUN OS - libpng.so was not being removed 2012-12-27 09:46:33 -06:00
Glenn Randers-Pehrson
a1337e57a8 [libpng17] Bump version to 1.7.0alpha06 2012-12-23 21:00:36 -06:00
Glenn Randers-Pehrson
247b3fcf49 [libpng17] Imported from libpng-1.7.0alpha05.tar 2012-12-23 21:00:22 -06:00
Glenn Randers-Pehrson
f01273b25c [libpng17] Bump version to 1.7.0alpha05 2012-12-22 18:23:22 -06:00
Glenn Randers-Pehrson
8cb1a2ac6d [libpng17] Imported from libpng-1.7.0alpha04.tar 2012-12-22 18:13:34 -06:00
Glenn Randers-Pehrson
e6e5ac8cb7 [libpng17] Added missing dependency on pnglibconf.h in scripts/makefile.linux 2012-12-22 17:53:18 -06:00
Glenn Randers-Pehrson
a4798fb83e [libpng17] Reformatted latest CHANGES/ANNOUNCE entry to 80 character lines. 2012-12-22 17:13:02 -06:00
John Bowler
46369f35c5 [libpng17] Fixed Windows build issues, enabled ARM compilation. Various warnings issued
by earlier versions of GCC fixed for Cygwin and Min/GW (which both use old GCCs.)
ARM support is enabled by default in zlib.props (unsupported by Microsoft) and
ARM compilation is made possible by deleting the check for x86. The test programs
cannot be run because they are not signed.
2012-12-20 22:58:13 -06:00
John Bowler
e699993d70 [libpng17] Made default Zlib compression settings be configurable. This adds #defines to
pnglibconf.h to control the defaults.
2012-12-20 22:21:02 -06:00
Glenn Randers-Pehrson
5a0afcfa63 [libpng17] Added scripts/makefile.msys contributed by Christipher M. Wheeler 2012-12-19 23:06:12 -06:00
Glenn Randers-Pehrson
3fc9cbf126 [libpng17] Bump version to 1.7.0alpha04 2012-12-19 16:06:17 -06:00
Glenn Randers-Pehrson
36b628b19e [libpng17] Imported from libpng-1.7.0alpha03.tar 2012-12-19 15:53:18 -06:00
Glenn Randers-Pehrson
2c31365fd4 [libpng16] Announce that git repository location at SourceForge has changed. 2012-12-18 21:45:58 -06:00
Glenn Randers-Pehrson
e1e3c1a2a2 [libpng17] Fixed typo in contrib/pngminim/encoder/README 2012-12-18 14:58:44 -06:00
John Bowler
b940e5dc5d [libpng17] Disassembled the version number in scripts/options.awk (necessary
for building on SunOs)
2012-12-17 23:36:08 -06:00
John Bowler
fbbbc620b8 [libpng16] Fixed previous support for Z_PREFIX in configure builds, corrected
sCAL APIs; some of these use floating point arithmetic so they need to be
disabled if floating point arithmetic is switched off.  This is a quiet API
change - previously it appeared that the APIs were supported if fixed point
arithmetic was used internally, however they required certain APIs (floor,
modf, frexp, atof) that are part of C floating point support. Changed
png_fixed and the gamma code specific version of the same to avoid floor(),
which may be a library function (not an intrinsic). Removed unused #if 0
code.
2012-12-17 21:07:30 -06:00
Glenn Randers-Pehrson
9b99600c4d [libpng17] Fixed several more whitespace errors in libpng.3 2012-12-17 20:00:44 -06:00
Glenn Randers-Pehrson
3129d7426e [libpng16] Cleaned up whitespace in the synopsis portion of the manpage. 2012-12-17 19:21:14 -06:00
Glenn Randers-Pehrson
325ceea971 [libpng17] Bump version to 1.7.0alpha03 2012-12-17 12:25:13 -06:00
Glenn Randers-Pehrson
ac39fc3024 [libpng17] Bump version to 1.7.0alpha03 2012-12-17 12:16:32 -06:00
Glenn Randers-Pehrson
99343407e6 [libpng17] Add #ifdef PNG_WRITE_FILTERED_ROW around a use of prev_row. 2012-12-17 12:12:49 -06:00
Glenn Randers-Pehrson
3e23f45ba9 [libpng17] Document new PNG_ABORT behavior in libpng-1.7.x 2012-12-17 11:53:34 -06:00
John Bowler
72389dec42 [libpng17] Cleaned up and enhanced the configure option; libpng now correctly
links and tests against zlib with a prefix; tests have been clarified; and
irrelevant or obsolete things (as defined by the autotools man page) have
been removed.
2012-12-17 09:20:02 -06:00
Glenn Randers-Pehrson
1f0853f47e [libpng17] Bump version to 1.7.0alpha03 2012-12-16 19:43:18 -06:00
Glenn Randers-Pehrson
32a60a4885 [libpng17] Imported from libpng-1.7.0alpha02.tar 2012-12-16 19:43:10 -06:00
Glenn Randers-Pehrson
5e07dc6970 [libpng17] Updated documentation about functions deprecated in 1.6.0 2012-12-16 16:47:07 -06:00
John Bowler
4b90a8d416 [libpng17] Build fixes (trailing ;, missing/misplaced PNG_REMOVED) in png.h 2012-12-16 15:56:18 -06:00
John Bowler
d59c19b64c [libpng17] Removed more functions that were deprecated in libpng-1.6.0:
png_malloc_default png_free_default.
  Updated some left over "1.6.0beta32" in code sources.
  Fixed a "png_structp" prototype (should be png_structrp) in arm_init.c
  Updated the version-number hack in pngvalid.c
2012-12-15 21:41:31 -06:00
Glenn Randers-Pehrson
bbabd977d1 [libpng17] Fixed some typos in comments; updated manual. 2012-12-15 17:12:48 -06:00
John Bowler
0cf9c7d63d [libpng17] Removed some duplicated code from png.c and contrib/tools/scale.c
and changed some png_warning() calls to png_app_error() calls in pngwutil.c
2012-12-15 16:04:28 -06:00
Glenn Randers-Pehrson
b4e241559e [libpng17] Removed no-longer-exported functions from scripts/symbols.def 2012-12-15 16:02:24 -06:00
Glenn Randers-Pehrson
1e15aee6be [libpng17] Removed functions that were deprecated in libpng-1.6.0:
png_reset_zstream(), png_info_init_3(), and png_data_freer() and its
associated flags.
2012-12-15 15:40:56 -06:00
Glenn Randers-Pehrson
d59e60d0fb [libpng17] Bump version to 1.7.0alpha02 2012-12-15 12:33:51 -06:00
Glenn Randers-Pehrson
ec1d13a1d4 [libpng17] Imported from libpng-1.7.0alpha01.tar 2012-12-15 12:33:44 -06:00
Glenn Randers-Pehrson
d9002f94cb [libpng17] Rebuilt Makefile.in, configure, etc., with autoconf-2.69
and automake-1.12.5 in the tar distributions.
2012-12-15 10:12:36 -06:00
John Bowler
1fa858db48 [libpng17] Fixed cases of unquoted DESTDIR in Makefile.am. 2012-12-15 09:48:10 -06:00
John Bowler
0f2a5bac64 [libpng17] Rearranged ARM-NEON optimizations to isolate the machine specific
code to the hardware subdirectory, and add comments to pngrutil.c so that
implementors of other optimizations will know what to do.
2012-12-14 23:12:16 -06:00
John Bowler
eac85878bf [libpng17] Clean up USER_LIMITS feature, removing members from png_struct
when not required.
2012-12-14 22:56:00 -06:00
John Bowler
240ac287eb [libpng17]Rearranged png_struct, remove unused members, change png_set_filter
handling png_struct members rearranged - partly to reorder to avoid packing,
partly to put frequently accessed members at the start and partly to make
the grouping more clear. png_set_filter code has been rewritten and the
code shared with png_write_start_row moved to a common function.  Comments
in png.h have been made more clear. Minor fixes to
contrib/libtests/timepng.c and some of the png_*_tRNS logic, including
more error detection in png_set_tRNS.
2012-12-14 22:31:50 -06:00
John Bowler
3e42c81193 [libpng17] Made 8-bit compose and rgb_to_grayscale accuracy improvements.
These changes cause 16-bit arithmetic to be used for 8-bit data in the gamma
    corrected compose and grayscale operations.  The arithmetic errors have
    three sources all of which are fixed in this commit:
    1) 8-bit linear calculations produce massive errors for lower intensity
       values.
    2) The old 16-bit "16 to 8" gamma table code erroneously wrote the lowest
       output value into a table entry which corresponded to multiple output
       values (so where the value written should have been the closest to the
       transformed input value.)
    3) In a number of cases the code to access the 16-bit table did not round;
       it did a simple shift, which was wrong and made the side effects of (2)
       even worse.
  The new gamma code does not have the 16-to-8 problem at the cost of slighly
    more calculations and the algorithm used to minimize the number of
    calculations has been extended to all the 16-bit tables; it has advantages
    for any significant gamma correction.
2012-12-14 22:17:54 -06:00
Glenn Randers-Pehrson
ac3b4d9b69 [libpng17] Bump version to 1.7.0alpha01 2012-12-10 16:21:25 -06:00
419 changed files with 39620 additions and 88024 deletions

View File

@ -1,81 +0,0 @@
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'

View File

@ -1,94 +0,0 @@
# 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

View File

@ -1,55 +0,0 @@
# 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

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

View File

@ -1,31 +0,0 @@
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
View File

@ -1,159 +0,0 @@
# 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

99
.travis.yml Normal file
View File

@ -0,0 +1,99 @@
language: c
sudo: false
cache:
directories:
- $HOME/.cache/pip
- $HOME/deps
matrix:
include:
- os: linux
compiler: gcc
env: BUILD_TYPE=normal
- os: linux
compiler: clang
env: BUILD_TYPE=normal
- os: linux
compiler: gcc
env: BUILD_TYPE=coverage
- os: linux
compiler: clang
env: BUILD_TYPE=ubsan
- os: linux
compiler: clang
env: BUILD_TYPE=asan
- os: linux
compiler: clang
env: BUILD_TYPE=lsan
- os: linux
compiler: clang
env: BUILD_TYPE=msan
- os: osx
compiler: gcc
env: BUILD_TYPE=normal
- os: osx
compiler: clang
env: BUILD_TYPE=normal
install:
- pip install --user 'requests[security]'
- pip install --user cpp-coveralls
- |
mkdir -p deps
pushd deps
export PREFIXDIR=`pwd`
if [ ! -f "libtool-2.4.6.tar.xz" ]; then
wget http://ftpmirror.gnu.org/libtool/libtool-2.4.6.tar.xz
fi
if [ ! -f "automake-1.15.tar.xz" ]; then
wget http://ftp.gnu.org/gnu/automake/automake-1.15.tar.xz
fi
if [ ! -d "libtool-2.4.6" ]; then
tar xf libtool-2.4.6.tar.xz
pushd libtool-2.4.6/
./configure --prefix=$PREFIXDIR
make && make install
popd
cp $PREFIXDIR/bin/libtool $PREFIXDIR/bin/glibtool
cp $PREFIXDIR/bin/libtoolize $PREFIXDIR/bin/glibtoolize
fi
if [ ! -d "automake-1.15" ]; then
tar xf automake-1.15.tar.xz
pushd automake-1.15/
./configure --prefix=$PREFIXDIR
make && make install
popd
fi
export PATH="$PREFIXDIR/bin:$PATH"
popd
before_script:
- |
if [ "$BUILD_TYPE" = "coverage" ]; then
export CFLAGS="-fprofile-arcs -ftest-coverage"
export LDFLAGS="-fprofile-arcs -ftest-coverage"
fi
- |
if [ "$BUILD_TYPE" = "asan" ]; then
export CFLAGS=-fsanitize=address
export LDFLAGS=-fsanitize=address
fi
- |
if [ "$BUILD_TYPE" = "lsan" ]; then
export CFLAGS=-fsanitize=leak
export LDFLAGS=-fsanitize=leak
fi
- |
if [ "$BUILD_TYPE" = "msan" ]; then
export CFLAGS=-fsanitize=memory
export LDFLAGS=-fsanitize=memory
fi
- |
if [ "$BUILD_TYPE" = "ubsan" ]; then
export CFLAGS="-fsanitize=undefined -fno-sanitize-recover"
export LDFLAGS="-fsanitize=undefined"
fi
script:
- ./autogen.sh && ./configure && make && make check
- |
if [ "$BUILD_TYPE" = "coverage" ]; then
cpp-coveralls --gcov-options '\-lp'
fi

View File

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

1465
ANNOUNCE

File diff suppressed because it is too large Load Diff

66
AUTHORS
View File

@ -1,66 +0,0 @@
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.

2278
CHANGES

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

158
INSTALL
View File

@ -1,3 +1,4 @@
Installing libpng
Contents
@ -15,11 +16,10 @@ Contents
XI. Prepending a prefix to exported symbols
XII. Configuring for compiler xxx:
XIII. Removing unwanted object code
XIV. Enabling or disabling hardware optimizations
XV. Changes to the build and configuration of libpng in libpng-1.5.x
XVI. Setjmp/longjmp issues
XVII. Common linking failures
XVIII. Other sources of information about libpng
XIV. Changes to the build and configuration of libpng in libpng-1.5.x
XV. Setjmp/longjmp issues
XVI. Common linking failures
XVII. Other sources of information about libpng
I. Simple installation
@ -78,8 +78,8 @@ Or you can use one of the "projects" in the "projects" directory.
Before installing libpng, you must first install zlib, if it
is not already on your system. zlib can usually be found
wherever you got libpng; otherwise go to https://zlib.net/. You can
place zlib in the same directory as libpng or in another directory.
wherever you got libpng; otherwise go to http://zlib.net. You can place
zlib in the same directory as libpng or in another directory.
If your system already has a preinstalled zlib you will still need
to have access to the zlib.h and zconf.h include files that
@ -127,18 +127,16 @@ Your directory structure should look like this:
README
*.h, *.c => libpng source files
CMakeLists.txt => "cmake" script
ci
ci_*.sh
configuration files:
configure.ac, configure, Makefile.am, Makefile.in,
autogen.sh, config.guess, ltmain.sh, missing, libpng.pc.in,
libpng-config.in, aclocal.m4, config.h.in, config.sub,
depcomp, install-sh, mkinstalldirs, test-pngtest.sh, etc.
depcomp, install-sh, mkinstalldirs, test-pngtest.sh
contrib
arm-neon, conftest, examples, gregbook, libtests, pngminim,
pngminus, pngsuite, tools, visupng, riscv-rvv
pngminus, pngsuite, tools, visupng
projects
owatcom, visualc71, vstudio
cbuilder5, owatcom, visualc71, vstudio, xcode
scripts
makefile.*
*.def (module definition files)
@ -146,7 +144,7 @@ Your directory structure should look like this:
pngtest.png
etc.
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
distribution of libpng. It is available in both tar.gz (UNIX style line
@ -154,27 +152,28 @@ endings) and zip (DOS style line endings) formats.
VI. Building with project files
If you are building libpng with Microsoft Visual Studio, you can enter
the directory projects\visualc71 or projects\vstudio and follow the
instructions in README.txt.
If you are building libpng with MSVC, you can enter the
libpng projects\visualc71 or vstudio directory and follow the instructions
in README.txt.
Otherwise, enter the zlib directory and follow the instructions in
zlib/README, then come back here and run "configure" or choose the
appropriate makefile in the scripts directory.
Otherwise enter the zlib directory and follow the instructions in zlib/README,
then come back here and run "configure" or choose the appropriate
makefile.sys in the scripts directory.
VII. Building with makefiles
Copy the file (or files) that you need from the
scripts directory into this directory, for example
MSDOS example:
copy scripts\makefile.msc makefile
copy scripts\pnglibconf.h.prebuilt pnglibconf.h
UNIX example:
cp scripts/makefile.std Makefile
make
Windows example:
nmake -f scripts\makefile.vcwin32
cp scripts/makefile.std makefile
cp scripts/pnglibconf.h.prebuilt pnglibconf.h
Read the makefile to see if you need to change any source or
target directories to match your preferences.
@ -191,33 +190,36 @@ test. For more confidence, you can run another test by typing
Also, you can run "pngtest -m contrib/pngsuite/*.png" and compare
your output with the result shown in contrib/pngsuite/README.
Most of the makefiles used to allow you to run "make install" to put
the library in its final resting place, but that feature is no longer
supported. The only tested and supported manners to install libpng are
the conventional build and install procedures driven by the configure
script or by the CMake file.
Most of the makefiles will allow you to run "make install" to
put the library in its final resting place (if you want to
do that, run "make install" in the zlib directory first if necessary).
Some also allow you to run "make test-installed" after you have
run "make install".
VIII. Configuring for DOS and other 16-bit platforms
VIII. Configuring libpng for 16-bit platforms
Officially, the support for 16-bit platforms has been removed.
You will want to look into zconf.h to tell zlib (and thus libpng) that
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
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.
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.
X. Configuring for Medium Model
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() call.
You will also have to look into zconf.h to tell zlib (and thus libpng)
that it cannot allocate more than 64K at a time. Even if you can, the
memory won't be accessible. Therefore, you should limit zlib and libpng
to 64K by defining MAXSEG_64K.
Libpng's support for medium model has been tested on most of the popular
compilers. Make sure MAXSEG_64K gets defined, USE_FAR_KEYWORD gets
defined, and FAR gets defined to far in pngconf.h, and you should be
all set. Everything in the library (except for zlib's structure) is
expecting far data. You must use the typedefs with the p or pp on
the end for pointers (or at least look at them and be careful). Make
note that the rows of data are defined as png_bytepp, which is
an "unsigned char far * far *".
IX. Prepending a prefix to exported symbols
XI. Prepending a prefix to exported symbols
Starting with libpng-1.6.0, you can configure libpng (when using the
"configure" script) to prefix all exported symbols by means of the
@ -228,7 +230,7 @@ identifier). This creates a set of macros in pnglibconf.h, so this is
transparent to applications; their function calls get transformed by
the macros to use the modified names.
X. Configuring for compiler xxx:
XII. Configuring for compiler xxx:
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.
@ -238,9 +240,10 @@ The files in libpng proper only include pngpriv.h and png.h, which
in turn includes pngconf.h and, as of libpng-1.5.0, pnglibconf.h.
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
that previously appeared in the public headers.
that previously appeared in the public headers. As of libpng-1.7.0,
pngchunk.h is also included, and is used privately by pngrutil.c.
XI. Removing unwanted object code
XIII. Removing unwanted object code
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
@ -279,61 +282,7 @@ 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
those sections that are actually used will be loaded into memory.
XII. Enabling or disabling hardware optimizations
Certain hardware capabilities, such as the Intel SSE instructions,
are normally detected at run time. Enable them with configure options
such as one of
--enable-arm-neon=yes
--enable-mips-msa=yes
--enable-intel-sse=yes
--enable-powerpc-vsx=yes
--enable-riscv-rvv=yes
or enable them all at once with
--enable-hardware-optimizations=yes
or, if you are not using "configure", you can use one
or more of
CPPFLAGS += "-DPNG_ARM_NEON"
CPPFLAGS += "-DPNG_MIPS_MSA"
CPPFLAGS += "-DPNG_INTEL_SSE"
CPPFLAGS += "-DPNG_POWERPC_VSX"
CPPFLAGS += "-DPNG_RISCV_RVV"
See for example scripts/makefile.linux-opt
If you wish to avoid using them,
you can disable them via the configure option
--disable-hardware-optimizations
to disable them all, or
--enable-intel-sse=no
to disable a particular one,
or via compiler-command options such as
CPPFLAGS += "-DPNG_ARM_NEON_OPT=0, -DPNG_MIPS_MSA_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"
by default. To disable them, use
cmake . -DPNG_ARM_NEON=no -DPNG_INTEL_SSE=no \
-DPNG_MIPS_MSA=no -DPNG_POWERPC_VSX=no \
-DPNG_RISCV_RVV=no
or disable them all at once with
cmake . -DPNG_HARDWARE_OPTIMIZATIONS=no
XIII. Changes to the build and configuration of libpng in libpng-1.5.x
XIV. 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
file and in the GIT repository logs. These will be of no concern to the vast
@ -424,7 +373,7 @@ $PREFIX/include directory). Do not edit pnglibconf.h after you have built
libpng, because than the settings would not accurately reflect the settings
that were used to build libpng.
XIV. Setjmp/longjmp issues
XV. Setjmp/longjmp issues
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
@ -442,7 +391,7 @@ This requires setjmp/longjmp, so you must either build the library
with PNG_SETJMP_SUPPORTED defined, or with PNG_SIMPLIFIED_READ_SUPPORTED
and PNG_SIMPLIFIED_WRITE_SUPPORTED undefined.
XV. Common linking failures
XVI. Common linking failures
If your application fails to find libpng or zlib entries while linking:
@ -454,13 +403,12 @@ If your application fails to find libpng or zlib entries while linking:
If you are using the vstudio project, observe the WARNING in
project/vstudio/README.txt.
XVI. Other sources of information about libpng:
XVII. Other sources of information about libpng:
Further information can be found in the README and libpng-manual.txt
files, in the individual makefiles, in png.h, and the manual pages
libpng.3 and png.5.
Copyright (c) 2022 Cosmin Truta
Copyright (c) 1998-2002,2006-2016 Glenn Randers-Pehrson
This document is released under the libpng license.
For conditions of distribution and use, see the disclaimer

174
LICENSE
View File

@ -1,82 +1,50 @@
COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
=========================================
PNG Reference Library License version 2
---------------------------------------
This copy of the libpng notices is provided for your convenience. In case of
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 (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.
COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
The software is supplied "as is", without warranty of any kind,
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.
If you modify libpng you may insert additional notices immediately following
this sentence.
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:
This code is released under the libpng license.
1. The origin of this software must not be misrepresented; you
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
libpng versions 1.0.7, July 1, 2000 through 1.7.0beta88, August 6, 2017 are
Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
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
added to the list of Contributing Authors:
Simon-Pierre Cadieux
Eric S. Raymond
Mans Rullgard
Cosmin Truta
Gilles Vollant
James Yu
Mandar Sahastrabuddhe
Google Inc.
Vadim Barkov
Simon-Pierre Cadieux
Eric S. Raymond
Mans Rullgard
Cosmin Truta
Gilles Vollant
James Yu
and with the following additions to the disclaimer:
There is no warranty against interference with your enjoyment of
the library or against infringement. There is no warranty that our
efforts or the library will fulfill any of your particular purposes
or needs. This library is provided with all faults, and the entire
risk of satisfactory quality, performance, accuracy, and effort is
with the user.
There is no warranty against interference with your enjoyment of the
library or against infringement. There is no warranty that our
efforts or the library will fulfill any of your particular purposes
or needs. This library is provided with all faults, and the entire
risk of satisfactory quality, performance, accuracy, and effort is with
the user.
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.
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
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 of Contributing Authors:
license as libpng-0.96, with the following individuals added to the list
of Contributing Authors:
Tom Lane
Glenn Randers-Pehrson
Willem van Schaik
Tom Lane
Glenn Randers-Pehrson
Willem van Schaik
libpng versions 0.89, June 1996, through 0.96, May 1997, are
Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
@ -84,14 +52,14 @@ and are distributed according to the same disclaimer and license as
libpng-0.88, with the following individuals added to the list of
Contributing Authors:
John Bowler
Kevin Bracey
Sam Bushell
Magnus Holmgren
Greg Roelofs
Tom Tanner
John Bowler
Kevin Bracey
Sam Bushell
Magnus Holmgren
Greg Roelofs
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.
libpng versions 0.5, May 1995, through 0.88, January 1996, are
@ -100,35 +68,63 @@ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
For the purposes of this copyright and license, "Contributing Authors"
is defined as the following set of individuals:
Andreas Dilger
Dave Martindale
Guy Eric Schalnat
Paul Schmidt
Tim Wegner
Andreas Dilger
Dave Martindale
Guy Eric Schalnat
Paul Schmidt
Tim Wegner
The PNG Reference Library is supplied "AS IS". The Contributing
Authors and Group 42, Inc. disclaim all warranties, expressed or
implied, including, without limitation, the warranties of
merchantability and of fitness for any purpose. The Contributing
Authors and Group 42, Inc. assume no liability for direct, indirect,
incidental, special, exemplary, or consequential damages, which may
result from the use of the PNG Reference Library, even if advised of
the possibility of such damage.
The PNG Reference Library is supplied "AS IS". The Contributing Authors
and Group 42, Inc. disclaim all warranties, expressed or implied,
including, without limitation, the warranties of merchantability and of
fitness for any purpose. The Contributing Authors and Group 42, Inc.
assume no liability for direct, indirect, incidental, special, exemplary,
or consequential damages, which may 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
source code, or portions hereof, for any purpose, without fee, subject
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
be misrepresented as being the original source.
2. Altered versions must be plainly marked as such and must not
be misrepresented as being the original source.
3. This Copyright notice may not be removed or altered from any
source or altered source distribution.
3. This Copyright notice may not be removed or altered from any
source or altered source distribution.
The Contributing Authors and Group 42, Inc. specifically permit,
without fee, and encourage the use of this source code as a component
to supporting the PNG file format in commercial products. If you use
this source code in a product, acknowledgment is not required but would
be appreciated.
The Contributing Authors and Group 42, Inc. specifically permit, without
fee, and encourage the use of this source code as a component to
supporting the PNG file format in commercial products. If you use this
source code in a product, acknowledgment is not required but would 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
August 6, 2017

View File

@ -1,7 +1,7 @@
# 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
# Last changed in libpng 1.7.0 [(PENDING RELEASE)]
#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
@ -9,24 +9,16 @@
PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
ACLOCAL_AMFLAGS = -I scripts/autoconf
ACLOCAL_AMFLAGS = -I scripts
# 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
check_PROGRAMS += timepng
endif
else
check_PROGRAMS=
endif
# Utilities - installed
if ENABLE_TOOLS
bin_PROGRAMS= pngfix png-fix-itxt
else
bin_PROGRAMS=
endif
# 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,
@ -38,7 +30,6 @@ endif
# always wrong and always very confusing.
BUILT_SOURCES = pnglibconf.h
if ENABLE_TESTS
pngtest_SOURCES = pngtest.c
pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
@ -54,33 +45,29 @@ pngunknown_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
pngimage_SOURCES = contrib/libtests/pngimage.c
pngimage_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
pngfix_SOURCES = contrib/tools/pngfix.c
pngfix_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
png_fix_itxt_SOURCES = contrib/tools/png-fix-itxt.c
timepng_SOURCES = contrib/libtests/timepng.c
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_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
png_fix_itxt_SOURCES = contrib/tools/png-fix-itxt.c
endif
# Generally these are single line shell scripts to run a test with a particular
# set of parameters:
if ENABLE_TESTS
TESTS =\
tests/pngtest-all\
tests/pngtest\
tests/pngvalid-gamma-16-to-8 tests/pngvalid-gamma-alpha-mode\
tests/pngvalid-gamma-background tests/pngvalid-gamma-expand16-alpha-mode\
tests/pngvalid-gamma-expand16-background\
tests/pngvalid-gamma-expand16-transform tests/pngvalid-gamma-sbit\
tests/pngvalid-gamma-threshold tests/pngvalid-gamma-transform\
tests/pngvalid-progressive-size\
tests/pngvalid-progressive-size tests/pngvalid-size\
tests/pngvalid-progressive-interlace-standard\
tests/pngvalid-transform\
tests/pngvalid-transform tests/pngvalid-interlace-transform\
tests/pngvalid-progressive-standard tests/pngvalid-standard\
tests/pngstest-1.8 tests/pngstest-1.8-alpha tests/pngstest-linear\
tests/pngstest-linear-alpha tests/pngstest-none tests/pngstest-none-alpha\
@ -88,7 +75,6 @@ TESTS =\
tests/pngunknown-discard tests/pngunknown-if-safe tests/pngunknown-sAPI\
tests/pngunknown-sTER tests/pngunknown-save tests/pngunknown-vpAg\
tests/pngimage-quick tests/pngimage-full
endif
# man pages
dist_man_MANS= libpng.3 libpngpf.3 png.5
@ -104,50 +90,15 @@ lib_LTLIBRARIES=libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngerror.c\
pngget.c pngmem.c pngpread.c pngread.c pngrio.c pngrtran.c pngrutil.c\
pngset.c pngtrans.c pngwio.c pngwrite.c pngwtran.c pngwutil.c\
png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h pngusr.dfa
png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h pngchunk.h \
pngusr.dfa
if PNG_ARM_NEON
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += arm/arm_init.c\
arm/filter_neon_intrinsics.c \
arm/palette_neon_intrinsics.c
endif
if PNG_MIPS_MSA
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += mips/mips_init.c\
mips/filter_msa_intrinsics.c
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
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += intel/intel_init.c\
intel/filter_sse2_intrinsics.c
endif
if PNG_POWERPC_VSX
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += powerpc/powerpc_init.c\
powerpc/filter_vsx_intrinsics.c
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
# Include libpng extensions, if appropriate. This uses a Makefile.am fragment,
# pre-set things that might be changed by addition:
AM_CPPFLAGS =
DFA_EXTENSION =
if LIBPNG_EXTENSIONS
include $(top_srcdir)/contrib/extensions.am
endif
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
@ -170,14 +121,6 @@ else
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.sym
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/*
pkgincludedir= $(includedir)/$(PNGLIB_BASENAME)
pkginclude_HEADERS= png.h pngconf.h
@ -192,31 +135,31 @@ pkgconfig_DATA = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc
# from those directories being included. This only works if the configure is
# not done in the source directory!
EXTRA_DIST= \
ANNOUNCE AUTHORS CHANGES INSTALL LICENSE README TODO TRADEMARK \
ANNOUNCE CHANGES INSTALL LICENSE README TODO \
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
${srcdir}/ci ${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
$(TESTS) $(XFAIL_TESTS) tests/pngstest \
CMakeLists.txt example.c libpng-manual.txt
SCRIPT_CLEANFILES=scripts/*.out scripts/*.chk
SCRIPT_CLEANFILES=scripts/*.out scripts/*.chk scripts/pnglibconf.c
CLEANFILES= *.tf? pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers libpng.sym \
check.new pnglibconf.h pngprefix.h symbols.new pngtest-log.txt \
pnglibconf.out pnglibconf.c pnglibconf.pre pnglibconf.dfn \
pnglibconf.out pnglibconf.c pnglibconf.dfn pnglibconf.pre \
$(SCRIPT_CLEANFILES)
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
config.sub configure depcomp install-sh ltmain.sh missing
# PNG_COPTS give extra options for the C compiler to be used on all compilation
# steps (unless target_CFLAGS is specified; that will take precedence over
# steps (unless targe_CFLAGS is specified; that will take precedence over
# AM_CFLAGS)
PNG_COPTS = @PNG_COPTS@
AM_CFLAGS = ${PNG_COPTS}
# DFNCPP is normally just CPP - the C preprocessor - but on Solaris and maybe
# other operating systems (NeXT?) the C preprocessor selected by configure
# DFNCPP is normally just "CPP -E" - the C preprocessor - but on Solaris and
# maybe other operating systems (NeXT?) the C preprocessor selected by configure
# checks input tokens for validity - effectively it performs part of the ANSI-C
# parsing - and therefore fails with the .df files. configure.ac has special
# checks for this and sets DFNCPP appropriately.
@ -235,6 +178,8 @@ scripts/prefix.out: png.h pngconf.h pnglibconf.out
scripts/symbols.out: png.h pngconf.h $(srcdir)/scripts/pnglibconf.h.prebuilt
scripts/intprefix.out: pnglibconf.h
pnglibconf.out: config.h
libpng.sym: scripts/sym.out
rm -f $@
cp $? $@
@ -246,7 +191,7 @@ if DO_PNG_PREFIX
# Rename functions in scripts/prefix.out with a PNG_PREFIX prefix.
# Rename macros in scripts/macro.lst from PNG_PREFIXpng_ to PNG_ (the actual
# implementation of the macro).
pnglibconf.h: pnglibconf.out scripts/prefix.out scripts/macro.lst
pnglibconf.h: pnglibconf.out scripts/prefix.out scripts/macro.lst config.h
rm -f $@
$(AWK) 's==0 && NR>1{print prev}\
s==0{prev=$$0}\
@ -312,17 +257,17 @@ endif
rm -f $@ $*.tf[12]
test -d scripts || mkdir scripts || test -d scripts
$(DFNCPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)\
$(CPPFLAGS) $(SYMBOL_CFLAGS) $< > $*.tf1
$(AM_CPPFLAGS) $(CPPFLAGS) $(SYMBOL_CFLAGS) $< > $*.tf1
$(AWK) -f "${srcdir}/scripts/dfn.awk" out="$*.tf2" $*.tf1 1>&2
rm -f $*.tf1
mv $*.tf2 $@
# The .c file for pnglibconf.h is machine generated
pnglibconf.c: scripts/pnglibconf.dfa scripts/options.awk pngconf.h pngusr.dfa $(DFA_XTRA)
pnglibconf.c: scripts/pnglibconf.dfa scripts/options.awk pngconf.h pngusr.dfa $(DFA_EXTENSION) $(DFA_XTRA)
rm -f $@ $*.tf[45]
$(AWK) -f ${srcdir}/scripts/options.awk out=$*.tf4 version=search\
${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\
${srcdir}/pngusr.dfa $(DFA_XTRA) 1>&2
$(DFA_EXTENSION) ${srcdir}/pngusr.dfa $(DFA_XTRA) 1>&2
$(AWK) -f ${srcdir}/scripts/options.awk out=$*.tf5 $*.tf4 1>&2
rm $*.tf4
mv $*.tf5 $@
@ -340,8 +285,9 @@ scripts/symbols.chk: scripts/checksym.awk scripts/symbols.def scripts/symbols.ou
# be empty - no non-standard defines
scripts/pnglibconf.c: scripts/pnglibconf.dfa scripts/options.awk pngconf.h
rm -f $@ pnglibconf.tf[67]
test -z "$(CPPFLAGS)"
echo "com @PNGLIB_VERSION@ STANDARD API DEFINITION" |\
test -z "$(CPPFLAGS)" -a -z "$(AM_CPPFLAGS)"
(echo "com libpng @PNGLIB_VERSION@ STANDARD API DEFINITION";\
echo "com") |\
$(AWK) -f ${srcdir}/scripts/options.awk out=pnglibconf.tf6\
logunsupported=1 version=search ${srcdir}/pngconf.h -\
${srcdir}/scripts/pnglibconf.dfa 1>&2
@ -350,7 +296,7 @@ scripts/pnglibconf.c: scripts/pnglibconf.dfa scripts/options.awk pngconf.h
rm pnglibconf.tf6
mv pnglibconf.tf7 $@
$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS): png.h pngconf.h \
$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS): png.h pngconf.h pngchunk.h \
pnglibconf.h pngpriv.h pngdebug.h pnginfo.h pngstruct.h pngprefix.h
test: check-am

File diff suppressed because it is too large Load Diff

344
README
View File

@ -1,88 +1,56 @@
README for libpng version 1.6.51.git
====================================
README for libpng version 1.7.0beta88 - August 6, 2017 (shared library 17.0)
See the note about version numbers near the top of png.h
See the note about version numbers near the top of `png.h`.
See `INSTALL` for instructions on how to install libpng.
See INSTALL for instructions on how to install libpng.
Libpng comes in several distribution formats. Get `libpng-*.tar.gz`
or `libpng-*.tar.xz` if you want UNIX-style line endings in the text
files, or `lpng*.7z` or `lpng*.zip` if you want DOS-style line endings.
Libpng comes in several distribution formats. Get libpng-*.tar.gz or
libpng-*.tar.xz or if you want UNIX-style line endings in the text files,
or lpng*.7z or lpng*.zip if you want DOS-style line endings.
For a detailed description on using libpng, read `libpng-manual.txt`.
For 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`.
Version 0.89 was the first official release of libpng. Don't let the
fact that it's the first release fool you. The libpng library has been in
extensive use and testing since mid-1995. 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 < 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
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
****
Note that some of the changes to the png_info structure render this
version of the library binary incompatible with libpng-0.89 or
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 `png_uint_32`, which will affect shared-library applications that
use this function.
"filler" parameter for png_set_filler() has changed from png_byte to
png_uint_32, which will affect shared-library applications that use
this function.
To avoid problems with changes to the internals of the `info_struct`,
To avoid problems with changes to the internals of the png info_struct,
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
`png_get_<chunk>` functions. These functions should be used when
accessing/storing the `info_struct` data, rather than manipulating it
access to info_ptr. These functions are the png_set_<chunk> and
png_get_<chunk> functions. These functions should be used when
accessing/storing the info_struct data, rather than manipulating it
directly, to avoid such problems in the future.
It is important to note that the APIs did not make current programs
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
be a transitional release, members of the `png_struct` and the
`info_struct` can still be accessed, but the compiler will issue a
be a transitional release, members of the png_struct and the
info_struct can still be accessed, but the compiler will issue a
warning about deprecated usage. Since libpng-1.5.0, direct access
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 accessible to applications. It is strongly suggested that new
programs use the new APIs (as shown in `example.c` and `pngtest.c`),
and older programs be converted to the new format, to facilitate
upgrades in the future.
reside in private pngstruct.h and pnginfo.h header files that are not
accessible to applications. It is strongly suggested that new
programs use the new APIs (as shown in example.c and pngtest.c), and
older programs be converted to the new format, to facilitate 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
which has had some (or all) of the signature bytes read by the calling
@ -92,93 +60,157 @@ 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
critical or an ancillary chunk.
The 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 included 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-to-8 bit color
conversion. Some of these experimental functions, such as the weighted
filter heuristics, have since been removed.
The changes made to the library, and bugs fixed are based on discussions
on the PNG-implement mailing list and not on material submitted
privately to Guy, Andreas, or Glenn. They will forward any good
suggestions to the list.
Files included in this distribution
-----------------------------------
For a detailed description on using libpng, read libpng-manual.txt. For
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
ANNOUNCE => Announcement of this version, with recent changes
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
I have included a general makefile, as well as several machine and
compiler specific ones, but you may have to modify one for your own needs.
Good luck, and happy coding!
You should use zlib 1.0.4 or later to run this, but it MAY work with
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.
* Cosmin Truta (current maintainer, since 2018)
* Glenn Randers-Pehrson (former maintainer, 1998-2018)
* Andreas Eric Dilger (former maintainer, 1996-1997)
* Guy Eric Schalnat (original author and former maintainer, 1995-1996)
(formerly of Group 42, Inc.)
zlib should be available at the same place that libpng is, or at 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 libpng.sourceforge.io in the
[DOWNLOAD] area, and at ftp://ftp-osl.osuosl.org/pub/libpng/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)
pngchunk.h => PNG chunk descriptions (private, new in libpng17)
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
contrib => Contributions
examples => Example programs
gregbook => source code for PNG reading and writing, from
Greg Roelofs' "PNG: The Definitive Guide",
O'Reilly, 1999
libtests => Test programs
pngminim => Minimal decoder, encoder, and progressive decoder
programs demonstrating use of pngusr.dfa
pngminus => Simple pnm2png and png2pnm programs
pngsuite => Test images
tools => Various tools
visupng => Contains a MSVC workspace for VisualPng
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

51
TODO
View File

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

View File

@ -1,8 +0,0 @@
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

File diff suppressed because it is too large Load Diff

View File

@ -1,60 +0,0 @@
/* filter_neon.S - placeholder file
*
* Copyright (c) 2024 Cosmin Truta
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* 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
* definitions (or not) of PNG_ARM_NEON_OPT and PNG_ARM_NEON_IMPLEMENTATION.
*/
#define PNG_VERSION_INFO_ONLY
#include "../pngpriv.h"
#ifdef PNG_READ_SUPPORTED
#if PNG_ARM_NEON_IMPLEMENTATION == 2 /* hand-coded assembler */
#if PNG_ARM_NEON_OPT > 0
#if defined(__clang__)
#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
#define GNUC_VERSION 0 /* not gcc */
#endif
#if (GNUC_VERSION > 0) && (GNUC_VERSION < 40300)
#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
#endif /* PNG_ARM_NEON_OPT > 0 */
#endif /* PNG_ARM_NEON_IMPLEMENTATION == 2 */
#endif /* READ */

View File

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

View File

@ -1,11 +0,0 @@
# 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

View File

@ -1,19 +0,0 @@
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.

View File

@ -1,25 +0,0 @@
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

View File

@ -1,142 +0,0 @@
#!/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 "$@"

View File

@ -1,209 +0,0 @@
#!/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 "$@"

View File

@ -1,182 +0,0 @@
#!/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 "$@"

View File

@ -1,200 +0,0 @@
#!/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 "$@"

View File

@ -1,191 +0,0 @@
#!/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 "$@"

View File

@ -1,111 +0,0 @@
# 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

@ -1,48 +0,0 @@
#!/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 "$@"

View File

@ -1,49 +0,0 @@
#!/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 "$@"

View File

@ -1,49 +0,0 @@
#!/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 "$@"

View File

@ -1,46 +0,0 @@
#!/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

@ -1,16 +0,0 @@
# 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

@ -1,16 +0,0 @@
# 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

@ -1,16 +0,0 @@
# 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

@ -1,16 +0,0 @@
# 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

@ -1,18 +0,0 @@
# 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

@ -1,18 +0,0 @@
# 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

@ -1,15 +0,0 @@
# 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

@ -1,15 +0,0 @@
# 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

@ -1,14 +0,0 @@
# 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

@ -1,14 +0,0 @@
# 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

@ -1,14 +0,0 @@
# 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

@ -1,14 +0,0 @@
# 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

@ -1,21 +0,0 @@
# 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

@ -1,21 +0,0 @@
# 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

@ -1,21 +0,0 @@
# 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

@ -1,21 +0,0 @@
# 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

@ -1,21 +0,0 @@
# 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

@ -1,21 +0,0 @@
# 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

@ -1,21 +0,0 @@
# 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

@ -1,21 +0,0 @@
# 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

@ -1,21 +0,0 @@
# 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

@ -1,21 +0,0 @@
# 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

@ -1,21 +0,0 @@
# 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

@ -1,21 +0,0 @@
# 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

@ -1,21 +0,0 @@
# 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

@ -1,21 +0,0 @@
# 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

@ -1,21 +0,0 @@
# 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

@ -1,21 +0,0 @@
# 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

@ -1,21 +0,0 @@
# 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

@ -1,18 +0,0 @@
# 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

@ -1,18 +0,0 @@
# 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

@ -1,19 +0,0 @@
# 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

@ -1,18 +0,0 @@
# 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

@ -1,21 +0,0 @@
# 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

@ -1,18 +0,0 @@
# 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

@ -1,21 +0,0 @@
# 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

@ -1,18 +0,0 @@
# 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
View File

@ -1,364 +0,0 @@
#! /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

File diff suppressed because it is too large Load Diff

View File

@ -1,138 +0,0 @@
/* 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

File diff suppressed because it is too large Load Diff

18185
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,13 @@
# configure.ac
# Copyright (c) 2018-2024 Cosmin Truta
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
# Last changed in libpng 1.7.0 [(PENDING RELEASE)]
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
dnl Process this file with autoconf to produce a configure script.
dnl
dnl Minor upgrades (compatible ABI): increment the package version
@ -25,8 +26,8 @@ AC_PREREQ([2.68])
dnl Version number stuff here:
AC_INIT([libpng],[1.6.51.git],[png-mng-implement@lists.sourceforge.net])
AC_CONFIG_MACRO_DIR([scripts/autoconf])
AC_INIT([libpng],[1.7.0beta88],[png-mng-implement@lists.sourceforge.net])
AC_CONFIG_MACRO_DIR([scripts])
# libpng does not follow GNU file name conventions (hence 'foreign')
# color-tests requires automake 1.11 or later
@ -34,7 +35,8 @@ AC_CONFIG_MACRO_DIR([scripts/autoconf])
# dist-xz requires automake 1.11 or later
# 1.12.2 fixes a security issue in 1.11.2 and 1.12.1
# 1.13 is required for parallel tests
AM_INIT_AUTOMAKE([1.13 foreign dist-xz color-tests silent-rules subdir-objects])
# 1.14.1 is required for %reldir% support
AM_INIT_AUTOMAKE([1.15 foreign dist-xz color-tests silent-rules subdir-objects])
# The following line causes --disable-maintainer-mode to be the default to
# configure. This is necessary because libpng distributions cannot rely on the
# time stamps of the autotools generated files being correct
@ -46,17 +48,17 @@ dnl automake, so the following is not necessary (and is not defined anyway):
dnl AM_PREREQ([1.11.2])
dnl stop configure from automagically running automake
PNGLIB_VERSION=1.6.51.git
PNGLIB_VERSION=1.7.0beta88
PNGLIB_MAJOR=1
PNGLIB_MINOR=6
PNGLIB_RELEASE=51
PNGLIB_MINOR=7
PNGLIB_RELEASE=0
dnl End of version number stuff
AC_CONFIG_SRCDIR([pngget.c])
AC_CONFIG_HEADERS([config.h])
# Check the basic programs.
# Checks for programs.
AC_LANG([C])
AC_PROG_CC
AM_PROG_AS
@ -67,54 +69,33 @@ AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
dnl libtool/libtoolize; version 2.4.2 is the tested version. This or any
dnl libtool/libtoolize; version 2.4.4 is the tested version, this or any
dnl compatible later version may be used
LT_INIT([win32-dll])
LT_PREREQ([2.4.2])
LT_PREREQ([2.4.4])
dnl Declare the AWK variable.
AC_ARG_VAR(AWK, [AWK language processor])
# 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])
# Some awks crash when confronted with pnglibconf.dfa, do a test run now
# to make sure this doesn't happen
AC_MSG_CHECKING([that AWK works])
if ${AWK} -f ${srcdir}/scripts/options.awk out="/dev/null" version=search\
${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\
${srcdir}/pngusr.dfa 1>&2
then
AC_MSG_RESULT([yes])
AC_MSG_RESULT([ok])
else
AC_MSG_FAILURE([no], 1)
AC_MSG_FAILURE([failed], 1)
fi
# This is a remnant of the old cc -E validation, where it may have been
# necessary to use a different preprocessor for .dfn files
DFNCPP="$CPP"
DFNCPP="$CPP -E"
AC_SUBST(DFNCPP)
AC_ARG_ENABLE([tests],
AS_HELP_STRING([--disable-tests],
[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:
# -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,
[additional flags for the C compiler, to be used for options that would]
[additional flags for the C compiler, use this for options that would]
[cause configure itself to fail])
AC_ARG_ENABLE(werror,
AS_HELP_STRING([[[--enable-werror[=OPT]]]],
@ -135,52 +116,153 @@ AC_ARG_ENABLE(werror,
CFLAGS="$sav_CFLAGS"
fi],)
# 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. This is incompatible with the new default mode, so
# 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_COMPILE_IFELSE(
[AC_LANG_PROGRAM([
[#define _POSIX_SOURCE 1]
[#include <stdio.h>]
])],
AC_MSG_RESULT(no),[
if test "x$GCC" != "xyes"; then
AC_MSG_ERROR(
[Forcing back to C89 is required but the flags are only known for GCC])
fi
AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS -std=c89"
])
# Checks for header files.
AC_HEADER_STDC
# Headers used in pngpriv.h:
AC_CHECK_HEADERS([assert.h stdlib.h string.h float.h fp.h math.h m68881.h])
# Additional headers used in pngconf.h:
AC_CHECK_HEADERS([limits.h stddef.h stdio.h setjmp.h time.h])
# Used by pngread.c (for the simplified API):
AC_CHECK_HEADERS([errno.h])
# The following are not required for the standard 'make' build of libpng:
# Additional requirements of contrib/libtests/makepng.c:
AC_CHECK_HEADERS([ctype.h])
# Additional requirements of contrib/libtests/pngvalid.c:
AC_CHECK_HEADERS([fenv.h])
# Checks for structures and compiler characteristics.
AC_STRUCT_TM
# Checks for typedefs, structures, and compiler characteristics.
# Most of these have been removed from 1.7.0 because they checked for non-ANSI-C
# behaviors and the result were, anyway, not used by earlier versions of libpng.
AC_C_RESTRICT
# Checks for library functions.
AC_CHECK_FUNCS([pow], ,
[AC_CHECK_LIB([m], [pow], , [AC_MSG_ERROR([cannot find pow])])])
# Checks for library functions; these need to be in order, least demanding to
# most because the -l directives are added to the head of the list at each
# check.
# ANSI-C functions: all are required but they don't have to be implemented in
# libc, it is perfectly ok to configure with an extra, wrapper, library preset
# in LIBS. NOTE: this list may not be complete
AC_CHECK_FUNCS([memset memcpy strncpy],,
AC_MSG_FAILURE([missing ANSI-C functions]))
# Some later POSIX 1003.1 functions are required for test programs, failure
# here is soft (the corresponding test program is not built).
AC_CHECK_FUNC([clock_gettime], , [AC_MSG_WARN([not building timepng])])
# Some later POSIX 1003.1 functions are required for test programs, failure here
# is soft (the corresponding test program is not built).
AC_CHECK_FUNC([clock_gettime],,[AC_MSG_WARN([not building timepng])])
AM_CONDITIONAL([HAVE_CLOCK_GETTIME], [test "$ac_cv_func_clock_gettime" = "yes"])
AC_ARG_WITH(zlib-prefix,
AS_HELP_STRING([[[--with-zlib-prefix]]],
[prefix that may have been used in installed zlib]),
[ZPREFIX=${withval}],
[ZPREFIX='z_'])
AC_CHECK_LIB([z], [zlibVersion], ,
[AC_CHECK_LIB([z], [${ZPREFIX}zlibVersion], ,
[AC_MSG_ERROR([zlib not installed])])])
# floor and ceil are required for FLOATING_POINT, but they can be turned off on
# the configure command line (and they are independent.) Default is to 'on'
AC_ARG_ENABLE([floating-point],
AS_HELP_STRING([[[--enabled-floating-point]]],
[Enable floating point APIs (default: yes)]),,
[enable_floating_point=yes])
AC_ARG_ENABLE([fixed-point],
AS_HELP_STRING([[[--enable-fixed-point]]],
[Enable fixed point APIs (default: yes)]),,
[enable_fixed_point=yes])
AC_ARG_ENABLE([floating-arithmetic],
AS_HELP_STRING([[[--enable-floating-arithmetic]]],
[Use floating point arithmetic internally (default: yes)]),,
[enable_floating_arithmetic=yes])
# Check for a requirement for math library support
if test "$enable_floating_arithmetic" = yes
then
AC_SEARCH_LIBS([floor],[m],,
[AC_MSG_WARN([not found])
enable_floating_arithmetic=no])
AC_SEARCH_LIBS([frexp],[m],,
[AC_MSG_WARN([not found])
enable_floating_arithmetic=no])
AC_SEARCH_LIBS([modf],[m],,
[AC_MSG_WARN([not found])
enable_floating_arithmetic=no])
AC_SEARCH_LIBS([atof],[m],,
[AC_MSG_WARN([not found])
enable_floating_arithmetic=no])
AC_SEARCH_LIBS([pow],[m],,
[AC_MSG_WARN([not found])
enable_floating_arithmetic=no])
fi
# Set the relevant defines if required (only if required). This will override
# anything on the command line.
if test "$enable_floating_point" != yes
then
AC_MSG_NOTICE([Floating point APIs disabled])
AC_DEFINE([PNG_NO_FLOATING_POINT],[1],
[No support for floating point APIs])
fi
if test "$enable_fixed_point" != yes
then
AC_MSG_NOTICE([Fixed point APIs disabled])
AC_DEFINE([PNG_NO_FIXED_POINT],[1],
[No support for fixed point APIs])
fi
if test "$enable_floating_arithmetic" != yes
then
AC_MSG_NOTICE([Fixed point arithmetic will be used])
AC_DEFINE([PNG_NO_FLOATING_ARITHMETIC],[1],
[No support for floating point arithmetic])
fi
# 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
# library (typically), it's not an error if it is not found.
AC_CHECK_LIB([m], [feenableexcept])
AC_CHECK_FUNCS([feenableexcept])
AC_SEARCH_LIBS([feenableexcept],[m],AC_DEFINE([HAVE_FEENABLEEXCEPT],[1],
[Define to 1 if the feenableexcept function is available]))
# Required by pngvalid:
AC_SEARCH_LIBS([ceil],[m])
# zlib checks and arguments;
# package zlib: argument is the name of the library
# zlib-header: the name of the header file
# zlib-prefix: the prefix for library functions, if any
AC_ARG_WITH([zlib],
AS_HELP_STRING([[[--with-zlib=<name>]]],
[base name of the zlib implementation (e.g. 'z')]),,
[with_zlib='z'])
z_prefix=
AC_ARG_WITH([zlib-prefix],
AS_HELP_STRING([[[--with-zlib-prefix=<prefix>]]],
[prefix for zlib API functions]),
[if test "$withval" = "" -o "$withval" = yes; then
with_zlib_prefix='z_'
AC_DEFINE([PNG_ZLIB_PREFIX],[z_],[Standard zlib prefix])
elif test "${withval}" != "no"; then
AC_DEFINE_UNQUOTED([PNG_ZLIB_PREFIX],[${withval}],
[User defined zlib prefix])
else
with_zlib_prefix=
fi
if test "$with_zlib_prefix" != ""; then
AC_DEFINE([Z_PREFIX],[1],[Tell zlib.h to prefix function names])
z_prefix="#define Z_PREFIX 1"
fi])
AC_ARG_WITH([zlib-header],
AS_HELP_STRING([[[--with-zlib-header='<file>' or '"file"']]],
[C include argument to locate zlib header file, e.g. <zlib.h>, take
care to put single quotes round this on the command line]),
[AC_DEFINE_UNQUOTED([PNG_ZLIB_HEADER],[${withval}],[Zlib header file])],
with_zlib_header='<zlib.h>')
# AC_CHECK_LIB isn't quite enough for this because we need the special header
# file too.
LIBS="-l${with_zlib} $LIBS"
AC_MSG_CHECKING(
[[Library '${with_zlib}' and #include ${with_zlib_header} for symbol '${with_zlib_prefix}zlibVersion']])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[
${z_prefix}
#include ${with_zlib_header}
]],
[[(void)${with_zlib_prefix}zlibVersion();]])],
AC_MSG_RESULT([ok]),
AC_MSG_FAILURE([not found]))
AC_MSG_CHECKING([if using Solaris linker])
SLD=`$LD --version 2>&1 | grep Solaris`
@ -226,9 +308,9 @@ AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
if test "$have_ld_version_script" = "yes"; then
AC_MSG_CHECKING([for symbol prefix])
SYMBOL_PREFIX=`echo "PREFIX=__USER_LABEL_PREFIX__" \
| ${CPP:-${CC:-gcc} -E} - 2>&1 \
| ${EGREP:-grep} "^PREFIX=" \
| ${SED:-sed} -e "s:^PREFIX=::" -e "s:__USER_LABEL_PREFIX__::"`
| ${DFNCPP-${CC-gcc -E}} - 2>&1 \
| ${EGREP-grep} "^PREFIX=" \
| ${SED-sed} -e "s:^PREFIX=::" -e "s:__USER_LABEL_PREFIX__::"`
AC_SUBST(SYMBOL_PREFIX)
AC_MSG_RESULT($SYMBOL_PREFIX)
fi
@ -313,437 +395,16 @@ AC_ARG_ENABLE([unversioned-libpng-config],
AM_CONDITIONAL([DO_INSTALL_LIBPNG_CONFIG],
[test "$enable_unversioned_libpng_config" != "no"])
# HOST-SPECIFIC OPTIONS
# =====================
#
# DEFAULT
# =======
#
AC_ARG_ENABLE([hardware-optimizations],
AS_HELP_STRING([[[--enable-hardware-optimizations]]],
[Enable hardware optimizations: =no/off, yes/on.]),
[case "$enableval" in
no|off)
# disable hardware optimization on all systems:
enable_arm_neon=no
AC_DEFINE([PNG_ARM_NEON_OPT], [0],
[Disable ARM_NEON optimizations])
enable_mips_msa=no
AC_DEFINE([PNG_MIPS_MSA_OPT], [0],
[Disable MIPS_MSA optimizations])
enable_mips_mmi=no
AC_DEFINE([PNG_MIPS_MMI_OPT], [0],
[Disable MIPS_MMI optimizations])
enable_powerpc_vsx=no
AC_DEFINE([PNG_POWERPC_VSX_OPT], [0],
[Disable POWERPC VSX optimizations])
enable_intel_sse=no
AC_DEFINE([PNG_INTEL_SSE_OPT], [0],
[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:
case "$host_cpu" in
arm*|aarch64*)
enable_arm_neon=yes
AC_DEFINE([PNG_ARM_NEON_OPT], [2],
[Enable ARM_NEON optimizations])
;;
mipsel*|mips64el*)
enable_mips_mmi=yes
enable_mips_msa=yes
AC_DEFINE([PNG_MIPS_MMI_OPT], [1],
[Enable MIPS_MMI optimizations])
AC_DEFINE([PNG_MIPS_MSA_OPT], [2],
[Enable MIPS_MSA optimizations])
;;
i?86|x86_64)
enable_intel_sse=yes
AC_DEFINE([PNG_INTEL_SSE_OPT], [1],
[Enable Intel SSE optimizations])
;;
powerpc*|ppc64*)
enable_powerpc_vsx=yes
AC_DEFINE([PNG_POWERPC_VSX_OPT], [2],
[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])
# ARM NEON
# ========
AC_ARG_ENABLE([arm-neon],
AS_HELP_STRING([[[--enable-arm-neon]]],
[Enable ARM NEON 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 __ARM_NEON__ systems:
AC_DEFINE([PNG_ARM_NEON_OPT], [0],
[Disable ARM Neon optimizations])
# Prevent inclusion of the assembler files below:
enable_arm_neon=no ;;
check)
AC_DEFINE([PNG_ARM_NEON_CHECK_SUPPORTED], [],
[Check for ARM Neon support at run-time]);;
api)
AC_DEFINE([PNG_ARM_NEON_API_SUPPORTED], [],
[Turn on ARM Neon optimizations at run-time]);;
yes|on)
AC_DEFINE([PNG_ARM_NEON_OPT], [2],
[Enable ARM Neon optimizations])
AC_MSG_WARN([--enable-arm-neon: please specify 'check' or 'api';]
[if you want the optimizations unconditionally,]
[pass '-mfpu=neon' to the compiler.]);;
*)
AC_MSG_ERROR([--enable-arm-neon=${enable_arm_neon}:]
[invalid argument])
esac])
# 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 future host CPU does not match 'arm*'.)
AM_CONDITIONAL([PNG_ARM_NEON],
[test "$enable_arm_neon" != 'no' &&
case "$host_cpu" in
arm*|aarch64*) : ;;
*) test "$enable_arm_neon" != '' ;;
esac])
# MIPS MSA
# ========
AC_ARG_ENABLE([mips-msa],
AS_HELP_STRING([[[--enable-mips-msa]]],
[Enable MIPS MSA 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_msa systems:
AC_DEFINE([PNG_MIPS_MSA_OPT], [0],
[Disable MIPS MSA optimizations])
# Prevent inclusion of the assembler files below:
enable_mips_msa=no ;;
check)
AC_DEFINE([PNG_MIPS_MSA_CHECK_SUPPORTED], [],
[Check for MIPS MSA support at run-time]);;
api)
AC_DEFINE([PNG_MIPS_MSA_API_SUPPORTED], [],
[Turn on MIPS MSA optimizations at run-time]);;
yes|on)
AC_DEFINE([PNG_MIPS_MSA_OPT], [2],
[Enable MIPS MSA optimizations])
AC_MSG_WARN([--enable-mips-msa: please specify 'check' or 'api';]
[if you want the optimizations unconditionally,]
[pass '-mmsa -mfp64' to the compiler.]);;
*)
AC_MSG_ERROR([--enable-mips-msa=${enable_mips_msa}:]
[invalid argument])
esac])
# 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 future host CPU does not match 'mips*'.)
AM_CONDITIONAL([PNG_MIPS_MSA],
[test "$enable_mips_msa" != 'no' &&
case "$host_cpu" in
mipsel*|mips64el*) : ;;
esac])
# MIPS MMI
# ========
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],
AS_HELP_STRING([[[--enable-intel-sse]]],
[Enable Intel SSE optimizations: =no/off, yes/on.]
[no/off: disable the optimizations;]
[yes/on: enable the optimizations.]
[If not specified: determined by the compiler.]),
[case "$enableval" in
no|off)
# disable the default enabling:
AC_DEFINE([PNG_INTEL_SSE_OPT], [0],
[Disable Intel SSE optimizations])
# Prevent inclusion of the assembler files below:
enable_intel_sse=no ;;
yes|on)
AC_DEFINE([PNG_INTEL_SSE_OPT], [1],
[Enable Intel SSE optimizations]);;
*)
AC_MSG_ERROR([--enable-intel-sse=${enable_intel_sse}:]
[invalid argument])
esac])
# Add Intel-specific files to all builds where $host_cpu is Intel ('x86*') or
# where Intel optimizations were explicitly requested. (This allows a fallback
# if a future host CPU does not match 'x86*'.)
AM_CONDITIONAL([PNG_INTEL_SSE],
[test "$enable_intel_sse" != 'no' &&
case "$host_cpu" in
i?86|x86_64) : ;;
*) test "$enable_intel_sse" != '' ;;
esac])
# POWERPC VSX
# ===========
AC_ARG_ENABLE([powerpc-vsx],
AS_HELP_STRING([[[--enable-powerpc-vsx]]],
[Enable POWERPC VSX 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 unconditionally.]
[If not specified: determined by the compiler.]),
[case "$enableval" in
no|off)
# disable the default enabling on __ppc64__ systems:
AC_DEFINE([PNG_POWERPC_VSX_OPT], [0],
[Disable POWERPC VSX optimizations])
# Prevent inclusion of the platform-specific files below:
enable_powerpc_vsx=no ;;
check)
AC_DEFINE([PNG_POWERPC_VSX_CHECK_SUPPORTED], [],
[Check for POWERPC VSX support at run-time])
AC_MSG_WARN([--enable-powerpc-vsx: please see contrib/powerpc/README]
[for the list of supported systems.]);;
api)
AC_DEFINE([PNG_POWERPC_VSX_API_SUPPORTED], [],
[Turn on POWERPC VSX optimizations at run-time]);;
yes|on)
AC_DEFINE([PNG_POWERPC_VSX_OPT], [2],
[Enable POWERPC VSX optimizations])
AC_MSG_WARN([--enable-powerpc-vsx: please specify 'check' or 'api';]
[if you want the optimizations unconditionally,]
[pass '-maltivec -mvsx' or '-mcpu=power8' to the compiler.]);;
*)
AC_MSG_ERROR([--enable-powerpc-vsx=${enable_powerpc_vsx}:]
[invalid argument])
esac])
# Add PowerPC-specific files to all builds where $host_cpu is powerpc
# ('powerpc*') or where PowerPC optimizations were explicitly requested.
# (This allows a fallback if a future host CPU does not match 'powerpc*'.)
AM_CONDITIONAL([PNG_POWERPC_VSX],
[test "$enable_powerpc_vsx" != 'no' &&
case "$host_cpu" in
powerpc*|ppc64*) : ;;
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])
# EXTENSIONS
# Configure (and all other) support for extensions is included when autoconf is
# run by virtue of the existence (or not) of the following file:
sinclude([contrib/extensions.ac])
AM_CONDITIONAL([LIBPNG_EXTENSIONS],[test -n "$libpng_automake_extensions"])
AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]])
# Config files, substituting as above
AC_CONFIG_FILES([Makefile libpng.pc:libpng.pc.in])
AC_CONFIG_FILES([libpng-config:libpng-config.in],
[chmod +x libpng-config])
AC_CONFIG_FILES([Makefile libpng.pc])
AC_CONFIG_FILES([libpng-config], [chmod +x libpng-config])
AC_OUTPUT

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,8 @@
/* contrib/arm-neon/linux.c
*
* Copyright (c) 2014, 2017 Glenn Randers-Pehrson
* Written by John Bowler, 2014, 2017.
* Copyright (c) 2014 Glenn Randers-Pehrson
* Written by John Bowler, 2014.
* Last changed in libpng 1.6.16 [December 22, 2014]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
@ -18,7 +19,6 @@
* 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.
*/
#include <stdio.h>
static int
@ -62,7 +62,7 @@ png_have_neon(png_structp png_ptr)
counter=0;
state = Feature;
/* FALLTHROUGH */
/* FALL THROUGH */
case Feature:
/* Match 'FEATURE', ASCII case insensitive. */
@ -75,7 +75,7 @@ png_have_neon(png_structp png_ptr)
/* did not match 'feature' */
state = SkipLine;
/* FALLTHROUGH */
/* FALL THROUGH */
case SkipLine:
skipLine:
@ -110,7 +110,7 @@ png_have_neon(png_structp png_ptr)
state = Neon;
counter = 0;
/* FALLTHROUGH */
/* FALL THROUGH */
case Neon:
/* Look for 'neon' tag */
@ -122,7 +122,7 @@ png_have_neon(png_structp png_ptr)
}
state = SkipTag;
/* FALLTHROUGH */
/* FALL THROUGH */
case SkipTag:
/* Skip non-space characters */

View File

@ -1,133 +0,0 @@
# 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

@ -1,15 +0,0 @@
# 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

@ -1,14 +0,0 @@
# 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

@ -1,21 +0,0 @@
# 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

@ -1,19 +0,0 @@
# 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

@ -13,30 +13,15 @@
#
everything = off
# This option is specific to this configuration; it adds a #define to the
# generated pnglibconf.h which turns on the (not portable) timing option for
# pngcp. Note that any option is automatically preceded by PNG_; there is no
# way round this and this is deliberate.
option PNGCP_TIMING
# Because of the everything off above the option must also be turned on. This
# may not be done in one step because it is safer and avoids mis-spelled options
# in user .dfa files to error out if an unrecognized option is turned on.
option PNGCP_TIMING on
# Options to turn on png_read_png and png_write_png:
option INFO_IMAGE on
option SEQUENTIAL_READ on
option WRITE_PNG on
option READ_PNG on
option EASY_ACCESS on
option WRITE on
option WRITE_16BIT on
option WRITE_FILTER on
option SELECT_FILTER on
# pngcp needs this to preserve unknown chunks, switching all these on means that
# pngcp can work without explicit known chunk reading support
option UNKNOWN_CHUNKS on
option SET_UNKNOWN_CHUNKS on
option HANDLE_AS_UNKNOWN on
# pngcp can work without explicit known chunk reading suppport
option SAVE_UNKNOWN_CHUNKS on
option WRITE_UNKNOWN_CHUNKS on
@ -44,14 +29,10 @@ option WRITE_UNKNOWN_CHUNKS on
option CHECK_FOR_INVALID_INDEX on
option GET_PALETTE_MAX on
# Pre-libpng 1.7 pngcp has to stash text chunks manually, post 1.7 without this
# text chunks should be handled as unknown ok.
option TEXT on
# this is used to turn off limits:
option USER_LIMITS on
option SET_USER_LIMITS on
# these are just required for specific customizations
# these are are just required for specific customizations
option WRITE_CUSTOMIZE_ZTXT_COMPRESSION on
option WRITE_CUSTOMIZE_COMPRESSION on

View File

@ -1,13 +0,0 @@
# 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

@ -1,13 +0,0 @@
# 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

@ -1,143 +0,0 @@
---
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,3 +1,4 @@
This directory (contrib/examples) contains examples of libpng usage.
NO COPYRIGHT RIGHTS ARE CLAIMED TO ANY OF THE FILES IN THIS DIRECTORY.
@ -20,4 +21,4 @@ ORIGINAL AUTHORS
of the people below claim any rights with regard to the contents of this
directory.
John Bowler <jbowler at acm.org>
John Bowler <jbowler@acm.org>

View File

@ -10,7 +10,7 @@
* without processing the image. Notice that some header information may occur
* 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
* information in the section of the file that precedes the image data.
* information in the section of the file that preceeds the image data.
*
* Compile and link against libpng and zlib, plus anything else required on the
* system you use.
@ -26,9 +26,8 @@
#include <png.h>
#if !defined(PNG_iCCP_SUPPORTED) || !defined(PNG_READ_SUPPORTED)
#error This program requires libpng supporting the iCCP chunk and the read API
#endif
#if defined(PNG_READ_SUPPORTED) && defined(PNG_STDIO_SUPPORTED) && \
defined (PNG_iCCP_SUPPORTED)
static int verbose = 1;
@ -37,8 +36,7 @@ static png_byte no_profile[] = "no profile";
static png_bytep
extract(FILE *fp, png_uint_32 *proflen)
{
png_structp png_ptr =
png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,0,0,0);
png_infop info_ptr = NULL;
png_bytep result = NULL;
@ -71,7 +69,7 @@ extract(FILE *fp, png_uint_32 *proflen)
png_bytep profile;
if (png_get_iCCP(png_ptr, info_ptr, &name, &compression_type, &profile,
proflen) & PNG_INFO_iCCP)
proflen) & PNG_INFO_iCCP)
{
result = malloc(*proflen);
if (result != NULL)
@ -82,7 +80,7 @@ extract(FILE *fp, png_uint_32 *proflen)
}
else
result = no_profile;
result = no_profile;
}
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
@ -109,7 +107,7 @@ extract_one_file(const char *filename)
const char *ep = strrchr(filename, '.');
if (ep != NULL)
len = ep - filename;
len = ep-filename;
else
len = strlen(filename);
@ -121,14 +119,14 @@ extract_one_file(const char *filename)
FILE *of;
memcpy(output, filename, len);
strcpy(output + len, ".icc");
strcpy(output+len, ".icc");
of = fopen(output, "wb");
if (of != NULL)
{
if (fwrite(profile, proflen, 1, of) == 1 &&
fflush(of) == 0 &&
fclose(of) == 0)
fflush(of) == 0 &&
fclose(of) == 0)
{
if (verbose)
printf("%s -> %s\n", filename, output);
@ -157,15 +155,12 @@ extract_one_file(const char *filename)
}
else if (verbose && profile == no_profile)
printf("%s has no profile\n", filename);
printf("%s has no profile\n", filename);
}
else
fprintf(stderr, "%s: could not open file\n", filename);
if (fp != NULL)
fclose(fp);
return result;
}
@ -175,7 +170,7 @@ main(int argc, char **argv)
int i;
int extracted = 0;
for (i = 1; i < argc; ++i)
for (i=1; i<argc; ++i)
{
if (strcmp(argv[i], "-q") == 0)
verbose = 0;
@ -187,3 +182,4 @@ main(int argc, char **argv)
/* Exit code is true if any extract succeeds */
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
* deal with the interlace for you, but that obliges you to buffer half of the
* image to assemble the interlaced rows. In this code
* png_set_interlace_handling() is not called and, instead, the code handles
* the interlace passes directly looking for the required pixel.
* png_set_interlace_handling() is not called and, instead, the code handles the
* interlace passes directly looking for the required pixel.
*/
#include <stdlib.h>
#include <stdio.h>
@ -27,37 +27,34 @@
*/
#include "../../png.h"
#if !defined(PNG_READ_SUPPORTED) || !defined(PNG_SEQUENTIAL_READ_SUPPORTED)
#error This program requires libpng supporting the read and sequential read API
#endif
#if defined(PNG_READ_SUPPORTED) && defined(PNG_SEQUENTIAL_READ_SUPPORTED)
/* Return component 'c' of pixel 'x' from the given row. */
static unsigned int
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, which means they can be up to
* 2^37 bits wide (for a 64-bit pixel - the largest possible) and hence
* 2^34 bytes wide. Since the row fitted into memory, the following must
/* PNG images can be up to 2^31 pixels wide, but this means they can be up to
* 2^37 bits wide (for a 64-bit pixel - the largest possible) and hence 2^34
* bytes wide. Since the row fitted into memory, however, the following must
* work:
*/
png_uint_32 bit_offset_hi = bit_depth * ((x >> 6) * channels);
png_uint_32 bit_offset_lo = bit_depth * ((x & 0x3f) * channels + c);
row = (png_const_bytep)(((const png_byte(*)[8])row) + bit_offset_hi);
row = (png_const_bytep)(((PNG_CONST png_byte (*)[8])row) + bit_offset_hi);
row += bit_offset_lo >> 3;
bit_offset_lo &= 0x07;
/* 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 first, so:
* bits of the byte and into two bytes for 16-bit values with the high 8 bits
* first, so:
*/
switch (bit_depth)
{
case 1: return (row[0] >> (7 - bit_offset_lo)) & 0x01;
case 2: return (row[0] >> (6 - bit_offset_lo)) & 0x03;
case 4: return (row[0] >> (4 - bit_offset_lo)) & 0x0f;
case 1: return (row[0] >> (7-bit_offset_lo)) & 0x01;
case 2: return (row[0] >> (6-bit_offset_lo)) & 0x03;
case 4: return (row[0] >> (4-bit_offset_lo)) & 0x0f;
case 8: return row[0];
case 16: return (row[0] << 8) + row[1];
default:
@ -74,9 +71,9 @@ component(png_const_bytep row, png_uint_32 x, unsigned int c,
*/
static void
print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
png_uint_32 x)
png_uint_32 x)
{
unsigned int bit_depth = png_get_bit_depth(png_ptr, info_ptr);
PNG_CONST unsigned int bit_depth = png_get_bit_depth(png_ptr, info_ptr);
switch (png_get_color_type(png_ptr, info_ptr))
{
@ -90,29 +87,27 @@ print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
*/
case PNG_COLOR_TYPE_PALETTE:
{
int index = component(row, x, 0, bit_depth, 1);
PNG_CONST int index = component(row, x, 0, bit_depth, 1);
png_colorp palette = NULL;
int num_palette = 0;
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;
int num_trans = 0;
if ((png_get_tRNS(png_ptr, info_ptr, &trans_alpha, &num_trans,
NULL) & PNG_INFO_tRNS) &&
(num_trans > 0) &&
(trans_alpha != NULL))
NULL) & PNG_INFO_tRNS) && num_trans > 0 &&
trans_alpha != NULL)
printf("INDEXED %u = %d %d %d %d\n", index,
palette[index].red, palette[index].green,
palette[index].blue,
index < num_trans ? trans_alpha[index] : 255);
palette[index].red, palette[index].green,
palette[index].blue,
index < num_trans ? trans_alpha[index] : 255);
else /* no transparency */
printf("INDEXED %u = %d %d %d\n", index, palette[index].red,
palette[index].green, palette[index].blue);
printf("INDEXED %u = %d %d %d\n", index,
palette[index].red, palette[index].green,
palette[index].blue);
}
else
@ -122,20 +117,20 @@ print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
case PNG_COLOR_TYPE_RGB:
printf("RGB %u %u %u\n", component(row, x, 0, bit_depth, 3),
component(row, x, 1, bit_depth, 3),
component(row, x, 2, bit_depth, 3));
component(row, x, 1, bit_depth, 3),
component(row, x, 2, bit_depth, 3));
return;
case PNG_COLOR_TYPE_GRAY_ALPHA:
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;
case PNG_COLOR_TYPE_RGB_ALPHA:
printf("RGBA %u %u %u %u\n", component(row, x, 0, bit_depth, 4),
component(row, x, 1, bit_depth, 4),
component(row, x, 2, bit_depth, 4),
component(row, x, 3, bit_depth, 4));
component(row, x, 1, bit_depth, 4),
component(row, x, 2, bit_depth, 4),
component(row, x, 3, bit_depth, 4));
return;
default:
@ -143,8 +138,7 @@ 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
* mechanism, therefore any local variable that exists before the call to
@ -152,7 +146,7 @@ main(int argc, const char **argv)
* be declared with 'volatile' to ensure that their values don't get
* destroyed by longjmp:
*/
volatile int result = 1 /*fail*/;
volatile int result = 1/*fail*/;
if (argc == 4)
{
@ -169,8 +163,8 @@ main(int argc, const char **argv)
* writes error messages to stderr. Creating the png_struct is a
* little tricky; just copy the following code.
*/
png_structp png_ptr =
png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
NULL, NULL, NULL);
if (png_ptr != NULL)
{
@ -190,11 +184,11 @@ main(int argc, const char **argv)
compression_method, filter_method;
png_bytep row_tmp;
/* Now associate the recently opened FILE object with the
* default libpng initialization functions. Sometimes libpng
* is compiled without stdio support (it can be difficult to
* do in some environments); in that case you will have to
* write your own read callback to read data from the stream.
/* Now associate the recently opened (FILE*) with the default
* libpng initialization functions. Sometimes libpng is
* compiled without stdio support (it can be difficult to do
* in some environments); in that case you will have to write
* your own read callback to read data from the (FILE*).
*/
png_init_io(png_ptr, f);
@ -208,21 +202,21 @@ main(int argc, const char **argv)
* space. In this case png_malloc is used - it will not
* return if memory isn't available.
*/
row =
png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr));
row = png_malloc(png_ptr, png_get_rowbytes(png_ptr,
info_ptr));
/* Avoid the overhead of using a volatile auto copy row_tmp
/* To avoid the overhead of using a volatile auto copy row_tmp
* to a local here - just use row for the png_free below.
*/
row_tmp = row;
/* All the information we need is in the header returned by
* png_get_IHDR. If this fails, we can use 'png_error' to
/* All the information we need is in the header is returned by
* png_get_IHDR, if this fails we can now use 'png_error' to
* signal the error and return control to the setjmp above.
*/
if (png_get_IHDR(png_ptr, info_ptr, &width, &height,
&bit_depth, &color_type, &interlace_method,
&compression_method, &filter_method))
&bit_depth, &color_type, &interlace_method,
&compression_method, &filter_method))
{
int passes, pass;
@ -248,7 +242,7 @@ main(int argc, const char **argv)
/* Now read the pixels, pass-by-pass, row-by-row: */
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 py;
@ -305,27 +299,19 @@ main(int argc, const char **argv)
* are, of course, much better ways of doing this
* than using a for loop:
*/
if (y == py)
if (y == py) for (px = xstart, ppx = 0;
px < width; px += xstep, ++ppx) if (x == px)
{
for (px = xstart, ppx = 0;
px < width;
px += xstep, ++ppx)
{
if (x == px)
{
/* 'ppx' is the index of the pixel in the
* row buffer.
*/
print_pixel(png_ptr, info_ptr, row_tmp,
ppx);
/* '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
* found and handled the required data.
*/
goto pass_loop_end;
} /* x loop */
}
}
/* Now terminate the loops early - we have
* found and handled the required data.
*/
goto pass_loop_end;
} /* x loop */
} /* y loop */
} /* pass loop */
@ -337,6 +323,7 @@ main(int argc, const char **argv)
else
png_error(png_ptr, "pngpixel: png_get_IHDR failed");
}
else
@ -362,8 +349,7 @@ main(int argc, const char **argv)
}
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);
}
@ -382,3 +368,4 @@ main(int argc, const char **argv)
return result;
}
#endif /* READ && SEQUENTIAL_READ */

View File

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

View File

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

16
contrib/extensions.ac Normal file
View File

@ -0,0 +1,16 @@
# CONTRIBUTED EXTENSIONS
#
# The following extensions are part of a standard libpng distribution. They are
# not supported parts of libpng and they are not necessarily released under the
# same license as libpng. Please consult the relevant directory for copyright
# and support information before uncommenting any of the lines below.
#
# After you change this file you MUST re-run "autoreconf" to regenerate the
# configure script, otherwise the change may have no effect.
#
# Include the ARM NEON extension:
#sinclude([contrib/neon/neon.ac])
#
# If any of the extensions require automake support (this is likely) automake
# must include the file contrib/extensions.am
#libpng_automake_extensions="yes"

7
contrib/extensions.am Normal file
View File

@ -0,0 +1,7 @@
# CONTRIBUTED EXTENSIONS
#
# Please read the file "contrib/extensions.ac" before making changes to this
# file.
#
# Include the ARM NEON extension:
#include %reldir%/neon/neon.am

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