Compare commits

...

623 Commits

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

View File

@@ -1,5 +1,5 @@
Libpng 1.2.10rc1 - April 19, 2006 Libpng 1.4.5beta06 - November 21, 2010
This is not intended to be a public release. It will be replaced This is not intended to be a public release. It will be replaced
within a few weeks by a public version or by another test version. within a few weeks by a public version or by another test version.
@@ -9,68 +9,69 @@ Files available for download:
Source files with LF line endings (for Unix/Linux) and with a Source files with LF line endings (for Unix/Linux) and with a
"configure" script "configure" script
1.2.10rc1.tar.gz 1.4.5beta06.tar.xz (LZMA-compressed, recommended)
1.2.10rc1.tar.bz2 1.4.5beta06.tar.gz
1.4.5beta06.tar.bz2
Source files with LF line endings (for Unix/Linux) without the
"configure" script
1.2.10rc1-no-config.tar.gz
1.2.10rc1-no-config.tar.bz2
Source files with CRLF line endings (for Windows), without the Source files with CRLF line endings (for Windows), without the
"configure" script "configure" script
lp1210r01.zip lp145b06.zip
lp1210r01.tar.bz2 lp145b06.7z
Project files
1.2.10rc1-project-netware.zip
1.2.10rc1-project-wince.zip
Other information: Other information:
1.2.10rc1-README.txt 1.4.5beta06-README.txt
1.2.10rc1-KNOWNBUGS.txt 1.4.5beta06-LICENSE.txt
1.2.10rc1-LICENSE.txt
1.2.10rc1-Y2K-compliance.txt
Changes since the last public release (1.2.9): Changes since the last public release (1.4.4):
version 1.2.10beta1 [April 15, 2006] version 1.4.5beta01 [September 25, 2010]
Renamed "config.h" to "png_conf.h" and revised Makefile.am to add Fixed possible configure.ac bug introduced in version 1.4.4rc05.
-DPNG_BUILDING_LIBPNG to compile directive, and modified pngconf.h Rebuilt configure scripts with autoconf-2.68 instead of autoconf-2.65
to include png_conf.h only when PNG_BUILDING_LIBPNG is defined.
version 1.2.10beta2 [April 15, 2006] version 1.4.5beta02 [October 5, 2010]
Manually updated Makefile.in and configure. Changed png_conf.h.in Reverted configure scripts to autoconf-2.65
back to config.h. Fixed problem with symbols creation in Makefile.am which was assuming that
all versions of cpp write to standard output by default (Martin Banky). The
bug was introduced in libpng-1.2.9beta5.
version 1.2.10beta3 [April 15, 2006] version 1.4.5beta03 [October 8, 2010]
Change png_conf.h back to config.h in pngconf.h. Wrapped long lines in CMakeLists.txt and introduced ${libpng_public_hdrs}
Undid Makefile.am revision of 1.4.5beta02.
version 1.2.10beta4 [April 16, 2006] version 1.4.5beta04 [November 8, 2010]
Change PNG_BUILDING_LIBPNG to PNG_CONFIGURE_LIBPNG in config/Makefile*. Check for out-of-range text compression mode in png_set_text().
version 1.2.10beta5 [April 16, 2006] version 1.4.5rc01 [November 19, 2010]
Added a configure check for compiling assembler code in pnggccrd.c No changes.
version 1.2.10beta6 [April 17, 2006] version 1.4.5beta05 [November 21, 2010]
Revised the configure check for pnggccrd.c Removed some extraneous parentheses that appeared in pngrutil.c of
Moved -DPNG_CONFIGURE_LIBPNG into @LIBPNG_DEFINES@ libpng-1.4.3beta01
Added @LIBPNG_DEFINES@ to arguments when building libpng.sym Revised png_get_uint_32, png_get_int_32, png_get_uint_16 (Cosmin)
Moved reading of file signature into png_read_sig (Cosmin)
Fixed atomicity of chunk header serialization (Cosmin)
Added test for io_state in pngtest.c (Cosmin)
Added "#!/bin/sh" at the top of contrib/pngminim/*/gather.sh scripts.
version 1.2.10beta7 [April 18, 2006] version 1.4.5beta06 [November 21, 2010]
Change "exec_prefix=$prefix" to "exec_prefix=$(prefix)" in makefiles. Restored the parentheses in pngrutil.c; they are needed when the
png_get_*int_*() functions are compiled (i.e., when PNG_USE_READ_MACROS
is not defined).
Make the "png_get_uint_16" macro return a png_uint_32 in libpng-1.4 for API
compatibility.
Changes to remove gcc warnings (John Bowler)
Certain optional gcc warning flags resulted in warnings in libpng code.
With these changes only -Wconversion and -Wcast-qual cannot be turned on.
Changes are trivial rearrangements of code. -Wconversion is not possible
for pngrutil.c (because of the widespread use of += et al on variables
smaller than (int) or (unsigned int)) and -Wcast-qual is not possible
with pngwio.c and pngwutil.c because the 'write' callback and zlib
compression both fail to declare their input buffers with 'const'.
version 1.2.10beta8 [April 19, 2006] Send comments/corrections/commendations to glennrp at users.sourceforge.net
Ensure pngconf.h doesn't define both PNG_USE_PNGGCCRD and PNG_USE_PNGVCRD or to png-mng-implement at lists.sf.net (subscription required; visit
Fixed "LN_FS" typo in makefile.sco and makefile.solaris. https://lists.sourceforge.net/lists/listinfo/png-mng-implement).
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe) or to glennrp at users.sourceforge.net
Glenn R-P Glenn R-P

1203
CHANGES

File diff suppressed because it is too large Load Diff

374
CMakeLists.txt Normal file
View File

@@ -0,0 +1,374 @@
cmake_minimum_required(VERSION 2.4.4)
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
if(UNIX AND NOT DEFINED CMAKE_BUILD_TYPE)
if(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION EQUAL 4)
# workaround CMake 2.4.x bug
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
"Choose the type of build, options are:
None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used)
Debug
Release
RelWithDebInfo
MinSizeRel.")
else()
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
"Choose the type of build, options are:
None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used)
Debug
Release
RelWithDebInfo
MinSizeRel.")
endif()
endif()
project(libpng C)
enable_testing()
# Copyright (C) 2007-2010 Glenn Randers-Pehrson
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
set(PNGLIB_MAJOR 1)
set(PNGLIB_MINOR 4)
set(PNGLIB_RELEASE 5)
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
# needed packages
find_package(ZLIB REQUIRED)
include_directories(${ZLIB_INCLUDE_DIR})
if(NOT WIN32)
find_library(M_LIBRARY
NAMES m
PATHS /usr/lib /usr/local/lib
)
if(NOT M_LIBRARY)
message(STATUS
"math library 'libm' not found - floating point support disabled")
endif()
else()
# not needed on windows
set(M_LIBRARY "")
endif()
# COMMAND LINE OPTIONS
if(DEFINED PNG_SHARED)
option(PNG_SHARED "Build shared lib" ${PNG_SHARED})
else()
option(PNG_SHARED "Build shared lib" ON)
endif()
if(DEFINED PNG_STATIC)
option(PNG_STATIC "Build static lib" ${PNG_STATIC})
else()
option(PNG_STATIC "Build static lib" ON)
endif()
if(MINGW)
option(PNG_TESTS "Build pngtest" NO)
else()
option(PNG_TESTS "Build pngtest" YES)
endif()
option(PNG_NO_CONSOLE_IO "FIXME" YES)
option(PNG_NO_STDIO "FIXME" YES)
option(PNG_DEBUG "Build with debug output" NO)
option(PNGARG "FIXME" YES)
#TODO:
# PNG_CONSOLE_IO_SUPPORTED
# maybe needs improving, but currently I don't know when we can enable what :)
set(png_asm_tmp "OFF")
if(NOT WIN32)
find_program(uname_executable NAMES uname PATHS /bin /usr/bin /usr/local/bin)
if(uname_executable)
exec_program(${uname_executable}
ARGS --machine OUTPUT_VARIABLE uname_output)
if("uname_output" MATCHES "^.*i[1-9]86.*$")
set(png_asm_tmp "ON")
else("uname_output" MATCHES "^.*i[1-9]86.*$")
set(png_asm_tmp "OFF")
endif("uname_output" MATCHES "^.*i[1-9]86.*$")
endif(uname_executable)
else()
# this env var is normally only set on win64
set(TEXT "ProgramFiles(x86)")
if("$ENV{${TEXT}}" STREQUAL "")
set(png_asm_tmp "ON")
endif("$ENV{${TEXT}}" STREQUAL "")
endif()
# SET LIBNAME
set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR})
# to distinguish between debug and release lib
set(CMAKE_DEBUG_POSTFIX "d")
# OUR SOURCES
set(libpng_public_hdrs
png.h
pngconf.h
)
set(libpng_sources
${libpng_public_hdrs}
pngpriv.h
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
)
set(pngtest_sources
pngtest.c
)
# SOME NEEDED DEFINITIONS
add_definitions(-DPNG_CONFIGURE_LIBPNG)
if(_AIX)
add_definitions(-D_ALL_SOURCE)
endif(_AIX)
if(MSVC)
add_definitions(-DPNG_NO_MODULEDEF -D_CRT_SECURE_NO_DEPRECATE)
endif(MSVC)
if(PNG_SHARED OR NOT MSVC)
#if building msvc static this has NOT to be defined
add_definitions(-DZLIB_DLL)
endif()
if(PNG_CONSOLE_IO_SUPPORTED)
add_definitions(-DPNG_CONSOLE_IO_SUPPORTED)
endif()
if(PNG_NO_CONSOLE_IO)
add_definitions(-DPNG_NO_CONSOLE_IO)
endif()
if(PNG_NO_STDIO)
add_definitions(-DPNG_NO_STDIO)
endif()
if(PNG_DEBUG)
add_definitions(-DPNG_DEBUG)
endif()
if(NOT M_LIBRARY AND NOT WIN32)
add_definitions(-DPNG_NO_FLOATING_POINT_SUPPORTED)
endif()
# NOW BUILD OUR TARGET
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIR})
if(PNG_SHARED)
add_library(${PNG_LIB_NAME} SHARED ${libpng_sources})
if(MSVC)
# msvc does not append 'lib' - do it here to have consistent name
set_target_properties(${PNG_LIB_NAME} PROPERTIES PREFIX "lib")
set_target_properties(${PNG_LIB_NAME} PROPERTIES IMPORT_PREFIX "lib")
endif()
target_link_libraries(${PNG_LIB_NAME} ${ZLIB_LIBRARY} ${M_LIBRARY})
endif()
if(PNG_STATIC)
# does not work without changing name
set(PNG_LIB_NAME_STATIC ${PNG_LIB_NAME}_static)
add_library(${PNG_LIB_NAME_STATIC} STATIC ${libpng_sources})
if(MSVC)
# msvc does not append 'lib' - do it here to have consistent name
set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES PREFIX "lib")
endif()
target_link_libraries(${PNG_LIB_NAME_STATIC} ${ZLIB_LIBRARY} ${M_LIBRARY})
endif()
if(PNG_SHARED AND WIN32)
set_target_properties(${PNG_LIB_NAME} PROPERTIES DEFINE_SYMBOL PNG_BUILD_DLL)
endif()
if(PNG_TESTS AND PNG_SHARED)
# does not work with msvc due to png_lib_ver issue
add_executable(pngtest ${pngtest_sources})
target_link_libraries(pngtest ${PNG_LIB_NAME})
add_test(pngtest ./pngtest ${CMAKE_CURRENT_SOURCE_DIR}/pngtest.png)
endif()
#
# Set a variable with CMake code which:
# Creates a symlink from src to dest (if possible) or alternatively
# copies if different.
macro(_png_generate_symlink_code CODE SRC DEST)
if(WIN32 AND NOT CYGWIN)
set(_png_gsc_message "Copying ${SRC} to ${DEST} if needed")
set(_png_gsc_operation "copy_if_different")
else()
set(_png_gsc_message "Symlinking ${SRC} to ${DEST}")
set(_png_gsc_operation "create_symlink")
endif()
set(${CODE} "
message(STATUS \"${_png_gsc_message}\")
execute_process(COMMAND \${CMAKE_COMMAND} -E ${_png_gsc_operation}
\"${SRC}\" \"${DEST}\")
")
endmacro()
# CREATE PKGCONFIG FILES
# we use the same files like ./configure, so we have to set its vars
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
set(CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib)
endif(NOT DEFINED CMAKE_INSTALL_LIBDIR)
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix ${CMAKE_INSTALL_PREFIX})
set(libdir ${CMAKE_INSTALL_LIBDIR})
set(includedir ${CMAKE_INSTALL_PREFIX}/include)
set(LIBS "-lz -lm")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc @ONLY)
_png_generate_symlink_code(PNG_PC_INSTALL_CODE ${PNGLIB_NAME}.pc libpng.pc)
install(CODE ${PNG_PC_INSTALL_CODE})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config @ONLY)
_png_generate_symlink_code(PNG_CONFIG_INSTALL_CODE ${PNGLIB_NAME}-config
libpng-config)
install(CODE ${PNG_CONFIG_INSTALL_CODE})
# SET UP LINKS
if(PNG_SHARED)
set_target_properties(${PNG_LIB_NAME} PROPERTIES
# VERSION 14.${PNGLIB_RELEASE}.1.4.5beta06
VERSION 14.${PNGLIB_RELEASE}.0
SOVERSION 14
CLEAN_DIRECT_OUTPUT 1)
endif()
if(PNG_STATIC)
# MSVC doesn't use a different file extension for shared vs. static
# libs. We are able to change OUTPUT_NAME to remove the _static
# for all other platforms.
if(NOT MSVC)
set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES
OUTPUT_NAME ${PNG_LIB_NAME}
CLEAN_DIRECT_OUTPUT 1)
endif()
endif()
# If CMake > 2.4.x, we set a variable used below to export
# targets to an export file.
# TODO: Use VERSION_GREATER after our cmake_minimum_required >= 2.6.2
if(CMAKE_MAJOR_VERSION GREATER 1 AND CMAKE_MINOR_VERSION GREATER 4)
set(PNG_EXPORT_RULE EXPORT libpng)
elseif(CMAKE_MAJOR_VERSION GREATER 2) # future proof
set(PNG_EXPORT_RULE EXPORT libpng)
endif()
# INSTALL
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
if(PNG_SHARED)
install(TARGETS ${PNG_LIB_NAME}
${PNG_EXPORT_RULE}
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
# Create a symlink for libpng.dll.a => libpng14.dll.a on Cygwin
if(CYGWIN)
_png_generate_symlink_code(PNG_SHARED_IMPLIB_INSTALL_CODE
${PNGLIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}
libpng${CMAKE_IMPORT_LIBRARY_SUFFIX})
install(CODE ${PNG_SHARED_IMPLIB_INSTALL_CODE})
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
if(NOT WIN32)
_png_generate_symlink_code(PNG_SHARED_INSTALL_CODE
${PNGLIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
libpng${CMAKE_SHARED_LIBRARY_SUFFIX})
install(CODE ${PNG_SHARED_INSTALL_CODE})
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
endif()
if(PNG_STATIC)
install(TARGETS ${PNG_LIB_NAME_STATIC}
${PNG_EXPORT_RULE}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(NOT WIN32 OR CYGWIN)
_png_generate_symlink_code(PNG_STATIC_INSTALL_CODE
${PNGLIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}
libpng${CMAKE_STATIC_LIBRARY_SUFFIX})
install(CODE ${PNG_STATIC_INSTALL_CODE})
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
endif()
endif()
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
install(FILES ${libpng_public_hdrs} DESTINATION include)
install(FILES ${libpng_public_hdrs} DESTINATION include/${PNGLIB_NAME})
endif()
if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL )
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config DESTINATION bin)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
DESTINATION bin)
endif()
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
# Install man pages
if(NOT PNG_MAN_DIR)
set(PNG_MAN_DIR "share/man")
endif()
install(FILES libpng.3 libpngpf.3 DESTINATION ${PNG_MAN_DIR}/man3)
install(FILES png.5 DESTINATION ${PNG_MAN_DIR}/man5)
# Install pkg-config files
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config
DESTINATION bin)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
DESTINATION bin)
endif()
# On versions of CMake that support it, create an export file CMake
# users can include() to import our targets
if(PNG_EXPORT_RULE AND NOT SKIP_INSTALL_EXPORT AND NOT SKIP_INSTALL_ALL )
install(EXPORT libpng DESTINATION lib/libpng FILE lib${PNG_LIB_NAME}.cmake)
endif()
# what's with libpng.txt and all the extra files?
# UNINSTALL
# do we need this?
# DIST
# do we need this?
# to create msvc import lib for mingw compiled shared lib
# pexports libpng.dll > libpng.def
# lib /def:libpng.def /machine:x86

145
INSTALL
View File

@@ -1,22 +1,33 @@
Installing libpng version 1.2.10rc1 - April 19, 2006 Installing libpng version 1.4.5beta06 - November 21, 2010
On Unix/Linux and similar systems, you can simply type On Unix/Linux and similar systems, you can simply type
./autogen.sh ./configure [--prefix=/path]
./configure [--prefix=$HOME]
make check make check
make install make install
and ignore the rest of this document. and ignore the rest of this document.
Or you can use one of the custom-built makefiles in the If configure does not work on your system and you have a reasonably
up-to-date set of tools, running ./autogen.sh before running ./configure
may fix the problem. You can also run the individual commands in
autogen.sh with the --force option, if supported by your version of
the tools. If you run 'libtoolize --force', though, this will replace
the distributed, patched, version of ltmain.sh with an unpatched version
and your shared library builds may fail to produce libraries with the
correct version numbers.
Instead, you can use one of the custom-built makefiles in the
"scripts" directory "scripts" directory
cp scripts/makefile.system makefile cp scripts/makefile.system makefile
make test make test
make install make install
The files that are presently available in the scripts directory
are listed and described in scripts/README.txt.
Or you can use one of the "projects" in the "projects" directory. Or you can use one of the "projects" in the "projects" directory.
Before installing libpng, you must first install zlib, if it Before installing libpng, you must first install zlib, if it
@@ -24,13 +35,19 @@ is not already on your system. zlib can usually be found
wherever you got libpng. zlib can be placed in another directory, wherever you got libpng. zlib can be placed in another directory,
at the same level as libpng. at the same level as libpng.
If you want to use "cmake" (see www.cmake.org), type
cmake . -DCMAKE_INSTALL_PREFIX=/path
make
make install
If your system already has a preinstalled zlib you will still need 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 to have access to the zlib.h and zconf.h include files that
correspond to the version of zlib that's installed. correspond to the version of zlib that's installed.
You can rename the directories that you downloaded (they You can rename the directories that you downloaded (they
might be called "libpng-1.2.10rc1" or "lpng109" and "zlib-1.2.1" might be called "libpng-1.4.5beta06" or "libpng14" and "zlib-1.2.3"
or "zlib121") so that you have directories called "zlib" and "libpng". or "zlib123") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this: Your directory structure should look like this:
@@ -40,19 +57,27 @@ Your directory structure should look like this:
README README
*.h *.h
*.c *.c
CMakeLists.txt => "cmake" script
configuration files:
configure.ac, configure, Makefile.am, Makefile.in,
autogen.sh, config.guess, ltmain.sh, missing,
aclocal.m4, config.h.in, config.sub,
depcomp, install-sh, test-pngtest.sh
contrib contrib
gregbook gregbook
pngminim
pngminus pngminus
pngsuite pngsuite
visupng visupng
projects projects
beos cbuilder5 (Borland)
c5builder (Borland)
visualc6 (msvc) visualc6 (msvc)
netware.txt visualc71
wince.txt vstudio
xcode
scripts scripts
makefile.* makefile.*
*.def (module definition files)
pngtest.png pngtest.png
etc. etc.
zlib zlib
@@ -67,83 +92,13 @@ distribution of libpng. It is available in both tar.gz (UNIX style line
endings) and zip (DOS style line endings) formats. endings) and zip (DOS style line endings) formats.
If you are building libpng with MSVC, you can enter the If you are building libpng with MSVC, you can enter the
libpng projects\visualc6 directory and follow the instructions in libpng projects\visualc6 or visualc71 directory and follow the instructions
projects\visualc6\README.txt. in README.txt.
You can build libpng for WindowsCE by downloading and installing Otherwise enter the zlib directory and follow the instructions in zlib/README,
the projects\wince directory as instructed in the projects\wince.txt file, and
then following the instructions in the README* files. Similarly, you can
build libpng for Netware or Beos as instructed in projects\netware.txt
or projects\beos.
Else enter the zlib directory and follow the instructions in zlib/README,
then come back here and run "configure" or choose the appropriate then come back here and run "configure" or choose the appropriate
makefile.sys in the scripts directory. makefile.sys in the scripts directory.
The files that are presently available in the scripts directory
include
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.elf => Linux/ELF makefile symbol versioning,
gcc, creates libpng12.so.0.1.2.10rc1)
makefile.linux => Linux/ELF makefile
(gcc, creates libpng12.so.0.1.2.10rc1)
makefile.gcmmx => Linux/ELF makefile
(gcc, creates libpng12.so.0.1.2.10rc1,
uses assembler code tuned for Intel MMX platform)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with
ansi2knr (Requires ansi2knr.c from
ftp://ftp.cs.wisc.edu/ghost)
makefile.aix => AIX/gcc makefile
makefile.cygwin => Cygwin/gcc makefile
makefile.darwin => Darwin makefile, can use on MacosX
makefile.dec => DEC Alpha UNIX makefile
makefile.freebsd => FreeBSD makefile
makefile.hpgcc => HPUX makefile using gcc
makefile.hpux => HPUX (10.20 and 11.00) makefile
makefile.hp64 => HPUX (10.20 and 11.00) makefile, 64-bit
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
makefile.intel => Intel C/C++ version 4.0 and later
libpng.icc => Project file for IBM VisualAge/C++ version 4.0 or later
makefile.netbsd => NetBSD/cc makefile, uses PNGGCCRD, makes libpng.so.
makefile.ne12bsd => NetBSD/cc makefile, uses PNGGCCRD,
makes libpng12.so
makefile.openbsd => OpenBSD makefile
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
makefile.sggcc => Silicon Graphics (gcc,
creates libpng12.so.0.1.2.10rc1)
makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile (gcc,
creates libpng12.so.0.1.2.10rc1)
makefile.so9 => Solaris 9 makefile (gcc,
creates libpng12.so.0.1.2.10rc1)
makefile.32sunu => Sun Ultra 32-bit makefile
makefile.64sunu => Sun Ultra 64-bit makefile
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.mips => MIPS makefile
makefile.acorn => Acorn makefile
makefile.amiga => Amiga makefile
smakefile.ppc => AMIGA smakefile for SAS C V6.58/7.00 PPC compiler
(Requires SCOPTIONS, copied from scripts/SCOPTIONS.ppc)
makefile.atari => Atari makefile
makefile.beos => BEOS makefile for X86
makefile.bor => Borland makefile (uses bcc)
makefile.bc32 => 32-bit Borland C++ (all modules compiled in C mode)
makefile.tc3 => Turbo C 3.0 makefile
makefile.dj2 => DJGPP 2 makefile
makefile.msc => Microsoft C makefile
makefile.vcawin32 => makefile for Microsoft Visual C++ 5.0 and later (uses
assembler code tuned for Intel MMX platform)
makefile.vcwin32 => makefile for Microsoft Visual C++ 4.0 and later (does
not use assembler code)
makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def)
pngos2.def => OS/2 module definition file used by makefile.os2
makefile.watcom => Watcom 10a+ Makefile, 32-bit flat memory model
makevms.com => VMS build script
descrip.mms => VMS makefile for MMS or MMK
SCOPTIONS.ppc => Used with smakefile.ppc
Copy the file (or files) that you need from the Copy the file (or files) that you need from the
scripts directory into this directory, for example scripts directory into this directory, for example
@@ -173,9 +128,11 @@ run "make install".
If you encounter a compiler error message complaining about the If you encounter a compiler error message complaining about the
lines lines
__png.h__ already includes setjmp.h; __png.h__ already includes setjmp.h;
__dont__ include it again.; __dont__ include it again.;
This means you have compiled another module that includes setjmp.h,
this means you have compiled another module that includes setjmp.h,
which is hazardous because the two modules might not include exactly which is hazardous because the two modules might not include exactly
the same setjmp.h. If you are sure that you know what you are doing the same setjmp.h. If you are sure that you know what you are doing
and that they are exactly the same, then you can comment out or and that they are exactly the same, then you can comment out or
@@ -185,23 +142,3 @@ instead, as demonstrated in contrib/visupng of the libpng distribution.
Further information can be found in the README and libpng.txt Further information can be found in the README and libpng.txt
files, in the individual makefiles, in png.h, and the manual pages files, in the individual makefiles, in png.h, and the manual pages
libpng.3 and png.5. libpng.3 and png.5.
Using the ./configure script -- 16 December 2002.
=================================================
The ./configure script should work compatibly with what scripts/makefile.*
did, however there are some options you need to add to configure explicitly,
which previously was done semi-automatically (if you didn't edit
scripts/makefile.* yourself, that is)
CFLAGS="-Wall -O3 -funroll-loops \
-malign-loops=2 -malign-functions=2" ./configure --prefix=/usr/include \
--with-pkgconfigdir=/usr/lib/pkgconfig --includedir=/usr/include
You can alternatively specify --includedir=/usr/include, /usr/local/include,
/usr/include/png12, or whatever.

View File

@@ -1,23 +0,0 @@
Known bugs in libpng version 1.2.10rc1
1. April 22, 2001: pnggccrd.c has been reported to crash on NetBSD when
reading interlaced PNG files, when assembler code is enabled but running
on a non-MMX i386 platform.
STATUS: Under investigation. The change to pnggccrd.c in libpng-1.2.1
fixed a problem under FreeBSD but not the problem with NetBSD, which
still fails as of libpng-1.2.2rc1.
2. February 23, 2006: The custom makefiles don't build libpng with -lz.
STATUS: This is a subject of debate. The change will probably be made
as a part of a major overhaul of the makefiles in libpng version 1.3.0.
3. February 24, 2006: The Makefile generated by the "configure" script
fails to install symbolic links
libpng12.so => libpng12.so.0.1.2.9betaN
that are generated by the custom makefiles.
STATUS: For now, system library builders should use the custom makefiles.

View File

@@ -8,8 +8,10 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
If you modify libpng you may insert additional notices immediately following If you modify libpng you may insert additional notices immediately following
this sentence. this sentence.
libpng versions 1.2.6, August 15, 2004, through 1.2.10rc1, April 19, 2006, are This code is released under the libpng license.
Copyright (c) 2004, 2006 Glenn Randers-Pehrson, and are
libpng versions 1.2.6, August 15, 2004, through 1.4.5beta06, November 21, 2010, are
Copyright (c) 2004, 2006-2010 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5 distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors with the following individual added to the list of Contributing Authors
@@ -106,4 +108,4 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson Glenn Randers-Pehrson
glennrp at users.sourceforge.net glennrp at users.sourceforge.net
April 19, 2006 November 21, 2010

View File

@@ -1,14 +1,8 @@
# Makefile.am: # Makefile.am:
# Source file for Makefile.in (and hence Makefile) # Source file for Makefile.in (and hence Makefile)
# #
# Makefile.am need only be changed on a major version number
# change (e.g. libpng12 --> libpng13). In that case seach
# this file for every instance of the old base name (libpng12)
# and change to the new one (libpng13), then change the
# -version-number settings below so that the new values have
# the correct major part (first field).
PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@ PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
# libpng does not follow GNU file name conventions # libpng does not follow GNU file name conventions
AUTOMAKE_OPTIONS = foreign AUTOMAKE_OPTIONS = foreign
@@ -16,47 +10,44 @@ AUTOMAKE_OPTIONS = foreign
# test programs - run on make check, make distcheck # test programs - run on make check, make distcheck
check_PROGRAMS= pngtest check_PROGRAMS= pngtest
pngtest_SOURCES = pngtest.c pngtest_SOURCES = pngtest.c
pngtest_LDADD = libpng12.la pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
TESTS = test-pngtest.sh TESTS = test-pngtest.sh
TESTS_ENVIRONMENT= srcdir=$(srcdir) TESTS_ENVIRONMENT= srcdir=$(srcdir)
# man pages # man pages
dist_man_MANS= libpng.3 libpngpf.3 png.5 dist_man_MANS= libpng.3 libpngpf.3 png.5
# generate the -config scripts if required # generate the -config scripts if required
binconfigs= libpng12-config binconfigs= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config
EXTRA_SCRIPTS= libpng-config libpng12-config EXTRA_SCRIPTS= libpng-config libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config
bin_SCRIPTS= @binconfigs@ bin_SCRIPTS= @binconfigs@
# rules to build libpng, only build the old library on request # rules to build libpng, only build the old library on request
lib_LTLIBRARIES=libpng12.la @compatlib@ lib_LTLIBRARIES=libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
EXTRA_LTLIBRARIES= libpng.la # EXTRA_LTLIBRARIES= libpng.la
libpng12_la_SOURCES = png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngset.c pngget.c pngrutil.c \
pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \ pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c pnggccrd.c \ pngwtran.c pngmem.c pngerror.c pngpread.c \
png.h pngconf.h png.h pngconf.h pngpriv.h
libpng_la_SOURCES = $(libpng12_la_SOURCES)
libpng_la_CPPFLAGS = @LIBPNG_DEFINES@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS = @LIBPNG_DEFINES@
libpng12_la_CPPFLAGS = @LIBPNG_DEFINES@
# MAJOR UPGRADE: the version-number settings below must be changed. libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined -export-dynamic \
libpng12_la_LDFLAGS = -no-undefined -export-dynamic \ -version-number @PNGLIB_MAJOR@@PNGLIB_MINOR@:@PNGLIB_RELEASE@:0
-version-number 0:@PNGLIB_MINOR@:0
# -rpath is needed as automake doesn't know the directory
libpng_la_LDFLAGS = -rpath '$(libdir)' -no-undefined -export-dynamic \
-version-number 3:@PNGLIB_MINOR@:0
if HAVE_LD_VERSION_SCRIPT if HAVE_LD_VERSION_SCRIPT
# Versioned symbols and restricted exports # Versioned symbols and restricted exports
libpng12_la_LDFLAGS += -Wl,--version-script=libpng.vers libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -Wl,--version-script=libpng.vers
libpng12_la_DEPENDENCIES = libpng.vers libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.vers
else else
# Only restricted exports when possible # Only restricted exports when possible
libpng12_la_LDFLAGS += -export-symbols libpng.sym libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -export-symbols libpng.sym
libpng12_la_DEPENDENCIES = libpng.sym libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.sym
endif endif
libpng_la_DEPENDENCIES = $(libpng12_la_DEPENDENCIES)
# Avoid depending upon Character Ranges.
AN = '_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
#distribute headers in /usr/include/libpng/* #distribute headers in /usr/include/libpng/*
pkgincludedir= $(includedir)/$(PNGLIB_BASENAME) pkgincludedir= $(includedir)/$(PNGLIB_BASENAME)
@@ -65,27 +56,29 @@ pkginclude_HEADERS= png.h pngconf.h
# pkg-config stuff, note that libpng.pc is always required in order # pkg-config stuff, note that libpng.pc is always required in order
# to get the correct library # to get the correct library
pkgconfigdir = @pkgconfigdir@ pkgconfigdir = @pkgconfigdir@
pkgconfig_DATA = libpng12.pc pkgconfig_DATA = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc
#extra source distribution files. #extra source distribution files.
EXTRA_DIST= \ EXTRA_DIST= \
ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO \ ANNOUNCE CHANGES INSTALL LICENSE README TODO \
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \ pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
${srcdir}/projects/cbuilder5/* \
${srcdir}/projects/beos/* \
${srcdir}/projects/visualc6/* \ ${srcdir}/projects/visualc6/* \
${srcdir}/projects/visualc71/* \ ${srcdir}/projects/visualc71/* \
${srcdir}/projects/wince.txt \ ${srcdir}/projects/xcode/* \
${srcdir}/projects/netware.txt \
${srcdir}/scripts/* \ ${srcdir}/scripts/* \
${srcdir}/contrib/gregbook/* \ ${srcdir}/contrib/gregbook/* \
${srcdir}/contrib/pngminim/* \
${srcdir}/contrib/pngminus/* \ ${srcdir}/contrib/pngminus/* \
${srcdir}/contrib/pngsuite/* \ ${srcdir}/contrib/pngsuite/* \
${srcdir}/contrib/visupng/* \ ${srcdir}/contrib/visupng/* \
$(TESTS) \ $(TESTS) \
example.c libpng.txt pngvcrd.c example.c libpng-*.txt
CLEANFILES= pngout.png libpng12.pc libpng12-config libpng.vers libpng.sym CLEANFILES= pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers \
libpng.sym
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
config.sub configure depcomp install-sh ltmain.sh missing
$(PNGLIB_BASENAME).pc: libpng.pc $(PNGLIB_BASENAME).pc: libpng.pc
cp libpng.pc $@ cp libpng.pc $@
@@ -96,48 +89,44 @@ $(PNGLIB_BASENAME)-config: libpng-config
libpng.sym: png.h pngconf.h libpng.sym: png.h pngconf.h
rm -f $@ $@.new rm -f $@ $@.new
$(CPP) @LIBPNG_DEFINES@ $(CPPFLAGS) -DPNG_BUILDSYMS $(srcdir)/png.h | \ $(CPP) @LIBPNG_DEFINES@ $(CPPFLAGS) -DPNG_BUILDSYMS $(srcdir)/png.h | \
$(SED) -n -e 's|^.*PNG_FUNCTION_EXPORT[ ]*\([a-zA-Z0-9_]*\).*$$|\1|p' \ $(SED) -n -e \
-e 's|^.*PNG_DATA_EXPORT[ ]*\([a-zA-Z0-9_]*\).*$$|\1|p' \ 's|^.*PNG_FUNCTION_EXPORT[ ]*\([$(AN)]*\).*$$|$(SYMBOL_PREFIX)\1|p' \
-e 's|^.*PNG_DATA_EXPORT[ ]*\([$(AN)]*\).*$$|$(SYMBOL_PREFIX)\1|p' \
>$@.new >$@.new
mv $@.new $@ mv $@.new $@
libpng.vers: libpng.sym libpng.vers: libpng.sym
rm -f $@ $@.new rm -f $@ $@.new
$(ECHO) PNG@PNGLIB_MAJOR@_0 '{global:' > $@.new echo PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0 '{global:' > $@.new
$(SED) s/$$/\;/ libpng.sym >> $@.new $(SED) s/$$/\;/ libpng.sym >> $@.new
$(ECHO) 'local: *; };' >> $@.new echo 'local: *; };' >> $@.new
mv $@.new $@ mv $@.new $@
test: check
# install the .../include headers as links to the new ones # install the .../include headers as links to the new ones
install-data-hook: install-data-hook:
cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h
cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/png.h png.h cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/png.h png.h
cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/pngconf.h pngconf.h cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/pngconf.h \
pngconf.h
cd $(DESTDIR)$(pkgconfigdir); rm -f libpng.pc cd $(DESTDIR)$(pkgconfigdir); rm -f libpng.pc
cd $(DESTDIR)$(pkgconfigdir); $(LN_S) $(PNGLIB_BASENAME).pc libpng.pc cd $(DESTDIR)$(pkgconfigdir); $(LN_S) $(PNGLIB_BASENAME).pc libpng.pc
# do evil things to libpng to cause libpng12 to be used, if # do evil things to libpng to cause libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ to be used
# the compat library is not being built do nothing.
install-exec-hook: install-exec-hook:
cd $(DESTDIR)$(bindir); rm -f libpng-config cd $(DESTDIR)$(bindir); rm -f libpng-config
cd $(DESTDIR)$(bindir); $(LN_S) $(PNGLIB_BASENAME)-config libpng-config cd $(DESTDIR)$(bindir); $(LN_S) $(PNGLIB_BASENAME)-config libpng-config
@if test -n "@compatlib@"; then\ @set -x;\
set -x;\ cd $(DESTDIR)$(libdir);\
cd $(DESTDIR)$(libdir);\ for ext in a la so so.@PNGLIB_MAJOR@@PNGLIB_MINOR@.@PNGLIB_RELEASE@ sl dylib dll.a; do\
for ext in a la so; do\ rm -f libpng.$$ext;\
rm -f libpng.$$ext;\ if test -f $(PNGLIB_BASENAME).$$ext; then\
$(LN_S) $(PNGLIB_BASENAME).$$ext libpng.$$ext;\ $(LN_S) $(PNGLIB_BASENAME).$$ext libpng.$$ext;\
done;\ fi;\
fi done
uninstall-hook: uninstall-hook:
cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h
rm -f $(DESTDIR)$(pkgconfigdir)/libpng.pc rm -f $(DESTDIR)$(pkgconfigdir)/libpng.pc
rm -f $(DESTDIR)$(bindir)/libpng-config rm -f $(DESTDIR)$(bindir)/libpng-config
@if test -n "@compatlib@"; then\
set -x;\
cd $(DESTDIR)$(libdir);\
for ext in a la so; do\
rm -f libpng.$$ext;\
done;\
fi

File diff suppressed because it is too large Load Diff

78
README
View File

@@ -1,11 +1,11 @@
README for libpng version 1.2.10rc1 - April 19, 2006 (shared library 12.0) README for libpng version 1.4.5beta06 - November 21, 2010 (shared library 14.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 Libpng comes in several distribution formats. Get libpng-*.tar.gz,
or libpng-*.tar.bz2 if you want UNIX-style line endings in the text libpng-*.tar.xz or libpng-*.tar.bz2 if you want UNIX-style line endings
files, or lpng*.zip if you want DOS-style line endings. in the text files, or lpng*.zip if you want DOS-style line endings.
Version 0.89 was the first official release of libpng. Don't let the 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 fact that it's the first release fool you. The libpng library has been in
@@ -54,9 +54,9 @@ to set different actions based on whether the CRC error occurred in a
critical or an ancillary chunk. critical or an ancillary chunk.
The changes made to the library, and bugs fixed are based on discussions The changes made to the library, and bugs fixed are based on discussions
on the PNG-implement mailing list on the PNG-implement mailing list and not on material submitted
and not on material submitted privately to Guy, Andreas, or Glenn. They will privately to Guy, Andreas, or Glenn. They will forward any good
forward any good suggestions to the list. suggestions to the list.
For a detailed description on using libpng, read libpng.txt. For For a detailed description on using libpng, read libpng.txt. For
examples of libpng in a program, see example.c and pngtest.c. For usage examples of libpng in a program, see example.c and pngtest.c. For usage
@@ -101,16 +101,17 @@ Finally, if you get any warning messages when compiling libpng
fix. Please mention "libpng" somewhere in the subject line. Thanks. fix. Please mention "libpng" somewhere in the subject line. Thanks.
This release was created and will be supported by myself (of course 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 group. 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.sf.net Send comments/corrections/commendations to png-mng-implement at
(subscription required; visit lists.sourceforge.net (subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe) or to glennrp at users.sourceforge.net to subscribe) or to glennrp at users.sourceforge.net
You can't reach Guy, the original libpng author, at the addresses 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 given in previous versions of this document. He and Andreas will
addressed to the png-implement list, however. read mail addressed to the png-implement list, however.
Please do not send general questions about PNG. Send them to Please do not send general questions about PNG. Send them to
the (png-list at ccrc.wustl.edu, subscription required, write to the (png-list at ccrc.wustl.edu, subscription required, write to
@@ -147,7 +148,6 @@ Files in this distribution:
png.c => Basic interface functions common to library png.c => Basic interface functions common to library
png.h => Library function and interface declarations png.h => Library function and interface declarations
pngconf.h => System specific library configuration pngconf.h => System specific library configuration
pngasmrd.h => Header file for assembler-coded functions
pngerror.c => Error/warning message I/O functions pngerror.c => Error/warning message I/O functions
pngget.c => Functions for retrieving info from struct pngget.c => Functions for retrieving info from struct
pngmem.c => Memory handling functions pngmem.c => Memory handling functions
@@ -174,28 +174,20 @@ Files in this distribution:
pngminus => Simple pnm2png and png2pnm programs pngminus => Simple pnm2png and png2pnm programs
pngsuite => Test images pngsuite => Test images
visupng => Contains a MSVC workspace for VisualPng visupng => Contains a MSVC workspace for VisualPng
projects => Contains project files and workspaces for building DLL projects => Contains project files and workspaces for
beos => Contains a Beos workspace for building libpng building a DLL
c5builder => Contains a Borland workspace for building libpng c5builder => Contains a Borland workspace for building
and zlib libpng and zlib
visualc6 => Contains a Microsoft Visual C++ (MSVC) workspace visualc6 => Contains a Microsoft Visual C++ (MSVC)
for building libpng and zlib workspace for building libpng and zlib
netware.txt => Contains instructions for downloading a set of
project files for building libpng and zlib on
Netware.
wince.txt => Contains instructions for downloading a Microsoft
Visual C++ (Windows CD Toolkit) workspace for
building libpng and zlib on WindowsCE
scripts => Directory containing scripts for building libpng: scripts => Directory containing scripts for building libpng:
descrip.mms => VMS makefile for MMS or MMK descrip.mms => VMS makefile for MMS or MMK
makefile.std => Generic UNIX makefile (cc, creates static libpng.a) makefile.std => Generic UNIX makefile (cc, creates static
libpng.a)
makefile.elf => Linux/ELF makefile symbol versioning, makefile.elf => Linux/ELF makefile symbol versioning,
gcc, creates libpng12.so.0.1.2.10rc1) (gcc, creates libpng14.so.14.1.4.5beta06)
makefile.linux => Linux/ELF makefile makefile.linux => Linux/ELF makefile
(gcc, creates libpng12.so.0.1.2.10rc1) (gcc, creates libpng14.so.14.1.4.5beta06)
makefile.gcmmx => Linux/ELF makefile
(gcc, creates libpng12.so.0.1.2.10rc1,
uses assembler code tuned for Intel MMX platform)
makefile.gcc => Generic makefile (gcc, creates static libpng.a) makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with makefile.knr => Archaic UNIX Makefile that converts files with
ansi2knr (Requires ansi2knr.c from ansi2knr (Requires ansi2knr.c from
@@ -210,18 +202,19 @@ Files in this distribution:
makefile.hp64 => HPUX (10.20 and 11.00) makefile, 64 bit makefile.hp64 => HPUX (10.20 and 11.00) makefile, 64 bit
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static) makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
makefile.intel => Intel C/C++ version 4.0 and later makefile.intel => Intel C/C++ version 4.0 and later
libpng.icc => Project file, IBM VisualAge/C++ 4.0 or later makefile.mingw => Mingw/gcc makefile
makefile.netbsd => NetBSD/cc makefile, PNGGCCRD, makes libpng.so. makefile.netbsd => NetBSD/cc makefile, makes libpng.so.
makefile.ne12bsd => NetBSD/cc makefile, PNGGCCRD, makes libpng12.so makefile.ne14bsd => NetBSD/cc makefile, makes
libpng14.so
makefile.openbsd => OpenBSD makefile makefile.openbsd => OpenBSD makefile
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib) makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
makefile.sggcc => Silicon Graphics makefile.sggcc => Silicon Graphics
(gcc, creates libpng12.so.0.1.2.10rc1) (gcc, creates libpng14.so.14.1.4.5beta06)
makefile.sunos => Sun makefile makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile makefile.solaris => Solaris 2.X makefile
(gcc, creates libpng12.so.0.1.2.10rc1) (gcc, creates libpng14.so.14.1.4.5beta06)
makefile.so9 => Solaris 9 makefile makefile.so9 => Solaris 9 makefile
(gcc, creates libpng12.so.0.1.2.10rc1) (gcc, creates libpng14.so.14.1.4.5beta06)
makefile.32sunu => Sun Ultra 32-bit makefile makefile.32sunu => Sun Ultra 32-bit makefile
makefile.64sunu => Sun Ultra 64-bit makefile makefile.64sunu => Sun Ultra 64-bit makefile
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
@@ -238,20 +231,21 @@ Files in this distribution:
makefile.tc3 => Turbo C 3.0 makefile makefile.tc3 => Turbo C 3.0 makefile
makefile.dj2 => DJGPP 2 makefile makefile.dj2 => DJGPP 2 makefile
makefile.msc => Microsoft C makefile makefile.msc => Microsoft C makefile
makefile.vcawin32=> makefile for Microsoft Visual C++ 5.0 and
later (uses assembler code tuned for Intel MMX
platform)
makefile.vcwin32 => makefile for Microsoft Visual C++ 4.0 and makefile.vcwin32 => makefile for Microsoft Visual C++ 4.0 and
later (does not use assembler code) later (does not use assembler code)
makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def) makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def)
pngos2.def => OS/2 module definition file used by makefile.os2 png32ce.def => module definition for makefile.cegccg
pngos2.def => OS/2 module definition file used by
makefile.os2
pngwin.def => module definition file used by
makefile.cygwin and makefile.mingw
makefile.watcom => Watcom 10a+ Makefile, 32-bit flat memory model makefile.watcom => Watcom 10a+ Makefile, 32-bit flat memory model
makevms.com => VMS build script makevms.com => VMS build script
SCOPTIONS.ppc => Used with smakefile.ppc SCOPTIONS.ppc => Used with smakefile.ppc
Good luck, and happy coding. Good luck, and happy coding.
-Glenn Randers-Pehrson (current maintainer) -Glenn Randers-Pehrson (current maintainer, since 1998)
Internet: glennrp at users.sourceforge.net Internet: glennrp at users.sourceforge.net
-Andreas Eric Dilger (former maintainer, 1996-1997) -Andreas Eric Dilger (former maintainer, 1996-1997)

11
TODO
View File

@@ -1,3 +1,4 @@
/*
TODO - list of things to do for libpng: TODO - list of things to do for libpng:
Final bug fixes. Final bug fixes.
@@ -8,7 +9,7 @@ Fix problem with C++ and EXTERN "C".
cHRM transformation. cHRM transformation.
Improve setjmp/longjmp usage or remove it in favor of returning error codes. Improve setjmp/longjmp usage or remove it in favor of returning error codes.
Add "grayscale->palette" transformation and "palette->grayscale" detection. Add "grayscale->palette" transformation and "palette->grayscale" detection.
Improved dithering. Improved quantizing and dithering.
Multi-lingual error and warning message support. Multi-lingual error and warning message support.
Complete sRGB transformation (presently it simply uses gamma=0.45455). Complete sRGB transformation (presently it simply uses gamma=0.45455).
Man pages for function calls. Man pages for function calls.
@@ -17,8 +18,14 @@ Better filter selection
(counting huffman bits/precompression? filter inertia? filter costs?). (counting huffman bits/precompression? filter inertia? filter costs?).
Histogram creation. Histogram creation.
Text conversion between different code pages (Latin-1 -> Mac and DOS). Text conversion between different code pages (Latin-1 -> Mac and DOS).
Should we always malloc 2^bit_depth PLTE/tRNS/hIST entries for safety?
Build gamma tables using fixed point (and do away with floating point entirely). Build gamma tables using fixed point (and do away with floating point entirely).
Avoid building gamma tables whenever possible.
Use greater precision when changing to linear gamma for compositing against Use greater precision when changing to linear gamma for compositing against
background and doing rgb-to-gray transformation. background and doing rgb-to-gray transformation.
Investigate pre-incremented loop counters and other loop constructions. Investigate pre-incremented loop counters and other loop constructions.
Add interpolated method of handling interlacing.
Provide for conditional compilation of 16-bit support (except for the
initial stripping down to 8-bits when reading a 16-bit PNG datastream).
Switch to the simpler zlib (zlib/libpng) license if legally possible.
*/

55
Y2KINFO
View File

@@ -1,55 +0,0 @@
Y2K compliance in libpng:
=========================
April 19, 2006
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
upward through 1.2.10rc1 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer
that will hold years up to 65535. The other two hold the date in text
format, and will hold years up to 9999.
The integer is
"png_uint_16 year" in png_time_struct.
The strings are
"png_charp time_buffer" in png_struct and
"near_time_buffer", which is a local character string in png.c.
There are seven time-related functions:
png_convert_to_rfc_1123() in png.c
(formerly png_convert_to_rfc_1152() in error)
png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c
png_convert_from_time_t() in pngwrite.c
png_get_tIME() in pngget.c
png_handle_tIME() in pngrutil.c, called in pngread.c
png_set_tIME() in pngset.c
png_write_tIME() in pngwutil.c, called in pngwrite.c
All appear to handle dates properly in a Y2K environment. The
png_convert_from_time_t() function calls gmtime() to convert from system
clock time, which returns (year - 1900), which we properly convert to
the full 4-digit year. There is a possibility that applications using
libpng are not passing 4-digit years into the png_convert_to_rfc_1123()
function, or that they are incorrectly passing only a 2-digit year
instead of "year - 1900" into the png_convert_from_struct_tm() function,
but this is not under our control. The libpng documentation has always
stated that it works with 4-digit years, and the APIs have been
documented as such.
The tIME chunk itself is also Y2K compliant. It uses a 2-byte unsigned
integer to hold the year, and can hold years as large as 65535.
zlib, upon which libpng depends, is also Y2K compliant. It contains
no date-related code.
Glenn Randers-Pehrson
libpng maintainer
PNG Development Group

10040
aclocal.m4 vendored

File diff suppressed because it is too large Load Diff

View File

@@ -4,21 +4,31 @@
# #
# WARNING: if you run this you will change the versions # WARNING: if you run this you will change the versions
# of the tools which are used and, maybe, required! # of the tools which are used and, maybe, required!
# You can define your own replacements in your environment.
# $AUTOCONF, $AUTOMAKE, $AUTOHEADER, $AUTOPOINT, $ACLOCAL and $LIBTOOLIZE
touch Makefile.am configure.ac
{ {
echo "running libtoolize" >&2 LT=${LIBTOOLIZE-libtoolize}
libtoolize --copy --automake echo "running $LT" >&2
$LT --force --copy --automake
} && { } && {
echo "running aclocal" >&2 AL=${ACLOCAL-aclocal}
aclocal echo "running $AL" >&2
$AL
} && { } && {
echo "running autoheader [ignore the warnings]" >&2 AH=${AUTOHEADER-autoheader}
autoheader echo "running $AH [ignore the warnings]" >&2
$AH
} && { } && {
echo "running automake" >&2 AM=${AUTOMAKE-automake}
automake --foreign -a -c echo "running $AM" >&2
$AM --force-missing --foreign -a -c
} && { } && {
echo "running autoconf" >&2 AC=${AUTOCONF-autoconf}
autoconf echo "running $AC" >&2
$AC
} && } &&
echo "autogen complete" >&2 || echo "autogen complete" >&2 ||
echo "ERROR: autogen.sh failed, autogen is incomplete" >&2 echo "ERROR: autogen.sh failed, autogen is incomplete" >&2

376
config.guess vendored
View File

@@ -1,9 +1,10 @@
#! /bin/sh #! /bin/sh
# Attempt to guess a canonical system name. # Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
# Free Software Foundation, Inc.
timestamp='2005-12-23' timestamp='2009-11-20'
# This file is free software; you can redistribute it and/or modify it # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
@@ -26,16 +27,16 @@ timestamp='2005-12-23'
# the same distribution terms that you use for the rest of that program. # the same distribution terms that you use for the rest of that program.
# Originally written by Per Bothner <per@bothner.com>. # Originally written by Per Bothner. Please send patches (context
# Please send patches to <config-patches@gnu.org>. Submit a context # diff format) to <config-patches@gnu.org> and include a ChangeLog
# diff and a properly formatted ChangeLog entry. # entry.
# #
# This script attempts to guess a canonical system name similar to # This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and # config.sub. If it succeeds, it prints the system name on stdout, and
# exits with 0. Otherwise, it exits with 1. # exits with 0. Otherwise, it exits with 1.
# #
# The plan is that this can be called by configure scripts if you # You can get the latest version of this script from:
# don't specify an explicit build system type. # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
me=`echo "$0" | sed -e 's,.*/,,'` me=`echo "$0" | sed -e 's,.*/,,'`
@@ -55,8 +56,8 @@ version="\
GNU config.guess ($timestamp) GNU config.guess ($timestamp)
Originally written by Per Bothner. Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
Free Software Foundation, Inc. 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -106,7 +107,7 @@ set_cc_for_build='
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
: ${TMPDIR=/tmp} ; : ${TMPDIR=/tmp} ;
{ tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
@@ -138,23 +139,6 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
if [ "${UNAME_SYSTEM}" = "Linux" ] ; then
eval $set_cc_for_build
cat << EOF > $dummy.c
#include <features.h>
#ifdef __UCLIBC__
# ifdef __UCLIBC_CONFIG_VERSION__
LIBC=uclibc __UCLIBC_CONFIG_VERSION__
# else
LIBC=uclibc
# endif
#else
LIBC=gnu
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep LIBC= | sed -e 's: ::g'`
fi
# Note: order is significant - the case branches are not exclusive. # Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
@@ -177,6 +161,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
arm*) machine=arm-unknown ;; arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;; sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;; sh3eb) machine=sh-unknown ;;
sh5el) machine=sh5le-unknown ;;
*) machine=${UNAME_MACHINE_ARCH}-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac esac
# The Operating System including object format, if it has switched # The Operating System including object format, if it has switched
@@ -185,7 +170,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
arm*|i386|m68k|ns32k|sh3*|sparc|vax) arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep __ELF__ >/dev/null | grep -q __ELF__
then then
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
# Return netbsd for either. FIX? # Return netbsd for either. FIX?
@@ -223,8 +208,11 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:ekkoBSD:*:*) *:ekkoBSD:*:*)
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
exit ;; exit ;;
*:SolidBSD:*:*)
echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
exit ;;
macppc:MirBSD:*:*) macppc:MirBSD:*:*)
echo powerppc-unknown-mirbsd${UNAME_RELEASE} echo powerpc-unknown-mirbsd${UNAME_RELEASE}
exit ;; exit ;;
*:MirBSD:*:*) *:MirBSD:*:*)
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
@@ -336,14 +324,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
case `/usr/bin/uname -p` in case `/usr/bin/uname -p` in
sparc) echo sparc-icl-nx7; exit ;; sparc) echo sparc-icl-nx7; exit ;;
esac ;; esac ;;
s390x:SunOS:*:*)
echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4H:SunOS:5.*:*) sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;; exit ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;; exit ;;
i86pc:SunOS:5.*:*) i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` echo i386-pc-auroraux${UNAME_RELEASE}
exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
eval $set_cc_for_build
SUN_ARCH="i386"
# If there is a compiler, see if it is configured for 64-bit objects.
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
# This test works for both compilers.
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
SUN_ARCH="x86_64"
fi
fi
echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;; exit ;;
sun4*:SunOS:6*:*) sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize # According to config.sub, this is the proper way to canonicalize
@@ -544,7 +551,7 @@ EOF
echo rs6000-ibm-aix3.2 echo rs6000-ibm-aix3.2
fi fi
exit ;; exit ;;
*:AIX:*:[45]) *:AIX:*:[456])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000 IBM_ARCH=rs6000
@@ -652,7 +659,7 @@ EOF
# => hppa64-hp-hpux11.23 # => hppa64-hp-hpux11.23
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
grep __LP64__ >/dev/null grep -q __LP64__
then then
HP_ARCH="hppa2.0w" HP_ARCH="hppa2.0w"
else else
@@ -784,6 +791,8 @@ EOF
case ${UNAME_MACHINE} in case ${UNAME_MACHINE} in
pc98) pc98)
echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
amd64)
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
*) *)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
esac esac
@@ -791,7 +800,7 @@ EOF
i*:CYGWIN*:*) i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin echo ${UNAME_MACHINE}-pc-cygwin
exit ;; exit ;;
i*:MINGW*:*) *:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32 echo ${UNAME_MACHINE}-pc-mingw32
exit ;; exit ;;
i*:windows32*:*) i*:windows32*:*)
@@ -801,12 +810,24 @@ EOF
i*:PW*:*) i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32 echo ${UNAME_MACHINE}-pc-pw32
exit ;; exit ;;
x86:Interix*:[345]*) *:Interix*:*)
echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' case ${UNAME_MACHINE} in
exit ;; x86)
echo i586-pc-interix${UNAME_RELEASE}
exit ;;
authenticamd | genuineintel | EM64T)
echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;;
IA64)
echo ia64-unknown-interix${UNAME_RELEASE}
exit ;;
esac ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks echo i${UNAME_MACHINE}-pc-mks
exit ;; exit ;;
8664:Windows_NT:*)
echo x86_64-pc-mks
exit ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*) i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem? # How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
@@ -836,74 +857,6 @@ EOF
i*86:Minix:*:*) i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix echo ${UNAME_MACHINE}-pc-minix
exit ;; exit ;;
arm*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
cris:Linux:*:*)
echo cris-axis-linux-${LIBC}
exit ;;
crisv32:Linux:*:*)
echo crisv32-axis-linux-${LIBC}
exit ;;
frv:Linux:*:*)
echo frv-unknown-linux-${LIBC}
exit ;;
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
mips:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
#undef mips
#undef mipsel
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=mipsel
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=mips
#else
CPU=
#endif
#endif
EOF
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`"
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
;;
mips64:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
#undef mips64
#undef mips64el
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=mips64el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=mips64
#else
CPU=
#endif
#endif
EOF
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`"
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
;;
or32:Linux:*:*)
echo or32-unknown-linux-${LIBC}
exit ;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-${LIBC}
exit ;;
ppc64:Linux:*:*)
echo powerpc64-unknown-linux-${LIBC}
exit ;;
alpha:Linux:*:*) alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;; EV5) UNAME_MACHINE=alphaev5 ;;
@@ -914,100 +867,115 @@ EOF
EV67) UNAME_MACHINE=alphaev67 ;; EV67) UNAME_MACHINE=alphaev67 ;;
EV68*) UNAME_MACHINE=alphaev68 ;; EV68*) UNAME_MACHINE=alphaev68 ;;
esac esac
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC="gnulibc1" ; fi if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
exit ;;
arm*:Linux:*:*)
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
echo ${UNAME_MACHINE}-unknown-linux-gnu
else
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
fi
exit ;;
avr32*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
cris:Linux:*:*)
echo cris-axis-linux-gnu
exit ;;
crisv32:Linux:*:*)
echo crisv32-axis-linux-gnu
exit ;;
frv:Linux:*:*)
echo frv-unknown-linux-gnu
exit ;;
i*86:Linux:*:*)
LIBC=gnu
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#ifdef __dietlibc__
LIBC=dietlibc
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
exit ;;
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
#undef ${UNAME_MACHINE}
#undef ${UNAME_MACHINE}el
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=${UNAME_MACHINE}el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=${UNAME_MACHINE}
#else
CPU=
#endif
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
or32:Linux:*:*)
echo or32-unknown-linux-gnu
exit ;;
padre:Linux:*:*)
echo sparc-unknown-linux-gnu
exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-gnu
exit ;; exit ;;
parisc:Linux:*:* | hppa:Linux:*:*) parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level # Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA7*) echo hppa1.1-unknown-linux-gnu ;;
PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-gnu ;;
*) echo hppa-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-gnu ;;
esac esac
exit ;; exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*) ppc64:Linux:*:*)
echo hppa64-unknown-linux-${LIBC} echo powerpc64-unknown-linux-gnu
exit ;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
exit ;; exit ;;
s390:Linux:*:* | s390x:Linux:*:*) s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux echo ${UNAME_MACHINE}-ibm-linux
exit ;; exit ;;
sh64*:Linux:*:*) sh64*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;; exit ;;
sh*:Linux:*:*) sh*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;; exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*) sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;; exit ;;
vax:Linux:*:*) vax:Linux:*:*)
echo ${UNAME_MACHINE}-dec-linux-${LIBC} echo ${UNAME_MACHINE}-dec-linux-gnu
exit ;; exit ;;
x86_64:Linux:*:*) x86_64:Linux:*:*)
echo x86_64-unknown-linux-${LIBC} echo x86_64-unknown-linux-gnu
exit ;;
xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;; exit ;;
i*86:Linux:*:*)
# The BFD linker knows what the default object file format is, so
# first see if it will tell us. cd to the root directory to prevent
# problems with other programs or directories called `ld' in the path.
# Set LC_ALL=C to ensure ld outputs messages in English.
ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
| sed -ne '/supported targets:/!d
s/[ ][ ]*/ /g
s/.*supported targets: *//
s/ .*//
p'`
case "$ld_supported_targets" in
elf32-i386)
TENTATIVE="${UNAME_MACHINE}-pc-linux-${LIBC}"
;;
a.out-i386-linux)
echo "${UNAME_MACHINE}-pc-linux-${LIBC}aout"
exit ;;
coff-i386)
echo "${UNAME_MACHINE}-pc-linux-${LIBC}coff"
exit ;;
"")
# Either a pre-BFD a.out linker (linux-gnuoldld) or
# one that does not give us useful --help.
echo "${UNAME_MACHINE}-pc-linux-${LIBC}oldld"
exit ;;
esac
# This should get integrated into the C code below, but now we hack
if [ "$LIBC" != "gnu" ] ; then echo "$TENTATIVE" && exit 0 ; fi
# Determine whether the default compiler is a.out or elf
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#include <features.h>
#ifdef __ELF__
# ifdef __GLIBC__
# if __GLIBC__ >= 2
LIBC=gnu
# else
LIBC=gnulibc1
# endif
# else
LIBC=gnulibc1
# endif
#else
#if defined(__INTEL_COMPILER) || defined(__PGI)
LIBC=gnu
#else
LIBC=gnuaout
#endif
#endif
#ifdef __dietlibc__
LIBC=dietlibc
#endif
EOF
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^LIBC/{s: ::g;p;}'`"
test x"${LIBC}" != x && {
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
exit
}
test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
;;
i*86:DYNIX/ptx:4*:*) i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# earlier versions are messed up and put the nodename in both # earlier versions are messed up and put the nodename in both
@@ -1036,7 +1004,7 @@ EOF
i*86:syllable:*:*) i*86:syllable:*:*)
echo ${UNAME_MACHINE}-pc-syllable echo ${UNAME_MACHINE}-pc-syllable
exit ;; exit ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
echo i386-unknown-lynxos${UNAME_RELEASE} echo i386-unknown-lynxos${UNAME_RELEASE}
exit ;; exit ;;
i*86:*DOS:*:*) i*86:*DOS:*:*)
@@ -1080,8 +1048,11 @@ EOF
pc:*:*:*) pc:*:*:*)
# Left here for compatibility: # Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about # uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i386. # the processor, so we play safe by assuming i586.
echo i386-pc-msdosdjgpp # Note: whatever this is, it MUST be the same as what config.sub
# prints for the "djgpp" host, or else GDB configury will decide that
# this is a cross-build.
echo i586-pc-msdosdjgpp
exit ;; exit ;;
Intel:Mach:3*:*) Intel:Mach:3*:*)
echo i386-pc-mach3 echo i386-pc-mach3
@@ -1119,6 +1090,16 @@ EOF
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4; exit; } ;; && { echo i486-ncr-sysv4; exit; } ;;
NCR*:*:4.2:* | MPRAS*:*:4.2:*)
OS_REL='.3'
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE} echo m68k-unknown-lynxos${UNAME_RELEASE}
exit ;; exit ;;
@@ -1131,7 +1112,7 @@ EOF
rs6000:LynxOS:2.*:*) rs6000:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE} echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit ;; exit ;;
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
echo powerpc-unknown-lynxos${UNAME_RELEASE} echo powerpc-unknown-lynxos${UNAME_RELEASE}
exit ;; exit ;;
SM[BE]S:UNIX_SV:*:*) SM[BE]S:UNIX_SV:*:*)
@@ -1194,6 +1175,9 @@ EOF
BePC:BeOS:*:*) # BeOS running on Intel PC compatible. BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
echo i586-pc-beos echo i586-pc-beos
exit ;; exit ;;
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
echo i586-pc-haiku
exit ;;
SX-4:SUPER-UX:*:*) SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE} echo sx4-nec-superux${UNAME_RELEASE}
exit ;; exit ;;
@@ -1203,6 +1187,15 @@ EOF
SX-6:SUPER-UX:*:*) SX-6:SUPER-UX:*:*)
echo sx6-nec-superux${UNAME_RELEASE} echo sx6-nec-superux${UNAME_RELEASE}
exit ;; exit ;;
SX-7:SUPER-UX:*:*)
echo sx7-nec-superux${UNAME_RELEASE}
exit ;;
SX-8:SUPER-UX:*:*)
echo sx8-nec-superux${UNAME_RELEASE}
exit ;;
SX-8R:SUPER-UX:*:*)
echo sx8r-nec-superux${UNAME_RELEASE}
exit ;;
Power*:Rhapsody:*:*) Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE} echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit ;; exit ;;
@@ -1212,6 +1205,16 @@ EOF
*:Darwin:*:*) *:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
case $UNAME_PROCESSOR in case $UNAME_PROCESSOR in
i386)
eval $set_cc_for_build
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
UNAME_PROCESSOR="x86_64"
fi
fi ;;
unknown) UNAME_PROCESSOR=powerpc ;; unknown) UNAME_PROCESSOR=powerpc ;;
esac esac
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
@@ -1293,6 +1296,9 @@ EOF
i*86:rdos:*:*) i*86:rdos:*:*)
echo ${UNAME_MACHINE}-pc-rdos echo ${UNAME_MACHINE}-pc-rdos
exit ;; exit ;;
i*86:AROS:*:*)
echo ${UNAME_MACHINE}-pc-aros
exit ;;
esac esac
#echo '(No uname command or uname output not recognized.)' 1>&2 #echo '(No uname command or uname output not recognized.)' 1>&2
@@ -1453,9 +1459,9 @@ This script, last modified $timestamp, has failed to recognize
the operating system you are using. It is advised that you the operating system you are using. It is advised that you
download the most up to date version of the config scripts from download the most up to date version of the config scripts from
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
and and
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
If the version you run ($0) is already up to date, please If the version you run ($0) is already up to date, please
send the following data and any information you think might be send the following data and any information you think might be

View File

@@ -12,10 +12,6 @@
/* Define to 1 if you have the `z' library (-lz). */ /* Define to 1 if you have the `z' library (-lz). */
#undef HAVE_LIBZ #undef HAVE_LIBZ
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */
#undef HAVE_MALLOC
/* Define to 1 if you have the <malloc.h> header file. */ /* Define to 1 if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H #undef HAVE_MALLOC_H
@@ -49,6 +45,10 @@
/* Define to 1 if you have the <unistd.h> header file. */ /* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H #undef HAVE_UNISTD_H
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Name of package */ /* Name of package */
#undef PACKAGE #undef PACKAGE
@@ -64,6 +64,9 @@
/* Define to the one symbol short name of this package. */ /* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME #undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */ /* Define to the version of this package. */
#undef PACKAGE_VERSION #undef PACKAGE_VERSION
@@ -79,8 +82,5 @@
/* Define to empty if `const' does not conform to ANSI C. */ /* Define to empty if `const' does not conform to ANSI C. */
#undef const #undef const
/* Define to rpl_malloc if the replacement function should be used. */ /* Define to `unsigned int' if <sys/types.h> does not define. */
#undef malloc
/* Define to `unsigned' if <sys/types.h> does not define. */
#undef size_t #undef size_t

220
config.sub vendored
View File

@@ -1,9 +1,10 @@
#! /bin/sh #! /bin/sh
# Configuration validation subroutine script. # Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
# Free Software Foundation, Inc.
timestamp='2005-12-23' timestamp='2009-11-20'
# This file is (in principle) common to ALL GNU software. # This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software # The presence of a machine in this file suggests that SOME GNU software
@@ -31,13 +32,16 @@ timestamp='2005-12-23'
# Please send patches to <config-patches@gnu.org>. Submit a context # Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted ChangeLog entry. # diff and a properly formatted GNU ChangeLog entry.
# #
# Configuration subroutine to validate and canonicalize a configuration type. # Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument. # Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1. # If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed. # Otherwise, we print the canonical config type on stdout and succeed.
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
# This file is supposed to be the same for all GNU packages # This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases # and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software. # that are meaningful with *any* GNU software.
@@ -71,8 +75,8 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\ version="\
GNU config.sub ($timestamp) GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
Free Software Foundation, Inc. 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -121,6 +125,7 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in case $maybe_os in
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*) storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
@@ -147,10 +152,13 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple | -axis | -knuth | -cray) -apple | -axis | -knuth | -cray | -microblaze)
os= os=
basic_machine=$1 basic_machine=$1
;; ;;
-bluegene*)
os=-cnk
;;
-sim | -cisco | -oki | -wec | -winbond) -sim | -cisco | -oki | -wec | -winbond)
os= os=
basic_machine=$1 basic_machine=$1
@@ -240,20 +248,24 @@ case $basic_machine in
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \ | am33_2.0 \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
| bfin \ | bfin \
| c4x | clipper \ | c4x | clipper \
| d10v | d30v | dlx | dsp16xx | dvp \ | d10v | d30v | dlx | dsp16xx \
| fr30 | frv \ | fido | fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \ | i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \ | ip2k | iq2000 \
| m32r | m32rle | m68000 | m68k | m88k | maxq | mb | microblaze | mcore \ | lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
| maxq | mb | microblaze | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \ | mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \ | mips16 \
| mips64 | mips64el \ | mips64 | mips64el \
| mips64vr | mips64vrel \ | mips64octeon | mips64octeonel \
| mips64orion | mips64orionel \ | mips64orion | mips64orionel \
| mips64r5900 | mips64r5900el \
| mips64vr | mips64vrel \
| mips64vr4100 | mips64vr4100el \ | mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \ | mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \ | mips64vr5000 | mips64vr5000el \
@@ -266,29 +278,31 @@ case $basic_machine in
| mipsisa64sr71k | mipsisa64sr71kel \ | mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \ | mipstx39 | mipstx39el \
| mn10200 | mn10300 \ | mn10200 | mn10300 \
| moxie \
| mt \ | mt \
| msp430 \ | msp430 \
| nios | nios2 \
| ns16k | ns32k \ | ns16k | ns32k \
| or32 \ | or32 \
| pdp10 | pdp11 | pj | pjl \ | pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \ | pyramid \
| sh | sh[1234] | sh[24]a | sh[24]a*eb | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | rx \
| score \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \ | sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
| strongarm \ | spu | strongarm \
| tahoe | thumb | tic4x | tic80 | tron \ | tahoe | thumb | tic4x | tic80 | tron \
| ubicom32 \
| v850 | v850e \ | v850 | v850e \
| we32k \ | we32k \
| x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
| z8k) | z8k | z80)
basic_machine=$basic_machine-unknown basic_machine=$basic_machine-unknown
;; ;;
m32c) m6811 | m68hc11 | m6812 | m68hc12 | picochip)
basic_machine=$basic_machine-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12)
# Motorola 68HC11/12. # Motorola 68HC11/12.
basic_machine=$basic_machine-unknown basic_machine=$basic_machine-unknown
os=-none os=-none
@@ -298,10 +312,6 @@ case $basic_machine in
ms1) ms1)
basic_machine=mt-unknown basic_machine=mt-unknown
;; ;;
nios2 | nios2-* | nios2 | nios2-*)
basic_machine=nios2-altera
os=-none
;;
# We use `pc' rather than `unknown' # We use `pc' rather than `unknown'
# because (1) that's what they normally are, and # because (1) that's what they normally are, and
@@ -321,25 +331,28 @@ case $basic_machine in
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* \ | avr-* | avr32-* \
| bfin-* | bs2000-* \ | bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
| clipper-* | craynv-* | cydra-* \ | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \ | d10v-* | d30v-* | dlx-* \
| elxsi-* \ | elxsi-* \
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \ | h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \ | i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \ | ip2k-* | iq2000-* \
| m32r-* | m32rle-* \ | lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | maxq-* | mcore-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \ | mips16-* \
| mips64-* | mips64el-* \ | mips64-* | mips64el-* \
| mips64vr-* | mips64vrel-* \ | mips64octeon-* | mips64octeonel-* \
| mips64orion-* | mips64orionel-* \ | mips64orion-* | mips64orionel-* \
| mips64r5900-* | mips64r5900el-* \
| mips64vr-* | mips64vrel-* \
| mips64vr4100-* | mips64vr4100el-* \ | mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \ | mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \ | mips64vr5000-* | mips64vr5000el-* \
@@ -354,28 +367,32 @@ case $basic_machine in
| mmix-* \ | mmix-* \
| mt-* \ | mt-* \
| msp430-* \ | msp430-* \
| nios-* | nios2-* \
| none-* | np1-* | ns16k-* | ns32k-* \ | none-* | np1-* | ns16k-* | ns32k-* \
| orion-* \ | orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \ | pyramid-* \
| romp-* | rs6000-* \ | romp-* | rs6000-* | rx-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \ | sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \ | tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
| tron-* \ | tron-* \
| ubicom32-* \
| v850-* | v850e-* | vax-* \ | v850-* | v850e-* | vax-* \
| we32k-* \ | we32k-* \
| x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
| xstormy16-* | xtensa-* \ | xstormy16-* | xtensa*-* \
| ymp-* \ | ymp-* \
| z8k-*) | z8k-* | z80-*)
;; ;;
m32c-*) # Recognize the basic CPU types without company name, with glob match.
xtensa*)
basic_machine=$basic_machine-unknown
;; ;;
# Recognize the various machine names and aliases which stand # Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS. # for a CPU type and a company and sometimes even an OS.
@@ -439,6 +456,10 @@ case $basic_machine in
basic_machine=m68k-apollo basic_machine=m68k-apollo
os=-bsd os=-bsd
;; ;;
aros)
basic_machine=i386-pc
os=-aros
;;
aux) aux)
basic_machine=m68k-apple basic_machine=m68k-apple
os=-aux os=-aux
@@ -447,10 +468,26 @@ case $basic_machine in
basic_machine=ns32k-sequent basic_machine=ns32k-sequent
os=-dynix os=-dynix
;; ;;
blackfin)
basic_machine=bfin-unknown
os=-linux
;;
blackfin-*)
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
bluegene*)
basic_machine=powerpc-ibm
os=-cnk
;;
c90) c90)
basic_machine=c90-cray basic_machine=c90-cray
os=-unicos os=-unicos
;; ;;
cegcc)
basic_machine=arm-unknown
os=-cegcc
;;
convex-c1) convex-c1)
basic_machine=c1-convex basic_machine=c1-convex
os=-bsd os=-bsd
@@ -479,8 +516,8 @@ case $basic_machine in
basic_machine=craynv-cray basic_machine=craynv-cray
os=-unicosmp os=-unicosmp
;; ;;
cr16c) cr16)
basic_machine=cr16c-unknown basic_machine=cr16-unknown
os=-elf os=-elf
;; ;;
crds | unos) crds | unos)
@@ -518,6 +555,10 @@ case $basic_machine in
basic_machine=m88k-motorola basic_machine=m88k-motorola
os=-sysv3 os=-sysv3
;; ;;
dicos)
basic_machine=i686-pc
os=-dicos
;;
djgpp) djgpp)
basic_machine=i586-pc basic_machine=i586-pc
os=-msdosdjgpp os=-msdosdjgpp
@@ -672,6 +713,14 @@ case $basic_machine in
basic_machine=m68k-isi basic_machine=m68k-isi
os=-sysv os=-sysv
;; ;;
m68knommu)
basic_machine=m68k-unknown
os=-linux
;;
m68knommu-*)
basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
m88k-omron*) m88k-omron*)
basic_machine=m88k-omron basic_machine=m88k-omron
;; ;;
@@ -683,10 +732,17 @@ case $basic_machine in
basic_machine=ns32k-utek basic_machine=ns32k-utek
os=-sysv os=-sysv
;; ;;
microblaze)
basic_machine=microblaze-xilinx
;;
mingw32) mingw32)
basic_machine=i386-pc basic_machine=i386-pc
os=-mingw32 os=-mingw32
;; ;;
mingw32ce)
basic_machine=arm-unknown
os=-mingw32ce
;;
miniframe) miniframe)
basic_machine=m68000-convergent basic_machine=m68000-convergent
;; ;;
@@ -694,24 +750,6 @@ case $basic_machine in
basic_machine=m68k-atari basic_machine=m68k-atari
os=-mint os=-mint
;; ;;
mipsEE* | ee | ps2)
basic_machine=mips64r5900el-scei
case $os in
-linux*)
;;
*)
os=-elf
;;
esac
;;
iop)
basic_machine=mipsel-scei
os=-irx
;;
dvp)
basic_machine=dvp-scei
os=-elf
;;
mips3*-*) mips3*-*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
;; ;;
@@ -831,6 +869,14 @@ case $basic_machine in
basic_machine=i860-intel basic_machine=i860-intel
os=-osf os=-osf
;; ;;
parisc)
basic_machine=hppa-unknown
os=-linux
;;
parisc-*)
basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
pbd) pbd)
basic_machine=sparc-tti basic_machine=sparc-tti
;; ;;
@@ -932,6 +978,10 @@ case $basic_machine in
sb1el) sb1el)
basic_machine=mipsisa64sb1el-unknown basic_machine=mipsisa64sb1el-unknown
;; ;;
sde)
basic_machine=mipsisa32-sde
os=-elf
;;
sei) sei)
basic_machine=mips-sei basic_machine=mips-sei
os=-seiux os=-seiux
@@ -943,6 +993,9 @@ case $basic_machine in
basic_machine=sh-hitachi basic_machine=sh-hitachi
os=-hms os=-hms
;; ;;
sh5el)
basic_machine=sh5le-unknown
;;
sh64) sh64)
basic_machine=sh64-unknown basic_machine=sh64-unknown
;; ;;
@@ -1032,6 +1085,10 @@ case $basic_machine in
basic_machine=tic6x-unknown basic_machine=tic6x-unknown
os=-coff os=-coff
;; ;;
tile*)
basic_machine=tile-unknown
os=-linux-gnu
;;
tx39) tx39)
basic_machine=mipstx39-unknown basic_machine=mipstx39-unknown
;; ;;
@@ -1107,6 +1164,10 @@ case $basic_machine in
basic_machine=z8k-unknown basic_machine=z8k-unknown
os=-sim os=-sim
;; ;;
z80-*-coff)
basic_machine=z80-unknown
os=-sim
;;
none) none)
basic_machine=none-none basic_machine=none-none
os=-none os=-none
@@ -1145,10 +1206,10 @@ case $basic_machine in
we32k) we32k)
basic_machine=we32k-att basic_machine=we32k-att
;; ;;
sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown basic_machine=sh-unknown
;; ;;
sparc | sparcv8 | sparcv9 | sparcv9b) sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
basic_machine=sparc-sun basic_machine=sparc-sun
;; ;;
cydra) cydra)
@@ -1195,6 +1256,9 @@ case $os in
# First match some system type aliases # First match some system type aliases
# that might get confused with valid system types. # that might get confused with valid system types.
# -solaris* is a basic system type, with this one exception. # -solaris* is a basic system type, with this one exception.
-auroraux)
os=-auroraux
;;
-solaris1 | -solaris1.*) -solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'` os=`echo $os | sed -e 's|solaris1|sunos4|'`
;; ;;
@@ -1215,18 +1279,20 @@ case $os in
# Each alternative MUST END IN A *, to match a version number. # Each alternative MUST END IN A *, to match a version number.
# -sysv* is not here because it comes later, after sysvr4. # -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
| -sym* | -kopensolaris* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* \ | -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
| -openbsd* | -solidbsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* \ | -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \ | -uxpv* | -beos* | -mpeix* | -udk* \
@@ -1236,7 +1302,7 @@ case $os in
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -irx*) | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
# Remember, each alternative MUST END IN *, to match a version number. # Remember, each alternative MUST END IN *, to match a version number.
;; ;;
-qnx*) -qnx*)
@@ -1366,6 +1432,9 @@ case $os in
-zvmoe) -zvmoe)
os=-zvmoe os=-zvmoe
;; ;;
-dicos*)
os=-dicos
;;
-none) -none)
;; ;;
*) *)
@@ -1388,6 +1457,12 @@ else
# system, and we'll never get to this point. # system, and we'll never get to this point.
case $basic_machine in case $basic_machine in
score-*)
os=-elf
;;
spu-*)
os=-elf
;;
*-acorn) *-acorn)
os=-riscix1.2 os=-riscix1.2
;; ;;
@@ -1397,9 +1472,9 @@ case $basic_machine in
arm*-semi) arm*-semi)
os=-aout os=-aout
;; ;;
c4x-* | tic4x-*) c4x-* | tic4x-*)
os=-coff os=-coff
;; ;;
# This must come before the *-dec entry. # This must come before the *-dec entry.
pdp10-*) pdp10-*)
os=-tops20 os=-tops20
@@ -1425,6 +1500,9 @@ case $basic_machine in
m68*-cisco) m68*-cisco)
os=-aout os=-aout
;; ;;
mep-*)
os=-elf
;;
mips*-cisco) mips*-cisco)
os=-elf os=-elf
;; ;;
@@ -1554,7 +1632,7 @@ case $basic_machine in
-sunos*) -sunos*)
vendor=sun vendor=sun
;; ;;
-aix*) -cnk*|-aix*)
vendor=ibm vendor=ibm
;; ;;
-beos*) -beos*)

25619
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,7 @@
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
dnl dnl
dnl Minor upgrades (compatible ABI): increment the package version dnl Minor upgrades (compatible ABI): increment the package version
dnl (third field in two places below) and set the PNGLIB_MINOR dnl (third field in two places below) and set the PNGLIB_RELEASE
dnl variable. dnl variable.
dnl dnl
dnl Major upgrades (incompatible ABI): increment the package major dnl Major upgrades (incompatible ABI): increment the package major
@@ -16,21 +16,22 @@ dnl should not be necessary to regenerate configure if the time
dnl stamps are correct dnl stamps are correct
AC_PREREQ(2.59) AC_PREREQ(2.59)
dnl Version number stuff here: AC_INIT([libpng], [1.4.5beta06], [png-mng-implement@lists.sourceforge.net])
AC_INIT([libpng], [1.2.10rc1], [png-mng-implement@lists.sourceforge.net])
AM_INIT_AUTOMAKE AM_INIT_AUTOMAKE
dnl stop configure from automagically running automake dnl stop configure from automagically running automake
AM_MAINTAINER_MODE AM_MAINTAINER_MODE
PNGLIB_VERSION=1.2.10rc1 dnl Version number stuff here:
PNGLIB_MAJOR=12
PNGLIB_MINOR=10 PNGLIB_VERSION=1.4.5beta06
PNGLIB_MAJOR=1
PNGLIB_MINOR=4
PNGLIB_RELEASE=5
dnl End of version number stuff dnl End of version number stuff
AC_CONFIG_SRCDIR([pngget.c]) AC_CONFIG_SRCDIR([pngget.c])
AM_CONFIG_HEADER([config.h]) AM_CONFIG_HEADER(config.h)
# Checks for programs. # Checks for programs.
AC_PROG_CC AC_PROG_CC
@@ -40,7 +41,7 @@ AC_CHECK_TOOL(SED, sed, :)
AC_PROG_INSTALL AC_PROG_INSTALL
AC_PROG_LN_S AC_PROG_LN_S
AC_PROG_MAKE_SET AC_PROG_MAKE_SET
AC_PROG_LIBTOOL LT_INIT([win32-dll])
# Checks for header files. # Checks for header files.
AC_HEADER_STDC AC_HEADER_STDC
@@ -52,27 +53,30 @@ AC_TYPE_SIZE_T
AC_STRUCT_TM AC_STRUCT_TM
# Checks for library functions. # Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_STRTOD AC_FUNC_STRTOD
AC_CHECK_FUNCS([memset], , AC_ERROR([memset not found in libc])) AC_CHECK_FUNCS([memset], , AC_ERROR([memset not found in libc]))
AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_ERROR([cannot find pow])) ) AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_ERROR([cannot find pow])) )
AC_CHECK_LIB(z, zlibVersion, , AC_ERROR([zlib not installed])) AC_CHECK_LIB(z, zlibVersion, , AC_ERROR([zlib not installed]))
AC_MSG_CHECKING([if assembler code in pnggccrd.c can be compiled]) case $host_os in
AC_TRY_COMPILE( aix*)
[#include "pnggccrd.c"], LIBPNG_DEFINES="-DPNG_CONFIGURE_LIBPNG -D_ALL_SOURCE";;
[return 0;], *)
LIBPNG_DEFINES=, LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG;;
LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG -DPNG_NO_ASSEMBLER_CODE) esac
if test "$LIBPNG_DEFINES"; then LIBPNG_DEFINES=$LIBPNG_DEFINES
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG
fi
AC_SUBST(LIBPNG_DEFINES) AC_SUBST(LIBPNG_DEFINES)
AC_MSG_CHECKING([if libraries can be versioned]) AC_MSG_CHECKING([if libraries can be versioned])
# Special case for PE/COFF platforms: ld reports
# support for version-script, but doesn't actually
# DO anything with it.
case $host in
*cygwin* | *mingw32* )
have_ld_version_script=no
AC_MSG_RESULT(no)
;;
* )
GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script` GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
if test "$GLD"; then if test "$GLD"; then
have_ld_version_script=yes have_ld_version_script=yes
@@ -80,14 +84,28 @@ if test "$GLD"; then
else else
have_ld_version_script=no have_ld_version_script=no
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
AC_MSG_WARN(*** You may want to rerun configure using --with-gnu-ld to enable versioned symbols.) AC_MSG_WARN(*** You have not enabled versioned symbols.)
fi fi
;;
esac
AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes") 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} "s:^PREFIX=::"`
AC_SUBST(SYMBOL_PREFIX)
AC_MSG_RESULT($SYMBOL_PREFIX)
fi
# Substitutions for .in files # Substitutions for .in files
AC_SUBST(PNGLIB_VERSION) AC_SUBST(PNGLIB_VERSION)
AC_SUBST(PNGLIB_MAJOR) AC_SUBST(PNGLIB_MAJOR)
AC_SUBST(PNGLIB_MINOR) AC_SUBST(PNGLIB_MINOR)
AC_SUBST(PNGLIB_RELEASE)
# Additional arguments (and substitutions) # Additional arguments (and substitutions)
# Allow the pkg-config directory to be set # Allow the pkg-config directory to be set
@@ -114,23 +132,9 @@ AC_ARG_WITH(binconfigs,
[binconfigs='${binconfigs}']) [binconfigs='${binconfigs}'])
AC_SUBST([binconfigs]) AC_SUBST([binconfigs])
# Allow the old version number library, libpng.so, to be removed from
# the build
AC_ARG_WITH(libpng-compat,
AC_HELP_STRING([--with-libpng-compat],
[Generate the obsolete libpng.so library @<:@default=yes@:>@]),
[if test "${withval}" = no; then
compatlib=
AC_MSG_NOTICE([libpng.so will not be built])
else
compatlib=libpng.la
fi],
[compatlib=libpng.la])
AC_SUBST([compatlib])
# Config files, substituting as above # Config files, substituting as above
AC_CONFIG_FILES([Makefile libpng.pc:scripts/libpng.pc.in]) AC_CONFIG_FILES([Makefile libpng.pc:libpng.pc.in])
AC_CONFIG_FILES([libpng-config:scripts/libpng-config.in], AC_CONFIG_FILES([libpng-config:libpng-config.in],
[chmod +x libpng-config]) [chmod +x libpng-config])
AC_OUTPUT AC_OUTPUT

340
contrib/gregbook/COPYING Normal file
View File

@@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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 of the License, 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, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@@ -1,12 +1,19 @@
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 1998-2001 Greg Roelofs. All rights reserved. Copyright (c) 1998-2008 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind, This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of be held liable for any damages arising in any way from the use of
this software. this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose, Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions: it freely, subject to the following restrictions:
@@ -23,4 +30,21 @@
and contributors for the book, "PNG: The Definitive Guide," and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates. published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
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 of the License, 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, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--------------------------------------------------------------------------- ---------------------------------------------------------------------------

View File

@@ -0,0 +1,130 @@
# Sample makefile for rpng-win / rpng2-win / wpng using mingw32-gcc and make.
# Greg Roelofs
# Last modified: 2 June 2007
#
# The programs built by this makefile are described in the book,
# "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and
# Associates, 1999). Go buy a copy, eh? Well, OK, it's not
# generally for sale anymore, but it's the thought that counts,
# right? (Hint: http://www.libpng.org/pub/png/book/ )
#
# Invoke this makefile from a DOS-prompt window via:
#
# make -f Makefile.mingw32
#
# This makefile assumes libpng and zlib have already been built or downloaded
# and are in subdirectories at the same level as the current subdirectory
# (as indicated by the PNGDIR and ZDIR macros below). It makes no assumptions
# at all about the mingw32 installation tree (W32DIR). Edit as appropriate.
#
# Note that the names of the dynamic and static libpng and zlib libraries
# used below may change in later releases of the libraries. This makefile
# builds both statically and dynamically linked executables by default.
# (You need only one set, but for testing it can be handy to have both.)
# macros --------------------------------------------------------------------
#PNGDIR = ../..# for libpng-x.y.z/contrib/gregbook builds
PNGDIR = ../libpng-win32
PNGINC = -I$(PNGDIR)
PNGLIBd = $(PNGDIR)/libpng.dll.a # dynamically linked
PNGLIBs = $(PNGDIR)/libpng.a # statically linked, local libpng
#ZDIR = ../../../zlib-win32# for libpng-x.y.z/contrib/gregbook builds
ZDIR = ../zlib-win32
ZINC = -I$(ZDIR)
ZLIBd = $(ZDIR)/libzdll.a
ZLIBs = $(ZDIR)/libz.a
# change this to be the path where mingw32 installs its stuff:
W32DIR =
#W32DIR = /usr/local/cross-tools/i386-mingw32msvc
W32INC = -I$(W32DIR)/include
W32LIB = $(W32DIR)/lib/libuser32.a $(W32DIR)/lib/libgdi32.a
CC = gcc
#CC = i386-mingw32msvc-gcc # e.g., Linux -> Win32 cross-compilation
LD = $(CC)
RM = rm -f
CFLAGS = -O -Wall $(INCS) $(MINGW_CCFLAGS)
# [note that -Wall is a gcc-specific compilation flag ("most warnings on")]
# [-ansi, -pedantic and -W can also be used]
LDFLAGS = $(MINGW_LDFLAGS)
O = .o
E = .exe
INCS = $(PNGINC) $(ZINC) $(W32INC)
RLIBSd = $(PNGLIBd) $(ZLIBd) $(W32LIB) -lm
RLIBSs = $(PNGLIBs) $(ZLIBs) $(W32LIB) -lm
WLIBSd = $(PNGLIBd) $(ZLIBd)
WLIBSs = $(PNGLIBs) $(ZLIBs)
RPNG = rpng-win
RPNG2 = rpng2-win
WPNG = wpng
ROBJSd = $(RPNG)$(O) readpng.pic$(O)
ROBJS2d = $(RPNG2)$(O) readpng2.pic$(O)
WOBJSd = $(WPNG)$(O) writepng.pic$(O)
RPNGs = $(RPNG)-static
RPNG2s = $(RPNG2)-static
WPNGs = $(WPNG)-static
ROBJSs = $(RPNG)$(O) readpng$(O)
ROBJS2s = $(RPNG2)$(O) readpng2$(O)
WOBJSs = $(WPNG)$(O) writepng$(O)
STATIC_EXES = $(RPNGs)$(E) $(RPNG2s)$(E) $(WPNGs)$(E)
DYNAMIC_EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)
EXES = $(STATIC_EXES) $(DYNAMIC_EXES)
# implicit make rules -------------------------------------------------------
.c$(O):
$(CC) -c $(CFLAGS) $<
%.pic$(O): %.c
$(CC) -c $(CFLAGS) -DPNG_BUILD_DLL -o $@ $<
# dependencies --------------------------------------------------------------
all: $(EXES)
$(RPNGs)$(E): $(ROBJSs)
$(LD) $(LDFLAGS) -o $@ $(ROBJSs) $(RLIBSs)
$(RPNG)$(E): $(ROBJSd)
$(LD) $(LDFLAGS) -o $@ $(ROBJSd) $(RLIBSd)
$(RPNG2s)$(E): $(ROBJS2s)
$(LD) $(LDFLAGS) -o $@ $(ROBJS2s) $(RLIBSs)
$(RPNG2)$(E): $(ROBJS2d)
$(LD) $(LDFLAGS) -o $@ $(ROBJS2d) $(RLIBSd)
$(WPNGs)$(E): $(WOBJSs)
$(LD) $(LDFLAGS) -o $@ $(WOBJSs) $(WLIBSs)
$(WPNG)$(E): $(WOBJSd)
$(LD) $(LDFLAGS) -o $@ $(WOBJSd) $(WLIBSd)
$(RPNG)$(O): $(RPNG).c readpng.h
$(RPNG2)$(O): $(RPNG2).c readpng2.h
$(WPNG)$(O): $(WPNG).c writepng.h
readpng$(O) readpng.pic$(O): readpng.c readpng.h
readpng2$(O) readpng2.pic$(O): readpng2.c readpng2.h
writepng$(O) writepng.pic$(O): writepng.c writepng.h
# maintenance ---------------------------------------------------------------
clean:
$(RM) $(EXES)
$(RM) $(ROBJSs) $(ROBJS2s) $(WOBJSs)
$(RM) $(ROBJSd) $(ROBJS2d) $(WOBJSd)

View File

@@ -23,9 +23,9 @@
# macros -------------------------------------------------------------------- # macros --------------------------------------------------------------------
PNGINC = -I/usr/local/include/libpng12 PNGINC = -I/usr/local/include/libpng14
PNGLIB = -L/usr/local/lib -lpng12 # dynamically linked against libpng PNGLIB = -L/usr/local/lib -lpng14 # dynamically linked against libpng
#PNGLIB = /usr/local/lib/libpng12.a # statically linked against libpng #PNGLIB = /usr/local/lib/libpng14.a # statically linked against libpng
# or: # or:
#PNGINC = -I../.. #PNGINC = -I../..
#PNGLIB = -L../.. -lpng #PNGLIB = -L../.. -lpng

View File

@@ -1,73 +1,92 @@
# Sample makefile for rpng-x / rpng2-x / wpng using gcc and make. # Sample makefile for rpng-x / rpng2-x / wpng using gcc and make.
# Greg Roelofs # Greg Roelofs
# Last modified: 7 March 2002 # Last modified: 2 June 2007
# #
# The programs built by this makefile are described in the book, # The programs built by this makefile are described in the book,
# "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and # "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and
# Associates, 1999). Go buy a copy, eh? Buy some for friends # Associates, 1999). Go buy a copy, eh? Well, OK, it's not
# and family, too. (Not that this is a blatant plug or anything.) # generally for sale anymore, but it's the thought that counts,
# right? (Hint: http://www.libpng.org/pub/png/book/ )
# #
# Invoke this makefile from a shell prompt in the usual way; for example: # Invoke this makefile from a shell prompt in the usual way; for example:
# #
# make -f Makefile.unx # make -f Makefile.unx
# #
# This makefile assumes libpng and zlib have already been built or downloaded # This makefile assumes libpng and zlib have already been built or downloaded
# and are both installed in /usr/local/{include,lib} (as indicated by the # and are installed in /usr/local/{include,lib} or as otherwise indicated by
# PNG* and Z* macros below). Edit as appropriate--choose only ONE each of # the PNG* and Z* macros below. Edit as appropriate--choose only ONE each of
# the PNGINC, PNGLIB, ZINC and ZLIB lines. # the PNGINC, PNGLIBd, PNGLIBs, ZINC, ZLIBd and ZLIBs lines.
# #
# This makefile builds statically linked executables (against libpng and zlib, # This makefile builds both dynamically and statically linked executables
# that is), but that can be changed by uncommenting the appropriate PNGLIB and # (against libpng and zlib, that is), but that can be changed by modifying
# ZLIB lines. # the "EXES =" line. (You need only one set, but for testing it can be handy
# to have both.)
# macros -------------------------------------------------------------------- # macros --------------------------------------------------------------------
PNGINC = -I/usr/local/include/libpng12 #PNGDIR = /usr/local/lib
#PNGLIB = -L/usr/local/lib -lpng12 # dynamically linked against libpng #PNGINC = -I/usr/local/include/libpng14
PNGLIB = /usr/local/lib/libpng12.a # statically linked against libpng #PNGLIBd = -L$(PNGDIR) -lpng14 # dynamically linked, installed libpng
#PNGLIBs = $(PNGDIR)/libpng14.a # statically linked, installed libpng
# or: # or:
#PNGINC = -I../libpng PNGDIR = ../..# this one is for libpng-x.y.z/contrib/gregbook builds
#PNGLIB = -L../libpng -lpng #PNGDIR = ../libpng
#PNGLIB = ../libpng/libpng.a PNGINC = -I$(PNGDIR)
PNGLIBd = -Wl,-rpath,$(PNGDIR) -L$(PNGDIR) -lpng14 # dynamically linked
PNGLIBs = $(PNGDIR)/libpng.a # statically linked, local libpng
ZDIR = /usr/local/lib
#ZDIR = /usr/lib64
ZINC = -I/usr/local/include ZINC = -I/usr/local/include
#ZLIB = -L/usr/local/lib -lz # dynamically linked against zlib ZLIBd = -L$(ZDIR) -lz # dynamically linked against zlib
ZLIB = /usr/local/lib/libz.a # statically linked against zlib ZLIBs = $(ZDIR)/libz.a # statically linked against zlib
#ZINC = -I../zlib # or:
#ZLIB = -L../zlib -lz #ZDIR = ../zlib
#ZLIB = ../zlib/libz.a #ZINC = -I$(ZDIR)
#ZLIBd = -Wl,-rpath,$(ZDIR) -L$(ZDIR) -lz # -rpath allows in-place testing
#ZLIBs = $(ZDIR)/libz.a
#XINC = -I/usr/include # old-style, stock X distributions #XINC = -I/usr/include # old-style, stock X distributions
#XLIB = -L/usr/lib/X11 -lX11 #XLIB = -L/usr/lib/X11 -lX11 # (including SGI IRIX)
#XINC = -I/usr/openwin/include # Sun workstations (OpenWindows) #XINC = -I/usr/openwin/include # Sun workstations (OpenWindows)
#XLIB = -L/usr/openwin/lib -lX11 #XLIB = -L/usr/openwin/lib -lX11
XINC = -I/usr/X11R6/include # new X distributions (XFree86, etc.) XINC = -I/usr/X11R6/include # new X distributions (X.org, etc.)
XLIB = -L/usr/X11R6/lib -lX11 XLIB = -L/usr/X11R6/lib -lX11
#XLIB = -L/usr/X11R6/lib64 -lX11 # e.g., Red Hat on AMD64
INCS = $(PNGINC) $(ZINC) $(XINC) INCS = $(PNGINC) $(ZINC) $(XINC)
RLIBS = $(PNGLIB) $(ZLIB) $(XLIB) -lm RLIBSd = $(PNGLIBd) $(ZLIBd) $(XLIB) -lm
WLIBS = $(PNGLIB) $(ZLIB) RLIBSs = $(PNGLIBs) $(ZLIBs) $(XLIB) -lm
WLIBSd = $(PNGLIBd) $(ZLIBd) -lm
WLIBSs = $(PNGLIBs) $(ZLIBs)
CC = gcc CC = gcc
LD = gcc LD = gcc
RM = rm -f RM = rm -f
CFLAGS = -O -Wall $(INCS) CFLAGS = -O -Wall $(INCS) -DFEATURE_LOOP
# [note that -Wall is a gcc-specific compilation flag ("most warnings on")] # [note that -Wall is a gcc-specific compilation flag ("most warnings on")]
# [-ansi, -pedantic and -W can also be used] # [-ansi, -pedantic and -W can also be used]
LDFLAGS = LDFLAGS =
O = .o O = .o
E = E =
RPNG = rpng-x RPNG = rpng-x
RPNG2 = rpng2-x RPNG2 = rpng2-x
WPNG = wpng WPNG = wpng
RPNGs = $(RPNG)-static
RPNG2s = $(RPNG2)-static
WPNGs = $(WPNG)-static
ROBJS = $(RPNG)$(O) readpng$(O) ROBJS = $(RPNG)$(O) readpng$(O)
ROBJS2 = $(RPNG2)$(O) readpng2$(O) ROBJS2 = $(RPNG2)$(O) readpng2$(O)
WOBJS = $(WPNG)$(O) writepng$(O) WOBJS = $(WPNG)$(O) writepng$(O)
EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E) STATIC_EXES = $(RPNGs)$(E) $(RPNG2s)$(E) $(WPNGs)$(E)
DYNAMIC_EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)
EXES = $(STATIC_EXES) $(DYNAMIC_EXES)
# implicit make rules ------------------------------------------------------- # implicit make rules -------------------------------------------------------
@@ -80,14 +99,23 @@ EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)
all: $(EXES) all: $(EXES)
$(RPNGs)$(E): $(ROBJS)
$(LD) $(LDFLAGS) -o $@ $(ROBJS) $(RLIBSs)
$(RPNG)$(E): $(ROBJS) $(RPNG)$(E): $(ROBJS)
$(LD) $(LDFLAGS) -o $@ $(ROBJS) $(RLIBS) $(LD) $(LDFLAGS) -o $@ $(ROBJS) $(RLIBSd)
$(RPNG2s)$(E): $(ROBJS2)
$(LD) $(LDFLAGS) -o $@ $(ROBJS2) $(RLIBSs)
$(RPNG2)$(E): $(ROBJS2) $(RPNG2)$(E): $(ROBJS2)
$(LD) $(LDFLAGS) -o $@ $(ROBJS2) $(RLIBS) $(LD) $(LDFLAGS) -o $@ $(ROBJS2) $(RLIBSd)
$(WPNGs)$(E): $(WOBJS)
$(LD) $(LDFLAGS) -o $@ $(WOBJS) $(WLIBSs)
$(WPNG)$(E): $(WOBJS) $(WPNG)$(E): $(WOBJS)
$(LD) $(LDFLAGS) -o $@ $(WOBJS) $(WLIBS) $(LD) $(LDFLAGS) -o $@ $(WOBJS) $(WLIBSd)
$(RPNG)$(O): $(RPNG).c readpng.h $(RPNG)$(O): $(RPNG).c readpng.h
$(RPNG2)$(O): $(RPNG2).c readpng2.h $(RPNG2)$(O): $(RPNG2).c readpng2.h

View File

@@ -1,11 +1,12 @@
# Sample makefile for rpng-win / rpng2-win / wpng using MSVC and NMAKE. # Sample makefile for rpng-win / rpng2-win / wpng using MSVC and NMAKE.
# Greg Roelofs # Greg Roelofs
# Last modified: 16 February 1999 # Last modified: 2 June 2007
# #
# The programs built by this makefile are described in the book, # The programs built by this makefile are described in the book,
# "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and # "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and
# Associates, 1999). Go buy a copy, eh? Buy some for friends # Associates, 1999). Go buy a copy, eh? Well, OK, it's not
# and family, too. (Not that this is a blatant plug or anything.) # generally for sale anymore, but it's the thought that counts,
# right? (Hint: http://www.libpng.org/pub/png/book/ )
# #
# Invoke this makefile from a DOS prompt window via: # Invoke this makefile from a DOS prompt window via:
# #
@@ -53,7 +54,7 @@ CC = cl
LD = link LD = link
RM = del RM = del
CFLAGS = -nologo -O -W3 $(INCS) $(cvars) CFLAGS = -nologo -O -W3 $(INCS) $(cvars)
# [note that -Wall is an MSVC-specific compilation flag ("all warnings on")] # [note that -W3 is an MSVC-specific compilation flag ("all warnings on")]
# [see %devstudio%\vc\include\win32.mak for cvars macro definition] # [see %devstudio%\vc\include\win32.mak for cvars macro definition]
O = .obj O = .obj
E = .exe E = .exe

View File

@@ -22,7 +22,8 @@ below.
Files: Files:
README this file README this file
LICENSE terms of distribution and reuse (BSD-like) LICENSE terms of distribution and reuse (BSD-like or GNU GPL)
COPYING GNU General Public License (GPL)
Makefile.unx Unix makefile Makefile.unx Unix makefile
Makefile.w32 Windows (MSVC) makefile Makefile.w32 Windows (MSVC) makefile
@@ -54,15 +55,15 @@ mation and links to the latest version of the source code, and Chapters
13-15 of the book for detailed discussion of the three programs. 13-15 of the book for detailed discussion of the three programs.
Greg Roelofs Greg Roelofs
newt@pobox.com http://pobox.com/~newt/greg_contact.html
30 June 2001 16 March 2008
BUILD INSTRUCTIONS BUILD INSTRUCTIONS
- Prerequisites (in order of compilation): - Prerequisites (in order of compilation):
- zlib http://www.gzip.org/zlib/ - zlib http://zlib.net/
- libpng http://www.libpng.org/pub/png/libpng.html - libpng http://www.libpng.org/pub/png/libpng.html
- pngbook http://www.libpng.org/pub/png/book/sources.html - pngbook http://www.libpng.org/pub/png/book/sources.html
@@ -150,9 +151,9 @@ BUILD INSTRUCTIONS
To run the programs, they probably first need to be set up as "foreign To run the programs, they probably first need to be set up as "foreign
symbols," with "disk" and "dir" set appropriately: symbols," with "disk" and "dir" set appropriately:
$ rpng == "$disk:[dir]rpng-x.exe" $ rpng == "$disk:[dir]rpng-x.exe"
$ rpng2 == "$disk:[dir]rpng2-x.exe" $ rpng2 == "$disk:[dir]rpng2-x.exe"
$ wpng == "$disk:[dir]wpng.exe" $ wpng == "$disk:[dir]wpng.exe"
All three will print a basic usage screen when run without any command- All three will print a basic usage screen when run without any command-
line arguments; see the book for more details. Note that the options line arguments; see the book for more details. Note that the options
@@ -164,7 +165,7 @@ RUNNING THE PROGRAMS: (VERY) BRIEF INTRO
rpng is a simple PNG viewer that can display transparent PNGs with a rpng is a simple PNG viewer that can display transparent PNGs with a
specified background color; for example, specified background color; for example,
rpng -bgcolor #ff0000 toucan.png rpng -bgcolor \#ff0000 toucan.png
would display the image with a red background. rpng2 is a progressive would display the image with a red background. rpng2 is a progressive
viewer that simulates a web browser in some respects; it can display viewer that simulates a web browser in some respects; it can display
@@ -176,7 +177,7 @@ RUNNING THE PROGRAMS: (VERY) BRIEF INTRO
wpng is a purely command-line image converter from binary PBMPLUS/NetPBM wpng is a purely command-line image converter from binary PBMPLUS/NetPBM
format (.pgm or .ppm) to PNG; for example, format (.pgm or .ppm) to PNG; for example,
wpng -time < toucan.ppm > toucan.png wpng -time < toucan-notrans.ppm > toucan-notrans.png
would convert the specified PPM file (using redirection) to PNG, auto- would convert the specified PPM file (using redirection) to PNG, auto-
matically setting the PNG modification-time chunk. matically setting the PNG modification-time chunk.

View File

@@ -4,13 +4,20 @@
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved. Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind, This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of be held liable for any damages arising in any way from the use of
this software. this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose, Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions: it freely, subject to the following restrictions:
@@ -27,6 +34,23 @@
and contributors for the book, "PNG: The Definitive Guide," and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates. published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
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 of the License, 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, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
#include <stdio.h> #include <stdio.h>
@@ -69,7 +93,7 @@ int readpng_init(FILE *infile, ulg *pWidth, ulg *pHeight)
* have used slightly more general png_sig_cmp() function instead */ * have used slightly more general png_sig_cmp() function instead */
fread(sig, 1, 8, infile); fread(sig, 1, 8, infile);
if (!png_check_sig(sig, 8)) if (png_sig_cmp(sig, 0, 8))
return 1; /* bad signature */ return 1; /* bad signature */

View File

@@ -4,13 +4,20 @@
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved. Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind, This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of be held liable for any damages arising in any way from the use of
this software. this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose, Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions: it freely, subject to the following restrictions:
@@ -27,6 +34,23 @@
and contributors for the book, "PNG: The Definitive Guide," and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates. published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
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 of the License, 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, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
#ifndef TRUE #ifndef TRUE

View File

@@ -4,19 +4,20 @@
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Changelog: Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
- 1.01: initial public release
- 1.02: added code to skip unused chunks (GR-P)
---------------------------------------------------------------------------
Copyright (c) 1998-2002 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind, This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of be held liable for any damages arising in any way from the use of
this software. this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose, Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions: it freely, subject to the following restrictions:
@@ -33,6 +34,23 @@
and contributors for the book, "PNG: The Definitive Guide," and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates. published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
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 of the License, 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, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
@@ -55,79 +73,10 @@ static void readpng2_error_handler(png_structp png_ptr, png_const_charp msg);
void readpng2_version_info(void) void readpng2_version_info(void)
{ {
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && \ fprintf(stderr, " Compiled with libpng %s; using libpng %s\n",
(defined(__i386__) || defined(_M_IX86)) && \ PNG_LIBPNG_VER_STRING, png_libpng_ver);
defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
/*
* WARNING: This preprocessor approach means that the following code
* cannot be used with a libpng DLL older than 1.2.0--the
* compiled-in symbols for the new functions will not exist.
* (Could use dlopen() and dlsym() on Unix and corresponding
* calls for Windows, but not portable...)
*/
{
int mmxsupport = png_mmx_support();
if (mmxsupport < 0)
fprintf(stderr, " Compiled with libpng %s; using libpng %s "
"without MMX support.\n", PNG_LIBPNG_VER_STRING, png_libpng_ver);
else {
int compilerID;
png_uint_32 mmx_mask = png_get_mmx_flagmask(
PNG_SELECT_READ | PNG_SELECT_WRITE, &compilerID);
fprintf(stderr, " Compiled with libpng %s; using libpng %s " fprintf(stderr, " and with zlib %s; using zlib %s.\n",
"with MMX support\n (%s version).", PNG_LIBPNG_VER_STRING,
png_libpng_ver, compilerID == 1? "MSVC++" :
(compilerID == 2? "GNU C" : "unknown"));
fprintf(stderr, " Processor %s MMX instructions.\n",
mmxsupport? "supports" : "does not support");
if (mmxsupport > 0) {
int num_optims = 0;
fprintf(stderr,
" Potential MMX optimizations supported by libpng:\n");
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_FILTER_SUB)
++num_optims;
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_FILTER_UP)
++num_optims;
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_FILTER_AVG)
++num_optims;
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH)
++num_optims;
if (num_optims)
fprintf(stderr,
" decoding %s row filters (reading)\n",
(num_optims == 4)? "all non-trivial" : "some");
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) {
fprintf(stderr, " combining rows (reading)\n");
++num_optims;
}
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_INTERLACE) {
fprintf(stderr,
" expanding interlacing (reading)\n");
++num_optims;
}
mmx_mask &= ~( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
| PNG_ASM_FLAG_MMX_READ_INTERLACE \
| PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
| PNG_ASM_FLAG_MMX_READ_FILTER_UP \
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH );
if (mmx_mask) {
fprintf(stderr, " other (unknown)\n");
++num_optims;
}
if (num_optims == 0)
fprintf(stderr, " (none)\n");
}
}
}
#else
fprintf(stderr, " Compiled with libpng %s; using libpng %s "
"without MMX support.\n", PNG_LIBPNG_VER_STRING, png_libpng_ver);
#endif
fprintf(stderr, " Compiled with zlib %s; using zlib %s.\n",
ZLIB_VERSION, zlib_version); ZLIB_VERSION, zlib_version);
} }
@@ -136,7 +85,7 @@ void readpng2_version_info(void)
int readpng2_check_sig(uch *sig, int num) int readpng2_check_sig(uch *sig, int num)
{ {
return png_check_sig(sig, num); return !png_sig_cmp(sig, 0, num);
} }
@@ -179,40 +128,38 @@ int readpng2_init(mainprog_info *mainprog_ptr)
return 2; return 2;
} }
/* prepare the reader to ignore all recognized chunks whose data isn't
* going to be used, i.e., all chunks recognized by libpng except for
* IHDR, PLTE, IDAT, IEND, tRNS, bKGD, gAMA, and sRGB : */
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
/* prepare the reader to ignore all recognized chunks whose data won't be
* used, i.e., all chunks recognized by libpng except for IHDR, PLTE, IDAT,
* IEND, tRNS, bKGD, gAMA, and sRGB (small performance improvement) */
{ {
#ifndef HANDLE_CHUNK_NEVER /* These byte strings were copied from png.h. If a future libpng
/* prior to libpng-1.2.5, this macro was internal, so we define it here. */ * version recognizes more chunks, add them to this list. If a
# define HANDLE_CHUNK_NEVER 1 * future version of readpng2.c recognizes more chunks, delete them
#endif * from this list. */
/* these byte strings were copied from png.h. static /* const */ png_byte chunks_to_ignore[] = {
* If a future libpng version recognizes more chunks, add them 99, 72, 82, 77, '\0', /* cHRM */
* to this list. If a future version of readpng2.c recognizes 104, 73, 83, 84, '\0', /* hIST */
* more chunks, delete them from this list. */ 105, 67, 67, 80, '\0', /* iCCP */
png_byte png_chunk_types_to_ignore[]= 105, 84, 88, 116, '\0', /* iTXt */
{ 99, 72, 82, 77, '\0', /* cHRM */ 111, 70, 70, 115, '\0', /* oFFs */
104, 73, 83, 84, '\0', /* hIST */ 112, 67, 65, 76, '\0', /* pCAL */
105, 67, 67, 80, '\0', /* iCCP */ 112, 72, 89, 115, '\0', /* pHYs */
105, 84, 88, 116, '\0', /* iTXt */ 115, 66, 73, 84, '\0', /* sBIT */
111, 70, 70, 115, '\0', /* oFFs */ 115, 67, 65, 76, '\0', /* sCAL */
112, 67, 65, 76, '\0', /* pCAL */ 115, 80, 76, 84, '\0', /* sPLT */
115, 67, 65, 76, '\0', /* sCAL */ 115, 84, 69, 82, '\0', /* sTER */
112, 72, 89, 115, '\0', /* pHYs */ 116, 69, 88, 116, '\0', /* tEXt */
115, 66, 73, 84, '\0', /* sBIT */ 116, 73, 77, 69, '\0', /* tIME */
115, 80, 76, 84, '\0', /* sPLT */ 122, 84, 88, 116, '\0' /* zTXt */
116, 69, 88, 116, '\0', /* tEXt */ };
116, 73, 77, 69, '\0', /* tIME */
122, 84, 88, 116, '\0'}; /* zTXt */
#define NUM_PNG_CHUNK_TYPES_TO_IGNORE 13
png_set_keep_unknown_chunks(png_ptr, HANDLE_CHUNK_NEVER, png_set_keep_unknown_chunks(png_ptr, 1 /* PNG_HANDLE_CHUNK_NEVER */,
png_chunk_types_to_ignore, NUM_PNG_CHUNK_TYPES_TO_IGNORE); chunks_to_ignore, sizeof(chunks_to_ignore)/5);
} }
#endif #endif /* PNG_HANDLE_AS_UNKNOWN_SUPPORTED */
/* instead of doing png_init_io() here, now we set up our callback /* instead of doing png_init_io() here, now we set up our callback
* functions for progressive decoding */ * functions for progressive decoding */
@@ -221,96 +168,6 @@ int readpng2_init(mainprog_info *mainprog_ptr)
readpng2_info_callback, readpng2_row_callback, readpng2_end_callback); readpng2_info_callback, readpng2_row_callback, readpng2_end_callback);
/*
* may as well enable or disable MMX routines here, if supported;
*
* to enable all: mask = png_get_mmx_flagmask (
* PNG_SELECT_READ | PNG_SELECT_WRITE, &compilerID);
* flags = png_get_asm_flags (png_ptr);
* flags |= mask;
* png_set_asm_flags (png_ptr, flags);
*
* to disable all: mask = png_get_mmx_flagmask (
* PNG_SELECT_READ | PNG_SELECT_WRITE, &compilerID);
* flags = png_get_asm_flags (png_ptr);
* flags &= ~mask;
* png_set_asm_flags (png_ptr, flags);
*/
#if (defined(__i386__) || defined(_M_IX86)) && \
defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
/*
* WARNING: This preprocessor approach means that the following code
* cannot be used with a libpng DLL older than 1.2.0--the
* compiled-in symbols for the new functions will not exist.
* (Could use dlopen() and dlsym() on Unix and corresponding
* calls for Windows, but not portable...)
*/
{
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
png_uint_32 mmx_disable_mask = 0;
png_uint_32 asm_flags, mmx_mask;
int compilerID;
if (mainprog_ptr->nommxfilters)
mmx_disable_mask |= ( PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
| PNG_ASM_FLAG_MMX_READ_FILTER_UP \
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH );
if (mainprog_ptr->nommxcombine)
mmx_disable_mask |= PNG_ASM_FLAG_MMX_READ_COMBINE_ROW;
if (mainprog_ptr->nommxinterlace)
mmx_disable_mask |= PNG_ASM_FLAG_MMX_READ_INTERLACE;
asm_flags = png_get_asm_flags(png_ptr);
png_set_asm_flags(png_ptr, asm_flags & ~mmx_disable_mask);
/* Now query libpng's asm settings, just for yuks. Note that this
* differs from the querying of its *potential* MMX capabilities
* in readpng2_version_info(); this is true runtime verification. */
asm_flags = png_get_asm_flags(png_ptr);
mmx_mask = png_get_mmx_flagmask(PNG_SELECT_READ | PNG_SELECT_WRITE,
&compilerID);
if (asm_flags & PNG_ASM_FLAG_MMX_SUPPORT_COMPILED)
fprintf(stderr,
" MMX support (%s version) is compiled into libpng\n",
compilerID == 1? "MSVC++" :
(compilerID == 2? "GNU C" : "unknown"));
else
fprintf(stderr, " MMX support is not compiled into libpng\n");
fprintf(stderr, " MMX instructions are %ssupported by CPU\n",
(asm_flags & PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU)? "" : "not ");
fprintf(stderr, " MMX read support for combining rows is %sabled\n",
(asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)? "en" : "dis");
fprintf(stderr,
" MMX read support for expanding interlacing is %sabled\n",
(asm_flags & PNG_ASM_FLAG_MMX_READ_INTERLACE)? "en" : "dis");
fprintf(stderr, " MMX read support for \"sub\" filter is %sabled\n",
(asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB)? "en" : "dis");
fprintf(stderr, " MMX read support for \"up\" filter is %sabled\n",
(asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP)? "en" : "dis");
fprintf(stderr, " MMX read support for \"avg\" filter is %sabled\n",
(asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG)? "en" : "dis");
fprintf(stderr, " MMX read support for \"Paeth\" filter is %sabled\n",
(asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH)? "en" : "dis");
asm_flags &= (mmx_mask & ~( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
| PNG_ASM_FLAG_MMX_READ_INTERLACE \
| PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
| PNG_ASM_FLAG_MMX_READ_FILTER_UP \
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ));
if (asm_flags)
fprintf(stderr,
" additional MMX support is also enabled (0x%02lx)\n",
asm_flags);
#else /* !PNG_ASSEMBLER_CODE_SUPPORTED */
fprintf(stderr, " MMX querying is disabled in libpng.\n");
#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
}
#endif
/* make sure we save our pointers for use in readpng2_decode_data() */ /* make sure we save our pointers for use in readpng2_decode_data() */
mainprog_ptr->png_ptr = png_ptr; mainprog_ptr->png_ptr = png_ptr;
@@ -358,6 +215,7 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
{ {
mainprog_info *mainprog_ptr; mainprog_info *mainprog_ptr;
int color_type, bit_depth; int color_type, bit_depth;
png_uint_32 width, height;
double gamma; double gamma;
@@ -393,8 +251,10 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
/* this is just like in the non-progressive case */ /* this is just like in the non-progressive case */
png_get_IHDR(png_ptr, info_ptr, &mainprog_ptr->width, png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
&mainprog_ptr->height, &bit_depth, &color_type, NULL, NULL, NULL); NULL, NULL, NULL);
mainprog_ptr->width = (ulg)width;
mainprog_ptr->height = (ulg)height;
/* since we know we've read all of the PNG file's "header" (i.e., up /* since we know we've read all of the PNG file's "header" (i.e., up

View File

@@ -4,13 +4,20 @@
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 1998-2001 Greg Roelofs. All rights reserved. Copyright (c) 1998-2008 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind, This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of be held liable for any damages arising in any way from the use of
this software. this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose, Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions: it freely, subject to the following restrictions:
@@ -27,6 +34,23 @@
and contributors for the book, "PNG: The Definitive Guide," and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates. published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
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 of the License, 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, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
#ifndef TRUE #ifndef TRUE
@@ -45,6 +69,12 @@
# define Trace(x) ; # define Trace(x) ;
#endif #endif
enum rpng2_states {
kPreInit = 0,
kWindowInit,
kDone
};
typedef unsigned char uch; typedef unsigned char uch;
typedef unsigned short ush; typedef unsigned short ush;
typedef unsigned long ulg; typedef unsigned long ulg;
@@ -66,12 +96,7 @@ typedef struct _mainprog_info {
int rowbytes; int rowbytes;
int channels; int channels;
int need_bgcolor; int need_bgcolor;
#if (defined(__i386__) || defined(_M_IX86)) int state;
int nommxfilters;
int nommxcombine;
int nommxinterlace;
#endif
int done;
uch bg_red; uch bg_red;
uch bg_green; uch bg_green;
uch bg_blue; uch bg_blue;

179
contrib/gregbook/readppm.c Normal file
View File

@@ -0,0 +1,179 @@
/*---------------------------------------------------------------------------
rpng - simple PNG display program readppm.c
---------------------------------------------------------------------------
This is a special-purpose replacement for readpng.c that allows binary
PPM files to be used in place of PNG images.
---------------------------------------------------------------------------
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of
this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions:
1. Redistributions of source code must retain the above copyright
notice, disclaimer, and this list of conditions.
2. Redistributions in binary form must reproduce the above copyright
notice, disclaimer, and this list of conditions in the documenta-
tion and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this
software must display the following acknowledgment:
This product includes software developed by Greg Roelofs
and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
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 of the License, 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, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include "readpng.h" /* typedefs, common macros, public prototypes */
ulg width, height;
int bit_depth, color_type, channels;
uch *image_data = NULL;
FILE *saved_infile;
void readpng_version_info()
{
fprintf(stderr, " Compiled without libpng, zlib or PBMPLUS/NetPBM.\n");
}
/* return value = 0 for success, 1 for bad sig, 2 for bad IHDR, 4 for no mem */
int readpng_init(FILE *infile, ulg *pWidth, ulg *pHeight)
{
static uch ppmline[256];
int maxval;
saved_infile = infile;
fgets(ppmline, 256, infile);
if (ppmline[0] != 'P' || ppmline[1] != '6') {
fprintf(stderr, "ERROR: not a PPM file\n");
return 1;
}
/* possible color types: P5 = grayscale (0), P6 = RGB (2), P8 = RGBA (6) */
if (ppmline[1] == '6') {
color_type = 2;
channels = 3;
} else if (ppmline[1] == '8') {
color_type = 6;
channels = 4;
} else /* if (ppmline[1] == '5') */ {
color_type = 0;
channels = 1;
}
do {
fgets(ppmline, 256, infile);
} while (ppmline[0] == '#');
sscanf(ppmline, "%lu %lu", &width, &height);
do {
fgets(ppmline, 256, infile);
} while (ppmline[0] == '#');
sscanf(ppmline, "%d", &maxval);
if (maxval != 255) {
fprintf(stderr, "ERROR: maxval = %d\n", maxval);
return 2;
}
bit_depth = 8;
*pWidth = width;
*pHeight = height;
return 0;
}
/* returns 0 if succeeds, 1 if fails due to no bKGD chunk, 2 if libpng error;
* scales values to 8-bit if necessary */
int readpng_get_bgcolor(uch *red, uch *green, uch *blue)
{
return 1;
}
/* display_exponent == LUT_exponent * CRT_exponent */
uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes)
{
ulg rowbytes;
/* expand palette images to RGB, low-bit-depth grayscale images to 8 bits,
* transparency chunks to full alpha channel; strip 16-bit-per-sample
* images to 8 bits per sample; and convert grayscale to RGB[A] */
/* GRR WARNING: grayscale needs to be expanded and channels reset! */
*pRowbytes = rowbytes = channels*width;
*pChannels = channels;
if ((image_data = (uch *)malloc(rowbytes*height)) == NULL) {
return NULL;
}
Trace((stderr, "readpng_get_image: rowbytes = %ld, height = %ld\n", rowbytes, height));
/* now we can go ahead and just read the whole image */
fread(image_data, 1L, rowbytes*height, saved_infile);
return image_data;
}
void readpng_cleanup(int free_image_data)
{
if (free_image_data && image_data) {
free(image_data);
image_data = NULL;
}
}

View File

@@ -22,16 +22,25 @@
- 1.02: added extra set of parentheses to png_jmpbuf() macro; fixed - 1.02: added extra set of parentheses to png_jmpbuf() macro; fixed
command-line parsing bug command-line parsing bug
- 1.10: enabled "message window"/console (thanks to David Geldreich) - 1.10: enabled "message window"/console (thanks to David Geldreich)
- 2.00: dual-licensed (added GNU GPL)
- 2.01: fixed improper display of usage screen on PNG error(s)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 1998-2001 Greg Roelofs. All rights reserved. Copyright (c) 1998-2008 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind, This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of be held liable for any damages arising in any way from the use of
this software. this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose, Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions: it freely, subject to the following restrictions:
@@ -48,18 +57,61 @@
and contributors for the book, "PNG: The Definitive Guide," and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates. published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
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 of the License, 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, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
#define PROGNAME "rpng-win" #define PROGNAME "rpng-win"
#define LONGNAME "Simple PNG Viewer for Windows" #define LONGNAME "Simple PNG Viewer for Windows"
#define VERSION "1.20 of 28 May 2001" #define VERSION "2.01 of 16 March 2008"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <windows.h> #include <windows.h>
#ifdef __CYGWIN__
/* getch replacement. Turns out, we don't really need this,
* but leave it here if we ever enable any of the uses of
* _getch in the main code
*/
#include <unistd.h>
#include <termio.h>
#include <sys/ioctl.h>
int repl_getch( void )
{
char ch;
int fd = fileno(stdin);
struct termio old_tty, new_tty;
ioctl(fd, TCGETA, &old_tty);
new_tty = old_tty;
new_tty.c_lflag &= ~(ICANON | ECHO | ISIG);
ioctl(fd, TCSETA, &new_tty);
fread(&ch, 1, sizeof(ch), stdin);
ioctl(fd, TCSETA, &old_tty);
return ch;
}
#define _getch repl_getch
#else
#include <conio.h> /* only for _getch() */ #include <conio.h> /* only for _getch() */
#endif
/* #define DEBUG : this enables the Trace() macros */ /* #define DEBUG : this enables the Trace() macros */
@@ -85,10 +137,9 @@ static void rpng_win_cleanup(void);
LRESULT CALLBACK rpng_win_wndproc(HWND, UINT, WPARAM, LPARAM); LRESULT CALLBACK rpng_win_wndproc(HWND, UINT, WPARAM, LPARAM);
static char titlebar[1024], *window_name = titlebar; static char titlebar[1024];
static char *progname = PROGNAME; static char *progname = PROGNAME;
static char *appname = LONGNAME; static char *appname = LONGNAME;
static char *icon_name = PROGNAME; /* GRR: not (yet) used */
static char *filename; static char *filename;
static FILE *infile; static FILE *infile;
@@ -128,7 +179,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
filename = (char *)NULL; filename = (char *)NULL;
#ifndef __CYGWIN__
/* First reenable console output, which normally goes to the bit bucket /* First reenable console output, which normally goes to the bit bucket
* for windowed apps. Closing the console window will terminate the * for windowed apps. Closing the console window will terminate the
* app. Thanks to David.Geldreich@realviz.com for supplying the magical * app. Thanks to David.Geldreich@realviz.com for supplying the magical
@@ -137,6 +188,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
AllocConsole(); AllocConsole();
freopen("CONOUT$", "a", stderr); freopen("CONOUT$", "a", stderr);
freopen("CONOUT$", "a", stdout); freopen("CONOUT$", "a", stdout);
#endif
/* Next set the default value for our display-system exponent, i.e., /* Next set the default value for our display-system exponent, i.e.,
@@ -247,9 +299,43 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
} }
} }
if (!filename) { if (!filename)
++error; ++error;
} else if (!(infile = fopen(filename, "rb"))) {
/* print usage screen if any errors up to this point */
if (error) {
#ifndef __CYGWIN__
int ch;
#endif
fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname);
readpng_version_info();
fprintf(stderr, "\n"
"Usage: %s [-gamma exp] [-bgcolor bg] file.png\n"
" exp \ttransfer-function exponent (``gamma'') of the display\n"
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
"\t\t to the product of the lookup-table exponent (varies)\n"
"\t\t and the CRT exponent (usually 2.2); must be positive\n"
" bg \tdesired background color in 7-character hex RGB format\n"
"\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
"\t\t used with transparent images\n"
"\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
#ifndef __CYGWIN__
"Press Q or Esc to quit this usage screen.\n"
#endif
"\n", PROGNAME, default_display_exponent);
#ifndef __CYGWIN__
do
ch = _getch();
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
#endif
exit(1);
}
if (!(infile = fopen(filename, "rb"))) {
fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename); fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename);
++error; ++error;
} else { } else {
@@ -262,8 +348,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
break; break;
case 2: case 2:
fprintf(stderr, PROGNAME fprintf(stderr, PROGNAME
": [%s] has bad IHDR (libpng longjmp)\n", ": [%s] has bad IHDR (libpng longjmp)\n", filename);
filename);
break; break;
case 4: case 4:
fprintf(stderr, PROGNAME ": insufficient memory\n"); fprintf(stderr, PROGNAME ": insufficient memory\n");
@@ -280,34 +365,25 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
} }
/* usage screen */
if (error) { if (error) {
#ifndef __CYGWIN__
int ch; int ch;
#endif
fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname); fprintf(stderr, PROGNAME ": aborting.\n");
readpng_version_info(); #ifndef __CYGWIN__
fprintf(stderr, "\n"
"Usage: %s [-gamma exp] [-bgcolor bg] file.png\n"
" exp \ttransfer-function exponent (``gamma'') of the display\n"
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
"\t\t to the product of the lookup-table exponent (varies)\n"
"\t\t and the CRT exponent (usually 2.2); must be positive\n"
" bg \tdesired background color in 7-character hex RGB format\n"
"\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
"\t\t used with transparent images\n"
"\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
"Press Q or Esc to quit this usage screen.\n"
"\n", PROGNAME, default_display_exponent);
do do
ch = _getch(); ch = _getch();
while (ch != 'q' && ch != 'Q' && ch != 0x1B); while (ch != 'q' && ch != 'Q' && ch != 0x1B);
exit(1); #endif
exit(2);
} else { } else {
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname); fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
#ifndef __CYGWIN__
fprintf(stderr, fprintf(stderr,
"\n [console window: closing this window will terminate %s]\n\n", "\n [console window: closing this window will terminate %s]\n\n",
PROGNAME); PROGNAME);
#endif
} }
@@ -325,9 +401,14 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
* check for one in the PNG file--if not, the initialized values of 0 * check for one in the PNG file--if not, the initialized values of 0
* (black) will be used */ * (black) will be used */
if (have_bg) if (have_bg) {
sscanf(bgstr+1, "%2x%2x%2x", &bg_red, &bg_green, &bg_blue); unsigned r, g, b; /* this approach quiets compiler warnings */
else if (readpng_get_bgcolor(&bg_red, &bg_green, &bg_blue) > 1) {
sscanf(bgstr+1, "%2x%2x%2x", &r, &g, &b);
bg_red = (uch)r;
bg_green = (uch)g;
bg_blue = (uch)b;
} else if (readpng_get_bgcolor(&bg_red, &bg_green, &bg_blue) > 1) {
readpng_cleanup(TRUE); readpng_cleanup(TRUE);
fprintf(stderr, PROGNAME fprintf(stderr, PROGNAME
": libpng error while checking for background color\n"); ": libpng error while checking for background color\n");
@@ -375,7 +456,12 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
/* wait for the user to tell us when to quit */ /* wait for the user to tell us when to quit */
printf( printf(
"Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n"); #ifndef __CYGWIN__
"Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n"
#else
"Done. Press mouse button 1 (within image window) to quit.\n"
#endif
);
fflush(stdout); fflush(stdout);
while (GetMessage(&msg, NULL, 0, 0)) { while (GetMessage(&msg, NULL, 0, 0)) {

View File

@@ -9,7 +9,7 @@
by Martin Zinser under OpenVMS; may work under OS/2 with some tweaking). by Martin Zinser under OpenVMS; may work under OS/2 with some tweaking).
to do: to do:
- 8-bit support - 8-bit (colormapped) X support
- use %.1023s to simplify truncation of title-bar string? - use %.1023s to simplify truncation of title-bar string?
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
@@ -21,18 +21,28 @@
- 1.10: added support for non-default visuals; fixed X pixel-conversion - 1.10: added support for non-default visuals; fixed X pixel-conversion
- 1.11: added extra set of parentheses to png_jmpbuf() macro; fixed - 1.11: added extra set of parentheses to png_jmpbuf() macro; fixed
command-line parsing bug command-line parsing bug
- 1.12: fixed small X memory leak (thanks to Francois Petitjean) - 1.12: fixed some small X memory leaks (thanks to Fran<EFBFBD>ois Petitjean)
- 1.13: fixed XFreeGC() crash bug - 1.13: fixed XFreeGC() crash bug (thanks to Patrick Welche)
- 1.14: added support for X resources (thanks to Gerhard Niklasch)
- 2.00: dual-licensed (added GNU GPL)
- 2.01: fixed improper display of usage screen on PNG error(s)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 1998-2001 Greg Roelofs. All rights reserved. Copyright (c) 1998-2008 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind, This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of be held liable for any damages arising in any way from the use of
this software. this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose, Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions: it freely, subject to the following restrictions:
@@ -49,11 +59,30 @@
and contributors for the book, "PNG: The Definitive Guide," and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates. published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
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 of the License, 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, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
#define PROGNAME "rpng-x" #define PROGNAME "rpng-x"
#define LONGNAME "Simple PNG Viewer for X" #define LONGNAME "Simple PNG Viewer for X"
#define VERSION "1.13 of 16 August 2001" #define VERSION "2.01 of 16 March 2008"
#define RESNAME "rpng" /* our X resource application name */
#define RESCLASS "Rpng" /* our X resource class name */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@@ -91,6 +120,8 @@ static int rpng_x_msb(ulg u32val);
static char titlebar[1024], *window_name = titlebar; static char titlebar[1024], *window_name = titlebar;
static char *appname = LONGNAME; static char *appname = LONGNAME;
static char *icon_name = PROGNAME; static char *icon_name = PROGNAME;
static char *res_name = RESNAME;
static char *res_class = RESCLASS;
static char *filename; static char *filename;
static FILE *infile; static FILE *infile;
@@ -235,9 +266,33 @@ int main(int argc, char **argv)
} }
} }
if (!filename) { if (!filename)
++error; ++error;
} else if (!(infile = fopen(filename, "rb"))) {
/* print usage screen if any errors up to this point */
if (error) {
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
readpng_version_info();
fprintf(stderr, "\n"
"Usage: %s [-display xdpy] [-gamma exp] [-bgcolor bg] file.png\n"
" xdpy\tname of the target X display (e.g., ``hostname:0'')\n"
" exp \ttransfer-function exponent (``gamma'') of the display\n"
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
"\t\t to the product of the lookup-table exponent (varies)\n"
"\t\t and the CRT exponent (usually 2.2); must be positive\n"
" bg \tdesired background color in 7-character hex RGB format\n"
"\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
"\t\t used with transparent images\n"
"\nPress Q, Esc or mouse button 1 (within image window, after image\n"
"is displayed) to quit.\n"
"\n", PROGNAME, default_display_exponent);
exit(1);
}
if (!(infile = fopen(filename, "rb"))) {
fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename); fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename);
++error; ++error;
} else { } else {
@@ -250,8 +305,7 @@ int main(int argc, char **argv)
break; break;
case 2: case 2:
fprintf(stderr, PROGNAME fprintf(stderr, PROGNAME
": [%s] has bad IHDR (libpng longjmp)\n", ": [%s] has bad IHDR (libpng longjmp)\n", filename);
filename);
break; break;
case 4: case 4:
fprintf(stderr, PROGNAME ": insufficient memory\n"); fprintf(stderr, PROGNAME ": insufficient memory\n");
@@ -276,25 +330,9 @@ int main(int argc, char **argv)
} }
/* usage screen */
if (error) { if (error) {
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname); fprintf(stderr, PROGNAME ": aborting.\n");
readpng_version_info(); exit(2);
fprintf(stderr, "\n"
"Usage: %s [-display xdpy] [-gamma exp] [-bgcolor bg] file.png\n"
" xdpy\tname of the target X display (e.g., ``hostname:0'')\n"
" exp \ttransfer-function exponent (``gamma'') of the display\n"
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
"\t\t to the product of the lookup-table exponent (varies)\n"
"\t\t and the CRT exponent (usually 2.2); must be positive\n"
" bg \tdesired background color in 7-character hex RGB format\n"
"\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
"\t\t used with transparent images\n"
"\nPress Q, Esc or mouse button 1 (within image window, after image\n"
"is displayed) to quit.\n"
"\n", PROGNAME, default_display_exponent);
exit(1);
} }
@@ -399,11 +437,12 @@ static int rpng_x_create_window(void)
XEvent e; XEvent e;
XGCValues gcvalues; XGCValues gcvalues;
XSetWindowAttributes attr; XSetWindowAttributes attr;
XSizeHints *size_hints;
XTextProperty windowName, *pWindowName = &windowName; XTextProperty windowName, *pWindowName = &windowName;
XTextProperty iconName, *pIconName = &iconName; XTextProperty iconName, *pIconName = &iconName;
XVisualInfo visual_info; XVisualInfo visual_info;
XSizeHints *size_hints;
XWMHints *wm_hints; XWMHints *wm_hints;
XClassHint *class_hints;
screen = DefaultScreen(display); screen = DefaultScreen(display);
@@ -526,7 +565,7 @@ static int rpng_x_create_window(void)
if (!XStringListToTextProperty(&icon_name, 1, pIconName)) if (!XStringListToTextProperty(&icon_name, 1, pIconName))
pIconName = NULL; pIconName = NULL;
/* OK if either hints allocation fails; XSetWMProperties() allows NULLs */ /* OK if any hints allocation fails; XSetWMProperties() allows NULLs */
if ((size_hints = XAllocSizeHints()) != NULL) { if ((size_hints = XAllocSizeHints()) != NULL) {
/* window will not be resizable */ /* window will not be resizable */
@@ -542,8 +581,13 @@ static int rpng_x_create_window(void)
wm_hints->flags = StateHint | InputHint /* | IconPixmapHint */ ; wm_hints->flags = StateHint | InputHint /* | IconPixmapHint */ ;
} }
if ((class_hints = XAllocClassHint()) != NULL) {
class_hints->res_name = res_name;
class_hints->res_class = res_class;
}
XSetWMProperties(display, window, pWindowName, pIconName, NULL, 0, XSetWMProperties(display, window, pWindowName, pIconName, NULL, 0,
size_hints, wm_hints, NULL); size_hints, wm_hints, class_hints);
/* various properties and hints no longer needed; free memory */ /* various properties and hints no longer needed; free memory */
if (pWindowName) if (pWindowName)
@@ -554,6 +598,8 @@ static int rpng_x_create_window(void)
XFree(size_hints); XFree(size_hints);
if (wm_hints) if (wm_hints)
XFree(wm_hints); XFree(wm_hints);
if (class_hints)
XFree(class_hints);
XMapWindow(display, window); XMapWindow(display, window);

View File

@@ -10,7 +10,7 @@
tweaking (or maybe not). Thanks to Adam Costello and Pieter S. van der tweaking (or maybe not). Thanks to Adam Costello and Pieter S. van der
Meulen for the "diamond" and "radial waves" patterns, respectively. Meulen for the "diamond" and "radial waves" patterns, respectively.
to do: to do (someday, maybe):
- handle quoted command-line args (especially filenames with spaces) - handle quoted command-line args (especially filenames with spaces)
- finish resizable checkerboard-gradient (sizes 4-128?) - finish resizable checkerboard-gradient (sizes 4-128?)
- use %.1023s to simplify truncation of title-bar string? - use %.1023s to simplify truncation of title-bar string?
@@ -27,16 +27,29 @@
- 1.10: enabled "message window"/console (thanks to David Geldreich) - 1.10: enabled "message window"/console (thanks to David Geldreich)
- 1.20: added runtime MMX-enabling/disabling and new -mmx* options - 1.20: added runtime MMX-enabling/disabling and new -mmx* options
- 1.21: made minor tweak to usage screen to fit within 25-line console - 1.21: made minor tweak to usage screen to fit within 25-line console
- 1.22: added AMD64/EM64T support (__x86_64__)
- 2.00: dual-licensed (added GNU GPL)
- 2.01: fixed 64-bit typo in readpng2.c
- 2.02: fixed improper display of usage screen on PNG error(s); fixed
unexpected-EOF and file-read-error cases
- 2.03: removed runtime MMX-enabling/disabling and obsolete -mmx* options
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 1998-2001 Greg Roelofs. All rights reserved. Copyright (c) 1998-2008 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind, This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of be held liable for any damages arising in any way from the use of
this software. this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose, Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions: it freely, subject to the following restrictions:
@@ -53,11 +66,28 @@
and contributors for the book, "PNG: The Definitive Guide," and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates. published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
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 of the License, 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, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
#define PROGNAME "rpng2-win" #define PROGNAME "rpng2-win"
#define LONGNAME "Progressive PNG Viewer for Windows" #define LONGNAME "Progressive PNG Viewer for Windows"
#define VERSION "1.21 of 29 June 2001" #define VERSION "2.02 of 16 March 2008"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@@ -66,7 +96,33 @@
#include <time.h> #include <time.h>
#include <math.h> /* only for PvdM background code */ #include <math.h> /* only for PvdM background code */
#include <windows.h> #include <windows.h>
#ifdef __CYGWIN__
/* getch replacement. Turns out, we don't really need this,
* but leave it here if we ever enable any of the uses of
* _getch in the main code
*/
#include <unistd.h>
#include <termio.h>
#include <sys/ioctl.h>
int repl_getch( void )
{
char ch;
int fd = fileno(stdin);
struct termio old_tty, new_tty;
ioctl(fd, TCGETA, &old_tty);
new_tty = old_tty;
new_tty.c_lflag &= ~(ICANON | ECHO | ISIG);
ioctl(fd, TCSETA, &new_tty);
fread(&ch, 1, sizeof(ch), stdin);
ioctl(fd, TCSETA, &old_tty);
return ch;
}
#define _getch repl_getch
#else
#include <conio.h> /* only for _getch() */ #include <conio.h> /* only for _getch() */
#endif
/* all for PvdM background code: */ /* all for PvdM background code: */
#ifndef PI #ifndef PI
@@ -119,10 +175,9 @@ static void rpng2_win_cleanup(void);
LRESULT CALLBACK rpng2_win_wndproc(HWND, UINT, WPARAM, LPARAM); LRESULT CALLBACK rpng2_win_wndproc(HWND, UINT, WPARAM, LPARAM);
static char titlebar[1024], *window_name = titlebar; static char titlebar[1024];
static char *progname = PROGNAME; static char *progname = PROGNAME;
static char *appname = LONGNAME; static char *appname = LONGNAME;
static char *icon_name = PROGNAME; /* GRR: not (yet) used */
static char *filename; static char *filename;
static FILE *infile; static FILE *infile;
@@ -241,7 +296,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
filename = (char *)NULL; filename = (char *)NULL;
memset(&rpng2_info, 0, sizeof(mainprog_info)); memset(&rpng2_info, 0, sizeof(mainprog_info));
#ifndef __CYGWIN__
/* Next reenable console output, which normally goes to the bit bucket /* Next reenable console output, which normally goes to the bit bucket
* for windowed apps. Closing the console window will terminate the * for windowed apps. Closing the console window will terminate the
* app. Thanks to David.Geldreich@realviz.com for supplying the magical * app. Thanks to David.Geldreich@realviz.com for supplying the magical
@@ -250,7 +305,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
AllocConsole(); AllocConsole();
freopen("CONOUT$", "a", stderr); freopen("CONOUT$", "a", stderr);
freopen("CONOUT$", "a", stdout); freopen("CONOUT$", "a", stdout);
#endif
/* Set the default value for our display-system exponent, i.e., the /* Set the default value for our display-system exponent, i.e., the
* product of the CRT exponent and the exponent corresponding to * product of the CRT exponent and the exponent corresponding to
@@ -367,18 +422,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
} }
} else if (!strncmp(*argv, "-timing", 2)) { } else if (!strncmp(*argv, "-timing", 2)) {
timing = TRUE; timing = TRUE;
#if (defined(__i386__) || defined(_M_IX86))
} else if (!strncmp(*argv, "-nommxfilters", 7)) {
rpng2_info.nommxfilters = TRUE;
} else if (!strncmp(*argv, "-nommxcombine", 7)) {
rpng2_info.nommxcombine = TRUE;
} else if (!strncmp(*argv, "-nommxinterlace", 7)) {
rpng2_info.nommxinterlace = TRUE;
} else if (!strcmp(*argv, "-nommx")) {
rpng2_info.nommxfilters = TRUE;
rpng2_info.nommxcombine = TRUE;
rpng2_info.nommxinterlace = TRUE;
#endif
} else { } else {
if (**argv != '-') { if (**argv != '-') {
filename = *argv; filename = *argv;
@@ -389,9 +432,56 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
} }
} }
if (!filename) { if (!filename)
++error; ++error;
} else if (!(infile = fopen(filename, "rb"))) {
/* print usage screen if any errors up to this point */
if (error) {
#ifndef __CYGWIN__
int ch;
#endif
fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname);
readpng2_version_info();
fprintf(stderr, "\n"
"Usage: %s [-gamma exp] [-bgcolor bg | -bgpat pat] [-timing]\n"
" %*s file.png\n\n"
" exp \ttransfer-function exponent (``gamma'') of the display\n"
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
"\t\t to the product of the lookup-table exponent (varies)\n"
"\t\t and the CRT exponent (usually 2.2); must be positive\n"
" bg \tdesired background color in 7-character hex RGB format\n"
"\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
"\t\t used with transparent images; overrides -bgpat option\n"
" pat \tdesired background pattern number (1-%d); used with\n"
"\t\t transparent images; overrides -bgcolor option\n"
" -timing\tenables delay for every block read, to simulate modem\n"
"\t\t download of image (~36 Kbps)\n"
"\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
#ifndef __CYGWIN__
"Press Q or Esc to quit this usage screen. ",
#else
,
#endif
PROGNAME,
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) && \
!(defined(__CYGWIN__) || defined(__MINGW32__))
(int)strlen(PROGNAME), " ",
#endif
(int)strlen(PROGNAME), " ", default_display_exponent, num_bgpat);
fflush(stderr);
#ifndef __CYGWIN__
do
ch = _getch();
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
#endif
exit(1);
}
if (!(infile = fopen(filename, "rb"))) {
fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename); fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename);
++error; ++error;
} else { } else {
@@ -405,8 +495,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
switch (rc) { switch (rc) {
case 2: case 2:
fprintf(stderr, PROGNAME fprintf(stderr, PROGNAME
": [%s] has bad IHDR (libpng longjmp)\n", ": [%s] has bad IHDR (libpng longjmp)\n", filename);
filename);
break; break;
case 4: case 4:
fprintf(stderr, PROGNAME ": insufficient memory\n"); fprintf(stderr, PROGNAME ": insufficient memory\n");
@@ -423,51 +512,25 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
} }
/* usage screen */
if (error) { if (error) {
#ifndef __CYGWIN__
int ch; int ch;
#endif
fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname); fprintf(stderr, PROGNAME ": aborting.\n");
readpng2_version_info(); #ifndef __CYGWIN__
fprintf(stderr, "\n"
"Usage: %s [-gamma exp] [-bgcolor bg | -bgpat pat] [-timing]\n"
#if (defined(__i386__) || defined(_M_IX86))
" %*s [[-nommxfilters] [-nommxcombine] [-nommxinterlace] | -nommx]\n"
#endif
" %*s file.png\n\n"
" exp \ttransfer-function exponent (``gamma'') of the display\n"
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
"\t\t to the product of the lookup-table exponent (varies)\n"
"\t\t and the CRT exponent (usually 2.2); must be positive\n"
" bg \tdesired background color in 7-character hex RGB format\n"
"\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
"\t\t used with transparent images; overrides -bgpat option\n"
" pat \tdesired background pattern number (1-%d); used with\n"
"\t\t transparent images; overrides -bgcolor option\n"
" -timing\tenables delay for every block read, to simulate modem\n"
"\t\t download of image (~36 Kbps)\n"
#if (defined(__i386__) || defined(_M_IX86))
" -nommx*\tdisable optimized MMX routines for decoding row filters,\n"
"\t\t combining rows, and expanding interlacing, respectively\n"
#endif
"\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
"Press Q or Esc to quit this usage screen. ",
PROGNAME,
#if (defined(__i386__) || defined(_M_IX86))
strlen(PROGNAME), " ",
#endif
strlen(PROGNAME), " ", default_display_exponent, num_bgpat);
fflush(stderr);
do do
ch = _getch(); ch = _getch();
while (ch != 'q' && ch != 'Q' && ch != 0x1B); while (ch != 'q' && ch != 'Q' && ch != 0x1B);
exit(1); #endif
exit(2);
} else { } else {
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname); fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
#ifndef __CYGWIN__
fprintf(stderr, fprintf(stderr,
"\n [console window: closing this window will terminate %s]\n\n", "\n [console window: closing this window will terminate %s]\n\n",
PROGNAME); PROGNAME);
#endif
fflush(stderr); fflush(stderr);
} }
@@ -494,7 +557,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
} else } else
rpng2_info.need_bgcolor = TRUE; rpng2_info.need_bgcolor = TRUE;
rpng2_info.done = FALSE; rpng2_info.state = kPreInit;
rpng2_info.mainprog_init = rpng2_win_init; rpng2_info.mainprog_init = rpng2_win_init;
rpng2_info.mainprog_display_row = rpng2_win_display_row; rpng2_info.mainprog_display_row = rpng2_win_display_row;
rpng2_info.mainprog_finish_display = rpng2_win_finish_display; rpng2_info.mainprog_finish_display = rpng2_win_finish_display;
@@ -514,10 +577,27 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
if (readpng2_decode_data(&rpng2_info, inbuf, incount)) if (readpng2_decode_data(&rpng2_info, inbuf, incount))
++error; ++error;
Trace((stderr, "done with readpng2_decode_data()\n")) Trace((stderr, "done with readpng2_decode_data()\n"))
if (error || feof(infile) || rpng2_info.done)
if (error || incount != INBUFSIZE || rpng2_info.state == kDone) {
if (rpng2_info.state == kDone) {
Trace((stderr, "done decoding PNG image\n"))
} else if (ferror(infile)) {
fprintf(stderr, PROGNAME
": error while reading PNG image file\n");
exit(3);
} else if (feof(infile)) {
fprintf(stderr, PROGNAME ": end of file reached "
"(unexpectedly) while reading PNG image file\n");
exit(3);
} else /* if (error) */ {
// will print error message below
}
break; break;
}
if (timing) if (timing)
Sleep(1000L); Sleep(1000L);
incount = fread(inbuf, 1, INBUFSIZE, infile); incount = fread(inbuf, 1, INBUFSIZE, infile);
} }
@@ -564,7 +644,7 @@ static void rpng2_win_init()
ulg rowbytes = rpng2_info.rowbytes; ulg rowbytes = rpng2_info.rowbytes;
Trace((stderr, "beginning rpng2_win_init()\n")) Trace((stderr, "beginning rpng2_win_init()\n"))
Trace((stderr, " rowbytes = %ld\n", rpng2_info.rowbytes)) Trace((stderr, " rowbytes = %d\n", rpng2_info.rowbytes))
Trace((stderr, " width = %ld\n", rpng2_info.width)) Trace((stderr, " width = %ld\n", rpng2_info.width))
Trace((stderr, " height = %ld\n", rpng2_info.height)) Trace((stderr, " height = %ld\n", rpng2_info.height))
@@ -594,6 +674,8 @@ static void rpng2_win_init()
readpng2_cleanup(&rpng2_info); readpng2_cleanup(&rpng2_info);
return; return;
} }
rpng2_info.state = kWindowInit;
} }
@@ -1089,9 +1171,14 @@ static void rpng2_win_finish_display()
* we have nothing to do here except set a flag and let the user know * we have nothing to do here except set a flag and let the user know
* that the image is done */ * that the image is done */
rpng2_info.done = TRUE; rpng2_info.state = kDone;
printf( printf(
"Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n"); #ifndef __CYGWIN__
"Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n"
#else
"Done. Press mouse button 1 (within image window) to quit.\n"
#endif
);
fflush(stdout); fflush(stdout);
} }

File diff suppressed because it is too large Load Diff

View File

@@ -5,8 +5,10 @@
This program converts certain NetPBM binary files (grayscale and RGB, This program converts certain NetPBM binary files (grayscale and RGB,
maxval = 255) to PNG. Non-interlaced PNGs are written progressively; maxval = 255) to PNG. Non-interlaced PNGs are written progressively;
interlaced PNGs are read and written in one memory-intensive blast. interlaced PNGs are read and written in one memory-intensive blast.
Thanks to Jean-loup Gailly for providing the necessary trick to read Thanks to Jean-loup Gailly for providing the necessary trick to read
interactive text from the keyboard while stdin is redirected. interactive text from the keyboard while stdin is redirected. Thanks
to Cosmin Truta for Cygwin fixes.
NOTE: includes provisional support for PNM type "8" (portable alphamap) NOTE: includes provisional support for PNM type "8" (portable alphamap)
images, presumed to be a 32-bit interleaved RGBA format; no pro- images, presumed to be a 32-bit interleaved RGBA format; no pro-
@@ -24,16 +26,32 @@
- 1.02: modified to allow abbreviated options - 1.02: modified to allow abbreviated options
- 1.03: removed extraneous character from usage screen; fixed bug in - 1.03: removed extraneous character from usage screen; fixed bug in
command-line parsing command-line parsing
- 1.04: fixed DOS/OS2/Win32 detection, including partial Cygwin fix
(see http://home.att.net/~perlspinr/diffs/GregBook_cygwin.diff)
- 2.00: dual-licensed (added GNU GPL)
[REPORTED BUG (win32 only): "contrib/gregbook/wpng.c - cmd line
dose not work! In order to do something useful I needed to redirect
both input and output, with cygwin and with bcc32 as well. Under
Linux, the same wpng appears to work fine. I don't know what is
the problem."]
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved. Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind, This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of be held liable for any damages arising in any way from the use of
this software. this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose, Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions: it freely, subject to the following restrictions:
@@ -50,16 +68,35 @@
and contributors for the book, "PNG: The Definitive Guide," and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates. published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
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 of the License, 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, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
#define PROGNAME "wpng" #define PROGNAME "wpng"
#define VERSION "1.03 of 19 March 2000" #define VERSION "2.00 of 2 June 2007"
#define APPNAME "Simple PGM/PPM/PAM to PNG Converter" #define APPNAME "Simple PGM/PPM/PAM to PNG Converter"
#if defined(__MSDOS__) || defined(__OS2__) #if defined(__MSDOS__) || defined(__OS2__)
# define DOS_OS2_W32 # define DOS_OS2_W32
#elif defined(_WIN32) || defined(__WIN32__) #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
# define DOS_OS2_W32 # ifndef __GNUC__ /* treat Win32 native ports of gcc as Unix environments */
# define DOS_OS2_W32
# endif
#endif #endif
#include <stdio.h> #include <stdio.h>

View File

@@ -4,13 +4,20 @@
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved. Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind, This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of be held liable for any damages arising in any way from the use of
this software. this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose, Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions: it freely, subject to the following restrictions:
@@ -27,6 +34,23 @@
and contributors for the book, "PNG: The Definitive Guide," and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates. published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
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 of the License, 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, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/

View File

@@ -4,13 +4,20 @@
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved. Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind, This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of be held liable for any damages arising in any way from the use of
this software. this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose, Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions: it freely, subject to the following restrictions:
@@ -27,6 +34,23 @@
and contributors for the book, "PNG: The Definitive Guide," and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates. published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
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 of the License, 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, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
#ifndef TRUE #ifndef TRUE

View File

@@ -0,0 +1,9 @@
This demonstrates the use of PNG_USER_CONFIG and pngusr.h
To build a minimal read-only decoder with embedded libpng and zlib, run
gather.sh # to collect needed files from pngminus, libpng, and zlib
make
If you prefer to use the shared libraries, go to contrib/pngminus
and build the png2pnm application there.

View File

@@ -0,0 +1,10 @@
#!/bin/sh
cp ../../pngminus/png2pnm.c pngm2pnm.c
cp ../../../*.h .
cp ../../../*.c .
rm example.c pngtest.c pngpread.c pngw*.c
# change the following 2 lines if zlib is somewhere else
cp ../../../../zlib/*.h .
cp ../../../../zlib/*.c .
rm minigzip.c example.c compress.c deflate.c gz*

View File

@@ -0,0 +1,44 @@
# Makefile for PngMinus (pngm2pnm)
# Linux / Unix
#CC=cc
CC=gcc
LD=$(CC)
RM=rm -f
CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP \
-DdeflateParams\(a,b,c\)=Z_OK -I. -O1
C=.c
O=.o
L=.a
E=
ZOBJS = adler32$(O) crc32$(O) \
infback$(O) inffast$(O) inflate$(O) inftrees$(O) \
trees$(O) uncompr$(O) zutil$(O)
OBJS = pngm2pnm$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \
pngset$(O) pngtrans$(O) $(ZOBJS)
# implicit make rules -------------------------------------------------------
.c$(O): png.h pngconf.h pngpriv.h pngusr.h zlib.h
$(CC) -c $(CFLAGS) $<
# dependencies
all: pngm2pnm$(E)
pngm2pnm$(E): $(OBJS)
$(LD) -o pngm2pnm$(E) $(OBJS)
strip pngm2pnm$(E)
clean:
$(RM) pngm2pnm$(O)
$(RM) pngm2pnm$(E)
$(RM) $(OBJS)
# End of makefile for pngm2pnm

View File

@@ -0,0 +1,75 @@
/* minrdpngconf.h: headers to make a minimal png-read-only library
*
* Copyright (c) 2007, 2009 Glenn Randers-Pehrson
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
* Derived from pngcrush.h, Copyright 1998-2007, Glenn Randers-Pehrson
*/
#ifndef MINRDPNGCONF_H
#define MINRDPNGCONF_H
#define PNG_NO_WARNINGS
#define png_warning(s1,s2) ""
#define png_chunk_warning(s1,s2) ""
#define PNG_NO_ERROR_TEXT
#define png_error(s1,s2) png_err(s1)
#define png_chunk_error(s1,s2) png_err(s1)
#define PNG_NO_READ_BGR
#define PNG_NO_READ_GAMMA
#define PNG_NO_READ_BACKGROUND
#define PNG_NO_READ_QUANTIZE
#define PNG_NO_READ_INVERT
#define PNG_NO_READ_SHIFT
#define PNG_NO_READ_PACK
#define PNG_NO_READ_PACKSWAP
#define PNG_NO_READ_FILLER
#define PNG_NO_READ_SWAP
#define PNG_NO_READ_SWAP_ALPHA
#define PNG_NO_READ_INVERT_ALPHA
#define PNG_NO_READ_RGB_TO_GRAY
#define PNG_NO_READ_USER_TRANSFORM
#define PNG_NO_READ_bKGD
#define PNG_NO_READ_cHRM
#define PNG_NO_READ_gAMA
#define PNG_NO_READ_hIST
#define PNG_NO_READ_iCCP
#define PNG_NO_READ_pCAL
#define PNG_NO_READ_pHYs
#define PNG_NO_READ_sBIT
#define PNG_NO_READ_sCAL
#define PNG_NO_READ_sPLT
#define PNG_NO_READ_sRGB
#define PNG_NO_READ_TEXT
#define PNG_NO_READ_tIME
#define PNG_NO_READ_UNKNOWN_CHUNKS
#define PNG_NO_READ_USER_CHUNKS
#define PNG_NO_READ_EMPTY_PLTE
#define PNG_NO_READ_OPT_PLTE
#define PNG_NO_READ_STRIP_ALPHA
#define PNG_NO_READ_oFFs
#define PNG_NO_WRITE_SUPPORTED
#define PNG_NO_INFO_IMAGE
#define PNG_NO_IO_STATE
#define PNG_NO_USER_MEM
#define PNG_NO_FIXED_POINT_SUPPORTED
#define PNG_NO_MNG_FEATURES
#define PNG_NO_USER_TRANSFORM_PTR
#define PNG_NO_HANDLE_AS_UNKNOWN
#define PNG_NO_CONSOLE_IO
#define PNG_NO_ZALLOC_ZERO
#define PNG_NO_ERROR_NUMBERS
#define PNG_NO_EASY_ACCESS
#define PNG_NO_PROGRESSIVE_READ
#define PNG_NO_USER_LIMITS
#define PNG_NO_SET_USER_LIMITS
#define PNG_NO_TIME_RFC1123
#endif /* MINRDPNGCONF_H */

View File

@@ -0,0 +1,9 @@
This demonstrates the use of PNG_USER_CONFIG and pngusr.h
To build a minimal write-only decoder with embedded libpng and zlib, run
gather.sh # to collect needed files from pngminus, libpng, and zlib
make
If you prefer to use the shared libraries, go to contrib/pngminus
and build the pnm2png application there.

View File

@@ -0,0 +1,11 @@
#!/bin/sh
cp ../../pngminus/pnm2png.c pnm2pngm.c
cp ../../../*.h .
cp ../../../*.c .
rm example.c pngtest.c pngr*.c pngpread.c
# Change the next 2 lines if zlib is somewhere else.
cp ../../../../zlib/*.h .
cp ../../../../zlib/*.c .
rm inf*.[ch]
rm uncompr.c minigzip.c example.c gz*

View File

@@ -0,0 +1,42 @@
# Makefile for PngMinus (pnm2pngm)
# Linux / Unix
#CC=cc
CC=gcc
LD=$(CC)
RM=rm -f
CFLAGS=-DPNG_USER_CONFIG -DNO_GZIP -I. -O1
C=.c
O=.o
L=.a
E=
ZOBJS = adler32$(O) compress$(O) crc32$(O) deflate$(O) \
trees$(O) zutil$(O)
OBJS = pnm2pngm$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
pngset$(O) pngtrans$(O) pngwio$(O) pngwrite$(O) \
pngwtran$(O) pngwutil$(O) $(ZOBJS)
# implicit make rules -------------------------------------------------------
.c$(O): png.h pngconf.h pngpriv.h pngusr.h zlib.h
$(CC) -c $(CFLAGS) $<
# dependencies
all: pnm2pngm$(E)
pnm2pngm$(E): $(OBJS)
$(LD) -o pnm2pngm$(E) $(OBJS)
strip pnm2pngm$(E)
clean:
$(RM) pnm2pngm$(O)
$(RM) pnm2pngm$(E)
$(RM) $(OBJS)
# End of makefile for pnm2pngm

View File

@@ -0,0 +1,76 @@
/* minwrpngconf.h: headers to make a minimal png-write-only library
*
* Copyright (c) 2007, 2009 Glenn Randers-Pehrson
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
* Derived from pngcrush.h, Copyright 1998-2007, Glenn Randers-Pehrson
*/
#ifndef MINWRPNGCONF_H
#define MINWRPNGCONF_H
#define PNG_NO_READ_SUPPORTED
#define PNG_NO_WARNINGS
#define png_warning(s1,s2) ""
#define png_chunk_warning(s1,s2) ""
#define PNG_NO_ERROR_TEXT
#define png_error(s1,s2) png_err(s1)
#define png_chunk_error(s1,s2) png_err(s1)
#define PNG_NO_WRITE_BACKGROUND
#define PNG_NO_WRITE_BGR
#define PNG_NO_WRITE_GAMMA
#define PNG_NO_WRITE_QUANTIZE
#define PNG_NO_WRITE_INVERT
#define PNG_NO_WRITE_SHIFT
#define PNG_NO_WRITE_PACK
#define PNG_NO_WRITE_PACKSWAP
#define PNG_NO_WRITE_FILLER
#define PNG_NO_WRITE_SWAP
#define PNG_NO_WRITE_SWAP_ALPHA
#define PNG_NO_WRITE_INVERT_ALPHA
#define PNG_NO_WRITE_RGB_TO_GRAY
#define PNG_NO_WRITE_USER_TRANSFORM
#define PNG_NO_WRITE_bKGD
#define PNG_NO_WRITE_cHRM
#define PNG_NO_WRITE_gAMA
#define PNG_NO_WRITE_hIST
#define PNG_NO_WRITE_iCCP
#define PNG_NO_WRITE_oFFs
#define PNG_NO_WRITE_pCAL
#define PNG_NO_WRITE_pHYs
#define PNG_NO_WRITE_sBIT
#define PNG_NO_WRITE_sCAL
#define PNG_NO_WRITE_sPLT
#define PNG_NO_WRITE_sRGB
#define PNG_NO_WRITE_TEXT
#define PNG_NO_WRITE_tIME
#define PNG_NO_WRITE_UNKNOWN_CHUNKS
#define PNG_NO_WRITE_USER_CHUNKS
#define PNG_NO_WRITE_EMPTY_PLTE
#define PNG_NO_WRITE_OPT_PLTE
#define PNG_NO_WRITE_FILTER
#define PNG_NO_WRITE_WEIGHTED_FILTER
#define PNG_NO_WRITE_INTERLACING_SUPPORTED
#define PNG_NO_WRITE_FLUSH
#define PNG_NO_INFO_IMAGE
#define PNG_NO_IO_STATE
#define PNG_NO_USER_MEM
#define PNG_NO_FIXED_POINT_SUPPORTED
#define PNG_NO_MNG_FEATURES
#define PNG_NO_USER_TRANSFORM_PTR
#define PNG_NO_HANDLE_AS_UNKNOWN
#define PNG_NO_CONSOLE_IO
#define PNG_NO_ZALLOC_ZERO
#define PNG_NO_ERROR_NUMBERS
#define PNG_NO_EASY_ACCESS
#define PNG_NO_USER_LIMITS
#define PNG_NO_SET_USER_LIMITS
#define PNG_NO_TIME_RFC1143
#endif /* MINWRPNGCONF_H */

View File

@@ -0,0 +1,14 @@
This demonstrates the use of PNG_USER_CONFIG and pngusr.h
To build a minimal read-only progressive decoder embedded libpng and
zlib and with your system's X library, run
gather.sh # to collect needed files from gregbook, libpng, and zlib
Edit makefile if required, to find your X library and include files,
then
make
If you prefer to use the shared libraries, go to contrib/gregbook
and build the rpng2-x application there.

View File

@@ -0,0 +1,11 @@
#!/bin/sh
cp ../../gregbook/rpng2-x.c ../../gregbook/readpng2.[ch] .
cp ../../gregbook/COPYING ../../gregbook/LICENSE .
cp ../../../*.h .
cp ../../../*.c .
rm example.c pngtest.c pngw*.c
# change the following 2 lines if zlib is somewhere else
cp ../../../../zlib/*.h .
cp ../../../../zlib/*.c .
rm minigzip.c example.c compress.c deflate.c gz*

View File

@@ -0,0 +1,60 @@
# Makefile for PngMinus (rpng2)
# Linux / Unix
#CC=cc
CC=gcc
LD=$(CC)
RM=rm -f
#XINC = -I/usr/include # old-style, stock X distributions
#XLIB = -L/usr/lib/X11 -lX11 # (including SGI IRIX)
#XINC = -I/usr/openwin/include # Sun workstations (OpenWindows)
#XLIB = -L/usr/openwin/lib -lX11
XINC = -I/usr/X11R6/include # new X distributions (X.org, etc.)
XLIB = -L/usr/X11R6/lib -lX11
#XLIB = -L/usr/X11R6/lib64 -lX11 # e.g., Red Hat on AMD64
#XINC = -I/usr/local/include # FreeBSD
#XLIB = -L/usr/local/lib -lX11
#LIBS = $(XLIB)
LIBS = $(XLIB) -lm #platforms that need libm
CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP \
-DdeflateParams\(a,b,c\)=Z_OK -I. $(XINC) -O1
C=.c
O=.o
L=.a
E=
ZOBJS = adler32$(O) crc32$(O) \
infback$(O) inffast$(O) inflate$(O) inftrees$(O) \
trees$(O) uncompr$(O) zutil$(O)
OBJS = rpng2-x$(O) readpng2$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
pngpread$(O) pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \
pngset$(O) pngtrans$(O) $(ZOBJS)
# implicit make rules -------------------------------------------------------
.c$(O): png.h pngconf.h pngpriv.h readpng2.h pngusr.h zlib.h
$(CC) -c $(CFLAGS) $<
# dependencies
all: rpng2-x$(E)
rpng2-x$(E): $(OBJS)
$(LD) -o rpng2-x$(E) $(OBJS) $(LIBS)
strip rpng2-x$(E)
clean:
$(RM) rpng2-x$(O)
$(RM) rpng2-x$(E)
$(RM) $(OBJS)
# End of makefile for rpng2-x

View File

@@ -0,0 +1,68 @@
/* minrdpngconf.h: headers to make a minimal png-read-only library
*
* Copyright (c) 2009 Glenn Randers-Pehrson
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
* Derived from pngcrush.h, Copyright 1998-2007, Glenn Randers-Pehrson
*/
#ifndef MINPRDPNGCONF_H
#define MINPRDPNGCONF_H
#define PNG_NO_WARNINGS
#define png_warning(s1,s2) ""
#define png_chunk_warning(s1,s2) ""
#define PNG_NO_ERROR_TEXT
#define png_error(s1,s2) png_err(s1)
#define png_chunk_error(s1,s2) png_err(s1)
#define PNG_NO_READ_BGR
#define PNG_NO_READ_DITHER
#define PNG_NO_READ_INVERT
#define PNG_NO_READ_SHIFT
#define PNG_NO_READ_PACK
#define PNG_NO_READ_PACKSWAP
#define PNG_NO_READ_FILLER
#define PNG_NO_READ_SWAP
#define PNG_NO_READ_SWAP_ALPHA
#define PNG_NO_READ_INVERT_ALPHA
#define PNG_NO_READ_RGB_TO_GRAY
#define PNG_NO_READ_USER_TRANSFORM
#define PNG_NO_READ_cHRM
#define PNG_NO_READ_hIST
#define PNG_NO_READ_iCCP
#define PNG_NO_READ_pCAL
#define PNG_NO_READ_pHYs
#define PNG_NO_READ_sBIT
#define PNG_NO_READ_sCAL
#define PNG_NO_READ_sPLT
#define PNG_NO_READ_TEXT
#define PNG_NO_READ_tIME
#define PNG_NO_READ_UNKNOWN_CHUNKS
#define PNG_NO_READ_USER_CHUNKS
#define PNG_NO_READ_EMPTY_PLTE
#define PNG_NO_READ_OPT_PLTE
#define PNG_NO_READ_STRIP_ALPHA
#define PNG_NO_READ_oFFs
#define PNG_NO_WRITE_SUPPORTED
#define PNG_NO_INFO_IMAGE
#define PNG_NO_IO_STATE
#define PNG_NO_USER_MEM
#define PNG_NO_FIXED_POINT_SUPPORTED
#define PNG_NO_MNG_FEATURES
#define PNG_NO_USER_TRANSFORM_PTR
#define PNG_NO_HANDLE_AS_UNKNOWN
#define PNG_NO_CONSOLE_IO
#define PNG_NO_ZALLOC_ZERO
#define PNG_NO_ERROR_NUMBERS
#define PNG_NO_EASY_ACCESS
#define PNG_NO_USER_LIMITS
#define PNG_NO_SET_USER_LIMITS
#define PNG_NO_TIME_RFC1143
#endif /* MINPRDPNGCONF_H */

View File

@@ -20,7 +20,7 @@ Soon after the creation of PNG in 1995, the need was felt for a set of
pnmtopng / pngtopnm utilities. Independantly Alexander Lehmann and I pnmtopng / pngtopnm utilities. Independantly Alexander Lehmann and I
(Willem van Schaik) started such a project. Luckily we discovered this (Willem van Schaik) started such a project. Luckily we discovered this
and merged the two together into pnmtopng.tar.gz, which is available and merged the two together into pnmtopng.tar.gz, which is available
from a/o ftp://swrinde.nde.swri.edu/pub/png/. from a/o ftp://ftp.simplesystems.org/pub/libpng/png/.
These two utilities have many, many options and make use of most of the These two utilities have many, many options and make use of most of the
features of PNG, like gamma, alpha, sbit, text-chunks, etc. This makes features of PNG, like gamma, alpha, sbit, text-chunks, etc. This makes

View File

@@ -211,8 +211,8 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
if (ret != 8) if (ret != 8)
return FALSE; return FALSE;
ret = png_check_sig (buf, 8); ret = png_sig_cmp (buf, 0, 8);
if (!ret) if (ret)
return FALSE; return FALSE;
/* create png and info structures */ /* create png and info structures */

View File

@@ -1,3 +1,4 @@
#!/bin/sh
# -- grayscale # -- grayscale
./png2pnm -noraw ../pngsuite/basn0g01.png basn0g01.pgm ./png2pnm -noraw ../pngsuite/basn0g01.png basn0g01.pgm
./png2pnm -noraw ../pngsuite/basn0g02.png basn0g02.pgm ./png2pnm -noraw ../pngsuite/basn0g02.png basn0g02.pgm

View File

@@ -1,3 +1,4 @@
#!/bin/sh
make -f makefile.std make -f makefile.std
sh png2pnm.sh sh png2pnm.sh
sh pnm2png.sh sh pnm2png.sh

View File

@@ -1,3 +1,4 @@
#!/bin/sh
# -- grayscale # -- grayscale
./pnm2png basn0g01.pgm basn0g01.png ./pnm2png basn0g01.pgm basn0g01.png
./pnm2png basn0g02.pgm basn0g02.png ./pnm2png basn0g02.pgm basn0g02.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 429 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 719 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -2,8 +2,11 @@
// PNGFILE.C -- Image File Functions // PNGFILE.C -- Image File Functions
//------------------------------------- //-------------------------------------
// Copyright 2000, Willem van Schaik. For conditions of distribution and // Copyright 2000, Willem van Schaik.
// use, see the copyright/license/disclaimer notice in png.h //
// This code is released under the libpng license.
// For conditions of distribution and use, see the disclaimer
// and license in png.h
#include <windows.h> #include <windows.h>
#include <commdlg.h> #include <commdlg.h>
@@ -32,7 +35,7 @@ png_cexcept_error(png_structp png_ptr, png_const_charp msg)
{ {
if(png_ptr) if(png_ptr)
; ;
#ifndef PNG_NO_CONSOLE_IO #ifdef PNG_CONSOLE_IO_SUPPORTED
fprintf(stderr, "libpng error: %s\n", msg); fprintf(stderr, "libpng error: %s\n", msg);
#endif #endif
{ {
@@ -123,7 +126,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
// first check the eight byte PNG signature // first check the eight byte PNG signature
fread(pbSig, 1, 8, pfFile); fread(pbSig, 1, 8, pfFile);
if (!png_check_sig(pbSig, 8)) if (png_sig_cmp(pbSig, 0, 8))
{ {
*ppbImageData = pbImageData = NULL; *ppbImageData = pbImageData = NULL;
return FALSE; return FALSE;
@@ -152,7 +155,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
// initialize the png structure // initialize the png structure
#if !defined(PNG_NO_STDIO) #ifdef PNG_STDIO_SUPPORTED
png_init_io(png_ptr, pfFile); png_init_io(png_ptr, pfFile);
#else #else
png_set_read_fn(png_ptr, (png_voidp)pfFile, png_read_data); png_set_read_fn(png_ptr, (png_voidp)pfFile, png_read_data);
@@ -321,7 +324,7 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
{ {
// initialize the png structure // initialize the png structure
#if !defined(PNG_NO_STDIO) #ifdef PNG_STDIO_SUPPORTED
png_init_io(png_ptr, pfFile); png_init_io(png_ptr, pfFile);
#else #else
png_set_write_fn(png_ptr, (png_voidp)pfFile, png_write_data, png_flush); png_set_write_fn(png_ptr, (png_voidp)pfFile, png_write_data, png_flush);
@@ -392,7 +395,7 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
return TRUE; return TRUE;
} }
#ifdef PNG_NO_STDIO #ifndef PNG_STDIO_SUPPORTED
static void static void
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length) png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)

View File

@@ -2,8 +2,11 @@
// PNGFILE.H -- Header File for pngfile.c // PNGFILE.H -- Header File for pngfile.c
//------------------------------------------ //------------------------------------------
// Copyright 2000, Willem van Schaik. For conditions of distribution and // Copyright 2000, Willem van Schaik.
// use, see the copyright/license/disclaimer notice in png.h
// This code is released under the libpng license.
// For conditions of distribution and use, see the disclaimer
// and license in png.h
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@@ -19,7 +22,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData, BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
int iWidth, int iHeight, png_color BkgColor); int iWidth, int iHeight, png_color BkgColor);
#if defined(PNG_NO_STDIO) #ifndef PNG_STDIO_SUPPORTED
static void png_read_data(png_structp png_ptr, png_bytep data, png_size_t length); static void png_read_data(png_structp png_ptr, png_bytep data, png_size_t length);
static void png_write_data(png_structp png_ptr, png_bytep data, png_size_t length); static void png_write_data(png_structp png_ptr, png_bytep data, png_size_t length);
static void png_flush(png_structp png_ptr); static void png_flush(png_structp png_ptr);

View File

@@ -1,8 +1,11 @@
Microsoft Developer Studio Build File, Format Version 6.00 for VisualPng Microsoft Developer Studio Build File, Format Version 6.00 for VisualPng
------------------------------------------------------------------------ ------------------------------------------------------------------------
Copyright 2000, Willem van Schaik. For conditions of distribution and Copyright 2000, Willem van Schaik.
use, see the copyright/license/disclaimer notice in png.h
This code is released under the libpng license.
For conditions of distribution and use, see the disclaimer
and license in png.h
As a PNG .dll demo VisualPng is finished. More features would only hinder As a PNG .dll demo VisualPng is finished. More features would only hinder
the program's objective. However, further extensions (like support for other the program's objective. However, further extensions (like support for other

View File

@@ -2,8 +2,11 @@
// VisualPng.C -- Shows a PNG image // VisualPng.C -- Shows a PNG image
//------------------------------------ //------------------------------------
// Copyright 2000, Willem van Schaik. For conditions of distribution and // Copyright 2000, Willem van Schaik.
// use, see the copyright/license/disclaimer notice in png.h
// This code is released under the libpng license.
// For conditions of distribution and use, see the disclaimer
// and license in png.h
// switches // switches

View File

@@ -43,9 +43,9 @@ RSC=rc.exe
# PROP Intermediate_Dir "Release" # PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0 # PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /c # ADD BASE CPP /nologo /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_NO_STDIO" /FD /c
# SUBTRACT BASE CPP /YX # SUBTRACT BASE CPP /YX
# ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /c # ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_NO_STDIO" /FD /c
# SUBTRACT CPP /YX # SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
@@ -77,9 +77,9 @@ PostBuild_Cmds=$(outdir)\VisualPng.exe ..\..\contrib\pngsuite\basn6a16.png
# PROP Intermediate_Dir "Debug" # PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0 # PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /GZ /c # ADD BASE CPP /nologo /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "PNG_NO_STDIO" /FD /GZ /c
# SUBTRACT BASE CPP /YX # SUBTRACT BASE CPP /YX
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /GZ /c # ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "PNG_NO_STDIO" /FD /GZ /c
# SUBTRACT CPP /YX # SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32

View File

@@ -1,25 +1,30 @@
/*=== /*===
cexcept.h 2.0.0 (2001-Jul-12-Thu) cexcept.h 2.0.1 (2008-Jul-19-Sat)
Adam M. Costello <amc@cs.berkeley.edu> http://www.nicemice.net/cexcept/
Adam M. Costello
http://www.nicemice.net/amc/
An interface for exception-handling in ANSI C (C89 and subsequent ISO An interface for exception-handling in ANSI C (C89 and subsequent ISO
standards), developed jointly with Cosmin Truta <cosmin@cs.toronto.edu>. standards), developed jointly with Cosmin Truta.
Copyright (c) 2001 Adam M. Costello and Cosmin Truta. Everyone Copyright (c) 2000-2008 Adam M. Costello and Cosmin Truta.
is hereby granted permission to do whatever they like with this This software may be modified only if its author and version
file, provided that if they modify it they take reasonable steps to information is updated accurately, and may be redistributed
avoid confusing or misleading people about the authors, version, only if accompanied by this unaltered notice. Subject to those
and terms of use of the derived file. The copyright holders make restrictions, permission is granted to anyone to do anything
no guarantees regarding this file, and are not responsible for any with this software. The copyright holders make no guarantees
damage resulting from its use. regarding this software, and are not responsible for any damage
resulting from its use.
Only user-defined exceptions are supported, not "real" exceptions like The cexcept interface is not compatible with and cannot interact
division by zero or memory segmentation violations. with system exceptions (like division by zero or memory segmentation
violation), compiler-generated exceptions (like C++ exceptions), or
other exception-handling interfaces.
If this interface is used by multiple .c files, they shouldn't include When using this interface across multiple .c files, do not include
this header file directly. Instead, create a wrapper header file that this header file directly. Instead, create a wrapper header file that
includes this header file and then invokes the define_exception_type includes this header file and then invokes the define_exception_type
macro (see below), and let your .c files include that header file. macro (see below). The .c files should then include that header file.
The interface consists of one type, one well-known name, and six macros. The interface consists of one type, one well-known name, and six macros.
@@ -164,7 +169,7 @@ Throw expression;
be compatible with the type passed to define_exception_type(). The be compatible with the type passed to define_exception_type(). The
exception must be caught, otherwise the program may crash. exception must be caught, otherwise the program may crash.
Slight limitation: If the expression is a comma-expression it must Slight limitation: If the expression is a comma-expression, it must
be enclosed in parentheses. be enclosed in parentheses.
@@ -209,11 +214,11 @@ struct exception_context { \
exception__prev = the_exception_context->penv; \ exception__prev = the_exception_context->penv; \
the_exception_context->penv = &exception__env; \ the_exception_context->penv = &exception__env; \
if (setjmp(exception__env) == 0) { \ if (setjmp(exception__env) == 0) { \
if (&exception__prev) do
#define exception__catch(action) \ #define exception__catch(action) \
else { } \ while (the_exception_context->caught = 0, \
the_exception_context->caught = 0; \ the_exception_context->caught); \
} \ } \
else { \ else { \
the_exception_context->caught = 1; \ the_exception_context->caught = 1; \
@@ -226,14 +231,14 @@ struct exception_context { \
#define Catch(e) exception__catch(((e) = the_exception_context->v.etmp, 0)) #define Catch(e) exception__catch(((e) = the_exception_context->v.etmp, 0))
#define Catch_anonymous exception__catch(0) #define Catch_anonymous exception__catch(0)
/* Try ends with if(), and Catch begins and ends with else. This */ /* Try ends with do, and Catch begins with while(0) and ends with */
/* ensures that the Try/Catch syntax is really the same as the */ /* else, to ensure that Try/Catch syntax is similar to if/else */
/* if/else syntax. */ /* syntax. */
/* */ /* */
/* We use &exception__prev instead of 1 to appease compilers that */ /* The 0 in while(0) is expressed as x=0,x in order to appease */
/* warn about constant expressions inside if(). Most compilers */ /* compilers that warn about constant expressions inside while(). */
/* should still recognize that &exception__prev is never zero and */ /* Most compilers should still recognize that the condition is always */
/* avoid generating test code. */ /* false and avoid generating code for it. */
#define Throw \ #define Throw \
for (;; longjmp(*the_exception_context->penv, 1)) \ for (;; longjmp(*the_exception_context->penv, 1)) \

499
depcomp
View File

@@ -1,7 +1,10 @@
#! /bin/sh #! /bin/sh
# depcomp - compile a program generating dependencies as side-effects # depcomp - compile a program generating dependencies as side-effects
# Copyright 1999, 2000 Free Software Foundation, Inc.
scriptversion=2009-04-28.21; # UTC
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
# Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -14,9 +17,7 @@
# GNU General Public License for more details. # GNU General Public License for more details.
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# As a special exception to the GNU General Public License, if you # As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a # distribute this file as part of a program that contains a
@@ -25,13 +26,45 @@
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
if test -z "$depmode" || test -z "$source" || test -z "$object"; then if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2 echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1 exit 1
fi fi
# `libtool' can also be set to `yes' or `no'.
depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`} # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
@@ -52,12 +85,34 @@ if test "$depmode" = dashXmstdout; then
depmode=dashmstdout depmode=dashmstdout
fi fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u="sed s,\\\\\\\\,/,g"
depmode=msvisualcpp
fi
case "$depmode" in case "$depmode" in
gcc3) gcc3)
## gcc 3 implements dependency tracking that does exactly what ## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm. ## it if -MD -MP comes after the -MF stuff. Hmm.
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile" ## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$? stat=$?
if test $stat -eq 0; then : if test $stat -eq 0; then :
else else
@@ -144,14 +199,14 @@ sgi)
' < "$tmpdepfile" \ ' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr ' tr '
' ' ' >> $depfile ' ' ' >> "$depfile"
echo >> $depfile echo >> "$depfile"
# The second pass generates a dummy entry for each header file. # The second pass generates a dummy entry for each header file.
tr ' ' ' tr ' ' '
' < "$tmpdepfile" \ ' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile >> "$depfile"
else else
# The sourcefile does not contain any dependencies, so just # The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile # store a dummy comment line, to avoid errors with the Makefile
@@ -163,31 +218,43 @@ sgi)
aix) aix)
# The C for AIX Compiler uses -M and outputs the dependencies # The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. This file always lives in the current directory. # in a .u file. In older versions, this file always lives in the
# Also, the AIX compiler puts `$object:' at the start of each line; # current directory. Also, the AIX compiler puts `$object:' at the
# $object doesn't have directory information. # start of each line; $object doesn't have directory information.
stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` # Version 6 uses the directory in both cases.
tmpdepfile="$stripped.u" dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
outname="$stripped.o" test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M "$@" -Wc,-M
else else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M "$@" -M
fi fi
stat=$? stat=$?
if test $stat -eq 0; then : if test $stat -eq 0; then :
else else
rm -f "$tmpdepfile" rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat exit $stat
fi fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then if test -f "$tmpdepfile"; then
# Each line is of the form `foo.o: dependent.h'. # Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to # Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'. # `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" # That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else else
# The sourcefile does not contain any dependencies, so just # The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile # store a dummy comment line, to avoid errors with the Makefile
@@ -197,37 +264,141 @@ aix)
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
;; ;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64) tru64)
# The Tru64 AIX compiler uses -MD to generate dependencies as a side # The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too. # dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected. # Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
tmpdepfile1="$object.d"
tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'`
if test "$libtool" = yes; then if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mechanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD "$@" -Wc,-MD
else else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD "$@" -MD
fi fi
stat=$? stat=$?
if test $stat -eq 0; then : if test $stat -eq 0; then :
else else
rm -f "$tmpdepfile1" "$tmpdepfile2" rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat exit $stat
fi fi
if test -f "$tmpdepfile1"; then for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
tmpdepfile="$tmpdepfile1" do
else test -f "$tmpdepfile" && break
tmpdepfile="$tmpdepfile2" done
fi
if test -f "$tmpdepfile"; then if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a space and a tab in the []. # That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else else
echo "#dummy" > "$depfile" echo "#dummy" > "$depfile"
fi fi
@@ -240,34 +411,42 @@ tru64)
dashmstdout) dashmstdout)
# Important note: in order to support this mode, a compiler *must* # Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout, regardless of -o, # always write the preprocessed file to stdout, regardless of -o.
# because we must use -o when running libtool. "$@" || exit $?
test -z "$dashmflag" && dashmflag=-M
( IFS=" " # Remove the call to Libtool.
case " $* " in if test "$libtool" = yes; then
*" --mode=compile "*) # this is libtool, let us make it quiet while test "X$1" != 'X--mode=compile'; do
for arg shift
do # cycle over the arguments done
case "$arg" in shift
"--mode=compile") fi
# insert --quiet before "--mode=compile"
set fnord "$@" --quiet # Remove `-o $object'.
shift # fnord IFS=" "
;; for arg
esac do
set fnord "$@" "$arg" case $arg in
shift # fnord -o)
shift # "$arg" shift
done ;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;; ;;
esac esac
"$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" done
) &
proc=$! test -z "$dashmflag" && dashmflag=-M
"$@" # Require at least two characters before searching for `:'
stat=$? # in the target name. This is to cope with DOS-style filenames:
wait "$proc" # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
if test "$stat" != 0; then exit $stat; fi "$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile" rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile" cat < "$tmpdepfile" > "$depfile"
tr ' ' ' tr ' ' '
@@ -285,36 +464,47 @@ dashXmstdout)
;; ;;
makedepend) makedepend)
# X makedepend "$@" || exit $?
( # Remove any Libtool call
shift if test "$libtool" = yes; then
cleared=no while test "X$1" != 'X--mode=compile'; do
for arg in "$@"; do shift
case $cleared in no)
set ""; shift
cleared=yes
esac
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift;;
-*)
;;
*)
set fnord "$@" "$arg"; shift;;
esac
done done
obj_suffix="`echo $object | sed 's/^.*\././'`" shift
touch "$tmpdepfile" fi
${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@" # X makedepend
) & shift
proc=$! cleared=no eat=no
"$@" for arg
stat=$? do
wait "$proc" case $cleared in
if test "$stat" != 0; then exit $stat; fi no)
set ""; shift
cleared=yes ;;
esac
if test $eat = yes; then
eat=no
continue
fi
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-arch)
eat=yes ;;
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile" rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile" cat < "$tmpdepfile" > "$depfile"
tail +3 "$tmpdepfile" | tr ' ' ' sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \ ' | \
## Some versions of the HPUX 10.20 sed can't process this invocation ## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround. ## correctly. Breaking it into two sed invocations is a workaround.
@@ -324,35 +514,40 @@ makedepend)
cpp) cpp)
# Important note: in order to support this mode, a compiler *must* # Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout, regardless of -o, # always write the preprocessed file to stdout.
# because we must use -o when running libtool. "$@" || exit $?
( IFS=" "
case " $* " in # Remove the call to Libtool.
*" --mode=compile "*) if test "$libtool" = yes; then
for arg while test "X$1" != 'X--mode=compile'; do
do # cycle over the arguments shift
case $arg in done
"--mode=compile") shift
# insert --quiet before "--mode=compile" fi
set fnord "$@" --quiet
shift # fnord # Remove `-o $object'.
;; IFS=" "
esac for arg
set fnord "$@" "$arg" do
shift # fnord case $arg in
shift # "$arg" -o)
done shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;; ;;
esac esac
"$@" -E | done
sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
"$@" -E |
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile" sed '$ s: \\$::' > "$tmpdepfile"
) &
proc=$!
"$@"
stat=$?
wait "$proc"
if test "$stat" != 0; then exit $stat; fi
rm -f "$depfile" rm -f "$depfile"
echo "$object : \\" > "$depfile" echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile" cat < "$tmpdepfile" >> "$depfile"
@@ -362,42 +557,56 @@ cpp)
msvisualcpp) msvisualcpp)
# Important note: in order to support this mode, a compiler *must* # Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout, regardless of -o, # always write the preprocessed file to stdout.
# because we must use -o when running libtool. "$@" || exit $?
( IFS=" "
case " $* " in # Remove the call to Libtool.
*" --mode=compile "*) if test "$libtool" = yes; then
for arg while test "X$1" != 'X--mode=compile'; do
do # cycle over the arguments shift
case $arg in done
"--mode=compile") shift
# insert --quiet before "--mode=compile" fi
set fnord "$@" --quiet
shift # fnord IFS=" "
;; for arg
esac do
set fnord "$@" "$arg" case "$arg" in
shift # fnord -o)
shift # "$arg" shift
done
;; ;;
$object)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac esac
"$@" -E | done
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" "$@" -E 2>/dev/null |
) & sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
proc=$!
"$@"
stat=$?
wait "$proc"
if test "$stat" != 0; then exit $stat; fi
rm -f "$depfile" rm -f "$depfile"
echo "$object : \\" > "$depfile" echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile" echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
;; ;;
msvcmsys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
none) none)
exec "$@" exec "$@"
;; ;;
@@ -409,3 +618,13 @@ none)
esac esac
exit 0 exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

362
example.c
View File

@@ -2,9 +2,9 @@
#if 0 /* in case someone actually tries to compile this */ #if 0 /* in case someone actually tries to compile this */
/* example.c - an example of using libpng /* example.c - an example of using libpng
* Last changed in libpng 1.2.1 December 7, 2001. * Last changed in libpng 1.4.2 [May 6, 2010]
* This file has been placed in the public domain by the authors. * This file has been placed in the public domain by the authors.
* Maintained 1998-2001 Glenn Randers-Pehrson * Maintained 1998-2010 Glenn Randers-Pehrson
* Maintained 1996, 1997 Andreas Dilger) * Maintained 1996, 1997 Andreas Dilger)
* Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*/ */
@@ -91,14 +91,15 @@ void read_png(char *file_name) /* We need to open the file */
if ((fp = fopen(file_name, "rb")) == NULL) if ((fp = fopen(file_name, "rb")) == NULL)
return (ERROR); return (ERROR);
#else no_open_file /* prototype 2 */ #else no_open_file /* prototype 2 */
void read_png(FILE *fp, unsigned int sig_read) /* file is already open */ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
{ {
png_structp png_ptr; png_structp png_ptr;
png_infop info_ptr; png_infop info_ptr;
png_uint_32 width, height; png_uint_32 width, height;
int bit_depth, color_type, interlace_type; int bit_depth, color_type, interlace_type;
#endif no_open_file /* only use one prototype! */ #endif no_open_file /* Only use one prototype! */
/* Create and initialize the png_struct with the desired error handler /* Create and initialize the png_struct with the desired error handler
* functions. If you want to use the default stderr and longjump method, * functions. If you want to use the default stderr and longjump method,
@@ -120,7 +121,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
if (info_ptr == NULL) if (info_ptr == NULL)
{ {
fclose(fp); fclose(fp);
png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL); png_destroy_read_struct(&png_ptr, NULL, NULL);
return (ERROR); return (ERROR);
} }
@@ -132,7 +133,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
if (setjmp(png_jmpbuf(png_ptr))) if (setjmp(png_jmpbuf(png_ptr)))
{ {
/* Free all of the memory associated with the png_ptr and info_ptr */ /* Free all of the memory associated with the png_ptr and info_ptr */
png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL); png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
fclose(fp); fclose(fp);
/* If we get here, we had a problem reading the file */ /* If we get here, we had a problem reading the file */
return (ERROR); return (ERROR);
@@ -159,11 +160,12 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
* If you have enough memory to read in the entire image at once, * If you have enough memory to read in the entire image at once,
* and you need to specify only transforms that can be controlled * and you need to specify only transforms that can be controlled
* with one of the PNG_TRANSFORM_* bits (this presently excludes * with one of the PNG_TRANSFORM_* bits (this presently excludes
* dithering, filling, setting background, and doing gamma * quantizing, filling, setting background, and doing gamma
* adjustment), then you can read the entire image (including * adjustment), then you can read the entire image (including
* pixels) into the info structure with this call: * pixels) into the info structure with this call:
*/ */
png_read_png(png_ptr, info_ptr, png_transforms, png_voidp_NULL); png_read_png(png_ptr, info_ptr, png_transforms, NULL);
#else #else
/* OK, you're doing it the hard way, with the lower-level functions */ /* OK, you're doing it the hard way, with the lower-level functions */
@@ -173,15 +175,15 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
png_read_info(png_ptr, info_ptr); png_read_info(png_ptr, info_ptr);
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
&interlace_type, int_p_NULL, int_p_NULL); &interlace_type, NULL, NULL);
/* Set up the data transformations you want. Note that these are all /* Set up the data transformations you want. Note that these are all
* optional. Only call them if you want/need them. Many of the * optional. Only call them if you want/need them. Many of the
* transformations only work on specific types of images, and many * transformations only work on specific types of images, and many
* are mutually exclusive. * are mutually exclusive.
*/ */
/* tell libpng to strip 16 bit/color files down to 8 bits/color */ /* Tell libpng to strip 16 bit/color files down to 8 bits/color */
png_set_strip_16(png_ptr); png_set_strip_16(png_ptr);
/* Strip alpha bytes from the input data without combining with the /* Strip alpha bytes from the input data without combining with the
@@ -200,11 +202,11 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
/* Expand paletted colors into true RGB triplets */ /* Expand paletted colors into true RGB triplets */
if (color_type == PNG_COLOR_TYPE_PALETTE) if (color_type == PNG_COLOR_TYPE_PALETTE)
png_set_palette_rgb(png_ptr); png_set_palette_to_rgb(png_ptr);
/* Expand grayscale images to the full 8 bits from 1, 2, or 4 bits/pixel */ /* Expand grayscale images to the full 8 bits from 1, 2, or 4 bits/pixel */
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
png_set_gray_1_2_4_to_8(png_ptr); png_set_expand_gray_1_2_4_to_8(png_ptr);
/* Expand paletted or RGB images with transparency to full alpha channels /* Expand paletted or RGB images with transparency to full alpha channels
* so the data will be available as RGBA quartets. * so the data will be available as RGBA quartets.
@@ -228,10 +230,11 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
png_set_background(png_ptr, &my_background, png_set_background(png_ptr, &my_background,
PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0); PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
/* Some suggestions as to how to get a screen gamma value */ /* Some suggestions as to how to get a screen gamma value
*
/* Note that screen gamma is the display_exponent, which includes * Note that screen gamma is the display_exponent, which includes
* the CRT_exponent and any correction for viewing conditions */ * the CRT_exponent and any correction for viewing conditions
*/
if (/* We have a user-defined screen gamma value */) if (/* We have a user-defined screen gamma value */)
{ {
screen_gamma = user-defined screen_gamma; screen_gamma = user-defined screen_gamma;
@@ -244,7 +247,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
/* If we don't have another value */ /* If we don't have another value */
else else
{ {
screen_gamma = 2.2; /* A good guess for a PC monitors in a dimly screen_gamma = 2.2; /* A good guess for a PC monitor in a dimly
lit room */ lit room */
screen_gamma = 1.7 or 1.0; /* A good guess for Mac systems */ screen_gamma = 1.7 or 1.0; /* A good guess for Mac systems */
} }
@@ -268,7 +271,8 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
png_set_gamma(png_ptr, screen_gamma, 0.45455); png_set_gamma(png_ptr, screen_gamma, 0.45455);
} }
/* Dither RGB files down to 8 bit palette or reduce palettes #ifdef PNG_READ_QUANTIZE_SUPPORTED
/* Quantize RGB files down to 8 bit palette or reduce palettes
* to the number of colors available on your screen. * to the number of colors available on your screen.
*/ */
if (color_type & PNG_COLOR_MASK_COLOR) if (color_type & PNG_COLOR_MASK_COLOR)
@@ -277,13 +281,14 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
png_colorp palette; png_colorp palette;
/* This reduces the image to the application supplied palette */ /* This reduces the image to the application supplied palette */
if (/* we have our own palette */) if (/* We have our own palette */)
{ {
/* An array of colors to which the image should be dithered */ /* An array of colors to which the image should be quantized */
png_color std_color_cube[MAX_SCREEN_COLORS]; png_color std_color_cube[MAX_SCREEN_COLORS];
png_set_dither(png_ptr, std_color_cube, MAX_SCREEN_COLORS, /* Prior to libpng-1.4.2, this was png_set_dither(). */
MAX_SCREEN_COLORS, png_uint_16p_NULL, 0); png_set_quantize(png_ptr, std_color_cube, MAX_SCREEN_COLORS,
MAX_SCREEN_COLORS, NULL, 0);
} }
/* This reduces the image to the palette supplied in the file */ /* This reduces the image to the palette supplied in the file */
else if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette)) else if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette))
@@ -292,12 +297,13 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
png_get_hIST(png_ptr, info_ptr, &histogram); png_get_hIST(png_ptr, info_ptr, &histogram);
png_set_dither(png_ptr, palette, num_palette, png_set_quantize(png_ptr, palette, num_palette,
max_screen_colors, histogram, 0); max_screen_colors, histogram, 0);
} }
} }
#endif /* PNG_READ_QUANTIZE_SUPPORTED */
/* invert monochrome files to have 0 as white and 1 as black */ /* Invert monochrome files to have 0 as white and 1 as black */
png_set_invert_mono(png_ptr); png_set_invert_mono(png_ptr);
/* If you want to shift the pixel values from the range [0,255] or /* If you want to shift the pixel values from the range [0,255] or
@@ -306,20 +312,20 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
*/ */
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT)) if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT))
{ {
png_color_8p sig_bit; png_color_8p sig_bit_p;
png_get_sBIT(png_ptr, info_ptr, &sig_bit); png_get_sBIT(png_ptr, info_ptr, &sig_bit_p);
png_set_shift(png_ptr, sig_bit); png_set_shift(png_ptr, sig_bit_p);
} }
/* flip the RGB pixels to BGR (or RGBA to BGRA) */ /* Flip the RGB pixels to BGR (or RGBA to BGRA) */
if (color_type & PNG_COLOR_MASK_COLOR) if (color_type & PNG_COLOR_MASK_COLOR)
png_set_bgr(png_ptr); png_set_bgr(png_ptr);
/* swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */ /* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */
png_set_swap_alpha(png_ptr); png_set_swap_alpha(png_ptr);
/* swap bytes of 16 bit files to least significant byte first */ /* Swap bytes of 16 bit files to least significant byte first */
png_set_swap(png_ptr); png_set_swap(png_ptr);
/* Add filler (or alpha) byte (before/after each RGB triplet) */ /* Add filler (or alpha) byte (before/after each RGB triplet) */
@@ -342,11 +348,13 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
/* The easiest way to read the image: */ /* The easiest way to read the image: */
png_bytep row_pointers[height]; png_bytep row_pointers[height];
/* Clear the pointer array */
for (row = 0; row < height; row++)
row_pointers[row] = NULL;
for (row = 0; row < height; row++) for (row = 0; row < height; row++)
{
row_pointers[row] = png_malloc(png_ptr, png_get_rowbytes(png_ptr, row_pointers[row] = png_malloc(png_ptr, png_get_rowbytes(png_ptr,
info_ptr)); info_ptr));
}
/* Now it's time to read the image. One of these methods is REQUIRED */ /* Now it's time to read the image. One of these methods is REQUIRED */
#ifdef entire /* Read the entire image in one go */ #ifdef entire /* Read the entire image in one go */
@@ -360,44 +368,43 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
#ifdef single /* Read the image a single row at a time */ #ifdef single /* Read the image a single row at a time */
for (y = 0; y < height; y++) for (y = 0; y < height; y++)
{ {
png_read_rows(png_ptr, &row_pointers[y], png_bytepp_NULL, 1); png_read_rows(png_ptr, &row_pointers[y], NULL, 1);
} }
#else no_single /* Read the image several rows at a time */ #else no_single /* Read the image several rows at a time */
for (y = 0; y < height; y += number_of_rows) for (y = 0; y < height; y += number_of_rows)
{ {
#ifdef sparkle /* Read the image using the "sparkle" effect. */ #ifdef sparkle /* Read the image using the "sparkle" effect. */
png_read_rows(png_ptr, &row_pointers[y], png_bytepp_NULL, png_read_rows(png_ptr, &row_pointers[y], NULL,
number_of_rows); number_of_rows);
#else no_sparkle /* Read the image using the "rectangle" effect */ #else no_sparkle /* Read the image using the "rectangle" effect */
png_read_rows(png_ptr, png_bytepp_NULL, &row_pointers[y], png_read_rows(png_ptr, NULL, &row_pointers[y],
number_of_rows); number_of_rows);
#endif no_sparkle /* use only one of these two methods */ #endif no_sparkle /* Use only one of these two methods */
} }
/* if you want to display the image after every pass, do /* If you want to display the image after every pass, do so here */
so here */ #endif no_single /* Use only one of these two methods */
#endif no_single /* use only one of these two methods */
} }
#endif no_entire /* use only one of these two methods */ #endif no_entire /* Use only one of these two methods */
/* read rest of file, and get additional chunks in info_ptr - REQUIRED */ /* Read rest of file, and get additional chunks in info_ptr - REQUIRED */
png_read_end(png_ptr, info_ptr); png_read_end(png_ptr, info_ptr);
#endif hilevel #endif hilevel
/* At this point you have read the entire image */ /* At this point you have read the entire image */
/* clean up after the read, and free any memory allocated - REQUIRED */ /* Clean up after the read, and free any memory allocated - REQUIRED */
png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL); png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
/* close the file */ /* Close the file */
fclose(fp); fclose(fp);
/* that's it */ /* That's it */
return (OK); return (OK);
} }
/* progressively read a file */ /* Progressively read a file */
int int
initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr) initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr)
@@ -421,13 +428,13 @@ initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr)
if (*info_ptr == NULL) if (*info_ptr == NULL)
{ {
png_destroy_read_struct(png_ptr, info_ptr, png_infopp_NULL); png_destroy_read_struct(png_ptr, info_ptr, NULL);
return (ERROR); return (ERROR);
} }
if (setjmp(png_jmpbuf((*png_ptr)))) if (setjmp(png_jmpbuf((*png_ptr))))
{ {
png_destroy_read_struct(png_ptr, info_ptr, png_infopp_NULL); png_destroy_read_struct(png_ptr, info_ptr, NULL);
return (ERROR); return (ERROR);
} }
@@ -456,13 +463,13 @@ process_data(png_structp *png_ptr, png_infop *info_ptr,
if (setjmp(png_jmpbuf((*png_ptr)))) if (setjmp(png_jmpbuf((*png_ptr))))
{ {
/* Free the png_ptr and info_ptr memory on error */ /* Free the png_ptr and info_ptr memory on error */
png_destroy_read_struct(png_ptr, info_ptr, png_infopp_NULL); png_destroy_read_struct(png_ptr, info_ptr, NULL);
return (ERROR); return (ERROR);
} }
/* This one's new also. Simply give it chunks of data as /* This one's new also. Simply give it chunks of data as
* they arrive from the data stream (in order, of course). * they arrive from the data stream (in order, of course).
* On Segmented machines, don't give it any more than 64K. * On segmented machines, don't give it any more than 64K.
* The library seems to run fine with sizes of 4K, although * The library seems to run fine with sizes of 4K, although
* you can give it much less if necessary (I assume you can * you can give it much less if necessary (I assume you can
* give it chunks of 1 byte, but I haven't tried with less * give it chunks of 1 byte, but I haven't tried with less
@@ -476,86 +483,84 @@ process_data(png_structp *png_ptr, png_infop *info_ptr,
info_callback(png_structp png_ptr, png_infop info) info_callback(png_structp png_ptr, png_infop info)
{ {
/* do any setup here, including setting any of the transformations /* Do any setup here, including setting any of the transformations
* mentioned in the Reading PNG files section. For now, you _must_ * mentioned in the Reading PNG files section. For now, you _must_
* call either png_start_read_image() or png_read_update_info() * call either png_start_read_image() or png_read_update_info()
* after all the transformations are set (even if you don't set * after all the transformations are set (even if you don't set
* any). You may start getting rows before png_process_data() * any). You may start getting rows before png_process_data()
* returns, so this is your last chance to prepare for that. * returns, so this is your last chance to prepare for that.
*/ */
} }
row_callback(png_structp png_ptr, png_bytep new_row, row_callback(png_structp png_ptr, png_bytep new_row,
png_uint_32 row_num, int pass) png_uint_32 row_num, int pass)
{ {
/* /*
* This function is called for every row in the image. If the * This function is called for every row in the image. If the
* image is interlaced, and you turned on the interlace handler, * image is interlaced, and you turned on the interlace handler,
* this function will be called for every row in every pass. * this function will be called for every row in every pass.
* *
* In this function you will receive a pointer to new row data from * In this function you will receive a pointer to new row data from
* libpng called new_row that is to replace a corresponding row (of * libpng called new_row that is to replace a corresponding row (of
* the same data format) in a buffer allocated by your application. * the same data format) in a buffer allocated by your application.
* *
* The new row data pointer new_row may be NULL, indicating there is * The new row data pointer "new_row" may be NULL, indicating there is
* no new data to be replaced (in cases of interlace loading). * no new data to be replaced (in cases of interlace loading).
* *
* If new_row is not NULL then you need to call * If new_row is not NULL then you need to call
* png_progressive_combine_row() to replace the corresponding row as * png_progressive_combine_row() to replace the corresponding row as
* shown below: * shown below:
*/ */
/* Check if row_num is in bounds. */
if((row_num >= 0) && (row_num < height))
{
/* Get pointer to corresponding row in our
* PNG read buffer.
*/
png_bytep old_row = ((png_bytep *)our_data)[row_num];
/* If both rows are allocated then copy the new row /* Get pointer to corresponding row in our
* data to the corresponding row data. * PNG read buffer.
*/ */
if((old_row != NULL) && (new_row != NULL)) png_bytep old_row = ((png_bytep *)our_data)[row_num];
png_progressive_combine_row(png_ptr, old_row, new_row);
} /* If both rows are allocated then copy the new row
/* * data to the corresponding row data.
* The rows and passes are called in order, so you don't really */
* need the row_num and pass, but I'm supplying them because it if ((old_row != NULL) && (new_row != NULL))
* may make your life easier. png_progressive_combine_row(png_ptr, old_row, new_row);
*
* For the non-NULL rows of interlaced images, you must call /*
* png_progressive_combine_row() passing in the new row and the * The rows and passes are called in order, so you don't really
* old row, as demonstrated above. You can call this function for * need the row_num and pass, but I'm supplying them because it
* NULL rows (it will just return) and for non-interlaced images * may make your life easier.
* (it just does the png_memcpy for you) if it will make the code *
* easier. Thus, you can just do this for all cases: * For the non-NULL rows of interlaced images, you must call
*/ * png_progressive_combine_row() passing in the new row and the
* old row, as demonstrated above. You can call this function for
* NULL rows (it will just return) and for non-interlaced images
* (it just does the png_memcpy for you) if it will make the code
* easier. Thus, you can just do this for all cases:
*/
png_progressive_combine_row(png_ptr, old_row, new_row); png_progressive_combine_row(png_ptr, old_row, new_row);
/* where old_row is what was displayed for previous rows. Note /* where old_row is what was displayed for previous rows. Note
* that the first pass (pass == 0 really) will completely cover * that the first pass (pass == 0 really) will completely cover
* the old row, so the rows do not have to be initialized. After * the old row, so the rows do not have to be initialized. After
* the first pass (and only for interlaced images), you will have * the first pass (and only for interlaced images), you will have
* to pass the current row as new_row, and the function will combine * to pass the current row as new_row, and the function will combine
* the old row and the new row. * the old row and the new row.
*/ */
} }
end_callback(png_structp png_ptr, png_infop info) end_callback(png_structp png_ptr, png_infop info)
{ {
/* this function is called when the whole image has been read, /* This function is called when the whole image has been read,
* including any chunks after the image (up to and including * including any chunks after the image (up to and including
* the IEND). You will usually have the same info chunk as you * the IEND). You will usually have the same info chunk as you
* had in the header, although some data may have been added * had in the header, although some data may have been added
* to the comments and time fields. * to the comments and time fields.
* *
* Most people won't do much here, perhaps setting a flag that * Most people won't do much here, perhaps setting a flag that
* marks the image as finished. * marks the image as finished.
*/ */
} }
/* write a png file */ /* Write a png file */
void write_png(char *file_name /* , ... other image information ... */) void write_png(char *file_name /* , ... other image information ... */)
{ {
FILE *fp; FILE *fp;
@@ -563,7 +568,7 @@ void write_png(char *file_name /* , ... other image information ... */)
png_infop info_ptr; png_infop info_ptr;
png_colorp palette; png_colorp palette;
/* open the file */ /* Open the file */
fp = fopen(file_name, "wb"); fp = fopen(file_name, "wb");
if (fp == NULL) if (fp == NULL)
return (ERROR); return (ERROR);
@@ -588,7 +593,7 @@ void write_png(char *file_name /* , ... other image information ... */)
if (info_ptr == NULL) if (info_ptr == NULL)
{ {
fclose(fp); fclose(fp);
png_destroy_write_struct(&png_ptr, png_infopp_NULL); png_destroy_write_struct(&png_ptr, NULL);
return (ERROR); return (ERROR);
} }
@@ -597,30 +602,34 @@ void write_png(char *file_name /* , ... other image information ... */)
*/ */
if (setjmp(png_jmpbuf(png_ptr))) if (setjmp(png_jmpbuf(png_ptr)))
{ {
/* If we get here, we had a problem reading the file */ /* If we get here, we had a problem writing the file */
fclose(fp); fclose(fp);
png_destroy_write_struct(&png_ptr, &info_ptr); png_destroy_write_struct(&png_ptr, &info_ptr);
return (ERROR); return (ERROR);
} }
/* One of the following I/O initialization functions is REQUIRED */ /* One of the following I/O initialization functions is REQUIRED */
#ifdef streams /* I/O initialization method 1 */ #ifdef streams /* I/O initialization method 1 */
/* set up the output control if you are using standard C streams */ /* Set up the output control if you are using standard C streams */
png_init_io(png_ptr, fp); png_init_io(png_ptr, fp);
#else no_streams /* I/O initialization method 2 */ #else no_streams /* I/O initialization method 2 */
/* If you are using replacement read functions, instead of calling /* If you are using replacement write functions, instead of calling
* png_init_io() here you would call */ * png_init_io() here you would call
*/
png_set_write_fn(png_ptr, (void *)user_io_ptr, user_write_fn, png_set_write_fn(png_ptr, (void *)user_io_ptr, user_write_fn,
user_IO_flush_function); user_IO_flush_function);
/* where user_io_ptr is a structure you want available to the callbacks */ /* where user_io_ptr is a structure you want available to the callbacks */
#endif no_streams /* only use one initialization method */ #endif no_streams /* Only use one initialization method */
#ifdef hilevel #ifdef hilevel
/* This is the easy way. Use it if you already have all the /* This is the easy way. Use it if you already have all the
* image info living info in the structure. You could "|" many * image info living in the structure. You could "|" many
* PNG_TRANSFORM flags into the png_transforms integer here. * PNG_TRANSFORM flags into the png_transforms integer here.
*/ */
png_write_png(png_ptr, info_ptr, png_transforms, png_voidp_NULL); png_write_png(png_ptr, info_ptr, png_transforms, NULL);
#else #else
/* This is the hard way */ /* This is the hard way */
@@ -635,25 +644,27 @@ void write_png(char *file_name /* , ... other image information ... */)
png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, PNG_COLOR_TYPE_???, png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, PNG_COLOR_TYPE_???,
PNG_INTERLACE_????, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); PNG_INTERLACE_????, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
/* set the palette if there is one. REQUIRED for indexed-color images */ /* Set the palette if there is one. REQUIRED for indexed-color images */
palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH
* png_sizeof (png_color)); * png_sizeof(png_color));
/* ... set palette colors ... */ /* ... Set palette colors ... */
png_set_PLTE(png_ptr, info_ptr, palette, PNG_MAX_PALETTE_LENGTH); png_set_PLTE(png_ptr, info_ptr, palette, PNG_MAX_PALETTE_LENGTH);
/* You must not free palette here, because png_set_PLTE only makes a link to /* You must not free palette here, because png_set_PLTE only makes a link to
the palette that you malloced. Wait until you are about to destroy * the palette that you malloced. Wait until you are about to destroy
the png structure. */ * the png structure.
*/
/* optional significant bit chunk */ /* Optional significant bit (sBIT) chunk */
/* if we are dealing with a grayscale image then */ png_color_8 sig_bit;
/* If we are dealing with a grayscale image then */
sig_bit.gray = true_bit_depth; sig_bit.gray = true_bit_depth;
/* otherwise, if we are dealing with a color image then */ /* Otherwise, if we are dealing with a color image then */
sig_bit.red = true_red_bit_depth; sig_bit.red = true_red_bit_depth;
sig_bit.green = true_green_bit_depth; sig_bit.green = true_green_bit_depth;
sig_bit.blue = true_blue_bit_depth; sig_bit.blue = true_blue_bit_depth;
/* if the image has an alpha channel then */ /* If the image has an alpha channel then */
sig_bit.alpha = true_alpha_bit_depth; sig_bit.alpha = true_alpha_bit_depth;
png_set_sBIT(png_ptr, info_ptr, sig_bit); png_set_sBIT(png_ptr, info_ptr, &sig_bit);
/* Optional gamma chunk is strongly suggested if you have any guess /* Optional gamma chunk is strongly suggested if you have any guess
@@ -673,14 +684,20 @@ void write_png(char *file_name /* , ... other image information ... */)
text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt; text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt;
#ifdef PNG_iTXt_SUPPORTED #ifdef PNG_iTXt_SUPPORTED
text_ptr[0].lang = NULL; text_ptr[0].lang = NULL;
text_ptr[0].lang_key = NULL;
text_ptr[1].lang = NULL; text_ptr[1].lang = NULL;
text_ptr[1].lang_key = NULL;
text_ptr[2].lang = NULL; text_ptr[2].lang = NULL;
text_ptr[2].lang_key = NULL;
#endif #endif
png_set_text(png_ptr, info_ptr, text_ptr, 3); png_set_text(png_ptr, info_ptr, text_ptr, 3);
/* other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs, */ /* Other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs */
/* note that if sRGB is present the gAMA and cHRM chunks must be ignored
* on read and must be written in accordance with the sRGB profile */ /* Note that if sRGB is present the gAMA and cHRM chunks must be ignored
* on read and, if your application chooses to write them, they must
* be written in accordance with the sRGB profile
*/
/* Write the file header information. REQUIRED */ /* Write the file header information. REQUIRED */
png_write_info(png_ptr, info_ptr); png_write_info(png_ptr, info_ptr);
@@ -692,7 +709,7 @@ void write_png(char *file_name /* , ... other image information ... */)
* write_my_chunk(); * write_my_chunk();
* png_write_info(png_ptr, info_ptr); * png_write_info(png_ptr, info_ptr);
* *
* However, given the level of known- and unknown-chunk support in 1.1.0 * However, given the level of known- and unknown-chunk support in 1.2.0
* and up, this should no longer be necessary. * and up, this should no longer be necessary.
*/ */
@@ -702,11 +719,11 @@ void write_png(char *file_name /* , ... other image information ... */)
* at the end. * at the end.
*/ */
/* set up the transformations you want. Note that these are /* Set up the transformations you want. Note that these are
* all optional. Only call them if you want them. * all optional. Only call them if you want them.
*/ */
/* invert monochrome pixels */ /* Invert monochrome pixels */
png_set_invert_mono(png_ptr); png_set_invert_mono(png_ptr);
/* Shift the pixels up to a legal bit depth and fill in /* Shift the pixels up to a legal bit depth and fill in
@@ -714,10 +731,10 @@ void write_png(char *file_name /* , ... other image information ... */)
*/ */
png_set_shift(png_ptr, &sig_bit); png_set_shift(png_ptr, &sig_bit);
/* pack pixels into bytes */ /* Pack pixels into bytes */
png_set_packing(png_ptr); png_set_packing(png_ptr);
/* swap location of alpha bytes from ARGB to RGBA */ /* Swap location of alpha bytes from ARGB to RGBA */
png_set_swap_alpha(png_ptr); png_set_swap_alpha(png_ptr);
/* Get rid of filler (OR ALPHA) bytes, pack XRGB/RGBX/ARGB/RGBA into /* Get rid of filler (OR ALPHA) bytes, pack XRGB/RGBX/ARGB/RGBA into
@@ -725,16 +742,16 @@ void write_png(char *file_name /* , ... other image information ... */)
*/ */
png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE); png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
/* flip BGR pixels to RGB */ /* Flip BGR pixels to RGB */
png_set_bgr(png_ptr); png_set_bgr(png_ptr);
/* swap bytes of 16-bit files to most significant byte first */ /* Swap bytes of 16-bit files to most significant byte first */
png_set_swap(png_ptr); png_set_swap(png_ptr);
/* swap bits of 1, 2, 4 bit packed pixel formats */ /* Swap bits of 1, 2, 4 bit packed pixel formats */
png_set_packswap(png_ptr); png_set_packswap(png_ptr);
/* turn on interlace handling if you are not using png_write_image() */ /* Turn on interlace handling if you are not using png_write_image() */
if (interlacing) if (interlacing)
number_passes = png_set_interlace_handling(png_ptr); number_passes = png_set_interlace_handling(png_ptr);
else else
@@ -755,12 +772,14 @@ void write_png(char *file_name /* , ... other image information ... */)
row_pointers[k] = image + k*width*bytes_per_pixel; row_pointers[k] = image + k*width*bytes_per_pixel;
/* One of the following output methods is REQUIRED */ /* One of the following output methods is REQUIRED */
#ifdef entire /* write out the entire image data in one call */
#ifdef entire /* Write out the entire image data in one call */
png_write_image(png_ptr, row_pointers); png_write_image(png_ptr, row_pointers);
/* the other way to write the image - deal with interlacing */ /* The other way to write the image - deal with interlacing */
#else no_entire /* Write out the image data by one or more scanlines */
#else no_entire /* write out the image data by one or more scanlines */
/* The number of passes is either 1 for non-interlaced images, /* The number of passes is either 1 for non-interlaced images,
* or 7 for interlaced images. * or 7 for interlaced images.
*/ */
@@ -771,14 +790,12 @@ void write_png(char *file_name /* , ... other image information ... */)
/* If you are only writing one row at a time, this works */ /* If you are only writing one row at a time, this works */
for (y = 0; y < height; y++) for (y = 0; y < height; y++)
{
png_write_rows(png_ptr, &row_pointers[y], 1); png_write_rows(png_ptr, &row_pointers[y], 1);
}
} }
#endif no_entire /* use only one output method */ #endif no_entire /* Use only one output method */
/* You can write optional chunks like tEXt, zTXt, and tIME at the end /* You can write optional chunks like tEXt, zTXt, and tIME at the end
* as well. Shouldn't be necessary in 1.1.0 and up as all the public * as well. Shouldn't be necessary in 1.2.0 and up as all the public
* chunks are supported and you can use png_set_unknown_chunks() to * chunks are supported and you can use png_set_unknown_chunks() to
* register unknown chunks into the info structure to be written out. * register unknown chunks into the info structure to be written out.
*/ */
@@ -788,26 +805,33 @@ void write_png(char *file_name /* , ... other image information ... */)
#endif hilevel #endif hilevel
/* If you png_malloced a palette, free it here (don't free info_ptr->palette, /* If you png_malloced a palette, free it here (don't free info_ptr->palette,
as recommended in versions 1.0.5m and earlier of this example; if * as recommended in versions 1.0.5m and earlier of this example; if
libpng mallocs info_ptr->palette, libpng will free it). If you * libpng mallocs info_ptr->palette, libpng will free it). If you
allocated it with malloc() instead of png_malloc(), use free() instead * allocated it with malloc() instead of png_malloc(), use free() instead
of png_free(). */ * of png_free().
*/
png_free(png_ptr, palette); png_free(png_ptr, palette);
palette=NULL; palette = NULL;
/* Similarly, if you png_malloced any data that you passed in with /* Similarly, if you png_malloced any data that you passed in with
png_set_something(), such as a hist or trans array, free it here, * png_set_something(), such as a hist or trans array, free it here,
when you can be sure that libpng is through with it. */ * when you can be sure that libpng is through with it.
*/
png_free(png_ptr, trans); png_free(png_ptr, trans);
trans=NULL; trans = NULL;
/* Whenever you use png_free() it is a good idea to set the pointer to
* NULL in case your application inadvertently tries to png_free() it
* again. When png_free() sees a NULL it returns without action, thus
* avoiding the double-free security problem.
*/
/* clean up after the write, and free any memory allocated */ /* Clean up after the write, and free any memory allocated */
png_destroy_write_struct(&png_ptr, &info_ptr); png_destroy_write_struct(&png_ptr, &info_ptr);
/* close the file */ /* Close the file */
fclose(fp); fclose(fp);
/* that's it */ /* That's it */
return (OK); return (OK);
} }

View File

@@ -1,251 +1,520 @@
#!/bin/sh #!/bin/sh
#
# install - install a program, script, or datafile # install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
scriptversion=2009-04-28.21; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
# #
# Copyright 1991 by the Massachusetts Institute of Technology # Copyright (C) 1994 X Consortium
# #
# Permission to use, copy, modify, distribute, and sell this software and its # Permission is hereby granted, free of charge, to any person obtaining a copy
# documentation for any purpose is hereby granted without fee, provided that # of this software and associated documentation files (the "Software"), to
# the above copyright notice appear in all copies and that both that # deal in the Software without restriction, including without limitation the
# copyright notice and this permission notice appear in supporting # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# documentation, and that the name of M.I.T. not be used in advertising or # sell copies of the Software, and to permit persons to whom the Software is
# publicity pertaining to distribution of the software without specific, # furnished to do so, subject to the following conditions:
# written prior permission. M.I.T. makes no representations about the #
# suitability of this software for any purpose. It is provided "as is" # The above copyright notice and this permission notice shall be included in
# without express or implied warranty. # 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
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
# #
# Calling this script install-sh is preferred over install.sh, to prevent # Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it # `make' implicit rules from creating a file called install from it
# when there is no Makefile. # when there is no Makefile.
# #
# This script is compatible with the BSD install script, but was written # This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction # from scratch.
# shared with many OS's install programs.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script # set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it. # Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}" doit=${DOITPROG-}
if test -z "$doit"; then
doit_exec=exec
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else else
true doit_exec=$doit
fi fi
if [ x"$dir_arg" != x ]; then # Put in absolute file names if you don't have them in your path;
dst=$src # or use environment vars.
src=""
if [ -d $dst ]; then
instcmd=:
chmodcmd=""
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command chgrpprog=${CHGRPPROG-chgrp}
# might cause directories to be created, which would be especially bad chmodprog=${CHMODPROG-chmod}
# if $src (and thus $dsttmp) contains '*'. chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
if [ -f $src -o -d $src ] posix_glob='?'
then initialize_posix_glob='
true test "$posix_glob" != "?" || {
else if (set -f) 2>/dev/null; then
echo "install: $src does not exist" posix_glob=
exit 1 else
fi posix_glob=:
fi
if [ x"$dst" = x ] }
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
' '
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}" posix_mkdir=
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp='' # Desired mode of installed file.
mode=0755
while [ $# -ne 0 ] ; do chgrpcmd=
pathcomp="${pathcomp}${1}" chmodcmd=$chmodprog
shift chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
if [ ! -d "${pathcomp}" ] ; src=
then dst=
$mkdirprog "${pathcomp}" dir_arg=
else dst_arg=
true
fi
pathcomp="${pathcomp}/" copy_on_change=false
no_target_directory=
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done done
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
done
fi fi
if [ x"$dir_arg" != x ] if test $# -eq 0; then
then if test -z "$dir_arg"; then
$doit $instcmd $dst && echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if test -z "$dir_arg"; then
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && trap '(exit $?); exit' 1 2 13 15
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now. # Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
if [ x"$transformarg" = x ] *[0-7])
then if test -z "$stripcmd"; then
dstfile=`basename $dst` u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names starting with `-'.
case $src in
-*) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else else
dstfile=`basename $dst $transformbasename | mkdir_mode=
sed $transformarg`$transformbasename
fi fi
# don't allow the sed command to completely eliminate the filename posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if [ x"$dstfile" = x ] if (umask $mkdir_umask &&
then exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
dstfile=`basename $dst` then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writeable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
-*) prefix='./';;
*) prefix='';;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob set -f
set fnord $dstdir
shift
$posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
test -z "$d" && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else else
true if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi fi
prefix=$prefix/
done
# Make a temp file name in the proper directory. if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
dsttmp=$dstdir/#inst.$$# if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Move or copy the file name to the temp name # Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
$doit $instcmd $src $dsttmp && # Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
trap "rm -f ${dsttmp}" 0 && # Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits # and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If any of these fail, we abort the whole thing. If we want to # If -C, don't bother to copy if it wouldn't change the file.
# ignore errors from any of these, just make sure not to ignore if $copy_on_change &&
# errors from the above "$doit $instcmd $src $dsttmp" command. old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && eval "$initialize_posix_glob" &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && $posix_glob set -f &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && set X $old && old=:$2:$4:$5:$6 &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f &&
# Now rename the file to the real destination. test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
$doit $rmcmd -f $dstdir/$dstfile && # The rename failed, perhaps because mv can't rename something else
$doit $mvcmd $dsttmp $dstdir/$dstfile # to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
fi && # Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
exit 0 # Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

File diff suppressed because it is too large Load Diff

View File

@@ -3,8 +3,11 @@
# libpng-config # libpng-config
# provides configuration info for libpng. # provides configuration info for libpng.
# Copyright (C) 2002, 2004, 2006 Glenn Randers-Pehrson # Copyright (C) 2002, 2004, 2006, 2007 Glenn Randers-Pehrson
# For conditions of distribution and use, see copyright notice in png.h
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# Modeled after libxml-config. # Modeled after libxml-config.
@@ -12,9 +15,9 @@ version="@PNGLIB_VERSION@"
prefix="@prefix@" prefix="@prefix@"
exec_prefix="@exec_prefix@" exec_prefix="@exec_prefix@"
libdir="@libdir@" libdir="@libdir@"
includedir="@includedir@/libpng@PNGLIB_MAJOR@" includedir="@includedir@/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@"
libs="-lpng@PNGLIB_MAJOR@" libs="-lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@"
all_libs="-lpng@PNGLIB_MAJOR@ -lz -lm" all_libs="-lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ @LIBS@"
I_opts="-I${includedir}" I_opts="-I${includedir}"
L_opts="-L${libdir}" L_opts="-L${libdir}"
R_opts="" R_opts=""

1170
libpng.3

File diff suppressed because it is too large Load Diff

11
libpng.pc.in Normal file
View File

@@ -0,0 +1,11 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
Name: libpng
Description: Loads and saves PNG files
Version: @PNGLIB_VERSION@
Libs: -L${libdir} -lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
Libs.private: @LIBS@
Cflags: -I${includedir}

View File

@@ -1,15 +1,21 @@
.TH LIBPNGPF 3 "April 19, 2006" .TH LIBPNGPF 3 "November 21, 2010"
.SH NAME .SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.2.10rc1 libpng \- Portable Network Graphics (PNG) Reference Library 1.4.5beta06
(private functions) (private functions)
.SH SYNOPSIS .SH SYNOPSIS
\fB#include <png.h>\fP \fB#include <png.h>\fP
\fI\fB \fB#include \fI"pngpriv.h"
\fI\fB \fI\fB
\fBvoid png_build_gamma_table (png_structp \fIpng_ptr\fP\fB);\fP \fBvoid png_64bit_product (long \fP\fIv1\fP\fB, long \fP\fIv2\fP\fB, unsigned long \fI*hi_product,
\fBunsigned long \fI*lo_product\fP\fB);\fP
\fI\fB
\fBvoid png_build_gamma_table (png_structp \fP\fIpng_ptr\fP\fB, png_byte \fIbit_depth\fP\fB);\fP
\fI\fB \fI\fB
@@ -27,6 +33,12 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.10rc1
\fI\fB \fI\fB
\fBint png_check_cHRM_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_fixed_point \fP\fIint_white_x\fP\fB, png_fixed_point \fP\fIint_white_y\fP\fB, png_fixed_point \fP\fIint_red_x\fP\fB, png_fixed_point \fP\fIint_red_y\fP\fB, png_fixed_point \fP\fIint_green_x\fP\fB, png_fixed_point \fP\fIint_green_y\fP\fB, png_fixed_point \fP\fIint_blue_x\fP\fB, png_fixed_point \fIint_blue_y\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_check_chunk_name (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIchunk_name\fP\fB);\fP \fBvoid png_check_chunk_name (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIchunk_name\fP\fB);\fP
\fI\fB \fI\fB
@@ -39,6 +51,12 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.10rc1
\fI\fB \fI\fB
\fBvoid png_check_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIwidth\fP\fB, png_uint_32 \fP\fIheight\fP\fB, int \fP\fIbit_depth\fP\fB, int \fP\fIcolor_type\fP\fB, int \fP\fIinterlace_type\fP\fB, int \fP\fIcompression_type\fP\fB, int \fIfilter_type\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_combine_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIrow\fP\fB, int \fImask\fP\fB);\fP \fBvoid png_combine_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIrow\fP\fB, int \fImask\fP\fB);\fP
\fI\fB \fI\fB
@@ -81,7 +99,19 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.10rc1
\fI\fB \fI\fB
\fBpng_charp png_decompress_chunk (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIcomp_type\fP\fB, png_charp \fP\fIchunkdata\fP\fB, png_size_t \fP\fIchunklength\fP\fB, png_size_t \fP\fIprefix_length\fP\fB, png_size_t \fI*data_length\fP\fB);\fP \fBint png_debug(int \fP\fIlevel\fP\fB, png_const_charp \fImessage\fP\fB);\fP
\fI\fB
\fBint png_debug1(int \fP\fIlevel\fP\fB, png_const_charp \fP\fImessage\fP\fB, \fIp1\fP\fB);\fP
\fI\fB
\fBint png_debug2(int \fP\fIlevel\fP\fB, png_const_charp \fP\fImessage\fP\fB, \fP\fIp1\fP\fB, \fIp2\fP\fB);\fP
\fI\fB
\fBvoid png_decompress_chunk (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIcomp_type\fP\fB, png_size_t \fP\fIchunklength\fP\fB, png_size_t \fP\fIprefix_length\fP\fB, png_size_t \fI*data_length\fP\fB);\fP
\fI\fB \fI\fB
@@ -99,7 +129,7 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.10rc1
\fI\fB \fI\fB
\fBvoid png_do_background (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_16p \fP\fItrans_values\fP\fB, png_color_16p \fP\fIbackground\fP\fB, png_color_16p \fP\fIbackground_1\fP\fB, png_bytep \fP\fIgamma_table\fP\fB, png_bytep \fP\fIgamma_from_1\fP\fB, png_bytep \fP\fIgamma_to_1\fP\fB, png_uint_16pp \fP\fIgamma_16\fP\fB, png_uint_16pp \fP\fIgamma_16_from_1\fP\fB, png_uint_16pp \fP\fIgamma_16_to_1\fP\fB, int \fIgamma_shift\fP\fB);\fP \fBvoid png_do_background (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_16p \fP\fItrans_color\fP\fB, png_color_16p \fP\fIbackground\fP\fB, png_color_16p \fP\fIbackground_1\fP\fB, png_bytep \fP\fIgamma_table\fP\fB, png_bytep \fP\fIgamma_from_1\fP\fB, png_bytep \fP\fIgamma_to_1\fP\fB, png_uint_16pp \fP\fIgamma_16\fP\fB, png_uint_16pp \fP\fIgamma_16_from_1\fP\fB, png_uint_16pp \fP\fIgamma_16_to_1\fP\fB, int \fIgamma_shift\fP\fB);\fP
\fI\fB \fI\fB
@@ -115,14 +145,6 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.10rc1
\fI\fB \fI\fB
\fI\fB
\fBvoid png_do_dither (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIpalette_lookup\fP\fB, png_bytep \fIdither_lookup\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_expand (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_16p \fItrans_value\fP\fB);\fP \fBvoid png_do_expand (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_16p \fItrans_value\fP\fB);\fP
\fI\fB \fI\fB
@@ -165,6 +187,12 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.10rc1
\fI\fB \fI\fB
\fBvoid png_do_quantize (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIpalette_lookup\fP\fB, png_bytep \fIquantize_lookup\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_read_filler (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fP\fIfiller\fP\fB, png_uint_32 \fIflags\fP\fB);\fP \fBvoid png_do_read_filler (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fP\fIfiller\fP\fB, png_uint_32 \fIflags\fP\fB);\fP
\fI\fB \fI\fB
@@ -181,8 +209,6 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.10rc1
\fI\fB \fI\fB
\fI\fB
\fBvoid png_do_read_swap_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP \fBvoid png_do_read_swap_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB \fI\fB
@@ -541,6 +567,8 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.10rc1
\fI\fB \fI\fB
\fBvoid png_read_destroy (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_infop \fIend_info_ptr\fP\fB);\fP
\fI\fB \fI\fB
\fBvoid png_read_filter_row (png_structp \fP\fIpng_ptr\fP\fB, png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIprev_row\fP\fB, int \fIfilter\fP\fB);\fP \fBvoid png_read_filter_row (png_structp \fP\fIpng_ptr\fP\fB, png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIprev_row\fP\fB, int \fIfilter\fP\fB);\fP
@@ -553,32 +581,26 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.10rc1
\fI\fB \fI\fB
\fI\fB
\fBvoid png_read_push_finish_row (png_structp \fIpng_ptr\fP\fB);\fP \fBvoid png_read_push_finish_row (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB \fI\fB
\fBvoid png_read_sig (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
\fI\fB \fI\fB
\fBvoid png_read_start_row (png_structp \fIpng_ptr\fP\fB);\fP \fBvoid png_read_start_row (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB \fI\fB
\fI\fB
\fBvoid png_read_transform_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP \fBvoid png_read_transform_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
\fI\fB \fI\fB
\fI\fB
\fBvoid png_reset_crc (png_structp \fIpng_ptr\fP\fB);\fP \fBvoid png_reset_crc (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB \fI\fB
\fI\fB
\fBint png_set_text_2 (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_textp \fP\fItext_ptr\fP\fB, int \fInum_text\fP\fB);\fP \fBint png_set_text_2 (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_textp \fP\fItext_ptr\fP\fB, int \fInum_text\fP\fB);\fP
\fI\fB \fI\fB
@@ -601,6 +623,8 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.10rc1
\fI\fB \fI\fB
\fBvoid png_write_destroy (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB \fI\fB
\fBvoid png_write_filtered_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIfiltered_row\fP\fB);\fP \fBvoid png_write_filtered_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIfiltered_row\fP\fB);\fP
@@ -711,12 +735,6 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.10rc1
\fI\fB \fI\fB
\fBvoid png_write_sig (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_sRGB (png_structp \fP\fIpng_ptr\fP\fB, int \fIintent\fP\fB);\fP \fBvoid png_write_sRGB (png_structp \fP\fIpng_ptr\fP\fB, int \fIintent\fP\fB);\fP
\fI\fB \fI\fB
@@ -779,6 +797,6 @@ are listed alphabetically here as an aid to libpng maintainers.
See png.h for more information on these functions. See png.h for more information on these functions.
.SH SEE ALSO .SH SEE ALSO
libpng(3), png(5) .BR "png"(5), " libpng"(3), " zlib"(3), " deflate"(5), " " and " zlib"(5)
.SH AUTHOR .SH AUTHOR
Glenn Randers-Pehrson Glenn Randers-Pehrson

8966
ltmain.sh Normal file → Executable file

File diff suppressed because it is too large Load Diff

227
missing
View File

@@ -1,6 +1,10 @@
#! /bin/sh #! /bin/sh
# Common stub for a few missing GNU programs while installing. # Common stub for a few missing GNU programs while installing.
# Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
scriptversion=2009-04-28.21; # UTC
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
# 2008, 2009 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. # Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
@@ -14,9 +18,7 @@
# GNU General Public License for more details. # GNU General Public License for more details.
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# As a special exception to the GNU General Public License, if you # As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a # distribute this file as part of a program that contains a
@@ -29,6 +31,8 @@ if test $# -eq 0; then
fi fi
run=: run=:
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
# In the cases where this matters, `missing' is being run in the # In the cases where this matters, `missing' is being run in the
# srcdir already. # srcdir already.
@@ -38,18 +42,24 @@ else
configure_ac=configure.in configure_ac=configure.in
fi fi
case "$1" in msg="missing on your system"
case $1 in
--run) --run)
# Try to run requested program, and just exit if it succeeds. # Try to run requested program, and just exit if it succeeds.
run= run=
shift shift
"$@" && exit 0 "$@" && exit 0
# Exit code 63 means version mismatch. This often happens
# when the user try to use an ancient version of a tool on
# a file that requires a minimum version. In this case we
# we should proceed has if the program had been absent, or
# if --run hadn't been passed.
if test $? = 63; then
run=:
msg="probably too old"
fi
;; ;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case "$1" in
-h|--h|--he|--hel|--help) -h|--h|--he|--hel|--help)
echo "\ echo "\
@@ -67,6 +77,7 @@ Supported PROGRAM values:
aclocal touch file \`aclocal.m4' aclocal touch file \`aclocal.m4'
autoconf touch file \`configure' autoconf touch file \`configure'
autoheader touch file \`config.h.in' autoheader touch file \`config.h.in'
autom4te touch the output file, or create a stub one
automake touch all \`Makefile.in' files automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch] bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c flex create \`lex.yy.c', if possible, from existing .c
@@ -74,11 +85,18 @@ Supported PROGRAM values:
lex create \`lex.yy.c', if possible, from existing .c lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]" yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
\`g' are ignored when checking the name.
Send bug reports to <bug-automake@gnu.org>."
exit $?
;; ;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version) -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing 0.3 - GNU automake" echo "missing $scriptversion (GNU Automake)"
exit $?
;; ;;
-*) -*)
@@ -87,27 +105,69 @@ Supported PROGRAM values:
exit 1 exit 1
;; ;;
aclocal) esac
# normalize program name to check for.
program=`echo "$1" | sed '
s/^gnu-//; t
s/^gnu//; t
s/^g//; t'`
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
# the program). This is about non-GNU programs, so use $1 not
# $program.
case $1 in
lex*|yacc*)
# Not GNU programs, they don't have --version.
;;
tar*)
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
exit 1
fi
;;
*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
# Could not run --version or --help. This is probably someone
# running `$TOOL --version' or `$TOOL --help' to check whether
# $TOOL exists and not knowing $TOOL uses missing.
exit 1
fi
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case $program in
aclocal*)
echo 1>&2 "\ echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if WARNING: \`$1' is $msg. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site." any GNU archive site."
touch aclocal.m4 touch aclocal.m4
;; ;;
autoconf) autoconf*)
echo 1>&2 "\ echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site." archive site."
touch configure touch configure
;; ;;
autoheader) autoheader*)
echo 1>&2 "\ echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site." from any GNU archive site."
@@ -115,7 +175,7 @@ WARNING: \`$1' is missing on your system. You should only need it if
test -z "$files" && files="config.h" test -z "$files" && files="config.h"
touch_files= touch_files=
for f in $files; do for f in $files; do
case "$f" in case $f in
*:*) touch_files="$touch_files "`echo "$f" | *:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;; sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";; *) touch_files="$touch_files $f.in";;
@@ -124,9 +184,9 @@ WARNING: \`$1' is missing on your system. You should only need it if
touch $touch_files touch $touch_files
;; ;;
automake) automake*)
echo 1>&2 "\ echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if WARNING: \`$1' is $msg. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages. You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site." Grab them from any GNU archive site."
@@ -135,128 +195,153 @@ WARNING: \`$1' is missing on your system. You should only need it if
while read f; do touch "$f"; done while read f; do touch "$f"; done
;; ;;
bison|yacc) autom4te*)
echo 1>&2 "\ echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
proper tools for further handling them.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison*|yacc*)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site." \`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h rm -f y.tab.c y.tab.h
if [ $# -ne 1 ]; then if test $# -ne 1; then
eval LASTARG="\${$#}" eval LASTARG="\${$#}"
case "$LASTARG" in case $LASTARG in
*.y) *.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if [ -f "$SRCFILE" ]; then if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.c cp "$SRCFILE" y.tab.c
fi fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if [ -f "$SRCFILE" ]; then if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.h cp "$SRCFILE" y.tab.h
fi fi
;; ;;
esac esac
fi fi
if [ ! -f y.tab.h ]; then if test ! -f y.tab.h; then
echo >y.tab.h echo >y.tab.h
fi fi
if [ ! -f y.tab.c ]; then if test ! -f y.tab.c; then
echo 'main() { return 0; }' >y.tab.c echo 'main() { return 0; }' >y.tab.c
fi fi
;; ;;
lex|flex) lex*|flex*)
echo 1>&2 "\ echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site." \`Flex' from any GNU archive site."
rm -f lex.yy.c rm -f lex.yy.c
if [ $# -ne 1 ]; then if test $# -ne 1; then
eval LASTARG="\${$#}" eval LASTARG="\${$#}"
case "$LASTARG" in case $LASTARG in
*.l) *.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if [ -f "$SRCFILE" ]; then if test -f "$SRCFILE"; then
cp "$SRCFILE" lex.yy.c cp "$SRCFILE" lex.yy.c
fi fi
;; ;;
esac esac
fi fi
if [ ! -f lex.yy.c ]; then if test ! -f lex.yy.c; then
echo 'main() { return 0; }' >lex.yy.c echo 'main() { return 0; }' >lex.yy.c
fi fi
;; ;;
help2man) help2man*)
echo 1>&2 "\ echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take \`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site." effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` file=`echo "$*" | sed -n "$sed_output"`
if test -z "$file"; then test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` if test -f "$file"; then
fi
if [ -f "$file" ]; then
touch $file touch $file
else else
test -z "$file" || exec >$file test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page" echo ".ab help2man is required to generate this page"
exit 1 exit $?
fi fi
;; ;;
makeinfo) makeinfo*)
if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
# We have makeinfo, but it failed.
exit 1
fi
echo 1>&2 "\ echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX, call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site." the \`GNU make' package. Grab either from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` # The file to touch is that specified with -o ...
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -z "$file"; then if test -z "$file"; then
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` # ... or it is the one specified with @setfilename ...
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '
/^@setfilename/{
s/.* \([^ ]*\) *$/\1/
p
q
}' $infile`
# ... or it is derived from the source name (dir/f.texi becomes f.info)
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
fi fi
# If the file does not exist, the user really needs makeinfo;
# let's fail without touching anything.
test -f $file || exit 1
touch $file touch $file
;; ;;
tar) tar*)
shift shift
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
fi
# We have already tried tar in the generic part. # We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error # Look for gnutar/gtar before invocation to avoid ugly error
# messages. # messages.
if (gnutar --version > /dev/null 2>&1); then if (gnutar --version > /dev/null 2>&1); then
gnutar ${1+"$@"} && exit 0 gnutar "$@" && exit 0
fi fi
if (gtar --version > /dev/null 2>&1); then if (gtar --version > /dev/null 2>&1); then
gtar ${1+"$@"} && exit 0 gtar "$@" && exit 0
fi fi
firstarg="$1" firstarg="$1"
if shift; then if shift; then
case "$firstarg" in case $firstarg in
*o*) *o*)
firstarg=`echo "$firstarg" | sed s/o//` firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" ${1+"$@"} && exit 0 tar "$firstarg" "$@" && exit 0
;; ;;
esac esac
case "$firstarg" in case $firstarg in
*h*) *h*)
firstarg=`echo "$firstarg" | sed s/h//` firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" ${1+"$@"} && exit 0 tar "$firstarg" "$@" && exit 0
;; ;;
esac esac
fi fi
@@ -270,10 +355,10 @@ WARNING: I can't seem to be able to run \`tar' with the given arguments.
*) *)
echo 1>&2 "\ echo 1>&2 "\
WARNING: \`$1' is needed, and you do not seem to have it handy on your WARNING: \`$1' is needed, and is $msg.
system. You might have modified some files without having the You might have modified some files without having the
proper tools for further handling them. Check the \`README' file, proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequirements for installing it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program." some other package would contain this missing \`$1' program."
exit 1 exit 1
@@ -281,3 +366,11 @@ WARNING: \`$1' is needed, and you do not seem to have it handy on your
esac esac
exit 0 exit 0
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

View File

@@ -1,40 +0,0 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
errstatus=0
for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d
do
pathcomp="$pathcomp$d"
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
fi
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# mkinstalldirs ends here

4
png.5
View File

@@ -1,4 +1,4 @@
.TH PNG 5 "April 19, 2006" .TH PNG 5 "November 21, 2010"
.SH NAME .SH NAME
png \- Portable Network Graphics (PNG) format png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION .SH DESCRIPTION
@@ -18,7 +18,7 @@ gamma and chromaticity data for improved color matching on heterogeneous
platforms. platforms.
.SH "SEE ALSO" .SH "SEE ALSO"
.IR libpng(3), zlib(3), deflate(5), and zlib(5) .BR "libpng"(3), " libpngpf"(3), " zlib"(3), " deflate"(5), " " and " zlib"(5)
.LP .LP
PNG specification (second edition), November 2003: PNG specification (second edition), November 2003:
.IP .IP

1029
png.c

File diff suppressed because it is too large Load Diff

2635
png.h

File diff suppressed because it is too large Load Diff

1064
pngconf.h

File diff suppressed because it is too large Load Diff

View File

@@ -1,34 +1,41 @@
/* pngerror.c - stub functions for i/o and memory allocation /* pngerror.c - stub functions for i/o and memory allocation
* *
* Last changed in libpng 1.2.9 April 14, 2006 * Last changed in libpng 1.4.0 [January 3, 2010]
* For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2010 Glenn Randers-Pehrson
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
* This file provides a location for all error handling. Users who * This file provides a location for all error handling. Users who
* need special error handling are expected to write replacement functions * need special error handling are expected to write replacement functions
* and use png_set_error_fn() to use those functions. See the instructions * and use png_set_error_fn() to use those functions. See the instructions
* at each function. * at each function.
*/ */
#define PNG_INTERNAL #define PNG_NO_PEDANTIC_WARNINGS
#include "png.h" #include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#include "pngpriv.h"
static void /* PRIVATE */ static void /* PRIVATE */
png_default_error PNGARG((png_structp png_ptr, png_default_error PNGARG((png_structp png_ptr,
png_const_charp error_message)); png_const_charp error_message)) PNG_NORETURN;
#ifdef PNG_WARNINGS_SUPPORTED
static void /* PRIVATE */ static void /* PRIVATE */
png_default_warning PNGARG((png_structp png_ptr, png_default_warning PNGARG((png_structp png_ptr,
png_const_charp warning_message)); png_const_charp warning_message));
#endif /* PNG_WARNINGS_SUPPORTED */
/* This function is called whenever there is a fatal error. This function /* This function is called whenever there is a fatal error. This function
* should not be changed. If there is a need to handle errors differently, * should not be changed. If there is a need to handle errors differently,
* you should supply a replacement error function and use png_set_error_fn() * you should supply a replacement error function and use png_set_error_fn()
* to replace the error function at run-time. * to replace the error function at run-time.
*/ */
#ifdef PNG_ERROR_TEXT_SUPPORTED
void PNGAPI void PNGAPI
png_error(png_structp png_ptr, png_const_charp error_message) png_error(png_structp png_ptr, png_const_charp error_message)
{ {
@@ -39,30 +46,31 @@ png_error(png_structp png_ptr, png_const_charp error_message)
if (png_ptr->flags& if (png_ptr->flags&
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) (PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
{ {
if (*error_message == '#') if (*error_message == PNG_LITERAL_SHARP)
{ {
/* Strip "#nnnn " from beginning of error message. */
int offset; int offset;
for (offset=1; offset<15; offset++) for (offset = 1; offset<15; offset++)
if (*(error_message+offset) == ' ') if (error_message[offset] == ' ')
break; break;
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT) if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
{ {
int i; int i;
for (i=0; i<offset-1; i++) for (i = 0; i < offset - 1; i++)
msg[i]=error_message[i+1]; msg[i] = error_message[i + 1];
msg[i]='\0'; msg[i - 1] = '\0';
error_message=msg; error_message = msg;
} }
else else
error_message+=offset; error_message += offset;
} }
else else
{ {
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT) if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
{ {
msg[0]='0'; msg[0] = '0';
msg[1]='\0'; msg[1] = '\0';
error_message=msg; error_message = msg;
} }
} }
} }
@@ -75,7 +83,20 @@ png_error(png_structp png_ptr, png_const_charp error_message)
use the default handler, which will not return. */ use the default handler, which will not return. */
png_default_error(png_ptr, error_message); png_default_error(png_ptr, error_message);
} }
#else
void PNGAPI
png_err(png_structp png_ptr)
{
if (png_ptr != NULL && png_ptr->error_fn != NULL)
(*(png_ptr->error_fn))(png_ptr, '\0');
/* If the custom handler doesn't exist, or if it returns,
use the default handler, which will not return. */
png_default_error(png_ptr, '\0');
}
#endif /* PNG_ERROR_TEXT_SUPPORTED */
#ifdef PNG_WARNINGS_SUPPORTED
/* This function is called whenever there is a non-fatal error. This function /* This function is called whenever there is a non-fatal error. This function
* should not be changed. If there is a need to handle warnings differently, * should not be changed. If there is a need to handle warnings differently,
* you should supply a replacement warning function and use * you should supply a replacement warning function and use
@@ -92,19 +113,31 @@ png_warning(png_structp png_ptr, png_const_charp warning_message)
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) (PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
#endif #endif
{ {
if (*warning_message == '#') if (*warning_message == PNG_LITERAL_SHARP)
{ {
for (offset=1; offset<15; offset++) for (offset = 1; offset < 15; offset++)
if (*(warning_message+offset) == ' ') if (warning_message[offset] == ' ')
break; break;
} }
} }
if (png_ptr != NULL && png_ptr->warning_fn != NULL)
(*(png_ptr->warning_fn))(png_ptr, warning_message+offset);
} }
if (png_ptr != NULL && png_ptr->warning_fn != NULL)
(*(png_ptr->warning_fn))(png_ptr, warning_message + offset);
else else
png_default_warning(png_ptr, warning_message+offset); png_default_warning(png_ptr, warning_message + offset);
} }
#endif /* PNG_WARNINGS_SUPPORTED */
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
void PNGAPI
png_benign_error(png_structp png_ptr, png_const_charp error_message)
{
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
png_warning(png_ptr, error_message);
else
png_error(png_ptr, error_message);
}
#endif
/* These utilities are used internally to build an error message that relates /* These utilities are used internally to build an error message that relates
* to the current chunk. The chunk name comes from png_ptr->chunk_name, * to the current chunk. The chunk name comes from png_ptr->chunk_name,
@@ -118,6 +151,8 @@ static PNG_CONST char png_digit[16] = {
'A', 'B', 'C', 'D', 'E', 'F' 'A', 'B', 'C', 'D', 'E', 'F'
}; };
#define PNG_MAX_ERROR_TEXT 64
#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED)
static void /* PRIVATE */ static void /* PRIVATE */
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
error_message) error_message)
@@ -129,10 +164,10 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
int c = png_ptr->chunk_name[iin++]; int c = png_ptr->chunk_name[iin++];
if (isnonalpha(c)) if (isnonalpha(c))
{ {
buffer[iout++] = '['; buffer[iout++] = PNG_LITERAL_LEFT_SQUARE_BRACKET;
buffer[iout++] = png_digit[(c & 0xf0) >> 4]; buffer[iout++] = png_digit[(c & 0xf0) >> 4];
buffer[iout++] = png_digit[c & 0x0f]; buffer[iout++] = png_digit[c & 0x0f];
buffer[iout++] = ']'; buffer[iout++] = PNG_LITERAL_RIGHT_SQUARE_BRACKET;
} }
else else
{ {
@@ -141,35 +176,75 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
} }
if (error_message == NULL) if (error_message == NULL)
buffer[iout] = 0; buffer[iout] = '\0';
else else
{ {
buffer[iout++] = ':'; buffer[iout++] = ':';
buffer[iout++] = ' '; buffer[iout++] = ' ';
png_strncpy(buffer+iout, error_message, 63); png_memcpy(buffer + iout, error_message, PNG_MAX_ERROR_TEXT);
buffer[iout+63] = 0; buffer[iout + PNG_MAX_ERROR_TEXT - 1] = '\0';
} }
} }
#ifdef PNG_READ_SUPPORTED
void PNGAPI void PNGAPI
png_chunk_error(png_structp png_ptr, png_const_charp error_message) png_chunk_error(png_structp png_ptr, png_const_charp error_message)
{ {
char msg[18+64]; char msg[18+PNG_MAX_ERROR_TEXT];
if (png_ptr == NULL) if (png_ptr == NULL)
png_error(png_ptr, error_message); png_error(png_ptr, error_message);
png_format_buffer(png_ptr, msg, error_message); else
png_error(png_ptr, msg); {
png_format_buffer(png_ptr, msg, error_message);
png_error(png_ptr, msg);
}
} }
#endif /* PNG_READ_SUPPORTED */
#endif /* PNG_WARNINGS_SUPPORTED || PNG_ERROR_TEXT_SUPPORTED */
#ifdef PNG_WARNINGS_SUPPORTED
void PNGAPI void PNGAPI
png_chunk_warning(png_structp png_ptr, png_const_charp warning_message) png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
{ {
char msg[18+64]; char msg[18+PNG_MAX_ERROR_TEXT];
if (png_ptr == NULL) if (png_ptr == NULL)
png_warning(png_ptr, warning_message); png_warning(png_ptr, warning_message);
png_format_buffer(png_ptr, msg, warning_message); else
png_warning(png_ptr, msg); {
png_format_buffer(png_ptr, msg, warning_message);
png_warning(png_ptr, msg);
}
} }
#endif /* PNG_WARNINGS_SUPPORTED */
#ifdef PNG_READ_SUPPORTED
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
void PNGAPI
png_chunk_benign_error(png_structp png_ptr, png_const_charp error_message)
{
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
png_chunk_warning(png_ptr, error_message);
else
png_chunk_error(png_ptr, error_message);
}
#endif
#endif /* PNG_READ_SUPPORTED */
#ifdef PNG_SETJMP_SUPPORTED
/* This API only exists if ANSI-C style error handling is used,
* otherwise it is necessary for png_default_error to be overridden.
*/
jmp_buf* PNGAPI
png_set_longjmp_fn(png_structp png_ptr, png_longjmp_ptr longjmp_fn,
size_t jmp_buf_size)
{
if (png_ptr == NULL || jmp_buf_size != png_sizeof(jmp_buf))
return NULL;
png_ptr->longjmp_fn = longjmp_fn;
return &png_ptr->jmpbuf;
}
#endif
/* This is the default error handling function. Note that replacements for /* This is the default error handling function. Note that replacements for
* this function MUST NOT RETURN, or the program will likely crash. This * this function MUST NOT RETURN, or the program will likely crash. This
@@ -179,54 +254,63 @@ png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
static void /* PRIVATE */ static void /* PRIVATE */
png_default_error(png_structp png_ptr, png_const_charp error_message) png_default_error(png_structp png_ptr, png_const_charp error_message)
{ {
#ifndef PNG_NO_CONSOLE_IO #ifdef PNG_CONSOLE_IO_SUPPORTED
#ifdef PNG_ERROR_NUMBERS_SUPPORTED #ifdef PNG_ERROR_NUMBERS_SUPPORTED
if (*error_message == '#') if (*error_message == PNG_LITERAL_SHARP)
{ {
/* Strip "#nnnn " from beginning of error message. */
int offset; int offset;
char error_number[16]; char error_number[16];
for (offset=0; offset<15; offset++) for (offset = 0; offset<15; offset++)
{ {
error_number[offset] = *(error_message+offset+1); error_number[offset] = error_message[offset + 1];
if (*(error_message+offset) == ' ') if (error_message[offset] == ' ')
break; break;
} }
if((offset > 1) && (offset < 15)) if ((offset > 1) && (offset < 15))
{ {
error_number[offset-1]='\0'; error_number[offset - 1] = '\0';
fprintf(stderr, "libpng error no. %s: %s\n", error_number, fprintf(stderr, "libpng error no. %s: %s",
error_message+offset); error_number, error_message + offset + 1);
fprintf(stderr, PNG_STRING_NEWLINE);
} }
else else
fprintf(stderr, "libpng error: %s, offset=%d\n", error_message,offset); {
fprintf(stderr, "libpng error: %s, offset=%d",
error_message, offset);
fprintf(stderr, PNG_STRING_NEWLINE);
}
} }
else else
#endif #endif
fprintf(stderr, "libpng error: %s\n", error_message); {
fprintf(stderr, "libpng error: %s", error_message);
fprintf(stderr, PNG_STRING_NEWLINE);
}
#endif #endif
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
if (png_ptr && png_ptr->longjmp_fn)
{
# ifdef USE_FAR_KEYWORD # ifdef USE_FAR_KEYWORD
{ {
jmp_buf jmpbuf; jmp_buf jmpbuf;
png_memcpy(jmpbuf,png_ptr->jmpbuf,png_sizeof(jmp_buf)); png_memcpy(jmpbuf, png_ptr->jmpbuf, png_sizeof(jmp_buf));
longjmp(jmpbuf, 1); png_ptr->longjmp_fn(jmpbuf, 1);
} }
# else # else
longjmp(png_ptr->jmpbuf, 1); png_ptr->longjmp_fn(png_ptr->jmpbuf, 1);
# endif # endif
#else }
/* make compiler happy */ ;
if (png_ptr)
PNG_ABORT();
#endif #endif
#ifdef PNG_NO_CONSOLE_IO /* Here if not setjmp support or if png_ptr is null. */
/* make compiler happy */ ; PNG_ABORT();
if (&error_message != NULL) #ifndef PNG_CONSOLE_IO_SUPPORTED
return; error_message = error_message; /* Make compiler happy */
#endif #endif
} }
#ifdef PNG_WARNINGS_SUPPORTED
/* This function is called when there is a warning, but the library thinks /* This function is called when there is a warning, but the library thinks
* it can continue anyway. Replacement functions don't have to do anything * it can continue anyway. Replacement functions don't have to do anything
* here if you don't want them to. In the default configuration, png_ptr is * here if you don't want them to. In the default configuration, png_ptr is
@@ -235,39 +319,44 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
static void /* PRIVATE */ static void /* PRIVATE */
png_default_warning(png_structp png_ptr, png_const_charp warning_message) png_default_warning(png_structp png_ptr, png_const_charp warning_message)
{ {
#ifndef PNG_NO_CONSOLE_IO #ifdef PNG_CONSOLE_IO_SUPPORTED
# ifdef PNG_ERROR_NUMBERS_SUPPORTED # ifdef PNG_ERROR_NUMBERS_SUPPORTED
if (*warning_message == '#') if (*warning_message == PNG_LITERAL_SHARP)
{ {
int offset; int offset;
char warning_number[16]; char warning_number[16];
for (offset=0; offset<15; offset++) for (offset = 0; offset < 15; offset++)
{ {
warning_number[offset]=*(warning_message+offset+1); warning_number[offset] = warning_message[offset + 1];
if (*(warning_message+offset) == ' ') if (warning_message[offset] == ' ')
break; break;
} }
if((offset > 1) && (offset < 15)) if ((offset > 1) && (offset < 15))
{ {
warning_number[offset-1]='\0'; warning_number[offset + 1] = '\0';
fprintf(stderr, "libpng warning no. %s: %s\n", warning_number, fprintf(stderr, "libpng warning no. %s: %s",
warning_message+offset); warning_number, warning_message + offset);
fprintf(stderr, PNG_STRING_NEWLINE);
} }
else else
fprintf(stderr, "libpng warning: %s\n", warning_message); {
fprintf(stderr, "libpng warning: %s",
warning_message);
fprintf(stderr, PNG_STRING_NEWLINE);
}
} }
else else
# endif # endif
fprintf(stderr, "libpng warning: %s\n", warning_message); {
fprintf(stderr, "libpng warning: %s", warning_message);
fprintf(stderr, PNG_STRING_NEWLINE);
}
#else #else
/* make compiler happy */ ; warning_message = warning_message; /* Make compiler happy */
if (warning_message)
return;
#endif #endif
/* make compiler happy */ ; png_ptr = png_ptr; /* Make compiler happy */
if (png_ptr)
return;
} }
#endif /* PNG_WARNINGS_SUPPORTED */
/* This function is called when the application wants to use another method /* This function is called when the application wants to use another method
* of handling errors and warnings. Note that the error function MUST NOT * of handling errors and warnings. Note that the error function MUST NOT
@@ -303,7 +392,7 @@ png_get_error_ptr(png_structp png_ptr)
void PNGAPI void PNGAPI
png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode) png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode)
{ {
if(png_ptr != NULL) if (png_ptr != NULL)
{ {
png_ptr->flags &= png_ptr->flags &=
((~(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))&strip_mode); ((~(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))&strip_mode);

5420
pnggccrd.c

File diff suppressed because it is too large Load Diff

470
pngget.c
View File

@@ -1,56 +1,62 @@
/* pngget.c - retrieval of values from info struct /* pngget.c - retrieval of values from info struct
* *
* Last changed in libpng 1.2.9 April 14, 2006 * Last changed in libpng 1.4.2 [May 6, 2010]
* For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2010 Glenn Randers-Pehrson
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
*/ */
#define PNG_INTERNAL #define PNG_NO_PEDANTIC_WARNINGS
#include "png.h" #include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#include "pngpriv.h"
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_valid(png_structp png_ptr, png_infop info_ptr, png_uint_32 flag) png_get_valid(png_structp png_ptr, png_infop info_ptr, png_uint_32 flag)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
return(info_ptr->valid & flag); return(info_ptr->valid & flag);
else else
return(0); return(0);
} }
png_uint_32 PNGAPI png_size_t PNGAPI
png_get_rowbytes(png_structp png_ptr, png_infop info_ptr) png_get_rowbytes(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
return(info_ptr->rowbytes); return(info_ptr->rowbytes);
else else
return(0); return(0);
} }
#if defined(PNG_INFO_IMAGE_SUPPORTED) #ifdef PNG_INFO_IMAGE_SUPPORTED
png_bytepp PNGAPI png_bytepp PNGAPI
png_get_rows(png_structp png_ptr, png_infop info_ptr) png_get_rows(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
return(info_ptr->row_pointers); return(info_ptr->row_pointers);
else else
return(0); return(0);
} }
#endif #endif
#ifdef PNG_EASY_ACCESS_SUPPORTED #ifdef PNG_EASY_ACCESS_SUPPORTED
/* easy access to info, added in libpng-0.99 */ /* Easy access to info, added in libpng-0.99 */
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_image_width(png_structp png_ptr, png_infop info_ptr) png_get_image_width(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
{
return info_ptr->width; return info_ptr->width;
}
return (0); return (0);
} }
@@ -58,9 +64,8 @@ png_uint_32 PNGAPI
png_get_image_height(png_structp png_ptr, png_infop info_ptr) png_get_image_height(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
{
return info_ptr->height; return info_ptr->height;
}
return (0); return (0);
} }
@@ -68,9 +73,8 @@ png_byte PNGAPI
png_get_bit_depth(png_structp png_ptr, png_infop info_ptr) png_get_bit_depth(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
{
return info_ptr->bit_depth; return info_ptr->bit_depth;
}
return (0); return (0);
} }
@@ -78,9 +82,8 @@ png_byte PNGAPI
png_get_color_type(png_structp png_ptr, png_infop info_ptr) png_get_color_type(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
{
return info_ptr->color_type; return info_ptr->color_type;
}
return (0); return (0);
} }
@@ -88,9 +91,8 @@ png_byte PNGAPI
png_get_filter_type(png_structp png_ptr, png_infop info_ptr) png_get_filter_type(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
{
return info_ptr->filter_type; return info_ptr->filter_type;
}
return (0); return (0);
} }
@@ -98,9 +100,8 @@ png_byte PNGAPI
png_get_interlace_type(png_structp png_ptr, png_infop info_ptr) png_get_interlace_type(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
{
return info_ptr->interlace_type; return info_ptr->interlace_type;
}
return (0); return (0);
} }
@@ -108,9 +109,8 @@ png_byte PNGAPI
png_get_compression_type(png_structp png_ptr, png_infop info_ptr) png_get_compression_type(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
{
return info_ptr->compression_type; return info_ptr->compression_type;
}
return (0); return (0);
} }
@@ -118,13 +118,16 @@ png_uint_32 PNGAPI
png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr) png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_pHYs_SUPPORTED) #ifdef PNG_pHYs_SUPPORTED
if (info_ptr->valid & PNG_INFO_pHYs) if (info_ptr->valid & PNG_INFO_pHYs)
{ {
png_debug1(1, "in %s retrieval function\n", "png_get_x_pixels_per_meter"); png_debug1(1, "in %s retrieval function", "png_get_x_pixels_per_meter");
if(info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
return (0); return (0);
else return (info_ptr->x_pixels_per_unit);
else
return (info_ptr->x_pixels_per_unit);
} }
#else #else
return (0); return (0);
@@ -136,13 +139,16 @@ png_uint_32 PNGAPI
png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr) png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_pHYs_SUPPORTED) #ifdef PNG_pHYs_SUPPORTED
if (info_ptr->valid & PNG_INFO_pHYs) if (info_ptr->valid & PNG_INFO_pHYs)
{ {
png_debug1(1, "in %s retrieval function\n", "png_get_y_pixels_per_meter"); png_debug1(1, "in %s retrieval function", "png_get_y_pixels_per_meter");
if(info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
return (0); return (0);
else return (info_ptr->y_pixels_per_unit);
else
return (info_ptr->y_pixels_per_unit);
} }
#else #else
return (0); return (0);
@@ -154,14 +160,17 @@ png_uint_32 PNGAPI
png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr) png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_pHYs_SUPPORTED) #ifdef PNG_pHYs_SUPPORTED
if (info_ptr->valid & PNG_INFO_pHYs) if (info_ptr->valid & PNG_INFO_pHYs)
{ {
png_debug1(1, "in %s retrieval function\n", "png_get_pixels_per_meter"); png_debug1(1, "in %s retrieval function", "png_get_pixels_per_meter");
if(info_ptr->phys_unit_type != PNG_RESOLUTION_METER ||
if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER ||
info_ptr->x_pixels_per_unit != info_ptr->y_pixels_per_unit) info_ptr->x_pixels_per_unit != info_ptr->y_pixels_per_unit)
return (0); return (0);
else return (info_ptr->x_pixels_per_unit);
else
return (info_ptr->x_pixels_per_unit);
} }
#else #else
return (0); return (0);
@@ -174,18 +183,21 @@ float PNGAPI
png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr) png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_pHYs_SUPPORTED) #ifdef PNG_pHYs_SUPPORTED
if (info_ptr->valid & PNG_INFO_pHYs) if (info_ptr->valid & PNG_INFO_pHYs)
{ {
png_debug1(1, "in %s retrieval function\n", "png_get_aspect_ratio"); png_debug1(1, "in %s retrieval function", "png_get_aspect_ratio");
if (info_ptr->x_pixels_per_unit == 0) if (info_ptr->x_pixels_per_unit == 0)
return ((float)0.0); return ((float)0.0);
else else
return ((float)((float)info_ptr->y_pixels_per_unit return ((float)((float)info_ptr->y_pixels_per_unit
/(float)info_ptr->x_pixels_per_unit)); /(float)info_ptr->x_pixels_per_unit));
} }
#else #else
return (0.0); return (0.0);
#endif #endif
return ((float)0.0); return ((float)0.0);
} }
@@ -195,16 +207,20 @@ png_int_32 PNGAPI
png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr) png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_oFFs_SUPPORTED) #ifdef PNG_oFFs_SUPPORTED
if (info_ptr->valid & PNG_INFO_oFFs) if (info_ptr->valid & PNG_INFO_oFFs)
{ {
png_debug1(1, "in %s retrieval function\n", "png_get_x_offset_microns"); png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns");
if(info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
return (0); return (0);
else return (info_ptr->x_offset);
else
return (info_ptr->x_offset);
} }
#else #else
return (0); return (0);
#endif #endif
return (0); return (0);
} }
@@ -213,13 +229,17 @@ png_int_32 PNGAPI
png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr) png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_oFFs_SUPPORTED)
#ifdef PNG_oFFs_SUPPORTED
if (info_ptr->valid & PNG_INFO_oFFs) if (info_ptr->valid & PNG_INFO_oFFs)
{ {
png_debug1(1, "in %s retrieval function\n", "png_get_y_offset_microns"); png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
if(info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
return (0); return (0);
else return (info_ptr->y_offset);
else
return (info_ptr->y_offset);
} }
#else #else
return (0); return (0);
@@ -231,13 +251,17 @@ png_int_32 PNGAPI
png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr) png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_oFFs_SUPPORTED)
#ifdef PNG_oFFs_SUPPORTED
if (info_ptr->valid & PNG_INFO_oFFs) if (info_ptr->valid & PNG_INFO_oFFs)
{ {
png_debug1(1, "in %s retrieval function\n", "png_get_x_offset_microns"); png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns");
if(info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
return (0); return (0);
else return (info_ptr->x_offset);
else
return (info_ptr->x_offset);
} }
#else #else
return (0); return (0);
@@ -249,13 +273,17 @@ png_int_32 PNGAPI
png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr) png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_oFFs_SUPPORTED)
#ifdef PNG_oFFs_SUPPORTED
if (info_ptr->valid & PNG_INFO_oFFs) if (info_ptr->valid & PNG_INFO_oFFs)
{ {
png_debug1(1, "in %s retrieval function\n", "png_get_y_offset_microns"); png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
if(info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
return (0); return (0);
else return (info_ptr->y_offset);
else
return (info_ptr->y_offset);
} }
#else #else
return (0); return (0);
@@ -299,7 +327,7 @@ png_get_y_offset_inches(png_structp png_ptr, png_infop info_ptr)
*.00003937); *.00003937);
} }
#if defined(PNG_pHYs_SUPPORTED) #ifdef PNG_pHYs_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr, png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr,
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type) png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
@@ -308,7 +336,8 @@ png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr,
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
{ {
png_debug1(1, "in %s retrieval function\n", "pHYs"); png_debug1(1, "in %s retrieval function", "pHYs");
if (res_x != NULL) if (res_x != NULL)
{ {
*res_x = info_ptr->x_pixels_per_unit; *res_x = info_ptr->x_pixels_per_unit;
@@ -323,7 +352,7 @@ png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr,
{ {
*unit_type = (int)info_ptr->phys_unit_type; *unit_type = (int)info_ptr->phys_unit_type;
retval |= PNG_INFO_pHYs; retval |= PNG_INFO_pHYs;
if(*unit_type == 1) if (*unit_type == 1)
{ {
if (res_x != NULL) *res_x = (png_uint_32)(*res_x * .0254 + .50); if (res_x != NULL) *res_x = (png_uint_32)(*res_x * .0254 + .50);
if (res_y != NULL) *res_y = (png_uint_32)(*res_y * .0254 + .50); if (res_y != NULL) *res_y = (png_uint_32)(*res_y * .0254 + .50);
@@ -357,7 +386,7 @@ png_get_signature(png_structp png_ptr, png_infop info_ptr)
return (NULL); return (NULL);
} }
#if defined(PNG_bKGD_SUPPORTED) #ifdef PNG_bKGD_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_bKGD(png_structp png_ptr, png_infop info_ptr, png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
png_color_16p *background) png_color_16p *background)
@@ -365,7 +394,8 @@ png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD)
&& background != NULL) && background != NULL)
{ {
png_debug1(1, "in %s retrieval function\n", "bKGD"); png_debug1(1, "in %s retrieval function", "bKGD");
*background = &(info_ptr->background); *background = &(info_ptr->background);
return (PNG_INFO_bKGD); return (PNG_INFO_bKGD);
} }
@@ -373,7 +403,7 @@ png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
} }
#endif #endif
#if defined(PNG_cHRM_SUPPORTED) #ifdef PNG_cHRM_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_cHRM(png_structp png_ptr, png_infop info_ptr, png_get_cHRM(png_structp png_ptr, png_infop info_ptr,
@@ -382,7 +412,8 @@ png_get_cHRM(png_structp png_ptr, png_infop info_ptr,
{ {
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM)) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
{ {
png_debug1(1, "in %s retrieval function\n", "cHRM"); png_debug1(1, "in %s retrieval function", "cHRM");
if (white_x != NULL) if (white_x != NULL)
*white_x = (double)info_ptr->x_white; *white_x = (double)info_ptr->x_white;
if (white_y != NULL) if (white_y != NULL)
@@ -411,9 +442,10 @@ png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y, png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y,
png_fixed_point *blue_x, png_fixed_point *blue_y) png_fixed_point *blue_x, png_fixed_point *blue_y)
{ {
png_debug1(1, "in %s retrieval function", "cHRM");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM)) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
{ {
png_debug1(1, "in %s retrieval function\n", "cHRM");
if (white_x != NULL) if (white_x != NULL)
*white_x = info_ptr->int_x_white; *white_x = info_ptr->int_x_white;
if (white_y != NULL) if (white_y != NULL)
@@ -437,15 +469,16 @@ png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
#endif #endif
#endif #endif
#if defined(PNG_gAMA_SUPPORTED) #ifdef PNG_gAMA_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma) png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma)
{ {
png_debug1(1, "in %s retrieval function", "gAMA");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
&& file_gamma != NULL) && file_gamma != NULL)
{ {
png_debug1(1, "in %s retrieval function\n", "gAMA");
*file_gamma = (double)info_ptr->gamma; *file_gamma = (double)info_ptr->gamma;
return (PNG_INFO_gAMA); return (PNG_INFO_gAMA);
} }
@@ -457,10 +490,11 @@ png_uint_32 PNGAPI
png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr,
png_fixed_point *int_file_gamma) png_fixed_point *int_file_gamma)
{ {
png_debug1(1, "in %s retrieval function", "gAMA");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
&& int_file_gamma != NULL) && int_file_gamma != NULL)
{ {
png_debug1(1, "in %s retrieval function\n", "gAMA");
*int_file_gamma = info_ptr->int_gamma; *int_file_gamma = info_ptr->int_gamma;
return (PNG_INFO_gAMA); return (PNG_INFO_gAMA);
} }
@@ -469,14 +503,15 @@ png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr,
#endif #endif
#endif #endif
#if defined(PNG_sRGB_SUPPORTED) #ifdef PNG_sRGB_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent) png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
{ {
png_debug1(1, "in %s retrieval function", "sRGB");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB)
&& file_srgb_intent != NULL) && file_srgb_intent != NULL)
{ {
png_debug1(1, "in %s retrieval function\n", "sRGB");
*file_srgb_intent = (int)info_ptr->srgb_intent; *file_srgb_intent = (int)info_ptr->srgb_intent;
return (PNG_INFO_sRGB); return (PNG_INFO_sRGB);
} }
@@ -484,20 +519,22 @@ png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
} }
#endif #endif
#if defined(PNG_iCCP_SUPPORTED) #ifdef PNG_iCCP_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_iCCP(png_structp png_ptr, png_infop info_ptr, png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
png_charpp name, int *compression_type, png_charpp name, int *compression_type,
png_charpp profile, png_uint_32 *proflen) png_charpp profile, png_uint_32 *proflen)
{ {
png_debug1(1, "in %s retrieval function", "iCCP");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP)
&& name != NULL && profile != NULL && proflen != NULL) && name != NULL && profile != NULL && proflen != NULL)
{ {
png_debug1(1, "in %s retrieval function\n", "iCCP");
*name = info_ptr->iccp_name; *name = info_ptr->iccp_name;
*profile = info_ptr->iccp_profile; *profile = info_ptr->iccp_profile;
/* compression_type is a dummy so the API won't have to change /* Compression_type is a dummy so the API won't have to change
if we introduce multiple compression types later. */ * if we introduce multiple compression types later.
*/
*proflen = (int)info_ptr->iccp_proflen; *proflen = (int)info_ptr->iccp_proflen;
*compression_type = (int)info_ptr->iccp_compression; *compression_type = (int)info_ptr->iccp_compression;
return (PNG_INFO_iCCP); return (PNG_INFO_iCCP);
@@ -506,25 +543,29 @@ png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
} }
#endif #endif
#if defined(PNG_sPLT_SUPPORTED) #ifdef PNG_sPLT_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_sPLT(png_structp png_ptr, png_infop info_ptr, png_get_sPLT(png_structp png_ptr, png_infop info_ptr,
png_sPLT_tpp spalettes) png_sPLT_tpp spalettes)
{ {
if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL) if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL)
{
*spalettes = info_ptr->splt_palettes; *spalettes = info_ptr->splt_palettes;
return ((png_uint_32)info_ptr->splt_palettes_num); return ((png_uint_32)info_ptr->splt_palettes_num);
}
return (0);
} }
#endif #endif
#if defined(PNG_hIST_SUPPORTED) #ifdef PNG_hIST_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist) png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist)
{ {
png_debug1(1, "in %s retrieval function", "hIST");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST)
&& hist != NULL) && hist != NULL)
{ {
png_debug1(1, "in %s retrieval function\n", "hIST");
*hist = info_ptr->hist; *hist = info_ptr->hist;
return (PNG_INFO_hIST); return (PNG_INFO_hIST);
} }
@@ -539,54 +580,48 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
int *filter_type) int *filter_type)
{ {
if (png_ptr != NULL && info_ptr != NULL && width != NULL && height != NULL && png_debug1(1, "in %s retrieval function", "IHDR");
bit_depth != NULL && color_type != NULL)
{
png_debug1(1, "in %s retrieval function\n", "IHDR");
*width = info_ptr->width;
*height = info_ptr->height;
*bit_depth = info_ptr->bit_depth;
if (info_ptr->bit_depth < 1 || info_ptr->bit_depth > 16)
png_error(png_ptr, "Invalid bit depth");
*color_type = info_ptr->color_type;
if (info_ptr->color_type > 6)
png_error(png_ptr, "Invalid color type");
if (compression_type != NULL)
*compression_type = info_ptr->compression_type;
if (filter_type != NULL)
*filter_type = info_ptr->filter_type;
if (interlace_type != NULL)
*interlace_type = info_ptr->interlace_type;
/* check for potential overflow of rowbytes */ if (png_ptr == NULL || info_ptr == NULL || width == NULL ||
if (*width == 0 || *width > PNG_UINT_31_MAX) height == NULL || bit_depth == NULL || color_type == NULL)
png_error(png_ptr, "Invalid image width"); return (0);
if (*height == 0 || *height > PNG_UINT_31_MAX)
png_error(png_ptr, "Invalid image height"); *width = info_ptr->width;
if (info_ptr->width > (PNG_UINT_32_MAX *height = info_ptr->height;
>> 3) /* 8-byte RGBA pixels */ *bit_depth = info_ptr->bit_depth;
- 64 /* bigrowbuf hack */ *color_type = info_ptr->color_type;
- 1 /* filter byte */
- 7*8 /* rounding of width to multiple of 8 pixels */ if (compression_type != NULL)
- 8) /* extra max_pixel_depth pad */ *compression_type = info_ptr->compression_type;
{
png_warning(png_ptr, if (filter_type != NULL)
"Width too large for libpng to process image data."); *filter_type = info_ptr->filter_type;
}
return (1); if (interlace_type != NULL)
} *interlace_type = info_ptr->interlace_type;
return (0);
/* This is redundant if we can be sure that the info_ptr values were all
* assigned in png_set_IHDR(). We do the check anyhow in case an
* application has ignored our advice not to mess with the members
* of info_ptr directly.
*/
png_check_IHDR (png_ptr, info_ptr->width, info_ptr->height,
info_ptr->bit_depth, info_ptr->color_type, info_ptr->interlace_type,
info_ptr->compression_type, info_ptr->filter_type);
return (1);
} }
#if defined(PNG_oFFs_SUPPORTED) #ifdef PNG_oFFs_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_oFFs(png_structp png_ptr, png_infop info_ptr, png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type) png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)
{ {
png_debug1(1, "in %s retrieval function", "oFFs");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)
&& offset_x != NULL && offset_y != NULL && unit_type != NULL) && offset_x != NULL && offset_y != NULL && unit_type != NULL)
{ {
png_debug1(1, "in %s retrieval function\n", "oFFs");
*offset_x = info_ptr->x_offset; *offset_x = info_ptr->x_offset;
*offset_y = info_ptr->y_offset; *offset_y = info_ptr->y_offset;
*unit_type = (int)info_ptr->offset_unit_type; *unit_type = (int)info_ptr->offset_unit_type;
@@ -596,17 +631,18 @@ png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
} }
#endif #endif
#if defined(PNG_pCAL_SUPPORTED) #ifdef PNG_pCAL_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_pCAL(png_structp png_ptr, png_infop info_ptr, png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams, png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams,
png_charp *units, png_charpp *params) png_charp *units, png_charpp *params)
{ {
png_debug1(1, "in %s retrieval function", "pCAL");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pCAL) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pCAL)
&& purpose != NULL && X0 != NULL && X1 != NULL && type != NULL && && purpose != NULL && X0 != NULL && X1 != NULL && type != NULL &&
nparams != NULL && units != NULL && params != NULL) nparams != NULL && units != NULL && params != NULL)
{ {
png_debug1(1, "in %s retrieval function\n", "pCAL");
*purpose = info_ptr->pcal_purpose; *purpose = info_ptr->pcal_purpose;
*X0 = info_ptr->pcal_X0; *X0 = info_ptr->pcal_X0;
*X1 = info_ptr->pcal_X1; *X1 = info_ptr->pcal_X1;
@@ -620,14 +656,14 @@ png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
} }
#endif #endif
#if defined(PNG_sCAL_SUPPORTED) #ifdef PNG_sCAL_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_sCAL(png_structp png_ptr, png_infop info_ptr, png_get_sCAL(png_structp png_ptr, png_infop info_ptr,
int *unit, double *width, double *height) int *unit, double *width, double *height)
{ {
if (png_ptr != NULL && info_ptr != NULL && if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_sCAL)) (info_ptr->valid & PNG_INFO_sCAL))
{ {
*unit = info_ptr->scal_unit; *unit = info_ptr->scal_unit;
*width = info_ptr->scal_pixel_width; *width = info_ptr->scal_pixel_width;
@@ -643,7 +679,7 @@ png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr,
int *unit, png_charpp width, png_charpp height) int *unit, png_charpp width, png_charpp height)
{ {
if (png_ptr != NULL && info_ptr != NULL && if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_sCAL)) (info_ptr->valid & PNG_INFO_sCAL))
{ {
*unit = info_ptr->scal_unit; *unit = info_ptr->scal_unit;
*width = info_ptr->scal_s_width; *width = info_ptr->scal_s_width;
@@ -656,27 +692,30 @@ png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr,
#endif #endif
#endif #endif
#if defined(PNG_pHYs_SUPPORTED) #ifdef PNG_pHYs_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_pHYs(png_structp png_ptr, png_infop info_ptr, png_get_pHYs(png_structp png_ptr, png_infop info_ptr,
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type) png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
{ {
png_uint_32 retval = 0; png_uint_32 retval = 0;
png_debug1(1, "in %s retrieval function", "pHYs");
if (png_ptr != NULL && info_ptr != NULL && if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_pHYs)) (info_ptr->valid & PNG_INFO_pHYs))
{ {
png_debug1(1, "in %s retrieval function\n", "pHYs");
if (res_x != NULL) if (res_x != NULL)
{ {
*res_x = info_ptr->x_pixels_per_unit; *res_x = info_ptr->x_pixels_per_unit;
retval |= PNG_INFO_pHYs; retval |= PNG_INFO_pHYs;
} }
if (res_y != NULL) if (res_y != NULL)
{ {
*res_y = info_ptr->y_pixels_per_unit; *res_y = info_ptr->y_pixels_per_unit;
retval |= PNG_INFO_pHYs; retval |= PNG_INFO_pHYs;
} }
if (unit_type != NULL) if (unit_type != NULL)
{ {
*unit_type = (int)info_ptr->phys_unit_type; *unit_type = (int)info_ptr->phys_unit_type;
@@ -691,26 +730,28 @@ png_uint_32 PNGAPI
png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette, png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette,
int *num_palette) int *num_palette)
{ {
png_debug1(1, "in %s retrieval function", "PLTE");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_PLTE) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_PLTE)
&& palette != NULL) && palette != NULL)
{ {
png_debug1(1, "in %s retrieval function\n", "PLTE");
*palette = info_ptr->palette; *palette = info_ptr->palette;
*num_palette = info_ptr->num_palette; *num_palette = info_ptr->num_palette;
png_debug1(3, "num_palette = %d\n", *num_palette); png_debug1(3, "num_palette = %d", *num_palette);
return (PNG_INFO_PLTE); return (PNG_INFO_PLTE);
} }
return (0); return (0);
} }
#if defined(PNG_sBIT_SUPPORTED) #ifdef PNG_sBIT_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit) png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
{ {
png_debug1(1, "in %s retrieval function", "sBIT");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT)
&& sig_bit != NULL) && sig_bit != NULL)
{ {
png_debug1(1, "in %s retrieval function\n", "sBIT");
*sig_bit = &(info_ptr->sig_bit); *sig_bit = &(info_ptr->sig_bit);
return (PNG_INFO_sBIT); return (PNG_INFO_sBIT);
} }
@@ -718,20 +759,23 @@ png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
} }
#endif #endif
#if defined(PNG_TEXT_SUPPORTED) #ifdef PNG_TEXT_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr, png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
int *num_text) int *num_text)
{ {
if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0) if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0)
{ {
png_debug1(1, "in %s retrieval function\n", png_debug1(1, "in %s retrieval function",
(png_ptr->chunk_name[0] == '\0' ? "text" (png_ptr->chunk_name[0] == '\0' ? "text"
: (png_const_charp)png_ptr->chunk_name)); : (png_const_charp)png_ptr->chunk_name));
if (text_ptr != NULL) if (text_ptr != NULL)
*text_ptr = info_ptr->text; *text_ptr = info_ptr->text;
if (num_text != NULL) if (num_text != NULL)
*num_text = info_ptr->num_text; *num_text = info_ptr->num_text;
return ((png_uint_32)info_ptr->num_text); return ((png_uint_32)info_ptr->num_text);
} }
if (num_text != NULL) if (num_text != NULL)
@@ -740,14 +784,15 @@ png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
} }
#endif #endif
#if defined(PNG_tIME_SUPPORTED) #ifdef PNG_tIME_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time) png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
{ {
png_debug1(1, "in %s retrieval function", "tIME");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME)
&& mod_time != NULL) && mod_time != NULL)
{ {
png_debug1(1, "in %s retrieval function\n", "tIME");
*mod_time = &(info_ptr->mod_time); *mod_time = &(info_ptr->mod_time);
return (PNG_INFO_tIME); return (PNG_INFO_tIME);
} }
@@ -755,36 +800,39 @@ png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
} }
#endif #endif
#if defined(PNG_tRNS_SUPPORTED) #ifdef PNG_tRNS_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_tRNS(png_structp png_ptr, png_infop info_ptr, png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
png_bytep *trans, int *num_trans, png_color_16p *trans_values) png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color)
{ {
png_uint_32 retval = 0; png_uint_32 retval = 0;
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS)) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS))
{ {
png_debug1(1, "in %s retrieval function\n", "tRNS"); png_debug1(1, "in %s retrieval function", "tRNS");
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
{ {
if (trans != NULL) if (trans_alpha != NULL)
{ {
*trans = info_ptr->trans; *trans_alpha = info_ptr->trans_alpha;
retval |= PNG_INFO_tRNS; retval |= PNG_INFO_tRNS;
} }
if (trans_values != NULL)
*trans_values = &(info_ptr->trans_values); if (trans_color != NULL)
*trans_color = &(info_ptr->trans_color);
} }
else /* if (info_ptr->color_type != PNG_COLOR_TYPE_PALETTE) */ else /* if (info_ptr->color_type != PNG_COLOR_TYPE_PALETTE) */
{ {
if (trans_values != NULL) if (trans_color != NULL)
{ {
*trans_values = &(info_ptr->trans_values); *trans_color = &(info_ptr->trans_color);
retval |= PNG_INFO_tRNS; retval |= PNG_INFO_tRNS;
} }
if(trans != NULL)
*trans = NULL; if (trans_alpha != NULL)
*trans_alpha = NULL;
} }
if(num_trans != NULL) if (num_trans != NULL)
{ {
*num_trans = info_ptr->num_trans; *num_trans = info_ptr->num_trans;
retval |= PNG_INFO_tRNS; retval |= PNG_INFO_tRNS;
@@ -794,18 +842,21 @@ png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
} }
#endif #endif
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr, png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr,
png_unknown_chunkpp unknowns) png_unknown_chunkpp unknowns)
{ {
if (png_ptr != NULL && info_ptr != NULL && unknowns != NULL) if (png_ptr != NULL && info_ptr != NULL && unknowns != NULL)
{
*unknowns = info_ptr->unknown_chunks; *unknowns = info_ptr->unknown_chunks;
return ((png_uint_32)info_ptr->unknown_chunks_num); return ((png_uint_32)info_ptr->unknown_chunks_num);
}
return (0);
} }
#endif #endif
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
png_byte PNGAPI png_byte PNGAPI
png_get_rgb_to_gray_status (png_structp png_ptr) png_get_rgb_to_gray_status (png_structp png_ptr)
{ {
@@ -813,7 +864,7 @@ png_get_rgb_to_gray_status (png_structp png_ptr)
} }
#endif #endif
#if defined(PNG_USER_CHUNKS_SUPPORTED) #ifdef PNG_USER_CHUNKS_SUPPORTED
png_voidp PNGAPI png_voidp PNGAPI
png_get_user_chunk_ptr(png_structp png_ptr) png_get_user_chunk_ptr(png_structp png_ptr)
{ {
@@ -821,107 +872,16 @@ png_get_user_chunk_ptr(png_structp png_ptr)
} }
#endif #endif
#ifdef PNG_WRITE_SUPPORTED png_size_t PNGAPI
png_uint_32 PNGAPI
png_get_compression_buffer_size(png_structp png_ptr) png_get_compression_buffer_size(png_structp png_ptr)
{ {
return (png_uint_32)(png_ptr? png_ptr->zbuf_size : 0L); return (png_ptr ? png_ptr->zbuf_size : 0L);
}
#endif
#ifndef PNG_1_0_X
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
/* this function was added to libpng 1.2.0 and should exist by default */
png_uint_32 PNGAPI
png_get_asm_flags (png_structp png_ptr)
{
return (png_uint_32)(png_ptr? png_ptr->asm_flags : 0L);
} }
/* this function was added to libpng 1.2.0 and should exist by default */
png_uint_32 PNGAPI
png_get_asm_flagmask (int flag_select)
{
png_uint_32 settable_asm_flags = 0;
if (flag_select & PNG_SELECT_READ)
settable_asm_flags |=
PNG_ASM_FLAG_MMX_READ_COMBINE_ROW |
PNG_ASM_FLAG_MMX_READ_INTERLACE |
PNG_ASM_FLAG_MMX_READ_FILTER_SUB |
PNG_ASM_FLAG_MMX_READ_FILTER_UP |
PNG_ASM_FLAG_MMX_READ_FILTER_AVG |
PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ;
/* no non-MMX flags yet */
#if 0
/* GRR: no write-flags yet, either, but someday... */
if (flag_select & PNG_SELECT_WRITE)
settable_asm_flags |=
PNG_ASM_FLAG_MMX_WRITE_ [whatever] ;
#endif /* 0 */
return settable_asm_flags; /* _theoretically_ settable capabilities only */
}
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
/* GRR: could add this: && defined(PNG_MMX_CODE_SUPPORTED) */
/* this function was added to libpng 1.2.0 */
png_uint_32 PNGAPI
png_get_mmx_flagmask (int flag_select, int *compilerID)
{
png_uint_32 settable_mmx_flags = 0;
if (flag_select & PNG_SELECT_READ)
settable_mmx_flags |=
PNG_ASM_FLAG_MMX_READ_COMBINE_ROW |
PNG_ASM_FLAG_MMX_READ_INTERLACE |
PNG_ASM_FLAG_MMX_READ_FILTER_SUB |
PNG_ASM_FLAG_MMX_READ_FILTER_UP |
PNG_ASM_FLAG_MMX_READ_FILTER_AVG |
PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ;
#if 0
/* GRR: no MMX write support yet, but someday... */
if (flag_select & PNG_SELECT_WRITE)
settable_mmx_flags |=
PNG_ASM_FLAG_MMX_WRITE_ [whatever] ;
#endif /* 0 */
if (compilerID != NULL) {
#ifdef PNG_USE_PNGVCRD
*compilerID = 1; /* MSVC */
#else
#ifdef PNG_USE_PNGGCCRD
*compilerID = 2; /* gcc/gas */
#else
*compilerID = -1; /* unknown (i.e., no asm/MMX code compiled) */
#endif
#endif
}
return settable_mmx_flags; /* _theoretically_ settable capabilities only */
}
/* this function was added to libpng 1.2.0 */
png_byte PNGAPI
png_get_mmx_bitdepth_threshold (png_structp png_ptr)
{
return (png_byte)(png_ptr? png_ptr->mmx_bitdepth_threshold : 0);
}
/* this function was added to libpng 1.2.0 */
png_uint_32 PNGAPI
png_get_mmx_rowbytes_threshold (png_structp png_ptr)
{
return (png_uint_32)(png_ptr? png_ptr->mmx_rowbytes_threshold : 0L);
}
#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
#endif /* ?PNG_1_0_X */
#ifdef PNG_SET_USER_LIMITS_SUPPORTED #ifdef PNG_SET_USER_LIMITS_SUPPORTED
/* these functions were added to libpng 1.2.6 */ /* These functions were added to libpng 1.2.6 and were enabled
* by default in libpng-1.4.0 */
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_user_width_max (png_structp png_ptr) png_get_user_width_max (png_structp png_ptr)
{ {
@@ -932,6 +892,34 @@ png_get_user_height_max (png_structp png_ptr)
{ {
return (png_ptr? png_ptr->user_height_max : 0); return (png_ptr? png_ptr->user_height_max : 0);
} }
/* This function was added to libpng 1.4.0 */
png_uint_32 PNGAPI
png_get_chunk_cache_max (png_structp png_ptr)
{
return (png_ptr? png_ptr->user_chunk_cache_max : 0);
}
/* This function was added to libpng 1.4.1 */
png_alloc_size_t PNGAPI
png_get_chunk_malloc_max (png_structp png_ptr)
{
return (png_ptr?
png_ptr->user_chunk_malloc_max : 0);
}
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */ #endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
/* These functions were added to libpng 1.4.0 */
#ifdef PNG_IO_STATE_SUPPORTED
png_uint_32 PNGAPI
png_get_io_state (png_structp png_ptr)
{
return png_ptr->io_state;
}
png_bytep PNGAPI
png_get_io_chunk_name (png_structp png_ptr)
{
return png_ptr->chunk_name;
}
#endif /* ?PNG_IO_STATE_SUPPORTED */
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */

217
pngmem.c
View File

@@ -1,12 +1,15 @@
/* pngmem.c - stub functions for memory allocation /* pngmem.c - stub functions for memory allocation
* *
* Last changed in libpng 1.2.9 April 14, 2006 * Last changed in libpng 1.4.2 [May 6, 2010]
* For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2010 Glenn Randers-Pehrson
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
* This file provides a location for all memory allocation. Users who * This file provides a location for all memory allocation. Users who
* need special memory handling are expected to supply replacement * need special memory handling are expected to supply replacement
* functions for png_malloc() and png_free(), and to use * functions for png_malloc() and png_free(), and to use
@@ -14,14 +17,14 @@
* identify the replacement functions. * identify the replacement functions.
*/ */
#define PNG_INTERNAL #define PNG_NO_PEDANTIC_WARNINGS
#include "png.h" #include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#include "pngpriv.h"
/* Borland DOS special memory handler */ /* Borland DOS special memory handler */
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__) #if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
/* if you change this, be sure to change the one in png.h also */ /* If you change this, be sure to change the one in png.h also */
/* Allocate memory for a png_struct. The malloc and memset can be replaced /* Allocate memory for a png_struct. The malloc and memset can be replaced
by a single call to calloc() if this is thought to improve performance. */ by a single call to calloc() if this is thought to improve performance. */
@@ -29,7 +32,7 @@ png_voidp /* PRIVATE */
png_create_struct(int type) png_create_struct(int type)
{ {
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
return (png_create_struct_2(type, png_malloc_ptr_NULL, png_voidp_NULL)); return (png_create_struct_2(type, NULL, NULL));
} }
/* Alternate version of png_create_struct, for use with user-defined malloc. */ /* Alternate version of png_create_struct, for use with user-defined malloc. */
@@ -41,14 +44,14 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
png_voidp struct_ptr; png_voidp struct_ptr;
if (type == PNG_STRUCT_INFO) if (type == PNG_STRUCT_INFO)
size = png_sizeof(png_info); size = png_sizeof(png_info);
else if (type == PNG_STRUCT_PNG) else if (type == PNG_STRUCT_PNG)
size = png_sizeof(png_struct); size = png_sizeof(png_struct);
else else
return (png_get_copyright(NULL)); return (png_get_copyright(NULL));
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
if(malloc_fn != NULL) if (malloc_fn != NULL)
{ {
png_struct dummy_struct; png_struct dummy_struct;
png_structp png_ptr = &dummy_struct; png_structp png_ptr = &dummy_struct;
@@ -57,7 +60,7 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
} }
else else
#endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_USER_MEM_SUPPORTED */
struct_ptr = (png_voidp)farmalloc(size); struct_ptr = (png_voidp)farmalloc(size);
if (struct_ptr != NULL) if (struct_ptr != NULL)
png_memset(struct_ptr, 0, size); png_memset(struct_ptr, 0, size);
return (struct_ptr); return (struct_ptr);
@@ -68,7 +71,7 @@ void /* PRIVATE */
png_destroy_struct(png_voidp struct_ptr) png_destroy_struct(png_voidp struct_ptr)
{ {
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
png_destroy_struct_2(struct_ptr, png_free_ptr_NULL, png_voidp_NULL); png_destroy_struct_2(struct_ptr, NULL, NULL);
} }
/* Free memory allocated by a png_create_struct() call */ /* Free memory allocated by a png_create_struct() call */
@@ -80,7 +83,7 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
if (struct_ptr != NULL) if (struct_ptr != NULL)
{ {
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
if(free_fn != NULL) if (free_fn != NULL)
{ {
png_struct dummy_struct; png_struct dummy_struct;
png_structp png_ptr = &dummy_struct; png_structp png_ptr = &dummy_struct;
@@ -112,9 +115,19 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
* result, we would be truncating potentially larger memory requests * result, we would be truncating potentially larger memory requests
* (which should cause a fatal error) and introducing major problems. * (which should cause a fatal error) and introducing major problems.
*/ */
png_voidp PNGAPI
png_calloc(png_structp png_ptr, png_alloc_size_t size)
{
png_voidp ret;
ret = (png_malloc(png_ptr, size));
if (ret != NULL)
png_memset(ret,0,(png_size_t)size);
return (ret);
}
png_voidp PNGAPI png_voidp PNGAPI
png_malloc(png_structp png_ptr, png_uint_32 size) png_malloc(png_structp png_ptr, png_alloc_size_t size)
{ {
png_voidp ret; png_voidp ret;
@@ -122,21 +135,24 @@ png_malloc(png_structp png_ptr, png_uint_32 size)
return (NULL); return (NULL);
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
if(png_ptr->malloc_fn != NULL) if (png_ptr->malloc_fn != NULL)
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size)); ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
else else
ret = (png_malloc_default(png_ptr, size)); ret = (png_malloc_default(png_ptr, size));
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Out of memory!"); png_error(png_ptr, "Out of memory");
return (ret); return (ret);
} }
png_voidp PNGAPI png_voidp PNGAPI
png_malloc_default(png_structp png_ptr, png_uint_32 size) png_malloc_default(png_structp png_ptr, png_alloc_size_t size)
{ {
png_voidp ret; png_voidp ret;
#endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_USER_MEM_SUPPORTED */
if (png_ptr == NULL || size == 0)
return (NULL);
#ifdef PNG_MAX_MALLOC_64K #ifdef PNG_MAX_MALLOC_64K
if (size > (png_uint_32)65536L) if (size > (png_uint_32)65536L)
{ {
@@ -147,12 +163,12 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
#endif #endif
if (size != (size_t)size) if (size != (size_t)size)
ret = NULL; ret = NULL;
else if (size == (png_uint_32)65536L) else if (size == (png_uint_32)65536L)
{ {
if (png_ptr->offset_table == NULL) if (png_ptr->offset_table == NULL)
{ {
/* try to see if we need to do any of this fancy stuff */ /* Try to see if we need to do any of this fancy stuff */
ret = farmalloc(size); ret = farmalloc(size);
if (ret == NULL || ((png_size_t)ret & 0xffff)) if (ret == NULL || ((png_size_t)ret & 0xffff))
{ {
@@ -168,7 +184,7 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
ret = NULL; ret = NULL;
} }
if(png_ptr->zlib_window_bits > 14) if (png_ptr->zlib_window_bits > 14)
num_blocks = (int)(1 << (png_ptr->zlib_window_bits - 14)); num_blocks = (int)(1 << (png_ptr->zlib_window_bits - 14));
else else
num_blocks = 1; num_blocks = 1;
@@ -185,9 +201,9 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
{ {
#ifndef PNG_USER_MEM_SUPPORTED #ifndef PNG_USER_MEM_SUPPORTED
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Out Of Memory."); /* Note "O" and "M" */ png_error(png_ptr, "Out Of Memory"); /* Note "O", "M" */
else else
png_warning(png_ptr, "Out Of Memory."); png_warning(png_ptr, "Out Of Memory");
#endif #endif
return (NULL); return (NULL);
} }
@@ -207,15 +223,15 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
png_ptr->offset_table = table; png_ptr->offset_table = table;
png_ptr->offset_table_ptr = farmalloc(num_blocks * png_ptr->offset_table_ptr = farmalloc(num_blocks *
png_sizeof (png_bytep)); png_sizeof(png_bytep));
if (png_ptr->offset_table_ptr == NULL) if (png_ptr->offset_table_ptr == NULL)
{ {
#ifndef PNG_USER_MEM_SUPPORTED #ifndef PNG_USER_MEM_SUPPORTED
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Out Of memory."); /* Note "O" and "M" */ png_error(png_ptr, "Out Of memory"); /* Note "O", "m" */
else else
png_warning(png_ptr, "Out Of memory."); png_warning(png_ptr, "Out Of memory");
#endif #endif
return (NULL); return (NULL);
} }
@@ -242,9 +258,9 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
{ {
#ifndef PNG_USER_MEM_SUPPORTED #ifndef PNG_USER_MEM_SUPPORTED
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Out of Memory."); /* Note "o" and "M" */ png_error(png_ptr, "Out of Memory"); /* Note "o" and "M" */
else else
png_warning(png_ptr, "Out of Memory."); png_warning(png_ptr, "Out of Memory");
#endif #endif
return (NULL); return (NULL);
} }
@@ -258,18 +274,19 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
if (ret == NULL) if (ret == NULL)
{ {
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Out of memory."); /* Note "o" and "m" */ png_error(png_ptr, "Out of memory"); /* Note "o" and "m" */
else else
png_warning(png_ptr, "Out of memory."); /* Note "o" and "m" */ png_warning(png_ptr, "Out of memory"); /* Note "o" and "m" */
} }
#endif #endif
return (ret); return (ret);
} }
/* free a pointer allocated by png_malloc(). In the default /* Free a pointer allocated by png_malloc(). In the default
configuration, png_ptr is not used, but is passed in case it * configuration, png_ptr is not used, but is passed in case it
is needed. If ptr is NULL, return without taking any action. */ * is needed. If ptr is NULL, return without taking any action.
*/
void PNGAPI void PNGAPI
png_free(png_structp png_ptr, png_voidp ptr) png_free(png_structp png_ptr, png_voidp ptr)
{ {
@@ -282,7 +299,8 @@ png_free(png_structp png_ptr, png_voidp ptr)
(*(png_ptr->free_fn))(png_ptr, ptr); (*(png_ptr->free_fn))(png_ptr, ptr);
return; return;
} }
else png_free_default(png_ptr, ptr); else
png_free_default(png_ptr, ptr);
} }
void PNGAPI void PNGAPI
@@ -290,6 +308,9 @@ png_free_default(png_structp png_ptr, png_voidp ptr)
{ {
#endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_USER_MEM_SUPPORTED */
if (png_ptr == NULL || ptr == NULL)
return;
if (png_ptr->offset_table != NULL) if (png_ptr->offset_table != NULL)
{ {
int i; int i;
@@ -327,7 +348,7 @@ png_voidp /* PRIVATE */
png_create_struct(int type) png_create_struct(int type)
{ {
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
return (png_create_struct_2(type, png_malloc_ptr_NULL, png_voidp_NULL)); return (png_create_struct_2(type, NULL, NULL));
} }
/* Allocate memory for a png_struct or a png_info. The malloc and /* Allocate memory for a png_struct or a png_info. The malloc and
@@ -348,7 +369,7 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
return (NULL); return (NULL);
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
if(malloc_fn != NULL) if (malloc_fn != NULL)
{ {
png_struct dummy_struct; png_struct dummy_struct;
png_structp png_ptr = &dummy_struct; png_structp png_ptr = &dummy_struct;
@@ -364,7 +385,7 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
struct_ptr = (png_voidp)farmalloc(size); struct_ptr = (png_voidp)farmalloc(size);
#else #else
# if defined(_MSC_VER) && defined(MAXSEG_64K) # if defined(_MSC_VER) && defined(MAXSEG_64K)
struct_ptr = (png_voidp)halloc(size,1); struct_ptr = (png_voidp)halloc(size, 1);
# else # else
struct_ptr = (png_voidp)malloc(size); struct_ptr = (png_voidp)malloc(size);
# endif # endif
@@ -381,7 +402,7 @@ void /* PRIVATE */
png_destroy_struct(png_voidp struct_ptr) png_destroy_struct(png_voidp struct_ptr)
{ {
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
png_destroy_struct_2(struct_ptr, png_free_ptr_NULL, png_voidp_NULL); png_destroy_struct_2(struct_ptr, NULL, NULL);
} }
/* Free memory allocated by a png_create_struct() call */ /* Free memory allocated by a png_create_struct() call */
@@ -393,7 +414,7 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
if (struct_ptr != NULL) if (struct_ptr != NULL)
{ {
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
if(free_fn != NULL) if (free_fn != NULL)
{ {
png_struct dummy_struct; png_struct dummy_struct;
png_structp png_ptr = &dummy_struct; png_structp png_ptr = &dummy_struct;
@@ -415,13 +436,25 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
} }
/* Allocate memory. For reasonable files, size should never exceed /* Allocate memory. For reasonable files, size should never exceed
64K. However, zlib may allocate more then 64K if you don't tell * 64K. However, zlib may allocate more then 64K if you don't tell
it not to. See zconf.h and png.h for more information. zlib does * it not to. See zconf.h and png.h for more information. zlib does
need to allocate exactly 64K, so whatever you call here must * need to allocate exactly 64K, so whatever you call here must
have the ability to do that. */ * have the ability to do that.
*/
png_voidp PNGAPI png_voidp PNGAPI
png_malloc(png_structp png_ptr, png_uint_32 size) png_calloc(png_structp png_ptr, png_alloc_size_t size)
{
png_voidp ret;
ret = (png_malloc(png_ptr, size));
if (ret != NULL)
png_memset(ret,0,(png_size_t)size);
return (ret);
}
png_voidp PNGAPI
png_malloc(png_structp png_ptr, png_alloc_size_t size)
{ {
png_voidp ret; png_voidp ret;
@@ -429,17 +462,17 @@ png_malloc(png_structp png_ptr, png_uint_32 size)
if (png_ptr == NULL || size == 0) if (png_ptr == NULL || size == 0)
return (NULL); return (NULL);
if(png_ptr->malloc_fn != NULL) if (png_ptr->malloc_fn != NULL)
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size)); ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
else else
ret = (png_malloc_default(png_ptr, size)); ret = (png_malloc_default(png_ptr, size));
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Out of Memory!"); png_error(png_ptr, "Out of Memory");
return (ret); return (ret);
} }
png_voidp PNGAPI png_voidp PNGAPI
png_malloc_default(png_structp png_ptr, png_uint_32 size) png_malloc_default(png_structp png_ptr, png_alloc_size_t size)
{ {
png_voidp ret; png_voidp ret;
#endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_USER_MEM_SUPPORTED */
@@ -451,7 +484,7 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
if (size > (png_uint_32)65536L) if (size > (png_uint_32)65536L)
{ {
#ifndef PNG_USER_MEM_SUPPORTED #ifndef PNG_USER_MEM_SUPPORTED
if(png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Cannot Allocate > 64K"); png_error(png_ptr, "Cannot Allocate > 64K");
else else
#endif #endif
@@ -459,23 +492,23 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
} }
#endif #endif
/* Check for overflow */ /* Check for overflow */
#if defined(__TURBOC__) && !defined(__FLAT__) #if defined(__TURBOC__) && !defined(__FLAT__)
if (size != (unsigned long)size) if (size != (unsigned long)size)
ret = NULL; ret = NULL;
else else
ret = farmalloc(size); ret = farmalloc(size);
#else #else
# if defined(_MSC_VER) && defined(MAXSEG_64K) # if defined(_MSC_VER) && defined(MAXSEG_64K)
if (size != (unsigned long)size) if (size != (unsigned long)size)
ret = NULL; ret = NULL;
else else
ret = halloc(size, 1); ret = halloc(size, 1);
# else # else
if (size != (size_t)size) if (size != (size_t)size)
ret = NULL; ret = NULL;
else else
ret = malloc((size_t)size); ret = malloc((size_t)size);
# endif # endif
#endif #endif
@@ -488,7 +521,8 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
} }
/* Free a pointer allocated by png_malloc(). If ptr is NULL, return /* Free a pointer allocated by png_malloc(). If ptr is NULL, return
without taking any action. */ * without taking any action.
*/
void PNGAPI void PNGAPI
png_free(png_structp png_ptr, png_voidp ptr) png_free(png_structp png_ptr, png_voidp ptr)
{ {
@@ -501,7 +535,8 @@ png_free(png_structp png_ptr, png_voidp ptr)
(*(png_ptr->free_fn))(png_ptr, ptr); (*(png_ptr->free_fn))(png_ptr, ptr);
return; return;
} }
else png_free_default(png_ptr, ptr); else
png_free_default(png_ptr, ptr);
} }
void PNGAPI void PNGAPI
png_free_default(png_structp png_ptr, png_voidp ptr) png_free_default(png_structp png_ptr, png_voidp ptr)
@@ -524,53 +559,26 @@ png_free_default(png_structp png_ptr, png_voidp ptr)
#endif /* Not Borland DOS special memory handler */ #endif /* Not Borland DOS special memory handler */
#if defined(PNG_1_0_X)
# define png_malloc_warn png_malloc
#else
/* This function was added at libpng version 1.2.3. The png_malloc_warn() /* This function was added at libpng version 1.2.3. The png_malloc_warn()
* function will set up png_malloc() to issue a png_warning and return NULL * function will set up png_malloc() to issue a png_warning and return NULL
* instead of issuing a png_error, if it fails to allocate the requested * instead of issuing a png_error, if it fails to allocate the requested
* memory. * memory.
*/ */
png_voidp PNGAPI png_voidp PNGAPI
png_malloc_warn(png_structp png_ptr, png_uint_32 size) png_malloc_warn(png_structp png_ptr, png_alloc_size_t size)
{ {
png_voidp ptr; png_voidp ptr;
png_uint_32 save_flags=png_ptr->flags; png_uint_32 save_flags;
if (png_ptr == NULL)
return (NULL);
save_flags = png_ptr->flags;
png_ptr->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK; png_ptr->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK;
ptr = (png_voidp)png_malloc((png_structp)png_ptr, size); ptr = (png_voidp)png_malloc((png_structp)png_ptr, size);
png_ptr->flags=save_flags; png_ptr->flags=save_flags;
return(ptr); return(ptr);
} }
#endif
png_voidp PNGAPI
png_memcpy_check (png_structp png_ptr, png_voidp s1, png_voidp s2,
png_uint_32 length)
{
png_size_t size;
size = (png_size_t)length;
if ((png_uint_32)size != length)
png_error(png_ptr,"Overflow in png_memcpy_check.");
return(png_memcpy (s1, s2, size));
}
png_voidp PNGAPI
png_memset_check (png_structp png_ptr, png_voidp s1, int value,
png_uint_32 length)
{
png_size_t size;
size = (png_size_t)length;
if ((png_uint_32)size != length)
png_error(png_ptr,"Overflow in png_memset_check.");
return (png_memset (s1, value, size));
}
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
/* This function is called when the application wants to use another method /* This function is called when the application wants to use another method
@@ -580,9 +588,12 @@ void PNGAPI
png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
malloc_fn, png_free_ptr free_fn) malloc_fn, png_free_ptr free_fn)
{ {
png_ptr->mem_ptr = mem_ptr; if (png_ptr != NULL)
png_ptr->malloc_fn = malloc_fn; {
png_ptr->free_fn = free_fn; png_ptr->mem_ptr = mem_ptr;
png_ptr->malloc_fn = malloc_fn;
png_ptr->free_fn = free_fn;
}
} }
/* This function returns a pointer to the mem_ptr associated with the user /* This function returns a pointer to the mem_ptr associated with the user
@@ -592,6 +603,8 @@ png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
png_voidp PNGAPI png_voidp PNGAPI
png_get_mem_ptr(png_structp png_ptr) png_get_mem_ptr(png_structp png_ptr)
{ {
if (png_ptr == NULL)
return (NULL);
return ((png_voidp)png_ptr->mem_ptr); return ((png_voidp)png_ptr->mem_ptr);
} }
#endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_USER_MEM_SUPPORTED */

File diff suppressed because it is too large Load Diff

957
pngpriv.h Normal file
View File

@@ -0,0 +1,957 @@
/* pngpriv.h - private declarations for use inside libpng
*
* libpng version 1.4.5beta06 - November 21, 2010
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/
/* The symbols declared in this file (including the functions declared
* as PNG_EXTERN) are PRIVATE. They are not part of the libpng public
* interface, and are not recommended for use by regular applications.
* Some of them may become public in the future; others may stay private,
* change in an incompatible way, or even disappear.
* Although the libpng users are not forbidden to include this header,
* they should be well aware of the issues that may arise from doing so.
*/
#ifndef PNGPRIV_H
#define PNGPRIV_H
#ifndef PNG_VERSION_INFO_ONLY
#include <stdlib.h>
#ifndef PNG_EXTERN
/* The functions exported by PNG_EXTERN are internal functions, which
* aren't usually used outside the library (as far as I know), so it is
* debatable if they should be exported at all. In the future, when it
* is possible to have run-time registry of chunk-handling functions,
* some of these will be made available again.
# define PNG_EXTERN extern
*/
# define PNG_EXTERN
#endif
/* Other defines specific to compilers can go here. Try to keep
* them inside an appropriate ifdef/endif pair for portability.
*/
#ifdef PNG_FLOATING_POINT_SUPPORTED
# ifdef MACOS
/* We need to check that <math.h> hasn't already been included earlier
* as it seems it doesn't agree with <fp.h>, yet we should really use
* <fp.h> if possible.
*/
# if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
# include <fp.h>
# endif
# else
# include <math.h>
# endif
# if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
/* Amiga SAS/C: We must include builtin FPU functions when compiling using
* MATH=68881
*/
# include <m68881.h>
# endif
#endif
/* Codewarrior on NT has linking problems without this. */
#if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__)
# define PNG_ALWAYS_EXTERN
#endif
/* This provides the non-ANSI (far) memory allocation routines. */
#if defined(__TURBOC__) && defined(__MSDOS__)
# include <mem.h>
# include <alloc.h>
#endif
#if defined(WIN32) || defined(_Windows) || defined(_WINDOWS) || \
defined(_WIN32) || defined(__WIN32__)
# include <windows.h> /* defines _WINDOWS_ macro */
#endif
/* Various modes of operation. Note that after an init, mode is set to
* zero automatically when the structure is created.
*/
#define PNG_HAVE_IHDR 0x01
#define PNG_HAVE_PLTE 0x02
#define PNG_HAVE_IDAT 0x04
#define PNG_AFTER_IDAT 0x08 /* Have complete zlib datastream */
#define PNG_HAVE_IEND 0x10
#define PNG_HAVE_gAMA 0x20
#define PNG_HAVE_cHRM 0x40
#define PNG_HAVE_sRGB 0x80
#define PNG_HAVE_CHUNK_HEADER 0x100
#define PNG_WROTE_tIME 0x200
#define PNG_WROTE_INFO_BEFORE_PLTE 0x400
#define PNG_BACKGROUND_IS_GRAY 0x800
#define PNG_HAVE_PNG_SIGNATURE 0x1000
#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */
/* Flags for the transformations the PNG library does on the image data */
#define PNG_BGR 0x0001
#define PNG_INTERLACE 0x0002
#define PNG_PACK 0x0004
#define PNG_SHIFT 0x0008
#define PNG_SWAP_BYTES 0x0010
#define PNG_INVERT_MONO 0x0020
#define PNG_QUANTIZE 0x0040 /* formerly PNG_DITHER */
#define PNG_BACKGROUND 0x0080
#define PNG_BACKGROUND_EXPAND 0x0100
/* 0x0200 unused */
#define PNG_16_TO_8 0x0400
#define PNG_RGBA 0x0800
#define PNG_EXPAND 0x1000
#define PNG_GAMMA 0x2000
#define PNG_GRAY_TO_RGB 0x4000
#define PNG_FILLER 0x8000L
#define PNG_PACKSWAP 0x10000L
#define PNG_SWAP_ALPHA 0x20000L
#define PNG_STRIP_ALPHA 0x40000L
#define PNG_INVERT_ALPHA 0x80000L
#define PNG_USER_TRANSFORM 0x100000L
#define PNG_RGB_TO_GRAY_ERR 0x200000L
#define PNG_RGB_TO_GRAY_WARN 0x400000L
#define PNG_RGB_TO_GRAY 0x600000L /* two bits, RGB_TO_GRAY_ERR|WARN */
/* 0x800000L Unused */
#define PNG_ADD_ALPHA 0x1000000L /* Added to libpng-1.2.7 */
#define PNG_EXPAND_tRNS 0x2000000L /* Added to libpng-1.2.9 */
/* 0x4000000L unused */
/* 0x8000000L unused */
/* 0x10000000L unused */
/* 0x20000000L unused */
/* 0x40000000L unused */
/* Flags for png_create_struct */
#define PNG_STRUCT_PNG 0x0001
#define PNG_STRUCT_INFO 0x0002
/* Scaling factor for filter heuristic weighting calculations */
#define PNG_WEIGHT_SHIFT 8
#define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT))
#define PNG_COST_SHIFT 3
#define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT))
/* Flags for the png_ptr->flags rather than declaring a byte for each one */
#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001
#define PNG_FLAG_ZLIB_CUSTOM_LEVEL 0x0002
#define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL 0x0004
#define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS 0x0008
#define PNG_FLAG_ZLIB_CUSTOM_METHOD 0x0010
#define PNG_FLAG_ZLIB_FINISHED 0x0020
#define PNG_FLAG_ROW_INIT 0x0040
#define PNG_FLAG_FILLER_AFTER 0x0080
#define PNG_FLAG_CRC_ANCILLARY_USE 0x0100
#define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200
#define PNG_FLAG_CRC_CRITICAL_USE 0x0400
#define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800
/* 0x1000 unused */
/* 0x2000 unused */
/* 0x4000 unused */
#define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000L
#define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000L
#define PNG_FLAG_LIBRARY_MISMATCH 0x20000L
#define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000L
#define PNG_FLAG_STRIP_ERROR_TEXT 0x80000L
#define PNG_FLAG_MALLOC_NULL_MEM_OK 0x100000L
#define PNG_FLAG_ADD_ALPHA 0x200000L /* Added to libpng-1.2.8 */
#define PNG_FLAG_STRIP_ALPHA 0x400000L /* Added to libpng-1.2.8 */
#define PNG_FLAG_BENIGN_ERRORS_WARN 0x800000L /* Added to libpng-1.4.0 */
/* 0x1000000L unused */
/* 0x2000000L unused */
/* 0x4000000L unused */
/* 0x8000000L unused */
/* 0x10000000L unused */
/* 0x20000000L unused */
/* 0x40000000L unused */
#define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \
PNG_FLAG_CRC_ANCILLARY_NOWARN)
#define PNG_FLAG_CRC_CRITICAL_MASK (PNG_FLAG_CRC_CRITICAL_USE | \
PNG_FLAG_CRC_CRITICAL_IGNORE)
#define PNG_FLAG_CRC_MASK (PNG_FLAG_CRC_ANCILLARY_MASK | \
PNG_FLAG_CRC_CRITICAL_MASK)
/* Save typing and make code easier to understand */
#define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \
abs((int)((c1).green) - (int)((c2).green)) + \
abs((int)((c1).blue) - (int)((c2).blue)))
/* Added to libpng-1.2.6 JB */
#define PNG_ROWBYTES(pixel_bits, width) \
((pixel_bits) >= 8 ? \
((png_size_t)(width) * (((png_size_t)(pixel_bits)) >> 3)) : \
(( ((png_size_t)(width) * ((png_size_t)(pixel_bits))) + 7) >> 3) )
/* PNG_OUT_OF_RANGE returns true if value is outside the range
* ideal-delta..ideal+delta. Each argument is evaluated twice.
* "ideal" and "delta" should be constants, normally simple
* integers, "value" a variable. Added to libpng-1.2.6 JB
*/
#define PNG_OUT_OF_RANGE(value, ideal, delta) \
( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) )
/* Constant strings for known chunk types. If you need to add a chunk,
* define the name here, and add an invocation of the macro wherever it's
* needed.
*/
#define PNG_IHDR PNG_CONST png_byte png_IHDR[5] = { 73, 72, 68, 82, '\0'}
#define PNG_IDAT PNG_CONST png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'}
#define PNG_IEND PNG_CONST png_byte png_IEND[5] = { 73, 69, 78, 68, '\0'}
#define PNG_PLTE PNG_CONST png_byte png_PLTE[5] = { 80, 76, 84, 69, '\0'}
#define PNG_bKGD PNG_CONST png_byte png_bKGD[5] = { 98, 75, 71, 68, '\0'}
#define PNG_cHRM PNG_CONST png_byte png_cHRM[5] = { 99, 72, 82, 77, '\0'}
#define PNG_gAMA PNG_CONST png_byte png_gAMA[5] = {103, 65, 77, 65, '\0'}
#define PNG_hIST PNG_CONST png_byte png_hIST[5] = {104, 73, 83, 84, '\0'}
#define PNG_iCCP PNG_CONST png_byte png_iCCP[5] = {105, 67, 67, 80, '\0'}
#define PNG_iTXt PNG_CONST png_byte png_iTXt[5] = {105, 84, 88, 116, '\0'}
#define PNG_oFFs PNG_CONST png_byte png_oFFs[5] = {111, 70, 70, 115, '\0'}
#define PNG_pCAL PNG_CONST png_byte png_pCAL[5] = {112, 67, 65, 76, '\0'}
#define PNG_sCAL PNG_CONST png_byte png_sCAL[5] = {115, 67, 65, 76, '\0'}
#define PNG_pHYs PNG_CONST png_byte png_pHYs[5] = {112, 72, 89, 115, '\0'}
#define PNG_sBIT PNG_CONST png_byte png_sBIT[5] = {115, 66, 73, 84, '\0'}
#define PNG_sPLT PNG_CONST png_byte png_sPLT[5] = {115, 80, 76, 84, '\0'}
#define PNG_sRGB PNG_CONST png_byte png_sRGB[5] = {115, 82, 71, 66, '\0'}
#define PNG_sTER PNG_CONST png_byte png_sTER[5] = {115, 84, 69, 82, '\0'}
#define PNG_tEXt PNG_CONST png_byte png_tEXt[5] = {116, 69, 88, 116, '\0'}
#define PNG_tIME PNG_CONST png_byte png_tIME[5] = {116, 73, 77, 69, '\0'}
#define PNG_tRNS PNG_CONST png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'}
#define PNG_zTXt PNG_CONST png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'}
/* Inhibit C++ name-mangling for libpng functions but not for system calls. */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* These functions are used internally in the code. They generally
* shouldn't be used unless you are writing code to add or replace some
* functionality in libpng. More information about most functions can
* be found in the files where the functions are located.
*/
/* Allocate memory for an internal libpng struct */
PNG_EXTERN png_voidp png_create_struct PNGARG((int type));
/* Free memory from internal libpng struct */
PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr));
PNG_EXTERN png_voidp png_create_struct_2 PNGARG((int type, png_malloc_ptr
malloc_fn, png_voidp mem_ptr));
PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr,
png_free_ptr free_fn, png_voidp mem_ptr));
/* Free any memory that info_ptr points to and reset struct. */
PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr,
png_infop info_ptr));
/* Function to allocate memory for zlib. PNGAPI is disallowed. */
PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size));
/* Function to free memory for zlib. PNGAPI is disallowed. */
PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr));
/* Next four functions are used internally as callbacks. PNGAPI is required
* but not PNG_EXPORT. PNGAPI added at libpng version 1.2.3. */
PNG_EXTERN void PNGAPI png_default_read_data PNGARG((png_structp png_ptr,
png_bytep data, png_size_t length));
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
PNG_EXTERN void PNGAPI png_push_fill_buffer PNGARG((png_structp png_ptr,
png_bytep buffer, png_size_t length));
#endif
PNG_EXTERN void PNGAPI png_default_write_data PNGARG((png_structp png_ptr,
png_bytep data, png_size_t length));
#ifdef PNG_WRITE_FLUSH_SUPPORTED
#ifdef PNG_STDIO_SUPPORTED
PNG_EXTERN void PNGAPI png_default_flush PNGARG((png_structp png_ptr));
#endif
#endif
/* Reset the CRC variable */
PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr));
/* Write the "data" buffer to whatever output you are using */
PNG_EXTERN void png_write_data PNGARG((png_structp png_ptr, png_bytep data,
png_size_t length));
/* Read and check the PNG file signature */
PNG_EXTERN void png_read_sig PNGARG((png_structp png_ptr, png_infop info_ptr));
/* Read the chunk header (length + type name) */
PNG_EXTERN png_uint_32 png_read_chunk_header PNGARG((png_structp png_ptr));
/* Read data from whatever input you are using into the "data" buffer */
PNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data,
png_size_t length));
/* Read bytes into buf, and update png_ptr->crc */
PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf,
png_size_t length));
/* Decompress data in a chunk that uses compression */
#if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \
defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED)
PNG_EXTERN void png_decompress_chunk PNGARG((png_structp png_ptr,
int comp_type, png_size_t chunklength, png_size_t prefix_length,
png_size_t *data_length));
#endif
/* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */
PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip));
/* Read the CRC from the file and compare it to the libpng calculated CRC */
PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr));
/* Calculate the CRC over a section of data. Note that we are only
* passing a maximum of 64K on systems that have this as a memory limit,
* since this is the maximum buffer size we can specify.
*/
PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr,
png_size_t length));
#ifdef PNG_WRITE_FLUSH_SUPPORTED
PNG_EXTERN void png_flush PNGARG((png_structp png_ptr));
#endif
/* Write various chunks */
/* Write the IHDR chunk, and update the png_struct with the necessary
* information.
*/
PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width,
png_uint_32 height,
int bit_depth, int color_type, int compression_method, int filter_method,
int interlace_method));
PNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr, png_colorp palette,
png_uint_32 num_pal));
PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data,
png_size_t length));
PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr));
#ifdef PNG_WRITE_gAMA_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma));
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr,
png_fixed_point file_gamma));
#endif
#endif
#ifdef PNG_WRITE_sBIT_SUPPORTED
PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit,
int color_type));
#endif
#ifdef PNG_WRITE_cHRM_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
PNG_EXTERN void png_write_cHRM PNGARG((png_structp png_ptr,
double white_x, double white_y,
double red_x, double red_y, double green_x, double green_y,
double blue_x, double blue_y));
#endif
PNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structp png_ptr,
png_fixed_point int_white_x, png_fixed_point int_white_y,
png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
png_fixed_point int_blue_y));
#endif
#ifdef PNG_WRITE_sRGB_SUPPORTED
PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr,
int intent));
#endif
#ifdef PNG_WRITE_iCCP_SUPPORTED
PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr,
png_charp name, int compression_type,
png_charp profile, int proflen));
/* Note to maintainer: profile should be png_bytep */
#endif
#ifdef PNG_WRITE_sPLT_SUPPORTED
PNG_EXTERN void png_write_sPLT PNGARG((png_structp png_ptr,
png_sPLT_tp palette));
#endif
#ifdef PNG_WRITE_tRNS_SUPPORTED
PNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr, png_bytep trans,
png_color_16p values, int number, int color_type));
#endif
#ifdef PNG_WRITE_bKGD_SUPPORTED
PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr,
png_color_16p values, int color_type));
#endif
#ifdef PNG_WRITE_hIST_SUPPORTED
PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, png_uint_16p hist,
int num_hist));
#endif
#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr,
png_charp key, png_charpp new_key));
#endif
#ifdef PNG_WRITE_tEXt_SUPPORTED
PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_charp key,
png_charp text, png_size_t text_len));
#endif
#ifdef PNG_WRITE_zTXt_SUPPORTED
PNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_charp key,
png_charp text, png_size_t text_len, int compression));
#endif
#ifdef PNG_WRITE_iTXt_SUPPORTED
PNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr,
int compression, png_charp key, png_charp lang, png_charp lang_key,
png_charp text));
#endif
#ifdef PNG_TEXT_SUPPORTED /* Added at version 1.0.14 and 1.2.4 */
PNG_EXTERN int png_set_text_2 PNGARG((png_structp png_ptr,
png_infop info_ptr, png_textp text_ptr, int num_text));
#endif
#ifdef PNG_WRITE_oFFs_SUPPORTED
PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr,
png_int_32 x_offset, png_int_32 y_offset, int unit_type));
#endif
#ifdef PNG_WRITE_pCAL_SUPPORTED
PNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose,
png_int_32 X0, png_int_32 X1, int type, int nparams,
png_charp units, png_charpp params));
#endif
#ifdef PNG_WRITE_pHYs_SUPPORTED
PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr,
png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit,
int unit_type));
#endif
#ifdef PNG_WRITE_tIME_SUPPORTED
PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr,
png_timep mod_time));
#endif
#ifdef PNG_WRITE_sCAL_SUPPORTED
#if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_STDIO_SUPPORTED)
PNG_EXTERN void png_write_sCAL PNGARG((png_structp png_ptr,
int unit, double width, double height));
#else
#ifdef PNG_FIXED_POINT_SUPPORTED
PNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr,
int unit, png_charp width, png_charp height));
#endif
#endif
#endif
/* Called when finished processing a row of data */
PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr));
/* Internal use only. Called before first row of data */
PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr));
#ifdef PNG_READ_GAMMA_SUPPORTED
PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr,
png_byte bit_depth));
#endif
/* Combine a row of data, dealing with alpha, etc. if requested */
PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row,
int mask));
#ifdef PNG_READ_INTERLACING_SUPPORTED
/* Expand an interlaced row */
/* OLD pre-1.0.9 interface:
PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info,
png_bytep row, int pass, png_uint_32 transformations));
*/
PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr));
#endif
/* GRR TO DO (2.0 or whenever): simplify other internal calling interfaces */
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
/* Grab pixels out of a row for an interlaced pass */
PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info,
png_bytep row, int pass));
#endif
/* Unfilter a row */
PNG_EXTERN void png_read_filter_row PNGARG((png_structp png_ptr,
png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter));
/* Choose the best filter to use and filter the row data */
PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr,
png_row_infop row_info));
/* Write out the filtered row. */
PNG_EXTERN void png_write_filtered_row PNGARG((png_structp png_ptr,
png_bytep filtered_row));
/* Finish a row while reading, dealing with interlacing passes, etc. */
PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr));
/* Initialize the row buffers, etc. */
PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr));
/* Optional call to update the users info structure */
PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr,
png_infop info_ptr));
/* These are the functions that do the transformations */
#ifdef PNG_READ_FILLER_SUPPORTED
PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info,
png_bytep row, png_uint_32 filler, png_uint_32 flags));
#endif
#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
PNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info,
png_bytep row));
#endif
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
PNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info,
png_bytep row));
#endif
#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
PNG_EXTERN void png_do_read_invert_alpha PNGARG((png_row_infop row_info,
png_bytep row));
#endif
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
PNG_EXTERN void png_do_write_invert_alpha PNGARG((png_row_infop row_info,
png_bytep row));
#endif
#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
PNG_EXTERN void png_do_strip_filler PNGARG((png_row_infop row_info,
png_bytep row, png_uint_32 flags));
#endif
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info, png_bytep row));
#endif
#if defined(PNG_READ_PACKSWAP_SUPPORTED) || \
defined(PNG_WRITE_PACKSWAP_SUPPORTED)
PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, png_bytep row));
#endif
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr, png_row_infop
row_info, png_bytep row));
#endif
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info,
png_bytep row));
#endif
#ifdef PNG_READ_PACK_SUPPORTED
PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info, png_bytep row));
#endif
#ifdef PNG_READ_SHIFT_SUPPORTED
PNG_EXTERN void png_do_unshift PNGARG((png_row_infop row_info, png_bytep row,
png_color_8p sig_bits));
#endif
#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info, png_bytep row));
#endif
#ifdef PNG_READ_16_TO_8_SUPPORTED
PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, png_bytep row));
#endif
#ifdef PNG_READ_QUANTIZE_SUPPORTED
PNG_EXTERN void png_do_quantize PNGARG((png_row_infop row_info,
png_bytep row, png_bytep palette_lookup, png_bytep quantize_lookup));
# ifdef PNG_CORRECT_PALETTE_SUPPORTED
PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr,
png_colorp palette, int num_palette));
# endif
#endif
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info, png_bytep row));
#endif
#ifdef PNG_WRITE_PACK_SUPPORTED
PNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info,
png_bytep row, png_uint_32 bit_depth));
#endif
#ifdef PNG_WRITE_SHIFT_SUPPORTED
PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info, png_bytep row,
png_color_8p bit_depth));
#endif
#ifdef PNG_READ_BACKGROUND_SUPPORTED
#ifdef PNG_READ_GAMMA_SUPPORTED
PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
png_color_16p trans_color, png_color_16p background,
png_color_16p background_1,
png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1,
png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1,
png_uint_16pp gamma_16_to_1, int gamma_shift));
#else
PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
png_color_16p trans_color, png_color_16p background));
#endif
#endif
#ifdef PNG_READ_GAMMA_SUPPORTED
PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, png_bytep row,
png_bytep gamma_table, png_uint_16pp gamma_16_table,
int gamma_shift));
#endif
#ifdef PNG_READ_EXPAND_SUPPORTED
PNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info,
png_bytep row, png_colorp palette, png_bytep trans, int num_trans));
PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info,
png_bytep row, png_color_16p trans_value));
#endif
/* The following decodes the appropriate chunks, and does error correction,
* then calls the appropriate callback for the chunk if it is valid.
*/
/* Decode the IHDR chunk */
PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
PNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#ifdef PNG_READ_bKGD_SUPPORTED
PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
#ifdef PNG_READ_cHRM_SUPPORTED
PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
#ifdef PNG_READ_gAMA_SUPPORTED
PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
#ifdef PNG_READ_hIST_SUPPORTED
PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
#ifdef PNG_READ_iCCP_SUPPORTED
PNG_EXTERN void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif /* PNG_READ_iCCP_SUPPORTED */
#ifdef PNG_READ_iTXt_SUPPORTED
PNG_EXTERN void png_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
#ifdef PNG_READ_oFFs_SUPPORTED
PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
#ifdef PNG_READ_pCAL_SUPPORTED
PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
#ifdef PNG_READ_pHYs_SUPPORTED
PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
#ifdef PNG_READ_sBIT_SUPPORTED
PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
#ifdef PNG_READ_sCAL_SUPPORTED
PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
#ifdef PNG_READ_sPLT_SUPPORTED
PNG_EXTERN void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif /* PNG_READ_sPLT_SUPPORTED */
#ifdef PNG_READ_sRGB_SUPPORTED
PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
#ifdef PNG_READ_tEXt_SUPPORTED
PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
#ifdef PNG_READ_tIME_SUPPORTED
PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
#ifdef PNG_READ_tRNS_SUPPORTED
PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
#ifdef PNG_READ_zTXt_SUPPORTED
PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_32 length));
PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr,
png_bytep chunk_name));
/* Handle the transformations for reading and writing */
PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr));
PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr));
PNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr));
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr,
png_infop info_ptr));
PNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr,
png_infop info_ptr));
PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr));
PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr,
png_uint_32 length));
PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr));
PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr));
PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr,
png_bytep buffer, png_size_t buffer_length));
PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr));
PNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr,
png_bytep buffer, png_size_t buffer_length));
PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr));
PNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_32 length));
PNG_EXTERN void png_push_have_info PNGARG((png_structp png_ptr,
png_infop info_ptr));
PNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr,
png_infop info_ptr));
PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row));
PNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr,
png_infop info_ptr));
PNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr,
png_infop info_ptr));
PNG_EXTERN void png_read_push_finish_row PNGARG((png_structp png_ptr));
#ifdef PNG_READ_tEXt_SUPPORTED
PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_32 length));
PNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr,
png_infop info_ptr));
#endif
#ifdef PNG_READ_zTXt_SUPPORTED
PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_32 length));
PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr,
png_infop info_ptr));
#endif
#ifdef PNG_READ_iTXt_SUPPORTED
PNG_EXTERN void png_push_handle_iTXt PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_32 length));
PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr,
png_infop info_ptr));
#endif
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
#ifdef PNG_MNG_FEATURES_SUPPORTED
PNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info,
png_bytep row));
PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info,
png_bytep row));
#endif
/* Added at libpng version 1.4.0 */
#ifdef PNG_cHRM_SUPPORTED
PNG_EXTERN int png_check_cHRM_fixed PNGARG((png_structp png_ptr,
png_fixed_point int_white_x, png_fixed_point int_white_y,
png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
png_fixed_point int_blue_y));
#endif
#ifdef PNG_cHRM_SUPPORTED
#ifdef PNG_CHECK_cHRM_SUPPORTED
/* Added at libpng version 1.2.34 and 1.4.0 */
PNG_EXTERN void png_64bit_product PNGARG((long v1, long v2,
unsigned long *hi_product, unsigned long *lo_product));
#endif
#endif
/* Added at libpng version 1.4.0 */
PNG_EXTERN void png_check_IHDR PNGARG((png_structp png_ptr,
png_uint_32 width, png_uint_32 height, int bit_depth,
int color_type, int interlace_type, int compression_type,
int filter_type));
/* Free all memory used by the read (old method - NOT DLL EXPORTED) */
PNG_EXTERN void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr,
png_infop end_info_ptr));
/* Free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */
PNG_EXTERN void png_write_destroy PNGARG((png_structp png_ptr));
#ifdef USE_FAR_KEYWORD /* memory model conversion function */
PNG_EXTERN void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr,
int check));
#endif /* USE_FAR_KEYWORD */
/* Define PNG_DEBUG at compile time for debugging information. Higher
* numbers for PNG_DEBUG mean more debugging information. This has
* only been added since version 0.95 so it is not implemented throughout
* libpng yet, but more support will be added as needed.
*/
#ifdef PNG_DEBUG
#if (PNG_DEBUG > 0)
#if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER)
#include <crtdbg.h>
#if (PNG_DEBUG > 1)
#ifndef _DEBUG
# define _DEBUG
#endif
#ifndef png_debug
#define png_debug(l,m) _RPT0(_CRT_WARN,m PNG_STRING_NEWLINE)
#endif
#ifndef png_debug1
#define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m PNG_STRING_NEWLINE,p1)
#endif
#ifndef png_debug2
#define png_debug2(l,m,p1,p2) _RPT2(_CRT_WARN,m PNG_STRING_NEWLINE,p1,p2)
#endif
#endif
#else /* PNG_DEBUG_FILE || !_MSC_VER */
#ifndef PNG_DEBUG_FILE
#define PNG_DEBUG_FILE stderr
#endif /* PNG_DEBUG_FILE */
#if (PNG_DEBUG > 1)
/* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on
* non-ISO compilers
*/
# ifdef __STDC__
# ifndef png_debug
# define png_debug(l,m) \
{ \
int num_tabs=l; \
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
}
# endif
# ifndef png_debug1
# define png_debug1(l,m,p1) \
{ \
int num_tabs=l; \
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
}
# endif
# ifndef png_debug2
# define png_debug2(l,m,p1,p2) \
{ \
int num_tabs=l; \
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
}
# endif
# else /* __STDC __ */
# ifndef png_debug
# define png_debug(l,m) \
{ \
int num_tabs=l; \
char format[256]; \
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
m,PNG_STRING_NEWLINE); \
fprintf(PNG_DEBUG_FILE,format); \
}
# endif
# ifndef png_debug1
# define png_debug1(l,m,p1) \
{ \
int num_tabs=l; \
char format[256]; \
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
m,PNG_STRING_NEWLINE); \
fprintf(PNG_DEBUG_FILE,format,p1); \
}
# endif
# ifndef png_debug2
# define png_debug2(l,m,p1,p2) \
{ \
int num_tabs=l; \
char format[256]; \
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
m,PNG_STRING_NEWLINE); \
fprintf(PNG_DEBUG_FILE,format,p1,p2); \
}
# endif
# endif /* __STDC __ */
#endif /* (PNG_DEBUG > 1) */
#endif /* _MSC_VER */
#endif /* (PNG_DEBUG > 0) */
#endif /* PNG_DEBUG */
#ifndef png_debug
#define png_debug(l, m)
#endif
#ifndef png_debug1
#define png_debug1(l, m, p1)
#endif
#ifndef png_debug2
#define png_debug2(l, m, p1, p2)
#endif
/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
#ifdef __cplusplus
}
#endif
#endif /* PNG_VERSION_INFO_ONLY */
#endif /* PNGPRIV_H */

997
pngread.c

File diff suppressed because it is too large Load Diff

101
pngrio.c
View File

@@ -1,12 +1,15 @@
/* pngrio.c - functions for data input /* pngrio.c - functions for data input
* *
* Last changed in libpng 1.2.9 April 14, 2006 * Last changed in libpng 1.4.5 [November 21, 2010]
* For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2010 Glenn Randers-Pehrson
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
* This file provides a location for all input. Users who need * This file provides a location for all input. Users who need
* special handling are expected to write a function that has the same * special handling are expected to write a function that has the same
* arguments as this and performs a similar function, but that possibly * arguments as this and performs a similar function, but that possibly
@@ -15,53 +18,52 @@
* libpng use it at run time with png_set_read_fn(...). * libpng use it at run time with png_set_read_fn(...).
*/ */
#define PNG_INTERNAL #define PNG_NO_PEDANTIC_WARNINGS
#include "png.h" #include "png.h"
#ifdef PNG_READ_SUPPORTED
#if defined(PNG_READ_SUPPORTED) #include "pngpriv.h"
/* Read the data from whatever input you are using. The default routine /* Read the data from whatever input you are using. The default routine
reads from a file pointer. Note that this routine sometimes gets called * reads from a file pointer. Note that this routine sometimes gets called
with very small lengths, so you should implement some kind of simple * with very small lengths, so you should implement some kind of simple
buffering if you are using unbuffered reads. This should never be asked * buffering if you are using unbuffered reads. This should never be asked
to read more then 64K on a 16 bit machine. */ * to read more then 64K on a 16 bit machine.
*/
void /* PRIVATE */ void /* PRIVATE */
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length) png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{ {
png_debug1(4,"reading %d bytes\n", (int)length); png_debug1(4, "reading %d bytes", (int)length);
if (png_ptr->read_data_fn != NULL) if (png_ptr->read_data_fn != NULL)
(*(png_ptr->read_data_fn))(png_ptr, data, length); (*(png_ptr->read_data_fn))(png_ptr, data, length);
else else
png_error(png_ptr, "Call to NULL read function"); png_error(png_ptr, "Call to NULL read function");
} }
#if !defined(PNG_NO_STDIO) #ifdef PNG_STDIO_SUPPORTED
/* This is the function that does the actual reading of data. If you are /* This is the function that does the actual reading of data. If you are
not reading from a standard C stream, you should create a replacement * not reading from a standard C stream, you should create a replacement
read_data function and use it at run time with png_set_read_fn(), rather * read_data function and use it at run time with png_set_read_fn(), rather
than changing the library. */ * than changing the library.
*/
#ifndef USE_FAR_KEYWORD #ifndef USE_FAR_KEYWORD
void PNGAPI void PNGAPI
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length) png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{ {
png_size_t check; png_size_t check;
if (png_ptr == NULL)
return;
/* fread() returns 0 on error, so it is OK to store this in a png_size_t /* fread() returns 0 on error, so it is OK to store this in a png_size_t
* instead of an int, which is what fread() actually returns. * instead of an int, which is what fread() actually returns.
*/ */
#if defined(_WIN32_WCE) check = fread(data, 1, length, (png_FILE_p)png_ptr->io_ptr);
if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
check = 0;
#else
check = (png_size_t)fread(data, (png_size_t)1, length,
(png_FILE_p)png_ptr->io_ptr);
#endif
if (check != length) if (check != length)
png_error(png_ptr, "Read Error"); png_error(png_ptr, "Read Error");
} }
#else #else
/* this is the model-independent version. Since the standard I/O library /* This is the model-independent version. Since the standard I/O library
can't handle far buffers in the medium and small models, we have to copy can't handle far buffers in the medium and small models, we have to copy
the data. the data.
*/ */
@@ -72,21 +74,18 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
static void PNGAPI static void PNGAPI
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length) png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{ {
int check; png_size_t check;
png_byte *n_data; png_byte *n_data;
png_FILE_p io_ptr; png_FILE_p io_ptr;
if (png_ptr == NULL)
return;
/* Check if data really is near. If so, use usual code. */ /* Check if data really is near. If so, use usual code. */
n_data = (png_byte *)CVT_PTR_NOCHECK(data); n_data = (png_byte *)CVT_PTR_NOCHECK(data);
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr); io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
if ((png_bytep)n_data == data) if ((png_bytep)n_data == data)
{ {
#if defined(_WIN32_WCE)
if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
check = 0;
#else
check = fread(n_data, 1, length, io_ptr); check = fread(n_data, 1, length, io_ptr);
#endif
} }
else else
{ {
@@ -97,14 +96,9 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
do do
{ {
read = MIN(NEAR_BUF_SIZE, remaining); read = MIN(NEAR_BUF_SIZE, remaining);
#if defined(_WIN32_WCE) err = fread(buf, 1, read, io_ptr);
if ( !ReadFile((HANDLE)(io_ptr), buf, read, &err, NULL) )
err = 0;
#else
err = fread(buf, (png_size_t)1, read, io_ptr);
#endif
png_memcpy(data, buf, read); /* copy far buffer to near buffer */ png_memcpy(data, buf, read); /* copy far buffer to near buffer */
if(err != read) if (err != read)
break; break;
else else
check += err; check += err;
@@ -120,25 +114,30 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
#endif #endif
/* This function allows the application to supply a new input function /* This function allows the application to supply a new input function
for libpng if standard C streams aren't being used. * for libpng if standard C streams aren't being used.
*
This function takes as its arguments: * This function takes as its arguments:
png_ptr - pointer to a png input data structure * png_ptr - pointer to a png input data structure
io_ptr - pointer to user supplied structure containing info about * io_ptr - pointer to user supplied structure containing info about
the input functions. May be NULL. * the input functions. May be NULL.
read_data_fn - pointer to a new input function that takes as its * read_data_fn - pointer to a new input function that takes as its
arguments a pointer to a png_struct, a pointer to * arguments a pointer to a png_struct, a pointer to
a location where input data can be stored, and a 32-bit * a location where input data can be stored, and a 32-bit
unsigned int that is the number of bytes to be read. * unsigned int that is the number of bytes to be read.
To exit and output any fatal error messages the new write * To exit and output any fatal error messages the new write
function should call png_error(png_ptr, "Error msg"). */ * function should call png_error(png_ptr, "Error msg").
* May be NULL, in which case libpng's default function will
* be used.
*/
void PNGAPI void PNGAPI
png_set_read_fn(png_structp png_ptr, png_voidp io_ptr, png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
png_rw_ptr read_data_fn) png_rw_ptr read_data_fn)
{ {
if (png_ptr == NULL)
return;
png_ptr->io_ptr = io_ptr; png_ptr->io_ptr = io_ptr;
#if !defined(PNG_NO_STDIO) #ifdef PNG_STDIO_SUPPORTED
if (read_data_fn != NULL) if (read_data_fn != NULL)
png_ptr->read_data_fn = read_data_fn; png_ptr->read_data_fn = read_data_fn;
else else
@@ -154,10 +153,10 @@ png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
png_warning(png_ptr, png_warning(png_ptr,
"It's an error to set both read_data_fn and write_data_fn in the "); "It's an error to set both read_data_fn and write_data_fn in the ");
png_warning(png_ptr, png_warning(png_ptr,
"same structure. Resetting write_data_fn to NULL."); "same structure. Resetting write_data_fn to NULL");
} }
#if defined(PNG_WRITE_FLUSH_SUPPORTED) #ifdef PNG_WRITE_FLUSH_SUPPORTED
png_ptr->output_flush_fn = NULL; png_ptr->output_flush_fn = NULL;
#endif #endif
} }

1537
pngrtran.c

File diff suppressed because it is too large Load Diff

1651
pngrutil.c

File diff suppressed because it is too large Load Diff

1077
pngset.c

File diff suppressed because it is too large Load Diff

946
pngtest.c

File diff suppressed because it is too large Load Diff

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