mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Compare commits
49 Commits
v1.2.13
...
v1.4.0beta
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ffb71a6af | ||
|
|
79134c69a4 | ||
|
|
4a82d69b9f | ||
|
|
1eb14e95d3 | ||
|
|
65a0992f0d | ||
|
|
5ca69e43ec | ||
|
|
d6d8075c0a | ||
|
|
35f5196386 | ||
|
|
71a3c1f821 | ||
|
|
02a5e33061 | ||
|
|
398b5a31a7 | ||
|
|
d0c40591f2 | ||
|
|
f783101c88 | ||
|
|
97a9b48789 | ||
|
|
56f6396137 | ||
|
|
a5fa5c9013 | ||
|
|
800d1e9a67 | ||
|
|
dbed41fde1 | ||
|
|
4198360421 | ||
|
|
1916f6ae42 | ||
|
|
e0784c72f4 | ||
|
|
43aaf6eb37 | ||
|
|
51650b8a65 | ||
|
|
79084216af | ||
|
|
eb58091392 | ||
|
|
895a9c97e2 | ||
|
|
72b633026b | ||
|
|
d8d7b949d9 | ||
|
|
b3ff968558 | ||
|
|
145f5c8164 | ||
|
|
a7dbcba1e8 | ||
|
|
c3f52f12bb | ||
|
|
7edd45814c | ||
|
|
701dbaa81e | ||
|
|
ae4bd5c2be | ||
|
|
6b12c08bfc | ||
|
|
3779c69674 | ||
|
|
ebd7f9a371 | ||
|
|
beb572e616 | ||
|
|
3424ee7354 | ||
|
|
e826d7e200 | ||
|
|
d120996a49 | ||
|
|
6bc53be992 | ||
|
|
f46918d129 | ||
|
|
73b064c2af | ||
|
|
b3870ab5f9 | ||
|
|
86dc981475 | ||
|
|
d60b8fab03 | ||
|
|
1721829464 |
365
ANNOUNCE
365
ANNOUNCE
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
Libpng 1.2.10rc1 - April 19, 2006
|
Libpng 1.4.0beta49 - February 28, 2009
|
||||||
|
|
||||||
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,34 +9,29 @@ 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.0beta49.tar.gz
|
||||||
1.2.10rc1.tar.bz2
|
1.4.0beta49.tar.bz2
|
||||||
|
|
||||||
Source files with LF line endings (for Unix/Linux) without the
|
Source files with LF line endings (for Unix/Linux) without the
|
||||||
"configure" script
|
"configure" script
|
||||||
|
|
||||||
1.2.10rc1-no-config.tar.gz
|
1.4.0beta49-no-config.tar.gz
|
||||||
1.2.10rc1-no-config.tar.bz2
|
1.4.0beta49-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
|
lp140b49.zip
|
||||||
lp1210r01.tar.bz2
|
lp140b49.tar.bz2
|
||||||
|
|
||||||
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.0beta49-README.txt
|
||||||
1.2.10rc1-KNOWNBUGS.txt
|
1.4.0beta49-KNOWNBUGS.txt
|
||||||
1.2.10rc1-LICENSE.txt
|
1.4.0beta49-LICENSE.txt
|
||||||
1.2.10rc1-Y2K-compliance.txt
|
1.4.0beta49-Y2K-compliance.txt
|
||||||
|
|
||||||
Changes since the last public release (1.2.9):
|
Changes since the last public release (1.2.10):
|
||||||
|
|
||||||
version 1.2.10beta1 [April 15, 2006]
|
version 1.2.10beta1 [April 15, 2006]
|
||||||
Renamed "config.h" to "png_conf.h" and revised Makefile.am to add
|
Renamed "config.h" to "png_conf.h" and revised Makefile.am to add
|
||||||
@@ -64,12 +59,344 @@ version 1.2.10beta6 [April 17, 2006]
|
|||||||
version 1.2.10beta7 [April 18, 2006]
|
version 1.2.10beta7 [April 18, 2006]
|
||||||
Change "exec_prefix=$prefix" to "exec_prefix=$(prefix)" in makefiles.
|
Change "exec_prefix=$prefix" to "exec_prefix=$(prefix)" in makefiles.
|
||||||
|
|
||||||
version 1.2.10beta8 [April 19, 2006]
|
version 1.2.10rc1 [April 19, 2006]
|
||||||
Ensure pngconf.h doesn't define both PNG_USE_PNGGCCRD and PNG_USE_PNGVCRD
|
Ensure pngconf.h doesn't define both PNG_USE_PNGGCCRD and PNG_USE_PNGVCRD
|
||||||
Fixed "LN_FS" typo in makefile.sco and makefile.solaris.
|
Fixed "LN_FS" typo in makefile.sco and makefile.solaris.
|
||||||
|
|
||||||
|
version 1.2.10rc2 [April 19, 2006]
|
||||||
|
Added a backslash between -DPNG_CONFIGURE_LIBPNG and -DPNG_NO_ASSEMBLER_CODE
|
||||||
|
in configure.ac
|
||||||
|
Made the configure warning about versioned symbols less arrogant.
|
||||||
|
|
||||||
|
version 1.2.10rc3 [April 20, 2006]
|
||||||
|
Added a note in libpng.txt that png_set_sig_bytes(8) can be used when
|
||||||
|
writing an embedded PNG without the 8-byte signature.
|
||||||
|
|
||||||
|
version 1.4.0beta1 [April 20, 2006]
|
||||||
|
Enabled iTXt support (changes png_struct, thus requires so-number change).
|
||||||
|
Cleaned up PNG_ASSEMBLER_CODE_SUPPORTED vs PNG_MMX_CODE_SUPPORTED
|
||||||
|
Eliminated PNG_1_0_X and PNG_1_2_X macros.
|
||||||
|
Removed deprecated functions png_read_init, png_write_init, png_info_init,
|
||||||
|
png_permit_empty_plte, png_set_gray_1_2_4_to_8, and removed the
|
||||||
|
deprecated macro PNG_MAX_UINT.
|
||||||
|
Moved "PNG_INTERNAL" parts of png.h and pngconf.h into pngintrn.h
|
||||||
|
Removed many WIN32_WCE #ifdefs (Cosmin).
|
||||||
|
Reduced dependency on C-runtime library when on Windows (Simon-Pierre)
|
||||||
|
Replaced sprintf() with png_sprintf() (Simon-Pierre)
|
||||||
|
|
||||||
|
version 1.4.0beta2 [April 20, 2006]
|
||||||
|
Revised makefiles to avoid making links to libpng.so.*
|
||||||
|
Moved some leftover MMX-related defines from pngconf.h to pngintrn.h
|
||||||
|
Updated scripts/pngos2.def, pngw32.def, and projects/wince/png32ce.def
|
||||||
|
Updated scripts/pngw32.def to comment out MMX functions.
|
||||||
|
|
||||||
|
version 1.2.11beta1 [May 31, 2006]
|
||||||
|
scripts/libpng.pc.in contained "configure" style version info and would
|
||||||
|
not work with makefiles.
|
||||||
|
The shared-library makefiles were linking to libpng.so.0 instead of
|
||||||
|
libpng.so.3 compatibility as the library.
|
||||||
|
|
||||||
|
version 1.4.0beta3 [May 10, 2006]
|
||||||
|
Updated scripts/pngw32.def to comment out MMX functions.
|
||||||
|
Added PNG_NO_GET_INT_32 and PNG_NO_SAVE_INT_32 macros.
|
||||||
|
Revised pngconf.h and added pngconf.h.in so makefiles and configure can
|
||||||
|
pass defines to libpng and applications.
|
||||||
|
|
||||||
|
version 1.4.0beta4 [May 11, 2006]
|
||||||
|
Revised configure.ac, Makefile.am, and many of the makefiles to write
|
||||||
|
their defines in pngconf.h.
|
||||||
|
|
||||||
|
version 1.4.0beta5 [May 15, 2006]
|
||||||
|
Added a missing semicolon in Makefile.am and Makefile.in
|
||||||
|
Deleted extraneous square brackets from configure.ac
|
||||||
|
|
||||||
|
version 1.2.11beta2 [June 2, 2006]
|
||||||
|
Increased sprintf buffer from 50 to 52 chars in pngrutil.c to avoid
|
||||||
|
buffer overflow.
|
||||||
|
Fixed bug in example.c (png_set_palette_rgb -> png_set_palette_to_rgb))
|
||||||
|
|
||||||
|
version 1.4.0beta6 [June 2, 2006]
|
||||||
|
Changed sonum from 0 to 1.
|
||||||
|
Removed unused prototype for png_check_sig() from png.h
|
||||||
|
|
||||||
|
version 1.2.11beta3 [June 5, 2006]
|
||||||
|
Prepended "#! /bin/sh" to ltmail.sh and contrib/pngminus/*.sh (Cosmin).
|
||||||
|
Removed the accidental leftover Makefile.in~ (Cosmin).
|
||||||
|
Avoided potential buffer overflow and optimized buffer in
|
||||||
|
png_write_sCAL(), png_write_sCAL_s() (Cosmin).
|
||||||
|
Removed the include directories and libraries from CFLAGS and LDFLAGS
|
||||||
|
in scripts/makefile.gcc (Nelson A. de Oliveira, Cosmin).
|
||||||
|
|
||||||
|
version 1.2.11beta4 [June 6, 2006]
|
||||||
|
Allow zero-length IDAT chunks after the entire zlib datastream, but not
|
||||||
|
after another intervening chunk type.
|
||||||
|
|
||||||
|
version 1.2.11rc2 [June 14, 2006]
|
||||||
|
Added prototypes for PNG_INCH_CONVERSIONS functions to png.h
|
||||||
|
Revised INSTALL and autogen.sh
|
||||||
|
Fixed typo in several makefiles (-W1 should be -Wl)
|
||||||
|
|
||||||
|
version 1.2.11rc3 [June 15, 2006]
|
||||||
|
Added one zero element to png_gamma_shift[] array in pngrtran.c to avoid
|
||||||
|
reading out of bounds.
|
||||||
|
|
||||||
|
version 1.4.0beta7 [June 16, 2006]
|
||||||
|
Exported png_write_sig (Cosmin).
|
||||||
|
Optimized buffer in png_handle_cHRM() (Cosmin).
|
||||||
|
Set pHYs = 2835 x 2835 pixels per meter, and added
|
||||||
|
sCAL = 0.352778e-3 x 0.352778e-3 meters, in pngtest.png (Cosmin).
|
||||||
|
Added png_set_benign_errors(), png_benign_error(), png_chunk_benign_error().
|
||||||
|
Added typedef for png_int_32 and png_uint_32 on 64-bit systems.
|
||||||
|
|
||||||
|
version 1.4.0beta8 [June 21, 2006]
|
||||||
|
Added demonstration of user chunk support in pngtest.c, to support the
|
||||||
|
public sTER chunk and a private vpAg chunk.
|
||||||
|
|
||||||
|
version 1.4.0beta9 [July 3, 2006]
|
||||||
|
Removed ordinals from scripts/pngw32.def and removed png_info_int and
|
||||||
|
png_set_gray_1_2_4_to_8 entries.
|
||||||
|
Inline call of png_get_uint_32() in png_get_uint_31().
|
||||||
|
Use png_get_uint_31() to get vpAg width and height in pngtest.c
|
||||||
|
Removed WINCE and Netware projects.
|
||||||
|
Removed standalone Y2KINFO file.
|
||||||
|
|
||||||
|
version 1.4.0beta10 [July 12, 2006]
|
||||||
|
Added "all: pngconf.h.in pngconf.h" target to Makefile.am
|
||||||
|
|
||||||
|
version 1.4.0beta11 [August 19, 2006]
|
||||||
|
Removed AC_FUNC_MALLOC from configure.ac.
|
||||||
|
Added a warning when writing iCCP profile with mismatched profile length.
|
||||||
|
Patched pnggccrd.c to assemble on x86_64 platforms.
|
||||||
|
Moved chunk header reading into a separate function png_read_chunk_header()
|
||||||
|
in pngrutil.c. The chunk header (len+sig) is now serialized in a single
|
||||||
|
operation (Cosmin).
|
||||||
|
Implemented support for I/O states. Added png_ptr member io_state, and
|
||||||
|
functions png_get_io_chunk_name() and png_get_io_state() in pngget.c
|
||||||
|
(Cosmin).
|
||||||
|
Added png_get_io_chunk_name and png_get_io_state to scripts/*.def (Cosmin).
|
||||||
|
Renamed scripts/pngw32.* to scripts/pngwin.* (Cosmin).
|
||||||
|
Removed the include directories and libraries from CFLAGS and LDFLAGS
|
||||||
|
in scripts/makefile.gcc (Cosmin).
|
||||||
|
Used png_save_uint_32() to set vpAg width and height in pngtest.c (Cosmin).
|
||||||
|
Cast to proper type when getting/setting vpAg units in pngtest.c (Cosmin).
|
||||||
|
Added pngintrn.h to the Visual C++ projects (Cosmin).
|
||||||
|
Removed scripts/list (Cosmin).
|
||||||
|
Updated copyright year in scripts/pngwin.def (Cosmin).
|
||||||
|
Removed PNG_TYPECAST_NULL and used standard NULL consistently (Cosmin).
|
||||||
|
Disallowed the user to redefine png_size_t, and enforced a consistent use
|
||||||
|
of png_size_t across libpng (Cosmin).
|
||||||
|
Changed the type of png_ptr->rowbytes, PNG_ROWBYTES() and friends
|
||||||
|
to png_size_t (Cosmin).
|
||||||
|
Removed png_convert_size() and replaced png_sizeof with sizeof (Cosmin).
|
||||||
|
Removed some unnecessary type casts (Cosmin).
|
||||||
|
Changed prototype of png_get_compression_buffer_size() and
|
||||||
|
png_set_compression_buffer_size() to work with png_size_t instead of
|
||||||
|
png_uint_32 (Cosmin).
|
||||||
|
Removed png_memcpy_check() and png_memset_check() (Cosmin).
|
||||||
|
Fixed a typo (png_byte --> png_bytep) in libpng.3 and libpng.txt (Cosmin).
|
||||||
|
Clarified that png_zalloc() does not clear the allocated memory,
|
||||||
|
and png_zalloc() and png_zfree() cannot be PNGAPI (Cosmin).
|
||||||
|
Renamed png_mem_size_t to png_alloc_size_t, fixed its definition in
|
||||||
|
pngconf.h, and used it in all memory allocation functions (Cosmin).
|
||||||
|
Renamed pngintrn.h to pngpriv.h, added a comment at the top of the file
|
||||||
|
mentioning that the symbols declared in that file are private, and
|
||||||
|
updated the scripts and the Visual C++ projects accordingly (Cosmin).
|
||||||
|
Removed circular references between pngconf.h and pngconf.h.in in
|
||||||
|
scripts/makefile.vc*win32 (Cosmin).
|
||||||
|
Removing trailing '.' from the warning and error messages (Cosmin).
|
||||||
|
Added pngdefs.h that is built by makefile or configure, instead of
|
||||||
|
pngconf.h.in (Glenn).
|
||||||
|
Detect and fix attempt to write wrong iCCP profile length.
|
||||||
|
|
||||||
|
version 1.4.0beta12 [October 19, 2006]
|
||||||
|
Changed "logical" to "bitwise" in the documentation.
|
||||||
|
Work around Intel-Mac compiler bug by setting PNG_NO_MMX_CODE in pngconf.h
|
||||||
|
Add a typecast to stifle compiler warning in pngrutil.c
|
||||||
|
|
||||||
|
version 1.4.0beta13 [November 10, 2006]
|
||||||
|
Fix potential buffer overflow in sPLT chunk handler.
|
||||||
|
Fix Makefile.am to not try to link to noexistent files.
|
||||||
|
|
||||||
|
version 1.4.0beta14 [November 15, 2006]
|
||||||
|
Check all exported functions for NULL png_ptr.
|
||||||
|
|
||||||
|
version 1.4.0beta15 [November 17, 2006]
|
||||||
|
Relocated two misplaced tests for NULL png_ptr.
|
||||||
|
Built Makefile.in with automake-1.9.6 instead of 1.9.2.
|
||||||
|
Build configure with autoconf-2.60 instead of 2.59.
|
||||||
|
Add "install: all" in Makefile.am so "configure; make install" will work.
|
||||||
|
|
||||||
|
version 1.4.0beta16 [November 17, 2006]
|
||||||
|
Added a typecast in png_zalloc().
|
||||||
|
|
||||||
|
version 1.4.0beta17 [December 4, 2006]
|
||||||
|
Changed "new_key[79] = '\0';" to "(*new_key)[79] = '\0';" in pngwutil.c
|
||||||
|
|
||||||
|
version 1.4.0beta18 [December 7, 2006]
|
||||||
|
Added scripts/CMakeLists.txt
|
||||||
|
|
||||||
|
version 1.4.0beta19 [May 16, 2007]
|
||||||
|
Revised scripts/CMakeLists.txt
|
||||||
|
Rebuilt configure and Makefile.in with newer tools.
|
||||||
|
Added "png_ptr->num_trans=0" before error return in png_handle_tRNS,
|
||||||
|
to eliminate a vulnerability (CVE-2007-2554, CERT VU#684664)
|
||||||
|
|
||||||
|
version 1.4.0beta20 [July 9, 2008]
|
||||||
|
Moved several PNG_HAVE_* macros from pngpriv.h to png.h because applications
|
||||||
|
calling set_unknown_chunk_location() need them.
|
||||||
|
Moved several macro definitions from pngpriv.h to pngconf.h
|
||||||
|
Added png_ptr->unknown_chunk to hold working unknown chunk data, so it
|
||||||
|
can be free'ed in case of error. Revised unknown chunk handling in
|
||||||
|
pngrutil.c and pngpread.c to use this structure.
|
||||||
|
Merge with changes to the 1.2.X branch, as of 1.2.19beta10.
|
||||||
|
Revised makefile.mingw
|
||||||
|
Prefer PNG_USE_PNGVCRD when _MSC_VER is defined in pngconf.h
|
||||||
|
|
||||||
|
version 1.4.0beta21 [July 21, 2008]
|
||||||
|
Moved local array "chunkdata" from pngrutil.c to the png_struct, so
|
||||||
|
it will be freed by png_read_destroy() in case of a read error (Kurt
|
||||||
|
Christensen).
|
||||||
|
|
||||||
|
version 1.4.0beta22 [July 21, 2008]
|
||||||
|
Change "purpose" and "buffer" to png_ptr->chunkdata to avoid memory leaking.
|
||||||
|
|
||||||
|
version 1.4.0beta23 [July 22, 2008]
|
||||||
|
Change "chunkdata = NULL" to "png_ptr->chunkdata = NULL" several places in
|
||||||
|
png_decompress_chunk().
|
||||||
|
|
||||||
|
version 1.4.0beta24 [July 25, 2008]
|
||||||
|
Change all remaining "chunkdata" to "png_ptr->chunkdata" in
|
||||||
|
png_decompress_chunk(), and remove "chunkdata" from parameter list.
|
||||||
|
Put a call to png_check_chunk_name() in png_read_chunk_header().
|
||||||
|
Revised png_check_chunk_name() to reject a name with a lowercase 3rd byte.
|
||||||
|
Removed two calls to png_check_chunk_name() occuring later in the process.
|
||||||
|
Define PNG_NO_ERROR_NUMBERS by default in pngconf.h
|
||||||
|
|
||||||
|
version 1.4.0beta25 [July 30, 2008]
|
||||||
|
Added a call to png_check_chunk_name() in pngpread.c
|
||||||
|
Reverted png_check_chunk_name() to accept a name with a lowercase 3rd byte.
|
||||||
|
Added png_push_have_buffer() function to pngpread.c
|
||||||
|
Eliminated PNG_BIG_ENDIAN_SUPPORTED and associated png_get_* macros.
|
||||||
|
Made inline expansion of png_get_*() optional with PNG_USE_READ_MACROS.
|
||||||
|
Eliminated all PNG_USELESS_TESTS and PNG_CORRECT_PALETTE_SUPPORTED code.
|
||||||
|
Synced contrib directory and configure files with libpng-1.2.30beta06.
|
||||||
|
Eliminated no-longer-used pngdefs.h (but it's still built in the makefiles)
|
||||||
|
Relocated a misplaced "#endif /* PNG_NO_WRITE_FILTER */" in pngwutil.c
|
||||||
|
|
||||||
|
version 1.4.0beta26 [August 4, 2008]
|
||||||
|
Removed png_push_have_buffer() function in pngpread.c. It increased the
|
||||||
|
compiled library size slightly.
|
||||||
|
Changed "-Wall" to "-W -Wall" in the CFLAGS in all makefiles (Cosmin Truta)
|
||||||
|
Declared png_ptr "volatile" in pngread.c and pngwrite.c to avoid warnings.
|
||||||
|
Updated contrib/visupng/cexcept.h to version 2.0.1
|
||||||
|
Added PNG_LITERAL_CHARACTER macros for #, [, and ].
|
||||||
|
|
||||||
|
version 1.4.0beta27 [August 5, 2008]
|
||||||
|
Revised usage of PNG_LITERAL_SHARP in pngerror.c.
|
||||||
|
Moved newline character from individual png_debug messages into the
|
||||||
|
png_debug macros.
|
||||||
|
Allow user to #define their own png_debug, png_debug1, and png_debug2.
|
||||||
|
|
||||||
|
version 1.4.0beta28 [August 5, 2008]
|
||||||
|
Revised usage of PNG_LITERAL_SHARP in pngerror.c.
|
||||||
|
Added PNG_STRING_NEWLINE macro
|
||||||
|
|
||||||
|
version 1.4.0beta29 [August 9, 2008]
|
||||||
|
Revised usage of PNG_STRING_NEWLINE to work on non-ISO compilers.
|
||||||
|
Added PNG_STRING_COPYRIGHT macro.
|
||||||
|
Added non-ISO versions of png_debug macros.
|
||||||
|
|
||||||
|
version 1.4.0beta30 [August 14, 2008]
|
||||||
|
Added premultiplied alpha feature (Volker Wiendl).
|
||||||
|
|
||||||
|
version 1.4.0beta31 [August 18, 2008]
|
||||||
|
Moved png_set_premultiply_alpha from pngtrans.c to pngrtran.c
|
||||||
|
Removed extra crc check at the end of png_handle_cHRM(). Bug introduced
|
||||||
|
in libpng-1.4.0beta20.
|
||||||
|
|
||||||
|
version 1.4.0beta32 [August 19, 2008]
|
||||||
|
Added PNG_WRITE_FLUSH_SUPPORTED block around new png_flush() call.
|
||||||
|
Revised PNG_NO_STDIO version of png_write_flush()
|
||||||
|
|
||||||
|
version 1.4.0beta33 [August 20, 2008]
|
||||||
|
Added png_set_chunk_cache_max() to limit the total number of sPLT,
|
||||||
|
text, and unknown chunks that can be stored.
|
||||||
|
|
||||||
|
version 1.4.0beta34 [September 6, 2008]
|
||||||
|
Shortened tIME_string to 29 bytes in pngtest.c
|
||||||
|
Fixed off-by-one error introduced in png_push_read_zTXt() function in
|
||||||
|
libpng-1.2.30beta04/pngpread.c (Harald van Dijk)
|
||||||
|
|
||||||
|
version 1.4.0beta35 [October 6, 2008]
|
||||||
|
Changed "trans_values" to "trans_color".
|
||||||
|
Change png_set_gray_1_2_4_to_8() to png_set_expand_gray_1_2_4_to_8()
|
||||||
|
in example.c (debian bug report)
|
||||||
|
|
||||||
|
version 1.4.0beta36 [October 25, 2008]
|
||||||
|
Sync with tEXt vulnerability fix in libpng-1.2.33rc02.
|
||||||
|
|
||||||
|
version 1.4.0beta37 [November 13, 2008]
|
||||||
|
Added png_check_cHRM in png.c and moved checking from pngget.c, pngrutil.c,
|
||||||
|
and pngwrite.c
|
||||||
|
|
||||||
|
version 1.4.0beta38 [November 22, 2008]
|
||||||
|
Added check for zero-area RGB cHRM triange in png_check_cHRM() and
|
||||||
|
png_check_cHRM_fixed().
|
||||||
|
|
||||||
|
version 1.4.0beta39 [February 28, 2009]
|
||||||
|
Revised png_warning() to write its message on standard output by default
|
||||||
|
when warning_fn is NULL.
|
||||||
|
|
||||||
|
version 1.4.0beta40 [November 24, 2008]
|
||||||
|
Eliminated png_check_cHRM(). Instead, always use png_check_cHRM_fixed().
|
||||||
|
In png_check_cHRM_fixed(), ensure white_y is > 0, and removed redundant
|
||||||
|
check for all-zero coordinates that is detected by the triangle check.
|
||||||
|
|
||||||
|
version 1.4.0beta41 [November 26, 2008]
|
||||||
|
Fixed string vs pointer-to-string error in png_check_keyword().
|
||||||
|
Rearranged test expressions in png_check_cHRM_fixed() to avoid internal
|
||||||
|
overflows.
|
||||||
|
Added PNG_NO_CHECK_cHRM conditional.
|
||||||
|
|
||||||
|
version 1.4.0beta42, 43 [December 1, 2008]
|
||||||
|
Merge png_debug with version 1.2.34beta04.
|
||||||
|
|
||||||
|
version 1.4.0beta44 [December 6, 2008]
|
||||||
|
Removed redundant check for key==NULL before calling png_check_keyword()
|
||||||
|
to ensure that new_key gets initialized and removed extra warning
|
||||||
|
(Merge with version 1.2.34beta05 -- Arvan Pritchard).
|
||||||
|
|
||||||
|
version 1.4.0beta45 [December 9, 2008]
|
||||||
|
In png_write_png(), respect the placement of the filler bytes in an earlier
|
||||||
|
call to png_set_filler() (Jim Barry).
|
||||||
|
|
||||||
|
version 1.4.0beta46 [December 10, 2008]
|
||||||
|
Undid previous change and added PNG_TRANSFORM_STRIP_FILLER_BEFORE and
|
||||||
|
PNG_TRANSFORM_STRIP_FILLER_AFTER conditionals and deprecated
|
||||||
|
PNG_TRANSFORM_STRIP_FILLER (Jim Barry).
|
||||||
|
|
||||||
|
version 1.4.0beta47 [December 15, 2008]
|
||||||
|
Turned off PNG_READ_DITHER_SUPPORTED by default.
|
||||||
|
|
||||||
|
version 1.4.0beta48 [February 14, 2009]
|
||||||
|
Added new exported function png_calloc().
|
||||||
|
Combined several instances of png_malloc(); png_memset() into png_calloc().
|
||||||
|
Removed prototype for png_freeptr() that was added in libpng-1.4.0beta24
|
||||||
|
|
||||||
|
version 1.4.0beta49 [February 28, 2009]
|
||||||
|
Added png_fileno() macro to pngconf.h, used in pngwio.c
|
||||||
|
Corrected order of #ifdef's in png_debug definition in png.h
|
||||||
|
Fixed bug introduced in libpng-1.4.0beta48 with the memset arguments
|
||||||
|
for pcal_params.
|
||||||
|
Fixed order of #ifdef directives in the png_debug defines in png.h
|
||||||
|
(bug introduced in libpng-1.2.34/1.4.0beta29).
|
||||||
|
Revised comments in png_set_read_fn() and png_set_write_fn().
|
||||||
|
|
||||||
|
version 1.4.0betaN [future]
|
||||||
|
Build shared libraries with -lz and sometimes -lm.
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
(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
|
||||||
|
|
||||||
|
|||||||
524
CHANGES
524
CHANGES
@@ -1480,7 +1480,7 @@ version 1.2.9beta5 [March 4, 2006]
|
|||||||
Restored scripts/makefile.elf which was inadvertently deleted.
|
Restored scripts/makefile.elf which was inadvertently deleted.
|
||||||
|
|
||||||
version 1.2.9beta6 [March 6, 2006]
|
version 1.2.9beta6 [March 6, 2006]
|
||||||
Fixed typo (10) in configuration files.
|
Fixed typo (RELEASE) in configuration files.
|
||||||
|
|
||||||
version 1.2.9beta7 [March 7, 2006]
|
version 1.2.9beta7 [March 7, 2006]
|
||||||
Removed libpng.vers and libpng.sym from libpng12_la_SOURCES in Makefile.am
|
Removed libpng.vers and libpng.sym from libpng12_la_SOURCES in Makefile.am
|
||||||
@@ -1552,14 +1552,524 @@ version 1.2.10rc1 [April 19, 2006]
|
|||||||
Ensure pngconf.h doesn't define both PNG_USE_PNGGCCRD and PNG_USE_PNGVCRD
|
Ensure pngconf.h doesn't define both PNG_USE_PNGGCCRD and PNG_USE_PNGVCRD
|
||||||
Fixed "LN_FS" typo in makefile.sco and makefile.solaris.
|
Fixed "LN_FS" typo in makefile.sco and makefile.solaris.
|
||||||
|
|
||||||
version 1.4.0beta1 [future]
|
version 1.2.10rc2 [April 20, 2006]
|
||||||
|
Added a backslash between -DPNG_CONFIGURE_LIBPNG and -DPNG_NO_ASSEMBLER_CODE
|
||||||
|
in configure.ac and configure
|
||||||
|
Made the configure warning about versioned symbols less arrogant.
|
||||||
|
|
||||||
|
version 1.2.10rc3 [April 21, 2006]
|
||||||
|
Added a note in libpng.txt that png_set_sig_bytes(8) can be used when
|
||||||
|
writing an embedded PNG without the 8-byte signature.
|
||||||
|
Revised makefiles and configure to avoid making links to libpng.so.*
|
||||||
|
|
||||||
|
version 1.2.10 [April 23, 2006]
|
||||||
|
Reverted configure to "rc2" state.
|
||||||
|
|
||||||
|
version 1.2.11beta1 [May 31, 2006]
|
||||||
|
scripts/libpng.pc.in contained "configure" style version info and would
|
||||||
|
not work with makefiles.
|
||||||
|
The shared-library makefiles were linking to libpng.so.0 instead of
|
||||||
|
libpng.so.3 compatibility as the library.
|
||||||
|
|
||||||
|
version 1.2.11beta2 [June 2, 2006]
|
||||||
|
Increased sprintf buffer from 50 to 52 chars in pngrutil.c to avoid
|
||||||
|
buffer overflow.
|
||||||
|
Fixed bug in example.c (png_set_palette_rgb -> png_set_palette_to_rgb)
|
||||||
|
|
||||||
|
version 1.2.11beta3 [June 5, 2006]
|
||||||
|
Prepended "#! /bin/sh" to ltmail.sh and contrib/pngminus/*.sh (Cosmin).
|
||||||
|
Removed the accidental leftover Makefile.in~ (Cosmin).
|
||||||
|
Avoided potential buffer overflow and optimized buffer in
|
||||||
|
png_write_sCAL(), png_write_sCAL_s() (Cosmin).
|
||||||
|
Removed the include directories and libraries from CFLAGS and LDFLAGS
|
||||||
|
in scripts/makefile.gcc (Nelson A. de Oliveira, Cosmin).
|
||||||
|
|
||||||
|
version 1.2.11beta4 [June 6, 2006]
|
||||||
|
Allow zero-length IDAT chunks after the entire zlib datastream, but not
|
||||||
|
after another intervening chunk type.
|
||||||
|
|
||||||
|
version 1.0.19rc1, 1.2.11rc1 [June 13, 2006]
|
||||||
|
Deleted extraneous square brackets from [config.h] in configure.ac
|
||||||
|
|
||||||
|
version 1.0.19rc2, 1.2.11rc2 [June 14, 2006]
|
||||||
|
Added prototypes for PNG_INCH_CONVERSIONS functions to png.h
|
||||||
|
Revised INSTALL and autogen.sh
|
||||||
|
Fixed typo in several makefiles (-W1 should be -Wl)
|
||||||
|
Added typedef for png_int_32 and png_uint_32 on 64-bit systems.
|
||||||
|
|
||||||
|
version 1.0.19rc3, 1.2.11rc3 [June 15, 2006]
|
||||||
|
Removed the new typedefs for 64-bit systems (delay until version 1.4.0)
|
||||||
|
Added one zero element to png_gamma_shift[] array in pngrtran.c to avoid
|
||||||
|
reading out of bounds.
|
||||||
|
|
||||||
|
version 1.0.19rc4, 1.2.11rc4 [June 15, 2006]
|
||||||
|
Really removed the new typedefs for 64-bit systems.
|
||||||
|
|
||||||
|
version 1.0.19rc5, 1.2.11rc5 [June 22, 2006]
|
||||||
|
Removed png_sig_bytes entry from scripts/pngw32.def
|
||||||
|
|
||||||
|
version 1.0.19, 1.2.11 [June 26, 2006]
|
||||||
|
None.
|
||||||
|
|
||||||
|
version 1.0.20, 1.2.12 [June 27, 2006]
|
||||||
|
Really increased sprintf buffer from 50 to 52 chars in pngrutil.c to avoid
|
||||||
|
buffer overflow.
|
||||||
|
|
||||||
|
version 1.2.13beta1 [October 2, 2006]
|
||||||
|
Removed AC_FUNC_MALLOC from configure.ac
|
||||||
|
Work around Intel-Mac compiler bug by setting PNG_NO_MMX_CODE in pngconf.h
|
||||||
|
Change "logical" to "bitwise" throughout documentation.
|
||||||
|
Detect and fix attempt to write wrong iCCP profile length.
|
||||||
|
|
||||||
|
version 1.0.21, 1.2.13 [November 14, 2006]
|
||||||
|
Fix potential buffer overflow in sPLT chunk handler.
|
||||||
|
Fix Makefile.am to not try to link to noexistent files.
|
||||||
|
Check all exported functions for NULL png_ptr.
|
||||||
|
|
||||||
|
version 1.2.14beta1 [November 17, 2006]
|
||||||
|
Relocated three misplaced tests for NULL png_ptr.
|
||||||
|
Built Makefile.in with automake-1.9.6 instead of 1.9.2.
|
||||||
|
Build configure with autoconf-2.60 instead of 2.59
|
||||||
|
|
||||||
|
version 1.2.14beta2 [November 17, 2006]
|
||||||
|
Added some typecasts in png_zalloc().
|
||||||
|
|
||||||
|
version 1.2.14rc1 [November 20, 2006]
|
||||||
|
Changed "strtod" to "png_strtod" in pngrutil.c
|
||||||
|
|
||||||
|
version 1.0.22, 1.2.14 [November 27, 2006]
|
||||||
|
Added missing "$(srcdir)" in Makefile.am and Makefile.in
|
||||||
|
|
||||||
|
version 1.2.15beta1 [December 3, 2006]
|
||||||
|
Generated configure with autoconf-2.61 instead of 2.60
|
||||||
|
Revised configure.ac to update libpng.pc and libpng-config.
|
||||||
|
|
||||||
|
version 1.2.15beta2 [December 3, 2006]
|
||||||
|
Always export MMX asm functions, just stubs if not building pnggccrd.c
|
||||||
|
|
||||||
|
version 1.2.15beta3 [December 4, 2006]
|
||||||
|
Add "png_bytep" typecast to profile while calculating length in pngwutil.c
|
||||||
|
|
||||||
|
version 1.2.15beta4 [December 7, 2006]
|
||||||
|
Added scripts/CMakeLists.txt
|
||||||
|
Changed PNG_NO_ASSEMBLER_CODE to PNG_NO_MMX_CODE in scripts, like 1.4.0beta
|
||||||
|
|
||||||
|
version 1.2.15beta5 [December 7, 2006]
|
||||||
|
Changed some instances of PNG_ASSEMBLER_* to PNG_MMX_* in pnggccrd.c
|
||||||
|
Revised scripts/CMakeLists.txt
|
||||||
|
|
||||||
|
version 1.2.15beta6 [December 13, 2006]
|
||||||
|
Revised scripts/CMakeLists.txt and configure.ac
|
||||||
|
|
||||||
|
version 1.2.15rc1 [December 18, 2006]
|
||||||
|
Revised scripts/CMakeLists.txt
|
||||||
|
|
||||||
|
version 1.2.15rc2 [December 21, 2006]
|
||||||
|
Added conditional #undef jmpbuf in pngtest.c to undo #define in AIX headers.
|
||||||
|
Added scripts/makefile.nommx
|
||||||
|
|
||||||
|
version 1.2.15rc3 [December 25, 2006]
|
||||||
|
Fixed shared library numbering error that was intruduced in 1.2.15beta6.
|
||||||
|
|
||||||
|
version 1.2.15rc4 [December 27, 2006]
|
||||||
|
Fixed handling of rgb_to_gray when png_ptr->color.gray isn't set.
|
||||||
|
|
||||||
|
version 1.2.15rc5 [December 31, 2006]
|
||||||
|
Revised handling of rgb_to_gray.
|
||||||
|
|
||||||
|
version 1.2.15 [January 5, 2007]
|
||||||
|
Added some (unsigned long) typecasts in pngtest.c to avoid printing errors.
|
||||||
|
|
||||||
|
version 1.2.16beta1 [January 6, 2007]
|
||||||
|
Fix bugs in makefile.nommx
|
||||||
|
|
||||||
|
version 1.2.16beta2 [January 16, 2007]
|
||||||
|
Revised scripts/CMakeLists.txt
|
||||||
|
|
||||||
|
version 1.2.16 [January 31, 2007]
|
||||||
|
No changes.
|
||||||
|
|
||||||
|
version 1.2.17beta1 [March 6, 2007]
|
||||||
|
Revised scripts/CMakeLists.txt to install both shared and static libraries.
|
||||||
|
Deleted a redundant line from pngset.c.
|
||||||
|
|
||||||
|
version 1.2.17beta2 [April 26, 2007]
|
||||||
|
Relocated misplaced test for png_ptr == NULL in pngpread.c
|
||||||
|
Change "==" to "&" for testing PNG_RGB_TO_GRAY_ERR & PNG_RGB_TO_GRAY_WARN
|
||||||
|
flags.
|
||||||
|
Changed remaining instances of PNG_ASSEMBLER_* to PNG_MMX_*
|
||||||
|
Added pngerror() when write_IHDR fails in deflateInit2().
|
||||||
|
Added "const" to some array declarations.
|
||||||
|
Mention examples of libpng usage in the libpng*.txt and libpng.3 documents.
|
||||||
|
|
||||||
|
version 1.2.17rc1 [May 4, 2007]
|
||||||
|
No changes.
|
||||||
|
|
||||||
|
version 1.2.17rc2 [May 8, 2007]
|
||||||
|
Moved several PNG_HAVE_* macros out of PNG_INTERNAL because applications
|
||||||
|
calling set_unknown_chunk_location() need them.
|
||||||
|
Changed transformation flag from PNG_EXPAND_tRNS to PNG_EXPAND in
|
||||||
|
png_set_expand_gray_1_2_4_to_8().
|
||||||
|
Added png_ptr->unknown_chunk to hold working unknown chunk data, so it
|
||||||
|
can be free'ed in case of error. Revised unknown chunk handling in
|
||||||
|
pngrutil.c and pngpread.c to use this structure.
|
||||||
|
|
||||||
|
version 1.2.17rc3 [May 8, 2007]
|
||||||
|
Revised symbol-handling in configure script.
|
||||||
|
|
||||||
|
version 1.2.17rc4 [May 10, 2007]
|
||||||
|
Revised unknown chunk handling to avoid storing unknown critical chunks.
|
||||||
|
|
||||||
|
version 1.0.25 [May 15, 2007]
|
||||||
|
version 1.2.17 [May 15, 2007]
|
||||||
|
Added "png_ptr->num_trans=0" before error return in png_handle_tRNS,
|
||||||
|
to eliminate a vulnerability (CVE-2007-2445, CERT VU#684664)
|
||||||
|
|
||||||
|
version 1.0.26 [May 15, 2007]
|
||||||
|
version 1.2.18 [May 15, 2007]
|
||||||
|
Reverted the libpng-1.2.17rc3 change to symbol-handling in configure script
|
||||||
|
|
||||||
|
version 1.2.19beta1 [May 18, 2007]
|
||||||
|
Changed "const static" to "static PNG_CONST" everywhere, mostly undoing
|
||||||
|
change of libpng-1.2.17beta2. Changed other "const" to "PNG_CONST"
|
||||||
|
Changed some handling of unused parameters, to avoid compiler warnings.
|
||||||
|
"if (unused == NULL) return;" becomes "unused = unused".
|
||||||
|
|
||||||
|
version 1.2.19beta2 [May 18, 2007]
|
||||||
|
Only use the valid bits of tRNS value in png_do_expand() (Brian Cartier)
|
||||||
|
|
||||||
|
version 1.2.19beta3 [May 19, 2007]
|
||||||
|
Add some "png_byte" typecasts in png_check_keyword() and write new_key
|
||||||
|
instead of key in zTXt chunk (Kevin Ryde).
|
||||||
|
|
||||||
|
version 1.2.19beta4 [May 21, 2007]
|
||||||
|
Add png_snprintf() function and use it in place of sprint() for improved
|
||||||
|
defense against buffer overflows.
|
||||||
|
|
||||||
|
version 1.2.19beta5 [May 21, 2007]
|
||||||
|
Fixed png_handle_tRNS() to only use the valid bits of tRNS value.
|
||||||
|
Changed handling of more unused parameters, to avoid compiler warnings.
|
||||||
|
Removed some PNG_CONST in pngwutil.c to avoid compiler warnings.
|
||||||
|
|
||||||
|
version 1.2.19beta6 [May 22, 2007]
|
||||||
|
Added some #ifdef PNG_MMX_CODE_SUPPORTED where needed in pngvcrd.c
|
||||||
|
Added a special "_MSC_VER" case that defines png_snprintf to _snprintf
|
||||||
|
|
||||||
|
version 1.2.19beta7 [May 22, 2007]
|
||||||
|
Squelched png_squelch_warnings() in pnggccrd.c and added an
|
||||||
|
#ifdef PNG_MMX_CODE_SUPPORTED block around the declarations that caused
|
||||||
|
the warnings that png_squelch_warnings was squelching.
|
||||||
|
|
||||||
|
version 1.2.19beta8 [May 22, 2007]
|
||||||
|
Removed __MMX__ from test in pngconf.h.
|
||||||
|
|
||||||
|
version 1.2.19beta9 [May 23, 2007]
|
||||||
|
Made png_squelch_warnings() available via PNG_SQUELCH_WARNINGS macro.
|
||||||
|
Revised png_squelch_warnings() so it might work.
|
||||||
|
Updated makefile.sgcc and makefile.solaris; added makefile.solaris-x86.
|
||||||
|
|
||||||
|
version 1.2.19beta10 [May 24, 2007]
|
||||||
|
Resquelched png_squelch_warnings(), use "__attribute__((used))" instead.
|
||||||
|
|
||||||
|
version 1.4.0beta1 [April 20, 2006]
|
||||||
Enabled iTXt support (changes png_struct, thus requires so-number change).
|
Enabled iTXt support (changes png_struct, thus requires so-number change).
|
||||||
Removed deprecated functions png_read_init, png_write_init, png_info_init,
|
|
||||||
png_permit_empty_plte, png_set_gray_1_2_4_to_8, and removed the
|
|
||||||
deprecated macro PNG_MAX_UINT.
|
|
||||||
Cleaned up PNG_ASSEMBLER_CODE_SUPPORTED vs PNG_MMX_CODE_SUPPORTED
|
Cleaned up PNG_ASSEMBLER_CODE_SUPPORTED vs PNG_MMX_CODE_SUPPORTED
|
||||||
Cleaned up WINCE project.
|
Eliminated PNG_1_0_X and PNG_1_2_X macros.
|
||||||
Moved "PNG_INTERNAL" parts of png.h into a new private header, pngintrn.h
|
Removed deprecated functions png_read_init, png_write_init, png_info_init,
|
||||||
|
png_permit_empty_plte, png_set_gray_1_2_4_to_8, png_check_sig, and
|
||||||
|
removed the deprecated macro PNG_MAX_UINT.
|
||||||
|
Moved "PNG_INTERNAL" parts of png.h and pngconf.h into pngintrn.h
|
||||||
|
Removed many WIN32_WCE #ifdefs (Cosmin).
|
||||||
|
Reduced dependency on C-runtime library when on Windows (Simon-Pierre)
|
||||||
|
Replaced sprintf() with png_sprintf() (Simon-Pierre)
|
||||||
|
|
||||||
|
version 1.4.0beta2 [April 20, 2006]
|
||||||
|
Revised makefiles and configure to avoid making links to libpng.so.*
|
||||||
|
Moved some leftover MMX-related defines from pngconf.h to pngintrn.h
|
||||||
|
Updated scripts/pngos2.def, pngw32.def, and projects/wince/png32ce.def
|
||||||
|
|
||||||
|
version 1.4.0beta3 [May 10, 2006]
|
||||||
|
Updated scripts/pngw32.def to comment out MMX functions.
|
||||||
|
Added PNG_NO_GET_INT_32 and PNG_NO_SAVE_INT_32 macros.
|
||||||
|
Scripts/libpng.pc.in contained "configure" style version info and would
|
||||||
|
not work with makefiles.
|
||||||
|
Revised pngconf.h and added pngconf.h.in, so makefiles and configure can
|
||||||
|
pass defines to libpng and applications.
|
||||||
|
|
||||||
|
version 1.4.0beta4 [May 11, 2006]
|
||||||
|
Revised configure.ac, Makefile.am, and many of the makefiles to write
|
||||||
|
their defines in pngconf.h.
|
||||||
|
|
||||||
|
version 1.4.0beta5 [May 15, 2006]
|
||||||
|
Added a missing semicolon in Makefile.am and Makefile.in
|
||||||
|
Deleted extraneous square brackets from configure.ac
|
||||||
|
|
||||||
|
version 1.4.0beta6 [June 2, 2006]
|
||||||
|
Increased sprintf buffer from 50 to 52 chars in pngrutil.c to avoid
|
||||||
|
buffer overflow.
|
||||||
|
Changed sonum from 0 to 1.
|
||||||
|
Removed unused prototype for png_check_sig() from png.h
|
||||||
|
|
||||||
|
version 1.4.0beta7 [June 16, 2006]
|
||||||
|
Exported png_write_sig (Cosmin).
|
||||||
|
Optimized buffer in png_handle_cHRM() (Cosmin).
|
||||||
|
Set pHYs = 2835 x 2835 pixels per meter, and added
|
||||||
|
sCAL = 0.352778e-3 x 0.352778e-3 meters, in pngtest.png (Cosmin).
|
||||||
|
Added png_set_benign_errors(), png_benign_error(), png_chunk_benign_error().
|
||||||
|
Added typedef for png_int_32 and png_uint_32 on 64-bit systems.
|
||||||
|
Added "(unsigned long)" typecast on png_uint_32 variables in printf lists.
|
||||||
|
|
||||||
|
version 1.4.0beta8 [June 22, 2006]
|
||||||
|
Added demonstration of user chunk support in pngtest.c, to support the
|
||||||
|
public sTER chunk and a private vpAg chunk.
|
||||||
|
|
||||||
|
version 1.4.0beta9 [July 3, 2006]
|
||||||
|
Removed ordinals from scripts/pngw32.def and removed png_info_int and
|
||||||
|
png_set_gray_1_2_4_to_8 entries.
|
||||||
|
Inline call of png_get_uint_32() in png_get_uint_31().
|
||||||
|
Use png_get_uint_31() to get vpAg width and height in pngtest.c
|
||||||
|
Removed WINCE and Netware projects.
|
||||||
|
Removed standalone Y2KINFO file.
|
||||||
|
|
||||||
|
version 1.4.0beta10 [July 12, 2006]
|
||||||
|
Eliminated automatic copy of pngconf.h to pngconf.h.in from configure and
|
||||||
|
some makefiles, because it was not working reliably. Instead, distribute
|
||||||
|
pngconf.h.in along with pngconf.h and cause configure and some of the
|
||||||
|
makefiles to update pngconf.h from pngconf.h.in.
|
||||||
|
Added pngconf.h to DEPENDENCIES in Makefile.am
|
||||||
|
|
||||||
|
version 1.4.0beta11 [August 19, 2006]
|
||||||
|
Removed AC_FUNC_MALLOC from configure.ac.
|
||||||
|
Added a warning when writing iCCP profile with mismatched profile length.
|
||||||
|
Patched pnggccrd.c to assemble on x86_64 platforms.
|
||||||
|
Moved chunk header reading into a separate function png_read_chunk_header()
|
||||||
|
in pngrutil.c. The chunk header (len+sig) is now serialized in a single
|
||||||
|
operation (Cosmin).
|
||||||
|
Implemented support for I/O states. Added png_ptr member io_state, and
|
||||||
|
functions png_get_io_chunk_name() and png_get_io_state() in pngget.c
|
||||||
|
(Cosmin).
|
||||||
|
Added png_get_io_chunk_name and png_get_io_state to scripts/*.def (Cosmin).
|
||||||
|
Renamed scripts/pngw32.* to scripts/pngwin.* (Cosmin).
|
||||||
|
Removed the include directories and libraries from CFLAGS and LDFLAGS
|
||||||
|
in scripts/makefile.gcc (Cosmin).
|
||||||
|
Used png_save_uint_32() to set vpAg width and height in pngtest.c (Cosmin).
|
||||||
|
Cast to proper type when getting/setting vpAg units in pngtest.c (Cosmin).
|
||||||
|
Added pngintrn.h to the Visual C++ projects (Cosmin).
|
||||||
|
Removed scripts/list (Cosmin).
|
||||||
|
Updated copyright year in scripts/pngwin.def (Cosmin).
|
||||||
|
Removed PNG_TYPECAST_NULL and used standard NULL consistently (Cosmin).
|
||||||
|
Disallowed the user to redefine png_size_t, and enforced a consistent use
|
||||||
|
of png_size_t across libpng (Cosmin).
|
||||||
|
Changed the type of png_ptr->rowbytes, PNG_ROWBYTES() and friends
|
||||||
|
to png_size_t (Cosmin).
|
||||||
|
Removed png_convert_size() and replaced png_sizeof with sizeof (Cosmin).
|
||||||
|
Removed some unnecessary type casts (Cosmin).
|
||||||
|
Changed prototype of png_get_compression_buffer_size() and
|
||||||
|
png_set_compression_buffer_size() to work with png_size_t instead of
|
||||||
|
png_uint_32 (Cosmin).
|
||||||
|
Removed png_memcpy_check() and png_memset_check() (Cosmin).
|
||||||
|
Fixed a typo (png_byte --> png_bytep) in libpng.3 and libpng.txt (Cosmin).
|
||||||
|
Clarified that png_zalloc() does not clear the allocated memory,
|
||||||
|
and png_zalloc() and png_zfree() cannot be PNGAPI (Cosmin).
|
||||||
|
Renamed png_mem_size_t to png_alloc_size_t, fixed its definition in
|
||||||
|
pngconf.h, and used it in all memory allocation functions (Cosmin).
|
||||||
|
Renamed pngintrn.h to pngpriv.h, added a comment at the top of the file
|
||||||
|
mentioning that the symbols declared in that file are private, and
|
||||||
|
updated the scripts and the Visual C++ projects accordingly (Cosmin).
|
||||||
|
Removed circular references between pngconf.h and pngconf.h.in in
|
||||||
|
scripts/makefile.vc*win32 (Cosmin).
|
||||||
|
Removing trailing '.' from the warning and error messages (Cosmin).
|
||||||
|
Added pngdefs.h that is built by makefile or configure, instead of
|
||||||
|
pngconf.h.in (Glenn).
|
||||||
|
Detect and fix attempt to write wrong iCCP profile length.
|
||||||
|
|
||||||
|
version 1.4.0beta12 [October 19, 2006]
|
||||||
|
Changed "logical" to "bitwise" in the documentation.
|
||||||
|
Work around Intel-Mac compiler bug by setting PNG_NO_MMX_CODE in pngconf.h
|
||||||
|
Add a typecast to stifle compiler warning in pngrutil.c
|
||||||
|
|
||||||
|
version 1.4.0beta13 [November 10, 2006]
|
||||||
|
Fix potential buffer overflow in sPLT chunk handler.
|
||||||
|
Fix Makefile.am to not try to link to noexistent files.
|
||||||
|
|
||||||
|
version 1.4.0beta14 [November 15, 2006]
|
||||||
|
Check all exported functions for NULL png_ptr.
|
||||||
|
|
||||||
|
version 1.4.0beta15 [November 17, 2006]
|
||||||
|
Relocated two misplaced tests for NULL png_ptr.
|
||||||
|
Built Makefile.in with automake-1.9.6 instead of 1.9.2.
|
||||||
|
Build configure with autoconf-2.60 instead of 2.59
|
||||||
|
Add "install: all" in Makefile.am so "configure; make install" will work.
|
||||||
|
|
||||||
|
version 1.4.0beta16 [November 17, 2006]
|
||||||
|
Added a typecast in png_zalloc().
|
||||||
|
|
||||||
|
version 1.4.0beta17 [December 4, 2006]
|
||||||
|
Changed "new_key[79] = '\0';" to "(*new_key)[79] = '\0';" in pngwutil.c
|
||||||
|
Add "png_bytep" typecast to profile while calculating length in pngwutil.c
|
||||||
|
|
||||||
|
version 1.4.0beta18 [December 7, 2006]
|
||||||
|
Added scripts/CMakeLists.txt
|
||||||
|
|
||||||
|
version 1.4.0beta19 [May 16, 2007]
|
||||||
|
Revised scripts/CMakeLists.txt
|
||||||
|
Rebuilt configure and Makefile.in with newer tools.
|
||||||
|
Added conditional #undef jmpbuf in pngtest.c to undo #define in AIX headers.
|
||||||
|
Added scripts/makefile.nommx
|
||||||
|
|
||||||
|
version 1.4.0beta20 [July 9, 2008]
|
||||||
|
Moved several PNG_HAVE_* macros from pngpriv.h to png.h because applications
|
||||||
|
calling set_unknown_chunk_location() need them.
|
||||||
|
Moved several macro definitions from pngpriv.h to pngconf.h
|
||||||
|
Merge with changes to the 1.2.X branch, as of 1.2.30beta04.
|
||||||
|
Deleted all use of the MMX assembler code and Intel-licensed optimizations.
|
||||||
|
Revised makefile.mingw
|
||||||
|
|
||||||
|
version 1.4.0beta21 [July 21, 2008]
|
||||||
|
Moved local array "chunkdata" from pngrutil.c to the png_struct, so
|
||||||
|
it will be freed by png_read_destroy() in case of a read error (Kurt
|
||||||
|
Christensen).
|
||||||
|
|
||||||
|
version 1.4.0beta22 [July 21, 2008]
|
||||||
|
Change "purpose" and "buffer" to png_ptr->chunkdata to avoid memory leaking.
|
||||||
|
|
||||||
|
version 1.4.0beta23 [July 22, 2008]
|
||||||
|
Change "chunkdata = NULL" to "png_ptr->chunkdata = NULL" several places in
|
||||||
|
png_decompress_chunk().
|
||||||
|
|
||||||
|
version 1.4.0beta24 [July 25, 2008]
|
||||||
|
Change all remaining "chunkdata" to "png_ptr->chunkdata" in
|
||||||
|
png_decompress_chunk(), and remove "chunkdata" from parameter list.
|
||||||
|
Put a call to png_check_chunk_name() in png_read_chunk_header().
|
||||||
|
Revised png_check_chunk_name() to reject a name with a lowercase 3rd byte.
|
||||||
|
Removed two calls to png_check_chunk_name() occuring later in the process.
|
||||||
|
Define PNG_NO_ERROR_NUMBERS by default in pngconf.h
|
||||||
|
|
||||||
|
version 1.4.0beta25 [July 30, 2008]
|
||||||
|
Added a call to png_check_chunk_name() in pngpread.c
|
||||||
|
Reverted png_check_chunk_name() to accept a name with a lowercase 3rd byte.
|
||||||
|
Added png_push_have_buffer() function to pngpread.c
|
||||||
|
Eliminated PNG_BIG_ENDIAN_SUPPORTED and associated png_get_* macros.
|
||||||
|
Made inline expansion of png_get_*() optional with PNG_USE_READ_MACROS.
|
||||||
|
Eliminated all PNG_USELESS_TESTS and PNG_CORRECT_PALETTE_SUPPORTED code.
|
||||||
|
Synced contrib directory and configure files with libpng-1.2.30beta06.
|
||||||
|
Eliminated no-longer-used pngdefs.h (but it's still built in the makefiles)
|
||||||
|
Relocated a misplaced "#endif /* PNG_NO_WRITE_FILTER */" in pngwutil.c
|
||||||
|
|
||||||
|
version 1.4.0beta26 [August 4, 2008]
|
||||||
|
Removed png_push_have_buffer() function in pngpread.c. It increased the
|
||||||
|
compiled library size slightly.
|
||||||
|
Changed "-Wall" to "-W -Wall" in the CFLAGS in all makefiles (Cosmin Truta)
|
||||||
|
Declared png_ptr "volatile" in pngread.c and pngwrite.c to avoid warnings.
|
||||||
|
Updated contrib/visupng/cexcept.h to version 2.0.1
|
||||||
|
Added PNG_LITERAL_CHARACTER macros for #, [, and ].
|
||||||
|
|
||||||
|
version 1.4.0beta27 [August 5, 2008]
|
||||||
|
Revised usage of PNG_LITERAL_SHARP in pngerror.c.
|
||||||
|
Moved newline character from individual png_debug messages into the
|
||||||
|
png_debug macros.
|
||||||
|
Allow user to #define their own png_debug, png_debug1, and png_debug2.
|
||||||
|
|
||||||
|
version 1.4.0beta28 [August 5, 2008]
|
||||||
|
Revised usage of PNG_LITERAL_SHARP in pngerror.c.
|
||||||
|
Added PNG_STRING_NEWLINE macro
|
||||||
|
|
||||||
|
version 1.4.0beta29 [August 9, 2008]
|
||||||
|
Revised usage of PNG_STRING_NEWLINE to work on non-ISO compilers.
|
||||||
|
Added PNG_STRING_COPYRIGHT macro.
|
||||||
|
Added non-ISO versions of png_debug macros.
|
||||||
|
|
||||||
|
version 1.4.0beta30 [August 14, 2008]
|
||||||
|
Added premultiplied alpha feature (Volker Wiendl).
|
||||||
|
|
||||||
|
version 1.4.0beta31 [August 18, 2008]
|
||||||
|
Moved png_set_premultiply_alpha from pngtrans.c to pngrtran.c
|
||||||
|
Removed extra crc check at the end of png_handle_cHRM(). Bug introduced
|
||||||
|
in libpng-1.4.0beta20.
|
||||||
|
|
||||||
|
version 1.4.0beta32 [August 19, 2008]
|
||||||
|
Added PNG_WRITE_FLUSH_SUPPORTED block around new png_flush() call.
|
||||||
|
Revised PNG_NO_STDIO version of png_write_flush()
|
||||||
|
|
||||||
|
version 1.4.0beta33 [August 20, 2008]
|
||||||
|
Added png_get|set_chunk_cache_max() to limit the total number of sPLT,
|
||||||
|
text, and unknown chunks that can be stored.
|
||||||
|
|
||||||
|
version 1.4.0beta34 [September 6, 2008]
|
||||||
|
Shortened tIME_string to 29 bytes in pngtest.c
|
||||||
|
Fixed off-by-one error introduced in png_push_read_zTXt() function in
|
||||||
|
libpng-1.2.30beta04/pngpread.c (Harald van Dijk)
|
||||||
|
|
||||||
|
version 1.4.0beta35 [October 6, 2008]
|
||||||
|
Changed "trans_values" to "trans_color".
|
||||||
|
Changed so-number from 0 to 14. Some OS do not like 0.
|
||||||
|
Revised makefile.darwin to fix shared library numbering.
|
||||||
|
Change png_set_gray_1_2_4_to_8() to png_set_expand_gray_1_2_4_to_8()
|
||||||
|
in example.c (debian bug report)
|
||||||
|
|
||||||
|
version 1.4.0beta36 [October 25, 2008]
|
||||||
|
Sync with tEXt vulnerability fix in libpng-1.2.33rc02.
|
||||||
|
|
||||||
|
version 1.4.0beta37 [November 13, 2008]
|
||||||
|
Added png_check_cHRM in png.c and moved checking from pngget.c, pngrutil.c,
|
||||||
|
and pngwrite.c
|
||||||
|
|
||||||
|
version 1.4.0beta38 [November 22, 2008]
|
||||||
|
Added check for zero-area RGB cHRM triangle in png_check_cHRM() and
|
||||||
|
png_check_cHRM_fixed().
|
||||||
|
|
||||||
|
version 1.4.0beta39 [November 23, 2008]
|
||||||
|
Revised png_warning() to write its message on standard output by default
|
||||||
|
when warning_fn is NULL.
|
||||||
|
|
||||||
|
version 1.4.0beta40 [November 24, 2008]
|
||||||
|
Eliminated png_check_cHRM(). Instead, always use png_check_cHRM_fixed().
|
||||||
|
In png_check_cHRM_fixed(), ensure white_y is > 0, and removed redundant
|
||||||
|
check for all-zero coordinates that is detected by the triangle check.
|
||||||
|
|
||||||
|
version 1.4.0beta41 [November 26, 2008]
|
||||||
|
Fixed string vs pointer-to-string error in png_check_keyword().
|
||||||
|
Rearranged test expressions in png_check_cHRM_fixed() to avoid internal
|
||||||
|
overflows.
|
||||||
|
Added PNG_NO_CHECK_cHRM conditional.
|
||||||
|
|
||||||
|
version 1.4.0beta42, 43 [December 1, 2008]
|
||||||
|
Merge png_debug with version 1.2.34beta04.
|
||||||
|
|
||||||
|
version 1.4.0beta44 [December 6, 2008]
|
||||||
|
Removed redundant check for key==NULL before calling png_check_keyword()
|
||||||
|
to ensure that new_key gets initialized and removed extra warning
|
||||||
|
(Merge with version 1.2.34beta05 -- Arvan Pritchard).
|
||||||
|
|
||||||
|
version 1.4.0beta45 [December 9, 2008]
|
||||||
|
In png_write_png(), respect the placement of the filler bytes in an earlier
|
||||||
|
call to png_set_filler() (Jim Barry).
|
||||||
|
|
||||||
|
version 1.4.0beta46 [December 10, 2008]
|
||||||
|
Undid previous change and added PNG_TRANSFORM_STRIP_FILLER_BEFORE and
|
||||||
|
PNG_TRANSFORM_STRIP_FILLER_AFTER conditionals and deprecated
|
||||||
|
PNG_TRANSFORM_STRIP_FILLER (Jim Barry).
|
||||||
|
|
||||||
|
version 1.4.0beta47 [December 15, 2008]
|
||||||
|
Turned off PNG_READ_DITHER_SUPPORTED by default.
|
||||||
|
|
||||||
|
version 1.4.0beta48 [February 14, 2009]
|
||||||
|
Added new exported function png_calloc().
|
||||||
|
Combined several instances of png_malloc(); png_memset() into png_calloc().
|
||||||
|
Removed prototype for png_freeptr() that was added in libpng-1.4.0beta24
|
||||||
|
but was never defined.
|
||||||
|
|
||||||
|
version 1.4.0beta49 [February 28, 2009]
|
||||||
|
Added png_fileno() macro to pngconf.h, used in pngwio.c
|
||||||
|
Corrected order of #ifdef's in png_debug definition in png.h
|
||||||
|
Fixed bug introduced in libpng-1.4.0beta48 with the memset arguments
|
||||||
|
for pcal_params.
|
||||||
|
Fixed order of #ifdef directives in the png_debug defines in png.h
|
||||||
|
(bug introduced in libpng-1.2.34/1.4.0beta29).
|
||||||
|
Revised comments in png_set_read_fn() and png_set_write_fn().
|
||||||
|
|
||||||
|
version 1.4.0betaN [future]
|
||||||
|
Build shared libraries with -lz and sometimes -lm.
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
(subscription required; visit
|
||||||
|
|||||||
55
INSTALL
55
INSTALL
@@ -1,16 +1,24 @@
|
|||||||
|
|
||||||
Installing libpng version 1.2.10rc1 - April 19, 2006
|
Installing libpng version 1.4.0beta49 - February 28, 2009
|
||||||
|
|
||||||
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
|
||||||
@@ -24,12 +32,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), copy CMakeLists.txt
|
||||||
|
from the "scripts" directory to this directory and 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.0beta49" or "lpng109" and "zlib-1.2.1"
|
||||||
or "zlib121") so that you have directories called "zlib" and "libpng".
|
or "zlib121") so that you have directories called "zlib" and "libpng".
|
||||||
|
|
||||||
Your directory structure should look like this:
|
Your directory structure should look like this:
|
||||||
@@ -49,8 +64,6 @@ Your directory structure should look like this:
|
|||||||
beos
|
beos
|
||||||
c5builder (Borland)
|
c5builder (Borland)
|
||||||
visualc6 (msvc)
|
visualc6 (msvc)
|
||||||
netware.txt
|
|
||||||
wince.txt
|
|
||||||
scripts
|
scripts
|
||||||
makefile.*
|
makefile.*
|
||||||
pngtest.png
|
pngtest.png
|
||||||
@@ -70,11 +83,7 @@ If you are building libpng with MSVC, you can enter the
|
|||||||
libpng projects\visualc6 directory and follow the instructions in
|
libpng projects\visualc6 directory and follow the instructions in
|
||||||
projects\visualc6\README.txt.
|
projects\visualc6\README.txt.
|
||||||
|
|
||||||
You can build libpng for WindowsCE by downloading and installing
|
You can build libpng for beos as instructed in projects\beos.
|
||||||
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,
|
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
|
||||||
@@ -83,14 +92,18 @@ makefile.sys in the scripts directory.
|
|||||||
The files that are presently available in the scripts directory
|
The files that are presently available in the scripts directory
|
||||||
include
|
include
|
||||||
|
|
||||||
|
CMakeLists.txt => "cmake" script
|
||||||
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.0beta49)
|
||||||
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.0beta49)
|
||||||
makefile.gcmmx => Linux/ELF makefile
|
makefile.gcmmx => Linux/ELF makefile
|
||||||
(gcc, creates libpng12.so.0.1.2.10rc1,
|
(gcc, creates libpng14.so.14.1.4.0beta49,
|
||||||
uses assembler code tuned for Intel MMX platform)
|
uses assembler code tuned for Intel MMX platform)
|
||||||
|
makefile.nommx => Linux/ELF makefile
|
||||||
|
(gcc, creates libpng14.so.14.1.4.0beta49
|
||||||
|
does not use Intel MMX assembler code)
|
||||||
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
|
||||||
@@ -107,17 +120,17 @@ include
|
|||||||
makefile.intel => Intel C/C++ version 4.0 and later
|
makefile.intel => Intel C/C++ version 4.0 and later
|
||||||
libpng.icc => Project file for IBM VisualAge/C++ version 4.0 or 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.netbsd => NetBSD/cc makefile, uses PNGGCCRD, makes libpng.so.
|
||||||
makefile.ne12bsd => NetBSD/cc makefile, uses PNGGCCRD,
|
makefile.ne14bsd => NetBSD/cc makefile, uses PNGGCCRD,
|
||||||
makes libpng12.so
|
makes libpng14.so
|
||||||
makefile.openbsd => OpenBSD makefile
|
makefile.openbsd => OpenBSD makefile
|
||||||
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
|
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
|
||||||
makefile.sggcc => Silicon Graphics (gcc,
|
makefile.sggcc => Silicon Graphics (gcc,
|
||||||
creates libpng12.so.0.1.2.10rc1)
|
creates libpng14.so.14.1.4.0beta49)
|
||||||
makefile.sunos => Sun makefile
|
makefile.sunos => Sun makefile
|
||||||
makefile.solaris => Solaris 2.X makefile (gcc,
|
makefile.solaris => Solaris 2.X makefile (gcc,
|
||||||
creates libpng12.so.0.1.2.10rc1)
|
creates libpng14.so.14.1.4.0beta49)
|
||||||
makefile.so9 => Solaris 9 makefile (gcc,
|
makefile.so9 => Solaris 9 makefile (gcc,
|
||||||
creates libpng12.so.0.1.2.10rc1)
|
creates libpng14.so.14.1.4.0beta49)
|
||||||
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
|
||||||
@@ -197,7 +210,7 @@ which previously was done semi-automatically (if you didn't edit
|
|||||||
scripts/makefile.* yourself, that is)
|
scripts/makefile.* yourself, that is)
|
||||||
|
|
||||||
|
|
||||||
CFLAGS="-Wall -O3 -funroll-loops \
|
CFLAGS="-Wall -O -funroll-loops \
|
||||||
-malign-loops=2 -malign-functions=2" ./configure --prefix=/usr/include \
|
-malign-loops=2 -malign-functions=2" ./configure --prefix=/usr/include \
|
||||||
--with-pkgconfigdir=/usr/lib/pkgconfig --includedir=/usr/include
|
--with-pkgconfigdir=/usr/lib/pkgconfig --includedir=/usr/include
|
||||||
|
|
||||||
|
|||||||
6
KNOWNBUG
6
KNOWNBUG
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
Known bugs in libpng version 1.2.10rc1
|
Known bugs in libpng version 1.4.0beta49
|
||||||
|
|
||||||
1. April 22, 2001: pnggccrd.c has been reported to crash on NetBSD when
|
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
|
reading interlaced PNG files, when assembler code is enabled but running
|
||||||
@@ -21,3 +21,7 @@ Known bugs in libpng version 1.2.10rc1
|
|||||||
|
|
||||||
STATUS: For now, system library builders should use the custom makefiles.
|
STATUS: For now, system library builders should use the custom makefiles.
|
||||||
|
|
||||||
|
4. November 14, 2006: "make install" fails to build pngdefs.h.
|
||||||
|
"make; make install" works.
|
||||||
|
|
||||||
|
STATUS: Under investigation.
|
||||||
|
|||||||
6
LICENSE
6
LICENSE
@@ -8,8 +8,8 @@ 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
|
libpng versions 1.2.6, August 15, 2004, through 1.4.0beta49, February 28, 2009, are
|
||||||
Copyright (c) 2004, 2006 Glenn Randers-Pehrson, and are
|
Copyright (c) 2004, 2006-2007 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 +106,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
|
February 28, 2009
|
||||||
|
|||||||
82
Makefile.am
82
Makefile.am
@@ -8,7 +8,7 @@
|
|||||||
# -version-number settings below so that the new values have
|
# -version-number settings below so that the new values have
|
||||||
# the correct major part (first field).
|
# 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,7 +16,7 @@ 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 = libpng14.la
|
||||||
TESTS = test-pngtest.sh
|
TESTS = test-pngtest.sh
|
||||||
TESTS_ENVIRONMENT= srcdir=$(srcdir)
|
TESTS_ENVIRONMENT= srcdir=$(srcdir)
|
||||||
|
|
||||||
@@ -24,39 +24,42 @@ TESTS_ENVIRONMENT= srcdir=$(srcdir)
|
|||||||
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= libpng14-config
|
||||||
EXTRA_SCRIPTS= libpng-config libpng12-config
|
EXTRA_SCRIPTS= libpng-config libpng14-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=libpng14.la @compatlib@
|
||||||
EXTRA_LTLIBRARIES= libpng.la
|
EXTRA_LTLIBRARIES= libpng.la
|
||||||
libpng12_la_SOURCES = png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
|
libpng14_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
|
||||||
libpng_la_SOURCES = $(libpng12_la_SOURCES)
|
libpng_la_SOURCES = $(libpng14_la_SOURCES)
|
||||||
|
|
||||||
libpng_la_CPPFLAGS = @LIBPNG_DEFINES@
|
libpng_la_CPPFLAGS = @LIBPNG_DEFINES@
|
||||||
libpng12_la_CPPFLAGS = @LIBPNG_DEFINES@
|
libpng14_la_CPPFLAGS = @LIBPNG_DEFINES@
|
||||||
|
|
||||||
# MAJOR UPGRADE: the version-number settings below must be changed.
|
# MAJOR UPGRADE: the version-number settings below must be changed.
|
||||||
libpng12_la_LDFLAGS = -no-undefined -export-dynamic \
|
libpng14_la_LDFLAGS = -no-undefined -export-dynamic \
|
||||||
-version-number 0:@PNGLIB_MINOR@:0
|
-version-number 14:@PNGLIB_RELEASE@:14
|
||||||
# -rpath is needed as automake doesn't know the directory
|
# -rpath is needed as automake doesn't know the directory
|
||||||
libpng_la_LDFLAGS = -rpath '$(libdir)' -no-undefined -export-dynamic \
|
libpng_la_LDFLAGS = -rpath '$(libdir)' -no-undefined -export-dynamic \
|
||||||
-version-number 3:@PNGLIB_MINOR@:0
|
-version-number 14:@PNGLIB_RELEASE@:14
|
||||||
|
|
||||||
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
|
libpng14_la_LDFLAGS += -Wl,--version-script=libpng.vers
|
||||||
libpng12_la_DEPENDENCIES = libpng.vers
|
libpng14_la_DEPENDENCIES = libpng.vers
|
||||||
else
|
else
|
||||||
# Only restricted exports when possible
|
# Only restricted exports when possible
|
||||||
libpng12_la_LDFLAGS += -export-symbols libpng.sym
|
libpng14_la_LDFLAGS += -export-symbols libpng.sym
|
||||||
libpng12_la_DEPENDENCIES = libpng.sym
|
libpng14_la_DEPENDENCIES = libpng.sym
|
||||||
endif
|
endif
|
||||||
libpng_la_DEPENDENCIES = $(libpng12_la_DEPENDENCIES)
|
libpng_la_DEPENDENCIES = $(libpng14_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,7 +68,7 @@ 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 = libpng14.pc
|
||||||
|
|
||||||
#extra source distribution files.
|
#extra source distribution files.
|
||||||
EXTRA_DIST= \
|
EXTRA_DIST= \
|
||||||
@@ -83,9 +86,13 @@ EXTRA_DIST= \
|
|||||||
${srcdir}/contrib/pngsuite/* \
|
${srcdir}/contrib/pngsuite/* \
|
||||||
${srcdir}/contrib/visupng/* \
|
${srcdir}/contrib/visupng/* \
|
||||||
$(TESTS) \
|
$(TESTS) \
|
||||||
example.c libpng.txt pngvcrd.c
|
example.c libpng-1.4.0beta49.txt pngvcrd.c
|
||||||
|
|
||||||
CLEANFILES= pngout.png libpng12.pc libpng12-config libpng.vers libpng.sym
|
CLEANFILES= pngout.png libpng14.pc libpng14-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,39 +103,42 @@ $(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 libpng14 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 sl dylib; 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
|
||||||
@@ -137,7 +147,7 @@ uninstall-hook:
|
|||||||
@if test -n "@compatlib@"; then\
|
@if test -n "@compatlib@"; then\
|
||||||
set -x;\
|
set -x;\
|
||||||
cd $(DESTDIR)$(libdir);\
|
cd $(DESTDIR)$(libdir);\
|
||||||
for ext in a la so; do\
|
for ext in a la so sl dylib; do\
|
||||||
rm -f libpng.$$ext;\
|
rm -f libpng.$$ext;\
|
||||||
done;\
|
done;\
|
||||||
fi
|
fi
|
||||||
|
|||||||
631
Makefile.in
631
Makefile.in
File diff suppressed because it is too large
Load Diff
22
README
22
README
@@ -1,4 +1,4 @@
|
|||||||
README for libpng version 1.2.10rc1 - April 19, 2006 (shared library 12.0)
|
README for libpng version 1.4.0beta49 - February 28, 2009 (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.
|
||||||
@@ -180,21 +180,15 @@ Files in this distribution:
|
|||||||
and zlib
|
and zlib
|
||||||
visualc6 => Contains a Microsoft Visual C++ (MSVC) workspace
|
visualc6 => Contains a Microsoft Visual C++ (MSVC) workspace
|
||||||
for building libpng and zlib
|
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.0beta49)
|
||||||
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.0beta49)
|
||||||
makefile.gcmmx => Linux/ELF makefile
|
makefile.gcmmx => Linux/ELF makefile
|
||||||
(gcc, creates libpng12.so.0.1.2.10rc1,
|
(gcc, creates libpng14.so.14.1.4.0beta49,
|
||||||
uses assembler code tuned for Intel MMX platform)
|
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
|
||||||
@@ -212,16 +206,16 @@ Files in this distribution:
|
|||||||
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
|
libpng.icc => Project file, IBM VisualAge/C++ 4.0 or later
|
||||||
makefile.netbsd => NetBSD/cc makefile, PNGGCCRD, makes libpng.so.
|
makefile.netbsd => NetBSD/cc makefile, PNGGCCRD, makes libpng.so.
|
||||||
makefile.ne12bsd => NetBSD/cc makefile, PNGGCCRD, makes libpng12.so
|
makefile.ne14bsd => NetBSD/cc makefile, PNGGCCRD, 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.0beta49)
|
||||||
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.0beta49)
|
||||||
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.0beta49)
|
||||||
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
|
||||||
|
|||||||
55
Y2KINFO
55
Y2KINFO
@@ -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
|
|
||||||
9169
aclocal.m4
vendored
9169
aclocal.m4
vendored
File diff suppressed because it is too large
Load Diff
@@ -4,9 +4,10 @@
|
|||||||
#
|
#
|
||||||
# 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!
|
||||||
|
touch Makefile.am configure.ac
|
||||||
{
|
{
|
||||||
echo "running libtoolize" >&2
|
echo "running libtoolize" >&2
|
||||||
libtoolize --copy --automake
|
libtoolize --force --copy --automake
|
||||||
} && {
|
} && {
|
||||||
echo "running aclocal" >&2
|
echo "running aclocal" >&2
|
||||||
aclocal
|
aclocal
|
||||||
@@ -15,7 +16,7 @@
|
|||||||
autoheader
|
autoheader
|
||||||
} && {
|
} && {
|
||||||
echo "running automake" >&2
|
echo "running automake" >&2
|
||||||
automake --foreign -a -c
|
automake --force-missing --foreign -a -c
|
||||||
} && {
|
} && {
|
||||||
echo "running autoconf" >&2
|
echo "running autoconf" >&2
|
||||||
autoconf
|
autoconf
|
||||||
|
|||||||
155
config.guess
vendored
155
config.guess
vendored
@@ -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
|
||||||
|
# Free Software Foundation, Inc.
|
||||||
|
|
||||||
timestamp='2005-12-23'
|
timestamp='2008-01-08'
|
||||||
|
|
||||||
# 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
|
||||||
@@ -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
|
||||||
@@ -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}
|
||||||
@@ -342,7 +330,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
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:SunOS:5.*:* | i86xen:SunOS:5.*:*)
|
||||||
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||||
exit ;;
|
exit ;;
|
||||||
sun4*:SunOS:6*:*)
|
sun4*:SunOS:6*:*)
|
||||||
@@ -544,7 +532,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
|
||||||
@@ -784,6 +772,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 +781,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,9 +791,18 @@ EOF
|
|||||||
i*:PW*:*)
|
i*:PW*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-pw32
|
echo ${UNAME_MACHINE}-pc-pw32
|
||||||
exit ;;
|
exit ;;
|
||||||
x86:Interix*:[345]*)
|
*:Interix*:[3456]*)
|
||||||
echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
|
case ${UNAME_MACHINE} in
|
||||||
exit ;;
|
x86)
|
||||||
|
echo i586-pc-interix${UNAME_RELEASE}
|
||||||
|
exit ;;
|
||||||
|
EM64T | authenticamd)
|
||||||
|
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 ;;
|
||||||
@@ -837,25 +836,35 @@ EOF
|
|||||||
echo ${UNAME_MACHINE}-pc-minix
|
echo ${UNAME_MACHINE}-pc-minix
|
||||||
exit ;;
|
exit ;;
|
||||||
arm*:Linux:*:*)
|
arm*:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
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 ;;
|
exit ;;
|
||||||
cris:Linux:*:*)
|
cris:Linux:*:*)
|
||||||
echo cris-axis-linux-${LIBC}
|
echo cris-axis-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
crisv32:Linux:*:*)
|
crisv32:Linux:*:*)
|
||||||
echo crisv32-axis-linux-${LIBC}
|
echo crisv32-axis-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
frv:Linux:*:*)
|
frv:Linux:*:*)
|
||||||
echo frv-unknown-linux-${LIBC}
|
echo frv-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
ia64:Linux:*:*)
|
ia64:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
m32r*:Linux:*:*)
|
m32r*:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
m68*:Linux:*:*)
|
m68*:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
mips:Linux:*:*)
|
mips:Linux:*:*)
|
||||||
eval $set_cc_for_build
|
eval $set_cc_for_build
|
||||||
@@ -873,8 +882,12 @@ EOF
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
EOF
|
EOF
|
||||||
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`"
|
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
|
||||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
|
/^CPU/{
|
||||||
|
s: ::g
|
||||||
|
p
|
||||||
|
}'`"
|
||||||
|
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
|
||||||
;;
|
;;
|
||||||
mips64:Linux:*:*)
|
mips64:Linux:*:*)
|
||||||
eval $set_cc_for_build
|
eval $set_cc_for_build
|
||||||
@@ -892,17 +905,21 @@ EOF
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
EOF
|
EOF
|
||||||
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`"
|
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
|
||||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
|
/^CPU/{
|
||||||
|
s: ::g
|
||||||
|
p
|
||||||
|
}'`"
|
||||||
|
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
|
||||||
;;
|
;;
|
||||||
or32:Linux:*:*)
|
or32:Linux:*:*)
|
||||||
echo or32-unknown-linux-${LIBC}
|
echo or32-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
ppc:Linux:*:*)
|
ppc:Linux:*:*)
|
||||||
echo powerpc-unknown-linux-${LIBC}
|
echo powerpc-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
ppc64:Linux:*:*)
|
ppc64:Linux:*:*)
|
||||||
echo powerpc64-unknown-linux-${LIBC}
|
echo powerpc64-unknown-linux-gnu
|
||||||
exit ;;
|
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
|
||||||
@@ -915,37 +932,40 @@ EOF
|
|||||||
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 ld.so.1 >/dev/null
|
||||||
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 ;;
|
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:*:*)
|
parisc64:Linux:*:* | hppa64:Linux:*:*)
|
||||||
echo hppa64-unknown-linux-${LIBC}
|
echo hppa64-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:*:*)
|
i*86:Linux:*:*)
|
||||||
# The BFD linker knows what the default object file format is, so
|
# The BFD linker knows what the default object file format is, so
|
||||||
@@ -960,22 +980,20 @@ EOF
|
|||||||
p'`
|
p'`
|
||||||
case "$ld_supported_targets" in
|
case "$ld_supported_targets" in
|
||||||
elf32-i386)
|
elf32-i386)
|
||||||
TENTATIVE="${UNAME_MACHINE}-pc-linux-${LIBC}"
|
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
|
||||||
;;
|
;;
|
||||||
a.out-i386-linux)
|
a.out-i386-linux)
|
||||||
echo "${UNAME_MACHINE}-pc-linux-${LIBC}aout"
|
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
|
||||||
exit ;;
|
exit ;;
|
||||||
coff-i386)
|
coff-i386)
|
||||||
echo "${UNAME_MACHINE}-pc-linux-${LIBC}coff"
|
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
|
||||||
exit ;;
|
exit ;;
|
||||||
"")
|
"")
|
||||||
# Either a pre-BFD a.out linker (linux-gnuoldld) or
|
# Either a pre-BFD a.out linker (linux-gnuoldld) or
|
||||||
# one that does not give us useful --help.
|
# one that does not give us useful --help.
|
||||||
echo "${UNAME_MACHINE}-pc-linux-${LIBC}oldld"
|
echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
|
||||||
exit ;;
|
exit ;;
|
||||||
esac
|
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
|
# Determine whether the default compiler is a.out or elf
|
||||||
eval $set_cc_for_build
|
eval $set_cc_for_build
|
||||||
sed 's/^ //' << EOF >$dummy.c
|
sed 's/^ //' << EOF >$dummy.c
|
||||||
@@ -991,7 +1009,7 @@ EOF
|
|||||||
LIBC=gnulibc1
|
LIBC=gnulibc1
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
#if defined(__INTEL_COMPILER) || defined(__PGI)
|
#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
|
||||||
LIBC=gnu
|
LIBC=gnu
|
||||||
#else
|
#else
|
||||||
LIBC=gnuaout
|
LIBC=gnuaout
|
||||||
@@ -1001,7 +1019,11 @@ EOF
|
|||||||
LIBC=dietlibc
|
LIBC=dietlibc
|
||||||
#endif
|
#endif
|
||||||
EOF
|
EOF
|
||||||
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^LIBC/{s: ::g;p;}'`"
|
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
|
||||||
|
/^LIBC/{
|
||||||
|
s: ::g
|
||||||
|
p
|
||||||
|
}'`"
|
||||||
test x"${LIBC}" != x && {
|
test x"${LIBC}" != x && {
|
||||||
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
|
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
|
||||||
exit
|
exit
|
||||||
@@ -1203,6 +1225,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 ;;
|
||||||
|
|||||||
13
config.h.in
13
config.h.in
@@ -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
|
||||||
|
|
||||||
@@ -79,8 +79,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
|
||||||
|
|||||||
141
config.sub
vendored
141
config.sub
vendored
@@ -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
|
||||||
|
# Free Software Foundation, Inc.
|
||||||
|
|
||||||
timestamp='2005-12-23'
|
timestamp='2008-01-16'
|
||||||
|
|
||||||
# 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
|
||||||
@@ -71,8 +72,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."
|
||||||
@@ -240,15 +241,16 @@ 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 \
|
| m32c | m32r | m32rle | m68000 | m68k | m88k \
|
||||||
|
| maxq | mb | microblaze | mcore | mep \
|
||||||
| mips | mipsbe | mipseb | mipsel | mipsle \
|
| mips | mipsbe | mipseb | mipsel | mipsle \
|
||||||
| mips16 \
|
| mips16 \
|
||||||
| mips64 | mips64el \
|
| mips64 | mips64el \
|
||||||
@@ -268,26 +270,25 @@ case $basic_machine in
|
|||||||
| mn10200 | mn10300 \
|
| mn10200 | mn10300 \
|
||||||
| 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 \
|
| score \
|
||||||
|
| sh | sh[1234] | sh[24]a | 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 \
|
||||||
| v850 | v850e \
|
| v850 | v850e \
|
||||||
| we32k \
|
| we32k \
|
||||||
| x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
|
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
|
||||||
| z8k)
|
| z8k)
|
||||||
basic_machine=$basic_machine-unknown
|
basic_machine=$basic_machine-unknown
|
||||||
;;
|
;;
|
||||||
m32c)
|
|
||||||
basic_machine=$basic_machine-unknown
|
|
||||||
;;
|
|
||||||
m6811 | m68hc11 | m6812 | m68hc12)
|
m6811 | m68hc11 | m6812 | m68hc12)
|
||||||
# Motorola 68HC11/12.
|
# Motorola 68HC11/12.
|
||||||
basic_machine=$basic_machine-unknown
|
basic_machine=$basic_machine-unknown
|
||||||
@@ -298,10 +299,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,18 +318,18 @@ 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-* \
|
| 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-* \
|
||||||
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
||||||
@@ -354,28 +351,31 @@ 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-* \
|
||||||
| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
|
| sh-* | sh[1234]-* | sh[24]a-* | 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-* \
|
||||||
| tron-* \
|
| tron-* \
|
||||||
| 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-*)
|
||||||
;;
|
;;
|
||||||
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.
|
||||||
@@ -447,6 +447,14 @@ 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
|
||||||
|
;;
|
||||||
c90)
|
c90)
|
||||||
basic_machine=c90-cray
|
basic_machine=c90-cray
|
||||||
os=-unicos
|
os=-unicos
|
||||||
@@ -479,8 +487,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)
|
||||||
@@ -672,6 +680,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
|
||||||
;;
|
;;
|
||||||
@@ -687,6 +703,10 @@ case $basic_machine in
|
|||||||
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 +714,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 +833,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 +942,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 +957,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 +1049,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
|
||||||
;;
|
;;
|
||||||
@@ -1148,7 +1169,7 @@ case $basic_machine in
|
|||||||
sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
|
sh[1234] | sh[24]a | 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)
|
||||||
@@ -1221,7 +1242,8 @@ case $os in
|
|||||||
| -aos* \
|
| -aos* \
|
||||||
| -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* \
|
||||||
@@ -1236,7 +1258,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*)
|
||||||
# Remember, each alternative MUST END IN *, to match a version number.
|
# Remember, each alternative MUST END IN *, to match a version number.
|
||||||
;;
|
;;
|
||||||
-qnx*)
|
-qnx*)
|
||||||
@@ -1388,6 +1410,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 +1425,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 +1453,9 @@ case $basic_machine in
|
|||||||
m68*-cisco)
|
m68*-cisco)
|
||||||
os=-aout
|
os=-aout
|
||||||
;;
|
;;
|
||||||
|
mep-*)
|
||||||
|
os=-elf
|
||||||
|
;;
|
||||||
mips*-cisco)
|
mips*-cisco)
|
||||||
os=-elf
|
os=-elf
|
||||||
;;
|
;;
|
||||||
|
|||||||
50
configure.ac
50
configure.ac
@@ -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
|
||||||
@@ -18,25 +18,27 @@ AC_PREREQ(2.59)
|
|||||||
|
|
||||||
dnl Version number stuff here:
|
dnl Version number stuff here:
|
||||||
|
|
||||||
AC_INIT([libpng], [1.2.10rc1], [png-mng-implement@lists.sourceforge.net])
|
AC_INIT([libpng], [1.4.0beta49], [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
|
PNGLIB_VERSION=1.4.0beta49
|
||||||
PNGLIB_MAJOR=12
|
PNGLIB_MAJOR=1
|
||||||
PNGLIB_MINOR=10
|
PNGLIB_MINOR=4
|
||||||
|
PNGLIB_RELEASE=0
|
||||||
|
|
||||||
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
|
||||||
AC_PROG_LD
|
AC_PROG_LD
|
||||||
AC_PROG_CPP
|
AC_PROG_CPP
|
||||||
AC_CHECK_TOOL(SED, sed, :)
|
AC_CHECK_TOOL(SED, sed, :)
|
||||||
|
AC_LIBTOOL_WIN32_DLL
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
AC_PROG_LN_S
|
AC_PROG_LN_S
|
||||||
AC_PROG_MAKE_SET
|
AC_PROG_MAKE_SET
|
||||||
@@ -52,25 +54,24 @@ 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])
|
LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG
|
||||||
|
AC_MSG_CHECKING(
|
||||||
|
[if assembler code in pnggccrd.c can be compiled without PNG_NO_MMX_CODE])
|
||||||
AC_TRY_COMPILE(
|
AC_TRY_COMPILE(
|
||||||
[#include "pnggccrd.c"],
|
[#include "$srcdir/pnggccrd.c"],
|
||||||
[return 0;],
|
[return 0;],
|
||||||
LIBPNG_DEFINES=,
|
AC_MSG_RESULT(yes)
|
||||||
LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG -DPNG_NO_ASSEMBLER_CODE)
|
LIBPNG_NO_MMX="",
|
||||||
if test "$LIBPNG_DEFINES"; then
|
AC_MSG_RESULT(no)
|
||||||
AC_MSG_RESULT(no)
|
LIBPNG_NO_MMX=-DPNG_NO_MMX_CODE)
|
||||||
else
|
LIBPNG_DEFINES=$LIBPNG_DEFINES\ $LIBPNG_NO_MMX
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG
|
|
||||||
fi
|
|
||||||
AC_SUBST(LIBPNG_DEFINES)
|
AC_SUBST(LIBPNG_DEFINES)
|
||||||
|
AC_SUBST(LIBPNG_NO_MMX)
|
||||||
|
|
||||||
AC_MSG_CHECKING([if libraries can be versioned])
|
AC_MSG_CHECKING([if libraries can be versioned])
|
||||||
GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
|
GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
|
||||||
@@ -80,14 +81,25 @@ 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
|
||||||
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
|
||||||
@@ -129,7 +141,7 @@ AC_ARG_WITH(libpng-compat,
|
|||||||
AC_SUBST([compatlib])
|
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:scripts/libpng.pc-configure.in])
|
||||||
AC_CONFIG_FILES([libpng-config:scripts/libpng-config.in],
|
AC_CONFIG_FILES([libpng-config:scripts/libpng-config.in],
|
||||||
[chmod +x libpng-config])
|
[chmod +x libpng-config])
|
||||||
|
|
||||||
|
|||||||
340
contrib/gregbook/COPYING
Normal file
340
contrib/gregbook/COPYING
Normal 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.
|
||||||
@@ -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
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|||||||
130
contrib/gregbook/Makefile.mingw32
Normal file
130
contrib/gregbook/Makefile.mingw32
Normal 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)
|
||||||
@@ -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/libpng12
|
||||||
PNGLIB = /usr/local/lib/libpng12.a # statically linked against libpng
|
#PNGLIBd = -L$(PNGDIR) -lpng12 # dynamically linked, installed libpng
|
||||||
|
#PNGLIBs = $(PNGDIR)/libpng12.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) -lpng12 # 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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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.
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
---------------------------------------------------------------------------*/
|
---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
@@ -56,7 +74,7 @@ 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) && \
|
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && \
|
||||||
(defined(__i386__) || defined(_M_IX86)) && \
|
(defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) && \
|
||||||
defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
||||||
/*
|
/*
|
||||||
* WARNING: This preprocessor approach means that the following code
|
* WARNING: This preprocessor approach means that the following code
|
||||||
@@ -79,7 +97,12 @@ void readpng2_version_info(void)
|
|||||||
"with MMX support\n (%s version).", PNG_LIBPNG_VER_STRING,
|
"with MMX support\n (%s version).", PNG_LIBPNG_VER_STRING,
|
||||||
png_libpng_ver, compilerID == 1? "MSVC++" :
|
png_libpng_ver, compilerID == 1? "MSVC++" :
|
||||||
(compilerID == 2? "GNU C" : "unknown"));
|
(compilerID == 2? "GNU C" : "unknown"));
|
||||||
fprintf(stderr, " Processor %s MMX instructions.\n",
|
fprintf(stderr, " Processor (x86%s) %s MMX instructions.\n",
|
||||||
|
#if defined(__x86_64__)
|
||||||
|
"_64",
|
||||||
|
#else
|
||||||
|
"",
|
||||||
|
#endif
|
||||||
mmxsupport? "supports" : "does not support");
|
mmxsupport? "supports" : "does not support");
|
||||||
if (mmxsupport > 0) {
|
if (mmxsupport > 0) {
|
||||||
int num_optims = 0;
|
int num_optims = 0;
|
||||||
@@ -179,40 +202,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_UNKNOWN_CHUNKS_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_UNKNOWN_CHUNKS_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 */
|
||||||
@@ -237,7 +258,7 @@ int readpng2_init(mainprog_info *mainprog_ptr)
|
|||||||
* png_set_asm_flags (png_ptr, flags);
|
* png_set_asm_flags (png_ptr, flags);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if (defined(__i386__) || defined(_M_IX86)) && \
|
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) && \
|
||||||
defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
||||||
/*
|
/*
|
||||||
* WARNING: This preprocessor approach means that the following code
|
* WARNING: This preprocessor approach means that the following code
|
||||||
|
|||||||
@@ -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,12 @@ typedef struct _mainprog_info {
|
|||||||
int rowbytes;
|
int rowbytes;
|
||||||
int channels;
|
int channels;
|
||||||
int need_bgcolor;
|
int need_bgcolor;
|
||||||
#if (defined(__i386__) || defined(_M_IX86))
|
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
|
||||||
int nommxfilters;
|
int nommxfilters;
|
||||||
int nommxcombine;
|
int nommxcombine;
|
||||||
int nommxinterlace;
|
int nommxinterlace;
|
||||||
#endif
|
#endif
|
||||||
int done;
|
int state;
|
||||||
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
179
contrib/gregbook/readppm.c
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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,11 +57,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 "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>
|
||||||
@@ -85,10 +111,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;
|
||||||
|
|
||||||
@@ -247,40 +272,11 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!filename) {
|
if (!filename)
|
||||||
++error;
|
++error;
|
||||||
} else if (!(infile = fopen(filename, "rb"))) {
|
|
||||||
fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename);
|
|
||||||
++error;
|
|
||||||
} else {
|
|
||||||
if ((rc = readpng_init(infile, &image_width, &image_height)) != 0) {
|
|
||||||
switch (rc) {
|
|
||||||
case 1:
|
|
||||||
fprintf(stderr, PROGNAME
|
|
||||||
": [%s] is not a PNG file: incorrect signature\n",
|
|
||||||
filename);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
fprintf(stderr, PROGNAME
|
|
||||||
": [%s] has bad IHDR (libpng longjmp)\n",
|
|
||||||
filename);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
fprintf(stderr, PROGNAME ": insufficient memory\n");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fprintf(stderr, PROGNAME
|
|
||||||
": unknown readpng_init() error\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
++error;
|
|
||||||
}
|
|
||||||
if (error)
|
|
||||||
fclose(infile);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* usage screen */
|
/* print usage screen if any errors up to this point */
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
int ch;
|
int ch;
|
||||||
@@ -303,6 +299,47 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
ch = _getch();
|
ch = _getch();
|
||||||
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
|
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!(infile = fopen(filename, "rb"))) {
|
||||||
|
fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename);
|
||||||
|
++error;
|
||||||
|
} else {
|
||||||
|
if ((rc = readpng_init(infile, &image_width, &image_height)) != 0) {
|
||||||
|
switch (rc) {
|
||||||
|
case 1:
|
||||||
|
fprintf(stderr, PROGNAME
|
||||||
|
": [%s] is not a PNG file: incorrect signature\n",
|
||||||
|
filename);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
fprintf(stderr, PROGNAME
|
||||||
|
": [%s] has bad IHDR (libpng longjmp)\n", filename);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
fprintf(stderr, PROGNAME ": insufficient memory\n");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fprintf(stderr, PROGNAME
|
||||||
|
": unknown readpng_init() error\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
++error;
|
||||||
|
}
|
||||||
|
if (error)
|
||||||
|
fclose(infile);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
int ch;
|
||||||
|
|
||||||
|
fprintf(stderr, PROGNAME ": aborting.\n");
|
||||||
|
do
|
||||||
|
ch = _getch();
|
||||||
|
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
|
||||||
|
exit(2);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
|
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
@@ -325,9 +362,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");
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|
||||||
|
|||||||
@@ -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,28 @@
|
|||||||
- 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
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
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 +65,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>
|
||||||
@@ -119,10 +148,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;
|
||||||
|
|
||||||
@@ -367,7 +395,7 @@ 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))
|
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
|
||||||
} else if (!strncmp(*argv, "-nommxfilters", 7)) {
|
} else if (!strncmp(*argv, "-nommxfilters", 7)) {
|
||||||
rpng2_info.nommxfilters = TRUE;
|
rpng2_info.nommxfilters = TRUE;
|
||||||
} else if (!strncmp(*argv, "-nommxcombine", 7)) {
|
} else if (!strncmp(*argv, "-nommxcombine", 7)) {
|
||||||
@@ -389,9 +417,54 @@ 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) {
|
||||||
|
int ch;
|
||||||
|
|
||||||
|
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"
|
||||||
|
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
|
||||||
|
" %*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) || defined(__x86_64__))
|
||||||
|
" -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) || defined(__x86_64__))
|
||||||
|
(int)strlen(PROGNAME), " ",
|
||||||
|
#endif
|
||||||
|
(int)strlen(PROGNAME), " ", default_display_exponent, num_bgpat);
|
||||||
|
fflush(stderr);
|
||||||
|
do
|
||||||
|
ch = _getch();
|
||||||
|
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
|
||||||
|
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 +478,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,46 +495,14 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* usage screen */
|
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname);
|
fprintf(stderr, PROGNAME ": aborting.\n");
|
||||||
readpng2_version_info();
|
|
||||||
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);
|
exit(2);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
|
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
@@ -494,7 +534,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 +554,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 +621,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 +651,8 @@ static void rpng2_win_init()
|
|||||||
readpng2_cleanup(&rpng2_info);
|
readpng2_cleanup(&rpng2_info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rpng2_info.state = kWindowInit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1089,7 +1148,7 @@ 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");
|
"Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -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>
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
---------------------------------------------------------------------------*/
|
---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
6
contrib/pngminim/decoder/README
Normal file
6
contrib/pngminim/decoder/README
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
This demonstrates the use of PNG_USER_CONFIG and pngusr.h
|
||||||
|
|
||||||
|
To build a minimal read-only decoder, run
|
||||||
|
gather.sh # to collect needed files from pngminus, libpng, and zlib
|
||||||
|
make -f makefile.std
|
||||||
|
|
||||||
8
contrib/pngminim/decoder/gather.sh
Executable file
8
contrib/pngminim/decoder/gather.sh
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
cp ../../pngminus/png2pnm.c pngm2pnm.c
|
||||||
|
cp ../../../*.h .
|
||||||
|
cp ../../../*.c .
|
||||||
|
rm example.c pnggccrd.c pngvcrd.c pngtest.c pngpread.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
|
||||||
44
contrib/pngminim/decoder/makefile.std
Normal file
44
contrib/pngminim/decoder/makefile.std
Normal 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) gzio$(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 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
|
||||||
68
contrib/pngminim/decoder/pngusr.h
Normal file
68
contrib/pngminim/decoder/pngusr.h
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
/* minrdpngconf.h: headers to make a minimal png-read-only library
|
||||||
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
* Copyright (c) 2007 Glenn Randers-Pehrson
|
||||||
|
* Derived from pngcrush.h, Copyright 1998-2007, Glenn Randers-Pehrson
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MINRDPNGCONF_H
|
||||||
|
#define MINRDPNGCONF_H
|
||||||
|
|
||||||
|
#define PNG_NO_GLOBAL_ARRAYS
|
||||||
|
|
||||||
|
#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_ASSEMBLER_CODE
|
||||||
|
#define PNG_NO_OPTIMIZED_CODE
|
||||||
|
#define PNG_NO_READ_GAMMA
|
||||||
|
#define PNG_NO_READ_BACKGROUND
|
||||||
|
#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_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_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_WARN_UNINITIALIZED_ROW
|
||||||
|
#define PNG_NO_READ_PREMULTIPLY_ALPHA
|
||||||
|
|
||||||
|
#define PNG_NO_WRITE_SUPPORTED
|
||||||
|
|
||||||
|
#define PNG_NO_INFO_IMAGE
|
||||||
|
#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
|
||||||
|
|
||||||
|
#endif /* MINRDPNGCONF_H */
|
||||||
6
contrib/pngminim/encoder/README
Normal file
6
contrib/pngminim/encoder/README
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
This demonstrates the use of PNG_USER_CONFIG and pngusr.h
|
||||||
|
|
||||||
|
To build a minimal write-only encoder, run
|
||||||
|
gather.sh # to collect needed files from pngminus, libpng, and zlib
|
||||||
|
make -f makefile.std
|
||||||
|
|
||||||
27
contrib/pngminim/encoder/dummy_inflate.c
Normal file
27
contrib/pngminim/encoder/dummy_inflate.c
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#include "zlib.h"
|
||||||
|
|
||||||
|
int ZEXPORT inflate(strm, flush)
|
||||||
|
z_streamp strm;
|
||||||
|
int flush;
|
||||||
|
{ return Z_OK ; }
|
||||||
|
|
||||||
|
int ZEXPORT inflateReset(strm)
|
||||||
|
z_streamp strm;
|
||||||
|
{ return Z_OK ; }
|
||||||
|
|
||||||
|
int ZEXPORT inflateEnd(strm)
|
||||||
|
z_streamp strm;
|
||||||
|
{ return Z_STREAM_ERROR ; }
|
||||||
|
|
||||||
|
int ZEXPORT inflateInit_(strm, version, stream_size)
|
||||||
|
z_streamp strm;
|
||||||
|
const char *version;
|
||||||
|
int stream_size;
|
||||||
|
{ return Z_OK ; }
|
||||||
|
|
||||||
|
int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size)
|
||||||
|
z_streamp strm;
|
||||||
|
int windowBits;
|
||||||
|
const char *version;
|
||||||
|
int stream_size;
|
||||||
|
{ return Z_STREAM_ERROR ; }
|
||||||
9
contrib/pngminim/encoder/gather.sh
Executable file
9
contrib/pngminim/encoder/gather.sh
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
cp ../../pngminus/pnm2png.c pnm2pngm.c
|
||||||
|
cp ../../../*.h .
|
||||||
|
cp ../../../*.c .
|
||||||
|
rm example.c pnggccrd.c pngvcrd.c pngtest.c pngr*.c
|
||||||
|
# Change the next 2 lines if zlib is somewhere else.
|
||||||
|
cp ../../../../zlib/*.h .
|
||||||
|
cp ../../../../zlib/*.c .
|
||||||
|
rm inf*.[ch]
|
||||||
|
rm minigzip.c example.c
|
||||||
43
contrib/pngminim/encoder/makefile.std
Normal file
43
contrib/pngminim/encoder/makefile.std
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# 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) gzio$(O) \
|
||||||
|
dummy_inflate$(O) \
|
||||||
|
trees$(O) uncompr$(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 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
|
||||||
66
contrib/pngminim/encoder/pngusr.h
Normal file
66
contrib/pngminim/encoder/pngusr.h
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
/* minwrpngconf.h: headers to make a minimal png-write-only library
|
||||||
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
* Copyright (c) 2007 Glenn Randers-Pehrson
|
||||||
|
* Derived from pngcrush.h, Copyright 1998-2007, Glenn Randers-Pehrson
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MINWRPNGCONF_H
|
||||||
|
#define MINWRPNGCONF_H
|
||||||
|
|
||||||
|
#define PNG_NO_GLOBAL_ARRAYS
|
||||||
|
|
||||||
|
#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_GAMMA
|
||||||
|
#define PNG_NO_WRITE_DITHER
|
||||||
|
#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_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_sRGB
|
||||||
|
#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_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_INFO_IMAGE
|
||||||
|
#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
|
||||||
|
|
||||||
|
#endif /* MINWRPNGCONF_H */
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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)) \
|
||||||
|
|||||||
444
depcomp
444
depcomp
@@ -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=2007-03-29.01
|
||||||
|
|
||||||
|
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 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
|
||||||
@@ -15,8 +18,8 @@
|
|||||||
|
|
||||||
# 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, write to the Free Software
|
||||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
# 02111-1307, USA.
|
# 02110-1301, 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 +28,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"
|
||||||
@@ -57,7 +92,20 @@ 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
|
||||||
@@ -163,31 +211,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 +257,136 @@ 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 +399,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 $1 != '--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 +452,40 @@ dashXmstdout)
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
makedepend)
|
makedepend)
|
||||||
# X makedepend
|
"$@" || exit $?
|
||||||
(
|
# Remove any Libtool call
|
||||||
shift
|
if test "$libtool" = yes; then
|
||||||
cleared=no
|
while test $1 != '--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
|
||||||
"$@"
|
for arg in "$@"; do
|
||||||
stat=$?
|
case $cleared in
|
||||||
wait "$proc"
|
no)
|
||||||
if test "$stat" != 0; then exit $stat; fi
|
set ""; shift
|
||||||
|
cleared=yes ;;
|
||||||
|
esac
|
||||||
|
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.
|
||||||
|
-*|$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 +495,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 $1 != '--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,34 +538,27 @@ 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, regardless of -o,
|
||||||
# because we must use -o when running libtool.
|
# because we must use -o when running libtool.
|
||||||
( IFS=" "
|
"$@" || exit $?
|
||||||
case " $* " in
|
IFS=" "
|
||||||
*" --mode=compile "*)
|
for arg
|
||||||
for arg
|
do
|
||||||
do # cycle over the arguments
|
case "$arg" in
|
||||||
case $arg in
|
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||||
"--mode=compile")
|
set fnord "$@"
|
||||||
# insert --quiet before "--mode=compile"
|
shift
|
||||||
set fnord "$@" --quiet
|
shift
|
||||||
shift # fnord
|
;;
|
||||||
;;
|
*)
|
||||||
esac
|
|
||||||
set fnord "$@" "$arg"
|
set fnord "$@" "$arg"
|
||||||
shift # fnord
|
shift
|
||||||
shift # "$arg"
|
shift
|
||||||
done
|
;;
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
"$@" -E |
|
done
|
||||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
|
"$@" -E |
|
||||||
) &
|
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$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"
|
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
||||||
@@ -409,3 +578,12 @@ 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-end: "$"
|
||||||
|
# End:
|
||||||
|
|||||||
48
example.c
48
example.c
@@ -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.0 [February 28, 2009]
|
||||||
* 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-2009 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.)
|
||||||
*/
|
*/
|
||||||
@@ -120,7 +120,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 +132,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);
|
||||||
@@ -163,7 +163,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
* 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,7 +173,7 @@ 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
|
||||||
@@ -200,11 +200,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.
|
||||||
@@ -283,7 +283,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
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,
|
png_set_dither(png_ptr, std_color_cube, MAX_SCREEN_COLORS,
|
||||||
MAX_SCREEN_COLORS, png_uint_16p_NULL, 0);
|
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))
|
||||||
@@ -360,17 +360,17 @@ 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 */
|
||||||
}
|
}
|
||||||
@@ -388,7 +388,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
/* 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);
|
||||||
@@ -421,13 +421,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,7 +456,7 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -505,7 +505,7 @@ row_callback(png_structp png_ptr, png_bytep new_row,
|
|||||||
* shown below:
|
* shown below:
|
||||||
*/
|
*/
|
||||||
/* Check if row_num is in bounds. */
|
/* Check if row_num is in bounds. */
|
||||||
if((row_num >= 0) && (row_num < height))
|
if ((row_num >= 0) && (row_num < height))
|
||||||
{
|
{
|
||||||
/* Get pointer to corresponding row in our
|
/* Get pointer to corresponding row in our
|
||||||
* PNG read buffer.
|
* PNG read buffer.
|
||||||
@@ -515,7 +515,7 @@ row_callback(png_structp png_ptr, png_bytep new_row,
|
|||||||
/* If both rows are allocated then copy the new row
|
/* If both rows are allocated then copy the new row
|
||||||
* data to the corresponding row data.
|
* data to the corresponding row data.
|
||||||
*/
|
*/
|
||||||
if((old_row != NULL) && (new_row != NULL))
|
if ((old_row != NULL) && (new_row != NULL))
|
||||||
png_progressive_combine_row(png_ptr, old_row, new_row);
|
png_progressive_combine_row(png_ptr, old_row, new_row);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@@ -588,7 +588,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -608,7 +608,7 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
/* 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);
|
||||||
@@ -620,7 +620,7 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
* image info living info in the structure. You could "|" many
|
* image info living info 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 */
|
||||||
|
|
||||||
@@ -637,7 +637,7 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
|
|
||||||
/* 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
|
||||||
@@ -793,13 +793,13 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
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;
|
||||||
|
|
||||||
/* 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);
|
||||||
|
|||||||
668
install-sh
668
install-sh
@@ -1,251 +1,519 @@
|
|||||||
#!/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=2006-12-25.00
|
||||||
|
|
||||||
|
# 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-end: "$"
|
||||||
|
# End:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
libpng.txt - A description on how to use and modify libpng
|
libpng.txt - A description on how to use and modify libpng
|
||||||
|
|
||||||
libpng version 1.2.10rc1 - April 19, 2006
|
libpng version 1.4.0beta49 - February 28, 2009
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
<glennrp at users.sourceforge.net>
|
<glennrp at users.sourceforge.net>
|
||||||
Copyright (c) 1998-2005 Glenn Randers-Pehrson
|
Copyright (c) 1998-2005 Glenn Randers-Pehrson
|
||||||
@@ -82,9 +82,7 @@ Libpng is thread safe, provided the threads are using different
|
|||||||
instances of the structures. Each thread should have its own
|
instances of the structures. Each thread should have its own
|
||||||
png_struct and png_info instances, and thus its own image.
|
png_struct and png_info instances, and thus its own image.
|
||||||
Libpng does not protect itself against two threads using the
|
Libpng does not protect itself against two threads using the
|
||||||
same instance of a structure. Note: thread safety may be defeated
|
same instance of a structure.
|
||||||
by use of some of the MMX assembler code in pnggccrd.c, which is only
|
|
||||||
compiled when the user defines PNG_THREAD_UNSAFE_OK.
|
|
||||||
|
|
||||||
II. Structures
|
II. Structures
|
||||||
|
|
||||||
@@ -302,29 +300,6 @@ You must supply a function
|
|||||||
To inform libpng about your function, use
|
To inform libpng about your function, use
|
||||||
|
|
||||||
png_set_read_status_fn(png_ptr, read_row_callback);
|
png_set_read_status_fn(png_ptr, read_row_callback);
|
||||||
|
|
||||||
Width and height limits
|
|
||||||
|
|
||||||
The PNG specification allows the width and height of an image to be as
|
|
||||||
large as 2^31-1 (0x7fffffff), or about 2.147 billion rows and columns.
|
|
||||||
Since very few applications really need to process such large images,
|
|
||||||
we have imposed an arbitrary 1-million limit on rows and columns.
|
|
||||||
Larger images will be rejected immediately with a png_error() call. If
|
|
||||||
you wish to override this limit, you can use
|
|
||||||
|
|
||||||
png_set_user_limits(png_ptr, width_max, height_max);
|
|
||||||
|
|
||||||
to set your own limits, or use width_max = height_max = 0x7fffffffL
|
|
||||||
to allow all valid dimensions (libpng may reject some very large images
|
|
||||||
anyway because of potential buffer overflow conditions).
|
|
||||||
|
|
||||||
You should put this statement after you create the PNG structure and
|
|
||||||
before calling png_read_info(), png_read_png(), or png_process_data().
|
|
||||||
If you need to retrieve the limits that are being applied, use
|
|
||||||
|
|
||||||
width_max = png_get_user_width_max(png_ptr);
|
|
||||||
height_max = png_get_user_height_max(png_ptr);
|
|
||||||
|
|
||||||
Unknown-chunk handling
|
Unknown-chunk handling
|
||||||
|
|
||||||
Now you get to set the way the library processes unknown chunks in the
|
Now you get to set the way the library processes unknown chunks in the
|
||||||
@@ -359,6 +334,38 @@ instances of png_set_keep_unknown_chunks(), the final instance will
|
|||||||
take precedence. The IHDR and IEND chunks should not be named in
|
take precedence. The IHDR and IEND chunks should not be named in
|
||||||
chunk_list; if they are, libpng will process them normally anyway.
|
chunk_list; if they are, libpng will process them normally anyway.
|
||||||
|
|
||||||
|
User limits
|
||||||
|
|
||||||
|
The PNG specification allows the width and height of an image to be as
|
||||||
|
large as 2^31-1 (0x7fffffff), or about 2.147 billion rows and columns.
|
||||||
|
Since very few applications really need to process such large images,
|
||||||
|
we have imposed an arbitrary 1-million limit on rows and columns.
|
||||||
|
Larger images will be rejected immediately with a png_error() call. If
|
||||||
|
you wish to override this limit, you can use
|
||||||
|
|
||||||
|
png_set_user_limits(png_ptr, width_max, height_max);
|
||||||
|
|
||||||
|
to set your own limits, or use width_max = height_max = 0x7fffffffL
|
||||||
|
to allow all valid dimensions (libpng may reject some very large images
|
||||||
|
anyway because of potential buffer overflow conditions).
|
||||||
|
|
||||||
|
You should put this statement after you create the PNG structure and
|
||||||
|
before calling png_read_info(), png_read_png(), or png_process_data().
|
||||||
|
If you need to retrieve the limits that are being applied, use
|
||||||
|
|
||||||
|
width_max = png_get_user_width_max(png_ptr);
|
||||||
|
height_max = png_get_user_height_max(png_ptr);
|
||||||
|
|
||||||
|
The PNG specification sets no limit on the number of ancillary chunks
|
||||||
|
allowed in a PNG datastream. You can impose a limit on the total number
|
||||||
|
of sPLT, tEXt, iTXt, zTXt, and unknown chunks that will be stored, with
|
||||||
|
|
||||||
|
png_set_chunk_cache_max(png_ptr, user_chunk_cache_max);
|
||||||
|
|
||||||
|
where 0x7fffffffL means unlimited. You can retrieve this limit with
|
||||||
|
|
||||||
|
chunk_cache_max = png_get_chunk_cache_max(png_ptr);
|
||||||
|
|
||||||
The high-level read interface
|
The high-level read interface
|
||||||
|
|
||||||
At this point there are two ways to proceed; through the high-level
|
At this point there are two ways to proceed; through the high-level
|
||||||
@@ -388,11 +395,11 @@ you want to do are limited to the following set:
|
|||||||
PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples
|
PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples
|
||||||
|
|
||||||
(This excludes setting a background color, doing gamma transformation,
|
(This excludes setting a background color, doing gamma transformation,
|
||||||
dithering, and setting filler.) If this is the case, simply do this:
|
and setting filler.) If this is the case, simply do this:
|
||||||
|
|
||||||
png_read_png(png_ptr, info_ptr, png_transforms, NULL)
|
png_read_png(png_ptr, info_ptr, png_transforms, NULL)
|
||||||
|
|
||||||
where png_transforms is an integer containing the logical OR of
|
where png_transforms is an integer containing the bitwise OR of
|
||||||
some set of transformation flags. This call is equivalent to png_read_info(),
|
some set of transformation flags. This call is equivalent to png_read_info(),
|
||||||
followed the set of transformations indicated by the transform mask,
|
followed the set of transformations indicated by the transform mask,
|
||||||
then png_read_image(), and finally png_read_end().
|
then png_read_image(), and finally png_read_end().
|
||||||
@@ -415,14 +422,14 @@ where row_pointers is an array of pointers to the pixel data for each row:
|
|||||||
If you know your image size and pixel size ahead of time, you can allocate
|
If you know your image size and pixel size ahead of time, you can allocate
|
||||||
row_pointers prior to calling png_read_png() with
|
row_pointers prior to calling png_read_png() with
|
||||||
|
|
||||||
if (height > PNG_UINT_32_MAX/png_sizeof(png_byte))
|
if (height > PNG_UINT_32_MAX/sizeof(png_bytep))
|
||||||
png_error (png_ptr,
|
png_error (png_ptr,
|
||||||
"Image is too tall to process in memory");
|
"Image is too tall to process in memory");
|
||||||
if (width > PNG_UINT_32_MAX/pixel_size)
|
if (width > PNG_UINT_32_MAX/pixel_size)
|
||||||
png_error (png_ptr,
|
png_error (png_ptr,
|
||||||
"Image is too wide to process in memory");
|
"Image is too wide to process in memory");
|
||||||
row_pointers = png_malloc(png_ptr,
|
row_pointers = png_malloc(png_ptr,
|
||||||
height*png_sizeof(png_bytep));
|
height*sizeof(png_bytep));
|
||||||
for (int i=0; i<height, i++)
|
for (int i=0; i<height, i++)
|
||||||
row_pointers[i]=png_malloc(png_ptr,
|
row_pointers[i]=png_malloc(png_ptr,
|
||||||
width*pixel_size);
|
width*pixel_size);
|
||||||
@@ -576,10 +583,10 @@ into the info_ptr is returned for any complex types.
|
|||||||
given color type (png_color_16)
|
given color type (png_color_16)
|
||||||
|
|
||||||
png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans,
|
png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans,
|
||||||
&trans_values);
|
&trans_color);
|
||||||
trans - array of transparent entries for
|
trans - array of transparent entries for
|
||||||
palette (PNG_INFO_tRNS)
|
palette (PNG_INFO_tRNS)
|
||||||
trans_values - graylevel or color sample values of
|
trans_color - graylevel or color sample values of
|
||||||
the single transparent color for
|
the single transparent color for
|
||||||
non-paletted images (PNG_INFO_tRNS)
|
non-paletted images (PNG_INFO_tRNS)
|
||||||
num_trans - number of transparent entries
|
num_trans - number of transparent entries
|
||||||
@@ -799,8 +806,8 @@ things.
|
|||||||
|
|
||||||
As of libpng version 1.2.9, png_set_expand_gray_1_2_4_to_8() was
|
As of libpng version 1.2.9, png_set_expand_gray_1_2_4_to_8() was
|
||||||
added. It expands the sample depth without changing tRNS to alpha.
|
added. It expands the sample depth without changing tRNS to alpha.
|
||||||
At the same time, png_set_gray_1_2_4_to_8() was deprecated, and it
|
%12%At the same time, png_set_gray_1_2_4_to_8() was deprecated, and it
|
||||||
will be removed from a future version.
|
%12%will be removed from a future version.
|
||||||
|
|
||||||
PNG can have files with 16 bits per channel. If you only can handle
|
PNG can have files with 16 bits per channel. If you only can handle
|
||||||
8 bits per channel, this will strip the pixels down to 8 bit.
|
8 bits per channel, this will strip the pixels down to 8 bit.
|
||||||
@@ -825,6 +832,15 @@ images) is fully transparent, with
|
|||||||
|
|
||||||
png_set_invert_alpha(png_ptr);
|
png_set_invert_alpha(png_ptr);
|
||||||
|
|
||||||
|
The PNG format only supports pixels with postmultiplied alpha.
|
||||||
|
If you want to replace the pixels, after reading them, with pixels
|
||||||
|
that have premultiplied color samples, you can do this with
|
||||||
|
|
||||||
|
png_set_premultiply_alpha(png_ptr);
|
||||||
|
|
||||||
|
If you do this, any input with a tRNS chunk will be expanded to
|
||||||
|
have an alpha channel.
|
||||||
|
|
||||||
PNG files pack pixels of bit depths 1, 2, and 4 into bytes as small as
|
PNG files pack pixels of bit depths 1, 2, and 4 into bytes as small as
|
||||||
they can, resulting in, for example, 8 pixels per byte for 1 bit
|
they can, resulting in, for example, 8 pixels per byte for 1 bit
|
||||||
files. This code expands to 1 pixel per byte without changing the
|
files. This code expands to 1 pixel per byte without changing the
|
||||||
@@ -1025,39 +1041,6 @@ recommended that PNG viewers support gamma correction.
|
|||||||
else
|
else
|
||||||
png_set_gamma(png_ptr, screen_gamma, 0.45455);
|
png_set_gamma(png_ptr, screen_gamma, 0.45455);
|
||||||
|
|
||||||
If you need to reduce an RGB file to a paletted file, or if a paletted
|
|
||||||
file has more entries then will fit on your screen, png_set_dither()
|
|
||||||
will do that. Note that this is a simple match dither that merely
|
|
||||||
finds the closest color available. This should work fairly well with
|
|
||||||
optimized palettes, and fairly badly with linear color cubes. If you
|
|
||||||
pass a palette that is larger then maximum_colors, the file will
|
|
||||||
reduce the number of colors in the palette so it will fit into
|
|
||||||
maximum_colors. If there is a histogram, it will use it to make
|
|
||||||
more intelligent choices when reducing the palette. If there is no
|
|
||||||
histogram, it may not do as good a job.
|
|
||||||
|
|
||||||
if (color_type & PNG_COLOR_MASK_COLOR)
|
|
||||||
{
|
|
||||||
if (png_get_valid(png_ptr, info_ptr,
|
|
||||||
PNG_INFO_PLTE))
|
|
||||||
{
|
|
||||||
png_uint_16p histogram = NULL;
|
|
||||||
|
|
||||||
png_get_hIST(png_ptr, info_ptr,
|
|
||||||
&histogram);
|
|
||||||
png_set_dither(png_ptr, palette, num_palette,
|
|
||||||
max_screen_colors, histogram, 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
png_color std_color_cube[MAX_SCREEN_COLORS] =
|
|
||||||
{ ... colors ... };
|
|
||||||
|
|
||||||
png_set_dither(png_ptr, std_color_cube,
|
|
||||||
MAX_SCREEN_COLORS, MAX_SCREEN_COLORS,
|
|
||||||
NULL,0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PNG files describe monochrome as black being zero and white being one.
|
PNG files describe monochrome as black being zero and white being one.
|
||||||
The following code will reverse this (make black be one and white be
|
The following code will reverse this (make black be one and white be
|
||||||
@@ -1272,7 +1255,7 @@ point to libpng-allocated storage with the following function:
|
|||||||
|
|
||||||
png_free_data(png_ptr, info_ptr, mask, seq)
|
png_free_data(png_ptr, info_ptr, mask, seq)
|
||||||
mask - identifies data to be freed, a mask
|
mask - identifies data to be freed, a mask
|
||||||
containing the logical OR of one or
|
containing the bitwise OR of one or
|
||||||
more of
|
more of
|
||||||
PNG_FREE_PLTE, PNG_FREE_TRNS,
|
PNG_FREE_PLTE, PNG_FREE_TRNS,
|
||||||
PNG_FREE_HIST, PNG_FREE_ICCP,
|
PNG_FREE_HIST, PNG_FREE_ICCP,
|
||||||
@@ -1334,7 +1317,7 @@ application instead of by libpng, you can use
|
|||||||
|
|
||||||
png_set_invalid(png_ptr, info_ptr, mask);
|
png_set_invalid(png_ptr, info_ptr, mask);
|
||||||
mask - identifies the chunks to be made invalid,
|
mask - identifies the chunks to be made invalid,
|
||||||
containing the logical OR of one or
|
containing the bitwise OR of one or
|
||||||
more of
|
more of
|
||||||
PNG_INFO_gAMA, PNG_INFO_sBIT,
|
PNG_INFO_gAMA, PNG_INFO_sBIT,
|
||||||
PNG_INFO_cHRM, PNG_INFO_PLTE,
|
PNG_INFO_cHRM, PNG_INFO_PLTE,
|
||||||
@@ -1601,6 +1584,14 @@ Libpng section below.
|
|||||||
|
|
||||||
png_init_io(png_ptr, fp);
|
png_init_io(png_ptr, fp);
|
||||||
|
|
||||||
|
If you are embedding your PNG into a datastream such as MNG, and don't
|
||||||
|
want libpng to write the 8-byte signature, or if you have already
|
||||||
|
written the signature in your application, use
|
||||||
|
|
||||||
|
png_set_sig_bytes(png_ptr, 8);
|
||||||
|
|
||||||
|
to inform libpng that it should not write a signature.
|
||||||
|
|
||||||
Write callbacks
|
Write callbacks
|
||||||
|
|
||||||
At this point, you can set up a callback function that will be
|
At this point, you can set up a callback function that will be
|
||||||
@@ -1638,7 +1629,7 @@ types.
|
|||||||
|
|
||||||
/* turn on or off filtering, and/or choose
|
/* turn on or off filtering, and/or choose
|
||||||
specific filters. You can use either a single
|
specific filters. You can use either a single
|
||||||
PNG_FILTER_VALUE_NAME or the logical OR of one
|
PNG_FILTER_VALUE_NAME or the bitwise OR of one
|
||||||
or more PNG_FILTER_NAME masks. */
|
or more PNG_FILTER_NAME masks. */
|
||||||
png_set_filter(png_ptr, 0,
|
png_set_filter(png_ptr, 0,
|
||||||
PNG_FILTER_NONE | PNG_FILTER_VALUE_NONE |
|
PNG_FILTER_NONE | PNG_FILTER_VALUE_NONE |
|
||||||
@@ -1791,10 +1782,10 @@ Some of the more important parts of the png_info are:
|
|||||||
(png_color_16)
|
(png_color_16)
|
||||||
|
|
||||||
png_set_tRNS(png_ptr, info_ptr, trans, num_trans,
|
png_set_tRNS(png_ptr, info_ptr, trans, num_trans,
|
||||||
trans_values);
|
trans_color);
|
||||||
trans - array of transparent entries for
|
trans - array of transparent entries for
|
||||||
palette (PNG_INFO_tRNS)
|
palette (PNG_INFO_tRNS)
|
||||||
trans_values - graylevel or color sample values of
|
trans_color - graylevel or color sample values of
|
||||||
the single transparent color for
|
the single transparent color for
|
||||||
non-paletted images (PNG_INFO_tRNS)
|
non-paletted images (PNG_INFO_tRNS)
|
||||||
num_trans - number of transparent entries
|
num_trans - number of transparent entries
|
||||||
@@ -2004,14 +1995,20 @@ transformations are permitted, enabled by the following masks.
|
|||||||
PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity
|
PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity
|
||||||
to transparency
|
to transparency
|
||||||
PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples
|
PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples
|
||||||
PNG_TRANSFORM_STRIP_FILLER Strip out filler bytes.
|
|
||||||
|
PNG_TRANSFORM_STRIP_FILLER Strip out filler
|
||||||
|
bytes (deprecated).
|
||||||
|
PNG_TRANSFORM_STRIP_FILLER_BEFORE Strip out leading
|
||||||
|
filler bytes
|
||||||
|
PNG_TRANSFORM_STRIP_FILLER_AFTER Strip out trailing
|
||||||
|
filler bytes
|
||||||
|
|
||||||
If you have valid image data in the info structure (you can use
|
If you have valid image data in the info structure (you can use
|
||||||
png_set_rows() to put image data in the info structure), simply do this:
|
png_set_rows() to put image data in the info structure), simply do this:
|
||||||
|
|
||||||
png_write_png(png_ptr, info_ptr, png_transforms, NULL)
|
png_write_png(png_ptr, info_ptr, png_transforms, NULL)
|
||||||
|
|
||||||
where png_transforms is an integer containing the logical OR of some set of
|
where png_transforms is an integer containing the bitwise OR of some set of
|
||||||
transformation flags. This call is equivalent to png_write_info(),
|
transformation flags. This call is equivalent to png_write_info(),
|
||||||
followed the set of transformations indicated by the transform mask,
|
followed the set of transformations indicated by the transform mask,
|
||||||
then png_write_image(), and finally png_write_end().
|
then png_write_image(), and finally png_write_end().
|
||||||
@@ -2271,7 +2268,7 @@ point to libpng-allocated storage with the following function:
|
|||||||
|
|
||||||
png_free_data(png_ptr, info_ptr, mask, seq)
|
png_free_data(png_ptr, info_ptr, mask, seq)
|
||||||
mask - identifies data to be freed, a mask
|
mask - identifies data to be freed, a mask
|
||||||
containing the logical OR of one or
|
containing the bitwise OR of one or
|
||||||
more of
|
more of
|
||||||
PNG_FREE_PLTE, PNG_FREE_TRNS,
|
PNG_FREE_PLTE, PNG_FREE_TRNS,
|
||||||
PNG_FREE_HIST, PNG_FREE_ICCP,
|
PNG_FREE_HIST, PNG_FREE_ICCP,
|
||||||
@@ -2412,6 +2409,9 @@ The replacement I/O functions must have prototypes as follows:
|
|||||||
png_bytep data, png_size_t length);
|
png_bytep data, png_size_t length);
|
||||||
void user_flush_data(png_structp png_ptr);
|
void user_flush_data(png_structp png_ptr);
|
||||||
|
|
||||||
|
The user_read_data() function is responsible for detecting and
|
||||||
|
handling end-of-data errors.
|
||||||
|
|
||||||
Supplying NULL for the read, write, or flush functions sets them back
|
Supplying NULL for the read, write, or flush functions sets them back
|
||||||
to using the default C stream functions. It is an error to read from
|
to using the default C stream functions. It is an error to read from
|
||||||
a write stream, and vice versa.
|
a write stream, and vice versa.
|
||||||
@@ -2519,11 +2519,10 @@ you may also have to change the memory allocators (png_malloc, etc.).
|
|||||||
|
|
||||||
Configuring for compiler xxx:
|
Configuring for compiler xxx:
|
||||||
|
|
||||||
All includes for libpng are in pngconf.h. If you need to add/change/delete
|
All includes for libpng are in pngconf.h. If you need to add, change
|
||||||
an include, this is the place to do it. The includes that are not
|
or delete an include, this is the place to do it. The includes that
|
||||||
needed outside libpng are protected by the PNG_INTERNAL definition,
|
are not needed outside libpng are placed inside pngpriv.h, which is
|
||||||
which is only defined for those routines inside libpng itself. The
|
only used by the routines inside libpng itself.
|
||||||
files in libpng proper only include png.h, which includes pngconf.h.
|
|
||||||
|
|
||||||
Configuring zlib:
|
Configuring zlib:
|
||||||
|
|
||||||
@@ -2714,126 +2713,7 @@ When PNG_DEBUG = 1, the macros are defined, but only png_debug statements
|
|||||||
having level = 0 will be printed. There aren't any such statements in
|
having level = 0 will be printed. There aren't any such statements in
|
||||||
this version of libpng, but if you insert some they will be printed.
|
this version of libpng, but if you insert some they will be printed.
|
||||||
|
|
||||||
VI. Runtime optimization
|
VI. MNG support
|
||||||
|
|
||||||
A new feature in libpng 1.2.0 is the ability to dynamically switch between
|
|
||||||
standard and optimized versions of some routines. Currently these are
|
|
||||||
limited to three computationally intensive tasks when reading PNG files:
|
|
||||||
decoding row filters, expanding interlacing, and combining interlaced or
|
|
||||||
transparent row data with previous row data. Currently the optimized
|
|
||||||
versions are available only for x86 (Intel, AMD, etc.) platforms with
|
|
||||||
MMX support, though this may change in future versions. (For example,
|
|
||||||
the non-MMX assembler optimizations for zlib might become similarly
|
|
||||||
runtime-selectable in future releases, in which case libpng could be
|
|
||||||
extended to support them. Alternatively, the compile-time choice of
|
|
||||||
floating-point versus integer routines for gamma correction might become
|
|
||||||
runtime-selectable.)
|
|
||||||
|
|
||||||
Because such optimizations tend to be very platform- and compiler-dependent,
|
|
||||||
both in how they are written and in how they perform, the new runtime code
|
|
||||||
in libpng has been written to allow programs to query, enable, and disable
|
|
||||||
either specific optimizations or all such optimizations. For example, to
|
|
||||||
enable all possible optimizations (bearing in mind that some "optimizations"
|
|
||||||
may actually run more slowly in rare cases):
|
|
||||||
|
|
||||||
#if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
|
||||||
png_uint_32 mask, flags;
|
|
||||||
|
|
||||||
flags = png_get_asm_flags(png_ptr);
|
|
||||||
mask = png_get_asm_flagmask(PNG_SELECT_READ | PNG_SELECT_WRITE);
|
|
||||||
png_set_asm_flags(png_ptr, flags | mask);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
To enable only optimizations relevant to reading PNGs, use PNG_SELECT_READ
|
|
||||||
by itself when calling png_get_asm_flagmask(); similarly for optimizing
|
|
||||||
only writing. To disable all optimizations:
|
|
||||||
|
|
||||||
#if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
|
||||||
flags = png_get_asm_flags(png_ptr);
|
|
||||||
mask = png_get_asm_flagmask(PNG_SELECT_READ | PNG_SELECT_WRITE);
|
|
||||||
png_set_asm_flags(png_ptr, flags & ~mask);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
To enable or disable only MMX-related features, use png_get_mmx_flagmask()
|
|
||||||
in place of png_get_asm_flagmask(). The mmx version takes one additional
|
|
||||||
parameter:
|
|
||||||
|
|
||||||
#if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
|
||||||
int selection = PNG_SELECT_READ | PNG_SELECT_WRITE;
|
|
||||||
int compilerID;
|
|
||||||
|
|
||||||
mask = png_get_mmx_flagmask(selection, &compilerID);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
On return, compilerID will indicate which version of the MMX assembler
|
|
||||||
optimizations was compiled. Currently two flavors exist: Microsoft
|
|
||||||
Visual C++ (compilerID == 1) and GNU C (a.k.a. gcc/gas, compilerID == 2).
|
|
||||||
On non-x86 platforms or on systems compiled without MMX optimizations, a
|
|
||||||
value of -1 is used.
|
|
||||||
|
|
||||||
Note that both png_get_asm_flagmask() and png_get_mmx_flagmask() return
|
|
||||||
all valid, settable optimization bits for the version of the library that's
|
|
||||||
currently in use. In the case of shared (dynamically linked) libraries,
|
|
||||||
this may include optimizations that did not exist at the time the code was
|
|
||||||
written and compiled. It is also possible, of course, to enable only known,
|
|
||||||
specific optimizations; for example:
|
|
||||||
|
|
||||||
#if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
|
||||||
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 ;
|
|
||||||
png_set_asm_flags(png_ptr, flags);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
This method would enable only the MMX read-optimizations available at the
|
|
||||||
time of libpng 1.2.0's release, regardless of whether a later version of
|
|
||||||
the DLL were actually being used. (Also note that these functions did not
|
|
||||||
exist in versions older than 1.2.0, so any attempt to run a dynamically
|
|
||||||
linked app on such an older version would fail.)
|
|
||||||
|
|
||||||
To determine whether the processor supports MMX instructions at all, use
|
|
||||||
the png_mmx_support() function:
|
|
||||||
|
|
||||||
#if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
|
||||||
mmxsupport = png_mmx_support();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
It returns -1 if MMX support is not compiled into libpng, 0 if MMX code
|
|
||||||
is compiled but MMX is not supported by the processor, or 1 if MMX support
|
|
||||||
is fully available. Note that png_mmx_support(), png_get_mmx_flagmask(),
|
|
||||||
and png_get_asm_flagmask() all may be called without allocating and ini-
|
|
||||||
tializing any PNG structures (for example, as part of a usage screen or
|
|
||||||
"about" box).
|
|
||||||
|
|
||||||
The following code can be used to prevent an application from using the
|
|
||||||
thread_unsafe features, even if libpng was built with PNG_THREAD_UNSAFE_OK
|
|
||||||
defined:
|
|
||||||
|
|
||||||
#if defined(PNG_USE_PNGGCCRD) && defined(PNG_ASSEMBLER_CODE_SUPPORTED) \
|
|
||||||
&& defined(PNG_THREAD_UNSAFE_OK)
|
|
||||||
/* Disable thread-unsafe features of pnggccrd */
|
|
||||||
if (png_access_version() >= 10200)
|
|
||||||
{
|
|
||||||
png_uint_32 mmx_disable_mask = 0;
|
|
||||||
png_uint_32 asm_flags;
|
|
||||||
|
|
||||||
mmx_disable_mask |= ( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH );
|
|
||||||
asm_flags = png_get_asm_flags(png_ptr);
|
|
||||||
png_set_asm_flags(png_ptr, asm_flags & ~mmx_disable_mask);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
For more extensive examples of runtime querying, enabling and disabling
|
|
||||||
of optimized features, see contrib/gregbook/readpng2.c in the libpng
|
|
||||||
source-code distribution.
|
|
||||||
|
|
||||||
VII. MNG support
|
|
||||||
|
|
||||||
The MNG specification (available at http://www.libpng.org/pub/mng) allows
|
The MNG specification (available at http://www.libpng.org/pub/mng) allows
|
||||||
certain extensions to PNG for PNG images that are embedded in MNG datastreams.
|
certain extensions to PNG for PNG images that are embedded in MNG datastreams.
|
||||||
@@ -2841,12 +2721,12 @@ Libpng can support some of these extensions. To enable them, use the
|
|||||||
png_permit_mng_features() function:
|
png_permit_mng_features() function:
|
||||||
|
|
||||||
feature_set = png_permit_mng_features(png_ptr, mask)
|
feature_set = png_permit_mng_features(png_ptr, mask)
|
||||||
mask is a png_uint_32 containing the logical OR of the
|
mask is a png_uint_32 containing the bitwise OR of the
|
||||||
features you want to enable. These include
|
features you want to enable. These include
|
||||||
PNG_FLAG_MNG_EMPTY_PLTE
|
PNG_FLAG_MNG_EMPTY_PLTE
|
||||||
PNG_FLAG_MNG_FILTER_64
|
PNG_FLAG_MNG_FILTER_64
|
||||||
PNG_ALL_MNG_FEATURES
|
PNG_ALL_MNG_FEATURES
|
||||||
feature_set is a png_uint_32 that is the logical AND of
|
feature_set is a png_uint_32 that is the bitwise AND of
|
||||||
your mask with the set of MNG features that is
|
your mask with the set of MNG features that is
|
||||||
supported by the version of libpng that you are using.
|
supported by the version of libpng that you are using.
|
||||||
|
|
||||||
@@ -2909,13 +2789,13 @@ application:
|
|||||||
|
|
||||||
IX. Y2K Compliance in libpng
|
IX. Y2K Compliance in libpng
|
||||||
|
|
||||||
April 19, 2006
|
February 28, 2009
|
||||||
|
|
||||||
Since the PNG Development group is an ad-hoc body, we can't make
|
Since the PNG Development group is an ad-hoc body, we can't make
|
||||||
an official declaration.
|
an official declaration.
|
||||||
|
|
||||||
This is your unofficial assurance that libpng from version 0.71 and
|
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
|
upward through 1.4.0beta49 are Y2K compliant. It is my belief that earlier
|
||||||
versions were also Y2K compliant.
|
versions were also Y2K compliant.
|
||||||
|
|
||||||
Libpng only has three year fields. One is a 2-byte unsigned integer that
|
Libpng only has three year fields. One is a 2-byte unsigned integer that
|
||||||
397
libpng.3
397
libpng.3
@@ -1,6 +1,6 @@
|
|||||||
.TH LIBPNG 3 "April 19, 2006"
|
.TH LIBPNG 3 "February 28, 2009"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.2.10rc1
|
libpng \- Portable Network Graphics (PNG) Reference Library 1.4.0beta49
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
@@ -12,6 +12,14 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.10rc1
|
|||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_benign_error (png_structp \fP\fIpng_ptr\fP\fB, png_const_charp \fIerror\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_chunk_benign_error (png_structp \fP\fIpng_ptr\fP\fB, png_const_charp \fIerror\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
\fBint png_check_sig (png_bytep \fP\fIsig\fP\fB, int \fInum\fP\fB);\fP
|
\fBint png_check_sig (png_bytep \fP\fIsig\fP\fB, int \fInum\fP\fB);\fP
|
||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
@@ -120,10 +128,18 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.10rc1
|
|||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
|
\fBpng_uint_32 png_get_chunk_cache_max (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
\fBpng_byte png_get_color_type (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
\fBpng_byte png_get_color_type (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
|
\fBpng_uint_32 png_get_compression_buffer_size (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
\fBpng_byte png_get_compression_type (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
\fBpng_byte png_get_compression_type (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
@@ -262,11 +278,11 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.10rc1
|
|||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
\fBpng_uint_32 png_get_tRNS (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fP\fI*trans\fP\fB, int \fP\fI*num_trans\fP\fB, png_color_16p \fI*trans_values\fP\fB);\fP
|
\fBpng_uint_32 png_get_tRNS (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fP\fI*trans\fP\fB, int \fP\fI*num_trans\fP\fB, png_color_16p \fI*trans_color\fP\fB);\fP
|
||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
\fB#if \fI!defined(PNG_1_0_X)
|
\fB/* This function is really an inline macro. \fI*/
|
||||||
|
|
||||||
\fBpng_uint_16 png_get_uint_16 (png_bytep \fIbuf\fP\fB);\fP
|
\fBpng_uint_16 png_get_uint_16 (png_bytep \fIbuf\fP\fB);\fP
|
||||||
|
|
||||||
@@ -276,9 +292,9 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.10rc1
|
|||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
\fBpng_uint_32 png_get_uint_32 (png_bytep \fIbuf\fP\fB);\fP
|
\fB/* This function is really an inline macro. \fI*/
|
||||||
|
|
||||||
\fI\fB#endif
|
\fBpng_uint_32 png_get_uint_32 (png_bytep \fIbuf\fP\fB);\fP
|
||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
@@ -330,10 +346,6 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.10rc1
|
|||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
\fBpng_uint_32 png_get_compression_buffer_size (png_structp \fIpng_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBint png_handle_as_unknown (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIchunk_name\fP\fB);\fP
|
\fBint png_handle_as_unknown (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIchunk_name\fP\fB);\fP
|
||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
@@ -342,19 +354,11 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.10rc1
|
|||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
\fBDEPRECATED: void png_info_init (png_infop \fIinfo_ptr\fP\fB);\fP
|
\fBpng_voidp png_malloc (png_structp \fP\fIpng_ptr\fP\fB, png_alloc_size_t \fIsize\fP\fB);\fP
|
||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
\fBDEPRECATED: void png_info_init_2 (png_infopp \fP\fIptr_ptr\fP\fB, png_size_t \fIpng_info_struct_size\fP\fB);\fP
|
\fBpng_voidp png_malloc_default(png_structp \fP\fIpng_ptr\fP\fB, png_alloc_size_t \fIsize\fP\fB);\fP
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBpng_voidp png_malloc (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIsize\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBpng_voidp png_malloc_default(png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIsize\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
@@ -362,22 +366,10 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.10rc1
|
|||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
\fBpng_voidp png_memcpy_check (png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fP\fIs1\fP\fB, png_voidp \fP\fIs2\fP\fB, png_uint_32 \fIsize\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoidp png_memset (png_voidp \fP\fIs1\fP\fB, int \fP\fIvalue\fP\fB, png_size_t \fIsize\fP\fB);\fP
|
\fBvoidp png_memset (png_voidp \fP\fIs1\fP\fB, int \fP\fIvalue\fP\fB, png_size_t \fIsize\fP\fB);\fP
|
||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
\fBpng_voidp png_memset_check (png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fP\fIs1\fP\fB, int \fP\fIvalue\fP\fB, png_uint_32 \fIsize\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBDEPRECATED: void png_permit_empty_plte (png_structp \fP\fIpng_ptr\fP\fB, int \fIempty_plte_permitted\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_process_data (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIbuffer_size\fP\fB);\fP
|
\fBvoid png_process_data (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIbuffer_size\fP\fB);\fP
|
||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
@@ -398,14 +390,6 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.10rc1
|
|||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
\fBDEPRECATED: void png_read_init (png_structp \fIpng_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBDEPRECATED: void png_read_init_2 (png_structpp \fP\fIptr_ptr\fP\fB, png_const_charp \fP\fIuser_png_ver\fP\fB, png_size_t \fP\fIpng_struct_size\fP\fB, png_size_t \fIpng_info_size\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_read_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
\fBvoid png_read_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
@@ -466,6 +450,10 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.10rc1
|
|||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_set_chunk_cache_max (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIuser_chunk_cache_max\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
\fBvoid png_set_compression_level (png_structp \fP\fIpng_ptr\fP\fB, int \fIlevel\fP\fB);\fP
|
\fBvoid png_set_compression_level (png_structp \fP\fIpng_ptr\fP\fB, int \fIlevel\fP\fB);\fP
|
||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
@@ -602,6 +590,10 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.10rc1
|
|||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_set_premultiply_alpha (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
\fBvoid png_set_progressive_read_fn (png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fP\fIprogressive_ptr\fP\fB, png_progressive_info_ptr \fP\fIinfo_fn\fP\fB, png_progressive_row_ptr \fP\fIrow_fn\fP\fB, png_progressive_end_ptr \fIend_fn\fP\fB);\fP
|
\fBvoid png_set_progressive_read_fn (png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fP\fIprogressive_ptr\fP\fB, png_progressive_info_ptr \fP\fIinfo_fn\fP\fB, png_progressive_row_ptr \fP\fIrow_fn\fP\fB, png_progressive_end_ptr \fIend_fn\fP\fB);\fP
|
||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
@@ -686,7 +678,7 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.10rc1
|
|||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
\fBvoid png_set_tRNS (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fP\fItrans\fP\fB, int \fP\fInum_trans\fP\fB, png_color_16p \fItrans_values\fP\fB);\fP
|
\fBvoid png_set_tRNS (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fP\fItrans\fP\fB, int \fP\fInum_trans\fP\fB, png_color_16p \fItrans_color\fP\fB);\fP
|
||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
@@ -774,14 +766,6 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.10rc1
|
|||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
\fBDEPRECATED: void png_write_init (png_structp \fIpng_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBDEPRECATED: void png_write_init_2 (png_structpp \fP\fIptr_ptr\fP\fB, png_const_charp \fP\fIuser_png_ver\fP\fB, png_size_t \fP\fIpng_struct_size\fP\fB, png_size_t \fIpng_info_size\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
\fBvoid png_write_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
@@ -802,6 +786,10 @@ 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
|
||||||
|
|
||||||
\fBvoidpf png_zalloc (voidpf \fP\fIpng_ptr\fP\fB, uInt \fP\fIitems\fP\fB, uInt \fIsize\fP\fB);\fP
|
\fBvoidpf png_zalloc (voidpf \fP\fIpng_ptr\fP\fB, uInt \fP\fIitems\fP\fB, uInt \fIsize\fP\fB);\fP
|
||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
@@ -821,7 +809,7 @@ Following is a copy of the libpng.txt file that accompanies libpng.
|
|||||||
.SH LIBPNG.TXT
|
.SH LIBPNG.TXT
|
||||||
libpng.txt - A description on how to use and modify libpng
|
libpng.txt - A description on how to use and modify libpng
|
||||||
|
|
||||||
libpng version 1.2.10rc1 - April 19, 2006
|
libpng version 1.4.0beta49 - February 28, 2009
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
<glennrp at users.sourceforge.net>
|
<glennrp at users.sourceforge.net>
|
||||||
Copyright (c) 1998-2005 Glenn Randers-Pehrson
|
Copyright (c) 1998-2005 Glenn Randers-Pehrson
|
||||||
@@ -903,9 +891,7 @@ Libpng is thread safe, provided the threads are using different
|
|||||||
instances of the structures. Each thread should have its own
|
instances of the structures. Each thread should have its own
|
||||||
png_struct and png_info instances, and thus its own image.
|
png_struct and png_info instances, and thus its own image.
|
||||||
Libpng does not protect itself against two threads using the
|
Libpng does not protect itself against two threads using the
|
||||||
same instance of a structure. Note: thread safety may be defeated
|
same instance of a structure.
|
||||||
by use of some of the MMX assembler code in pnggccrd.c, which is only
|
|
||||||
compiled when the user defines PNG_THREAD_UNSAFE_OK.
|
|
||||||
|
|
||||||
.SH II. Structures
|
.SH II. Structures
|
||||||
|
|
||||||
@@ -1123,29 +1109,6 @@ You must supply a function
|
|||||||
To inform libpng about your function, use
|
To inform libpng about your function, use
|
||||||
|
|
||||||
png_set_read_status_fn(png_ptr, read_row_callback);
|
png_set_read_status_fn(png_ptr, read_row_callback);
|
||||||
|
|
||||||
.SS Width and height limits
|
|
||||||
|
|
||||||
The PNG specification allows the width and height of an image to be as
|
|
||||||
large as 2^31-1 (0x7fffffff), or about 2.147 billion rows and columns.
|
|
||||||
Since very few applications really need to process such large images,
|
|
||||||
we have imposed an arbitrary 1-million limit on rows and columns.
|
|
||||||
Larger images will be rejected immediately with a png_error() call. If
|
|
||||||
you wish to override this limit, you can use
|
|
||||||
|
|
||||||
png_set_user_limits(png_ptr, width_max, height_max);
|
|
||||||
|
|
||||||
to set your own limits, or use width_max = height_max = 0x7fffffffL
|
|
||||||
to allow all valid dimensions (libpng may reject some very large images
|
|
||||||
anyway because of potential buffer overflow conditions).
|
|
||||||
|
|
||||||
You should put this statement after you create the PNG structure and
|
|
||||||
before calling png_read_info(), png_read_png(), or png_process_data().
|
|
||||||
If you need to retrieve the limits that are being applied, use
|
|
||||||
|
|
||||||
width_max = png_get_user_width_max(png_ptr);
|
|
||||||
height_max = png_get_user_height_max(png_ptr);
|
|
||||||
|
|
||||||
.SS Unknown-chunk handling
|
.SS Unknown-chunk handling
|
||||||
|
|
||||||
Now you get to set the way the library processes unknown chunks in the
|
Now you get to set the way the library processes unknown chunks in the
|
||||||
@@ -1180,6 +1143,38 @@ instances of png_set_keep_unknown_chunks(), the final instance will
|
|||||||
take precedence. The IHDR and IEND chunks should not be named in
|
take precedence. The IHDR and IEND chunks should not be named in
|
||||||
chunk_list; if they are, libpng will process them normally anyway.
|
chunk_list; if they are, libpng will process them normally anyway.
|
||||||
|
|
||||||
|
.SS User limits
|
||||||
|
|
||||||
|
The PNG specification allows the width and height of an image to be as
|
||||||
|
large as 2^31-1 (0x7fffffff), or about 2.147 billion rows and columns.
|
||||||
|
Since very few applications really need to process such large images,
|
||||||
|
we have imposed an arbitrary 1-million limit on rows and columns.
|
||||||
|
Larger images will be rejected immediately with a png_error() call. If
|
||||||
|
you wish to override this limit, you can use
|
||||||
|
|
||||||
|
png_set_user_limits(png_ptr, width_max, height_max);
|
||||||
|
|
||||||
|
to set your own limits, or use width_max = height_max = 0x7fffffffL
|
||||||
|
to allow all valid dimensions (libpng may reject some very large images
|
||||||
|
anyway because of potential buffer overflow conditions).
|
||||||
|
|
||||||
|
You should put this statement after you create the PNG structure and
|
||||||
|
before calling png_read_info(), png_read_png(), or png_process_data().
|
||||||
|
If you need to retrieve the limits that are being applied, use
|
||||||
|
|
||||||
|
width_max = png_get_user_width_max(png_ptr);
|
||||||
|
height_max = png_get_user_height_max(png_ptr);
|
||||||
|
|
||||||
|
The PNG specification sets no limit on the number of ancillary chunks
|
||||||
|
allowed in a PNG datastream. You can impose a limit on the total number
|
||||||
|
of sPLT, tEXt, iTXt, zTXt, and unknown chunks that will be stored, with
|
||||||
|
|
||||||
|
png_set_chunk_cache_max(png_ptr, user_chunk_cache_max);
|
||||||
|
|
||||||
|
where 0x7fffffffL means unlimited. You can retrieve this limit with
|
||||||
|
|
||||||
|
chunk_cache_max = png_get_chunk_cache_max(png_ptr);
|
||||||
|
|
||||||
.SS The high-level read interface
|
.SS The high-level read interface
|
||||||
|
|
||||||
At this point there are two ways to proceed; through the high-level
|
At this point there are two ways to proceed; through the high-level
|
||||||
@@ -1209,11 +1204,11 @@ you want to do are limited to the following set:
|
|||||||
PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples
|
PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples
|
||||||
|
|
||||||
(This excludes setting a background color, doing gamma transformation,
|
(This excludes setting a background color, doing gamma transformation,
|
||||||
dithering, and setting filler.) If this is the case, simply do this:
|
and setting filler.) If this is the case, simply do this:
|
||||||
|
|
||||||
png_read_png(png_ptr, info_ptr, png_transforms, NULL)
|
png_read_png(png_ptr, info_ptr, png_transforms, NULL)
|
||||||
|
|
||||||
where png_transforms is an integer containing the logical OR of
|
where png_transforms is an integer containing the bitwise OR of
|
||||||
some set of transformation flags. This call is equivalent to png_read_info(),
|
some set of transformation flags. This call is equivalent to png_read_info(),
|
||||||
followed the set of transformations indicated by the transform mask,
|
followed the set of transformations indicated by the transform mask,
|
||||||
then png_read_image(), and finally png_read_end().
|
then png_read_image(), and finally png_read_end().
|
||||||
@@ -1236,14 +1231,14 @@ where row_pointers is an array of pointers to the pixel data for each row:
|
|||||||
If you know your image size and pixel size ahead of time, you can allocate
|
If you know your image size and pixel size ahead of time, you can allocate
|
||||||
row_pointers prior to calling png_read_png() with
|
row_pointers prior to calling png_read_png() with
|
||||||
|
|
||||||
if (height > PNG_UINT_32_MAX/png_sizeof(png_byte))
|
if (height > PNG_UINT_32_MAX/sizeof(png_bytep))
|
||||||
png_error (png_ptr,
|
png_error (png_ptr,
|
||||||
"Image is too tall to process in memory");
|
"Image is too tall to process in memory");
|
||||||
if (width > PNG_UINT_32_MAX/pixel_size)
|
if (width > PNG_UINT_32_MAX/pixel_size)
|
||||||
png_error (png_ptr,
|
png_error (png_ptr,
|
||||||
"Image is too wide to process in memory");
|
"Image is too wide to process in memory");
|
||||||
row_pointers = png_malloc(png_ptr,
|
row_pointers = png_malloc(png_ptr,
|
||||||
height*png_sizeof(png_bytep));
|
height*sizeof(png_bytep));
|
||||||
for (int i=0; i<height, i++)
|
for (int i=0; i<height, i++)
|
||||||
row_pointers[i]=png_malloc(png_ptr,
|
row_pointers[i]=png_malloc(png_ptr,
|
||||||
width*pixel_size);
|
width*pixel_size);
|
||||||
@@ -1397,10 +1392,10 @@ into the info_ptr is returned for any complex types.
|
|||||||
given color type (png_color_16)
|
given color type (png_color_16)
|
||||||
|
|
||||||
png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans,
|
png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans,
|
||||||
&trans_values);
|
&trans_color);
|
||||||
trans - array of transparent entries for
|
trans - array of transparent entries for
|
||||||
palette (PNG_INFO_tRNS)
|
palette (PNG_INFO_tRNS)
|
||||||
trans_values - graylevel or color sample values of
|
trans_color - graylevel or color sample values of
|
||||||
the single transparent color for
|
the single transparent color for
|
||||||
non-paletted images (PNG_INFO_tRNS)
|
non-paletted images (PNG_INFO_tRNS)
|
||||||
num_trans - number of transparent entries
|
num_trans - number of transparent entries
|
||||||
@@ -1620,8 +1615,8 @@ things.
|
|||||||
|
|
||||||
As of libpng version 1.2.9, png_set_expand_gray_1_2_4_to_8() was
|
As of libpng version 1.2.9, png_set_expand_gray_1_2_4_to_8() was
|
||||||
added. It expands the sample depth without changing tRNS to alpha.
|
added. It expands the sample depth without changing tRNS to alpha.
|
||||||
At the same time, png_set_gray_1_2_4_to_8() was deprecated, and it
|
%12%At the same time, png_set_gray_1_2_4_to_8() was deprecated, and it
|
||||||
will be removed from a future version.
|
%12%will be removed from a future version.
|
||||||
|
|
||||||
PNG can have files with 16 bits per channel. If you only can handle
|
PNG can have files with 16 bits per channel. If you only can handle
|
||||||
8 bits per channel, this will strip the pixels down to 8 bit.
|
8 bits per channel, this will strip the pixels down to 8 bit.
|
||||||
@@ -1646,6 +1641,15 @@ images) is fully transparent, with
|
|||||||
|
|
||||||
png_set_invert_alpha(png_ptr);
|
png_set_invert_alpha(png_ptr);
|
||||||
|
|
||||||
|
The PNG format only supports pixels with postmultiplied alpha.
|
||||||
|
If you want to replace the pixels, after reading them, with pixels
|
||||||
|
that have premultiplied color samples, you can do this with
|
||||||
|
|
||||||
|
png_set_premultiply_alpha(png_ptr);
|
||||||
|
|
||||||
|
If you do this, any input with a tRNS chunk will be expanded to
|
||||||
|
have an alpha channel.
|
||||||
|
|
||||||
PNG files pack pixels of bit depths 1, 2, and 4 into bytes as small as
|
PNG files pack pixels of bit depths 1, 2, and 4 into bytes as small as
|
||||||
they can, resulting in, for example, 8 pixels per byte for 1 bit
|
they can, resulting in, for example, 8 pixels per byte for 1 bit
|
||||||
files. This code expands to 1 pixel per byte without changing the
|
files. This code expands to 1 pixel per byte without changing the
|
||||||
@@ -1846,39 +1850,6 @@ recommended that PNG viewers support gamma correction.
|
|||||||
else
|
else
|
||||||
png_set_gamma(png_ptr, screen_gamma, 0.45455);
|
png_set_gamma(png_ptr, screen_gamma, 0.45455);
|
||||||
|
|
||||||
If you need to reduce an RGB file to a paletted file, or if a paletted
|
|
||||||
file has more entries then will fit on your screen, png_set_dither()
|
|
||||||
will do that. Note that this is a simple match dither that merely
|
|
||||||
finds the closest color available. This should work fairly well with
|
|
||||||
optimized palettes, and fairly badly with linear color cubes. If you
|
|
||||||
pass a palette that is larger then maximum_colors, the file will
|
|
||||||
reduce the number of colors in the palette so it will fit into
|
|
||||||
maximum_colors. If there is a histogram, it will use it to make
|
|
||||||
more intelligent choices when reducing the palette. If there is no
|
|
||||||
histogram, it may not do as good a job.
|
|
||||||
|
|
||||||
if (color_type & PNG_COLOR_MASK_COLOR)
|
|
||||||
{
|
|
||||||
if (png_get_valid(png_ptr, info_ptr,
|
|
||||||
PNG_INFO_PLTE))
|
|
||||||
{
|
|
||||||
png_uint_16p histogram = NULL;
|
|
||||||
|
|
||||||
png_get_hIST(png_ptr, info_ptr,
|
|
||||||
&histogram);
|
|
||||||
png_set_dither(png_ptr, palette, num_palette,
|
|
||||||
max_screen_colors, histogram, 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
png_color std_color_cube[MAX_SCREEN_COLORS] =
|
|
||||||
{ ... colors ... };
|
|
||||||
|
|
||||||
png_set_dither(png_ptr, std_color_cube,
|
|
||||||
MAX_SCREEN_COLORS, MAX_SCREEN_COLORS,
|
|
||||||
NULL,0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PNG files describe monochrome as black being zero and white being one.
|
PNG files describe monochrome as black being zero and white being one.
|
||||||
The following code will reverse this (make black be one and white be
|
The following code will reverse this (make black be one and white be
|
||||||
@@ -2093,7 +2064,7 @@ point to libpng-allocated storage with the following function:
|
|||||||
|
|
||||||
png_free_data(png_ptr, info_ptr, mask, seq)
|
png_free_data(png_ptr, info_ptr, mask, seq)
|
||||||
mask - identifies data to be freed, a mask
|
mask - identifies data to be freed, a mask
|
||||||
containing the logical OR of one or
|
containing the bitwise OR of one or
|
||||||
more of
|
more of
|
||||||
PNG_FREE_PLTE, PNG_FREE_TRNS,
|
PNG_FREE_PLTE, PNG_FREE_TRNS,
|
||||||
PNG_FREE_HIST, PNG_FREE_ICCP,
|
PNG_FREE_HIST, PNG_FREE_ICCP,
|
||||||
@@ -2155,7 +2126,7 @@ application instead of by libpng, you can use
|
|||||||
|
|
||||||
png_set_invalid(png_ptr, info_ptr, mask);
|
png_set_invalid(png_ptr, info_ptr, mask);
|
||||||
mask - identifies the chunks to be made invalid,
|
mask - identifies the chunks to be made invalid,
|
||||||
containing the logical OR of one or
|
containing the bitwise OR of one or
|
||||||
more of
|
more of
|
||||||
PNG_INFO_gAMA, PNG_INFO_sBIT,
|
PNG_INFO_gAMA, PNG_INFO_sBIT,
|
||||||
PNG_INFO_cHRM, PNG_INFO_PLTE,
|
PNG_INFO_cHRM, PNG_INFO_PLTE,
|
||||||
@@ -2422,6 +2393,14 @@ Libpng section below.
|
|||||||
|
|
||||||
png_init_io(png_ptr, fp);
|
png_init_io(png_ptr, fp);
|
||||||
|
|
||||||
|
If you are embedding your PNG into a datastream such as MNG, and don't
|
||||||
|
want libpng to write the 8-byte signature, or if you have already
|
||||||
|
written the signature in your application, use
|
||||||
|
|
||||||
|
png_set_sig_bytes(png_ptr, 8);
|
||||||
|
|
||||||
|
to inform libpng that it should not write a signature.
|
||||||
|
|
||||||
.SS Write callbacks
|
.SS Write callbacks
|
||||||
|
|
||||||
At this point, you can set up a callback function that will be
|
At this point, you can set up a callback function that will be
|
||||||
@@ -2459,7 +2438,7 @@ types.
|
|||||||
|
|
||||||
/* turn on or off filtering, and/or choose
|
/* turn on or off filtering, and/or choose
|
||||||
specific filters. You can use either a single
|
specific filters. You can use either a single
|
||||||
PNG_FILTER_VALUE_NAME or the logical OR of one
|
PNG_FILTER_VALUE_NAME or the bitwise OR of one
|
||||||
or more PNG_FILTER_NAME masks. */
|
or more PNG_FILTER_NAME masks. */
|
||||||
png_set_filter(png_ptr, 0,
|
png_set_filter(png_ptr, 0,
|
||||||
PNG_FILTER_NONE | PNG_FILTER_VALUE_NONE |
|
PNG_FILTER_NONE | PNG_FILTER_VALUE_NONE |
|
||||||
@@ -2612,10 +2591,10 @@ Some of the more important parts of the png_info are:
|
|||||||
(png_color_16)
|
(png_color_16)
|
||||||
|
|
||||||
png_set_tRNS(png_ptr, info_ptr, trans, num_trans,
|
png_set_tRNS(png_ptr, info_ptr, trans, num_trans,
|
||||||
trans_values);
|
trans_color);
|
||||||
trans - array of transparent entries for
|
trans - array of transparent entries for
|
||||||
palette (PNG_INFO_tRNS)
|
palette (PNG_INFO_tRNS)
|
||||||
trans_values - graylevel or color sample values of
|
trans_color - graylevel or color sample values of
|
||||||
the single transparent color for
|
the single transparent color for
|
||||||
non-paletted images (PNG_INFO_tRNS)
|
non-paletted images (PNG_INFO_tRNS)
|
||||||
num_trans - number of transparent entries
|
num_trans - number of transparent entries
|
||||||
@@ -2825,14 +2804,20 @@ transformations are permitted, enabled by the following masks.
|
|||||||
PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity
|
PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity
|
||||||
to transparency
|
to transparency
|
||||||
PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples
|
PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples
|
||||||
PNG_TRANSFORM_STRIP_FILLER Strip out filler bytes.
|
|
||||||
|
PNG_TRANSFORM_STRIP_FILLER Strip out filler
|
||||||
|
bytes (deprecated).
|
||||||
|
PNG_TRANSFORM_STRIP_FILLER_BEFORE Strip out leading
|
||||||
|
filler bytes
|
||||||
|
PNG_TRANSFORM_STRIP_FILLER_AFTER Strip out trailing
|
||||||
|
filler bytes
|
||||||
|
|
||||||
If you have valid image data in the info structure (you can use
|
If you have valid image data in the info structure (you can use
|
||||||
png_set_rows() to put image data in the info structure), simply do this:
|
png_set_rows() to put image data in the info structure), simply do this:
|
||||||
|
|
||||||
png_write_png(png_ptr, info_ptr, png_transforms, NULL)
|
png_write_png(png_ptr, info_ptr, png_transforms, NULL)
|
||||||
|
|
||||||
where png_transforms is an integer containing the logical OR of some set of
|
where png_transforms is an integer containing the bitwise OR of some set of
|
||||||
transformation flags. This call is equivalent to png_write_info(),
|
transformation flags. This call is equivalent to png_write_info(),
|
||||||
followed the set of transformations indicated by the transform mask,
|
followed the set of transformations indicated by the transform mask,
|
||||||
then png_write_image(), and finally png_write_end().
|
then png_write_image(), and finally png_write_end().
|
||||||
@@ -3092,7 +3077,7 @@ point to libpng-allocated storage with the following function:
|
|||||||
|
|
||||||
png_free_data(png_ptr, info_ptr, mask, seq)
|
png_free_data(png_ptr, info_ptr, mask, seq)
|
||||||
mask - identifies data to be freed, a mask
|
mask - identifies data to be freed, a mask
|
||||||
containing the logical OR of one or
|
containing the bitwise OR of one or
|
||||||
more of
|
more of
|
||||||
PNG_FREE_PLTE, PNG_FREE_TRNS,
|
PNG_FREE_PLTE, PNG_FREE_TRNS,
|
||||||
PNG_FREE_HIST, PNG_FREE_ICCP,
|
PNG_FREE_HIST, PNG_FREE_ICCP,
|
||||||
@@ -3233,6 +3218,9 @@ The replacement I/O functions must have prototypes as follows:
|
|||||||
png_bytep data, png_size_t length);
|
png_bytep data, png_size_t length);
|
||||||
void user_flush_data(png_structp png_ptr);
|
void user_flush_data(png_structp png_ptr);
|
||||||
|
|
||||||
|
The user_read_data() function is responsible for detecting and
|
||||||
|
handling end-of-data errors.
|
||||||
|
|
||||||
Supplying NULL for the read, write, or flush functions sets them back
|
Supplying NULL for the read, write, or flush functions sets them back
|
||||||
to using the default C stream functions. It is an error to read from
|
to using the default C stream functions. It is an error to read from
|
||||||
a write stream, and vice versa.
|
a write stream, and vice versa.
|
||||||
@@ -3340,11 +3328,10 @@ you may also have to change the memory allocators (png_malloc, etc.).
|
|||||||
|
|
||||||
.SS Configuring for compiler xxx:
|
.SS Configuring for compiler xxx:
|
||||||
|
|
||||||
All includes for libpng are in pngconf.h. If you need to add/change/delete
|
All includes for libpng are in pngconf.h. If you need to add, change
|
||||||
an include, this is the place to do it. The includes that are not
|
or delete an include, this is the place to do it. The includes that
|
||||||
needed outside libpng are protected by the PNG_INTERNAL definition,
|
are not needed outside libpng are placed inside pngpriv.h, which is
|
||||||
which is only defined for those routines inside libpng itself. The
|
only used by the routines inside libpng itself.
|
||||||
files in libpng proper only include png.h, which includes pngconf.h.
|
|
||||||
|
|
||||||
.SS Configuring zlib:
|
.SS Configuring zlib:
|
||||||
|
|
||||||
@@ -3535,126 +3522,7 @@ When PNG_DEBUG = 1, the macros are defined, but only png_debug statements
|
|||||||
having level = 0 will be printed. There aren't any such statements in
|
having level = 0 will be printed. There aren't any such statements in
|
||||||
this version of libpng, but if you insert some they will be printed.
|
this version of libpng, but if you insert some they will be printed.
|
||||||
|
|
||||||
.SH VI. Runtime optimization
|
.SH VI. MNG support
|
||||||
|
|
||||||
A new feature in libpng 1.2.0 is the ability to dynamically switch between
|
|
||||||
standard and optimized versions of some routines. Currently these are
|
|
||||||
limited to three computationally intensive tasks when reading PNG files:
|
|
||||||
decoding row filters, expanding interlacing, and combining interlaced or
|
|
||||||
transparent row data with previous row data. Currently the optimized
|
|
||||||
versions are available only for x86 (Intel, AMD, etc.) platforms with
|
|
||||||
MMX support, though this may change in future versions. (For example,
|
|
||||||
the non-MMX assembler optimizations for zlib might become similarly
|
|
||||||
runtime-selectable in future releases, in which case libpng could be
|
|
||||||
extended to support them. Alternatively, the compile-time choice of
|
|
||||||
floating-point versus integer routines for gamma correction might become
|
|
||||||
runtime-selectable.)
|
|
||||||
|
|
||||||
Because such optimizations tend to be very platform- and compiler-dependent,
|
|
||||||
both in how they are written and in how they perform, the new runtime code
|
|
||||||
in libpng has been written to allow programs to query, enable, and disable
|
|
||||||
either specific optimizations or all such optimizations. For example, to
|
|
||||||
enable all possible optimizations (bearing in mind that some "optimizations"
|
|
||||||
may actually run more slowly in rare cases):
|
|
||||||
|
|
||||||
#if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
|
||||||
png_uint_32 mask, flags;
|
|
||||||
|
|
||||||
flags = png_get_asm_flags(png_ptr);
|
|
||||||
mask = png_get_asm_flagmask(PNG_SELECT_READ | PNG_SELECT_WRITE);
|
|
||||||
png_set_asm_flags(png_ptr, flags | mask);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
To enable only optimizations relevant to reading PNGs, use PNG_SELECT_READ
|
|
||||||
by itself when calling png_get_asm_flagmask(); similarly for optimizing
|
|
||||||
only writing. To disable all optimizations:
|
|
||||||
|
|
||||||
#if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
|
||||||
flags = png_get_asm_flags(png_ptr);
|
|
||||||
mask = png_get_asm_flagmask(PNG_SELECT_READ | PNG_SELECT_WRITE);
|
|
||||||
png_set_asm_flags(png_ptr, flags & ~mask);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
To enable or disable only MMX-related features, use png_get_mmx_flagmask()
|
|
||||||
in place of png_get_asm_flagmask(). The mmx version takes one additional
|
|
||||||
parameter:
|
|
||||||
|
|
||||||
#if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
|
||||||
int selection = PNG_SELECT_READ | PNG_SELECT_WRITE;
|
|
||||||
int compilerID;
|
|
||||||
|
|
||||||
mask = png_get_mmx_flagmask(selection, &compilerID);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
On return, compilerID will indicate which version of the MMX assembler
|
|
||||||
optimizations was compiled. Currently two flavors exist: Microsoft
|
|
||||||
Visual C++ (compilerID == 1) and GNU C (a.k.a. gcc/gas, compilerID == 2).
|
|
||||||
On non-x86 platforms or on systems compiled without MMX optimizations, a
|
|
||||||
value of -1 is used.
|
|
||||||
|
|
||||||
Note that both png_get_asm_flagmask() and png_get_mmx_flagmask() return
|
|
||||||
all valid, settable optimization bits for the version of the library that's
|
|
||||||
currently in use. In the case of shared (dynamically linked) libraries,
|
|
||||||
this may include optimizations that did not exist at the time the code was
|
|
||||||
written and compiled. It is also possible, of course, to enable only known,
|
|
||||||
specific optimizations; for example:
|
|
||||||
|
|
||||||
#if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
|
||||||
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 ;
|
|
||||||
png_set_asm_flags(png_ptr, flags);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
This method would enable only the MMX read-optimizations available at the
|
|
||||||
time of libpng 1.2.0's release, regardless of whether a later version of
|
|
||||||
the DLL were actually being used. (Also note that these functions did not
|
|
||||||
exist in versions older than 1.2.0, so any attempt to run a dynamically
|
|
||||||
linked app on such an older version would fail.)
|
|
||||||
|
|
||||||
To determine whether the processor supports MMX instructions at all, use
|
|
||||||
the png_mmx_support() function:
|
|
||||||
|
|
||||||
#if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
|
||||||
mmxsupport = png_mmx_support();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
It returns -1 if MMX support is not compiled into libpng, 0 if MMX code
|
|
||||||
is compiled but MMX is not supported by the processor, or 1 if MMX support
|
|
||||||
is fully available. Note that png_mmx_support(), png_get_mmx_flagmask(),
|
|
||||||
and png_get_asm_flagmask() all may be called without allocating and ini-
|
|
||||||
tializing any PNG structures (for example, as part of a usage screen or
|
|
||||||
"about" box).
|
|
||||||
|
|
||||||
The following code can be used to prevent an application from using the
|
|
||||||
thread_unsafe features, even if libpng was built with PNG_THREAD_UNSAFE_OK
|
|
||||||
defined:
|
|
||||||
|
|
||||||
#if defined(PNG_USE_PNGGCCRD) && defined(PNG_ASSEMBLER_CODE_SUPPORTED) \
|
|
||||||
&& defined(PNG_THREAD_UNSAFE_OK)
|
|
||||||
/* Disable thread-unsafe features of pnggccrd */
|
|
||||||
if (png_access_version() >= 10200)
|
|
||||||
{
|
|
||||||
png_uint_32 mmx_disable_mask = 0;
|
|
||||||
png_uint_32 asm_flags;
|
|
||||||
|
|
||||||
mmx_disable_mask |= ( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH );
|
|
||||||
asm_flags = png_get_asm_flags(png_ptr);
|
|
||||||
png_set_asm_flags(png_ptr, asm_flags & ~mmx_disable_mask);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
For more extensive examples of runtime querying, enabling and disabling
|
|
||||||
of optimized features, see contrib/gregbook/readpng2.c in the libpng
|
|
||||||
source-code distribution.
|
|
||||||
|
|
||||||
.SH VII. MNG support
|
|
||||||
|
|
||||||
The MNG specification (available at http://www.libpng.org/pub/mng) allows
|
The MNG specification (available at http://www.libpng.org/pub/mng) allows
|
||||||
certain extensions to PNG for PNG images that are embedded in MNG datastreams.
|
certain extensions to PNG for PNG images that are embedded in MNG datastreams.
|
||||||
@@ -3662,12 +3530,12 @@ Libpng can support some of these extensions. To enable them, use the
|
|||||||
png_permit_mng_features() function:
|
png_permit_mng_features() function:
|
||||||
|
|
||||||
feature_set = png_permit_mng_features(png_ptr, mask)
|
feature_set = png_permit_mng_features(png_ptr, mask)
|
||||||
mask is a png_uint_32 containing the logical OR of the
|
mask is a png_uint_32 containing the bitwise OR of the
|
||||||
features you want to enable. These include
|
features you want to enable. These include
|
||||||
PNG_FLAG_MNG_EMPTY_PLTE
|
PNG_FLAG_MNG_EMPTY_PLTE
|
||||||
PNG_FLAG_MNG_FILTER_64
|
PNG_FLAG_MNG_FILTER_64
|
||||||
PNG_ALL_MNG_FEATURES
|
PNG_ALL_MNG_FEATURES
|
||||||
feature_set is a png_uint_32 that is the logical AND of
|
feature_set is a png_uint_32 that is the bitwise AND of
|
||||||
your mask with the set of MNG features that is
|
your mask with the set of MNG features that is
|
||||||
supported by the version of libpng that you are using.
|
supported by the version of libpng that you are using.
|
||||||
|
|
||||||
@@ -3730,13 +3598,13 @@ application:
|
|||||||
|
|
||||||
.SH IX. Y2K Compliance in libpng
|
.SH IX. Y2K Compliance in libpng
|
||||||
|
|
||||||
April 19, 2006
|
February 28, 2009
|
||||||
|
|
||||||
Since the PNG Development group is an ad-hoc body, we can't make
|
Since the PNG Development group is an ad-hoc body, we can't make
|
||||||
an official declaration.
|
an official declaration.
|
||||||
|
|
||||||
This is your unofficial assurance that libpng from version 0.71 and
|
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
|
upward through 1.4.0beta49 are Y2K compliant. It is my belief that earlier
|
||||||
versions were also Y2K compliant.
|
versions were also Y2K compliant.
|
||||||
|
|
||||||
Libpng only has three year fields. One is a 2-byte unsigned integer that
|
Libpng only has three year fields. One is a 2-byte unsigned integer that
|
||||||
@@ -3893,7 +3761,18 @@ the first widely used release:
|
|||||||
1.2.9beta4-11 13 10209 12.so.0.9[.0]
|
1.2.9beta4-11 13 10209 12.so.0.9[.0]
|
||||||
1.2.9rc1 13 10209 12.so.0.9[.0]
|
1.2.9rc1 13 10209 12.so.0.9[.0]
|
||||||
1.2.9 13 10209 12.so.0.9[.0]
|
1.2.9 13 10209 12.so.0.9[.0]
|
||||||
1.2.10beta1-8 13 10210 12.so.0.10[.0]
|
1.2.10beta1-7 13 10210 12.so.0.10[.0]
|
||||||
|
1.2.10rc1-2 13 10210 12.so.0.10[.0]
|
||||||
|
1.2.10 13 10210 12.so.0.10[.0]
|
||||||
|
1.4.0beta1-6 14 10400 14.so.0.0[.0]
|
||||||
|
1.2.11beta1-4 13 10210 12.so.0.10[.0]
|
||||||
|
1.4.0beta7-8 14 10400 14.so.0.0[.0]
|
||||||
|
1.2.11 13 10211 12.so.0.11[.0]
|
||||||
|
1.2.12 13 10212 12.so.0.12[.0]
|
||||||
|
1.4.0beta9-14 14 10400 14.so.0.0[.0]
|
||||||
|
1.2.13 13 10213 12.so.0.13[.0]
|
||||||
|
1.4.0beta15-36 14 10400 14.so.0.0[.0]
|
||||||
|
1.4.0beta37-49 14 10400 14.so.14.0[.0]
|
||||||
|
|
||||||
Henceforth the source version will match the shared-library minor
|
Henceforth the source version will match the shared-library minor
|
||||||
and patch numbers; the shared-library major version number will be
|
and patch numbers; the shared-library major version number will be
|
||||||
@@ -3949,7 +3828,7 @@ possible without all of you.
|
|||||||
|
|
||||||
Thanks to Frank J. T. Wojcik for helping with the documentation.
|
Thanks to Frank J. T. Wojcik for helping with the documentation.
|
||||||
|
|
||||||
Libpng version 1.2.10rc1 - April 19, 2006:
|
Libpng version 1.4.0beta49 - February 28, 2009:
|
||||||
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
|
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
|
||||||
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
|
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
|
||||||
|
|
||||||
@@ -3970,8 +3849,8 @@ included in the libpng distribution, the latter shall prevail.)
|
|||||||
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
|
libpng versions 1.2.6, August 15, 2004, through 1.4.0beta49, February 28, 2009, are
|
||||||
Copyright (c) 2004-2006 Glenn Randers-Pehrson, and are
|
Copyright (c) 2004,2006-2007 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
|
||||||
|
|
||||||
@@ -4069,7 +3948,7 @@ 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
|
February 28, 2009
|
||||||
|
|
||||||
.\" end of man page
|
.\" end of man page
|
||||||
|
|
||||||
|
|||||||
16
libpngpf.3
16
libpngpf.3
@@ -1,6 +1,6 @@
|
|||||||
.TH LIBPNGPF 3 "April 19, 2006"
|
.TH LIBPNGPF 3 "February 28, 2009"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.2.10rc1
|
libpng \- Portable Network Graphics (PNG) Reference Library 1.4.0beta49
|
||||||
(private functions)
|
(private functions)
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
\fB#include <png.h>\fP
|
\fB#include <png.h>\fP
|
||||||
@@ -81,7 +81,7 @@ 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
|
\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 +99,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
|
||||||
|
|
||||||
@@ -181,6 +181,8 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.10rc1
|
|||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_do_read_premultiply_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
||||||
|
|
||||||
\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
|
||||||
@@ -711,12 +713,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
|
||||||
|
|||||||
200
missing
200
missing
@@ -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=2006-05-10.23
|
||||||
|
|
||||||
|
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
|
||||||
|
# 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
|
||||||
@@ -15,8 +19,8 @@
|
|||||||
|
|
||||||
# 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, write to the Free Software
|
||||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
# 02111-1307, USA.
|
# 02110-1301, 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 +33,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 +44,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 +79,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 +87,15 @@ 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]
|
||||||
|
|
||||||
|
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,9 +104,44 @@ Supported PROGRAM values:
|
|||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
|
|
||||||
aclocal)
|
esac
|
||||||
|
|
||||||
|
# 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).
|
||||||
|
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 $1 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."
|
||||||
@@ -98,7 +150,7 @@ WARNING: \`$1' is missing on your system. You should only need it if
|
|||||||
|
|
||||||
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."
|
||||||
@@ -107,7 +159,7 @@ WARNING: \`$1' is missing on your system. You should only need it if
|
|||||||
|
|
||||||
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 +167,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 +176,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,71 +187,92 @@ 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
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
autom4te)
|
||||||
|
echo 1>&2 "\
|
||||||
|
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)
|
bison|yacc)
|
||||||
echo 1>&2 "\
|
echo 1>&2 "\
|
||||||
WARNING: \`$1' is missing on your system. You should only need it if
|
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
|
||||||
@@ -209,54 +282,58 @@ WARNING: \`$1' is missing on your system. You should only need it if
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
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 +347,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 +358,10 @@ 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-end: "$"
|
||||||
|
# End:
|
||||||
|
|||||||
167
mkinstalldirs
167
mkinstalldirs
@@ -1,40 +1,161 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# mkinstalldirs --- make directory hierarchy
|
# mkinstalldirs --- make directory hierarchy
|
||||||
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
|
|
||||||
|
scriptversion=2006-05-11.19
|
||||||
|
|
||||||
|
# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
|
||||||
# Created: 1993-05-16
|
# Created: 1993-05-16
|
||||||
# Public domain
|
# Public domain.
|
||||||
|
#
|
||||||
# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
|
# This file is maintained in Automake, please report
|
||||||
|
# bugs to <bug-automake@gnu.org> or send patches to
|
||||||
|
# <automake-patches@gnu.org>.
|
||||||
|
|
||||||
|
nl='
|
||||||
|
'
|
||||||
|
IFS=" "" $nl"
|
||||||
errstatus=0
|
errstatus=0
|
||||||
|
dirmode=
|
||||||
|
|
||||||
|
usage="\
|
||||||
|
Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
|
||||||
|
|
||||||
|
Create each directory DIR (with mode MODE, if specified), including all
|
||||||
|
leading file name components.
|
||||||
|
|
||||||
|
Report bugs to <bug-automake@gnu.org>."
|
||||||
|
|
||||||
|
# process command line arguments
|
||||||
|
while test $# -gt 0 ; do
|
||||||
|
case $1 in
|
||||||
|
-h | --help | --h*) # -h for help
|
||||||
|
echo "$usage"
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
-m) # -m PERM arg
|
||||||
|
shift
|
||||||
|
test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
|
||||||
|
dirmode=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--version)
|
||||||
|
echo "$0 $scriptversion"
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
--) # stop option processing
|
||||||
|
shift
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
-*) # unknown option
|
||||||
|
echo "$usage" 1>&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
*) # first non-opt arg
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
for file
|
for file
|
||||||
do
|
do
|
||||||
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
|
if test -d "$file"; then
|
||||||
shift
|
shift
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
pathcomp=
|
case $# in
|
||||||
for d
|
0) exit 0 ;;
|
||||||
do
|
esac
|
||||||
pathcomp="$pathcomp$d"
|
|
||||||
case "$pathcomp" in
|
|
||||||
-* ) pathcomp=./$pathcomp ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if test ! -d "$pathcomp"; then
|
# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and
|
||||||
echo "mkdir $pathcomp"
|
# mkdir -p a/c at the same time, both will detect that a is missing,
|
||||||
|
# one will create a, then the other will try to create a and die with
|
||||||
|
# a "File exists" error. This is a problem when calling mkinstalldirs
|
||||||
|
# from a parallel make. We use --version in the probe to restrict
|
||||||
|
# ourselves to GNU mkdir, which is thread-safe.
|
||||||
|
case $dirmode in
|
||||||
|
'')
|
||||||
|
if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
|
||||||
|
echo "mkdir -p -- $*"
|
||||||
|
exec mkdir -p -- "$@"
|
||||||
|
else
|
||||||
|
# On NextStep and OpenStep, the `mkdir' command does not
|
||||||
|
# recognize any option. It will interpret all options as
|
||||||
|
# directories to create, and then abort because `.' already
|
||||||
|
# exists.
|
||||||
|
test -d ./-p && rmdir ./-p
|
||||||
|
test -d ./--version && rmdir ./--version
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
|
||||||
|
test ! -d ./--version; then
|
||||||
|
echo "mkdir -m $dirmode -p -- $*"
|
||||||
|
exec mkdir -m "$dirmode" -p -- "$@"
|
||||||
|
else
|
||||||
|
# Clean up after NextStep and OpenStep mkdir.
|
||||||
|
for d in ./-m ./-p ./--version "./$dirmode";
|
||||||
|
do
|
||||||
|
test -d $d && rmdir $d
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
mkdir "$pathcomp" || lasterr=$?
|
for file
|
||||||
|
do
|
||||||
|
case $file in
|
||||||
|
/*) pathcomp=/ ;;
|
||||||
|
*) pathcomp= ;;
|
||||||
|
esac
|
||||||
|
oIFS=$IFS
|
||||||
|
IFS=/
|
||||||
|
set fnord $file
|
||||||
|
shift
|
||||||
|
IFS=$oIFS
|
||||||
|
|
||||||
if test ! -d "$pathcomp"; then
|
for d
|
||||||
errstatus=$lasterr
|
do
|
||||||
fi
|
test "x$d" = x && continue
|
||||||
fi
|
|
||||||
|
|
||||||
pathcomp="$pathcomp/"
|
pathcomp=$pathcomp$d
|
||||||
done
|
case $pathcomp in
|
||||||
|
-*) pathcomp=./$pathcomp ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if test ! -d "$pathcomp"; then
|
||||||
|
echo "mkdir $pathcomp"
|
||||||
|
|
||||||
|
mkdir "$pathcomp" || lasterr=$?
|
||||||
|
|
||||||
|
if test ! -d "$pathcomp"; then
|
||||||
|
errstatus=$lasterr
|
||||||
|
else
|
||||||
|
if test ! -z "$dirmode"; then
|
||||||
|
echo "chmod $dirmode $pathcomp"
|
||||||
|
lasterr=
|
||||||
|
chmod "$dirmode" "$pathcomp" || lasterr=$?
|
||||||
|
|
||||||
|
if test ! -z "$lasterr"; then
|
||||||
|
errstatus=$lasterr
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
pathcomp=$pathcomp/
|
||||||
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
exit $errstatus
|
exit $errstatus
|
||||||
|
|
||||||
# mkinstalldirs ends here
|
# 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-end: "$"
|
||||||
|
# End:
|
||||||
|
|||||||
2
png.5
2
png.5
@@ -1,4 +1,4 @@
|
|||||||
.TH PNG 5 "April 19, 2006"
|
.TH PNG 5 "February 28, 2009"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
png \- Portable Network Graphics (PNG) format
|
png \- Portable Network Graphics (PNG) format
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
|
|||||||
399
png.c
399
png.c
@@ -1,32 +1,32 @@
|
|||||||
|
|
||||||
/* png.c - location for general purpose libpng functions
|
/* png.c - location for general purpose libpng functions
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.2.9 April 14, 2006
|
* Last changed in libpng 1.4.0 [February 28, 2009]
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2009 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.)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
|
||||||
#define PNG_NO_EXTERN
|
#define PNG_NO_EXTERN
|
||||||
#include "png.h"
|
#include "png.h"
|
||||||
|
#include "pngpriv.h"
|
||||||
|
|
||||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||||
typedef version_1_2_10rc1 Your_png_h_is_not_version_1_2_10rc1;
|
typedef version_1_4_0beta49 Your_png_h_is_not_version_1_4_0beta49;
|
||||||
|
|
||||||
/* Version information for C files. This had better match the version
|
/* Version information for C files. This had better match the version
|
||||||
* string defined in png.h. */
|
* string defined in png.h. */
|
||||||
|
|
||||||
#ifdef PNG_USE_GLOBAL_ARRAYS
|
#ifdef PNG_USE_GLOBAL_ARRAYS
|
||||||
/* png_libpng_ver was changed to a function in version 1.0.5c */
|
/* png_libpng_ver was changed to a function in version 1.0.5c */
|
||||||
const char png_libpng_ver[18] = PNG_LIBPNG_VER_STRING;
|
PNG_CONST char png_libpng_ver[18] = PNG_LIBPNG_VER_STRING;
|
||||||
|
|
||||||
#ifdef PNG_READ_SUPPORTED
|
#ifdef PNG_READ_SUPPORTED
|
||||||
|
|
||||||
/* png_sig was changed to a function in version 1.0.5c */
|
/* png_sig was changed to a function in version 1.0.5c */
|
||||||
/* Place to hold the signature string for a PNG file. */
|
/* Place to hold the signature string for a PNG file. */
|
||||||
const png_byte FARDATA png_sig[8] = {137, 80, 78, 71, 13, 10, 26, 10};
|
PNG_CONST png_byte FARDATA png_sig[8] = {137, 80, 78, 71, 13, 10, 26, 10};
|
||||||
#endif /* PNG_READ_SUPPORTED */
|
#endif /* PNG_READ_SUPPORTED */
|
||||||
|
|
||||||
/* Invoke global declarations for constant strings for known chunk types */
|
/* Invoke global declarations for constant strings for known chunk types */
|
||||||
@@ -56,32 +56,27 @@ PNG_zTXt;
|
|||||||
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
||||||
|
|
||||||
/* start of interlace block */
|
/* start of interlace block */
|
||||||
const int FARDATA png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
|
PNG_CONST int FARDATA png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
|
||||||
|
|
||||||
/* offset to next interlace block */
|
/* offset to next interlace block */
|
||||||
const int FARDATA png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
|
PNG_CONST int FARDATA png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
|
||||||
|
|
||||||
/* start of interlace block in the y direction */
|
/* start of interlace block in the y direction */
|
||||||
const int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
|
PNG_CONST int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
|
||||||
|
|
||||||
/* offset to next interlace block in the y direction */
|
/* offset to next interlace block in the y direction */
|
||||||
const int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
|
PNG_CONST int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
|
||||||
|
|
||||||
/* width of interlace block (used in assembler routines only) */
|
|
||||||
#ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW
|
|
||||||
const int FARDATA png_pass_width[] = {8, 4, 4, 2, 2, 1, 1};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Height of interlace block. This is not currently used - if you need
|
/* Height of interlace block. This is not currently used - if you need
|
||||||
* it, uncomment it here and in png.h
|
* it, uncomment it here and in png.h
|
||||||
const int FARDATA png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
|
PNG_CONST int FARDATA png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Mask to determine which pixels are valid in a pass */
|
/* Mask to determine which pixels are valid in a pass */
|
||||||
const int FARDATA png_pass_mask[] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff};
|
PNG_CONST int FARDATA png_pass_mask[] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff};
|
||||||
|
|
||||||
/* Mask to determine which pixels to overwrite while displaying */
|
/* Mask to determine which pixels to overwrite while displaying */
|
||||||
const int FARDATA png_pass_dsp_mask[]
|
PNG_CONST int FARDATA png_pass_dsp_mask[]
|
||||||
= {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff};
|
= {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff};
|
||||||
|
|
||||||
#endif /* PNG_READ_SUPPORTED */
|
#endif /* PNG_READ_SUPPORTED */
|
||||||
@@ -97,9 +92,10 @@ const int FARDATA png_pass_dsp_mask[]
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_sig_bytes(png_structp png_ptr, int num_bytes)
|
png_set_sig_bytes(png_structp png_ptr, int num_bytes)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_sig_bytes\n");
|
if (png_ptr == NULL) return;
|
||||||
|
png_debug(1, "in png_set_sig_bytes");
|
||||||
if (num_bytes > 8)
|
if (num_bytes > 8)
|
||||||
png_error(png_ptr, "Too many bytes for PNG signature.");
|
png_error(png_ptr, "Too many bytes for PNG signature");
|
||||||
|
|
||||||
png_ptr->sig_bytes = (png_byte)(num_bytes < 0 ? 0 : num_bytes);
|
png_ptr->sig_bytes = (png_byte)(num_bytes < 0 ? 0 : num_bytes);
|
||||||
}
|
}
|
||||||
@@ -130,68 +126,35 @@ png_sig_cmp(png_bytep sig, png_size_t start, png_size_t num_to_check)
|
|||||||
return ((int)(png_memcmp(&sig[start], &png_signature[start], num_to_check)));
|
return ((int)(png_memcmp(&sig[start], &png_signature[start], num_to_check)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PNG_1_0_X) || defined(PNG_1_2_X)
|
|
||||||
/* (Obsolete) function to check signature bytes. It does not allow one
|
|
||||||
* to check a partial signature. This function might be removed in the
|
|
||||||
* future - use png_sig_cmp(). Returns true (nonzero) if the file is a PNG.
|
|
||||||
*/
|
|
||||||
int PNGAPI
|
|
||||||
png_check_sig(png_bytep sig, int num)
|
|
||||||
{
|
|
||||||
return ((int)!png_sig_cmp(sig, (png_size_t)0, (png_size_t)num));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* PNG_READ_SUPPORTED */
|
#endif /* PNG_READ_SUPPORTED */
|
||||||
|
|
||||||
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
||||||
/* Function to allocate memory for zlib and clear it to 0. */
|
/* Function to allocate memory for zlib and clear it to 0. */
|
||||||
#ifdef PNG_1_0_X
|
|
||||||
voidpf PNGAPI
|
|
||||||
#else
|
|
||||||
voidpf /* private */
|
voidpf /* private */
|
||||||
#endif
|
|
||||||
png_zalloc(voidpf png_ptr, uInt items, uInt size)
|
png_zalloc(voidpf png_ptr, uInt items, uInt size)
|
||||||
{
|
{
|
||||||
png_voidp ptr;
|
png_voidp ptr;
|
||||||
png_structp p=png_ptr;
|
png_structp p=(png_structp)png_ptr;
|
||||||
png_uint_32 save_flags=p->flags;
|
png_uint_32 save_flags=p->flags;
|
||||||
png_uint_32 num_bytes;
|
png_alloc_size_t num_bytes;
|
||||||
|
|
||||||
|
if (png_ptr == NULL) return (NULL);
|
||||||
if (items > PNG_UINT_32_MAX/size)
|
if (items > PNG_UINT_32_MAX/size)
|
||||||
{
|
{
|
||||||
png_warning (png_ptr, "Potential overflow in png_zalloc()");
|
png_warning (p, "Potential overflow in png_zalloc()");
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
num_bytes = (png_uint_32)items * size;
|
num_bytes = (png_alloc_size_t)items * size;
|
||||||
|
|
||||||
p->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK;
|
p->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK;
|
||||||
ptr = (png_voidp)png_malloc((png_structp)png_ptr, num_bytes);
|
ptr = (png_voidp)png_malloc((png_structp)png_ptr, num_bytes);
|
||||||
p->flags=save_flags;
|
p->flags=save_flags;
|
||||||
|
|
||||||
#if defined(PNG_1_0_X) && !defined(PNG_NO_ZALLOC_ZERO)
|
|
||||||
if (ptr == NULL)
|
|
||||||
return ((voidpf)ptr);
|
|
||||||
|
|
||||||
if (num_bytes > (png_uint_32)0x8000L)
|
|
||||||
{
|
|
||||||
png_memset(ptr, 0, (png_size_t)0x8000L);
|
|
||||||
png_memset((png_bytep)ptr + (png_size_t)0x8000L, 0,
|
|
||||||
(png_size_t)(num_bytes - (png_uint_32)0x8000L));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
png_memset(ptr, 0, (png_size_t)num_bytes);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return ((voidpf)ptr);
|
return ((voidpf)ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* function to free memory for zlib */
|
/* function to free memory for zlib */
|
||||||
#ifdef PNG_1_0_X
|
|
||||||
void PNGAPI
|
|
||||||
#else
|
|
||||||
void /* private */
|
void /* private */
|
||||||
#endif
|
|
||||||
png_zfree(voidpf png_ptr, voidpf ptr)
|
png_zfree(voidpf png_ptr, voidpf ptr)
|
||||||
{
|
{
|
||||||
png_free((png_structp)png_ptr, (png_voidp)ptr);
|
png_free((png_structp)png_ptr, (png_voidp)ptr);
|
||||||
@@ -243,8 +206,8 @@ png_create_info_struct(png_structp png_ptr)
|
|||||||
{
|
{
|
||||||
png_infop info_ptr;
|
png_infop info_ptr;
|
||||||
|
|
||||||
png_debug(1, "in png_create_info_struct\n");
|
png_debug(1, "in png_create_info_struct");
|
||||||
if(png_ptr == NULL) return (NULL);
|
if (png_ptr == NULL) return (NULL);
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
info_ptr = (png_infop)png_create_struct_2(PNG_STRUCT_INFO,
|
info_ptr = (png_infop)png_create_struct_2(PNG_STRUCT_INFO,
|
||||||
png_ptr->malloc_fn, png_ptr->mem_ptr);
|
png_ptr->malloc_fn, png_ptr->mem_ptr);
|
||||||
@@ -266,8 +229,9 @@ void PNGAPI
|
|||||||
png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr)
|
png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr)
|
||||||
{
|
{
|
||||||
png_infop info_ptr = NULL;
|
png_infop info_ptr = NULL;
|
||||||
|
if (png_ptr == NULL) return;
|
||||||
|
|
||||||
png_debug(1, "in png_destroy_info_struct\n");
|
png_debug(1, "in png_destroy_info_struct");
|
||||||
if (info_ptr_ptr != NULL)
|
if (info_ptr_ptr != NULL)
|
||||||
info_ptr = *info_ptr_ptr;
|
info_ptr = *info_ptr_ptr;
|
||||||
|
|
||||||
@@ -289,24 +253,17 @@ png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr)
|
|||||||
* and applications using it are urged to use png_create_info_struct()
|
* and applications using it are urged to use png_create_info_struct()
|
||||||
* instead.
|
* instead.
|
||||||
*/
|
*/
|
||||||
#if defined(PNG_1_0_X) || defined(PNG_1_2_X)
|
|
||||||
#undef png_info_init
|
|
||||||
void PNGAPI
|
|
||||||
png_info_init(png_infop info_ptr)
|
|
||||||
{
|
|
||||||
/* We only come here via pre-1.0.12-compiled applications */
|
|
||||||
png_info_init_3(&info_ptr, 0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_info_init_3(png_infopp ptr_ptr, png_size_t png_info_struct_size)
|
png_info_init_3(png_infopp ptr_ptr, png_size_t png_info_struct_size)
|
||||||
{
|
{
|
||||||
png_infop info_ptr = *ptr_ptr;
|
png_infop info_ptr = *ptr_ptr;
|
||||||
|
|
||||||
png_debug(1, "in png_info_init_3\n");
|
if (info_ptr == NULL) return;
|
||||||
|
|
||||||
if(png_sizeof(png_info) > png_info_struct_size)
|
png_debug(1, "in png_info_init_3");
|
||||||
|
|
||||||
|
if (png_sizeof(png_info) > png_info_struct_size)
|
||||||
{
|
{
|
||||||
png_destroy_struct(info_ptr);
|
png_destroy_struct(info_ptr);
|
||||||
info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO);
|
info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO);
|
||||||
@@ -314,7 +271,7 @@ png_info_init_3(png_infopp ptr_ptr, png_size_t png_info_struct_size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* set everything to 0 */
|
/* set everything to 0 */
|
||||||
png_memset(info_ptr, 0, png_sizeof (png_info));
|
png_memset(info_ptr, 0, png_sizeof(png_info));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_FREE_ME_SUPPORTED
|
#ifdef PNG_FREE_ME_SUPPORTED
|
||||||
@@ -322,16 +279,16 @@ void PNGAPI
|
|||||||
png_data_freer(png_structp png_ptr, png_infop info_ptr,
|
png_data_freer(png_structp png_ptr, png_infop info_ptr,
|
||||||
int freer, png_uint_32 mask)
|
int freer, png_uint_32 mask)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_data_freer\n");
|
png_debug(1, "in png_data_freer");
|
||||||
if (png_ptr == NULL || info_ptr == NULL)
|
if (png_ptr == NULL || info_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
if(freer == PNG_DESTROY_WILL_FREE_DATA)
|
if (freer == PNG_DESTROY_WILL_FREE_DATA)
|
||||||
info_ptr->free_me |= mask;
|
info_ptr->free_me |= mask;
|
||||||
else if(freer == PNG_USER_WILL_FREE_DATA)
|
else if (freer == PNG_USER_WILL_FREE_DATA)
|
||||||
info_ptr->free_me &= ~mask;
|
info_ptr->free_me &= ~mask;
|
||||||
else
|
else
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"Unknown freer parameter in png_data_freer.");
|
"Unknown freer parameter in png_data_freer");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -339,7 +296,7 @@ void PNGAPI
|
|||||||
png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
|
png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
|
||||||
int num)
|
int num)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_free_data\n");
|
png_debug(1, "in png_free_data");
|
||||||
if (png_ptr == NULL || info_ptr == NULL)
|
if (png_ptr == NULL || info_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -380,11 +337,11 @@ if ((mask & PNG_FREE_TRNS) && (png_ptr->flags & PNG_FLAG_FREE_TRNS))
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
png_free(png_ptr, info_ptr->trans);
|
png_free(png_ptr, info_ptr->trans);
|
||||||
|
info_ptr->trans = NULL;
|
||||||
info_ptr->valid &= ~PNG_INFO_tRNS;
|
info_ptr->valid &= ~PNG_INFO_tRNS;
|
||||||
#ifndef PNG_FREE_ME_SUPPORTED
|
#ifndef PNG_FREE_ME_SUPPORTED
|
||||||
png_ptr->flags &= ~PNG_FLAG_FREE_TRNS;
|
png_ptr->flags &= ~PNG_FLAG_FREE_TRNS;
|
||||||
#endif
|
#endif
|
||||||
info_ptr->trans = NULL;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -459,7 +416,7 @@ if (mask & PNG_FREE_SPLT)
|
|||||||
{
|
{
|
||||||
if (num != -1)
|
if (num != -1)
|
||||||
{
|
{
|
||||||
if(info_ptr->splt_palettes)
|
if (info_ptr->splt_palettes)
|
||||||
{
|
{
|
||||||
png_free(png_ptr, info_ptr->splt_palettes[num].name);
|
png_free(png_ptr, info_ptr->splt_palettes[num].name);
|
||||||
png_free(png_ptr, info_ptr->splt_palettes[num].entries);
|
png_free(png_ptr, info_ptr->splt_palettes[num].entries);
|
||||||
@@ -469,7 +426,7 @@ if (mask & PNG_FREE_SPLT)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(info_ptr->splt_palettes_num)
|
if (info_ptr->splt_palettes_num)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < (int)info_ptr->splt_palettes_num; i++)
|
for (i = 0; i < (int)info_ptr->splt_palettes_num; i++)
|
||||||
@@ -485,6 +442,12 @@ if (mask & PNG_FREE_SPLT)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
||||||
|
if (png_ptr->unknown_chunk.data)
|
||||||
|
{
|
||||||
|
png_free(png_ptr, png_ptr->unknown_chunk.data);
|
||||||
|
png_ptr->unknown_chunk.data = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef PNG_FREE_ME_SUPPORTED
|
#ifdef PNG_FREE_ME_SUPPORTED
|
||||||
if ((mask & PNG_FREE_UNKN) & info_ptr->free_me)
|
if ((mask & PNG_FREE_UNKN) & info_ptr->free_me)
|
||||||
#else
|
#else
|
||||||
@@ -493,7 +456,7 @@ if (mask & PNG_FREE_UNKN)
|
|||||||
{
|
{
|
||||||
if (num != -1)
|
if (num != -1)
|
||||||
{
|
{
|
||||||
if(info_ptr->unknown_chunks)
|
if (info_ptr->unknown_chunks)
|
||||||
{
|
{
|
||||||
png_free(png_ptr, info_ptr->unknown_chunks[num].data);
|
png_free(png_ptr, info_ptr->unknown_chunks[num].data);
|
||||||
info_ptr->unknown_chunks[num].data = NULL;
|
info_ptr->unknown_chunks[num].data = NULL;
|
||||||
@@ -503,7 +466,7 @@ if (mask & PNG_FREE_UNKN)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if(info_ptr->unknown_chunks_num)
|
if (info_ptr->unknown_chunks_num)
|
||||||
{
|
{
|
||||||
for (i = 0; i < (int)info_ptr->unknown_chunks_num; i++)
|
for (i = 0; i < (int)info_ptr->unknown_chunks_num; i++)
|
||||||
png_free_data(png_ptr, info_ptr, PNG_FREE_UNKN, i);
|
png_free_data(png_ptr, info_ptr, PNG_FREE_UNKN, i);
|
||||||
@@ -557,23 +520,21 @@ if ((mask & PNG_FREE_ROWS) & info_ptr->free_me)
|
|||||||
if (mask & PNG_FREE_ROWS)
|
if (mask & PNG_FREE_ROWS)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if(info_ptr->row_pointers)
|
if (info_ptr->row_pointers)
|
||||||
{
|
{
|
||||||
int row;
|
int row;
|
||||||
for (row = 0; row < (int)info_ptr->height; row++)
|
for (row = 0; row < (int)info_ptr->height; row++)
|
||||||
{
|
{
|
||||||
png_free(png_ptr, info_ptr->row_pointers[row]);
|
png_free(png_ptr, info_ptr->row_pointers[row]);
|
||||||
info_ptr->row_pointers[row]=NULL;
|
|
||||||
}
|
}
|
||||||
png_free(png_ptr, info_ptr->row_pointers);
|
png_free(png_ptr, info_ptr->row_pointers);
|
||||||
info_ptr->row_pointers=NULL;
|
|
||||||
}
|
}
|
||||||
info_ptr->valid &= ~PNG_INFO_IDAT;
|
info_ptr->valid &= ~PNG_INFO_IDAT;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_FREE_ME_SUPPORTED
|
#ifdef PNG_FREE_ME_SUPPORTED
|
||||||
if(num == -1)
|
if (num == -1)
|
||||||
info_ptr->free_me &= ~mask;
|
info_ptr->free_me &= ~mask;
|
||||||
else
|
else
|
||||||
info_ptr->free_me &= ~(mask & ~PNG_FREE_MUL);
|
info_ptr->free_me &= ~(mask & ~PNG_FREE_MUL);
|
||||||
@@ -587,7 +548,7 @@ if (mask & PNG_FREE_ROWS)
|
|||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_info_destroy(png_structp png_ptr, png_infop info_ptr)
|
png_info_destroy(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_info_destroy\n");
|
png_debug(1, "in png_info_destroy");
|
||||||
|
|
||||||
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
|
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
|
||||||
|
|
||||||
@@ -595,8 +556,7 @@ png_info_destroy(png_structp png_ptr, png_infop info_ptr)
|
|||||||
if (png_ptr->num_chunk_list)
|
if (png_ptr->num_chunk_list)
|
||||||
{
|
{
|
||||||
png_free(png_ptr, png_ptr->chunk_list);
|
png_free(png_ptr, png_ptr->chunk_list);
|
||||||
png_ptr->chunk_list=NULL;
|
png_ptr->num_chunk_list = 0;
|
||||||
png_ptr->num_chunk_list=0;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -611,6 +571,7 @@ png_info_destroy(png_structp png_ptr, png_infop info_ptr)
|
|||||||
png_voidp PNGAPI
|
png_voidp PNGAPI
|
||||||
png_get_io_ptr(png_structp png_ptr)
|
png_get_io_ptr(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
|
if (png_ptr == NULL) return (NULL);
|
||||||
return (png_ptr->io_ptr);
|
return (png_ptr->io_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -625,7 +586,8 @@ png_get_io_ptr(png_structp png_ptr)
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_init_io(png_structp png_ptr, png_FILE_p fp)
|
png_init_io(png_structp png_ptr, png_FILE_p fp)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_init_io\n");
|
png_debug(1, "in png_init_io");
|
||||||
|
if (png_ptr == NULL) return;
|
||||||
png_ptr->io_ptr = (png_voidp)fp;
|
png_ptr->io_ptr = (png_voidp)fp;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -641,27 +603,17 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
|
|||||||
{"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
{"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
||||||
|
|
||||||
|
if (png_ptr == NULL) return (NULL);
|
||||||
if (png_ptr->time_buffer == NULL)
|
if (png_ptr->time_buffer == NULL)
|
||||||
{
|
{
|
||||||
png_ptr->time_buffer = (png_charp)png_malloc(png_ptr, (png_uint_32)(29*
|
png_ptr->time_buffer = (png_charp)png_malloc(png_ptr, (png_uint_32)(29*
|
||||||
png_sizeof(char)));
|
png_sizeof(char)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
{
|
|
||||||
wchar_t time_buf[29];
|
|
||||||
wsprintf(time_buf, TEXT("%d %S %d %02d:%02d:%02d +0000"),
|
|
||||||
ptime->day % 32, short_months[(ptime->month - 1) % 12],
|
|
||||||
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
|
||||||
ptime->second % 61);
|
|
||||||
WideCharToMultiByte(CP_ACP, 0, time_buf, -1, png_ptr->time_buffer, 29,
|
|
||||||
NULL, NULL);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#ifdef USE_FAR_KEYWORD
|
#ifdef USE_FAR_KEYWORD
|
||||||
{
|
{
|
||||||
char near_time_buf[29];
|
char near_time_buf[29];
|
||||||
sprintf(near_time_buf, "%d %s %d %02d:%02d:%02d +0000",
|
png_snprintf6(near_time_buf, 29, "%d %s %d %02d:%02d:%02d +0000",
|
||||||
ptime->day % 32, short_months[(ptime->month - 1) % 12],
|
ptime->day % 32, short_months[(ptime->month - 1) % 12],
|
||||||
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
||||||
ptime->second % 61);
|
ptime->second % 61);
|
||||||
@@ -669,35 +621,38 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
|
|||||||
29*png_sizeof(char));
|
29*png_sizeof(char));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
sprintf(png_ptr->time_buffer, "%d %s %d %02d:%02d:%02d +0000",
|
png_snprintf6(png_ptr->time_buffer, 29, "%d %s %d %02d:%02d:%02d +0000",
|
||||||
ptime->day % 32, short_months[(ptime->month - 1) % 12],
|
ptime->day % 32, short_months[(ptime->month - 1) % 12],
|
||||||
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
||||||
ptime->second % 61);
|
ptime->second % 61);
|
||||||
#endif
|
#endif
|
||||||
#endif /* _WIN32_WCE */
|
|
||||||
return ((png_charp)png_ptr->time_buffer);
|
return ((png_charp)png_ptr->time_buffer);
|
||||||
}
|
}
|
||||||
#endif /* PNG_TIME_RFC1123_SUPPORTED */
|
#endif /* PNG_TIME_RFC1123_SUPPORTED */
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* Signature string for a PNG file. */
|
|
||||||
png_bytep PNGAPI
|
|
||||||
png_sig_bytes(void)
|
|
||||||
{
|
|
||||||
return ((png_bytep)"\211\120\116\107\015\012\032\012");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */
|
#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */
|
||||||
|
|
||||||
png_charp PNGAPI
|
png_charp PNGAPI
|
||||||
png_get_copyright(png_structp png_ptr)
|
png_get_copyright(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
if (&png_ptr != NULL) /* silence compiler warning about unused png_ptr */
|
png_ptr = png_ptr; /* silence compiler warning about unused png_ptr */
|
||||||
return ((png_charp) "\n libpng version 1.2.10rc1 - April 19, 2006\n\
|
#ifdef PNG_STRING_COPYRIGHT
|
||||||
Copyright (c) 1998-2006 Glenn Randers-Pehrson\n\
|
return PNG_STRING_COPYRIGHT
|
||||||
Copyright (c) 1996-1997 Andreas Dilger\n\
|
#else
|
||||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n");
|
#ifdef __STDC__
|
||||||
return ((png_charp) "");
|
return ((png_charp) PNG_STRING_NEWLINE \
|
||||||
|
"libpng version x 1.4.0beta49 - February 28, 2009" PNG_STRING_NEWLINE \
|
||||||
|
"Copyright (c) 1998-2009 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
|
||||||
|
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
||||||
|
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
||||||
|
PNG_STRING_NEWLINE);
|
||||||
|
#else
|
||||||
|
return ((png_charp) "libpng version 1.4.0beta49 - February 28, 2009\
|
||||||
|
Copyright (c) 1998-2009 Glenn Randers-Pehrson\
|
||||||
|
Copyright (c) 1996-1997 Andreas Dilger\
|
||||||
|
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.");
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The following return the library version as a short string in the
|
/* The following return the library version as a short string in the
|
||||||
@@ -712,27 +667,32 @@ png_charp PNGAPI
|
|||||||
png_get_libpng_ver(png_structp png_ptr)
|
png_get_libpng_ver(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
/* Version of *.c files used when building libpng */
|
/* Version of *.c files used when building libpng */
|
||||||
if (&png_ptr != NULL) /* silence compiler warning about unused png_ptr */
|
png_ptr = png_ptr; /* silence compiler warning about unused png_ptr */
|
||||||
return ((png_charp) PNG_LIBPNG_VER_STRING);
|
return ((png_charp) PNG_LIBPNG_VER_STRING);
|
||||||
return ((png_charp) "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
png_charp PNGAPI
|
png_charp PNGAPI
|
||||||
png_get_header_ver(png_structp png_ptr)
|
png_get_header_ver(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
/* Version of *.h files used when building libpng */
|
/* Version of *.h files used when building libpng */
|
||||||
if (&png_ptr != NULL) /* silence compiler warning about unused png_ptr */
|
png_ptr = png_ptr; /* silence compiler warning about unused png_ptr */
|
||||||
return ((png_charp) PNG_LIBPNG_VER_STRING);
|
return ((png_charp) PNG_LIBPNG_VER_STRING);
|
||||||
return ((png_charp) "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
png_charp PNGAPI
|
png_charp PNGAPI
|
||||||
png_get_header_version(png_structp png_ptr)
|
png_get_header_version(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
/* Returns longer string containing both version and date */
|
/* Returns longer string containing both version and date */
|
||||||
if (&png_ptr != NULL) /* silence compiler warning about unused png_ptr */
|
png_ptr = png_ptr; /* silence compiler warning about unused png_ptr */
|
||||||
return ((png_charp) PNG_HEADER_VERSION_STRING);
|
#ifdef __STDC__
|
||||||
return ((png_charp) "");
|
return ((png_charp) PNG_HEADER_VERSION_STRING
|
||||||
|
#ifndef PNG_READ_SUPPORTED
|
||||||
|
" (NO READ SUPPORT)"
|
||||||
|
#endif
|
||||||
|
PNG_STRING_NEWLINE);
|
||||||
|
#else
|
||||||
|
return ((png_charp) PNG_HEADER_VERSION_STRING);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
||||||
@@ -743,12 +703,12 @@ png_handle_as_unknown(png_structp png_ptr, png_bytep chunk_name)
|
|||||||
/* check chunk_name and return "keep" value if it's on the list, else 0 */
|
/* check chunk_name and return "keep" value if it's on the list, else 0 */
|
||||||
int i;
|
int i;
|
||||||
png_bytep p;
|
png_bytep p;
|
||||||
if((png_ptr == NULL && chunk_name == NULL) || png_ptr->num_chunk_list<=0)
|
if (png_ptr == NULL || chunk_name == NULL || png_ptr->num_chunk_list<=0)
|
||||||
return 0;
|
return 0;
|
||||||
p=png_ptr->chunk_list+png_ptr->num_chunk_list*5-5;
|
p = png_ptr->chunk_list + png_ptr->num_chunk_list*5 - 5;
|
||||||
for (i = png_ptr->num_chunk_list; i; i--, p-=5)
|
for (i = png_ptr->num_chunk_list; i; i--, p -= 5)
|
||||||
if (!png_memcmp(chunk_name, p, 4))
|
if (!png_memcmp(chunk_name, p, 4))
|
||||||
return ((int)*(p+4));
|
return ((int)*(p + 4));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -757,6 +717,7 @@ png_handle_as_unknown(png_structp png_ptr, png_bytep chunk_name)
|
|||||||
int PNGAPI
|
int PNGAPI
|
||||||
png_reset_zstream(png_structp png_ptr)
|
png_reset_zstream(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
|
if (png_ptr == NULL) return Z_STREAM_ERROR;
|
||||||
return (inflateReset(&png_ptr->zstream));
|
return (inflateReset(&png_ptr->zstream));
|
||||||
}
|
}
|
||||||
#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */
|
#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */
|
||||||
@@ -770,67 +731,6 @@ png_access_version_number(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if defined(PNG_READ_SUPPORTED)
|
|
||||||
#if !defined(PNG_1_0_X)
|
|
||||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
|
|
||||||
/* GRR: could add this: && defined(PNG_MMX_CODE_SUPPORTED) */
|
|
||||||
/* this INTERNAL function was added to libpng 1.2.0 */
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_init_mmx_flags (png_structp png_ptr)
|
|
||||||
{
|
|
||||||
png_ptr->mmx_rowbytes_threshold = 0;
|
|
||||||
png_ptr->mmx_bitdepth_threshold = 0;
|
|
||||||
|
|
||||||
# if (defined(PNG_USE_PNGVCRD) || defined(PNG_USE_PNGGCCRD))
|
|
||||||
|
|
||||||
png_ptr->asm_flags |= PNG_ASM_FLAG_MMX_SUPPORT_COMPILED;
|
|
||||||
|
|
||||||
if (png_mmx_support() > 0) {
|
|
||||||
png_ptr->asm_flags |= PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU
|
|
||||||
# ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_COMBINE_ROW
|
|
||||||
# endif
|
|
||||||
# ifdef PNG_HAVE_ASSEMBLER_READ_INTERLACE
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_INTERLACE
|
|
||||||
# endif
|
|
||||||
# ifndef PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
|
|
||||||
;
|
|
||||||
# else
|
|
||||||
| 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 ;
|
|
||||||
|
|
||||||
png_ptr->mmx_rowbytes_threshold = PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT;
|
|
||||||
png_ptr->mmx_bitdepth_threshold = PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT;
|
|
||||||
# endif
|
|
||||||
} else {
|
|
||||||
png_ptr->asm_flags &= ~( PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU
|
|
||||||
| PNG_MMX_READ_FLAGS
|
|
||||||
| PNG_MMX_WRITE_FLAGS );
|
|
||||||
}
|
|
||||||
|
|
||||||
# else /* !((PNGVCRD || PNGGCCRD) && PNG_ASSEMBLER_CODE_SUPPORTED)) */
|
|
||||||
|
|
||||||
/* clear all MMX flags; no support is compiled in */
|
|
||||||
png_ptr->asm_flags &= ~( PNG_MMX_FLAGS );
|
|
||||||
|
|
||||||
# endif /* ?(PNGVCRD || PNGGCCRD) */
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* !(PNG_ASSEMBLER_CODE_SUPPORTED) */
|
|
||||||
|
|
||||||
/* this function was added to libpng 1.2.0 */
|
|
||||||
#if !defined(PNG_USE_PNGGCCRD) && \
|
|
||||||
!(defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_USE_PNGVCRD))
|
|
||||||
int PNGAPI
|
|
||||||
png_mmx_support(void)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* PNG_1_0_X */
|
|
||||||
#endif /* PNG_READ_SUPPORTED */
|
|
||||||
|
|
||||||
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
||||||
#ifdef PNG_SIZE_T
|
#ifdef PNG_SIZE_T
|
||||||
@@ -844,4 +744,117 @@ png_convert_size(size_t size)
|
|||||||
return ((png_size_t)size);
|
return ((png_size_t)size);
|
||||||
}
|
}
|
||||||
#endif /* PNG_SIZE_T */
|
#endif /* PNG_SIZE_T */
|
||||||
|
|
||||||
|
/* Added at libpng version 1.2.34 and 1.4.0 (moved from pngset.c) */
|
||||||
|
#if defined(PNG_cHRM_SUPPORTED)
|
||||||
|
#if !defined(PNG_NO_CHECK_cHRM)
|
||||||
|
|
||||||
|
/*
|
||||||
|
Multiply two 32-bit numbers, V1 and V2, using 32-bit
|
||||||
|
arithmetic, to produce a 64 bit result in the HI/LO words.
|
||||||
|
|
||||||
|
A B
|
||||||
|
x C D
|
||||||
|
------
|
||||||
|
AD || BD
|
||||||
|
AC || CB || 0
|
||||||
|
|
||||||
|
where A and B are the high and low 16-bit words of V1,
|
||||||
|
C and D are the 16-bit words of V2, AD is the product of
|
||||||
|
A and D, and X || Y is (X << 16) + Y.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void png_64bit_product (long v1, long v2, unsigned long *hi_product,
|
||||||
|
unsigned long *lo_product)
|
||||||
|
{
|
||||||
|
int a, b, c, d;
|
||||||
|
long lo, hi, x, y;
|
||||||
|
|
||||||
|
a = (v1 >> 16) & 0xffff;
|
||||||
|
b = v1 & 0xffff;
|
||||||
|
c = (v2 >> 16) & 0xffff;
|
||||||
|
d = v2 & 0xffff;
|
||||||
|
|
||||||
|
lo = b * d; /* BD */
|
||||||
|
x = a * d + c * b; /* AD + CB */
|
||||||
|
y = ((lo >> 16) & 0xffff) + x;
|
||||||
|
|
||||||
|
lo = (lo & 0xffff) | ((y & 0xffff) << 16);
|
||||||
|
hi = (y >> 16) & 0xffff;
|
||||||
|
|
||||||
|
hi += a * c; /* AC */
|
||||||
|
|
||||||
|
*hi_product = (unsigned long)hi;
|
||||||
|
*lo_product = (unsigned long)lo;
|
||||||
|
}
|
||||||
|
int /* private */
|
||||||
|
png_check_cHRM_fixed(png_structp png_ptr,
|
||||||
|
png_fixed_point white_x, png_fixed_point white_y, png_fixed_point red_x,
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
int ret = 1;
|
||||||
|
unsigned long xy_hi,xy_lo,yx_hi,yx_lo;
|
||||||
|
|
||||||
|
png_debug(1, "in function png_check_cHRM_fixed");
|
||||||
|
if (png_ptr == NULL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (white_x < 0 || white_y <= 0 ||
|
||||||
|
red_x < 0 || red_y < 0 ||
|
||||||
|
green_x < 0 || green_y < 0 ||
|
||||||
|
blue_x < 0 || blue_y < 0)
|
||||||
|
{
|
||||||
|
png_warning(png_ptr,
|
||||||
|
"Ignoring attempt to set negative chromaticity value");
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
if (white_x > (png_fixed_point) PNG_UINT_31_MAX ||
|
||||||
|
white_y > (png_fixed_point) PNG_UINT_31_MAX ||
|
||||||
|
red_x > (png_fixed_point) PNG_UINT_31_MAX ||
|
||||||
|
red_y > (png_fixed_point) PNG_UINT_31_MAX ||
|
||||||
|
green_x > (png_fixed_point) PNG_UINT_31_MAX ||
|
||||||
|
green_y > (png_fixed_point) PNG_UINT_31_MAX ||
|
||||||
|
blue_x > (png_fixed_point) PNG_UINT_31_MAX ||
|
||||||
|
blue_y > (png_fixed_point) PNG_UINT_31_MAX )
|
||||||
|
{
|
||||||
|
png_warning(png_ptr,
|
||||||
|
"Ignoring attempt to set chromaticity value exceeding 21474.83");
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
if (white_x > 100000L - white_y)
|
||||||
|
{
|
||||||
|
png_warning(png_ptr, "Invalid cHRM white point");
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
if (red_x > 100000L - red_y)
|
||||||
|
{
|
||||||
|
png_warning(png_ptr, "Invalid cHRM red point");
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
if (green_x > 100000L - green_y)
|
||||||
|
{
|
||||||
|
png_warning(png_ptr, "Invalid cHRM green point");
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
if (blue_x > 100000L - blue_y)
|
||||||
|
{
|
||||||
|
png_warning(png_ptr, "Invalid cHRM blue point");
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
png_64bit_product(green_x - red_x, blue_y - red_y, &xy_hi, &xy_lo);
|
||||||
|
png_64bit_product(green_y - red_y, blue_x - red_x, &yx_hi, &yx_lo);
|
||||||
|
|
||||||
|
if (xy_hi == yx_hi && xy_lo == yx_lo)
|
||||||
|
{
|
||||||
|
png_warning(png_ptr,
|
||||||
|
"Ignoring attempt to set cHRM RGB triangle with zero area");
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif /* NO_PNG_CHECK_cHRM */
|
||||||
|
#endif /* PNG_cHRM_SUPPORTED */
|
||||||
#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */
|
#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */
|
||||||
|
|||||||
395
pngconf.h
395
pngconf.h
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
/* pngconf.h - machine configurable file for libpng
|
/* pngconf.h - machine configurable file for libpng
|
||||||
*
|
*
|
||||||
* libpng version 1.2.10rc1 - April 19, 2006
|
* libpng version 1.4.0beta49 - February 28, 2009
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2005 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2009 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.)
|
||||||
*/
|
*/
|
||||||
@@ -17,9 +17,22 @@
|
|||||||
#ifndef PNGCONF_H
|
#ifndef PNGCONF_H
|
||||||
#define PNGCONF_H
|
#define PNGCONF_H
|
||||||
|
|
||||||
#define PNG_1_2_X
|
#ifndef PNG_NO_LIMITS_H
|
||||||
|
#include <limits.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/* Added at libpng-1.2.9 */
|
||||||
|
|
||||||
|
/* config.h is created by and PNG_CONFIGURE_LIBPNG is set by the "configure" script. */
|
||||||
|
#ifdef PNG_CONFIGURE_LIBPNG
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Added at libpng-1.2.8
|
||||||
|
*
|
||||||
* PNG_USER_CONFIG has to be defined on the compiler command line. This
|
* PNG_USER_CONFIG has to be defined on the compiler command line. This
|
||||||
* includes the resource compiler for Windows DLL configurations.
|
* includes the resource compiler for Windows DLL configurations.
|
||||||
*/
|
*/
|
||||||
@@ -30,16 +43,12 @@
|
|||||||
#include "pngusr.h"
|
#include "pngusr.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* PNG_CONFIGURE_LIBPNG is set by the "configure" script. */
|
/* Added at libpng-1.4.0beta49 for testing */
|
||||||
#ifdef PNG_CONFIGURE_LIBPNG
|
#ifndef PNG_NO_CALLOC
|
||||||
#ifdef HAVE_CONFIG_H
|
# define PNG_CALLOC_SUPPORTED
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Added at libpng-1.2.8
|
|
||||||
*
|
|
||||||
* If you create a private DLL you need to define in "pngusr.h" the followings:
|
* If you create a private DLL you need to define in "pngusr.h" the followings:
|
||||||
* #define PNG_USER_PRIVATEBUILD <Describes by whom and why this version of
|
* #define PNG_USER_PRIVATEBUILD <Describes by whom and why this version of
|
||||||
* the DLL was built>
|
* the DLL was built>
|
||||||
@@ -104,9 +113,20 @@
|
|||||||
# define PNG_WRITE_SUPPORTED
|
# define PNG_WRITE_SUPPORTED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Enabled in 1.4.0. */
|
||||||
|
#ifdef PNG_ALLOW_BENIGN_ERRORS
|
||||||
|
# define png_benign_error png_warning
|
||||||
|
# define png_chunk_benign_error png_chunk_warning
|
||||||
|
#else
|
||||||
|
# ifndef PNG_BENIGN_ERRORS_SUPPORTED
|
||||||
|
# define png_benign_error png_error
|
||||||
|
# define png_chunk_benign_error png_chunk_error
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Enabled by default in 1.2.0. You can disable this if you don't need to
|
/* Enabled by default in 1.2.0. You can disable this if you don't need to
|
||||||
support PNGs that are embedded in MNG datastreams */
|
support PNGs that are embedded in MNG datastreams */
|
||||||
#if !defined(PNG_1_0_X) && !defined(PNG_NO_MNG_FEATURES)
|
#if !defined(PNG_NO_MNG_FEATURES)
|
||||||
# ifndef PNG_MNG_FEATURES_SUPPORTED
|
# ifndef PNG_MNG_FEATURES_SUPPORTED
|
||||||
# define PNG_MNG_FEATURES_SUPPORTED
|
# define PNG_MNG_FEATURES_SUPPORTED
|
||||||
# endif
|
# endif
|
||||||
@@ -248,10 +268,7 @@
|
|||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# else
|
# else
|
||||||
# if !defined(_WIN32_WCE)
|
# include <stdio.h>
|
||||||
/* "stdio.h" functions are not supported on WindowsCE */
|
|
||||||
# include <stdio.h>
|
|
||||||
# endif
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
/* This macro protects us against machines that don't have function
|
/* This macro protects us against machines that don't have function
|
||||||
@@ -269,9 +286,6 @@
|
|||||||
|
|
||||||
#ifdef _NO_PROTO
|
#ifdef _NO_PROTO
|
||||||
# define PNGARG(arglist) ()
|
# define PNGARG(arglist) ()
|
||||||
# ifndef PNG_TYPECAST_NULL
|
|
||||||
# define PNG_TYPECAST_NULL
|
|
||||||
# endif
|
|
||||||
#else
|
#else
|
||||||
# define PNGARG(arglist) arglist
|
# define PNGARG(arglist) arglist
|
||||||
#endif /* _NO_PROTO */
|
#endif /* _NO_PROTO */
|
||||||
@@ -324,6 +338,9 @@
|
|||||||
|
|
||||||
# ifdef __linux__
|
# ifdef __linux__
|
||||||
# ifdef PNG_SAVE_BSD_SOURCE
|
# ifdef PNG_SAVE_BSD_SOURCE
|
||||||
|
# ifdef _BSD_SOURCE
|
||||||
|
# undef _BSD_SOURCE
|
||||||
|
# endif
|
||||||
# define _BSD_SOURCE
|
# define _BSD_SOURCE
|
||||||
# undef PNG_SAVE_BSD_SOURCE
|
# undef PNG_SAVE_BSD_SOURCE
|
||||||
# endif
|
# endif
|
||||||
@@ -337,59 +354,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Other defines for things like memory and the like can go here. */
|
/* Other defines for things like memory and the like can go here. */
|
||||||
#ifdef PNG_INTERNAL
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
/* The functions exported by PNG_EXTERN are PNG_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
|
|
||||||
|
|
||||||
/* Other defines specific to compilers can go here. Try to keep
|
|
||||||
* them inside an appropriate ifdef/endif pair for portability.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined(PNG_FLOATING_POINT_SUPPORTED)
|
|
||||||
# if defined(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
|
|
||||||
|
|
||||||
/* I have no idea why is this necessary... */
|
|
||||||
#if defined(_MSC_VER) && (defined(WIN32) || defined(_Windows) || \
|
|
||||||
defined(_WINDOWS) || defined(_WIN32) || defined(__WIN32__))
|
|
||||||
# include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* This controls how fine the dithering gets. As this allocates
|
/* This controls how fine the dithering gets. As this allocates
|
||||||
* a largish chunk of memory (32K), those who are not as concerned
|
* a largish chunk of memory (32K), those who are not as concerned
|
||||||
@@ -423,8 +387,6 @@
|
|||||||
# define PNG_GAMMA_THRESHOLD 0.05
|
# define PNG_GAMMA_THRESHOLD 0.05
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* PNG_INTERNAL */
|
|
||||||
|
|
||||||
/* The following uses const char * instead of char * for error
|
/* The following uses const char * instead of char * for error
|
||||||
* and warning message functions, so some compilers won't complain.
|
* and warning message functions, so some compilers won't complain.
|
||||||
* If you do not want to use const, define PNG_NO_CONST here.
|
* If you do not want to use const, define PNG_NO_CONST here.
|
||||||
@@ -466,21 +428,9 @@
|
|||||||
* iTXt support was added. iTXt support was turned off by default through
|
* iTXt support was added. iTXt support was turned off by default through
|
||||||
* libpng-1.2.x, to support old apps that malloc the png_text structure
|
* libpng-1.2.x, to support old apps that malloc the png_text structure
|
||||||
* instead of calling png_set_text() and letting libpng malloc it. It
|
* instead of calling png_set_text() and letting libpng malloc it. It
|
||||||
* was turned on by default in libpng-1.3.0.
|
* was turned on by default in libpng-1.4.0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
|
|
||||||
# ifndef PNG_NO_iTXt_SUPPORTED
|
|
||||||
# define PNG_NO_iTXt_SUPPORTED
|
|
||||||
# endif
|
|
||||||
# ifndef PNG_NO_READ_iTXt
|
|
||||||
# define PNG_NO_READ_iTXt
|
|
||||||
# endif
|
|
||||||
# ifndef PNG_NO_WRITE_iTXt
|
|
||||||
# define PNG_NO_WRITE_iTXt
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(PNG_NO_iTXt_SUPPORTED)
|
#if !defined(PNG_NO_iTXt_SUPPORTED)
|
||||||
# if !defined(PNG_READ_iTXt_SUPPORTED) && !defined(PNG_NO_READ_iTXt)
|
# if !defined(PNG_READ_iTXt_SUPPORTED) && !defined(PNG_NO_READ_iTXt)
|
||||||
# define PNG_READ_iTXt
|
# define PNG_READ_iTXt
|
||||||
@@ -558,9 +508,11 @@
|
|||||||
# ifndef PNG_NO_READ_INVERT
|
# ifndef PNG_NO_READ_INVERT
|
||||||
# define PNG_READ_INVERT_SUPPORTED
|
# define PNG_READ_INVERT_SUPPORTED
|
||||||
# endif
|
# endif
|
||||||
|
#if 0 /* removed from libpng-1.4.0 */
|
||||||
# ifndef PNG_NO_READ_DITHER
|
# ifndef PNG_NO_READ_DITHER
|
||||||
# define PNG_READ_DITHER_SUPPORTED
|
# define PNG_READ_DITHER_SUPPORTED
|
||||||
# endif
|
# endif
|
||||||
|
#endif /* 0 */
|
||||||
# ifndef PNG_NO_READ_BACKGROUND
|
# ifndef PNG_NO_READ_BACKGROUND
|
||||||
# define PNG_READ_BACKGROUND_SUPPORTED
|
# define PNG_READ_BACKGROUND_SUPPORTED
|
||||||
# endif
|
# endif
|
||||||
@@ -582,6 +534,9 @@
|
|||||||
# ifndef PNG_NO_READ_INVERT_ALPHA
|
# ifndef PNG_NO_READ_INVERT_ALPHA
|
||||||
# define PNG_READ_INVERT_ALPHA_SUPPORTED
|
# define PNG_READ_INVERT_ALPHA_SUPPORTED
|
||||||
# endif
|
# endif
|
||||||
|
# ifndef PNG_NO_READ_PREMULTIPLY_ALPHA
|
||||||
|
# define PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED
|
||||||
|
# endif
|
||||||
# ifndef PNG_NO_READ_STRIP_ALPHA
|
# ifndef PNG_NO_READ_STRIP_ALPHA
|
||||||
# define PNG_READ_STRIP_ALPHA_SUPPORTED
|
# define PNG_READ_STRIP_ALPHA_SUPPORTED
|
||||||
# endif
|
# endif
|
||||||
@@ -607,12 +562,11 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
|
#if !defined(PNG_NO_GET_INT_32) || defined(PNG_READ_oFFS_SUPPORTED) || \
|
||||||
/* Deprecated, will be removed from version 2.0.0.
|
defined(PNG_READ_pCAL_SUPPORTED)
|
||||||
Use PNG_MNG_FEATURES_SUPPORTED instead. */
|
# ifndef PNG_GET_INT_32_SUPPORTED
|
||||||
#ifndef PNG_NO_READ_EMPTY_PLTE
|
# define PNG_GET_INT_32_SUPPORTED
|
||||||
# define PNG_READ_EMPTY_PLTE_SUPPORTED
|
# endif
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* PNG_READ_SUPPORTED */
|
#endif /* PNG_READ_SUPPORTED */
|
||||||
@@ -674,20 +628,16 @@
|
|||||||
# define PNG_WRITE_FLUSH_SUPPORTED
|
# define PNG_WRITE_FLUSH_SUPPORTED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
|
#if !defined(PNG_NO_SAVE_INT_32) || defined(PNG_WRITE_oFFS_SUPPORTED) || \
|
||||||
/* Deprecated, see PNG_MNG_FEATURES_SUPPORTED, above */
|
defined(PNG_WRITE_pCAL_SUPPORTED)
|
||||||
#ifndef PNG_NO_WRITE_EMPTY_PLTE
|
# ifndef PNG_SAVE_INT_32_SUPPORTED
|
||||||
# define PNG_WRITE_EMPTY_PLTE_SUPPORTED
|
# define PNG_SAVE_INT_32_SUPPORTED
|
||||||
#endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* PNG_WRITE_SUPPORTED */
|
#endif /* PNG_WRITE_SUPPORTED */
|
||||||
|
|
||||||
#ifndef PNG_1_0_X
|
#define PNG_NO_ERROR_NUMBERS
|
||||||
# ifndef PNG_NO_ERROR_NUMBERS
|
|
||||||
# define PNG_ERROR_NUMBERS_SUPPORTED
|
|
||||||
# endif
|
|
||||||
#endif /* PNG_1_0_X */
|
|
||||||
|
|
||||||
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
|
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
|
||||||
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
||||||
@@ -720,44 +670,18 @@
|
|||||||
# define PNG_EASY_ACCESS_SUPPORTED
|
# define PNG_EASY_ACCESS_SUPPORTED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0
|
|
||||||
even when PNG_USE_PNGVCRD or PNG_USE_PNGGCCRD is not defined */
|
|
||||||
#if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE)
|
|
||||||
# ifndef PNG_ASSEMBLER_CODE_SUPPORTED
|
|
||||||
# define PNG_ASSEMBLER_CODE_SUPPORTED
|
|
||||||
# endif
|
|
||||||
# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE) && \
|
|
||||||
defined(__MMX__)
|
|
||||||
# define PNG_MMX_CODE_SUPPORTED
|
|
||||||
# endif
|
|
||||||
# if !defined(PNG_USE_PNGGCCRD) && !defined(PNG_NO_MMX_CODE) && \
|
|
||||||
!defined(PNG_USE_PNGVCRD) && defined(__MMX__)
|
|
||||||
# define PNG_USE_PNGGCCRD
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* If you are sure that you don't need thread safety and you are compiling
|
|
||||||
with PNG_USE_PNGCCRD for an MMX application, you can define this for
|
|
||||||
faster execution. See pnggccrd.c.
|
|
||||||
#define PNG_THREAD_UNSAFE_OK
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined(PNG_1_0_X)
|
|
||||||
#if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED)
|
#if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED)
|
||||||
# define PNG_USER_MEM_SUPPORTED
|
# define PNG_USER_MEM_SUPPORTED
|
||||||
#endif
|
#endif
|
||||||
#endif /* PNG_1_0_X */
|
|
||||||
|
|
||||||
/* Added at libpng-1.2.6 */
|
/* Added at libpng-1.2.6 */
|
||||||
#if !defined(PNG_1_0_X)
|
|
||||||
#ifndef PNG_SET_USER_LIMITS_SUPPORTED
|
#ifndef PNG_SET_USER_LIMITS_SUPPORTED
|
||||||
#if !defined(PNG_NO_SET_USER_LIMITS) && !defined(PNG_SET_USER_LIMITS_SUPPORTED)
|
#if !defined(PNG_NO_SET_USER_LIMITS) && !defined(PNG_SET_USER_LIMITS_SUPPORTED)
|
||||||
# define PNG_SET_USER_LIMITS_SUPPORTED
|
# define PNG_SET_USER_LIMITS_SUPPORTED
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif /* PNG_1_0_X */
|
|
||||||
|
|
||||||
/* Added at libpng-1.0.16 and 1.2.6. To accept all valid PNGS no matter
|
/* Added at libpng-1.0.16 and 1.2.6. To accept all valid PNGs no matter
|
||||||
* how large, set these limits to 0x7fffffffL
|
* how large, set these limits to 0x7fffffffL
|
||||||
*/
|
*/
|
||||||
#ifndef PNG_USER_WIDTH_MAX
|
#ifndef PNG_USER_WIDTH_MAX
|
||||||
@@ -767,6 +691,29 @@
|
|||||||
# define PNG_USER_HEIGHT_MAX 1000000L
|
# define PNG_USER_HEIGHT_MAX 1000000L
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Added at libpng-1.4.0 */
|
||||||
|
#ifndef PNG_USER_CHUNK_CACHE_MAX
|
||||||
|
# define PNG_USER_CHUNK_CACHE_MAX 0x7ffffffLL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Added at libpng-1.4.0 */
|
||||||
|
#if !defined(PNG_NO_IO_STATE) && !defined(PNG_IO_STATE_SUPPORTED)
|
||||||
|
# define PNG_IO_STATE_SUPPORTED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PNG_LITERAL_SHARP
|
||||||
|
# define PNG_LITERAL_SHARP 0x23
|
||||||
|
#endif
|
||||||
|
#ifndef PNG_LITERAL_LEFT_SQUARE_BRACKET
|
||||||
|
# define PNG_LITERAL_LEFT_SQUARE_BRACKET 0x5b
|
||||||
|
#endif
|
||||||
|
#ifndef PNG_LITERAL_RIGHT_SQUARE_BRACKET
|
||||||
|
# define PNG_LITERAL_RIGHT_SQUARE_BRACKET 0x5d
|
||||||
|
#endif
|
||||||
|
#ifndef PNG_STRING_NEWLINE
|
||||||
|
#define PNG_STRING_NEWLINE "\n"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* These are currently experimental features, define them if you want */
|
/* These are currently experimental features, define them if you want */
|
||||||
|
|
||||||
/* very little testing */
|
/* very little testing */
|
||||||
@@ -786,16 +733,15 @@
|
|||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if !defined(PNG_NO_USE_READ_MACROS) && !defined(PNG_USE_READ_MACROS)
|
||||||
|
# define PNG_USE_READ_MACROS
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Buggy compilers (e.g., gcc 2.7.2.2) need this */
|
/* Buggy compilers (e.g., gcc 2.7.2.2) need this */
|
||||||
/*
|
/*
|
||||||
#define PNG_NO_POINTER_INDEXING
|
#define PNG_NO_POINTER_INDEXING
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* These functions are turned off by default, as they will be phased out. */
|
|
||||||
/*
|
|
||||||
#define PNG_USELESS_TESTS_SUPPORTED
|
|
||||||
#define PNG_CORRECT_PALETTE_SUPPORTED
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Any chunks you are not interested in, you can undef here. The
|
/* Any chunks you are not interested in, you can undef here. The
|
||||||
* ones that allocate memory may be expecially important (hIST,
|
* ones that allocate memory may be expecially important (hIST,
|
||||||
@@ -1078,25 +1024,26 @@
|
|||||||
* numbers suggest (a png_uint_32 must be at least 32 bits long), but they
|
* numbers suggest (a png_uint_32 must be at least 32 bits long), but they
|
||||||
* don't have to be exactly that size. Some compilers dislike passing
|
* don't have to be exactly that size. Some compilers dislike passing
|
||||||
* unsigned shorts as function parameters, so you may be better off using
|
* unsigned shorts as function parameters, so you may be better off using
|
||||||
* unsigned int for png_uint_16. Likewise, for 64-bit systems, you may
|
* unsigned int for png_uint_16.
|
||||||
* want to have unsigned int for png_uint_32 instead of unsigned long.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if defined(INT_MAX) && (INT_MAX > 0x7ffffffeL)
|
||||||
|
typedef unsigned int png_uint_32;
|
||||||
|
typedef int png_int_32;
|
||||||
|
#else
|
||||||
typedef unsigned long png_uint_32;
|
typedef unsigned long png_uint_32;
|
||||||
typedef long png_int_32;
|
typedef long png_int_32;
|
||||||
|
#endif
|
||||||
typedef unsigned short png_uint_16;
|
typedef unsigned short png_uint_16;
|
||||||
typedef short png_int_16;
|
typedef short png_int_16;
|
||||||
typedef unsigned char png_byte;
|
typedef unsigned char png_byte;
|
||||||
|
|
||||||
/* This is usually size_t. It is typedef'ed just in case you need it to
|
#ifdef PNG_NO_SIZE_T
|
||||||
change (I'm not sure if you will or not, so I thought I'd be safe) */
|
typedef unsigned int png_size_t;
|
||||||
#ifdef PNG_SIZE_T
|
|
||||||
typedef PNG_SIZE_T png_size_t;
|
|
||||||
# define png_sizeof(x) png_convert_size(sizeof (x))
|
|
||||||
#else
|
#else
|
||||||
typedef size_t png_size_t;
|
typedef size_t png_size_t;
|
||||||
# define png_sizeof(x) sizeof (x)
|
|
||||||
#endif
|
#endif
|
||||||
|
#define png_sizeof(x) sizeof(x)
|
||||||
|
|
||||||
/* The following is needed for medium model support. It cannot be in the
|
/* The following is needed for medium model support. It cannot be in the
|
||||||
* PNG_INTERNAL section. Needs modification for other compilers besides
|
* PNG_INTERNAL section. Needs modification for other compilers besides
|
||||||
@@ -1200,18 +1147,6 @@ typedef double FAR * FAR * png_doublepp;
|
|||||||
/* Pointers to pointers to pointers; i.e., pointer to array */
|
/* Pointers to pointers to pointers; i.e., pointer to array */
|
||||||
typedef char FAR * FAR * FAR * png_charppp;
|
typedef char FAR * FAR * FAR * png_charppp;
|
||||||
|
|
||||||
#if defined(PNG_1_0_X) || defined(PNG_1_2_X)
|
|
||||||
/* SPC - Is this stuff deprecated? */
|
|
||||||
/* It'll be removed as of libpng-1.3.0 - GR-P */
|
|
||||||
/* libpng typedefs for types in zlib. If zlib changes
|
|
||||||
* or another compression library is used, then change these.
|
|
||||||
* Eliminates need to change all the source files.
|
|
||||||
*/
|
|
||||||
typedef charf * png_zcharp;
|
|
||||||
typedef charf * FAR * png_zcharpp;
|
|
||||||
typedef z_stream FAR * png_zstreamp;
|
|
||||||
#endif /* (PNG_1_0_X) || defined(PNG_1_2_X) */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Define PNG_BUILD_DLL if the module being built is a Windows
|
* Define PNG_BUILD_DLL if the module being built is a Windows
|
||||||
* LIBPNG DLL.
|
* LIBPNG DLL.
|
||||||
@@ -1378,14 +1313,10 @@ typedef z_stream FAR * png_zstreamp;
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* User may want to use these so they are not in PNG_INTERNAL. Any library
|
/* Users may want to use these so they are not private. Any library
|
||||||
* functions that are passed far data must be model independent.
|
* functions that are passed far data must be model-independent.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef PNG_ABORT
|
|
||||||
# define PNG_ABORT() abort()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
|
# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
|
||||||
#else
|
#else
|
||||||
@@ -1393,29 +1324,107 @@ typedef z_stream FAR * png_zstreamp;
|
|||||||
(LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED)
|
(LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(USE_FAR_KEYWORD) /* memory model independent fns */
|
/* memory model/platform independent fns */
|
||||||
|
#ifndef PNG_ABORT
|
||||||
|
# ifdef _WINDOWS_
|
||||||
|
# define PNG_ABORT() ExitProcess(0)
|
||||||
|
# else
|
||||||
|
# define PNG_ABORT() abort()
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(USE_FAR_KEYWORD)
|
||||||
/* use this to make far-to-near assignments */
|
/* use this to make far-to-near assignments */
|
||||||
# define CHECK 1
|
# define CHECK 1
|
||||||
# define NOCHECK 0
|
# define NOCHECK 0
|
||||||
# define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
|
# define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
|
||||||
# define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
|
# define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
|
||||||
|
# define png_fileno _fileno /* Added to v 1.4.0 */
|
||||||
# define png_strcpy _fstrcpy
|
# define png_strcpy _fstrcpy
|
||||||
# define png_strncpy _fstrncpy /* Added to v 1.2.6 */
|
# define png_strncpy _fstrncpy /* Added to v 1.2.6 */
|
||||||
# define png_strlen _fstrlen
|
# define png_strlen _fstrlen
|
||||||
# define png_memcmp _fmemcmp /* SJT: added */
|
# define png_memcmp _fmemcmp /* SJT: added */
|
||||||
# define png_memcpy _fmemcpy
|
# define png_memcpy _fmemcpy
|
||||||
# define png_memset _fmemset
|
# define png_memset _fmemset
|
||||||
#else /* use the usual functions */
|
# define png_sprintf sprintf
|
||||||
# define CVT_PTR(ptr) (ptr)
|
#else
|
||||||
# define CVT_PTR_NOCHECK(ptr) (ptr)
|
# if defined(_WINDOWS_) /* favor Windows over C runtime fns */
|
||||||
# define png_strcpy strcpy
|
# define CVT_PTR(ptr) (ptr)
|
||||||
# define png_strncpy strncpy /* Added to v 1.2.6 */
|
# define CVT_PTR_NOCHECK(ptr) (ptr)
|
||||||
# define png_strlen strlen
|
# define png_fileno fileno
|
||||||
# define png_memcmp memcmp /* SJT: added */
|
# define png_strcpy lstrcpyA
|
||||||
# define png_memcpy memcpy
|
# define png_strncpy lstrcpynA
|
||||||
# define png_memset memset
|
# define png_strlen lstrlenA
|
||||||
|
# define png_memcmp memcmp
|
||||||
|
# define png_memcpy CopyMemory
|
||||||
|
# define png_memset memset
|
||||||
|
# define png_sprintf wsprintfA
|
||||||
|
# else
|
||||||
|
# define CVT_PTR(ptr) (ptr)
|
||||||
|
# define CVT_PTR_NOCHECK(ptr) (ptr)
|
||||||
|
# define png_fileno fileno /* Added to v 1.4.0 */
|
||||||
|
# define png_strcpy strcpy
|
||||||
|
# define png_strncpy strncpy /* Added to v 1.2.6 */
|
||||||
|
# define png_strlen strlen
|
||||||
|
# define png_memcmp memcmp /* SJT: added */
|
||||||
|
# define png_memcpy memcpy
|
||||||
|
# define png_memset memset
|
||||||
|
# define png_sprintf sprintf
|
||||||
|
# ifndef PNG_NO_SNPRINTF
|
||||||
|
# ifdef _MSC_VER
|
||||||
|
# define png_snprintf _snprintf /* Added to v 1.2.19 */
|
||||||
|
# define png_snprintf2 _snprintf
|
||||||
|
# define png_snprintf6 _snprintf
|
||||||
|
# else
|
||||||
|
# define png_snprintf snprintf /* Added to v 1.2.19 */
|
||||||
|
# define png_snprintf2 snprintf
|
||||||
|
# define png_snprintf6 snprintf
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
/* You don't have or don't want to use snprintf(). Caution: Using
|
||||||
|
* sprintf instead of snprintf exposes your application to accidental
|
||||||
|
* or malevolent buffer overflows. If you don't have snprintf()
|
||||||
|
* as a general rule you should provide one (you can get one from
|
||||||
|
* Portable OpenSSH). */
|
||||||
|
# define png_snprintf(s1,n,fmt,x1) sprintf(s1,fmt,x1)
|
||||||
|
# define png_snprintf2(s1,n,fmt,x1,x2) sprintf(s1,fmt,x1,x2)
|
||||||
|
# define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \
|
||||||
|
sprintf(s1,fmt,x1,x2,x3,x4,x5,x6)
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
/* End of memory model independent support */
|
|
||||||
|
/* png_alloc_size_t is guaranteed to be no smaller than png_size_t,
|
||||||
|
* and no smaller than png_uint_32. Casts from png_size_t or png_uint_32
|
||||||
|
* to png_alloc_size_t are not necessary; in fact, it is recommended
|
||||||
|
* not to use them at all so that the compiler can complain when something
|
||||||
|
* turns out to be problematic.
|
||||||
|
* Casts in the other direction (from png_alloc_size_t to png_size_t or
|
||||||
|
* png_uint_32) should be explicitly applied; however, we do not expect
|
||||||
|
* to encounter practical situations that require such conversions.
|
||||||
|
*/
|
||||||
|
#if defined(__TURBOC__) && !defined(__FLAT__)
|
||||||
|
# define png_mem_alloc farmalloc
|
||||||
|
# define png_mem_free farfree
|
||||||
|
typedef unsigned long png_alloc_size_t;
|
||||||
|
#else
|
||||||
|
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
||||||
|
# define png_mem_alloc(s) halloc(s, 1)
|
||||||
|
# define png_mem_free hfree
|
||||||
|
typedef unsigned long png_alloc_size_t;
|
||||||
|
# else
|
||||||
|
# if defined(_WINDOWS_) && (!defined(INT_MAX) || INT_MAX <= 0x7ffffffeL)
|
||||||
|
# define png_mem_alloc(s) HeapAlloc(GetProcessHeap(), 0, s)
|
||||||
|
# define png_mem_free(p) HeapFree(GetProcessHeap(), 0, p)
|
||||||
|
typedef DWORD png_alloc_size_t;
|
||||||
|
# else
|
||||||
|
# define png_mem_alloc malloc
|
||||||
|
# define png_mem_free free
|
||||||
|
typedef png_size_t png_alloc_size_t;
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
/* End of memory model/platform independent support */
|
||||||
|
|
||||||
/* Just a little check that someone hasn't tried to define something
|
/* Just a little check that someone hasn't tried to define something
|
||||||
* contradictory.
|
* contradictory.
|
||||||
@@ -1425,46 +1434,6 @@ typedef z_stream FAR * png_zstreamp;
|
|||||||
# define PNG_ZBUF_SIZE 65536L
|
# define PNG_ZBUF_SIZE 65536L
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_READ_SUPPORTED
|
|
||||||
/* Prior to libpng-1.0.9, this block was in pngasmrd.h */
|
|
||||||
#if defined(PNG_INTERNAL)
|
|
||||||
|
|
||||||
/* These are the default thresholds before the MMX code kicks in; if either
|
|
||||||
* rowbytes or bitdepth is below the threshold, plain C code is used. These
|
|
||||||
* can be overridden at runtime via the png_set_mmx_thresholds() call in
|
|
||||||
* libpng 1.2.0 and later. The values below were chosen by Intel.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT
|
|
||||||
# define PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT 128 /* >= */
|
|
||||||
#endif
|
|
||||||
#ifndef PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT
|
|
||||||
# define PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT 9 /* >= */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Set this in the makefile for VC++ on Pentium, not here. */
|
|
||||||
/* Platform must be Pentium. Makefile must assemble and load pngvcrd.c .
|
|
||||||
* MMX will be detected at run time and used if present.
|
|
||||||
*/
|
|
||||||
#ifdef PNG_USE_PNGVCRD
|
|
||||||
# define PNG_HAVE_ASSEMBLER_COMBINE_ROW
|
|
||||||
# define PNG_HAVE_ASSEMBLER_READ_INTERLACE
|
|
||||||
# define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Set this in the makefile for gcc/as on Pentium, not here. */
|
|
||||||
/* Platform must be Pentium. Makefile must assemble and load pnggccrd.c .
|
|
||||||
* MMX will be detected at run time and used if present.
|
|
||||||
*/
|
|
||||||
#ifdef PNG_USE_PNGGCCRD
|
|
||||||
# define PNG_HAVE_ASSEMBLER_COMBINE_ROW
|
|
||||||
# define PNG_HAVE_ASSEMBLER_READ_INTERLACE
|
|
||||||
# define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
|
|
||||||
#endif
|
|
||||||
/* - see pnggccrd.c for info about what is currently enabled */
|
|
||||||
|
|
||||||
#endif /* PNG_INTERNAL */
|
|
||||||
#endif /* PNG_READ_SUPPORTED */
|
|
||||||
|
|
||||||
/* Added at libpng-1.2.8 */
|
/* Added at libpng-1.2.8 */
|
||||||
#endif /* PNG_VERSION_INFO_ONLY */
|
#endif /* PNG_VERSION_INFO_ONLY */
|
||||||
|
|||||||
243
pngerror.c
243
pngerror.c
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
/* 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 [February 28, 2009]
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2009 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.)
|
||||||
*
|
*
|
||||||
@@ -13,22 +13,25 @@
|
|||||||
* at each function.
|
* at each function.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
|
||||||
#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));
|
||||||
|
#ifndef PNG_NO_WARNINGS
|
||||||
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_NO_WARNINGS */
|
||||||
|
|
||||||
/* 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.
|
||||||
*/
|
*/
|
||||||
|
#ifndef PNG_NO_ERROR_TEXT
|
||||||
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 +42,52 @@ 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. */
|
||||||
|
/*
|
||||||
|
* 012345678901234567890
|
||||||
|
* error_message: #nnnn text\0
|
||||||
|
* error_number: nnnn\0
|
||||||
|
* msg: : nnnn \0
|
||||||
|
* offset points to the first blank after nnnn
|
||||||
|
* In this example, offset is 5.
|
||||||
|
*/
|
||||||
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;
|
||||||
|
/* it is 5 because the loop iterations saw
|
||||||
|
* offset==1, error_message[1]=="n"; offset++.
|
||||||
|
* offset==2, error_message[2]=="n"; offset++.
|
||||||
|
* offset==3, error_message[3]=="n"; offset++.
|
||||||
|
* offset==4, error_message[4]=="n"; offset++.
|
||||||
|
* offset==5, error_message[5]==" "; 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++)
|
/* Copy the "nnnn" or however many there are, plus the
|
||||||
msg[i]=error_message[i+1];
|
* blank to the beginning of "msg" string.
|
||||||
msg[i]='\0';
|
*/
|
||||||
error_message=msg;
|
for (i = 0; i < offset - 1; i++)
|
||||||
|
msg[i] = error_message[i + 1];
|
||||||
|
/* In the example, "i" ends up being 5.
|
||||||
|
*/
|
||||||
|
msg[i - 1] = '\0';
|
||||||
|
error_message = msg;
|
||||||
}
|
}
|
||||||
|
/* msg, and error_message, now contain "nnnn \0". */
|
||||||
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 +100,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_NO_ERROR_TEXT */
|
||||||
|
|
||||||
|
#ifndef PNG_NO_WARNINGS
|
||||||
/* 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 +130,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_NO_WARNINGS */
|
||||||
|
|
||||||
|
#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 +168,9 @@ 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_NO_WARNINGS) || !defined(PNG_NO_ERROR_TEXT)
|
||||||
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 +182,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 +194,59 @@ 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 /* !defined(PNG_NO_WARNINGS) || !defined(PNG_NO_ERROR_TEXT) */
|
||||||
|
|
||||||
|
#ifndef PNG_NO_WARNINGS
|
||||||
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_NO_WARNINGS */
|
||||||
|
|
||||||
|
#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 */
|
||||||
|
|
||||||
/* 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
|
||||||
@@ -181,52 +258,79 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
|
|||||||
{
|
{
|
||||||
#ifndef PNG_NO_CONSOLE_IO
|
#ifndef PNG_NO_CONSOLE_IO
|
||||||
#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. */
|
||||||
|
/*
|
||||||
|
* 012345678901234567890
|
||||||
|
* error_message: #nnnn text\0
|
||||||
|
* error_number: nnnn\0
|
||||||
|
* offset points to the first blank after nnnn
|
||||||
|
* In this example, offset is 5, and we want to
|
||||||
|
* insert a terminating NULL at error_number[4].
|
||||||
|
*/
|
||||||
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))
|
/* This is unnecessarily slightly different from above, but
|
||||||
|
* offset is still 5 because the loop iterations saw
|
||||||
|
* offset==0, error_message[0]=="#"; error_number[0]="n";offset++.
|
||||||
|
* offset==1, error_message[1]=="n"; error_number[1]="n";offset++
|
||||||
|
* offset==2, error_message[2]=="n"; error_number[2]="n";offset++
|
||||||
|
* offset==3, error_message[3]=="n"; error_number[3]="n";offset++
|
||||||
|
* offset==4, error_message[4]=="n"; error_number[4]=" ";offset++.
|
||||||
|
* offset==5, error_message[5]==" "; break.
|
||||||
|
*/
|
||||||
|
if ((offset > 1) && (offset < 15))
|
||||||
{
|
{
|
||||||
error_number[offset-1]='\0';
|
/* Replace the " " with a string-terminating NULL */
|
||||||
fprintf(stderr, "libpng error no. %s: %s\n", error_number,
|
error_number[offset - 1] = '\0';
|
||||||
error_message+offset);
|
/* GRR: this should be [offset + 1] */
|
||||||
|
/* should we update "offset" to point to the beginning of the text? */
|
||||||
|
fprintf(stderr, "libpng error no. %s: %s",
|
||||||
|
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)
|
||||||
|
{
|
||||||
# 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);
|
longjmp(jmpbuf, 1);
|
||||||
}
|
}
|
||||||
# else
|
# else
|
||||||
longjmp(png_ptr->jmpbuf, 1);
|
longjmp(png_ptr->jmpbuf, 1);
|
||||||
# endif
|
# endif
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
/* make compiler happy */ ;
|
|
||||||
if (png_ptr)
|
|
||||||
PNG_ABORT();
|
PNG_ABORT();
|
||||||
#endif
|
#endif
|
||||||
#ifdef PNG_NO_CONSOLE_IO
|
#ifdef PNG_NO_CONSOLE_IO
|
||||||
/* make compiler happy */ ;
|
error_message = error_message; /* make compiler happy */
|
||||||
if (&error_message != NULL)
|
|
||||||
return;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PNG_NO_WARNINGS
|
||||||
/* 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
|
||||||
@@ -237,37 +341,42 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message)
|
|||||||
{
|
{
|
||||||
#ifndef PNG_NO_CONSOLE_IO
|
#ifndef PNG_NO_CONSOLE_IO
|
||||||
# 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_NO_WARNINGS */
|
||||||
|
|
||||||
/* 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 +412,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
5420
pnggccrd.c
File diff suppressed because it is too large
Load Diff
222
pngget.c
222
pngget.c
@@ -1,17 +1,16 @@
|
|||||||
|
|
||||||
/* 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.0 [February 28, 2009]
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2009 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.)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
|
||||||
#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)
|
||||||
@@ -22,7 +21,7 @@ png_get_valid(png_structp png_ptr, png_infop info_ptr, png_uint_32 flag)
|
|||||||
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)
|
||||||
@@ -121,8 +120,8 @@ png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
|
|||||||
#if defined(PNG_pHYs_SUPPORTED)
|
#if defined(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);
|
||||||
}
|
}
|
||||||
@@ -139,8 +138,8 @@ png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
|
|||||||
#if defined(PNG_pHYs_SUPPORTED)
|
#if defined(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);
|
||||||
}
|
}
|
||||||
@@ -157,8 +156,8 @@ png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
|
|||||||
#if defined(PNG_pHYs_SUPPORTED)
|
#if defined(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);
|
||||||
@@ -177,7 +176,7 @@ png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
|
|||||||
#if defined(PNG_pHYs_SUPPORTED)
|
#if defined(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
|
||||||
@@ -198,8 +197,8 @@ png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr)
|
|||||||
#if defined(PNG_oFFs_SUPPORTED)
|
#if defined(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);
|
||||||
}
|
}
|
||||||
@@ -216,8 +215,8 @@ png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr)
|
|||||||
#if defined(PNG_oFFs_SUPPORTED)
|
#if defined(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);
|
||||||
}
|
}
|
||||||
@@ -234,8 +233,8 @@ png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr)
|
|||||||
#if defined(PNG_oFFs_SUPPORTED)
|
#if defined(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);
|
||||||
}
|
}
|
||||||
@@ -252,8 +251,8 @@ png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr)
|
|||||||
#if defined(PNG_oFFs_SUPPORTED)
|
#if defined(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);
|
||||||
}
|
}
|
||||||
@@ -308,7 +307,7 @@ 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 +322,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);
|
||||||
@@ -365,7 +364,7 @@ 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);
|
||||||
}
|
}
|
||||||
@@ -382,7 +381,7 @@ 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)
|
||||||
@@ -413,7 +412,7 @@ png_get_cHRM_fixed(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 = info_ptr->int_x_white;
|
*white_x = info_ptr->int_x_white;
|
||||||
if (white_y != NULL)
|
if (white_y != NULL)
|
||||||
@@ -445,7 +444,7 @@ png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma)
|
|||||||
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");
|
png_debug1(1, "in %s retrieval function", "gAMA");
|
||||||
*file_gamma = (double)info_ptr->gamma;
|
*file_gamma = (double)info_ptr->gamma;
|
||||||
return (PNG_INFO_gAMA);
|
return (PNG_INFO_gAMA);
|
||||||
}
|
}
|
||||||
@@ -460,7 +459,7 @@ png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr,
|
|||||||
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");
|
png_debug1(1, "in %s retrieval function", "gAMA");
|
||||||
*int_file_gamma = info_ptr->int_gamma;
|
*int_file_gamma = info_ptr->int_gamma;
|
||||||
return (PNG_INFO_gAMA);
|
return (PNG_INFO_gAMA);
|
||||||
}
|
}
|
||||||
@@ -476,7 +475,7 @@ png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
|
|||||||
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");
|
png_debug1(1, "in %s retrieval function", "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);
|
||||||
}
|
}
|
||||||
@@ -493,7 +492,7 @@ png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
|
|||||||
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");
|
png_debug1(1, "in %s retrieval function", "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
|
||||||
@@ -512,8 +511,11 @@ 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
|
||||||
|
|
||||||
@@ -524,7 +526,7 @@ png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *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");
|
png_debug1(1, "in %s retrieval function", "hIST");
|
||||||
*hist = info_ptr->hist;
|
*hist = info_ptr->hist;
|
||||||
return (PNG_INFO_hIST);
|
return (PNG_INFO_hIST);
|
||||||
}
|
}
|
||||||
@@ -542,7 +544,7 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
|
|||||||
if (png_ptr != NULL && info_ptr != NULL && width != NULL && height != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL && width != NULL && height != NULL &&
|
||||||
bit_depth != NULL && color_type != NULL)
|
bit_depth != NULL && color_type != NULL)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function\n", "IHDR");
|
png_debug1(1, "in %s retrieval function", "IHDR");
|
||||||
*width = info_ptr->width;
|
*width = info_ptr->width;
|
||||||
*height = info_ptr->height;
|
*height = info_ptr->height;
|
||||||
*bit_depth = info_ptr->bit_depth;
|
*bit_depth = info_ptr->bit_depth;
|
||||||
@@ -571,7 +573,7 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
|
|||||||
- 8) /* extra max_pixel_depth pad */
|
- 8) /* extra max_pixel_depth pad */
|
||||||
{
|
{
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"Width too large for libpng to process image data.");
|
"Width too large for libpng to process image data");
|
||||||
}
|
}
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
@@ -586,7 +588,7 @@ png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
|
|||||||
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");
|
png_debug1(1, "in %s retrieval function", "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;
|
||||||
@@ -606,7 +608,7 @@ png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
|
|||||||
&& 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");
|
png_debug1(1, "in %s retrieval function", "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;
|
||||||
@@ -666,7 +668,7 @@ png_get_pHYs(png_structp png_ptr, png_infop info_ptr,
|
|||||||
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");
|
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;
|
||||||
@@ -694,10 +696,10 @@ png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette,
|
|||||||
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");
|
png_debug1(1, "in %s retrieval function", "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);
|
||||||
@@ -710,7 +712,7 @@ png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
|
|||||||
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");
|
png_debug1(1, "in %s retrieval function", "sBIT");
|
||||||
*sig_bit = &(info_ptr->sig_bit);
|
*sig_bit = &(info_ptr->sig_bit);
|
||||||
return (PNG_INFO_sBIT);
|
return (PNG_INFO_sBIT);
|
||||||
}
|
}
|
||||||
@@ -725,7 +727,7 @@ png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
|
|||||||
{
|
{
|
||||||
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)
|
||||||
@@ -747,7 +749,7 @@ png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_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");
|
png_debug1(1, "in %s retrieval function", "tIME");
|
||||||
*mod_time = &(info_ptr->mod_time);
|
*mod_time = &(info_ptr->mod_time);
|
||||||
return (PNG_INFO_tIME);
|
return (PNG_INFO_tIME);
|
||||||
}
|
}
|
||||||
@@ -758,12 +760,12 @@ png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
|
|||||||
#if defined(PNG_tRNS_SUPPORTED)
|
#if defined(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, 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 != NULL)
|
||||||
@@ -771,20 +773,20 @@ png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
|
|||||||
*trans = info_ptr->trans;
|
*trans = info_ptr->trans;
|
||||||
retval |= PNG_INFO_tRNS;
|
retval |= PNG_INFO_tRNS;
|
||||||
}
|
}
|
||||||
if (trans_values != NULL)
|
if (trans_color != NULL)
|
||||||
*trans_values = &(info_ptr->trans_values);
|
*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)
|
if (trans != NULL)
|
||||||
*trans = NULL;
|
*trans = 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;
|
||||||
@@ -800,8 +802,11 @@ 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
|
||||||
|
|
||||||
@@ -822,106 +827,16 @@ png_get_user_chunk_ptr(png_structp png_ptr)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WRITE_SUPPORTED
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
png_uint_32 PNGAPI
|
png_size_t 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
|
#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 */
|
||||||
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 +847,27 @@ 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? 0x7fffffffL :
|
||||||
|
png_ptr->user_chunk_cache_max - 1 : 0);
|
||||||
|
}
|
||||||
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
|
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
|
||||||
|
|
||||||
|
#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 */
|
||||||
|
|||||||
138
pngmem.c
138
pngmem.c
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
/* 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.0 [February 28, 2009]
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2009 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.)
|
||||||
*
|
*
|
||||||
@@ -14,10 +14,9 @@
|
|||||||
* identify the replacement functions.
|
* identify the replacement functions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
|
||||||
#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__)
|
||||||
@@ -29,7 +28,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. */
|
||||||
@@ -48,7 +47,7 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
|
|||||||
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;
|
||||||
@@ -68,7 +67,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 +79,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 +111,21 @@ 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.
|
||||||
*/
|
*/
|
||||||
|
#ifdef PNG_CALLOC_SUPPORTED
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
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 +133,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)
|
||||||
{
|
{
|
||||||
@@ -168,7 +182,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 +199,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);
|
||||||
}
|
}
|
||||||
@@ -207,15 +221,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" and "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 +256,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,9 +272,9 @@ 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
|
||||||
|
|
||||||
@@ -270,6 +284,7 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
|||||||
/* 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)
|
||||||
{
|
{
|
||||||
@@ -290,6 +305,8 @@ 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 +344,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 +365,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 +381,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 +398,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 +410,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;
|
||||||
@@ -421,7 +438,18 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
|
|||||||
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 +457,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 +479,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
|
||||||
@@ -524,53 +552,25 @@ 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 +580,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 +595,7 @@ 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 */
|
||||||
|
|||||||
273
pngpread.c
273
pngpread.c
@@ -1,17 +1,16 @@
|
|||||||
|
|
||||||
/* pngpread.c - read a png file in push mode
|
/* pngpread.c - read a png file in push mode
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.2.8 - December 3, 2004
|
* Last changed in libpng 1.4.0 [February 28, 2009]
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2004 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2009 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.)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
|
||||||
#include "png.h"
|
#include "png.h"
|
||||||
|
|
||||||
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
|
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
|
||||||
|
#include "pngpriv.h"
|
||||||
|
|
||||||
/* push model modes */
|
/* push model modes */
|
||||||
#define PNG_READ_SIG_MODE 0
|
#define PNG_READ_SIG_MODE 0
|
||||||
@@ -28,6 +27,7 @@ void PNGAPI
|
|||||||
png_process_data(png_structp png_ptr, png_infop info_ptr,
|
png_process_data(png_structp png_ptr, png_infop info_ptr,
|
||||||
png_bytep buffer, png_size_t buffer_size)
|
png_bytep buffer, png_size_t buffer_size)
|
||||||
{
|
{
|
||||||
|
if (png_ptr == NULL || info_ptr == NULL) return;
|
||||||
png_push_restore_buffer(png_ptr, buffer, buffer_size);
|
png_push_restore_buffer(png_ptr, buffer, buffer_size);
|
||||||
|
|
||||||
while (png_ptr->buffer_size)
|
while (png_ptr->buffer_size)
|
||||||
@@ -42,6 +42,7 @@ png_process_data(png_structp png_ptr, png_infop info_ptr,
|
|||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_process_some_data(png_structp png_ptr, png_infop info_ptr)
|
png_process_some_data(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
|
if (png_ptr == NULL) return;
|
||||||
switch (png_ptr->process_mode)
|
switch (png_ptr->process_mode)
|
||||||
{
|
{
|
||||||
case PNG_READ_SIG_MODE:
|
case PNG_READ_SIG_MODE:
|
||||||
@@ -112,7 +113,7 @@ png_push_read_sig(png_structp png_ptr, png_infop info_ptr)
|
|||||||
|
|
||||||
png_push_fill_buffer(png_ptr, &(info_ptr->signature[num_checked]),
|
png_push_fill_buffer(png_ptr, &(info_ptr->signature[num_checked]),
|
||||||
num_to_check);
|
num_to_check);
|
||||||
png_ptr->sig_bytes = (png_byte)(png_ptr->sig_bytes+num_to_check);
|
png_ptr->sig_bytes = (png_byte)(png_ptr->sig_bytes + num_to_check);
|
||||||
|
|
||||||
if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check))
|
if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check))
|
||||||
{
|
{
|
||||||
@@ -135,60 +136,60 @@ void /* PRIVATE */
|
|||||||
png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_USE_LOCAL_ARRAYS
|
#ifdef PNG_USE_LOCAL_ARRAYS
|
||||||
PNG_IHDR;
|
PNG_CONST PNG_IHDR;
|
||||||
PNG_IDAT;
|
PNG_CONST PNG_IDAT;
|
||||||
PNG_IEND;
|
PNG_CONST PNG_IEND;
|
||||||
PNG_PLTE;
|
PNG_CONST PNG_PLTE;
|
||||||
#if defined(PNG_READ_bKGD_SUPPORTED)
|
#if defined(PNG_READ_bKGD_SUPPORTED)
|
||||||
PNG_bKGD;
|
PNG_CONST PNG_bKGD;
|
||||||
#endif
|
#endif
|
||||||
#if defined(PNG_READ_cHRM_SUPPORTED)
|
#if defined(PNG_READ_cHRM_SUPPORTED)
|
||||||
PNG_cHRM;
|
PNG_CONST PNG_cHRM;
|
||||||
#endif
|
#endif
|
||||||
#if defined(PNG_READ_gAMA_SUPPORTED)
|
#if defined(PNG_READ_gAMA_SUPPORTED)
|
||||||
PNG_gAMA;
|
PNG_CONST PNG_gAMA;
|
||||||
#endif
|
#endif
|
||||||
#if defined(PNG_READ_hIST_SUPPORTED)
|
#if defined(PNG_READ_hIST_SUPPORTED)
|
||||||
PNG_hIST;
|
PNG_CONST PNG_hIST;
|
||||||
#endif
|
#endif
|
||||||
#if defined(PNG_READ_iCCP_SUPPORTED)
|
#if defined(PNG_READ_iCCP_SUPPORTED)
|
||||||
PNG_iCCP;
|
PNG_CONST PNG_iCCP;
|
||||||
#endif
|
#endif
|
||||||
#if defined(PNG_READ_iTXt_SUPPORTED)
|
#if defined(PNG_READ_iTXt_SUPPORTED)
|
||||||
PNG_iTXt;
|
PNG_CONST PNG_iTXt;
|
||||||
#endif
|
#endif
|
||||||
#if defined(PNG_READ_oFFs_SUPPORTED)
|
#if defined(PNG_READ_oFFs_SUPPORTED)
|
||||||
PNG_oFFs;
|
PNG_CONST PNG_oFFs;
|
||||||
#endif
|
#endif
|
||||||
#if defined(PNG_READ_pCAL_SUPPORTED)
|
#if defined(PNG_READ_pCAL_SUPPORTED)
|
||||||
PNG_pCAL;
|
PNG_CONST PNG_pCAL;
|
||||||
#endif
|
#endif
|
||||||
#if defined(PNG_READ_pHYs_SUPPORTED)
|
#if defined(PNG_READ_pHYs_SUPPORTED)
|
||||||
PNG_pHYs;
|
PNG_CONST PNG_pHYs;
|
||||||
#endif
|
#endif
|
||||||
#if defined(PNG_READ_sBIT_SUPPORTED)
|
#if defined(PNG_READ_sBIT_SUPPORTED)
|
||||||
PNG_sBIT;
|
PNG_CONST PNG_sBIT;
|
||||||
#endif
|
#endif
|
||||||
#if defined(PNG_READ_sCAL_SUPPORTED)
|
#if defined(PNG_READ_sCAL_SUPPORTED)
|
||||||
PNG_sCAL;
|
PNG_CONST PNG_sCAL;
|
||||||
#endif
|
#endif
|
||||||
#if defined(PNG_READ_sRGB_SUPPORTED)
|
#if defined(PNG_READ_sRGB_SUPPORTED)
|
||||||
PNG_sRGB;
|
PNG_CONST PNG_sRGB;
|
||||||
#endif
|
#endif
|
||||||
#if defined(PNG_READ_sPLT_SUPPORTED)
|
#if defined(PNG_READ_sPLT_SUPPORTED)
|
||||||
PNG_sPLT;
|
PNG_CONST PNG_sPLT;
|
||||||
#endif
|
#endif
|
||||||
#if defined(PNG_READ_tEXt_SUPPORTED)
|
#if defined(PNG_READ_tEXt_SUPPORTED)
|
||||||
PNG_tEXt;
|
PNG_CONST PNG_tEXt;
|
||||||
#endif
|
#endif
|
||||||
#if defined(PNG_READ_tIME_SUPPORTED)
|
#if defined(PNG_READ_tIME_SUPPORTED)
|
||||||
PNG_tIME;
|
PNG_CONST PNG_tIME;
|
||||||
#endif
|
#endif
|
||||||
#if defined(PNG_READ_tRNS_SUPPORTED)
|
#if defined(PNG_READ_tRNS_SUPPORTED)
|
||||||
PNG_tRNS;
|
PNG_CONST PNG_tRNS;
|
||||||
#endif
|
#endif
|
||||||
#if defined(PNG_READ_zTXt_SUPPORTED)
|
#if defined(PNG_READ_zTXt_SUPPORTED)
|
||||||
PNG_zTXt;
|
PNG_CONST PNG_zTXt;
|
||||||
#endif
|
#endif
|
||||||
#endif /* PNG_USE_LOCAL_ARRAYS */
|
#endif /* PNG_USE_LOCAL_ARRAYS */
|
||||||
/* First we make sure we have enough data for the 4 byte chunk name
|
/* First we make sure we have enough data for the 4 byte chunk name
|
||||||
@@ -208,14 +209,21 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
png_push_fill_buffer(png_ptr, chunk_length, 4);
|
png_push_fill_buffer(png_ptr, chunk_length, 4);
|
||||||
png_ptr->push_length = png_get_uint_31(png_ptr,chunk_length);
|
png_ptr->push_length = png_get_uint_31(png_ptr, chunk_length);
|
||||||
png_reset_crc(png_ptr);
|
png_reset_crc(png_ptr);
|
||||||
png_crc_read(png_ptr, png_ptr->chunk_name, 4);
|
png_crc_read(png_ptr, png_ptr->chunk_name, 4);
|
||||||
|
png_check_chunk_name(png_ptr, png_ptr->chunk_name);
|
||||||
png_ptr->mode |= PNG_HAVE_CHUNK_HEADER;
|
png_ptr->mode |= PNG_HAVE_CHUNK_HEADER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
|
||||||
|
if (png_ptr->mode & PNG_AFTER_IDAT)
|
||||||
|
png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
|
||||||
|
|
||||||
if (!png_memcmp(png_ptr->chunk_name, png_IHDR, 4))
|
if (!png_memcmp(png_ptr->chunk_name, png_IHDR, 4))
|
||||||
{
|
{
|
||||||
|
if (png_ptr->push_length != 13)
|
||||||
|
png_error(png_ptr, "Invalid IHDR length");
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
||||||
{
|
{
|
||||||
png_push_save_buffer(png_ptr);
|
png_push_save_buffer(png_ptr);
|
||||||
@@ -267,7 +275,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||||||
}
|
}
|
||||||
png_handle_PLTE(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_PLTE(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
else if (!png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4))
|
else if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
|
||||||
{
|
{
|
||||||
/* If we reach an IDAT chunk, this means we have read all of the
|
/* If we reach an IDAT chunk, this means we have read all of the
|
||||||
* header chunks, and we can start reading the image (or if this
|
* header chunks, and we can start reading the image (or if this
|
||||||
@@ -281,11 +289,12 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||||||
|
|
||||||
if (png_ptr->mode & PNG_HAVE_IDAT)
|
if (png_ptr->mode & PNG_HAVE_IDAT)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length == 0)
|
if (!(png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT))
|
||||||
return;
|
if (png_ptr->push_length == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
if (png_ptr->mode & PNG_AFTER_IDAT)
|
if (png_ptr->mode & PNG_AFTER_IDAT)
|
||||||
png_error(png_ptr, "Too many IDAT's found");
|
png_benign_error(png_ptr, "Too many IDATs found");
|
||||||
}
|
}
|
||||||
|
|
||||||
png_ptr->idat_size = png_ptr->push_length;
|
png_ptr->idat_size = png_ptr->push_length;
|
||||||
@@ -556,6 +565,7 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
|
|||||||
{
|
{
|
||||||
png_bytep ptr;
|
png_bytep ptr;
|
||||||
|
|
||||||
|
if (png_ptr == NULL) return;
|
||||||
ptr = buffer;
|
ptr = buffer;
|
||||||
if (png_ptr->save_buffer_size)
|
if (png_ptr->save_buffer_size)
|
||||||
{
|
{
|
||||||
@@ -596,7 +606,7 @@ png_push_save_buffer(png_structp png_ptr)
|
|||||||
{
|
{
|
||||||
if (png_ptr->save_buffer_ptr != png_ptr->save_buffer)
|
if (png_ptr->save_buffer_ptr != png_ptr->save_buffer)
|
||||||
{
|
{
|
||||||
png_size_t i,istop;
|
png_size_t i, istop;
|
||||||
png_bytep sp;
|
png_bytep sp;
|
||||||
png_bytep dp;
|
png_bytep dp;
|
||||||
|
|
||||||
@@ -622,7 +632,7 @@ png_push_save_buffer(png_structp png_ptr)
|
|||||||
new_max = png_ptr->save_buffer_size + png_ptr->current_buffer_size + 256;
|
new_max = png_ptr->save_buffer_size + png_ptr->current_buffer_size + 256;
|
||||||
old_buffer = png_ptr->save_buffer;
|
old_buffer = png_ptr->save_buffer;
|
||||||
png_ptr->save_buffer = (png_bytep)png_malloc(png_ptr,
|
png_ptr->save_buffer = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_uint_32)new_max);
|
(png_size_t)new_max);
|
||||||
png_memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
|
png_memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
|
||||||
png_free(png_ptr, old_buffer);
|
png_free(png_ptr, old_buffer);
|
||||||
png_ptr->save_buffer_max = new_max;
|
png_ptr->save_buffer_max = new_max;
|
||||||
@@ -652,7 +662,7 @@ void /* PRIVATE */
|
|||||||
png_push_read_IDAT(png_structp png_ptr)
|
png_push_read_IDAT(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_USE_LOCAL_ARRAYS
|
#ifdef PNG_USE_LOCAL_ARRAYS
|
||||||
PNG_IDAT;
|
PNG_CONST PNG_IDAT;
|
||||||
#endif
|
#endif
|
||||||
if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER))
|
if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER))
|
||||||
{
|
{
|
||||||
@@ -665,12 +675,12 @@ png_push_read_IDAT(png_structp png_ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
png_push_fill_buffer(png_ptr, chunk_length, 4);
|
png_push_fill_buffer(png_ptr, chunk_length, 4);
|
||||||
png_ptr->push_length = png_get_uint_31(png_ptr,chunk_length);
|
png_ptr->push_length = png_get_uint_31(png_ptr, chunk_length);
|
||||||
png_reset_crc(png_ptr);
|
png_reset_crc(png_ptr);
|
||||||
png_crc_read(png_ptr, png_ptr->chunk_name, 4);
|
png_crc_read(png_ptr, png_ptr->chunk_name, 4);
|
||||||
png_ptr->mode |= PNG_HAVE_CHUNK_HEADER;
|
png_ptr->mode |= PNG_HAVE_CHUNK_HEADER;
|
||||||
|
|
||||||
if (png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4))
|
if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
|
||||||
{
|
{
|
||||||
png_ptr->process_mode = PNG_READ_CHUNK_MODE;
|
png_ptr->process_mode = PNG_READ_CHUNK_MODE;
|
||||||
if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED))
|
if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED))
|
||||||
@@ -688,7 +698,7 @@ png_push_read_IDAT(png_structp png_ptr)
|
|||||||
{
|
{
|
||||||
save_size = (png_size_t)png_ptr->idat_size;
|
save_size = (png_size_t)png_ptr->idat_size;
|
||||||
/* check for overflow */
|
/* check for overflow */
|
||||||
if((png_uint_32)save_size != png_ptr->idat_size)
|
if ((png_uint_32)save_size != png_ptr->idat_size)
|
||||||
png_error(png_ptr, "save_size overflowed in pngpread");
|
png_error(png_ptr, "save_size overflowed in pngpread");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -710,7 +720,7 @@ png_push_read_IDAT(png_structp png_ptr)
|
|||||||
{
|
{
|
||||||
save_size = (png_size_t)png_ptr->idat_size;
|
save_size = (png_size_t)png_ptr->idat_size;
|
||||||
/* check for overflow */
|
/* check for overflow */
|
||||||
if((png_uint_32)save_size != png_ptr->idat_size)
|
if ((png_uint_32)save_size != png_ptr->idat_size)
|
||||||
png_error(png_ptr, "save_size overflowed in pngpread");
|
png_error(png_ptr, "save_size overflowed in pngpread");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -746,11 +756,11 @@ png_process_IDAT_data(png_structp png_ptr, png_bytep buffer,
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if ((png_ptr->flags & PNG_FLAG_ZLIB_FINISHED) && buffer_length)
|
if ((png_ptr->flags & PNG_FLAG_ZLIB_FINISHED) && buffer_length)
|
||||||
png_error(png_ptr, "Extra compression data");
|
png_benign_error(png_ptr, "Extra compression data");
|
||||||
|
|
||||||
png_ptr->zstream.next_in = buffer;
|
png_ptr->zstream.next_in = buffer;
|
||||||
png_ptr->zstream.avail_in = (uInt)buffer_length;
|
png_ptr->zstream.avail_in = (uInt)buffer_length;
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH);
|
ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH);
|
||||||
if (ret != Z_OK)
|
if (ret != Z_OK)
|
||||||
@@ -758,7 +768,7 @@ png_process_IDAT_data(png_structp png_ptr, png_bytep buffer,
|
|||||||
if (ret == Z_STREAM_END)
|
if (ret == Z_STREAM_END)
|
||||||
{
|
{
|
||||||
if (png_ptr->zstream.avail_in)
|
if (png_ptr->zstream.avail_in)
|
||||||
png_error(png_ptr, "Extra compressed data");
|
png_benign_error(png_ptr, "Extra compressed data");
|
||||||
if (!(png_ptr->zstream.avail_out))
|
if (!(png_ptr->zstream.avail_out))
|
||||||
{
|
{
|
||||||
png_push_process_row(png_ptr);
|
png_push_process_row(png_ptr);
|
||||||
@@ -812,8 +822,7 @@ png_push_process_row(png_structp png_ptr)
|
|||||||
png_ptr->row_buf + 1, png_ptr->prev_row + 1,
|
png_ptr->row_buf + 1, png_ptr->prev_row + 1,
|
||||||
(int)(png_ptr->row_buf[0]));
|
(int)(png_ptr->row_buf[0]));
|
||||||
|
|
||||||
png_memcpy_check(png_ptr, png_ptr->prev_row, png_ptr->row_buf,
|
png_memcpy(png_ptr->prev_row, png_ptr->row_buf, png_ptr->rowbytes + 1);
|
||||||
png_ptr->rowbytes + 1);
|
|
||||||
|
|
||||||
if (png_ptr->transformations || (png_ptr->flags&PNG_FLAG_STRIP_ALPHA))
|
if (png_ptr->transformations || (png_ptr->flags&PNG_FLAG_STRIP_ALPHA))
|
||||||
png_do_read_transformations(png_ptr);
|
png_do_read_transformations(png_ptr);
|
||||||
@@ -843,7 +852,7 @@ png_push_process_row(png_structp png_ptr)
|
|||||||
{
|
{
|
||||||
for (i = 0; i < 4 && png_ptr->pass == 2; i++)
|
for (i = 0; i < 4 && png_ptr->pass == 2; i++)
|
||||||
{
|
{
|
||||||
png_push_have_row(png_ptr, png_bytep_NULL);
|
png_push_have_row(png_ptr, NULL);
|
||||||
png_read_push_finish_row(png_ptr);
|
png_read_push_finish_row(png_ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -851,13 +860,13 @@ png_push_process_row(png_structp png_ptr)
|
|||||||
{
|
{
|
||||||
for (i = 0; i < 2 && png_ptr->pass == 4; i++)
|
for (i = 0; i < 2 && png_ptr->pass == 4; i++)
|
||||||
{
|
{
|
||||||
png_push_have_row(png_ptr, png_bytep_NULL);
|
png_push_have_row(png_ptr, NULL);
|
||||||
png_read_push_finish_row(png_ptr);
|
png_read_push_finish_row(png_ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (png_ptr->pass == 6 && png_ptr->height <= 4)
|
if (png_ptr->pass == 6 && png_ptr->height <= 4)
|
||||||
{
|
{
|
||||||
png_push_have_row(png_ptr, png_bytep_NULL);
|
png_push_have_row(png_ptr, NULL);
|
||||||
png_read_push_finish_row(png_ptr);
|
png_read_push_finish_row(png_ptr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -874,7 +883,7 @@ png_push_process_row(png_structp png_ptr)
|
|||||||
{
|
{
|
||||||
for (i = 0; i < 4 && png_ptr->pass == 2; i++)
|
for (i = 0; i < 4 && png_ptr->pass == 2; i++)
|
||||||
{
|
{
|
||||||
png_push_have_row(png_ptr, png_bytep_NULL);
|
png_push_have_row(png_ptr, NULL);
|
||||||
png_read_push_finish_row(png_ptr);
|
png_read_push_finish_row(png_ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -890,14 +899,14 @@ png_push_process_row(png_structp png_ptr)
|
|||||||
}
|
}
|
||||||
for (i = 0; i < 4 && png_ptr->pass == 2; i++)
|
for (i = 0; i < 4 && png_ptr->pass == 2; i++)
|
||||||
{
|
{
|
||||||
png_push_have_row(png_ptr, png_bytep_NULL);
|
png_push_have_row(png_ptr, NULL);
|
||||||
png_read_push_finish_row(png_ptr);
|
png_read_push_finish_row(png_ptr);
|
||||||
}
|
}
|
||||||
if (png_ptr->pass == 4) /* pass 3 might be empty */
|
if (png_ptr->pass == 4) /* pass 3 might be empty */
|
||||||
{
|
{
|
||||||
for (i = 0; i < 2 && png_ptr->pass == 4; i++)
|
for (i = 0; i < 2 && png_ptr->pass == 4; i++)
|
||||||
{
|
{
|
||||||
png_push_have_row(png_ptr, png_bytep_NULL);
|
png_push_have_row(png_ptr, NULL);
|
||||||
png_read_push_finish_row(png_ptr);
|
png_read_push_finish_row(png_ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -915,7 +924,7 @@ png_push_process_row(png_structp png_ptr)
|
|||||||
{
|
{
|
||||||
for (i = 0; i < 2 && png_ptr->pass == 4; i++)
|
for (i = 0; i < 2 && png_ptr->pass == 4; i++)
|
||||||
{
|
{
|
||||||
png_push_have_row(png_ptr, png_bytep_NULL);
|
png_push_have_row(png_ptr, NULL);
|
||||||
png_read_push_finish_row(png_ptr);
|
png_read_push_finish_row(png_ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -931,12 +940,12 @@ png_push_process_row(png_structp png_ptr)
|
|||||||
}
|
}
|
||||||
for (i = 0; i < 2 && png_ptr->pass == 4; i++)
|
for (i = 0; i < 2 && png_ptr->pass == 4; i++)
|
||||||
{
|
{
|
||||||
png_push_have_row(png_ptr, png_bytep_NULL);
|
png_push_have_row(png_ptr, NULL);
|
||||||
png_read_push_finish_row(png_ptr);
|
png_read_push_finish_row(png_ptr);
|
||||||
}
|
}
|
||||||
if (png_ptr->pass == 6) /* pass 5 might be empty */
|
if (png_ptr->pass == 6) /* pass 5 might be empty */
|
||||||
{
|
{
|
||||||
png_push_have_row(png_ptr, png_bytep_NULL);
|
png_push_have_row(png_ptr, NULL);
|
||||||
png_read_push_finish_row(png_ptr);
|
png_read_push_finish_row(png_ptr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -951,7 +960,7 @@ png_push_process_row(png_structp png_ptr)
|
|||||||
}
|
}
|
||||||
if (png_ptr->pass == 6) /* skip top generated row */
|
if (png_ptr->pass == 6) /* skip top generated row */
|
||||||
{
|
{
|
||||||
png_push_have_row(png_ptr, png_bytep_NULL);
|
png_push_have_row(png_ptr, NULL);
|
||||||
png_read_push_finish_row(png_ptr);
|
png_read_push_finish_row(png_ptr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -962,7 +971,7 @@ png_push_process_row(png_structp png_ptr)
|
|||||||
png_read_push_finish_row(png_ptr);
|
png_read_push_finish_row(png_ptr);
|
||||||
if (png_ptr->pass != 6)
|
if (png_ptr->pass != 6)
|
||||||
break;
|
break;
|
||||||
png_push_have_row(png_ptr, png_bytep_NULL);
|
png_push_have_row(png_ptr, NULL);
|
||||||
png_read_push_finish_row(png_ptr);
|
png_read_push_finish_row(png_ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -982,25 +991,20 @@ png_read_push_finish_row(png_structp png_ptr)
|
|||||||
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
||||||
|
|
||||||
/* start of interlace block */
|
/* start of interlace block */
|
||||||
const int FARDATA png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
|
PNG_CONST int FARDATA png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
|
||||||
|
|
||||||
/* offset to next interlace block */
|
/* offset to next interlace block */
|
||||||
const int FARDATA png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
|
PNG_CONST int FARDATA png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
|
||||||
|
|
||||||
/* start of interlace block in the y direction */
|
/* start of interlace block in the y direction */
|
||||||
const int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
|
PNG_CONST int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
|
||||||
|
|
||||||
/* offset to next interlace block in the y direction */
|
/* offset to next interlace block in the y direction */
|
||||||
const int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
|
PNG_CONST int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
|
||||||
|
|
||||||
/* Width of interlace block. This is not currently used - if you need
|
|
||||||
* it, uncomment it here and in png.h
|
|
||||||
const int FARDATA png_pass_width[] = {8, 4, 4, 2, 2, 1, 1};
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Height of interlace block. This is not currently used - if you need
|
/* Height of interlace block. This is not currently used - if you need
|
||||||
* it, uncomment it here and in png.h
|
* it, uncomment it here and in png.h
|
||||||
const int FARDATA png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
|
PNG_CONST int FARDATA png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
|
||||||
*/
|
*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1011,8 +1015,7 @@ png_read_push_finish_row(png_structp png_ptr)
|
|||||||
if (png_ptr->interlaced)
|
if (png_ptr->interlaced)
|
||||||
{
|
{
|
||||||
png_ptr->row_number = 0;
|
png_ptr->row_number = 0;
|
||||||
png_memset_check(png_ptr, png_ptr->prev_row, 0,
|
png_memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
|
||||||
png_ptr->rowbytes + 1);
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
png_ptr->pass++;
|
png_ptr->pass++;
|
||||||
@@ -1054,8 +1057,7 @@ png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
|||||||
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
|
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
|
||||||
{
|
{
|
||||||
png_error(png_ptr, "Out of place tEXt");
|
png_error(png_ptr, "Out of place tEXt");
|
||||||
/* to quiet some compiler warnings */
|
info_ptr = info_ptr; /* to quiet some compiler warnings */
|
||||||
if(info_ptr == NULL) return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_MAX_MALLOC_64K
|
#ifdef PNG_MAX_MALLOC_64K
|
||||||
@@ -1070,7 +1072,7 @@ png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
png_ptr->current_text = (png_charp)png_malloc(png_ptr,
|
png_ptr->current_text = (png_charp)png_malloc(png_ptr,
|
||||||
(png_uint_32)(length+1));
|
(png_size_t)(length + 1));
|
||||||
png_ptr->current_text[length] = '\0';
|
png_ptr->current_text[length] = '\0';
|
||||||
png_ptr->current_text_ptr = png_ptr->current_text;
|
png_ptr->current_text_ptr = png_ptr->current_text;
|
||||||
png_ptr->current_text_size = (png_size_t)length;
|
png_ptr->current_text_size = (png_size_t)length;
|
||||||
@@ -1118,11 +1120,11 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
|
|||||||
for (text = key; *text; text++)
|
for (text = key; *text; text++)
|
||||||
/* empty loop */ ;
|
/* empty loop */ ;
|
||||||
|
|
||||||
if (text != key + png_ptr->current_text_size)
|
if (text < key + png_ptr->current_text_size)
|
||||||
text++;
|
text++;
|
||||||
|
|
||||||
text_ptr = (png_textp)png_malloc(png_ptr,
|
text_ptr = (png_textp)png_malloc(png_ptr,
|
||||||
(png_uint_32)png_sizeof(png_text));
|
png_sizeof(png_text));
|
||||||
text_ptr->compression = PNG_TEXT_COMPRESSION_NONE;
|
text_ptr->compression = PNG_TEXT_COMPRESSION_NONE;
|
||||||
text_ptr->key = key;
|
text_ptr->key = key;
|
||||||
#ifdef PNG_iTXt_SUPPORTED
|
#ifdef PNG_iTXt_SUPPORTED
|
||||||
@@ -1138,7 +1140,7 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
|
|||||||
png_ptr->current_text = NULL;
|
png_ptr->current_text = NULL;
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
png_warning(png_ptr, "Insufficient memory to store text chunk.");
|
png_warning(png_ptr, "Insufficient memory to store text chunk");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -1151,8 +1153,7 @@ png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
|||||||
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
|
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
|
||||||
{
|
{
|
||||||
png_error(png_ptr, "Out of place zTXt");
|
png_error(png_ptr, "Out of place zTXt");
|
||||||
/* to quiet some compiler warnings */
|
info_ptr = info_ptr; /* to quiet some compiler warnings */
|
||||||
if(info_ptr == NULL) return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_MAX_MALLOC_64K
|
#ifdef PNG_MAX_MALLOC_64K
|
||||||
@@ -1169,7 +1170,7 @@ png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
png_ptr->current_text = (png_charp)png_malloc(png_ptr,
|
png_ptr->current_text = (png_charp)png_malloc(png_ptr,
|
||||||
(png_uint_32)(length+1));
|
(png_size_t)(length + 1));
|
||||||
png_ptr->current_text[length] = '\0';
|
png_ptr->current_text[length] = '\0';
|
||||||
png_ptr->current_text_ptr = png_ptr->current_text;
|
png_ptr->current_text_ptr = png_ptr->current_text;
|
||||||
png_ptr->current_text_size = (png_size_t)length;
|
png_ptr->current_text_size = (png_size_t)length;
|
||||||
@@ -1214,7 +1215,7 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
|
|||||||
/* empty loop */ ;
|
/* empty loop */ ;
|
||||||
|
|
||||||
/* zTXt can't have zero text */
|
/* zTXt can't have zero text */
|
||||||
if (text == key + png_ptr->current_text_size)
|
if (text >= key + png_ptr->current_text_size)
|
||||||
{
|
{
|
||||||
png_ptr->current_text = NULL;
|
png_ptr->current_text = NULL;
|
||||||
png_free(png_ptr, key);
|
png_free(png_ptr, key);
|
||||||
@@ -1260,8 +1261,8 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
|
|||||||
if (text == NULL)
|
if (text == NULL)
|
||||||
{
|
{
|
||||||
text = (png_charp)png_malloc(png_ptr,
|
text = (png_charp)png_malloc(png_ptr,
|
||||||
(png_uint_32)(png_ptr->zbuf_size - png_ptr->zstream.avail_out
|
(png_ptr->zbuf_size
|
||||||
+ key_size + 1));
|
- png_ptr->zstream.avail_out + key_size + 1));
|
||||||
png_memcpy(text + key_size, png_ptr->zbuf,
|
png_memcpy(text + key_size, png_ptr->zbuf,
|
||||||
png_ptr->zbuf_size - png_ptr->zstream.avail_out);
|
png_ptr->zbuf_size - png_ptr->zstream.avail_out);
|
||||||
png_memcpy(text, key, key_size);
|
png_memcpy(text, key, key_size);
|
||||||
@@ -1275,8 +1276,8 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
|
|||||||
|
|
||||||
tmp = text;
|
tmp = text;
|
||||||
text = (png_charp)png_malloc(png_ptr, text_size +
|
text = (png_charp)png_malloc(png_ptr, text_size +
|
||||||
(png_uint_32)(png_ptr->zbuf_size - png_ptr->zstream.avail_out
|
(png_ptr->zbuf_size
|
||||||
+ 1));
|
- png_ptr->zstream.avail_out + 1));
|
||||||
png_memcpy(text, tmp, text_size);
|
png_memcpy(text, tmp, text_size);
|
||||||
png_free(png_ptr, tmp);
|
png_free(png_ptr, tmp);
|
||||||
png_memcpy(text + text_size, png_ptr->zbuf,
|
png_memcpy(text + text_size, png_ptr->zbuf,
|
||||||
@@ -1316,7 +1317,7 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
|
|||||||
text += key_size;
|
text += key_size;
|
||||||
|
|
||||||
text_ptr = (png_textp)png_malloc(png_ptr,
|
text_ptr = (png_textp)png_malloc(png_ptr,
|
||||||
(png_uint_32)png_sizeof(png_text));
|
png_sizeof(png_text));
|
||||||
text_ptr->compression = PNG_TEXT_COMPRESSION_zTXt;
|
text_ptr->compression = PNG_TEXT_COMPRESSION_zTXt;
|
||||||
text_ptr->key = key;
|
text_ptr->key = key;
|
||||||
#ifdef PNG_iTXt_SUPPORTED
|
#ifdef PNG_iTXt_SUPPORTED
|
||||||
@@ -1331,7 +1332,7 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
|
|||||||
png_free(png_ptr, text_ptr);
|
png_free(png_ptr, text_ptr);
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
png_warning(png_ptr, "Insufficient memory to store text chunk.");
|
png_warning(png_ptr, "Insufficient memory to store text chunk");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -1344,8 +1345,7 @@ png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
|||||||
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
|
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
|
||||||
{
|
{
|
||||||
png_error(png_ptr, "Out of place iTXt");
|
png_error(png_ptr, "Out of place iTXt");
|
||||||
/* to quiet some compiler warnings */
|
info_ptr = info_ptr; /* to quiet some compiler warnings */
|
||||||
if(info_ptr == NULL) return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_MAX_MALLOC_64K
|
#ifdef PNG_MAX_MALLOC_64K
|
||||||
@@ -1360,7 +1360,7 @@ png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
png_ptr->current_text = (png_charp)png_malloc(png_ptr,
|
png_ptr->current_text = (png_charp)png_malloc(png_ptr,
|
||||||
(png_uint_32)(length+1));
|
(png_size_t)(length + 1));
|
||||||
png_ptr->current_text[length] = '\0';
|
png_ptr->current_text[length] = '\0';
|
||||||
png_ptr->current_text_ptr = png_ptr->current_text;
|
png_ptr->current_text_ptr = png_ptr->current_text;
|
||||||
png_ptr->current_text_size = (png_size_t)length;
|
png_ptr->current_text_size = (png_size_t)length;
|
||||||
@@ -1412,7 +1412,7 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
|
|||||||
for (lang = key; *lang; lang++)
|
for (lang = key; *lang; lang++)
|
||||||
/* empty loop */ ;
|
/* empty loop */ ;
|
||||||
|
|
||||||
if (lang != key + png_ptr->current_text_size)
|
if (lang < key + png_ptr->current_text_size - 3)
|
||||||
lang++;
|
lang++;
|
||||||
|
|
||||||
comp_flag = *lang++;
|
comp_flag = *lang++;
|
||||||
@@ -1422,14 +1422,18 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
|
|||||||
/* empty loop */ ;
|
/* empty loop */ ;
|
||||||
lang_key++; /* skip NUL separator */
|
lang_key++; /* skip NUL separator */
|
||||||
|
|
||||||
for (text = lang_key; *text; text++)
|
text=lang_key;
|
||||||
/* empty loop */ ;
|
if (lang_key < key + png_ptr->current_text_size - 1)
|
||||||
|
{
|
||||||
|
for (; *text; text++)
|
||||||
|
/* empty loop */ ;
|
||||||
|
}
|
||||||
|
|
||||||
if (text != key + png_ptr->current_text_size)
|
if (text < key + png_ptr->current_text_size)
|
||||||
text++;
|
text++;
|
||||||
|
|
||||||
text_ptr = (png_textp)png_malloc(png_ptr,
|
text_ptr = (png_textp)png_malloc(png_ptr,
|
||||||
(png_uint_32)png_sizeof(png_text));
|
png_sizeof(png_text));
|
||||||
text_ptr->compression = comp_flag + 2;
|
text_ptr->compression = comp_flag + 2;
|
||||||
text_ptr->key = key;
|
text_ptr->key = key;
|
||||||
text_ptr->lang = lang;
|
text_ptr->lang = lang;
|
||||||
@@ -1444,7 +1448,7 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
|
|||||||
|
|
||||||
png_free(png_ptr, text_ptr);
|
png_free(png_ptr, text_ptr);
|
||||||
if (ret)
|
if (ret)
|
||||||
png_warning(png_ptr, "Insufficient memory to store iTXt chunk.");
|
png_warning(png_ptr, "Insufficient memory to store iTXt chunk");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -1457,61 +1461,73 @@ void /* PRIVATE */
|
|||||||
png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
||||||
length)
|
length)
|
||||||
{
|
{
|
||||||
png_uint_32 skip=0;
|
png_uint_32 skip = 0;
|
||||||
png_check_chunk_name(png_ptr, png_ptr->chunk_name);
|
|
||||||
|
|
||||||
if (!(png_ptr->chunk_name[0] & 0x20))
|
if (!(png_ptr->chunk_name[0] & 0x20))
|
||||||
{
|
{
|
||||||
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
|
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
|
||||||
if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
|
if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
|
||||||
PNG_HANDLE_CHUNK_ALWAYS
|
PNG_HANDLE_CHUNK_ALWAYS
|
||||||
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
||||||
&& png_ptr->read_user_chunk_fn == NULL
|
&& png_ptr->read_user_chunk_fn == NULL
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
#endif
|
#endif
|
||||||
png_chunk_error(png_ptr, "unknown critical chunk");
|
png_chunk_error(png_ptr, "unknown critical chunk");
|
||||||
|
|
||||||
/* to quiet compiler warnings about unused info_ptr */
|
info_ptr = info_ptr; /* to quiet some compiler warnings */
|
||||||
if (info_ptr == NULL)
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
|
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
|
||||||
if (png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS)
|
if (png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS)
|
||||||
{
|
{
|
||||||
png_unknown_chunk chunk;
|
|
||||||
|
|
||||||
#ifdef PNG_MAX_MALLOC_64K
|
#ifdef PNG_MAX_MALLOC_64K
|
||||||
if (length > (png_uint_32)65535L)
|
if (length > (png_uint_32)65535L)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "unknown chunk too large to fit in memory");
|
png_warning(png_ptr, "unknown chunk too large to fit in memory");
|
||||||
skip = length - (png_uint_32)65535L;
|
skip = length - (png_uint_32)65535L;
|
||||||
length = (png_uint_32)65535L;
|
length = (png_uint_32)65535L;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
png_memcpy((png_charp)png_ptr->unknown_chunk.name,
|
||||||
|
(png_charp)png_ptr->chunk_name,
|
||||||
|
png_sizeof(png_ptr->unknown_chunk.name));
|
||||||
|
png_ptr->unknown_chunk.name[png_sizeof(png_ptr->unknown_chunk.name) - 1]
|
||||||
|
= '\0';
|
||||||
|
|
||||||
png_strcpy((png_charp)chunk.name, (png_charp)png_ptr->chunk_name);
|
png_ptr->unknown_chunk.size = (png_size_t)length;
|
||||||
chunk.data = (png_bytep)png_malloc(png_ptr, length);
|
if (length == 0)
|
||||||
png_crc_read(png_ptr, chunk.data, length);
|
png_ptr->unknown_chunk.data = NULL;
|
||||||
chunk.size = length;
|
else
|
||||||
|
{
|
||||||
|
png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr,
|
||||||
|
(png_size_t)length);
|
||||||
|
png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length);
|
||||||
|
}
|
||||||
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
||||||
if(png_ptr->read_user_chunk_fn != NULL)
|
if (png_ptr->read_user_chunk_fn != NULL)
|
||||||
{
|
{
|
||||||
/* callback to user unknown chunk handler */
|
/* callback to user unknown chunk handler */
|
||||||
if ((*(png_ptr->read_user_chunk_fn)) (png_ptr, &chunk) <= 0)
|
int ret;
|
||||||
{
|
ret = (*(png_ptr->read_user_chunk_fn))
|
||||||
if (!(png_ptr->chunk_name[0] & 0x20))
|
(png_ptr, &png_ptr->unknown_chunk);
|
||||||
if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
|
if (ret < 0)
|
||||||
PNG_HANDLE_CHUNK_ALWAYS)
|
png_chunk_error(png_ptr, "error in user chunk");
|
||||||
png_chunk_error(png_ptr, "unknown critical chunk");
|
if (ret == 0)
|
||||||
}
|
{
|
||||||
png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1);
|
if (!(png_ptr->chunk_name[0] & 0x20))
|
||||||
}
|
if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
|
||||||
else
|
PNG_HANDLE_CHUNK_ALWAYS)
|
||||||
|
png_chunk_error(png_ptr, "unknown critical chunk");
|
||||||
|
png_set_unknown_chunks(png_ptr, info_ptr,
|
||||||
|
&png_ptr->unknown_chunk, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1);
|
png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1);
|
||||||
png_free(png_ptr, chunk.data);
|
png_free(png_ptr, png_ptr->unknown_chunk.data);
|
||||||
|
png_ptr->unknown_chunk.data = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@@ -1546,9 +1562,10 @@ png_progressive_combine_row (png_structp png_ptr,
|
|||||||
png_bytep old_row, png_bytep new_row)
|
png_bytep old_row, png_bytep new_row)
|
||||||
{
|
{
|
||||||
#ifdef PNG_USE_LOCAL_ARRAYS
|
#ifdef PNG_USE_LOCAL_ARRAYS
|
||||||
const int FARDATA png_pass_dsp_mask[7] =
|
PNG_CONST int FARDATA png_pass_dsp_mask[7] =
|
||||||
{0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff};
|
{0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff};
|
||||||
#endif
|
#endif
|
||||||
|
if (png_ptr == NULL) return;
|
||||||
if (new_row != NULL) /* new_row must == png_ptr->row_buf here. */
|
if (new_row != NULL) /* new_row must == png_ptr->row_buf here. */
|
||||||
png_combine_row(png_ptr, old_row, png_pass_dsp_mask[png_ptr->pass]);
|
png_combine_row(png_ptr, old_row, png_pass_dsp_mask[png_ptr->pass]);
|
||||||
}
|
}
|
||||||
@@ -1558,6 +1575,7 @@ png_set_progressive_read_fn(png_structp png_ptr, png_voidp progressive_ptr,
|
|||||||
png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,
|
png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,
|
||||||
png_progressive_end_ptr end_fn)
|
png_progressive_end_ptr end_fn)
|
||||||
{
|
{
|
||||||
|
if (png_ptr == NULL) return;
|
||||||
png_ptr->info_fn = info_fn;
|
png_ptr->info_fn = info_fn;
|
||||||
png_ptr->row_fn = row_fn;
|
png_ptr->row_fn = row_fn;
|
||||||
png_ptr->end_fn = end_fn;
|
png_ptr->end_fn = end_fn;
|
||||||
@@ -1568,6 +1586,7 @@ png_set_progressive_read_fn(png_structp png_ptr, png_voidp progressive_ptr,
|
|||||||
png_voidp PNGAPI
|
png_voidp PNGAPI
|
||||||
png_get_progressive_ptr(png_structp png_ptr)
|
png_get_progressive_ptr(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
|
if (png_ptr == NULL) return (NULL);
|
||||||
return png_ptr->io_ptr;
|
return png_ptr->io_ptr;
|
||||||
}
|
}
|
||||||
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
||||||
|
|||||||
908
pngpriv.h
Normal file
908
pngpriv.h
Normal file
@@ -0,0 +1,908 @@
|
|||||||
|
|
||||||
|
/* pngpriv.h - private declarations for use inside libpng
|
||||||
|
*
|
||||||
|
* libpng version 1.4.0beta49 - February 28, 2009
|
||||||
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
* Copyright (c) 1998-2009 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.)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* 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>
|
||||||
|
|
||||||
|
/* 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
|
||||||
|
|
||||||
|
/* Other defines specific to compilers can go here. Try to keep
|
||||||
|
* them inside an appropriate ifdef/endif pair for portability.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(PNG_FLOATING_POINT_SUPPORTED)
|
||||||
|
# if defined(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 */
|
||||||
|
/* I have no idea why is this necessary... */
|
||||||
|
# if defined(_MSC_VER)
|
||||||
|
# include <malloc.h>
|
||||||
|
# endif
|
||||||
|
#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_DITHER 0x0040
|
||||||
|
#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 */
|
||||||
|
#define PNG_PREMULTIPLY_ALPHA 0x4000000L /* Added to libpng-1.4.0 by volker */
|
||||||
|
/* 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
|
||||||
|
#define PNG_FLAG_FREE_PLTE 0x1000
|
||||||
|
#define PNG_FLAG_FREE_TRNS 0x2000
|
||||||
|
#define PNG_FLAG_FREE_HIST 0x4000
|
||||||
|
#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) )
|
||||||
|
|
||||||
|
/* variables declared in png.c - only it needs to define PNG_NO_EXTERN */
|
||||||
|
#if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)
|
||||||
|
/* place to hold the signature string for a PNG file. */
|
||||||
|
#ifdef PNG_USE_GLOBAL_ARRAYS
|
||||||
|
PNG_EXPORT_VAR (const png_byte FARDATA) png_sig[8];
|
||||||
|
#else
|
||||||
|
#if 0
|
||||||
|
#define png_sig png_sig_bytes(NULL)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif /* PNG_NO_EXTERN */
|
||||||
|
|
||||||
|
/* Constant strings for known chunk types. If you need to add a chunk,
|
||||||
|
* define the name here, and add an invocation of the macro in png.c and
|
||||||
|
* wherever it's needed.
|
||||||
|
*/
|
||||||
|
#define PNG_IHDR const png_byte png_IHDR[5] = { 73, 72, 68, 82, '\0'}
|
||||||
|
#define PNG_IDAT const png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'}
|
||||||
|
#define PNG_IEND const png_byte png_IEND[5] = { 73, 69, 78, 68, '\0'}
|
||||||
|
#define PNG_PLTE const png_byte png_PLTE[5] = { 80, 76, 84, 69, '\0'}
|
||||||
|
#define PNG_bKGD const png_byte png_bKGD[5] = { 98, 75, 71, 68, '\0'}
|
||||||
|
#define PNG_cHRM const png_byte png_cHRM[5] = { 99, 72, 82, 77, '\0'}
|
||||||
|
#define PNG_gAMA const png_byte png_gAMA[5] = {103, 65, 77, 65, '\0'}
|
||||||
|
#define PNG_hIST const png_byte png_hIST[5] = {104, 73, 83, 84, '\0'}
|
||||||
|
#define PNG_iCCP const png_byte png_iCCP[5] = {105, 67, 67, 80, '\0'}
|
||||||
|
#define PNG_iTXt const png_byte png_iTXt[5] = {105, 84, 88, 116, '\0'}
|
||||||
|
#define PNG_oFFs const png_byte png_oFFs[5] = {111, 70, 70, 115, '\0'}
|
||||||
|
#define PNG_pCAL const png_byte png_pCAL[5] = {112, 67, 65, 76, '\0'}
|
||||||
|
#define PNG_sCAL const png_byte png_sCAL[5] = {115, 67, 65, 76, '\0'}
|
||||||
|
#define PNG_pHYs const png_byte png_pHYs[5] = {112, 72, 89, 115, '\0'}
|
||||||
|
#define PNG_sBIT const png_byte png_sBIT[5] = {115, 66, 73, 84, '\0'}
|
||||||
|
#define PNG_sPLT const png_byte png_sPLT[5] = {115, 80, 76, 84, '\0'}
|
||||||
|
#define PNG_sRGB const png_byte png_sRGB[5] = {115, 82, 71, 66, '\0'}
|
||||||
|
#define PNG_sTER const png_byte png_sTER[5] = {115, 84, 69, 82, '\0'}
|
||||||
|
#define PNG_tEXt const png_byte png_tEXt[5] = {116, 69, 88, 116, '\0'}
|
||||||
|
#define PNG_tIME const png_byte png_tIME[5] = {116, 73, 77, 69, '\0'}
|
||||||
|
#define PNG_tRNS const png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'}
|
||||||
|
#define PNG_zTXt const png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'}
|
||||||
|
|
||||||
|
#ifdef PNG_USE_GLOBAL_ARRAYS
|
||||||
|
PNG_EXPORT_VAR (const png_byte FARDATA) png_IHDR[5];
|
||||||
|
PNG_EXPORT_VAR (const png_byte FARDATA) png_IDAT[5];
|
||||||
|
PNG_EXPORT_VAR (const png_byte FARDATA) png_IEND[5];
|
||||||
|
PNG_EXPORT_VAR (const png_byte FARDATA) png_PLTE[5];
|
||||||
|
PNG_EXPORT_VAR (const png_byte FARDATA) png_bKGD[5];
|
||||||
|
PNG_EXPORT_VAR (const png_byte FARDATA) png_cHRM[5];
|
||||||
|
PNG_EXPORT_VAR (const png_byte FARDATA) png_gAMA[5];
|
||||||
|
PNG_EXPORT_VAR (const png_byte FARDATA) png_hIST[5];
|
||||||
|
PNG_EXPORT_VAR (const png_byte FARDATA) png_iCCP[5];
|
||||||
|
PNG_EXPORT_VAR (const png_byte FARDATA) png_iTXt[5];
|
||||||
|
PNG_EXPORT_VAR (const png_byte FARDATA) png_oFFs[5];
|
||||||
|
PNG_EXPORT_VAR (const png_byte FARDATA) png_pCAL[5];
|
||||||
|
PNG_EXPORT_VAR (const png_byte FARDATA) png_sCAL[5];
|
||||||
|
PNG_EXPORT_VAR (const png_byte FARDATA) png_pHYs[5];
|
||||||
|
PNG_EXPORT_VAR (const png_byte FARDATA) png_sBIT[5];
|
||||||
|
PNG_EXPORT_VAR (const png_byte FARDATA) png_sPLT[5];
|
||||||
|
PNG_EXPORT_VAR (const png_byte FARDATA) png_sRGB[5];
|
||||||
|
PNG_EXPORT_VAR (const png_byte FARDATA) png_tEXt[5];
|
||||||
|
PNG_EXPORT_VAR (const png_byte FARDATA) png_tIME[5];
|
||||||
|
PNG_EXPORT_VAR (const png_byte FARDATA) png_tRNS[5];
|
||||||
|
PNG_EXPORT_VAR (const png_byte FARDATA) png_zTXt[5];
|
||||||
|
#endif /* PNG_USE_GLOBAL_ARRAYS */
|
||||||
|
|
||||||
|
/* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern PNG_EXPORT(void,png_read_init_3) PNGARG((png_structpp ptr_ptr,
|
||||||
|
png_const_charp user_png_ver, png_size_t png_struct_size));
|
||||||
|
extern PNG_EXPORT(void,png_write_init_3) PNGARG((png_structpp ptr_ptr,
|
||||||
|
png_const_charp user_png_ver, png_size_t png_struct_size));
|
||||||
|
extern PNG_EXPORT(void,png_write_init_2) PNGARG((png_structp png_ptr,
|
||||||
|
png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t
|
||||||
|
png_info_size));
|
||||||
|
|
||||||
|
/* 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));
|
||||||
|
|
||||||
|
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
||||||
|
#if !defined(PNG_NO_STDIO)
|
||||||
|
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 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));
|
||||||
|
|
||||||
|
#if defined(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));
|
||||||
|
|
||||||
|
#if defined(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
|
||||||
|
|
||||||
|
#if defined(PNG_WRITE_sBIT_SUPPORTED)
|
||||||
|
PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit,
|
||||||
|
int color_type));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(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
|
||||||
|
|
||||||
|
#if defined(PNG_WRITE_sRGB_SUPPORTED)
|
||||||
|
PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr,
|
||||||
|
int intent));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(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
|
||||||
|
|
||||||
|
#if defined(PNG_WRITE_sPLT_SUPPORTED)
|
||||||
|
PNG_EXTERN void png_write_sPLT PNGARG((png_structp png_ptr,
|
||||||
|
png_sPLT_tp palette));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(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
|
||||||
|
|
||||||
|
#if defined(PNG_WRITE_bKGD_SUPPORTED)
|
||||||
|
PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr,
|
||||||
|
png_color_16p values, int color_type));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(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
|
||||||
|
|
||||||
|
#if defined(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
|
||||||
|
|
||||||
|
#if defined(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
|
||||||
|
|
||||||
|
#if defined(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
|
||||||
|
|
||||||
|
#if defined(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
|
||||||
|
|
||||||
|
#if defined(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
|
||||||
|
|
||||||
|
#if defined(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
|
||||||
|
|
||||||
|
#if defined(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
|
||||||
|
|
||||||
|
#if defined(PNG_WRITE_tIME_SUPPORTED)
|
||||||
|
PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr,
|
||||||
|
png_timep mod_time));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_WRITE_sCAL_SUPPORTED)
|
||||||
|
#if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO)
|
||||||
|
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));
|
||||||
|
|
||||||
|
#if defined(PNG_READ_GAMMA_SUPPORTED)
|
||||||
|
PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr));
|
||||||
|
#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));
|
||||||
|
|
||||||
|
#if defined(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 */
|
||||||
|
|
||||||
|
#if defined(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 */
|
||||||
|
#if defined(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
|
||||||
|
|
||||||
|
#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED)
|
||||||
|
PNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info,
|
||||||
|
png_bytep row));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
|
||||||
|
PNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info,
|
||||||
|
png_bytep row));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED)
|
||||||
|
PNG_EXTERN void png_do_read_invert_alpha PNGARG((png_row_infop row_info,
|
||||||
|
png_bytep row));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(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_READ_PREMULTIPLY_ALPHA_SUPPORTED)
|
||||||
|
PNG_EXTERN void png_do_read_premultiply_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
|
||||||
|
|
||||||
|
#if defined(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
|
||||||
|
|
||||||
|
#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
|
||||||
|
PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info,
|
||||||
|
png_bytep row));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_READ_PACK_SUPPORTED)
|
||||||
|
PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info, png_bytep row));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(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
|
||||||
|
|
||||||
|
#if defined(PNG_READ_16_TO_8_SUPPORTED)
|
||||||
|
PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, png_bytep row));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_READ_DITHER_SUPPORTED)
|
||||||
|
PNG_EXTERN void png_do_dither PNGARG((png_row_infop row_info,
|
||||||
|
png_bytep row, png_bytep palette_lookup, png_bytep dither_lookup));
|
||||||
|
|
||||||
|
# if defined(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
|
||||||
|
|
||||||
|
#if defined(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
|
||||||
|
|
||||||
|
#if defined(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
|
||||||
|
|
||||||
|
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||||
|
#if defined(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
|
||||||
|
|
||||||
|
#if defined(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
|
||||||
|
|
||||||
|
#if defined(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));
|
||||||
|
|
||||||
|
#if defined(PNG_READ_bKGD_SUPPORTED)
|
||||||
|
PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr,
|
||||||
|
png_uint_32 length));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_READ_cHRM_SUPPORTED)
|
||||||
|
PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr,
|
||||||
|
png_uint_32 length));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_READ_gAMA_SUPPORTED)
|
||||||
|
PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr,
|
||||||
|
png_uint_32 length));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_READ_hIST_SUPPORTED)
|
||||||
|
PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr,
|
||||||
|
png_uint_32 length));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_READ_iCCP_SUPPORTED)
|
||||||
|
extern void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr,
|
||||||
|
png_uint_32 length));
|
||||||
|
#endif /* PNG_READ_iCCP_SUPPORTED */
|
||||||
|
|
||||||
|
#if defined(PNG_READ_iTXt_SUPPORTED)
|
||||||
|
PNG_EXTERN void png_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
|
||||||
|
png_uint_32 length));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_READ_oFFs_SUPPORTED)
|
||||||
|
PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr,
|
||||||
|
png_uint_32 length));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_READ_pCAL_SUPPORTED)
|
||||||
|
PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
|
||||||
|
png_uint_32 length));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_READ_pHYs_SUPPORTED)
|
||||||
|
PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr,
|
||||||
|
png_uint_32 length));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_READ_sBIT_SUPPORTED)
|
||||||
|
PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr,
|
||||||
|
png_uint_32 length));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_READ_sCAL_SUPPORTED)
|
||||||
|
PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
|
||||||
|
png_uint_32 length));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_READ_sPLT_SUPPORTED)
|
||||||
|
extern void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr,
|
||||||
|
png_uint_32 length));
|
||||||
|
#endif /* PNG_READ_sPLT_SUPPORTED */
|
||||||
|
|
||||||
|
#if defined(PNG_READ_sRGB_SUPPORTED)
|
||||||
|
PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr,
|
||||||
|
png_uint_32 length));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_READ_tEXt_SUPPORTED)
|
||||||
|
PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr,
|
||||||
|
png_uint_32 length));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_READ_tIME_SUPPORTED)
|
||||||
|
PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr,
|
||||||
|
png_uint_32 length));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_READ_tRNS_SUPPORTED)
|
||||||
|
PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr,
|
||||||
|
png_uint_32 length));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(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));
|
||||||
|
#if defined(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
|
||||||
|
#if defined(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
|
||||||
|
#if defined(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
|
||||||
|
|
||||||
|
#if defined(PNG_MMX_CODE_SUPPORTED)
|
||||||
|
/* PRIVATE */
|
||||||
|
PNG_EXTERN void png_init_mmx_flags PNGARG((png_structp png_ptr));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Added at libpng version 1.4.0 */
|
||||||
|
#if defined(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
|
||||||
|
|
||||||
|
/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
|
||||||
|
|
||||||
|
#ifdef PNG_READ_SUPPORTED
|
||||||
|
/* Prior to libpng-1.0.9, this block was in pngasmrd.h */
|
||||||
|
|
||||||
|
/* These are the default thresholds before the MMX code kicks in; if either
|
||||||
|
* rowbytes or bitdepth is below the threshold, plain C code is used. These
|
||||||
|
* can be overridden at runtime via the png_set_mmx_thresholds() call in
|
||||||
|
* libpng 1.2.0 and later. The values below were chosen by Intel.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT
|
||||||
|
# define PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT 128 /* >= */
|
||||||
|
#endif
|
||||||
|
#ifndef PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT
|
||||||
|
# define PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT 9 /* >= */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Set this in the makefile for VC++ on Pentium, not here. */
|
||||||
|
/* Platform must be Pentium. Makefile must assemble and load pngvcrd.c .
|
||||||
|
* MMX will be detected at run time and used if present.
|
||||||
|
*/
|
||||||
|
#ifdef PNG_USE_PNGVCRD
|
||||||
|
# define PNG_HAVE_MMX_COMBINE_ROW
|
||||||
|
# define PNG_HAVE_MMX_READ_INTERLACE
|
||||||
|
# define PNG_HAVE_MMX_READ_FILTER_ROW
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Set this in the makefile for gcc/as on Pentium, not here. */
|
||||||
|
/* Platform must be Pentium. Makefile must assemble and load pnggccrd.c .
|
||||||
|
* MMX will be detected at run time and used if present.
|
||||||
|
*/
|
||||||
|
#ifdef PNG_USE_PNGGCCRD
|
||||||
|
# define PNG_HAVE_MMX_COMBINE_ROW
|
||||||
|
# define PNG_HAVE_MMX_READ_INTERLACE
|
||||||
|
# define PNG_HAVE_MMX_READ_FILTER_ROW
|
||||||
|
#endif
|
||||||
|
/* - see pnggccrd.c for info about what is currently enabled */
|
||||||
|
|
||||||
|
#endif /* PNG_READ_SUPPORTED */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* PNG_VERSION_INFO_ONLY */
|
||||||
|
#endif /* PNGPRIV_H */
|
||||||
42
pngrio.c
42
pngrio.c
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
/* 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.0 [February 28, 2009]
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2009 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.)
|
||||||
*
|
*
|
||||||
@@ -15,10 +15,9 @@
|
|||||||
* 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
|
|
||||||
#include "png.h"
|
#include "png.h"
|
||||||
|
|
||||||
#if defined(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
|
||||||
@@ -28,7 +27,7 @@
|
|||||||
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
|
||||||
@@ -46,16 +45,11 @@ 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");
|
||||||
@@ -72,21 +66,17 @@ 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 +87,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;
|
||||||
@@ -131,11 +116,14 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
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)
|
#if !defined(PNG_NO_STDIO)
|
||||||
@@ -154,7 +142,7 @@ 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)
|
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
||||||
|
|||||||
791
pngrtran.c
791
pngrtran.c
File diff suppressed because it is too large
Load Diff
967
pngrutil.c
967
pngrutil.c
File diff suppressed because it is too large
Load Diff
BIN
pngtest.png
BIN
pngtest.png
Binary file not shown.
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
76
pngtrans.c
76
pngtrans.c
@@ -1,23 +1,24 @@
|
|||||||
|
|
||||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.2.9 April 14, 2006
|
* Last changed in libpng 1.4.0 [February 28, 2009]
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2009 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.)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
|
||||||
#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"
|
||||||
|
|
||||||
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
|
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
|
||||||
/* turn on BGR-to-RGB mapping */
|
/* turn on BGR-to-RGB mapping */
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_bgr(png_structp png_ptr)
|
png_set_bgr(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_bgr\n");
|
png_debug(1, "in png_set_bgr");
|
||||||
|
if (png_ptr == NULL) return;
|
||||||
png_ptr->transformations |= PNG_BGR;
|
png_ptr->transformations |= PNG_BGR;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -27,7 +28,8 @@ png_set_bgr(png_structp png_ptr)
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_swap(png_structp png_ptr)
|
png_set_swap(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_swap\n");
|
png_debug(1, "in png_set_swap");
|
||||||
|
if (png_ptr == NULL) return;
|
||||||
if (png_ptr->bit_depth == 16)
|
if (png_ptr->bit_depth == 16)
|
||||||
png_ptr->transformations |= PNG_SWAP_BYTES;
|
png_ptr->transformations |= PNG_SWAP_BYTES;
|
||||||
}
|
}
|
||||||
@@ -38,7 +40,8 @@ png_set_swap(png_structp png_ptr)
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_packing(png_structp png_ptr)
|
png_set_packing(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_packing\n");
|
png_debug(1, "in png_set_packing");
|
||||||
|
if (png_ptr == NULL) return;
|
||||||
if (png_ptr->bit_depth < 8)
|
if (png_ptr->bit_depth < 8)
|
||||||
{
|
{
|
||||||
png_ptr->transformations |= PNG_PACK;
|
png_ptr->transformations |= PNG_PACK;
|
||||||
@@ -52,7 +55,8 @@ png_set_packing(png_structp png_ptr)
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_packswap(png_structp png_ptr)
|
png_set_packswap(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_packswap\n");
|
png_debug(1, "in png_set_packswap");
|
||||||
|
if (png_ptr == NULL) return;
|
||||||
if (png_ptr->bit_depth < 8)
|
if (png_ptr->bit_depth < 8)
|
||||||
png_ptr->transformations |= PNG_PACKSWAP;
|
png_ptr->transformations |= PNG_PACKSWAP;
|
||||||
}
|
}
|
||||||
@@ -62,7 +66,8 @@ png_set_packswap(png_structp png_ptr)
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_shift(png_structp png_ptr, png_color_8p true_bits)
|
png_set_shift(png_structp png_ptr, png_color_8p true_bits)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_shift\n");
|
png_debug(1, "in png_set_shift");
|
||||||
|
if (png_ptr == NULL) return;
|
||||||
png_ptr->transformations |= PNG_SHIFT;
|
png_ptr->transformations |= PNG_SHIFT;
|
||||||
png_ptr->shift = *true_bits;
|
png_ptr->shift = *true_bits;
|
||||||
}
|
}
|
||||||
@@ -73,8 +78,8 @@ png_set_shift(png_structp png_ptr, png_color_8p true_bits)
|
|||||||
int PNGAPI
|
int PNGAPI
|
||||||
png_set_interlace_handling(png_structp png_ptr)
|
png_set_interlace_handling(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_interlace handling\n");
|
png_debug(1, "in png_set_interlace handling");
|
||||||
if (png_ptr->interlaced)
|
if (png_ptr && png_ptr->interlaced)
|
||||||
{
|
{
|
||||||
png_ptr->transformations |= PNG_INTERLACE;
|
png_ptr->transformations |= PNG_INTERLACE;
|
||||||
return (7);
|
return (7);
|
||||||
@@ -93,7 +98,8 @@ png_set_interlace_handling(png_structp png_ptr)
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_filler\n");
|
png_debug(1, "in png_set_filler");
|
||||||
|
if (png_ptr == NULL) return;
|
||||||
png_ptr->transformations |= PNG_FILLER;
|
png_ptr->transformations |= PNG_FILLER;
|
||||||
png_ptr->filler = (png_byte)filler;
|
png_ptr->filler = (png_byte)filler;
|
||||||
if (filler_loc == PNG_FILLER_AFTER)
|
if (filler_loc == PNG_FILLER_AFTER)
|
||||||
@@ -125,7 +131,8 @@ png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_add_alpha\n");
|
png_debug(1, "in png_set_add_alpha");
|
||||||
|
if (png_ptr == NULL) return;
|
||||||
png_set_filler(png_ptr, filler, filler_loc);
|
png_set_filler(png_ptr, filler, filler_loc);
|
||||||
png_ptr->transformations |= PNG_ADD_ALPHA;
|
png_ptr->transformations |= PNG_ADD_ALPHA;
|
||||||
}
|
}
|
||||||
@@ -138,7 +145,8 @@ png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_swap_alpha(png_structp png_ptr)
|
png_set_swap_alpha(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_swap_alpha\n");
|
png_debug(1, "in png_set_swap_alpha");
|
||||||
|
if (png_ptr == NULL) return;
|
||||||
png_ptr->transformations |= PNG_SWAP_ALPHA;
|
png_ptr->transformations |= PNG_SWAP_ALPHA;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -148,7 +156,8 @@ png_set_swap_alpha(png_structp png_ptr)
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_invert_alpha(png_structp png_ptr)
|
png_set_invert_alpha(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_invert_alpha\n");
|
png_debug(1, "in png_set_invert_alpha");
|
||||||
|
if (png_ptr == NULL) return;
|
||||||
png_ptr->transformations |= PNG_INVERT_ALPHA;
|
png_ptr->transformations |= PNG_INVERT_ALPHA;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -157,7 +166,8 @@ png_set_invert_alpha(png_structp png_ptr)
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_invert_mono(png_structp png_ptr)
|
png_set_invert_mono(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_invert_mono\n");
|
png_debug(1, "in png_set_invert_mono");
|
||||||
|
if (png_ptr == NULL) return;
|
||||||
png_ptr->transformations |= PNG_INVERT_MONO;
|
png_ptr->transformations |= PNG_INVERT_MONO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,14 +175,10 @@ png_set_invert_mono(png_structp png_ptr)
|
|||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_do_invert(png_row_infop row_info, png_bytep row)
|
png_do_invert(png_row_infop row_info, png_bytep row)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_invert\n");
|
png_debug(1, "in png_do_invert");
|
||||||
/* This test removed from libpng version 1.0.13 and 1.2.0:
|
/* This test removed from libpng version 1.0.13 and 1.2.0:
|
||||||
* if (row_info->bit_depth == 1 &&
|
* if (row_info->bit_depth == 1 &&
|
||||||
*/
|
*/
|
||||||
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
|
||||||
if (row == NULL || row_info == NULL)
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
if (row_info->color_type == PNG_COLOR_TYPE_GRAY)
|
if (row_info->color_type == PNG_COLOR_TYPE_GRAY)
|
||||||
{
|
{
|
||||||
png_bytep rp = row;
|
png_bytep rp = row;
|
||||||
@@ -220,11 +226,8 @@ png_do_invert(png_row_infop row_info, png_bytep row)
|
|||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_do_swap(png_row_infop row_info, png_bytep row)
|
png_do_swap(png_row_infop row_info, png_bytep row)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_swap\n");
|
png_debug(1, "in png_do_swap");
|
||||||
if (
|
if (
|
||||||
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
|
||||||
row != NULL && row_info != NULL &&
|
|
||||||
#endif
|
|
||||||
row_info->bit_depth == 16)
|
row_info->bit_depth == 16)
|
||||||
{
|
{
|
||||||
png_bytep rp = row;
|
png_bytep rp = row;
|
||||||
@@ -351,11 +354,8 @@ static PNG_CONST png_byte fourbppswaptable[256] = {
|
|||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_do_packswap(png_row_infop row_info, png_bytep row)
|
png_do_packswap(png_row_infop row_info, png_bytep row)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_packswap\n");
|
png_debug(1, "in png_do_packswap");
|
||||||
if (
|
if (
|
||||||
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
|
||||||
row != NULL && row_info != NULL &&
|
|
||||||
#endif
|
|
||||||
row_info->bit_depth < 8)
|
row_info->bit_depth < 8)
|
||||||
{
|
{
|
||||||
png_bytep rp, end, table;
|
png_bytep rp, end, table;
|
||||||
@@ -383,10 +383,7 @@ png_do_packswap(png_row_infop row_info, png_bytep row)
|
|||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_strip_filler\n");
|
png_debug(1, "in png_do_strip_filler");
|
||||||
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
|
||||||
if (row != NULL && row_info != NULL)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
png_bytep sp=row;
|
png_bytep sp=row;
|
||||||
png_bytep dp=row;
|
png_bytep dp=row;
|
||||||
@@ -541,11 +538,8 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
|||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_do_bgr(png_row_infop row_info, png_bytep row)
|
png_do_bgr(png_row_infop row_info, png_bytep row)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_bgr\n");
|
png_debug(1, "in png_do_bgr");
|
||||||
if (
|
if (
|
||||||
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
|
||||||
row != NULL && row_info != NULL &&
|
|
||||||
#endif
|
|
||||||
(row_info->color_type & PNG_COLOR_MASK_COLOR))
|
(row_info->color_type & PNG_COLOR_MASK_COLOR))
|
||||||
{
|
{
|
||||||
png_uint_32 row_width = row_info->width;
|
png_uint_32 row_width = row_info->width;
|
||||||
@@ -620,13 +614,14 @@ void PNGAPI
|
|||||||
png_set_user_transform_info(png_structp png_ptr, png_voidp
|
png_set_user_transform_info(png_structp png_ptr, png_voidp
|
||||||
user_transform_ptr, int user_transform_depth, int user_transform_channels)
|
user_transform_ptr, int user_transform_depth, int user_transform_channels)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_user_transform_info\n");
|
png_debug(1, "in png_set_user_transform_info");
|
||||||
|
if (png_ptr == NULL) return;
|
||||||
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
||||||
png_ptr->user_transform_ptr = user_transform_ptr;
|
png_ptr->user_transform_ptr = user_transform_ptr;
|
||||||
png_ptr->user_transform_depth = (png_byte)user_transform_depth;
|
png_ptr->user_transform_depth = (png_byte)user_transform_depth;
|
||||||
png_ptr->user_transform_channels = (png_byte)user_transform_channels;
|
png_ptr->user_transform_channels = (png_byte)user_transform_channels;
|
||||||
#else
|
#else
|
||||||
if(user_transform_ptr || user_transform_depth || user_transform_channels)
|
if (user_transform_ptr || user_transform_depth || user_transform_channels)
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"This version of libpng does not support user transform info");
|
"This version of libpng does not support user transform info");
|
||||||
#endif
|
#endif
|
||||||
@@ -641,11 +636,10 @@ png_set_user_transform_info(png_structp png_ptr, png_voidp
|
|||||||
png_voidp PNGAPI
|
png_voidp PNGAPI
|
||||||
png_get_user_transform_ptr(png_structp png_ptr)
|
png_get_user_transform_ptr(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
|
if (png_ptr == NULL) return (NULL);
|
||||||
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
||||||
return ((png_voidp)png_ptr->user_transform_ptr);
|
return ((png_voidp)png_ptr->user_transform_ptr);
|
||||||
#else
|
#else
|
||||||
if(png_ptr)
|
|
||||||
return (NULL);
|
|
||||||
return (NULL);
|
return (NULL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
54
pngwio.c
54
pngwio.c
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
/* pngwio.c - functions for data output
|
/* pngwio.c - functions for data output
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.2.3 - May 21, 2002
|
* Last changed in libpng 1.4.0 [February 28, 2009]
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2002 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2009 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.)
|
||||||
*
|
*
|
||||||
@@ -15,9 +15,9 @@
|
|||||||
* them at run time with png_set_write_fn(...).
|
* them at run time with png_set_write_fn(...).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
|
||||||
#include "png.h"
|
#include "png.h"
|
||||||
#ifdef PNG_WRITE_SUPPORTED
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
|
#include "pngpriv.h"
|
||||||
|
|
||||||
/* Write the data to whatever output you are using. The default routine
|
/* Write the data to whatever output you are using. The default routine
|
||||||
writes to a file pointer. Note that this routine sometimes gets called
|
writes to a file pointer. Note that this routine sometimes gets called
|
||||||
@@ -45,12 +45,8 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
{
|
{
|
||||||
png_uint_32 check;
|
png_uint_32 check;
|
||||||
|
|
||||||
#if defined(_WIN32_WCE)
|
if (png_ptr == NULL) return;
|
||||||
if ( !WriteFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
|
|
||||||
check = 0;
|
|
||||||
#else
|
|
||||||
check = fwrite(data, 1, length, (png_FILE_p)(png_ptr->io_ptr));
|
check = fwrite(data, 1, length, (png_FILE_p)(png_ptr->io_ptr));
|
||||||
#endif
|
|
||||||
if (check != length)
|
if (check != length)
|
||||||
png_error(png_ptr, "Write Error");
|
png_error(png_ptr, "Write Error");
|
||||||
}
|
}
|
||||||
@@ -70,17 +66,13 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
png_byte *near_data; /* Needs to be "png_byte *" instead of "png_bytep" */
|
png_byte *near_data; /* Needs to be "png_byte *" instead of "png_bytep" */
|
||||||
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. */
|
||||||
near_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
near_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)near_data == data)
|
if ((png_bytep)near_data == data)
|
||||||
{
|
{
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
if ( !WriteFile(io_ptr, near_data, length, &check, NULL) )
|
|
||||||
check = 0;
|
|
||||||
#else
|
|
||||||
check = fwrite(near_data, 1, length, io_ptr);
|
check = fwrite(near_data, 1, length, io_ptr);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -92,12 +84,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
{
|
{
|
||||||
written = MIN(NEAR_BUF_SIZE, remaining);
|
written = MIN(NEAR_BUF_SIZE, remaining);
|
||||||
png_memcpy(buf, data, written); /* copy far buffer to near buffer */
|
png_memcpy(buf, data, written); /* copy far buffer to near buffer */
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
if ( !WriteFile(io_ptr, buf, written, &err, NULL) )
|
|
||||||
err = 0;
|
|
||||||
#else
|
|
||||||
err = fwrite(buf, 1, written, io_ptr);
|
err = fwrite(buf, 1, written, io_ptr);
|
||||||
#endif
|
|
||||||
if (err != written)
|
if (err != written)
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
@@ -129,12 +116,11 @@ png_flush(png_structp png_ptr)
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_default_flush(png_structp png_ptr)
|
png_default_flush(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
#if !defined(_WIN32_WCE)
|
|
||||||
png_FILE_p io_ptr;
|
png_FILE_p io_ptr;
|
||||||
|
if (png_ptr == NULL) return;
|
||||||
io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
|
io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
|
||||||
if (io_ptr != NULL)
|
if (io_ptr != NULL && png_fileno(io_ptr) != -1)
|
||||||
fflush(io_ptr);
|
fflush(io_ptr);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -151,7 +137,9 @@ png_default_flush(png_structp png_ptr)
|
|||||||
data to be written, and a 32-bit unsigned int that is
|
data to be written, and a 32-bit unsigned int that is
|
||||||
the number of bytes to be written. The new write
|
the number of bytes to be written. The new write
|
||||||
function should call png_error(png_ptr, "Error msg")
|
function should call png_error(png_ptr, "Error msg")
|
||||||
to exit and output any fatal error messages.
|
to exit and output any fatal error messages. May be
|
||||||
|
NULL, in which case libpng's default function will
|
||||||
|
be used.
|
||||||
flush_data_fn - pointer to a new flush function that takes as its
|
flush_data_fn - pointer to a new flush function that takes as its
|
||||||
arguments a pointer to a png_struct. After a call to
|
arguments a pointer to a png_struct. After a call to
|
||||||
the flush function, there should be no data in any buffers
|
the flush function, there should be no data in any buffers
|
||||||
@@ -160,11 +148,13 @@ png_default_flush(png_structp png_ptr)
|
|||||||
supplied although it doesn't have to do anything. If
|
supplied although it doesn't have to do anything. If
|
||||||
PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile
|
PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile
|
||||||
time, output_flush_fn will be ignored, although it must be
|
time, output_flush_fn will be ignored, although it must be
|
||||||
supplied for compatibility. */
|
supplied for compatibility. May be NULL, in which case
|
||||||
|
libpng's default function will be used. */
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
|
png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
|
||||||
png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)
|
png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)
|
||||||
{
|
{
|
||||||
|
if (png_ptr == NULL) return;
|
||||||
png_ptr->io_ptr = io_ptr;
|
png_ptr->io_ptr = io_ptr;
|
||||||
|
|
||||||
#if !defined(PNG_NO_STDIO)
|
#if !defined(PNG_NO_STDIO)
|
||||||
@@ -194,33 +184,33 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
|
|||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"Attempted to set both read_data_fn and write_data_fn in");
|
"Attempted to set both read_data_fn and write_data_fn in");
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"the same structure. Resetting read_data_fn to NULL.");
|
"the same structure. Resetting read_data_fn to NULL");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(USE_FAR_KEYWORD)
|
#if defined(USE_FAR_KEYWORD)
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
void *png_far_to_near(png_structp png_ptr,png_voidp ptr, int check)
|
void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check)
|
||||||
{
|
{
|
||||||
void *near_ptr;
|
void *near_ptr;
|
||||||
void FAR *far_ptr;
|
void FAR *far_ptr;
|
||||||
FP_OFF(near_ptr) = FP_OFF(ptr);
|
FP_OFF(near_ptr) = FP_OFF(ptr);
|
||||||
far_ptr = (void FAR *)near_ptr;
|
far_ptr = (void FAR *)near_ptr;
|
||||||
if(check != 0)
|
if (check != 0)
|
||||||
if(FP_SEG(ptr) != FP_SEG(far_ptr))
|
if (FP_SEG(ptr) != FP_SEG(far_ptr))
|
||||||
png_error(png_ptr,"segment lost in conversion");
|
png_error(png_ptr, "segment lost in conversion");
|
||||||
return(near_ptr);
|
return(near_ptr);
|
||||||
}
|
}
|
||||||
# else
|
# else
|
||||||
void *png_far_to_near(png_structp png_ptr,png_voidp ptr, int check)
|
void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check)
|
||||||
{
|
{
|
||||||
void *near_ptr;
|
void *near_ptr;
|
||||||
void FAR *far_ptr;
|
void FAR *far_ptr;
|
||||||
near_ptr = (void FAR *)ptr;
|
near_ptr = (void FAR *)ptr;
|
||||||
far_ptr = (void FAR *)near_ptr;
|
far_ptr = (void FAR *)near_ptr;
|
||||||
if(check != 0)
|
if (check != 0)
|
||||||
if(far_ptr != ptr)
|
if (far_ptr != ptr)
|
||||||
png_error(png_ptr,"segment lost in conversion");
|
png_error(png_ptr, "segment lost in conversion");
|
||||||
return(near_ptr);
|
return(near_ptr);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|||||||
298
pngwrite.c
298
pngwrite.c
@@ -1,17 +1,17 @@
|
|||||||
|
|
||||||
/* pngwrite.c - general routines to write a PNG file
|
/* pngwrite.c - general routines to write a PNG file
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.2.9 April 14, 2006
|
* Last changed in libpng 1.4.0 [February 28, 2009]
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2009 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.)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* get internal access to png.h */
|
/* get internal access to png.h */
|
||||||
#define PNG_INTERNAL
|
|
||||||
#include "png.h"
|
#include "png.h"
|
||||||
#ifdef PNG_WRITE_SUPPORTED
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
|
#include "pngpriv.h"
|
||||||
|
|
||||||
/* Writes all the PNG information. This is the suggested way to use the
|
/* Writes all the PNG information. This is the suggested way to use the
|
||||||
* library. If you have a new chunk to add, make a function to write it,
|
* library. If you have a new chunk to add, make a function to write it,
|
||||||
@@ -25,16 +25,16 @@
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
|
png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_write_info_before_PLTE\n");
|
png_debug(1, "in png_write_info_before_PLTE");
|
||||||
if (png_ptr == NULL || info_ptr == NULL)
|
if (png_ptr == NULL || info_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
if (!(png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE))
|
if (!(png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE))
|
||||||
{
|
{
|
||||||
png_write_sig(png_ptr); /* write PNG signature */
|
png_write_sig(png_ptr); /* write PNG signature */
|
||||||
#if defined(PNG_MNG_FEATURES_SUPPORTED)
|
#if defined(PNG_MNG_FEATURES_SUPPORTED)
|
||||||
if((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE)&&(png_ptr->mng_features_permitted))
|
if ((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE)&&(png_ptr->mng_features_permitted))
|
||||||
{
|
{
|
||||||
png_warning(png_ptr,"MNG features are not allowed in a PNG datastream");
|
png_warning(png_ptr, "MNG features are not allowed in a PNG datastream");
|
||||||
png_ptr->mng_features_permitted=0;
|
png_ptr->mng_features_permitted=0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -99,7 +99,7 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
|
|||||||
{
|
{
|
||||||
png_unknown_chunk *up;
|
png_unknown_chunk *up;
|
||||||
|
|
||||||
png_debug(5, "writing extra chunks\n");
|
png_debug(5, "writing extra chunks");
|
||||||
|
|
||||||
for (up = info_ptr->unknown_chunks;
|
for (up = info_ptr->unknown_chunks;
|
||||||
up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num;
|
up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num;
|
||||||
@@ -112,6 +112,8 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
|
|||||||
((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS ||
|
((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS ||
|
||||||
(png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS)))
|
(png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS)))
|
||||||
{
|
{
|
||||||
|
if (up->size == 0)
|
||||||
|
png_warning(png_ptr, "Writing zero-length unknown chunk");
|
||||||
png_write_chunk(png_ptr, up->name, up->data, up->size);
|
png_write_chunk(png_ptr, up->name, up->data, up->size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -128,7 +130,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
|
|||||||
int i;
|
int i;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
png_debug(1, "in png_write_info\n");
|
png_debug(1, "in png_write_info");
|
||||||
|
|
||||||
if (png_ptr == NULL || info_ptr == NULL)
|
if (png_ptr == NULL || info_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
@@ -154,7 +156,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
|
|||||||
info_ptr->trans[j] = (png_byte)(255 - info_ptr->trans[j]);
|
info_ptr->trans[j] = (png_byte)(255 - info_ptr->trans[j]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
png_write_tRNS(png_ptr, info_ptr->trans, &(info_ptr->trans_values),
|
png_write_tRNS(png_ptr, info_ptr->trans, &(info_ptr->trans_color),
|
||||||
info_ptr->num_trans, info_ptr->color_type);
|
info_ptr->num_trans, info_ptr->color_type);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -188,7 +190,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
|
|||||||
info_ptr->scal_s_width, info_ptr->scal_s_height);
|
info_ptr->scal_s_width, info_ptr->scal_s_height);
|
||||||
#else
|
#else
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"png_write_sCAL not supported; sCAL chunk not written.");
|
"png_write_sCAL not supported; sCAL chunk not written");
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -213,7 +215,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
|
|||||||
/* Check to see if we need to write text chunks */
|
/* Check to see if we need to write text chunks */
|
||||||
for (i = 0; i < info_ptr->num_text; i++)
|
for (i = 0; i < info_ptr->num_text; i++)
|
||||||
{
|
{
|
||||||
png_debug2(2, "Writing header text chunk %d, type %d\n", i,
|
png_debug2(2, "Writing header text chunk %d, type %d", i,
|
||||||
info_ptr->text[i].compression);
|
info_ptr->text[i].compression);
|
||||||
/* an internationalized chunk? */
|
/* an internationalized chunk? */
|
||||||
if (info_ptr->text[i].compression > 0)
|
if (info_ptr->text[i].compression > 0)
|
||||||
@@ -266,7 +268,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
|
|||||||
{
|
{
|
||||||
png_unknown_chunk *up;
|
png_unknown_chunk *up;
|
||||||
|
|
||||||
png_debug(5, "writing extra chunks\n");
|
png_debug(5, "writing extra chunks");
|
||||||
|
|
||||||
for (up = info_ptr->unknown_chunks;
|
for (up = info_ptr->unknown_chunks;
|
||||||
up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num;
|
up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num;
|
||||||
@@ -294,7 +296,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_write_end(png_structp png_ptr, png_infop info_ptr)
|
png_write_end(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_write_end\n");
|
png_debug(1, "in png_write_end");
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
if (!(png_ptr->mode & PNG_HAVE_IDAT))
|
if (!(png_ptr->mode & PNG_HAVE_IDAT))
|
||||||
@@ -316,7 +318,7 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
|
|||||||
/* loop through comment chunks */
|
/* loop through comment chunks */
|
||||||
for (i = 0; i < info_ptr->num_text; i++)
|
for (i = 0; i < info_ptr->num_text; i++)
|
||||||
{
|
{
|
||||||
png_debug2(2, "Writing trailer text chunk %d, type %d\n", i,
|
png_debug2(2, "Writing trailer text chunk %d, type %d", i,
|
||||||
info_ptr->text[i].compression);
|
info_ptr->text[i].compression);
|
||||||
/* an internationalized chunk? */
|
/* an internationalized chunk? */
|
||||||
if (info_ptr->text[i].compression > 0)
|
if (info_ptr->text[i].compression > 0)
|
||||||
@@ -368,7 +370,7 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
|
|||||||
{
|
{
|
||||||
png_unknown_chunk *up;
|
png_unknown_chunk *up;
|
||||||
|
|
||||||
png_debug(5, "writing extra chunks\n");
|
png_debug(5, "writing extra chunks");
|
||||||
|
|
||||||
for (up = info_ptr->unknown_chunks;
|
for (up = info_ptr->unknown_chunks;
|
||||||
up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num;
|
up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num;
|
||||||
@@ -391,20 +393,23 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
|
|||||||
|
|
||||||
/* write end of PNG file */
|
/* write end of PNG file */
|
||||||
png_write_IEND(png_ptr);
|
png_write_IEND(png_ptr);
|
||||||
#if 0
|
/* This flush, added in libpng-1.0.8, removed from libpng-1.0.9beta03,
|
||||||
/* This flush, added in libpng-1.0.8, causes some applications to crash
|
* and restored again in libpng-1.2.30, may cause some applications that
|
||||||
because they do not set png_ptr->output_flush_fn */
|
* do not set png_ptr->output_flush_fn to crash. If your application
|
||||||
|
* experiences a problem, please report the event to
|
||||||
|
* png-mng-implement at lists.sf.net .
|
||||||
|
*/
|
||||||
|
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
||||||
png_flush(png_ptr);
|
png_flush(png_ptr);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PNG_WRITE_tIME_SUPPORTED)
|
#if defined(PNG_WRITE_tIME_SUPPORTED)
|
||||||
#if !defined(_WIN32_WCE)
|
|
||||||
/* "time.h" functions are not supported on WindowsCE */
|
/* "time.h" functions are not supported on WindowsCE */
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_convert_from_struct_tm(png_timep ptime, struct tm FAR * ttime)
|
png_convert_from_struct_tm(png_timep ptime, struct tm FAR * ttime)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_convert_from_struct_tm\n");
|
png_debug(1, "in png_convert_from_struct_tm");
|
||||||
ptime->year = (png_uint_16)(1900 + ttime->tm_year);
|
ptime->year = (png_uint_16)(1900 + ttime->tm_year);
|
||||||
ptime->month = (png_byte)(ttime->tm_mon + 1);
|
ptime->month = (png_byte)(ttime->tm_mon + 1);
|
||||||
ptime->day = (png_byte)ttime->tm_mday;
|
ptime->day = (png_byte)ttime->tm_mday;
|
||||||
@@ -418,12 +423,11 @@ png_convert_from_time_t(png_timep ptime, time_t ttime)
|
|||||||
{
|
{
|
||||||
struct tm *tbuf;
|
struct tm *tbuf;
|
||||||
|
|
||||||
png_debug(1, "in png_convert_from_time_t\n");
|
png_debug(1, "in png_convert_from_time_t");
|
||||||
tbuf = gmtime(&ttime);
|
tbuf = gmtime(&ttime);
|
||||||
png_convert_from_struct_tm(ptime, tbuf);
|
png_convert_from_struct_tm(ptime, tbuf);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Initialize png_ptr structure, and allocate any memory needed */
|
/* Initialize png_ptr structure, and allocate any memory needed */
|
||||||
png_structp PNGAPI
|
png_structp PNGAPI
|
||||||
@@ -432,7 +436,7 @@ png_create_write_struct(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||||||
{
|
{
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
return (png_create_write_struct_2(user_png_ver, error_ptr, error_fn,
|
return (png_create_write_struct_2(user_png_ver, error_ptr, error_fn,
|
||||||
warn_fn, png_voidp_NULL, png_malloc_ptr_NULL, png_free_ptr_NULL));
|
warn_fn, NULL, NULL, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Alternate initialize png_ptr structure, and allocate any memory needed */
|
/* Alternate initialize png_ptr structure, and allocate any memory needed */
|
||||||
@@ -442,14 +446,17 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||||||
png_malloc_ptr malloc_fn, png_free_ptr free_fn)
|
png_malloc_ptr malloc_fn, png_free_ptr free_fn)
|
||||||
{
|
{
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
png_structp png_ptr;
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
|
volatile
|
||||||
|
#endif
|
||||||
|
png_structp png_ptr;
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
#ifdef USE_FAR_KEYWORD
|
#ifdef USE_FAR_KEYWORD
|
||||||
jmp_buf jmpbuf;
|
jmp_buf jmpbuf;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
int i;
|
int i;
|
||||||
png_debug(1, "in png_create_write_struct\n");
|
png_debug(1, "in png_create_write_struct");
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG,
|
png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG,
|
||||||
(png_malloc_ptr)malloc_fn, (png_voidp)mem_ptr);
|
(png_malloc_ptr)malloc_fn, (png_voidp)mem_ptr);
|
||||||
@@ -459,12 +466,6 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
#if !defined(PNG_1_0_X)
|
|
||||||
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
|
|
||||||
png_init_mmx_flags(png_ptr); /* 1.2.0 addition */
|
|
||||||
#endif
|
|
||||||
#endif /* PNG_1_0_X */
|
|
||||||
|
|
||||||
/* added at libpng-1.2.6 */
|
/* added at libpng-1.2.6 */
|
||||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||||
png_ptr->user_width_max=PNG_USER_WIDTH_MAX;
|
png_ptr->user_width_max=PNG_USER_WIDTH_MAX;
|
||||||
@@ -479,12 +480,11 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
png_free(png_ptr, png_ptr->zbuf);
|
png_free(png_ptr, png_ptr->zbuf);
|
||||||
png_ptr->zbuf=NULL;
|
|
||||||
png_destroy_struct(png_ptr);
|
png_destroy_struct(png_ptr);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
#ifdef USE_FAR_KEYWORD
|
#ifdef USE_FAR_KEYWORD
|
||||||
png_memcpy(png_ptr->jmpbuf,jmpbuf,png_sizeof(jmp_buf));
|
png_memcpy(png_ptr->jmpbuf, jmpbuf, png_sizeof(jmp_buf));
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -493,12 +493,15 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn);
|
png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn);
|
||||||
|
|
||||||
i=0;
|
if (user_png_ver)
|
||||||
do
|
|
||||||
{
|
{
|
||||||
if(user_png_ver[i] != png_libpng_ver[i])
|
i=0;
|
||||||
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
|
do
|
||||||
} while (png_libpng_ver[i++]);
|
{
|
||||||
|
if (user_png_ver[i] != png_libpng_ver[i])
|
||||||
|
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
|
||||||
|
} while (png_libpng_ver[i++]);
|
||||||
|
}
|
||||||
|
|
||||||
if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH)
|
if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH)
|
||||||
{
|
{
|
||||||
@@ -515,11 +518,13 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||||||
char msg[80];
|
char msg[80];
|
||||||
if (user_png_ver)
|
if (user_png_ver)
|
||||||
{
|
{
|
||||||
sprintf(msg, "Application was compiled with png.h from libpng-%.20s",
|
png_snprintf(msg, 80,
|
||||||
|
"Application was compiled with png.h from libpng-%.20s",
|
||||||
user_png_ver);
|
user_png_ver);
|
||||||
png_warning(png_ptr, msg);
|
png_warning(png_ptr, msg);
|
||||||
}
|
}
|
||||||
sprintf(msg, "Application is running with png.c from libpng-%.20s",
|
png_snprintf(msg, 80,
|
||||||
|
"Application is running with png.c from libpng-%.20s",
|
||||||
png_libpng_ver);
|
png_libpng_ver);
|
||||||
png_warning(png_ptr, msg);
|
png_warning(png_ptr, msg);
|
||||||
#endif
|
#endif
|
||||||
@@ -536,12 +541,11 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||||||
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
|
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_uint_32)png_ptr->zbuf_size);
|
(png_uint_32)png_ptr->zbuf_size);
|
||||||
|
|
||||||
png_set_write_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL,
|
png_set_write_fn(png_ptr, NULL, NULL, NULL);
|
||||||
png_flush_ptr_NULL);
|
|
||||||
|
|
||||||
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
|
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
|
||||||
png_set_filter_heuristics(png_ptr, PNG_FILTER_HEURISTIC_DEFAULT,
|
png_set_filter_heuristics(png_ptr, PNG_FILTER_HEURISTIC_DEFAULT,
|
||||||
1, png_doublep_NULL, png_doublep_NULL);
|
1, NULL, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
@@ -551,7 +555,7 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||||||
#ifdef USE_FAR_KEYWORD
|
#ifdef USE_FAR_KEYWORD
|
||||||
if (setjmp(jmpbuf))
|
if (setjmp(jmpbuf))
|
||||||
PNG_ABORT();
|
PNG_ABORT();
|
||||||
png_memcpy(png_ptr->jmpbuf,jmpbuf,png_sizeof(jmp_buf));
|
png_memcpy(png_ptr->jmpbuf, jmpbuf, png_sizeof(jmp_buf));
|
||||||
#else
|
#else
|
||||||
if (setjmp(png_ptr->jmpbuf))
|
if (setjmp(png_ptr->jmpbuf))
|
||||||
PNG_ABORT();
|
PNG_ABORT();
|
||||||
@@ -561,59 +565,6 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize png_ptr structure, and allocate any memory needed */
|
/* Initialize png_ptr structure, and allocate any memory needed */
|
||||||
#if defined(PNG_1_0_X) || defined(PNG_1_2_X)
|
|
||||||
/* Deprecated. */
|
|
||||||
#undef png_write_init
|
|
||||||
void PNGAPI
|
|
||||||
png_write_init(png_structp png_ptr)
|
|
||||||
{
|
|
||||||
/* We only come here via pre-1.0.7-compiled applications */
|
|
||||||
png_write_init_2(png_ptr, "1.0.6 or earlier", 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PNGAPI
|
|
||||||
png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver,
|
|
||||||
png_size_t png_struct_size, png_size_t png_info_size)
|
|
||||||
{
|
|
||||||
/* We only come here via pre-1.0.12-compiled applications */
|
|
||||||
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
|
|
||||||
if(png_sizeof(png_struct) > png_struct_size ||
|
|
||||||
png_sizeof(png_info) > png_info_size)
|
|
||||||
{
|
|
||||||
char msg[80];
|
|
||||||
png_ptr->warning_fn=NULL;
|
|
||||||
if (user_png_ver)
|
|
||||||
{
|
|
||||||
sprintf(msg, "Application was compiled with png.h from libpng-%.20s",
|
|
||||||
user_png_ver);
|
|
||||||
png_warning(png_ptr, msg);
|
|
||||||
}
|
|
||||||
sprintf(msg, "Application is running with png.c from libpng-%.20s",
|
|
||||||
png_libpng_ver);
|
|
||||||
png_warning(png_ptr, msg);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if(png_sizeof(png_struct) > png_struct_size)
|
|
||||||
{
|
|
||||||
png_ptr->error_fn=NULL;
|
|
||||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
|
||||||
png_ptr->flags=0;
|
|
||||||
#endif
|
|
||||||
png_error(png_ptr,
|
|
||||||
"The png struct allocated by the application for writing is too small.");
|
|
||||||
}
|
|
||||||
if(png_sizeof(png_info) > png_info_size)
|
|
||||||
{
|
|
||||||
png_ptr->error_fn=NULL;
|
|
||||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
|
||||||
png_ptr->flags=0;
|
|
||||||
#endif
|
|
||||||
png_error(png_ptr,
|
|
||||||
"The info struct allocated by the application for writing is too small.");
|
|
||||||
}
|
|
||||||
png_write_init_3(&png_ptr, user_png_ver, png_struct_size);
|
|
||||||
}
|
|
||||||
#endif /* PNG_1_0_X || PNG_1_2_X */
|
|
||||||
|
|
||||||
|
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
@@ -639,17 +590,17 @@ png_write_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
|
|||||||
#else
|
#else
|
||||||
png_ptr->warning_fn=NULL;
|
png_ptr->warning_fn=NULL;
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"Application uses deprecated png_write_init() and should be recompiled.");
|
"Application uses deprecated png_write_init() and should be recompiled.");
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
} while (png_libpng_ver[i++]);
|
} while (png_libpng_ver[i++]);
|
||||||
|
|
||||||
png_debug(1, "in png_write_init_3\n");
|
png_debug(1, "in png_write_init_3");
|
||||||
|
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
/* save jump buffer and error functions */
|
/* save jump buffer and error functions */
|
||||||
png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof (jmp_buf));
|
png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof(jmp_buf));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (png_sizeof(png_struct) > png_struct_size)
|
if (png_sizeof(png_struct) > png_struct_size)
|
||||||
@@ -660,7 +611,7 @@ png_write_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* reset all variables to 0 */
|
/* reset all variables to 0 */
|
||||||
png_memset(png_ptr, 0, png_sizeof (png_struct));
|
png_memset(png_ptr, 0, png_sizeof(png_struct));
|
||||||
|
|
||||||
/* added at libpng-1.2.6 */
|
/* added at libpng-1.2.6 */
|
||||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||||
@@ -668,19 +619,12 @@ png_write_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
|
|||||||
png_ptr->user_height_max=PNG_USER_HEIGHT_MAX;
|
png_ptr->user_height_max=PNG_USER_HEIGHT_MAX;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(PNG_1_0_X)
|
|
||||||
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
|
|
||||||
png_init_mmx_flags(png_ptr); /* 1.2.0 addition */
|
|
||||||
#endif
|
|
||||||
#endif /* PNG_1_0_X */
|
|
||||||
|
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
/* restore jump buffer */
|
/* restore jump buffer */
|
||||||
png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof (jmp_buf));
|
png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof(jmp_buf));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
png_set_write_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL,
|
png_set_write_fn(png_ptr, NULL, NULL, NULL);
|
||||||
png_flush_ptr_NULL);
|
|
||||||
|
|
||||||
/* initialize zbuf - compression buffer */
|
/* initialize zbuf - compression buffer */
|
||||||
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
|
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
|
||||||
@@ -689,7 +633,7 @@ png_write_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
|
|||||||
|
|
||||||
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
|
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
|
||||||
png_set_filter_heuristics(png_ptr, PNG_FILTER_HEURISTIC_DEFAULT,
|
png_set_filter_heuristics(png_ptr, PNG_FILTER_HEURISTIC_DEFAULT,
|
||||||
1, png_doublep_NULL, png_doublep_NULL);
|
1, NULL, NULL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -705,7 +649,7 @@ png_write_rows(png_structp png_ptr, png_bytepp row,
|
|||||||
png_uint_32 i; /* row counter */
|
png_uint_32 i; /* row counter */
|
||||||
png_bytepp rp; /* row pointer */
|
png_bytepp rp; /* row pointer */
|
||||||
|
|
||||||
png_debug(1, "in png_write_rows\n");
|
png_debug(1, "in png_write_rows");
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
@@ -730,7 +674,7 @@ png_write_image(png_structp png_ptr, png_bytepp image)
|
|||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
png_debug(1, "in png_write_image\n");
|
png_debug(1, "in png_write_image");
|
||||||
#if defined(PNG_WRITE_INTERLACING_SUPPORTED)
|
#if defined(PNG_WRITE_INTERLACING_SUPPORTED)
|
||||||
/* intialize interlace handling. If image is not interlaced,
|
/* intialize interlace handling. If image is not interlaced,
|
||||||
this will set pass to 1 */
|
this will set pass to 1 */
|
||||||
@@ -755,7 +699,7 @@ png_write_row(png_structp png_ptr, png_bytep row)
|
|||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
png_debug2(1, "in png_write_row (row %ld, pass %d)\n",
|
png_debug2(1, "in png_write_row (row %ld, pass %d)",
|
||||||
png_ptr->row_number, png_ptr->pass);
|
png_ptr->row_number, png_ptr->pass);
|
||||||
|
|
||||||
/* initialize transformations and other stuff if first time */
|
/* initialize transformations and other stuff if first time */
|
||||||
@@ -764,36 +708,36 @@ png_write_row(png_structp png_ptr, png_bytep row)
|
|||||||
/* make sure we wrote the header info */
|
/* make sure we wrote the header info */
|
||||||
if (!(png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE))
|
if (!(png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE))
|
||||||
png_error(png_ptr,
|
png_error(png_ptr,
|
||||||
"png_write_info was never called before png_write_row.");
|
"png_write_info was never called before png_write_row");
|
||||||
|
|
||||||
/* check for transforms that have been set but were defined out */
|
/* check for transforms that have been set but were defined out */
|
||||||
#if !defined(PNG_WRITE_INVERT_SUPPORTED) && defined(PNG_READ_INVERT_SUPPORTED)
|
#if !defined(PNG_WRITE_INVERT_SUPPORTED) && defined(PNG_READ_INVERT_SUPPORTED)
|
||||||
if (png_ptr->transformations & PNG_INVERT_MONO)
|
if (png_ptr->transformations & PNG_INVERT_MONO)
|
||||||
png_warning(png_ptr, "PNG_WRITE_INVERT_SUPPORTED is not defined.");
|
png_warning(png_ptr, "PNG_WRITE_INVERT_SUPPORTED is not defined");
|
||||||
#endif
|
#endif
|
||||||
#if !defined(PNG_WRITE_FILLER_SUPPORTED) && defined(PNG_READ_FILLER_SUPPORTED)
|
#if !defined(PNG_WRITE_FILLER_SUPPORTED) && defined(PNG_READ_FILLER_SUPPORTED)
|
||||||
if (png_ptr->transformations & PNG_FILLER)
|
if (png_ptr->transformations & PNG_FILLER)
|
||||||
png_warning(png_ptr, "PNG_WRITE_FILLER_SUPPORTED is not defined.");
|
png_warning(png_ptr, "PNG_WRITE_FILLER_SUPPORTED is not defined");
|
||||||
#endif
|
#endif
|
||||||
#if !defined(PNG_WRITE_PACKSWAP_SUPPORTED) && defined(PNG_READ_PACKSWAP_SUPPORTED)
|
#if !defined(PNG_WRITE_PACKSWAP_SUPPORTED) && defined(PNG_READ_PACKSWAP_SUPPORTED)
|
||||||
if (png_ptr->transformations & PNG_PACKSWAP)
|
if (png_ptr->transformations & PNG_PACKSWAP)
|
||||||
png_warning(png_ptr, "PNG_WRITE_PACKSWAP_SUPPORTED is not defined.");
|
png_warning(png_ptr, "PNG_WRITE_PACKSWAP_SUPPORTED is not defined");
|
||||||
#endif
|
#endif
|
||||||
#if !defined(PNG_WRITE_PACK_SUPPORTED) && defined(PNG_READ_PACK_SUPPORTED)
|
#if !defined(PNG_WRITE_PACK_SUPPORTED) && defined(PNG_READ_PACK_SUPPORTED)
|
||||||
if (png_ptr->transformations & PNG_PACK)
|
if (png_ptr->transformations & PNG_PACK)
|
||||||
png_warning(png_ptr, "PNG_WRITE_PACK_SUPPORTED is not defined.");
|
png_warning(png_ptr, "PNG_WRITE_PACK_SUPPORTED is not defined");
|
||||||
#endif
|
#endif
|
||||||
#if !defined(PNG_WRITE_SHIFT_SUPPORTED) && defined(PNG_READ_SHIFT_SUPPORTED)
|
#if !defined(PNG_WRITE_SHIFT_SUPPORTED) && defined(PNG_READ_SHIFT_SUPPORTED)
|
||||||
if (png_ptr->transformations & PNG_SHIFT)
|
if (png_ptr->transformations & PNG_SHIFT)
|
||||||
png_warning(png_ptr, "PNG_WRITE_SHIFT_SUPPORTED is not defined.");
|
png_warning(png_ptr, "PNG_WRITE_SHIFT_SUPPORTED is not defined");
|
||||||
#endif
|
#endif
|
||||||
#if !defined(PNG_WRITE_BGR_SUPPORTED) && defined(PNG_READ_BGR_SUPPORTED)
|
#if !defined(PNG_WRITE_BGR_SUPPORTED) && defined(PNG_READ_BGR_SUPPORTED)
|
||||||
if (png_ptr->transformations & PNG_BGR)
|
if (png_ptr->transformations & PNG_BGR)
|
||||||
png_warning(png_ptr, "PNG_WRITE_BGR_SUPPORTED is not defined.");
|
png_warning(png_ptr, "PNG_WRITE_BGR_SUPPORTED is not defined");
|
||||||
#endif
|
#endif
|
||||||
#if !defined(PNG_WRITE_SWAP_SUPPORTED) && defined(PNG_READ_SWAP_SUPPORTED)
|
#if !defined(PNG_WRITE_SWAP_SUPPORTED) && defined(PNG_READ_SWAP_SUPPORTED)
|
||||||
if (png_ptr->transformations & PNG_SWAP_BYTES)
|
if (png_ptr->transformations & PNG_SWAP_BYTES)
|
||||||
png_warning(png_ptr, "PNG_WRITE_SWAP_SUPPORTED is not defined.");
|
png_warning(png_ptr, "PNG_WRITE_SWAP_SUPPORTED is not defined");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
png_write_start_row(png_ptr);
|
png_write_start_row(png_ptr);
|
||||||
@@ -869,16 +813,15 @@ png_write_row(png_structp png_ptr, png_bytep row)
|
|||||||
png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth,
|
png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth,
|
||||||
png_ptr->row_info.width);
|
png_ptr->row_info.width);
|
||||||
|
|
||||||
png_debug1(3, "row_info->color_type = %d\n", png_ptr->row_info.color_type);
|
png_debug1(3, "row_info->color_type = %d", png_ptr->row_info.color_type);
|
||||||
png_debug1(3, "row_info->width = %lu\n", png_ptr->row_info.width);
|
png_debug1(3, "row_info->width = %lu", png_ptr->row_info.width);
|
||||||
png_debug1(3, "row_info->channels = %d\n", png_ptr->row_info.channels);
|
png_debug1(3, "row_info->channels = %d", png_ptr->row_info.channels);
|
||||||
png_debug1(3, "row_info->bit_depth = %d\n", png_ptr->row_info.bit_depth);
|
png_debug1(3, "row_info->bit_depth = %d", png_ptr->row_info.bit_depth);
|
||||||
png_debug1(3, "row_info->pixel_depth = %d\n", png_ptr->row_info.pixel_depth);
|
png_debug1(3, "row_info->pixel_depth = %d", png_ptr->row_info.pixel_depth);
|
||||||
png_debug1(3, "row_info->rowbytes = %lu\n", png_ptr->row_info.rowbytes);
|
png_debug1(3, "row_info->rowbytes = %lu", png_ptr->row_info.rowbytes);
|
||||||
|
|
||||||
/* Copy user's row into buffer, leaving room for filter byte. */
|
/* Copy user's row into buffer, leaving room for filter byte. */
|
||||||
png_memcpy_check(png_ptr, png_ptr->row_buf + 1, row,
|
png_memcpy(png_ptr->row_buf + 1, row, png_ptr->row_info.rowbytes);
|
||||||
png_ptr->row_info.rowbytes);
|
|
||||||
|
|
||||||
#if defined(PNG_WRITE_INTERLACING_SUPPORTED)
|
#if defined(PNG_WRITE_INTERLACING_SUPPORTED)
|
||||||
/* handle interlacing */
|
/* handle interlacing */
|
||||||
@@ -910,7 +853,7 @@ png_write_row(png_structp png_ptr, png_bytep row)
|
|||||||
* 4. The filter_method is 64 and
|
* 4. The filter_method is 64 and
|
||||||
* 5. The color_type is RGB or RGBA
|
* 5. The color_type is RGB or RGBA
|
||||||
*/
|
*/
|
||||||
if((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
|
if ((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
|
||||||
(png_ptr->filter_type == PNG_INTRAPIXEL_DIFFERENCING))
|
(png_ptr->filter_type == PNG_INTRAPIXEL_DIFFERENCING))
|
||||||
{
|
{
|
||||||
/* Intrapixel differencing */
|
/* Intrapixel differencing */
|
||||||
@@ -930,7 +873,7 @@ png_write_row(png_structp png_ptr, png_bytep row)
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_flush(png_structp png_ptr, int nrows)
|
png_set_flush(png_structp png_ptr, int nrows)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_flush\n");
|
png_debug(1, "in png_set_flush");
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
png_ptr->flush_dist = (nrows < 0 ? 0 : nrows);
|
png_ptr->flush_dist = (nrows < 0 ? 0 : nrows);
|
||||||
@@ -942,7 +885,7 @@ png_write_flush(png_structp png_ptr)
|
|||||||
{
|
{
|
||||||
int wrote_IDAT;
|
int wrote_IDAT;
|
||||||
|
|
||||||
png_debug(1, "in png_write_flush\n");
|
png_debug(1, "in png_write_flush");
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
/* We have already written out all of the data */
|
/* We have already written out all of the data */
|
||||||
@@ -1002,7 +945,7 @@ png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)
|
|||||||
png_voidp mem_ptr = NULL;
|
png_voidp mem_ptr = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
png_debug(1, "in png_destroy_write_struct\n");
|
png_debug(1, "in png_destroy_write_struct");
|
||||||
if (png_ptr_ptr != NULL)
|
if (png_ptr_ptr != NULL)
|
||||||
{
|
{
|
||||||
png_ptr = *png_ptr_ptr;
|
png_ptr = *png_ptr_ptr;
|
||||||
@@ -1012,21 +955,31 @@ png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
|
if (png_ptr != NULL)
|
||||||
|
{
|
||||||
|
free_fn = png_ptr->free_fn;
|
||||||
|
mem_ptr = png_ptr->mem_ptr;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (info_ptr_ptr != NULL)
|
if (info_ptr_ptr != NULL)
|
||||||
info_ptr = *info_ptr_ptr;
|
info_ptr = *info_ptr_ptr;
|
||||||
|
|
||||||
if (info_ptr != NULL)
|
if (info_ptr != NULL)
|
||||||
{
|
{
|
||||||
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
|
if (png_ptr != NULL)
|
||||||
|
{
|
||||||
|
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
|
||||||
|
|
||||||
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
||||||
if (png_ptr->num_chunk_list)
|
if (png_ptr->num_chunk_list)
|
||||||
{
|
{
|
||||||
png_free(png_ptr, png_ptr->chunk_list);
|
png_free(png_ptr, png_ptr->chunk_list);
|
||||||
png_ptr->chunk_list=NULL;
|
png_ptr->num_chunk_list = 0;
|
||||||
png_ptr->num_chunk_list=0;
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
png_destroy_struct_2((png_voidp)info_ptr, (png_free_ptr)free_fn,
|
png_destroy_struct_2((png_voidp)info_ptr, (png_free_ptr)free_fn,
|
||||||
@@ -1065,18 +1018,20 @@ png_write_destroy(png_structp png_ptr)
|
|||||||
png_free_ptr free_fn;
|
png_free_ptr free_fn;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
png_debug(1, "in png_write_destroy\n");
|
png_debug(1, "in png_write_destroy");
|
||||||
/* free any memory zlib uses */
|
/* free any memory zlib uses */
|
||||||
deflateEnd(&png_ptr->zstream);
|
deflateEnd(&png_ptr->zstream);
|
||||||
|
|
||||||
/* free our memory. png_free checks NULL for us. */
|
/* free our memory. png_free checks NULL for us. */
|
||||||
png_free(png_ptr, png_ptr->zbuf);
|
png_free(png_ptr, png_ptr->zbuf);
|
||||||
png_free(png_ptr, png_ptr->row_buf);
|
png_free(png_ptr, png_ptr->row_buf);
|
||||||
|
#ifndef PNG_NO_WRITE_FILTER
|
||||||
png_free(png_ptr, png_ptr->prev_row);
|
png_free(png_ptr, png_ptr->prev_row);
|
||||||
png_free(png_ptr, png_ptr->sub_row);
|
png_free(png_ptr, png_ptr->sub_row);
|
||||||
png_free(png_ptr, png_ptr->up_row);
|
png_free(png_ptr, png_ptr->up_row);
|
||||||
png_free(png_ptr, png_ptr->avg_row);
|
png_free(png_ptr, png_ptr->avg_row);
|
||||||
png_free(png_ptr, png_ptr->paeth_row);
|
png_free(png_ptr, png_ptr->paeth_row);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_TIME_RFC1123_SUPPORTED)
|
#if defined(PNG_TIME_RFC1123_SUPPORTED)
|
||||||
png_free(png_ptr, png_ptr->time_buffer);
|
png_free(png_ptr, png_ptr->time_buffer);
|
||||||
@@ -1092,7 +1047,7 @@ png_write_destroy(png_structp png_ptr)
|
|||||||
|
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
/* reset structure */
|
/* reset structure */
|
||||||
png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof (jmp_buf));
|
png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof(jmp_buf));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
error_fn = png_ptr->error_fn;
|
error_fn = png_ptr->error_fn;
|
||||||
@@ -1102,7 +1057,7 @@ png_write_destroy(png_structp png_ptr)
|
|||||||
free_fn = png_ptr->free_fn;
|
free_fn = png_ptr->free_fn;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
png_memset(png_ptr, 0, png_sizeof (png_struct));
|
png_memset(png_ptr, 0, png_sizeof(png_struct));
|
||||||
|
|
||||||
png_ptr->error_fn = error_fn;
|
png_ptr->error_fn = error_fn;
|
||||||
png_ptr->warning_fn = warning_fn;
|
png_ptr->warning_fn = warning_fn;
|
||||||
@@ -1112,7 +1067,7 @@ png_write_destroy(png_structp png_ptr)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof (jmp_buf));
|
png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof(jmp_buf));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1120,11 +1075,11 @@ png_write_destroy(png_structp png_ptr)
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_filter(png_structp png_ptr, int method, int filters)
|
png_set_filter(png_structp png_ptr, int method, int filters)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_filter\n");
|
png_debug(1, "in png_set_filter");
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
#if defined(PNG_MNG_FEATURES_SUPPORTED)
|
#if defined(PNG_MNG_FEATURES_SUPPORTED)
|
||||||
if((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
|
if ((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
|
||||||
(method == PNG_INTRAPIXEL_DIFFERENCING))
|
(method == PNG_INTRAPIXEL_DIFFERENCING))
|
||||||
method = PNG_FILTER_TYPE_BASE;
|
method = PNG_FILTER_TYPE_BASE;
|
||||||
#endif
|
#endif
|
||||||
@@ -1132,15 +1087,26 @@ png_set_filter(png_structp png_ptr, int method, int filters)
|
|||||||
{
|
{
|
||||||
switch (filters & (PNG_ALL_FILTERS | 0x07))
|
switch (filters & (PNG_ALL_FILTERS | 0x07))
|
||||||
{
|
{
|
||||||
|
#ifndef PNG_NO_WRITE_FILTER
|
||||||
case 5:
|
case 5:
|
||||||
case 6:
|
case 6:
|
||||||
case 7: png_warning(png_ptr, "Unknown row filter for method 0");
|
case 7: png_warning(png_ptr, "Unknown row filter for method 0");
|
||||||
case PNG_FILTER_VALUE_NONE: png_ptr->do_filter=PNG_FILTER_NONE; break;
|
#endif /* PNG_NO_WRITE_FILTER */
|
||||||
case PNG_FILTER_VALUE_SUB: png_ptr->do_filter=PNG_FILTER_SUB; break;
|
case PNG_FILTER_VALUE_NONE:
|
||||||
case PNG_FILTER_VALUE_UP: png_ptr->do_filter=PNG_FILTER_UP; break;
|
png_ptr->do_filter=PNG_FILTER_NONE; break;
|
||||||
case PNG_FILTER_VALUE_AVG: png_ptr->do_filter=PNG_FILTER_AVG; break;
|
#ifndef PNG_NO_WRITE_FILTER
|
||||||
case PNG_FILTER_VALUE_PAETH: png_ptr->do_filter=PNG_FILTER_PAETH;break;
|
case PNG_FILTER_VALUE_SUB:
|
||||||
|
png_ptr->do_filter=PNG_FILTER_SUB; break;
|
||||||
|
case PNG_FILTER_VALUE_UP:
|
||||||
|
png_ptr->do_filter=PNG_FILTER_UP; break;
|
||||||
|
case PNG_FILTER_VALUE_AVG:
|
||||||
|
png_ptr->do_filter=PNG_FILTER_AVG; break;
|
||||||
|
case PNG_FILTER_VALUE_PAETH:
|
||||||
|
png_ptr->do_filter=PNG_FILTER_PAETH; break;
|
||||||
default: png_ptr->do_filter = (png_byte)filters; break;
|
default: png_ptr->do_filter = (png_byte)filters; break;
|
||||||
|
#else
|
||||||
|
default: png_warning(png_ptr, "Unknown row filter for method 0");
|
||||||
|
#endif /* PNG_NO_WRITE_FILTER */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we have allocated the row_buf, this means we have already started
|
/* If we have allocated the row_buf, this means we have already started
|
||||||
@@ -1154,6 +1120,7 @@ png_set_filter(png_structp png_ptr, int method, int filters)
|
|||||||
*/
|
*/
|
||||||
if (png_ptr->row_buf != NULL)
|
if (png_ptr->row_buf != NULL)
|
||||||
{
|
{
|
||||||
|
#ifndef PNG_NO_WRITE_FILTER
|
||||||
if ((png_ptr->do_filter & PNG_FILTER_SUB) && png_ptr->sub_row == NULL)
|
if ((png_ptr->do_filter & PNG_FILTER_SUB) && png_ptr->sub_row == NULL)
|
||||||
{
|
{
|
||||||
png_ptr->sub_row = (png_bytep)png_malloc(png_ptr,
|
png_ptr->sub_row = (png_bytep)png_malloc(png_ptr,
|
||||||
@@ -1208,6 +1175,7 @@ png_set_filter(png_structp png_ptr, int method, int filters)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (png_ptr->do_filter == PNG_NO_FILTERS)
|
if (png_ptr->do_filter == PNG_NO_FILTERS)
|
||||||
|
#endif /* PNG_NO_WRITE_FILTER */
|
||||||
png_ptr->do_filter = PNG_FILTER_NONE;
|
png_ptr->do_filter = PNG_FILTER_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1230,7 +1198,7 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
png_debug(1, "in png_set_filter_heuristics\n");
|
png_debug(1, "in png_set_filter_heuristics");
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
if (heuristic_method >= PNG_FILTER_HEURISTIC_LAST)
|
if (heuristic_method >= PNG_FILTER_HEURISTIC_LAST)
|
||||||
@@ -1344,7 +1312,7 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_compression_level(png_structp png_ptr, int level)
|
png_set_compression_level(png_structp png_ptr, int level)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_compression_level\n");
|
png_debug(1, "in png_set_compression_level");
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_LEVEL;
|
png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_LEVEL;
|
||||||
@@ -1354,7 +1322,7 @@ png_set_compression_level(png_structp png_ptr, int level)
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_compression_mem_level(png_structp png_ptr, int mem_level)
|
png_set_compression_mem_level(png_structp png_ptr, int mem_level)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_compression_mem_level\n");
|
png_debug(1, "in png_set_compression_mem_level");
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL;
|
png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL;
|
||||||
@@ -1364,7 +1332,7 @@ png_set_compression_mem_level(png_structp png_ptr, int mem_level)
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_compression_strategy(png_structp png_ptr, int strategy)
|
png_set_compression_strategy(png_structp png_ptr, int strategy)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_compression_strategy\n");
|
png_debug(1, "in png_set_compression_strategy");
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_STRATEGY;
|
png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_STRATEGY;
|
||||||
@@ -1395,7 +1363,7 @@ png_set_compression_window_bits(png_structp png_ptr, int window_bits)
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_compression_method(png_structp png_ptr, int method)
|
png_set_compression_method(png_structp png_ptr, int method)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_compression_method\n");
|
png_debug(1, "in png_set_compression_method");
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
if (method != 8)
|
if (method != 8)
|
||||||
@@ -1417,7 +1385,7 @@ void PNGAPI
|
|||||||
png_set_write_user_transform_fn(png_structp png_ptr, png_user_transform_ptr
|
png_set_write_user_transform_fn(png_structp png_ptr, png_user_transform_ptr
|
||||||
write_user_transform_fn)
|
write_user_transform_fn)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_write_user_transform_fn\n");
|
png_debug(1, "in png_set_write_user_transform_fn");
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
png_ptr->transformations |= PNG_USER_TRANSFORM;
|
png_ptr->transformations |= PNG_USER_TRANSFORM;
|
||||||
@@ -1472,11 +1440,11 @@ png_write_png(png_structp png_ptr, png_infop info_ptr,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_WRITE_FILLER_SUPPORTED)
|
#if defined(PNG_WRITE_FILLER_SUPPORTED)
|
||||||
/* Get rid of filler (OR ALPHA) bytes, pack XRGB/RGBX/ARGB/RGBA into
|
/* Pack XRGB/RGBX/ARGB/RGBA into * RGB (4 channels -> 3 channels) */
|
||||||
* RGB (4 channels -> 3 channels). The second parameter is not used.
|
if (transforms & PNG_TRANSFORM_STRIP_FILLER_AFTER)
|
||||||
*/
|
png_set_filler(png_ptr, 0, PNG_FILLER_AFTER);
|
||||||
if (transforms & PNG_TRANSFORM_STRIP_FILLER)
|
else if (transforms & PNG_TRANSFORM_STRIP_FILLER_BEFORE)
|
||||||
png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
|
png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_WRITE_BGR_SUPPORTED)
|
#if defined(PNG_WRITE_BGR_SUPPORTED)
|
||||||
@@ -1506,8 +1474,8 @@ png_write_png(png_structp png_ptr, png_infop info_ptr,
|
|||||||
/* It is REQUIRED to call this to finish writing the rest of the file */
|
/* It is REQUIRED to call this to finish writing the rest of the file */
|
||||||
png_write_end(png_ptr, info_ptr);
|
png_write_end(png_ptr, info_ptr);
|
||||||
|
|
||||||
if(transforms == 0 || params == NULL)
|
transforms = transforms; /* quiet compiler warnings */
|
||||||
/* quiet compiler warnings */ return;
|
params = params;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* PNG_WRITE_SUPPORTED */
|
#endif /* PNG_WRITE_SUPPORTED */
|
||||||
|
|||||||
40
pngwtran.c
40
pngwtran.c
@@ -1,16 +1,16 @@
|
|||||||
|
|
||||||
/* pngwtran.c - transforms the data in a row for PNG writers
|
/* pngwtran.c - transforms the data in a row for PNG writers
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.2.9 April 14, 2006
|
* Last changed in libpng 1.4.0 [February 28, 2009]
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2009 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.)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
|
||||||
#include "png.h"
|
#include "png.h"
|
||||||
#ifdef PNG_WRITE_SUPPORTED
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
|
#include "pngpriv.h"
|
||||||
|
|
||||||
/* Transform the data according to the user's wishes. The order of
|
/* Transform the data according to the user's wishes. The order of
|
||||||
* transformations is significant.
|
* transformations is significant.
|
||||||
@@ -18,14 +18,14 @@
|
|||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_do_write_transformations(png_structp png_ptr)
|
png_do_write_transformations(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_write_transformations\n");
|
png_debug(1, "in png_do_write_transformations");
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
||||||
if (png_ptr->transformations & PNG_USER_TRANSFORM)
|
if (png_ptr->transformations & PNG_USER_TRANSFORM)
|
||||||
if(png_ptr->write_user_transform_fn != NULL)
|
if (png_ptr->write_user_transform_fn != NULL)
|
||||||
(*(png_ptr->write_user_transform_fn)) /* user write transform function */
|
(*(png_ptr->write_user_transform_fn)) /* user write transform function */
|
||||||
(png_ptr, /* png_ptr */
|
(png_ptr, /* png_ptr */
|
||||||
&(png_ptr->row_info), /* row_info: */
|
&(png_ptr->row_info), /* row_info: */
|
||||||
@@ -86,11 +86,8 @@ png_do_write_transformations(png_structp png_ptr)
|
|||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_pack\n");
|
png_debug(1, "in png_do_pack");
|
||||||
if (row_info->bit_depth == 8 &&
|
if (row_info->bit_depth == 8 &&
|
||||||
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
|
||||||
row != NULL && row_info != NULL &&
|
|
||||||
#endif
|
|
||||||
row_info->channels == 1)
|
row_info->channels == 1)
|
||||||
{
|
{
|
||||||
switch ((int)bit_depth)
|
switch ((int)bit_depth)
|
||||||
@@ -212,12 +209,8 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
|||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
|
png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_shift\n");
|
png_debug(1, "in png_do_shift");
|
||||||
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
|
||||||
if (row != NULL && row_info != NULL &&
|
|
||||||
#else
|
|
||||||
if (
|
if (
|
||||||
#endif
|
|
||||||
row_info->color_type != PNG_COLOR_TYPE_PALETTE)
|
row_info->color_type != PNG_COLOR_TYPE_PALETTE)
|
||||||
{
|
{
|
||||||
int shift_start[4], shift_dec[4];
|
int shift_start[4], shift_dec[4];
|
||||||
@@ -336,10 +329,7 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
|
|||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_write_swap_alpha\n");
|
png_debug(1, "in png_do_write_swap_alpha");
|
||||||
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
|
||||||
if (row != NULL && row_info != NULL)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
{
|
{
|
||||||
@@ -424,10 +414,7 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_write_invert_alpha\n");
|
png_debug(1, "in png_do_write_invert_alpha");
|
||||||
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
|
||||||
if (row != NULL && row_info != NULL)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
{
|
{
|
||||||
@@ -514,11 +501,8 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
|
png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_write_intrapixel\n");
|
png_debug(1, "in png_do_write_intrapixel");
|
||||||
if (
|
if (
|
||||||
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
|
||||||
row != NULL && row_info != NULL &&
|
|
||||||
#endif
|
|
||||||
(row_info->color_type & PNG_COLOR_MASK_COLOR))
|
(row_info->color_type & PNG_COLOR_MASK_COLOR))
|
||||||
{
|
{
|
||||||
int bytes_per_pixel;
|
int bytes_per_pixel;
|
||||||
@@ -558,8 +542,8 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
|
|||||||
png_uint_32 s0 = (*(rp ) << 8) | *(rp+1);
|
png_uint_32 s0 = (*(rp ) << 8) | *(rp+1);
|
||||||
png_uint_32 s1 = (*(rp+2) << 8) | *(rp+3);
|
png_uint_32 s1 = (*(rp+2) << 8) | *(rp+3);
|
||||||
png_uint_32 s2 = (*(rp+4) << 8) | *(rp+5);
|
png_uint_32 s2 = (*(rp+4) << 8) | *(rp+5);
|
||||||
png_uint_32 red = (png_uint_32)((s0-s1) & 0xffffL);
|
png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL);
|
||||||
png_uint_32 blue = (png_uint_32)((s2-s1) & 0xffffL);
|
png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL);
|
||||||
*(rp ) = (png_byte)((red >> 8) & 0xff);
|
*(rp ) = (png_byte)((red >> 8) & 0xff);
|
||||||
*(rp+1) = (png_byte)(red & 0xff);
|
*(rp+1) = (png_byte)(red & 0xff);
|
||||||
*(rp+4) = (png_byte)((blue >> 8) & 0xff);
|
*(rp+4) = (png_byte)((blue >> 8) & 0xff);
|
||||||
|
|||||||
695
pngwutil.c
695
pngwutil.c
File diff suppressed because it is too large
Load Diff
@@ -31,11 +31,11 @@ To use:
|
|||||||
|
|
||||||
This project builds the libpng binaries as follows:
|
This project builds the libpng binaries as follows:
|
||||||
|
|
||||||
* Win32_DLL_Release\libpng13.dll DLL build
|
* Win32_DLL_Release\libpng14.dll DLL build
|
||||||
* Win32_DLL_Debug\libpng13d.dll DLL build (debug version)
|
* Win32_DLL_Debug\libpng14d.dll DLL build (debug version)
|
||||||
* Win32_DLL_ASM_Release\libpng13.dll DLL build using ASM code
|
* Win32_DLL_ASM_Release\libpng14.dll DLL build using ASM code
|
||||||
* Win32_DLL_ASM_Debug\libpng13d.dll DLL build using ASM (debug version)
|
* Win32_DLL_ASM_Debug\libpng14d.dll DLL build using ASM (debug version)
|
||||||
* Win32_DLL_VB\libpng13vb.dll DLL build for Visual Basic, using stdcall
|
* Win32_DLL_VB\libpng14vb.dll DLL build for Visual Basic, using stdcall
|
||||||
* Win32_LIB_Release\libpng.lib static build
|
* Win32_LIB_Release\libpng.lib static build
|
||||||
* Win32_LIB_Debug\libpngd.lib static build (debug version)
|
* Win32_LIB_Debug\libpngd.lib static build (debug version)
|
||||||
* Win32_LIB_ASM_Release\libpng.lib static build using ASM code
|
* Win32_LIB_ASM_Release\libpng.lib static build using ASM code
|
||||||
|
|||||||
@@ -8,16 +8,16 @@
|
|||||||
CFG=libpng - Win32 DLL Release
|
CFG=libpng - Win32 DLL Release
|
||||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
!MESSAGE use the Export Makefile command and run
|
!MESSAGE use the Export Makefile command and run
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE NMAKE /f "libpng.mak".
|
!MESSAGE NMAKE /f "libpng.mak".
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE You can specify a configuration when running NMAKE
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE NMAKE /f "libpng.mak" CFG="libpng - Win32 DLL Release"
|
!MESSAGE NMAKE /f "libpng.mak" CFG="libpng - Win32 DLL Release"
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE Possible choices for configuration are:
|
!MESSAGE Possible choices for configuration are:
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE "libpng - Win32 DLL Release" (based on "Win32 (x86) Dynamic-Link Library")
|
!MESSAGE "libpng - Win32 DLL Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||||
!MESSAGE "libpng - Win32 DLL Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
!MESSAGE "libpng - Win32 DLL Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||||
!MESSAGE "libpng - Win32 DLL ASM Release" (based on "Win32 (x86) Dynamic-Link Library")
|
!MESSAGE "libpng - Win32 DLL ASM Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||||
@@ -27,7 +27,7 @@ CFG=libpng - Win32 DLL Release
|
|||||||
!MESSAGE "libpng - Win32 LIB Debug" (based on "Win32 (x86) Static Library")
|
!MESSAGE "libpng - Win32 LIB Debug" (based on "Win32 (x86) Static Library")
|
||||||
!MESSAGE "libpng - Win32 LIB ASM Release" (based on "Win32 (x86) Static Library")
|
!MESSAGE "libpng - Win32 LIB ASM Release" (based on "Win32 (x86) Static Library")
|
||||||
!MESSAGE "libpng - Win32 LIB ASM Debug" (based on "Win32 (x86) Static Library")
|
!MESSAGE "libpng - Win32 LIB ASM Debug" (based on "Win32 (x86) Static Library")
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
|
|
||||||
# Begin Project
|
# Begin Project
|
||||||
# PROP AllowPerConfigDependencies 0
|
# PROP AllowPerConfigDependencies 0
|
||||||
@@ -63,7 +63,7 @@ BSC32=bscmake.exe
|
|||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 /nologo /dll /machine:I386
|
# ADD BASE LINK32 /nologo /dll /machine:I386
|
||||||
# ADD LINK32 zlib1.lib /nologo /dll /machine:I386 /out:"Win32_DLL_Release\libpng13.dll" /libpath:"..\..\..\zlib\projects\visualc6\Win32_DLL_Release"
|
# ADD LINK32 zlib1.lib /nologo /dll /machine:I386 /out:"Win32_DLL_Release\libpng14.dll" /libpath:"..\..\..\zlib\projects\visualc6\Win32_DLL_Release"
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "libpng - Win32 DLL Debug"
|
!ELSEIF "$(CFG)" == "libpng - Win32 DLL Debug"
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ BSC32=bscmake.exe
|
|||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept
|
# ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||||
# ADD LINK32 zlib1d.lib /nologo /dll /debug /machine:I386 /out:"Win32_DLL_Debug\libpng13d.dll" /libpath:"..\..\..\zlib\projects\visualc6\Win32_DLL_Debug"
|
# ADD LINK32 zlib1d.lib /nologo /dll /debug /machine:I386 /out:"Win32_DLL_Debug\libpng14d.dll" /libpath:"..\..\..\zlib\projects\visualc6\Win32_DLL_Debug"
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "libpng - Win32 DLL ASM Release"
|
!ELSEIF "$(CFG)" == "libpng - Win32 DLL ASM Release"
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ BSC32=bscmake.exe
|
|||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 /nologo /dll /machine:I386
|
# ADD BASE LINK32 /nologo /dll /machine:I386
|
||||||
# ADD LINK32 zlib1.lib /nologo /dll /machine:I386 /out:"Win32_DLL_ASM_Release\libpng13.dll" /libpath:"..\..\..\zlib\projects\visualc6\Win32_DLL_ASM_Release"
|
# ADD LINK32 zlib1.lib /nologo /dll /machine:I386 /out:"Win32_DLL_ASM_Release\libpng14.dll" /libpath:"..\..\..\zlib\projects\visualc6\Win32_DLL_ASM_Release"
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "libpng - Win32 DLL ASM Debug"
|
!ELSEIF "$(CFG)" == "libpng - Win32 DLL ASM Debug"
|
||||||
|
|
||||||
@@ -156,7 +156,7 @@ BSC32=bscmake.exe
|
|||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept
|
# ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||||
# ADD LINK32 zlib1d.lib /nologo /dll /debug /machine:I386 /out:"Win32_DLL_ASM_Debug\libpng13d.dll" /libpath:"..\..\..\zlib\projects\visualc6\Win32_DLL_ASM_Debug"
|
# ADD LINK32 zlib1d.lib /nologo /dll /debug /machine:I386 /out:"Win32_DLL_ASM_Debug\libpng14d.dll" /libpath:"..\..\..\zlib\projects\visualc6\Win32_DLL_ASM_Debug"
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "libpng - Win32 DLL VB"
|
!ELSEIF "$(CFG)" == "libpng - Win32 DLL VB"
|
||||||
|
|
||||||
@@ -187,10 +187,10 @@ BSC32=bscmake.exe
|
|||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 /nologo /dll /machine:I386
|
# ADD BASE LINK32 /nologo /dll /machine:I386
|
||||||
# ADD LINK32 zlib1.lib /nologo /dll /machine:I386 /out:"Win32_DLL_VB\libpng13vb.dll" /libpath:"..\..\..\zlib\projects\visualc6\Win32_DLL_Release"
|
# ADD LINK32 zlib1.lib /nologo /dll /machine:I386 /out:"Win32_DLL_VB\libpng14vb.dll" /libpath:"..\..\..\zlib\projects\visualc6\Win32_DLL_Release"
|
||||||
# Begin Special Build Tool
|
# Begin Special Build Tool
|
||||||
OutDir=.\Win32_DLL_VB
|
OutDir=.\Win32_DLL_VB
|
||||||
TargetName=libpng13vb
|
TargetName=libpng14vb
|
||||||
SOURCE="$(InputPath)"
|
SOURCE="$(InputPath)"
|
||||||
PostBuild_Cmds=echo Deleting $(targetname) import library and export file (Not required for VB projects) del $(outdir)\$(targetname).lib del $(outdir)\$(targetname).exp
|
PostBuild_Cmds=echo Deleting $(targetname) import library and export file (Not required for VB projects) del $(outdir)\$(targetname).lib del $(outdir)\$(targetname).exp
|
||||||
# End Special Build Tool
|
# End Special Build Tool
|
||||||
@@ -303,7 +303,7 @@ LIB32=link.exe -lib
|
|||||||
# ADD BASE LIB32 /nologo
|
# ADD BASE LIB32 /nologo
|
||||||
# ADD LIB32 /nologo /out:"Win32_LIB_ASM_Debug\libpngd.lib"
|
# ADD LIB32 /nologo /out:"Win32_LIB_ASM_Debug\libpngd.lib"
|
||||||
|
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
# Begin Target
|
# Begin Target
|
||||||
|
|
||||||
@@ -395,12 +395,12 @@ SOURCE=..\..\pngvcrd.c
|
|||||||
|
|
||||||
!ELSEIF "$(CFG)" == "libpng - Win32 LIB ASM Debug"
|
!ELSEIF "$(CFG)" == "libpng - Win32 LIB ASM Debug"
|
||||||
|
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\..\scripts\pngw32.def
|
SOURCE=..\..\scripts\pngwin.def
|
||||||
|
|
||||||
!IF "$(CFG)" == "libpng - Win32 DLL Release"
|
!IF "$(CFG)" == "libpng - Win32 DLL Release"
|
||||||
|
|
||||||
@@ -430,7 +430,7 @@ SOURCE=..\..\scripts\pngw32.def
|
|||||||
|
|
||||||
# PROP Exclude_From_Build 1
|
# PROP Exclude_From_Build 1
|
||||||
|
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
@@ -461,13 +461,17 @@ SOURCE=..\..\png.h
|
|||||||
|
|
||||||
SOURCE=..\..\pngconf.h
|
SOURCE=..\..\pngconf.h
|
||||||
# End Source File
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\pngpriv.h
|
||||||
|
# End Source File
|
||||||
# End Group
|
# End Group
|
||||||
# Begin Group "Resource Files"
|
# Begin Group "Resource Files"
|
||||||
|
|
||||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\..\scripts\pngw32.rc
|
SOURCE=..\..\scripts\pngwin.rc
|
||||||
|
|
||||||
!IF "$(CFG)" == "libpng - Win32 DLL Release"
|
!IF "$(CFG)" == "libpng - Win32 DLL Release"
|
||||||
|
|
||||||
@@ -495,7 +499,7 @@ SOURCE=..\..\scripts\pngw32.rc
|
|||||||
|
|
||||||
# PROP Exclude_From_Build 1
|
# PROP Exclude_From_Build 1
|
||||||
|
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
# End Source File
|
# End Source File
|
||||||
# End Group
|
# End Group
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ BSC32=bscmake.exe
|
|||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 /nologo /subsystem:console /machine:I386
|
# ADD BASE LINK32 /nologo /subsystem:console /machine:I386
|
||||||
# ADD LINK32 Win32_DLL_Release\libpng13.lib ..\..\..\zlib\projects\visualc6\Win32_DLL_Release\zlib1.lib /nologo /subsystem:console /machine:I386
|
# ADD LINK32 Win32_DLL_Release\libpng14.lib ..\..\..\zlib\projects\visualc6\Win32_DLL_Release\zlib1.lib /nologo /subsystem:console /machine:I386
|
||||||
# Begin Special Build Tool
|
# Begin Special Build Tool
|
||||||
OutDir=.\Win32_DLL_Release
|
OutDir=.\Win32_DLL_Release
|
||||||
SOURCE="$(InputPath)"
|
SOURCE="$(InputPath)"
|
||||||
@@ -90,7 +90,7 @@ BSC32=bscmake.exe
|
|||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
# ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
# ADD LINK32 Win32_DLL_Debug\libpng13d.lib ..\..\..\zlib\projects\visualc6\Win32_DLL_Debug\zlib1d.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
# ADD LINK32 Win32_DLL_Debug\libpng14d.lib ..\..\..\zlib\projects\visualc6\Win32_DLL_Debug\zlib1d.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
# Begin Special Build Tool
|
# Begin Special Build Tool
|
||||||
OutDir=.\Win32_DLL_Debug
|
OutDir=.\Win32_DLL_Debug
|
||||||
SOURCE="$(InputPath)"
|
SOURCE="$(InputPath)"
|
||||||
@@ -122,7 +122,7 @@ BSC32=bscmake.exe
|
|||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 /nologo /subsystem:console /machine:I386
|
# ADD BASE LINK32 /nologo /subsystem:console /machine:I386
|
||||||
# ADD LINK32 Win32_DLL_ASM_Release\libpng13.lib ..\..\..\zlib\projects\visualc6\Win32_DLL_ASM_Release\zlib1.lib /nologo /subsystem:console /machine:I386
|
# ADD LINK32 Win32_DLL_ASM_Release\libpng14.lib ..\..\..\zlib\projects\visualc6\Win32_DLL_ASM_Release\zlib1.lib /nologo /subsystem:console /machine:I386
|
||||||
# Begin Special Build Tool
|
# Begin Special Build Tool
|
||||||
OutDir=.\Win32_DLL_ASM_Release
|
OutDir=.\Win32_DLL_ASM_Release
|
||||||
SOURCE="$(InputPath)"
|
SOURCE="$(InputPath)"
|
||||||
@@ -154,7 +154,7 @@ BSC32=bscmake.exe
|
|||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
# ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
# ADD LINK32 Win32_DLL_ASM_Debug\libpng13d.lib ..\..\..\zlib\projects\visualc6\Win32_DLL_ASM_Debug\zlib1d.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
# ADD LINK32 Win32_DLL_ASM_Debug\libpng14d.lib ..\..\..\zlib\projects\visualc6\Win32_DLL_ASM_Debug\zlib1d.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
# Begin Special Build Tool
|
# Begin Special Build Tool
|
||||||
OutDir=.\Win32_DLL_ASM_Debug
|
OutDir=.\Win32_DLL_ASM_Debug
|
||||||
SOURCE="$(InputPath)"
|
SOURCE="$(InputPath)"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Prevent "Cannot find missing dependency..." warnings while compiling
|
# Prevent "Cannot find missing dependency..." warnings while compiling
|
||||||
# pngw32.rc (PRJ0041).
|
# pngwin.rc (PRJ0041).
|
||||||
|
|
||||||
all: $(IntDir)\alloc.h \
|
all: $(IntDir)\alloc.h \
|
||||||
$(IntDir)\fp.h \
|
$(IntDir)\fp.h \
|
||||||
|
|||||||
@@ -32,11 +32,11 @@ To use:
|
|||||||
|
|
||||||
This project builds the libpng binaries as follows:
|
This project builds the libpng binaries as follows:
|
||||||
|
|
||||||
* Win32_DLL_Release\libpng13.dll DLL build
|
* Win32_DLL_Release\libpng14.dll DLL build
|
||||||
* Win32_DLL_Debug\libpng13d.dll DLL build (debug version)
|
* Win32_DLL_Debug\libpng14d.dll DLL build (debug version)
|
||||||
* Win32_DLL_ASM_Release\libpng13.dll DLL build using ASM code
|
* Win32_DLL_ASM_Release\libpng14.dll DLL build using ASM code
|
||||||
* Win32_DLL_ASM_Debug\libpng13d.dll DLL build using ASM (debug version)
|
* Win32_DLL_ASM_Debug\libpng14d.dll DLL build using ASM (debug version)
|
||||||
* Win32_DLL_VB\libpng13vb.dll DLL build for Visual Basic, using stdcall
|
* Win32_DLL_VB\libpng14vb.dll DLL build for Visual Basic, using stdcall
|
||||||
* Win32_LIB_Release\libpng.lib static build
|
* Win32_LIB_Release\libpng.lib static build
|
||||||
* Win32_LIB_Debug\libpngd.lib static build (debug version)
|
* Win32_LIB_Debug\libpngd.lib static build (debug version)
|
||||||
* Win32_LIB_ASM_Release\libpng.lib static build using ASM code
|
* Win32_LIB_ASM_Release\libpng.lib static build using ASM code
|
||||||
|
|||||||
@@ -30,9 +30,9 @@
|
|||||||
Name="VCCustomBuildTool"/>
|
Name="VCCustomBuildTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
OutputFile="$(OutDir)/libpng13.dll"
|
OutputFile="$(OutDir)/libpng14.dll"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
ModuleDefinitionFile="..\..\scripts\pngw32.def"/>
|
ModuleDefinitionFile="..\..\scripts\pngwin.def"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCMIDLTool"/>
|
Name="VCMIDLTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
@@ -78,8 +78,8 @@
|
|||||||
Name="VCCustomBuildTool"/>
|
Name="VCCustomBuildTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
OutputFile="$(OutDir)/libpng13d.dll"
|
OutputFile="$(OutDir)/libpng14d.dll"
|
||||||
ModuleDefinitionFile="..\..\scripts\pngw32.def"
|
ModuleDefinitionFile="..\..\scripts\pngwin.def"
|
||||||
GenerateDebugInformation="TRUE"/>
|
GenerateDebugInformation="TRUE"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCMIDLTool"/>
|
Name="VCMIDLTool"/>
|
||||||
@@ -126,9 +126,9 @@
|
|||||||
Name="VCCustomBuildTool"/>
|
Name="VCCustomBuildTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
OutputFile="$(OutDir)/libpng13.dll"
|
OutputFile="$(OutDir)/libpng14.dll"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
ModuleDefinitionFile="..\..\scripts\pngw32.def"/>
|
ModuleDefinitionFile="..\..\scripts\pngwin.def"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCMIDLTool"/>
|
Name="VCMIDLTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
@@ -175,8 +175,8 @@
|
|||||||
Name="VCCustomBuildTool"/>
|
Name="VCCustomBuildTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
OutputFile="$(OutDir)/libpng13d.dll"
|
OutputFile="$(OutDir)/libpng14d.dll"
|
||||||
ModuleDefinitionFile="..\..\scripts\pngw32.def"
|
ModuleDefinitionFile="..\..\scripts\pngwin.def"
|
||||||
GenerateDebugInformation="TRUE"/>
|
GenerateDebugInformation="TRUE"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCMIDLTool"/>
|
Name="VCMIDLTool"/>
|
||||||
@@ -224,7 +224,7 @@
|
|||||||
Name="VCCustomBuildTool"/>
|
Name="VCCustomBuildTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
OutputFile="$(OutDir)/libpng13vb.dll"
|
OutputFile="$(OutDir)/libpng14vb.dll"
|
||||||
LinkIncremental="1"/>
|
LinkIncremental="1"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCMIDLTool"/>
|
Name="VCMIDLTool"/>
|
||||||
@@ -597,7 +597,7 @@
|
|||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\scripts\pngw32.def">
|
RelativePath="..\..\scripts\pngwin.def">
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
Name="DLL VB|Win32"
|
Name="DLL VB|Win32"
|
||||||
ExcludedFromBuild="TRUE">
|
ExcludedFromBuild="TRUE">
|
||||||
@@ -651,12 +651,15 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath="..\..\pngconf.h">
|
RelativePath="..\..\pngconf.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\pngpriv.h">
|
||||||
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Resource Files"
|
Name="Resource Files"
|
||||||
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
|
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\scripts\pngw32.rc">
|
RelativePath="..\..\scripts\pngwin.rc">
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
Name="LIB Release|Win32"
|
Name="LIB Release|Win32"
|
||||||
ExcludedFromBuild="TRUE">
|
ExcludedFromBuild="TRUE">
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ $(TargetPath) ..\..\pngtest.png $(IntDir)\pngout.png"
|
|||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
OutputFile="$(OutDir)/pngtest.exe"
|
OutputFile="$(OutDir)/pngtest.exe"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
IgnoreDefaultLibraryNames="$(IntDir)\libpng13vb.lib"
|
IgnoreDefaultLibraryNames="$(IntDir)\libpng14vb.lib"
|
||||||
SubSystem="1"
|
SubSystem="1"
|
||||||
TargetMachine="1"/>
|
TargetMachine="1"/>
|
||||||
<Tool
|
<Tool
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
A set of project files is available for WinCE. Get
|
|
||||||
libpng-1.2.5-project-wince.zip from a libpng distribution
|
|
||||||
site such as http://libpng.sourceforge.net
|
|
||||||
|
|
||||||
Put the zip file in this directory (projects) and then run
|
|
||||||
"unzip -a libpng-1.2.5-project-wince.zip"
|
|
||||||
212
scripts/CMakeLists.txt
Normal file
212
scripts/CMakeLists.txt
Normal file
@@ -0,0 +1,212 @@
|
|||||||
|
project(PNG)
|
||||||
|
|
||||||
|
# Copyright (C) 2007 Glenn Randers-Pehrson
|
||||||
|
# For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
|
||||||
|
set(PNGLIB_MAJOR 1)
|
||||||
|
set(PNGLIB_MINOR 4)
|
||||||
|
set(PNGLIB_RELEASE 0)
|
||||||
|
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
||||||
|
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
|
||||||
|
|
||||||
|
# needed packages
|
||||||
|
find_package(ZLIB REQUIRED)
|
||||||
|
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(NOT M_LIBRARY)
|
||||||
|
else(NOT WIN32)
|
||||||
|
# not needed on windows
|
||||||
|
set(M_LIBRARY "")
|
||||||
|
endif(NOT WIN32)
|
||||||
|
|
||||||
|
|
||||||
|
# COMMAND LINE OPTIONS
|
||||||
|
option(PNG_SHARED "Build shared lib" YES)
|
||||||
|
option(PNG_STATIC "Build static lib" YES)
|
||||||
|
option(PNG_TESTS "Build pngtest" YES)
|
||||||
|
option(PNG_NO_CONSOLE_IO "FIXME" YES)
|
||||||
|
option(PNG_NO_STDIO "FIXME" YES)
|
||||||
|
option(PNG_DEBUG "Build with debug output" YES)
|
||||||
|
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)
|
||||||
|
endif(NOT WIN32)
|
||||||
|
|
||||||
|
option(PNG_MMX "Use MMX assembler code (x86 only)" ${png_asm_tmp})
|
||||||
|
|
||||||
|
# SET LIBNAME
|
||||||
|
# msvc does not append 'lib' - do it here to have consistent name
|
||||||
|
if(MSVC)
|
||||||
|
set(PNG_LIB_NAME lib)
|
||||||
|
endif(MSVC)
|
||||||
|
set(PNG_LIB_NAME ${PNG_LIB_NAME}png${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
||||||
|
|
||||||
|
# to distinguish between debug and release lib
|
||||||
|
set(CMAKE_DEBUG_POSTFIX "d")
|
||||||
|
|
||||||
|
|
||||||
|
# OUR SOURCES
|
||||||
|
set(libpng_sources
|
||||||
|
png.h
|
||||||
|
pngconf.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(-DZLIB_DLL)
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
add_definitions(-DPNG_NO_MODULEDEF -D_CRT_SECURE_NO_DEPRECATE)
|
||||||
|
FILE(WRITE pngdefs.h "#define PNG_USE_PNGVCRD\n")
|
||||||
|
set(libpng_sources ${libpng_sources}
|
||||||
|
pngvcrd.c
|
||||||
|
)
|
||||||
|
else(MSVC)
|
||||||
|
FILE(WRITE pngdefs.h "#define PNG_USE_PNGGCCRD\n")
|
||||||
|
set(libpng_sources ${libpng_sources}
|
||||||
|
pnggccrd.c
|
||||||
|
)
|
||||||
|
endif(MSVC)
|
||||||
|
|
||||||
|
if(NOT MSVC)
|
||||||
|
if(NOT PNG_MMX)
|
||||||
|
FILE(APPEND pngdefs.h "#define PNG_NO_MMX_CODE\n")
|
||||||
|
endif(NOT PNG_MMX)
|
||||||
|
else(NOT MSVC)
|
||||||
|
if(PNG_MMX)
|
||||||
|
# maybe add this to pngconf.h ?
|
||||||
|
FILE(APPEND pngdefs.h "#define PNG_MMX_MMX_CODE_SUPPORTED\n")
|
||||||
|
endif(PNG_MMX)
|
||||||
|
endif(NOT MSVC)
|
||||||
|
|
||||||
|
|
||||||
|
if(PNG_CONSOLE_IO_SUPPORTED)
|
||||||
|
add_definitions(-DPNG_CONSOLE_IO_SUPPORTED)
|
||||||
|
endif(PNG_CONSOLE_IO_SUPPORTED)
|
||||||
|
|
||||||
|
if(PNG_NO_CONSOLE_IO)
|
||||||
|
add_definitions(-DPNG_NO_CONSOLE_IO)
|
||||||
|
endif(PNG_NO_CONSOLE_IO)
|
||||||
|
|
||||||
|
if(PNG_NO_STDIO)
|
||||||
|
add_definitions(-DPNG_NO_STDIO)
|
||||||
|
endif(PNG_NO_STDIO)
|
||||||
|
|
||||||
|
if(PNG_DEBUG)
|
||||||
|
add_definitions(-DPNG_DEBUG)
|
||||||
|
endif(PNG_DEBUG)
|
||||||
|
|
||||||
|
if(NOT M_LIBRARY)
|
||||||
|
add_definitions(-DPNG_NO_FLOATING_POINT_SUPPORTED)
|
||||||
|
endif(NOT M_LIBRARY)
|
||||||
|
|
||||||
|
# NOW BUILD OUR TARGET
|
||||||
|
include_directories(${PNG_SOURCE_DIR} ${ZLIB_INCLUDE_DIR})
|
||||||
|
|
||||||
|
if(PNG_SHARED)
|
||||||
|
add_library(${PNG_LIB_NAME} SHARED ${libpng_sources})
|
||||||
|
target_link_libraries(${PNG_LIB_NAME} ${ZLIB_LIBRARY} ${M_LIBRARY})
|
||||||
|
endif(PNG_SHARED)
|
||||||
|
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})
|
||||||
|
endif(PNG_STATIC)
|
||||||
|
|
||||||
|
if(PNG_SHARED AND WIN32)
|
||||||
|
set_target_properties(${PNG_LIB_NAME} PROPERTIES DEFINE_SYMBOL PNG_BUILD_DLL)
|
||||||
|
endif(PNG_SHARED AND WIN32)
|
||||||
|
|
||||||
|
if(PNG_TESTS)
|
||||||
|
# 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 ${PNG_SOURCE_DIR}/pngtest.png)
|
||||||
|
endif(PNG_TESTS)
|
||||||
|
|
||||||
|
|
||||||
|
# CREATE PKGCONFIG FILES
|
||||||
|
# we use the same files like ./configure, so we have to set its vars
|
||||||
|
set(prefix ${CMAKE_INSTALL_PREFIX})
|
||||||
|
set(exec_prefix ${CMAKE_INSTALL_PREFIX})
|
||||||
|
set(libdir ${CMAKE_INSTALL_PREFIX}/lib)
|
||||||
|
set(includedir ${CMAKE_INSTALL_PREFIX}/include)
|
||||||
|
|
||||||
|
configure_file(${PNG_SOURCE_DIR}/scripts/libpng.pc.in
|
||||||
|
${PNG_BINARY_DIR}/libpng.pc)
|
||||||
|
configure_file(${PNG_SOURCE_DIR}/scripts/libpng-config.in
|
||||||
|
${PNG_BINARY_DIR}/libpng-config)
|
||||||
|
configure_file(${PNG_SOURCE_DIR}/scripts/libpng.pc.in
|
||||||
|
${PNG_BINARY_DIR}/${PNGLIB_NAME}.pc)
|
||||||
|
configure_file(${PNG_SOURCE_DIR}/scripts/libpng-config.in
|
||||||
|
${PNG_BINARY_DIR}/${PNGLIB_NAME}-config)
|
||||||
|
|
||||||
|
# SET UP LINKS
|
||||||
|
set_target_properties(${PNG_LIB_NAME} PROPERTIES
|
||||||
|
# VERSION 0.${PNGLIB_RELEASE}.1.4.0beta49
|
||||||
|
VERSION 0.${PNGLIB_RELEASE}.0
|
||||||
|
SOVERSION 0
|
||||||
|
CLEAN_DIRECT_OUTPUT 1)
|
||||||
|
set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES
|
||||||
|
OUTPUT_NAME ${PNG_LIB_NAME}
|
||||||
|
CLEAN_DIRECT_OUTPUT 1)
|
||||||
|
|
||||||
|
# INSTALL
|
||||||
|
install_targets(/lib ${PNG_LIB_NAME} ${PNG_LIB_NAME_STATIC})
|
||||||
|
install(FILES png.h pngconf.h pngpriv.h pngdefs.h DESTINATION include)
|
||||||
|
install(FILES png.h pngconf.h pngpriv.h pngdefs.h DESTINATION include/${PNGLIB_NAME})
|
||||||
|
install(FILES libpng.3 libpngpf.3 DESTINATION man/man3)
|
||||||
|
install(FILES png.5 DESTINATION man/man5)
|
||||||
|
install(FILES ${PNG_BINARY_DIR}/libpng.pc DESTINATION lib/pkgconfig)
|
||||||
|
install(FILES ${PNG_BINARY_DIR}/libpng-config DESTINATION bin)
|
||||||
|
install(FILES ${PNG_BINARY_DIR}/${PNGLIB_NAME}.pc DESTINATION lib/pkgconfig)
|
||||||
|
install(FILES ${PNG_BINARY_DIR}/${PNGLIB_NAME}-config DESTINATION bin)
|
||||||
|
|
||||||
|
# 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
|
||||||
@@ -15,9 +15,12 @@ OBJS = png.obj, pngset.obj, pngget.obj, pngrutil.obj, pngtrans.obj,\
|
|||||||
|
|
||||||
CFLAGS= $(C_DEB) $(CC_DEFS) $(PREF)
|
CFLAGS= $(C_DEB) $(CC_DEFS) $(PREF)
|
||||||
|
|
||||||
all : pngtest.exe libpng.olb
|
all : pngtest.exe libpng.olb pngdefs.h
|
||||||
@ write sys$output " pngtest available"
|
@ write sys$output " pngtest available"
|
||||||
|
|
||||||
|
pngdefs.h:
|
||||||
|
echo "/* pngdefs.h was built by MMS */" > pngdefs.h
|
||||||
|
|
||||||
libpng.olb : libpng.olb($(OBJS))
|
libpng.olb : libpng.olb($(OBJS))
|
||||||
@ write sys$output " Libpng available"
|
@ write sys$output " Libpng available"
|
||||||
|
|
||||||
@@ -29,24 +32,23 @@ test : pngtest.exe
|
|||||||
run pngtest
|
run pngtest
|
||||||
|
|
||||||
clean :
|
clean :
|
||||||
delete *.obj;*,*.exe;*
|
delete *.obj;*,*.exe;*,pngdefs.h
|
||||||
|
|
||||||
|
|
||||||
# Other dependencies.
|
# Other dependencies.
|
||||||
png.obj : png.h, pngconf.h
|
png.obj : png.h, pngconf.h, pngdefs.h, pngpriv.h
|
||||||
pngpread.obj : png.h, pngconf.h
|
pngpread.obj : png.h, pngconf.h, pngdefs.h, pngpriv.h
|
||||||
pngset.obj : png.h, pngconf.h
|
pngset.obj : png.h, pngconf.h, pngdefs.h, pngpriv.h
|
||||||
pngget.obj : png.h, pngconf.h
|
pngget.obj : png.h, pngconf.h, pngdefs.h, pngpriv.h
|
||||||
pngread.obj : png.h, pngconf.h
|
pngread.obj : png.h, pngconf.h, pngdefs.h, pngpriv.h
|
||||||
pngrtran.obj : png.h, pngconf.h
|
pngrtran.obj : png.h, pngconf.h, pngdefs.h, pngpriv.h
|
||||||
pngrutil.obj : png.h, pngconf.h
|
pngrutil.obj : png.h, pngconf.h, pngdefs.h, pngpriv.h
|
||||||
pngerror.obj : png.h, pngconf.h
|
pngerror.obj : png.h, pngconf.h, pngdefs.h, pngpriv.h
|
||||||
pngmem.obj : png.h, pngconf.h
|
pngmem.obj : png.h, pngconf.h, pngdefs.h, pngpriv.h
|
||||||
pngrio.obj : png.h, pngconf.h
|
pngrio.obj : png.h, pngconf.h, pngdefs.h, pngpriv.h
|
||||||
pngwio.obj : png.h, pngconf.h
|
pngwio.obj : png.h, pngconf.h, pngdefs.h, pngpriv.h
|
||||||
pngtest.obj : png.h, pngconf.h
|
pngtrans.obj : png.h, pngconf.h, pngdefs.h, pngpriv.h
|
||||||
pngtrans.obj : png.h, pngconf.h
|
pngwrite.obj : png.h, pngconf.h, pngdefs.h, pngpriv.h
|
||||||
pngwrite.obj : png.h, pngconf.h
|
pngwtran.obj : png.h, pngconf.h, pngdefs.h, pngpriv.h
|
||||||
pngwtran.obj : png.h, pngconf.h
|
pngwutil.obj : png.h, pngconf.h, pngdefs.h, pngpriv.h
|
||||||
pngwutil.obj : png.h, pngconf.h
|
pngtest.obj : png.h, pngconf.h, pngdefs.h
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
# Modeled after libxml-config.
|
# Modeled after libxml-config.
|
||||||
|
|
||||||
version=1.2.10rc1
|
version=1.4.0beta49
|
||||||
prefix=""
|
prefix=""
|
||||||
libdir=""
|
libdir=""
|
||||||
libs=""
|
libs=""
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# 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
|
# For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
|
||||||
# Modeled after libxml-config.
|
# Modeled after libxml-config.
|
||||||
@@ -12,14 +12,14 @@ 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=""
|
||||||
cppflags=""
|
cppflags=""
|
||||||
ccopts=""
|
ccopts="@LIBPNG_NO_MMX@"
|
||||||
ldopts=""
|
ldopts=""
|
||||||
|
|
||||||
usage()
|
usage()
|
||||||
|
|||||||
11
scripts/libpng.pc-configure.in
Normal file
11
scripts/libpng.pc-configure.in
Normal 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} @LIBPNG_NO_MMX@
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
prefix=@prefix@
|
prefix=@prefix@
|
||||||
exec_prefix=@exec_prefix@
|
exec_prefix=@exec_prefix@
|
||||||
libdir=@libdir@
|
libdir=@libdir@
|
||||||
includedir=@includedir@/libpng@PNGLIB_MAJOR@
|
includedir=@includedir@/libpng14
|
||||||
|
|
||||||
Name: libpng
|
Name: libpng
|
||||||
Description: Loads and saves PNG files
|
Description: Loads and saves PNG files
|
||||||
Version: @PNGLIB_VERSION@
|
Version: 1.4.0beta49
|
||||||
Libs: -L${libdir} -lpng@PNGLIB_MAJOR@
|
Libs: -L${libdir} -lpng14
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
|||||||
@@ -6,9 +6,9 @@
|
|||||||
# For conditions of distribution and use, see copyright notice in png.h
|
# For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
|
||||||
# Library name:
|
# Library name:
|
||||||
LIBNAME=libpng12
|
LIBNAME=libpng14
|
||||||
PNGMAJ = 0
|
PNGMAJ = 14
|
||||||
PNGMIN = 1.2.10rc1
|
PNGMIN = 1.4.0beta49
|
||||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
|
||||||
# Shared library names:
|
# Shared library names:
|
||||||
@@ -16,8 +16,6 @@ LIBSO=$(LIBNAME).so
|
|||||||
LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
|
LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
|
||||||
LIBSOVER=$(LIBNAME).so.$(PNGVER)
|
LIBSOVER=$(LIBNAME).so.$(PNGVER)
|
||||||
OLDSO=libpng.so
|
OLDSO=libpng.so
|
||||||
OLDSOMAJ=libpng.so.0
|
|
||||||
OLDSOVER=libpng.so.0.$(PNGMIN)
|
|
||||||
|
|
||||||
# Utilities:
|
# Utilities:
|
||||||
CC=cc
|
CC=cc
|
||||||
@@ -30,7 +28,7 @@ RM_F=/bin/rm -f
|
|||||||
SUN_CC_FLAGS=-fast -xtarget=ultra
|
SUN_CC_FLAGS=-fast -xtarget=ultra
|
||||||
SUN_LD_FLAGS=-fast -xtarget=ultra
|
SUN_LD_FLAGS=-fast -xtarget=ultra
|
||||||
|
|
||||||
# where make install puts libpng.a, libpng12.so and libpng12/png.h
|
# where make install puts libpng.a, libpng14.so and libpng14/png.h
|
||||||
prefix=/a
|
prefix=/a
|
||||||
exec_prefix=$(prefix)
|
exec_prefix=$(prefix)
|
||||||
|
|
||||||
@@ -81,7 +79,10 @@ OBJSDLL = $(OBJS:.o=.pic.o)
|
|||||||
.c.pic.o:
|
.c.pic.o:
|
||||||
$(CC) -c $(CFLAGS) -KPIC -o $@ $*.c
|
$(CC) -c $(CFLAGS) -KPIC -o $@ $*.c
|
||||||
|
|
||||||
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
|
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config pngdefs.h
|
||||||
|
|
||||||
|
pngdefs.h:
|
||||||
|
echo "/* pngdefs.h was built by makefile.32sunu */" > pngdefs.h
|
||||||
|
|
||||||
libpng.a: $(OBJS)
|
libpng.a: $(OBJS)
|
||||||
$(AR_RC) $@ $(OBJS)
|
$(AR_RC) $@ $(OBJS)
|
||||||
@@ -99,7 +100,7 @@ libpng-config:
|
|||||||
echo R_opts=\"-R$(LIBPATH)\"; \
|
echo R_opts=\"-R$(LIBPATH)\"; \
|
||||||
echo ccopts=\"-xtarget=ultra\"; \
|
echo ccopts=\"-xtarget=ultra\"; \
|
||||||
echo ldopts=\"-xtarget=ultra\"; \
|
echo ldopts=\"-xtarget=ultra\"; \
|
||||||
echo libs=\"-lpng12 -lz -lm\"; \
|
echo libs=\"-lpng14 -lz -lm\"; \
|
||||||
cat scripts/libpng-config-body.in ) > libpng-config
|
cat scripts/libpng-config-body.in ) > libpng-config
|
||||||
chmod +x libpng-config
|
chmod +x libpng-config
|
||||||
|
|
||||||
@@ -125,22 +126,19 @@ $(LIBSOVER): $(OBJSDLL)
|
|||||||
$(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h $(LIBSOMAJ) \
|
$(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h $(LIBSOMAJ) \
|
||||||
-o $(LIBSOVER) $(OBJSDLL)
|
-o $(LIBSOVER) $(OBJSDLL)
|
||||||
|
|
||||||
$(OLDSOVER): $(OBJSDLL)
|
|
||||||
$(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h $(OLDSOMAJ) \
|
|
||||||
-o $(OLDSOVER) $(OBJSDLL)
|
|
||||||
|
|
||||||
pngtest: pngtest.o $(LIBSO)
|
pngtest: pngtest.o $(LIBSO)
|
||||||
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
|
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
|
||||||
|
|
||||||
test: pngtest
|
test: pngtest
|
||||||
./pngtest
|
./pngtest
|
||||||
|
|
||||||
install-headers: png.h pngconf.h
|
install-headers: png.h pngconf.h pngdefs.h
|
||||||
-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
|
-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
|
||||||
-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
|
-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
|
||||||
cp png.h pngconf.h $(DI)/$(LIBNAME)
|
cp png.h pngconf.h pngdefs.h $(DI)/$(LIBNAME)
|
||||||
chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
|
chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
|
||||||
-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
|
chmod 644 $(DI)/$(LIBNAME)/pngdefs.h
|
||||||
|
-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pngdefs.h
|
||||||
-@$(RM_F) $(DI)/libpng
|
-@$(RM_F) $(DI)/libpng
|
||||||
(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
|
(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
|
||||||
|
|
||||||
@@ -151,24 +149,18 @@ install-static: install-headers libpng.a
|
|||||||
-@$(RM_F) $(DL)/libpng.a
|
-@$(RM_F) $(DL)/libpng.a
|
||||||
(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
|
(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
|
||||||
|
|
||||||
install-shared: install-headers $(LIBSOVER) libpng.pc \
|
install-shared: install-headers $(LIBSOVER) libpng.pc
|
||||||
$(OLDSOVER)
|
|
||||||
-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
|
-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
|
||||||
-@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
|
-@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
|
||||||
-@$(RM_F) $(DL)/$(LIBSOMAJ)
|
-@$(RM_F) $(DL)/$(LIBSOMAJ)
|
||||||
-@$(RM_F) $(DL)/$(LIBSO)
|
-@$(RM_F) $(DL)/$(LIBSO)
|
||||||
-@$(RM_F) $(DL)/$(OLDSO)
|
-@$(RM_F) $(DL)/$(OLDSO)
|
||||||
-@$(RM_F) $(DL)/$(OLDSOMAJ)
|
|
||||||
-@$(RM_F) $(DL)/$(OLDSOMAJ).$(PNGVER)*
|
|
||||||
cp $(LIBSOVER) $(DL)
|
cp $(LIBSOVER) $(DL)
|
||||||
cp $(OLDSOVER) $(DL)
|
|
||||||
chmod 755 $(DL)/$(LIBSOVER)
|
chmod 755 $(DL)/$(LIBSOVER)
|
||||||
chmod 755 $(DL)/$(OLDSOVER)
|
|
||||||
(cd $(DL); \
|
(cd $(DL); \
|
||||||
$(LN_SF) $(OLDSOVER) $(OLDSOMAJ); \
|
|
||||||
$(LN_SF) $(OLDSOMAJ) $(OLDSO); \
|
|
||||||
$(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
|
$(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
|
||||||
$(LN_SF) $(LIBSOMAJ) $(LIBSO))
|
$(LN_SF) $(LIBSOMAJ) $(LIBSO); \
|
||||||
|
$(LN_SF) $(OLDSO) $(LIBSO))
|
||||||
-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
|
-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
|
||||||
-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
|
-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
|
||||||
-@$(RM_F) $(DL)/pkgconfig/libpng.pc
|
-@$(RM_F) $(DL)/pkgconfig/libpng.pc
|
||||||
@@ -222,8 +214,7 @@ test-installed:
|
|||||||
clean:
|
clean:
|
||||||
$(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
|
$(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
|
||||||
libpng-config $(LIBSO) $(LIBSOMAJ)* \
|
libpng-config $(LIBSO) $(LIBSOMAJ)* \
|
||||||
$(OLDSOVER) \
|
libpng.pc pngdefs.h
|
||||||
libpng.pc
|
|
||||||
|
|
||||||
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
|
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
|
||||||
writelock:
|
writelock:
|
||||||
@@ -231,20 +222,20 @@ writelock:
|
|||||||
|
|
||||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||||
|
|
||||||
png.o png.pic.o: png.h pngconf.h
|
png.o png.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
pngerror.o pngerror.pic.o: png.h pngconf.h
|
pngerror.o pngerror.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
pngrio.o pngrio.pic.o: png.h pngconf.h
|
pngrio.o pngrio.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
pngwio.o pngwio.pic.o: png.h pngconf.h
|
pngwio.o pngwio.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
pngmem.o pngmem.pic.o: png.h pngconf.h
|
pngmem.o pngmem.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
pngset.o pngset.pic.o: png.h pngconf.h
|
pngset.o pngset.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
pngget.o pngget.pic.o: png.h pngconf.h
|
pngget.o pngget.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
pngread.o pngread.pic.o: png.h pngconf.h
|
pngread.o pngread.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
pngrtran.o pngrtran.pic.o: png.h pngconf.h
|
pngrtran.o pngrtran.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
pngrutil.o pngrutil.pic.o: png.h pngconf.h
|
pngrutil.o pngrutil.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
pngtrans.o pngtrans.pic.o: png.h pngconf.h
|
pngtrans.o pngtrans.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
pngwrite.o pngwrite.pic.o: png.h pngconf.h
|
pngwrite.o pngwrite.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
pngwtran.o pngwtran.pic.o: png.h pngconf.h
|
pngwtran.o pngwtran.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
pngwutil.o pngwutil.pic.o: png.h pngconf.h
|
pngwutil.o pngwutil.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
pngpread.o pngpread.pic.o: png.h pngconf.h
|
pngpread.o pngpread.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
|
|
||||||
pngtest.o: png.h pngconf.h
|
pngtest.o: png.h pngconf.h pngdefs.h
|
||||||
|
|||||||
@@ -6,9 +6,9 @@
|
|||||||
# For conditions of distribution and use, see copyright notice in png.h
|
# For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
|
||||||
# Library name:
|
# Library name:
|
||||||
LIBNAME=libpng12
|
LIBNAME=libpng14
|
||||||
PNGMAJ = 0
|
PNGMAJ = 14
|
||||||
PNGMIN = 1.2.10rc1
|
PNGMIN = 1.4.0beta49
|
||||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
|
||||||
# Shared library names:
|
# Shared library names:
|
||||||
@@ -16,8 +16,6 @@ LIBSO=$(LIBNAME).so
|
|||||||
LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
|
LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
|
||||||
LIBSOVER=$(LIBNAME).so.$(PNGVER)
|
LIBSOVER=$(LIBNAME).so.$(PNGVER)
|
||||||
OLDSO=libpng.so
|
OLDSO=libpng.so
|
||||||
OLDSOMAJ=libpng.so.0
|
|
||||||
OLDSOVER=libpng.so.0.$(PNGMIN)
|
|
||||||
|
|
||||||
# Utilities:
|
# Utilities:
|
||||||
CC=cc
|
CC=cc
|
||||||
@@ -30,7 +28,7 @@ RM_F=/bin/rm -f
|
|||||||
SUN_CC_FLAGS=-fast -xtarget=ultra -xarch=v9
|
SUN_CC_FLAGS=-fast -xtarget=ultra -xarch=v9
|
||||||
SUN_LD_FLAGS=-fast -xtarget=ultra -xarch=v9
|
SUN_LD_FLAGS=-fast -xtarget=ultra -xarch=v9
|
||||||
|
|
||||||
# where make install puts libpng.a, libpng12.so and libpng12/png.h
|
# where make install puts libpng.a, libpng14.so and libpng14/png.h
|
||||||
prefix=/a
|
prefix=/a
|
||||||
exec_prefix=$(prefix)
|
exec_prefix=$(prefix)
|
||||||
|
|
||||||
@@ -48,7 +46,7 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
|||||||
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
|
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
|
||||||
CFLAGS=-I$(ZLIBINC) $(SUN_CC_FLAGS) \
|
CFLAGS=-I$(ZLIBINC) $(SUN_CC_FLAGS) \
|
||||||
# $(WARNMORE) -g -DPNG_DEBUG=5
|
# $(WARNMORE) -g -DPNG_DEBUG=5
|
||||||
LDFLAGS=-L. -R. $(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng12 -lz -lm
|
LDFLAGS=-L. -R. $(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng14 -lz -lm
|
||||||
|
|
||||||
INCPATH=$(prefix)/include
|
INCPATH=$(prefix)/include
|
||||||
LIBPATH=$(exec_prefix)/lib
|
LIBPATH=$(exec_prefix)/lib
|
||||||
@@ -81,7 +79,10 @@ OBJSDLL = $(OBJS:.o=.pic.o)
|
|||||||
.c.pic.o:
|
.c.pic.o:
|
||||||
$(CC) -c $(CFLAGS) -KPIC -o $@ $*.c
|
$(CC) -c $(CFLAGS) -KPIC -o $@ $*.c
|
||||||
|
|
||||||
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
|
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config pngdefs.h
|
||||||
|
|
||||||
|
pngdefs.h:
|
||||||
|
echo "/* pngdefs.h was built by makefile.64sunu */" > pngdefs.h
|
||||||
|
|
||||||
libpng.a: $(OBJS)
|
libpng.a: $(OBJS)
|
||||||
$(AR_RC) $@ $(OBJS)
|
$(AR_RC) $@ $(OBJS)
|
||||||
@@ -99,7 +100,7 @@ libpng-config:
|
|||||||
echo R_opts=\"-R$(LIBPATH)\"; \
|
echo R_opts=\"-R$(LIBPATH)\"; \
|
||||||
echo ccopts=\"-xtarget=ultra -xarch=v9\"; \
|
echo ccopts=\"-xtarget=ultra -xarch=v9\"; \
|
||||||
echo ldopts=\"-xtarget=ultra -xarch=v9\"; \
|
echo ldopts=\"-xtarget=ultra -xarch=v9\"; \
|
||||||
echo libs=\"-lpng12 -lz -lm\"; \
|
echo libs=\"-lpng14 -lz -lm\"; \
|
||||||
cat scripts/libpng-config-body.in ) > libpng-config
|
cat scripts/libpng-config-body.in ) > libpng-config
|
||||||
chmod +x libpng-config
|
chmod +x libpng-config
|
||||||
|
|
||||||
@@ -125,22 +126,19 @@ $(LIBSOVER): $(OBJSDLL)
|
|||||||
$(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h $(LIBSOMAJ) \
|
$(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h $(LIBSOMAJ) \
|
||||||
-o $(LIBSOVER) $(OBJSDLL)
|
-o $(LIBSOVER) $(OBJSDLL)
|
||||||
|
|
||||||
$(OLDSOVER): $(OBJSDLL)
|
|
||||||
$(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h $(OLDSOMAJ) \
|
|
||||||
-o $(OLDSOVER) $(OBJSDLL)
|
|
||||||
|
|
||||||
pngtest: pngtest.o $(LIBSO)
|
pngtest: pngtest.o $(LIBSO)
|
||||||
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
|
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
|
||||||
|
|
||||||
test: pngtest
|
test: pngtest
|
||||||
./pngtest
|
./pngtest
|
||||||
|
|
||||||
install-headers: png.h pngconf.h
|
install-headers: png.h pngconf.h pngdefs.h
|
||||||
-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
|
-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
|
||||||
-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
|
-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
|
||||||
cp png.h pngconf.h $(DI)/$(LIBNAME)
|
cp png.h pngconf.h pngdefs.h $(DI)/$(LIBNAME)
|
||||||
chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
|
chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
|
||||||
-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
|
chmod 644 $(DI)/$(LIBNAME)/pngdefs.h
|
||||||
|
-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pngdefs.h
|
||||||
-@$(RM_F) $(DI)/libpng
|
-@$(RM_F) $(DI)/libpng
|
||||||
(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
|
(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
|
||||||
|
|
||||||
@@ -151,24 +149,18 @@ install-static: install-headers libpng.a
|
|||||||
-@$(RM_F) $(DL)/libpng.a
|
-@$(RM_F) $(DL)/libpng.a
|
||||||
(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
|
(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
|
||||||
|
|
||||||
install-shared: install-headers $(LIBSOVER) libpng.pc \
|
install-shared: install-headers $(LIBSOVER) libpng.pc
|
||||||
$(OLDSOVER)
|
|
||||||
-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
|
-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
|
||||||
-@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
|
-@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
|
||||||
-@$(RM_F) $(DL)/$(LIBSOMAJ)
|
-@$(RM_F) $(DL)/$(LIBSOMAJ)
|
||||||
-@$(RM_F) $(DL)/$(LIBSO)
|
-@$(RM_F) $(DL)/$(LIBSO)
|
||||||
-@$(RM_F) $(DL)/$(OLDSO)
|
-@$(RM_F) $(DL)/$(OLDSO)
|
||||||
-@$(RM_F) $(DL)/$(OLDSOMAJ)
|
|
||||||
-@$(RM_F) $(DL)/$(OLDSOMAJ).$(PNGVER)*
|
|
||||||
cp $(LIBSOVER) $(DL)
|
cp $(LIBSOVER) $(DL)
|
||||||
cp $(OLDSOVER) $(DL)
|
|
||||||
chmod 755 $(DL)/$(LIBSOVER)
|
chmod 755 $(DL)/$(LIBSOVER)
|
||||||
chmod 755 $(DL)/$(OLDSOVER)
|
|
||||||
(cd $(DL); \
|
(cd $(DL); \
|
||||||
$(LN_SF) $(OLDSOVER) $(OLDSOMAJ); \
|
|
||||||
$(LN_SF) $(OLDSOMAJ) $(OLDSO); \
|
|
||||||
$(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
|
$(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
|
||||||
$(LN_SF) $(LIBSOMAJ) $(LIBSO))
|
$(LN_SF) $(LIBSOMAJ) $(LIBSO); \
|
||||||
|
$(LN_SF) $(OLDSO) $(LIBSO))
|
||||||
-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
|
-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
|
||||||
-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
|
-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
|
||||||
-@$(RM_F) $(DL)/pkgconfig/libpng.pc
|
-@$(RM_F) $(DL)/pkgconfig/libpng.pc
|
||||||
@@ -222,8 +214,7 @@ test-installed:
|
|||||||
clean:
|
clean:
|
||||||
$(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
|
$(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
|
||||||
libpng-config $(LIBSO) $(LIBSOMAJ)* \
|
libpng-config $(LIBSO) $(LIBSOMAJ)* \
|
||||||
$(OLDSOVER) \
|
libpng.pc pngdefs.h
|
||||||
libpng.pc
|
|
||||||
|
|
||||||
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
|
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
|
||||||
writelock:
|
writelock:
|
||||||
@@ -231,20 +222,20 @@ writelock:
|
|||||||
|
|
||||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||||
|
|
||||||
png.o png.pic.o: png.h pngconf.h
|
png.o png.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
pngerror.o pngerror.pic.o: png.h pngconf.h
|
pngerror.o pngerror.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
pngrio.o pngrio.pic.o: png.h pngconf.h
|
pngrio.o pngrio.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
pngwio.o pngwio.pic.o: png.h pngconf.h
|
pngwio.o pngwio.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
pngmem.o pngmem.pic.o: png.h pngconf.h
|
pngmem.o pngmem.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
pngset.o pngset.pic.o: png.h pngconf.h
|
pngset.o pngset.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
pngget.o pngget.pic.o: png.h pngconf.h
|
pngget.o pngget.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
pngread.o pngread.pic.o: png.h pngconf.h
|
pngread.o pngread.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
pngrtran.o pngrtran.pic.o: png.h pngconf.h
|
pngrtran.o pngrtran.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
pngrutil.o pngrutil.pic.o: png.h pngconf.h
|
pngrutil.o pngrutil.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
pngtrans.o pngtrans.pic.o: png.h pngconf.h
|
pngtrans.o pngtrans.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
pngwrite.o pngwrite.pic.o: png.h pngconf.h
|
pngwrite.o pngwrite.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
pngwtran.o pngwtran.pic.o: png.h pngconf.h
|
pngwtran.o pngwtran.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
pngwutil.o pngwutil.pic.o: png.h pngconf.h
|
pngwutil.o pngwutil.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
pngpread.o pngpread.pic.o: png.h pngconf.h
|
pngpread.o pngpread.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
|
||||||
|
|
||||||
pngtest.o: png.h pngconf.h
|
pngtest.o: png.h pngconf.h pngdefs.h
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ CMHGflags =
|
|||||||
LibFileflags = -c -l -o $@
|
LibFileflags = -c -l -o $@
|
||||||
Squeezeflags = -o $@
|
Squeezeflags = -o $@
|
||||||
|
|
||||||
|
|
||||||
# Final targets:
|
# Final targets:
|
||||||
@.libpng-lib: @.o.png @.o.pngerror @.o.pngrio @.o.pngwio @.o.pngmem \
|
@.libpng-lib: @.o.png @.o.pngerror @.o.pngrio @.o.pngwio @.o.pngmem \
|
||||||
@.o.pngpread @.o.pngset @.o.pngget @.o.pngread @.o.pngrtran \
|
@.o.pngpread @.o.pngset @.o.pngget @.o.pngread @.o.pngrtran \
|
||||||
@@ -37,6 +36,11 @@ Test: @.pngtest
|
|||||||
@.pngtest: @.o.pngtest @.libpng-lib C:o.Stubs Zlib:zlib_lib
|
@.pngtest: @.o.pngtest @.libpng-lib C:o.Stubs Zlib:zlib_lib
|
||||||
Link $(Linkflags) @.o.pngtest @.libpng-lib C:o.Stubs Zlib:zlib_lib
|
Link $(Linkflags) @.o.pngtest @.libpng-lib C:o.Stubs Zlib:zlib_lib
|
||||||
|
|
||||||
|
all: pngdefs.h
|
||||||
|
|
||||||
|
pngdefs.h:
|
||||||
|
echo "/* pngdefs.h was built by makefile.acorn */" > pngdefs.h
|
||||||
|
|
||||||
.SUFFIXES: .o .mm .c
|
.SUFFIXES: .o .mm .c
|
||||||
|
|
||||||
.c.mm:
|
.c.mm:
|
||||||
@@ -47,5 +51,4 @@ Test: @.pngtest
|
|||||||
|
|
||||||
# Static dependencies:
|
# Static dependencies:
|
||||||
|
|
||||||
|
|
||||||
# Dynamic dependencies:
|
# Dynamic dependencies:
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ RANLIB = ranlib
|
|||||||
RM_F = rm -f
|
RM_F = rm -f
|
||||||
LN_SF = ln -f -s
|
LN_SF = ln -f -s
|
||||||
|
|
||||||
LIBNAME=libpng12
|
LIBNAME=libpng14
|
||||||
PNGMAJ = 0
|
PNGMAJ = 14
|
||||||
PNGMIN = 1.2.10rc1
|
PNGMIN = 1.4.0beta49
|
||||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
|
||||||
prefix=/usr/local
|
prefix=/usr/local
|
||||||
@@ -44,9 +44,9 @@ CDEBUG = -g -DPNG_DEBUG=5
|
|||||||
LDDEBUG =
|
LDDEBUG =
|
||||||
CRELEASE = -O2
|
CRELEASE = -O2
|
||||||
LDRELEASE = -s
|
LDRELEASE = -s
|
||||||
WARNMORE=-Wall
|
WARNMORE=-W -Wall
|
||||||
CFLAGS = -I$(ZLIBINC) $(WARNMORE) $(CRELEASE)
|
CFLAGS = -I$(ZLIBINC) $(WARNMORE) $(CRELEASE)
|
||||||
LDFLAGS = -L. -L$(ZLIBLIB) -lpng12 -lz -lm $(LDRELEASE)
|
LDFLAGS = -L. -L$(ZLIBLIB) -lpng14 -lz -lm $(LDRELEASE)
|
||||||
|
|
||||||
# File extensions
|
# File extensions
|
||||||
O=.o
|
O=.o
|
||||||
@@ -56,10 +56,14 @@ E=
|
|||||||
# Variables
|
# Variables
|
||||||
OBJS = png$(O) pngerror$(O) pngget$(O) pngmem$(O) pngpread$(O) \
|
OBJS = png$(O) pngerror$(O) pngget$(O) pngmem$(O) pngpread$(O) \
|
||||||
pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) pngset$(O) \
|
pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) pngset$(O) \
|
||||||
pngtrans$(O) pngwio$(O) pngwrite$(O) pngwtran$(O) pngwutil$(O)
|
pngtrans$(O) pngwio$(O) pngwrite$(O) pngwtran$(O) pngwutil$(O) \
|
||||||
|
pnggccrd$(O)
|
||||||
|
|
||||||
# Targets
|
# Targets
|
||||||
all: $(LIBNAME)$(A) pngtest$(E)
|
all: $(LIBNAME)$(A) pngtest$(E) pngdefs.h
|
||||||
|
|
||||||
|
pngdefs.h:
|
||||||
|
echo "/* pngdefs.h was built by makefile.aix */" > pngdefs.h
|
||||||
|
|
||||||
$(LIBNAME)$(A): $(OBJS)
|
$(LIBNAME)$(A): $(OBJS)
|
||||||
$(AR_RC) $@ $(OBJS)
|
$(AR_RC) $@ $(OBJS)
|
||||||
@@ -94,20 +98,21 @@ install: $(LIBNAME)$(A)
|
|||||||
clean:
|
clean:
|
||||||
$(RM_F) *.o $(LIBNAME)$(A) pngtest pngout.png
|
$(RM_F) *.o $(LIBNAME)$(A) pngtest pngout.png
|
||||||
|
|
||||||
png$(O): png.h pngconf.h
|
png$(O): png.h pngconf.h pngpriv.h
|
||||||
pngerror$(O): png.h pngconf.h
|
pngerror$(O): png.h pngconf.h pngpriv.h
|
||||||
pngget$(O): png.h pngconf.h
|
pnggccrd$(O): png.h pngconf.h pngpriv.h
|
||||||
pngmem$(O): png.h pngconf.h
|
pngget$(O): png.h pngconf.h pngpriv.h
|
||||||
pngpread$(O): png.h pngconf.h
|
pngmem$(O): png.h pngconf.h pngpriv.h
|
||||||
pngread$(O): png.h pngconf.h
|
pngpread$(O): png.h pngconf.h pngpriv.h
|
||||||
pngrio$(O): png.h pngconf.h
|
pngread$(O): png.h pngconf.h pngpriv.h
|
||||||
pngrtran$(O): png.h pngconf.h
|
pngrio$(O): png.h pngconf.h pngpriv.h
|
||||||
pngrutil$(O): png.h pngconf.h
|
pngrtran$(O): png.h pngconf.h pngpriv.h
|
||||||
pngset$(O): png.h pngconf.h
|
pngrutil$(O): png.h pngconf.h pngpriv.h
|
||||||
pngtest$(O): png.h pngconf.h
|
pngset$(O): png.h pngconf.h pngpriv.h
|
||||||
pngtrans$(O): png.h pngconf.h
|
pngtest$(O): png.h pngconf.h pngpriv.h
|
||||||
pngwio$(O): png.h pngconf.h
|
pngtrans$(O): png.h pngconf.h pngpriv.h
|
||||||
pngwrite$(O): png.h pngconf.h
|
pngwio$(O): png.h pngconf.h pngpriv.h
|
||||||
pngwtran$(O): png.h pngconf.h
|
pngwrite$(O): png.h pngconf.h pngpriv.h
|
||||||
pngwutil$(O): png.h pngconf.h
|
pngwtran$(O): png.h pngconf.h pngpriv.h
|
||||||
|
pngwutil$(O): png.h pngconf.h pngpriv.h
|
||||||
|
pngtest$(O): png.h pngconf.h
|
||||||
|
|||||||
@@ -32,7 +32,10 @@ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
|||||||
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
||||||
pngwtran.o pngmem.o pngerror.o pngpread.o
|
pngwtran.o pngmem.o pngerror.o pngpread.o
|
||||||
|
|
||||||
all: libpng.lib pngtest
|
all: libpng.lib pngtest pngdefs.h
|
||||||
|
|
||||||
|
pngdefs.h:
|
||||||
|
echo "/* pngdefs.h was built by makefile.amiga */" > pngdefs.h
|
||||||
|
|
||||||
libpng.lib: $(OBJS)
|
libpng.lib: $(OBJS)
|
||||||
-$(RM) libpng.lib
|
-$(RM) libpng.lib
|
||||||
|
|||||||
@@ -30,7 +30,10 @@ OBJS = $(LBR)(png.o) $(LBR)(pngset.o) $(LBR)(pngget.o) $(LBR)(pngrutil.o)\
|
|||||||
$(LBR)(pngrtran.o) $(LBR)(pngwtran.o)\
|
$(LBR)(pngrtran.o) $(LBR)(pngwtran.o)\
|
||||||
$(LBR)(pngmem.o) $(LBR)(pngrio.o) $(LBR)(pngwio.o) $(LBR)(pngpread.o)
|
$(LBR)(pngmem.o) $(LBR)(pngrio.o) $(LBR)(pngwio.o) $(LBR)(pngpread.o)
|
||||||
|
|
||||||
all: $(LBR) pngtest.ttp
|
all: $(LBR) pngtest.ttp pngdefs.h
|
||||||
|
|
||||||
|
pngdefs.h:
|
||||||
|
echo "/* pngdefs.h was built by makefile.atari */" > pngdefs.h
|
||||||
|
|
||||||
$(LBR): $(OBJS)
|
$(LBR): $(OBJS)
|
||||||
|
|
||||||
@@ -43,9 +46,12 @@ install: libpng.a
|
|||||||
-@mkdir $(DESTDIR)$(LIBPATH)
|
-@mkdir $(DESTDIR)$(LIBPATH)
|
||||||
-@rm -f $(DESTDIR)$(INCPATH)/png.h
|
-@rm -f $(DESTDIR)$(INCPATH)/png.h
|
||||||
-@rm -f $(DESTDIR)$(INCPATH)/pngconf.h
|
-@rm -f $(DESTDIR)$(INCPATH)/pngconf.h
|
||||||
|
-@rm -f $(DESTDIR)$(INCPATH)/pngdefs.h
|
||||||
cp png.h $(DESTDIR)$(INCPATH)/libpng
|
cp png.h $(DESTDIR)$(INCPATH)/libpng
|
||||||
cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
|
cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
|
||||||
|
cp pngdefs.h $(DESTDIR)$(INCPATH)/libpng
|
||||||
chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
|
chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
|
||||||
chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
|
chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
|
||||||
|
chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngdefs.h
|
||||||
(cd $(DESTDIR)$(INCPATH); ln -f -s $(LIBNAME) libpng; \
|
(cd $(DESTDIR)$(INCPATH); ln -f -s $(LIBNAME) libpng; \
|
||||||
ln -f -s $(LIBNAME)/* .)
|
ln -f -s $(LIBNAME)/* .)
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user