[alpha] Imported from libpng-1.6.0alpha01.tar

This commit is contained in:
Glenn Randers-Pehrson
2011-09-03 14:53:08 -05:00
parent 944f2e5700
commit e4ae523bce
199 changed files with 42458 additions and 20182 deletions

102
ANNOUNCE
View File

@@ -1,5 +1,5 @@
Libpng 1.5.0alpha01 - January 4, 2010 Libpng 1.6.0alpha01 - September 3, 2011
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,53 +9,81 @@ 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.5.0alpha01.tar.xz (LZMA-compressed, recommended) 1.6.0alpha01.tar.xz (LZMA-compressed, recommended)
1.5.0alpha01.tar.gz 1.6.0alpha01.tar.gz
1.5.0alpha01.tar.bz2 1.6.0alpha01.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
lp150a01.zip lp160a01.7z (LZMA-compressed, recommended)
lp150a01.7z lp160a01.zip
Other information: Other information:
1.5.0alpha01-README.txt 1.6.0alpha01-README.txt
1.5.0alpha01-LICENSE.txt 1.6.0alpha01-LICENSE.txt
Changes since the last public release (1.4.0): Changes since the last public release (1.5.4):
version 1.4.1alpha02 [December 11, 2009] Version 1.5.5beta01 [July 13, 2011]
Restored premultiplied alpha feature from version 1.4.0beta105. Fixed some typos and made other minor changes in the manual.
Added "double gamma" to parameters for png_set_premultiply_alpha(). Updated contrib/pngminus/makefile.std (Samuli Souminen)
Added "float postmultiply_gamma" member to the png_struct.
Moved PNG_DIVIDE_BY_255, PNG_8_BIT_PREMULTIPLY(), etc., from
version 1.5.0alpha01 [January 4, 2010] Version 1.5.5beta02 [July 14, 2011]
Bump version to 1.5.0alpha01 Revised Makefile.am and Makefile.in to look in the right directory for
Add "depth" parameter to private png_build_gamma_table() pnglibconf.h.prebuilt
Declared png_cleanup_needed "volatile" in pngread.c and pngwrite.c
Renamed libpng-pc.in back to libpng.pc.in and revised CMakeLists.txt
(revising the change in 1.4.0beta99)
Swapped PNG_UNKNOWN_CHUNKS_SUPPORTED and PNG_HANDLE_AS_UNKNOWN_SUPPORTED
in pngset.c to be consistent with other changes in version 1.2.38.
Changed "libpng-pc.in" to "libpng.pc.in" in configure.ac, configure, and
Makefile.in to be consistent with changes in libpng-1.4.0rc03
Avoid deprecated references to png_ptr-io_ptr and png_ptr->error_ptr
in pngtest.c
Recognize and use "--sysroot=DIR" in libpng-config.in and libpng.pc.in
Recognize and use environment variable $PKG_CONFIG_SYSROOT_DIR as default
setting of ${sysroot} in libpng.pc.in
Removed the just-added sysroot feature. It is the job of pkg-config,
not foo.pc, to mangle the directory locations when $PKG_CONFIG_SYSROOT_DIR
has been defined.
Updated CMakeLists.txt for consistent indentation and to avoid an
unclosed if-statement warning (Philip Lowman).
Revised Makefile.am and makefile.in to remove references to Y2KINFO,
KNOWNBUG, and libpng.la (Robert Schwebel)
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Version 1.5.5beta03 [July 27, 2011]
Enabled compilation with g++ compiler. This compiler does not recognize
the file extension, so it always compiles with C++ rules. Made minor
changes to pngrutil.c to cast results where C++ expects it but C does not.
Minor editing of libpng.3 and libpng-manual.txt.
Version 1.5.5beta04 [July 29, 2011]
Revised CMakeLists.txt (Clifford Yapp)
Updated commentary about the png_rgb_to_gray() default coefficients
in the manual and in pngrtran.c
Version 1.5.5beta05 [August 17, 2011]
Prevent unexpected API exports from non-libpng DLLs on Windows. The "_DLL"
is removed from the test of whether a DLL is being built (this erroneously
caused the libpng APIs to be marked as DLL exports in static builds under
Microsoft Visual Studio). Almost all of the libpng building configuration
is moved from pngconf.h to pngpriv.h, but PNG_DLL_EXPORT remains in
pngconf.h, though, so that it is colocated with the import definition (it
is no longer used anywhere in the installed headers). The VStudio project
definitions have been cleaned up: "_USRDLL" has been removed from the
static library builds (this was incorrect), and PNG_USE_DLL has been added
to pngvalid to test the functionality (pngtest does not supply it,
deliberately). The spurious "_EXPORTS" has been removed from the
libpng build (all these errors were a result of copy/paste between project
configurations.)
Added new types and internal functions for CIE RGB end point handling to
pngpriv.h (functions yet to be implemented).
Version 1.5.5beta06 [August 26, 2011]
Ensure the CMAKE_LIBRARY_OUTPUT_DIRECTORY is set in CMakeLists.txt
(Clifford Yap)
Fixes to rgb_to_gray and cHRM XYZ APIs (John Bowler):
The rgb_to_gray code had errors when combined with gamma correction.
Some pixels were treated as true grey when they weren't and such pixels
and true grey ones were not gamma corrected (the original value of the
red component was used instead). APIs to get and set cHRM using color
space end points have been added and the rgb_to_gray code that defaults
based on cHRM (introduced in 1.5.4) has been corrected. A considerable
number of tests has been added to pngvalid for the rgb_to_gray transform.
Arithmetic errors in rgb_to_gray whereby the calculated gray value was
truncated to the bit depth rather than rounded have been fixed except in
the 8-bit non-gamma-corrected case (where consistency seems more important
than correctness.) The code still has considerable inaccuracies in the
8-bit case because 8-bit linear arithmetic is used.
Version 1.5.5beta07 [September 3, 2011]
Added "$(ARCH)" option to makefile.darwin
Added SunOS support to configure.ac and Makefile.am
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

2263
CHANGES

File diff suppressed because it is too large Load Diff

View File

@@ -1,27 +1,40 @@
cmake_minimum_required(VERSION 2.4.3) # CMakeLists.txt
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
if(UNIX AND NOT DEFINED CMAKE_BUILD_TYPE) # Copyright (C) 2007-2011 Glenn Randers-Pehrson
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
"Choose the type of build, options are:
None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used)
Debug
Release
RelWithDebInfo
MinSizeRel.")
endif()
project(libpng C)
enable_testing()
# Copyright (C) 2007-2010 Glenn Randers-Pehrson
# This code is released under the libpng license. # This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer # For conditions of distribution and use, see the disclaimer
# and license in png.h # and license in png.h
cmake_minimum_required(VERSION 2.4.4)
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
if(UNIX AND NOT DEFINED CMAKE_BUILD_TYPE)
if(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION EQUAL 4)
# workaround CMake 2.4.x bug
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
"Choose the type of build, options are:
None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used)
Debug
Release
RelWithDebInfo
MinSizeRel.")
else()
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
"Choose the type of build, options are:
None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used)
Debug
Release
RelWithDebInfo
MinSizeRel.")
endif()
endif()
project(libpng C)
enable_testing()
set(PNGLIB_MAJOR 1) set(PNGLIB_MAJOR 1)
set(PNGLIB_MINOR 5) set(PNGLIB_MINOR 6)
set(PNGLIB_RELEASE 0) set(PNGLIB_RELEASE 0)
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR}) set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE}) set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
@@ -96,12 +109,23 @@ set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR})
# to distinguish between debug and release lib # to distinguish between debug and release lib
set(CMAKE_DEBUG_POSTFIX "d") set(CMAKE_DEBUG_POSTFIX "d")
# Use the prebuilt pnglibconf.h file from the scripts folder
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt
${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
# OUR SOURCES # OUR SOURCES
set(libpng_sources set(libpng_public_hdrs
png.h png.h
pngconf.h pngconf.h
pngpriv.h ${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h
)
set(libpng_sources
${libpng_public_hdrs}
pngdebug.h
pnginfo.h
pngpriv.h
pngstruct.h
png.c png.c
pngerror.c pngerror.c
pngget.c pngget.c
@@ -134,7 +158,6 @@ if(PNG_SHARED OR NOT MSVC)
add_definitions(-DZLIB_DLL) add_definitions(-DZLIB_DLL)
endif() endif()
if(PNG_CONSOLE_IO_SUPPORTED) if(PNG_CONSOLE_IO_SUPPORTED)
add_definitions(-DPNG_CONSOLE_IO_SUPPORTED) add_definitions(-DPNG_CONSOLE_IO_SUPPORTED)
endif() endif()
@@ -163,6 +186,7 @@ if(PNG_SHARED)
if(MSVC) if(MSVC)
# msvc does not append 'lib' - do it here to have consistent name # msvc does not append 'lib' - do it here to have consistent name
set_target_properties(${PNG_LIB_NAME} PROPERTIES PREFIX "lib") set_target_properties(${PNG_LIB_NAME} PROPERTIES PREFIX "lib")
set_target_properties(${PNG_LIB_NAME} PROPERTIES IMPORT_PREFIX "lib")
endif() endif()
target_link_libraries(${PNG_LIB_NAME} ${ZLIB_LIBRARY} ${M_LIBRARY}) target_link_libraries(${PNG_LIB_NAME} ${ZLIB_LIBRARY} ${M_LIBRARY})
endif() endif()
@@ -175,9 +199,9 @@ if(PNG_STATIC)
# msvc does not append 'lib' - do it here to have consistent name # msvc does not append 'lib' - do it here to have consistent name
set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES PREFIX "lib") set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES PREFIX "lib")
endif() endif()
target_link_libraries(${PNG_LIB_NAME_STATIC} ${ZLIB_LIBRARY} ${M_LIBRARY})
endif() endif()
if(PNG_SHARED AND WIN32) if(PNG_SHARED AND WIN32)
set_target_properties(${PNG_LIB_NAME} PROPERTIES DEFINE_SYMBOL PNG_BUILD_DLL) set_target_properties(${PNG_LIB_NAME} PROPERTIES DEFINE_SYMBOL PNG_BUILD_DLL)
endif() endif()
@@ -186,61 +210,128 @@ if(PNG_TESTS AND PNG_SHARED)
# does not work with msvc due to png_lib_ver issue # does not work with msvc due to png_lib_ver issue
add_executable(pngtest ${pngtest_sources}) add_executable(pngtest ${pngtest_sources})
target_link_libraries(pngtest ${PNG_LIB_NAME}) target_link_libraries(pngtest ${PNG_LIB_NAME})
add_test(pngtest pngtest ${CMAKE_CURRENT_SOURCE_DIR}/pngtest.png) add_test(pngtest ./pngtest ${CMAKE_CURRENT_SOURCE_DIR}/pngtest.png)
endif() endif()
# Ensure the CMAKE_LIBRARY_OUTPUT_DIRECTORY is set
IF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
IF(WIN32)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "bin")
ELSE(WIN32)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "lib")
ENDIF(WIN32)
ENDIF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
# Set a variable with CMake code which:
# Creates a symlink from src to dest (if possible) or alternatively
# copies if different.
macro(CREATE_SYMLINK SRC_FILE DEST_FILE)
FILE(REMOVE ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE})
if(WIN32 AND NOT CYGWIN)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${DEST_FILE}
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${SRC_FILE} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE}
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${SRC_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${DEST_FILE}
DEPENDS ${PNG_LIB_NAME} ${PNG_LIB_NAME_STATIC}
)
ADD_CUSTOM_TARGET(${DEST_FILE}_COPY ALL DEPENDS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE})
else(WIN32 AND NOT CYGWIN)
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${SRC_FILE} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${SRC_FILE} ${DEST_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif(WIN32 AND NOT CYGWIN)
endmacro()
# CREATE PKGCONFIG FILES # CREATE PKGCONFIG FILES
# we use the same files like ./configure, so we have to set its vars # we use the same files like ./configure, so we have to set its vars
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
set(CMAKE_INSTALL_LIBDIR lib)
endif(NOT DEFINED CMAKE_INSTALL_LIBDIR)
set(prefix ${CMAKE_INSTALL_PREFIX}) set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix ${CMAKE_INSTALL_PREFIX}) set(exec_prefix ${CMAKE_INSTALL_PREFIX})
set(libdir ${CMAKE_INSTALL_PREFIX}/lib) set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
set(includedir ${CMAKE_INSTALL_PREFIX}/include) set(includedir ${CMAKE_INSTALL_PREFIX}/include)
set(LIBS "-lz -lm")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc @ONLY)
CREATE_SYMLINK(${PNGLIB_NAME}.pc libpng.pc)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in
${CMAKE_CURRENT_BINARY_DIR}/libpng.pc)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in
${CMAKE_CURRENT_BINARY_DIR}/libpng-config) ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in CREATE_SYMLINK(${PNGLIB_NAME}-config libpng-config)
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config)
# SET UP LINKS # SET UP LINKS
if(PNG_SHARED) if(PNG_SHARED)
set_target_properties(${PNG_LIB_NAME} PROPERTIES set_target_properties(${PNG_LIB_NAME} PROPERTIES
# VERSION 15.${PNGLIB_RELEASE}.1.5.0alpha01 # VERSION 15.${PNGLIB_RELEASE}.1.6.0alpha01
VERSION 15.${PNGLIB_RELEASE}.0 VERSION 15.${PNGLIB_RELEASE}.0
SOVERSION 15 SOVERSION 15
CLEAN_DIRECT_OUTPUT 1) CLEAN_DIRECT_OUTPUT 1)
endif() endif()
if(PNG_STATIC) if(PNG_STATIC)
if(NOT WIN32) # MSVC doesn't use a different file extension for shared vs. static
# that's uncool on win32 - it overwrites our static import lib... # libs. We are able to change OUTPUT_NAME to remove the _static
# for all other platforms.
if(NOT MSVC)
set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES
OUTPUT_NAME ${PNG_LIB_NAME} OUTPUT_NAME ${PNG_LIB_NAME}
CLEAN_DIRECT_OUTPUT 1) CLEAN_DIRECT_OUTPUT 1)
endif() endif()
endif() endif()
# If CMake > 2.4.x, we set a variable used below to export
# targets to an export file.
# TODO: Use VERSION_GREATER after our cmake_minimum_required >= 2.6.2
if(CMAKE_MAJOR_VERSION GREATER 1 AND CMAKE_MINOR_VERSION GREATER 4)
set(PNG_EXPORT_RULE EXPORT libpng)
elseif(CMAKE_MAJOR_VERSION GREATER 2) # future proof
set(PNG_EXPORT_RULE EXPORT libpng)
endif()
# INSTALL # INSTALL
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
if(PNG_SHARED) if(PNG_SHARED)
install(TARGETS ${PNG_LIB_NAME} install(TARGETS ${PNG_LIB_NAME}
RUNTIME DESTINATION bin ${PNG_EXPORT_RULE}
LIBRARY DESTINATION lib RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib) LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
endif() ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
# Create a symlink for libpng.dll.a => libpng15.dll.a on Cygwin
if(CYGWIN)
get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME} LOCATION_${CMAKE_BUILD_TYPE})
get_filename_component(BUILD_TARGET_FILE ${BUILD_TARGET_LOCATION} NAME)
CREATE_SYMLINK(${BUILD_TARGET_FILE} libpng${CMAKE_IMPORT_LIBRARY_SUFFIX})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(CYGWIN)
if(NOT WIN32)
get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME} LOCATION_${CMAKE_BUILD_TYPE})
get_filename_component(BUILD_TARGET_FILE ${BUILD_TARGET_LOCATION} NAME)
CREATE_SYMLINK(${BUILD_TARGET_FILE} libpng${CMAKE_SHARED_LIBRARY_SUFFIX})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(NOT WIN32)
endif(PNG_SHARED)
if(PNG_STATIC) if(PNG_STATIC)
install(TARGETS ${PNG_LIB_NAME_STATIC} install(TARGETS ${PNG_LIB_NAME_STATIC}
LIBRARY DESTINATION lib ${PNG_EXPORT_RULE}
ARCHIVE DESTINATION lib) LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
endif() ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(NOT WIN32 OR CYGWIN)
get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME_STATIC} LOCATION_${CMAKE_BUILD_TYPE})
get_filename_component(BUILD_TARGET_FILE ${BUILD_TARGET_LOCATION} NAME)
CREATE_SYMLINK(${BUILD_TARGET_FILE} libpng${CMAKE_STATIC_LIBRARY_SUFFIX})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(NOT WIN32 OR CYGWIN)
endif()
endif() endif()
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL ) if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
install(FILES png.h pngconf.h DESTINATION include) install(FILES ${libpng_public_hdrs} DESTINATION include)
install(FILES png.h pngconf.h DESTINATION include/${PNGLIB_NAME}) install(FILES ${libpng_public_hdrs} DESTINATION include/${PNGLIB_NAME})
endif() endif()
if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL ) if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL )
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config DESTINATION bin) install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config DESTINATION bin)
@@ -249,26 +340,33 @@ if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL )
endif() endif()
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
# Install man pages # Install man pages
install(FILES libpng.3 libpngpf.3 DESTINATION man/man3) if(NOT PNG_MAN_DIR)
install(FILES png.5 DESTINATION man/man5) set(PNG_MAN_DIR "share/man")
endif()
install(FILES libpng.3 libpngpf.3 DESTINATION ${PNG_MAN_DIR}/man3)
install(FILES png.5 DESTINATION ${PNG_MAN_DIR}/man5)
# Install pkg-config files # Install pkg-config files
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc
DESTINATION lib/pkgconfig) DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng-config install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config
DESTINATION bin) DESTINATION bin)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc
DESTINATION lib/pkgconfig) DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
DESTINATION bin) DESTINATION bin)
endif() endif()
# what's with libpng.txt and all the extra files? # On versions of CMake that support it, create an export file CMake
# users can include() to import our targets
if(PNG_EXPORT_RULE AND NOT SKIP_INSTALL_EXPORT AND NOT SKIP_INSTALL_ALL )
install(EXPORT libpng DESTINATION lib/libpng FILE lib${PNG_LIB_NAME}.cmake)
endif()
# what's with libpng-$VER%.txt and all the extra files?
# UNINSTALL # UNINSTALL
# do we need this? # do we need this?
# DIST # DIST
# do we need this? # do we need this?

44
INSTALL
View File

@@ -1,5 +1,5 @@
Installing libpng version 1.5.0alpha01 - January 2, 2010 Installing libpng
On Unix/Linux and similar systems, you can simply type On Unix/Linux and similar systems, you can simply type
@@ -13,10 +13,16 @@ 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 up-to-date set of tools, running ./autogen.sh before running ./configure
may fix the problem. You can also run the individual commands in may fix the problem. You can also run the individual commands in
autogen.sh with the --force option, if supported by your version of autogen.sh with the --force option, if supported by your version of
the tools. If you run 'libtoolize --force', though, this will replace the tools. To be really sure that you aren't using any of the included
the distributed, patched, version of ltmain.sh with an unpatched version pre-built scripts, you can do this:
and your shared library builds may fail to produce libraries with the
correct version numbers. ./configure --enable-maintainer-mode
make maintainer-clean
./autogen.sh
./configure [--prefix=/path] [other options]
make
make install
make check
Instead, you can use one of the custom-built makefiles in the Instead, you can use one of the custom-built makefiles in the
"scripts" directory "scripts" directory
@@ -46,8 +52,8 @@ 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.5.0alpha01" or "libpng15" and "zlib-1.2.3" might be called "libpng-x.y.z" or "libpngNN" and "zlib-1.2.5"
or "zlib123") so that you have directories called "zlib" and "libpng". or "zlib125") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this: Your directory structure should look like this:
@@ -60,7 +66,7 @@ Your directory structure should look like this:
CMakeLists.txt => "cmake" script CMakeLists.txt => "cmake" script
configuration files: configuration files:
configure.ac, configure, Makefile.am, Makefile.in, configure.ac, configure, Makefile.am, Makefile.in,
autogen.sh, config.guess, ltmain.sh, missing, libpng-pc.in, autogen.sh, config.guess, ltmain.sh, missing, libpng.pc.in,
libpng-config.in, aclocal.m4, config.h.in, config.sub, libpng-config.in, aclocal.m4, config.h.in, config.sub,
depcomp, install-sh, mkinstalldirs, test-pngtest.sh depcomp, install-sh, mkinstalldirs, test-pngtest.sh
contrib contrib
@@ -70,13 +76,12 @@ Your directory structure should look like this:
pngsuite pngsuite
visupng visupng
projects projects
cbuilder5 (Borland)
visualc6 (msvc)
visualc71 visualc71
xcode vstudio
scripts scripts
makefile.* makefile.*
*.def (module definition files) *.def (module definition files)
etc.
pngtest.png pngtest.png
etc. etc.
zlib zlib
@@ -107,7 +112,7 @@ scripts directory into this directory, for example
Read the makefile to see if you need to change any source or Read the makefile to see if you need to change any source or
target directories to match your preferences. target directories to match your preferences.
Then read pngconf.h to see if you want to make any configuration Then read pnglibconf.dfa to see if you want to make any configuration
changes. changes.
Then just run "make" which will create the libpng library in Then just run "make" which will create the libpng library in
@@ -125,19 +130,6 @@ do that, run "make install" in the zlib directory first if necessary).
Some also allow you to run "make test-installed" after you have Some also allow you to run "make test-installed" after you have
run "make install". run "make install".
If you encounter a compiler error message complaining about the Further information can be found in the README and libpng-manual.txt
lines
__png.h__ already includes setjmp.h;
__dont__ include it again.;
this means you have compiled another module that includes setjmp.h,
which is hazardous because the two modules might not include exactly
the same setjmp.h. If you are sure that you know what you are doing
and that they are exactly the same, then you can comment out or
delete the two lines. Better yet, use the cexcept interface
instead, as demonstrated in contrib/visupng of the libpng distribution.
Further information can be found in the README and libpng.txt
files, in the individual makefiles, in png.h, and the manual pages files, in the individual makefiles, in png.h, and the manual pages
libpng.3 and png.5. libpng.3 and png.5.

View File

@@ -10,8 +10,8 @@ this sentence.
This code is released under the libpng license. This code is released under the libpng license.
libpng versions 1.2.6, August 15, 2004, through 1.5.0alpha01, January 2, 2010, are libpng versions 1.2.6, August 15, 2004, through 1.6.0alpha01, September 3, 2011, are
Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are Copyright (c) 2004, 2006-2011 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
@@ -108,4 +108,4 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson Glenn Randers-Pehrson
glennrp at users.sourceforge.net glennrp at users.sourceforge.net
January 2, 2010 September 3, 2011

View File

@@ -1,133 +1,208 @@
# Makefile.am: # Makefile.am:
# Source file for Makefile.in (and hence Makefile) # Source file for Makefile.in (and hence Makefile)
# #
# Makefile.am need only be changed on a major version number
# change (e.g. libpng12 --> libpng13). In that case seach
# this file for every instance of the old base name (libpng12)
# and change to the new one (libpng13), then change the
# -version-number settings below so that the new values have
# the correct major part (first field).
PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
# libpng does not follow GNU file name conventions # libpng does not follow GNU file name conventions
# "color-tests" requires automake 1.11.1 or later. Enable it if you like,
# to get red "FAIL" and green "PASS" notations during tests.
# AUTOMAKE_OPTIONS = foreign color-tests
AUTOMAKE_OPTIONS = foreign 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 pngvalid
pngtest_SOURCES = pngtest.c pngtest_SOURCES = pngtest.c
pngtest_LDADD = libpng15.la pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
TESTS = test-pngtest.sh pngvalid_SOURCES = pngvalid.c
pngvalid_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
TESTS = test-pngtest.sh test-pngvalid-simple.sh test-pngvalid-full.sh
TESTS_ENVIRONMENT= srcdir=$(srcdir) TESTS_ENVIRONMENT= srcdir=$(srcdir)
# man pages # man pages
dist_man_MANS= libpng.3 libpngpf.3 png.5 dist_man_MANS= libpng.3 libpngpf.3 png.5
# generate the -config scripts if required # generate the -config scripts if required
binconfigs= libpng15-config binconfigs= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config
EXTRA_SCRIPTS= libpng-config libpng15-config EXTRA_SCRIPTS= libpng-config libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config
bin_SCRIPTS= @binconfigs@ bin_SCRIPTS= @binconfigs@
# rules to build libpng, only build the old library on request # rules to build libpng, only build the old library on request
lib_LTLIBRARIES=libpng15.la lib_LTLIBRARIES=libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
# EXTRA_LTLIBRARIES= libpng.la # EXTRA_LTLIBRARIES= libpng.la
libpng15_la_SOURCES = png.c pngset.c pngget.c pngrutil.c \ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngerror.c\
pngtrans.c pngwutil.c \ pngget.c pngmem.c pngpread.c pngread.c pngrio.c pngrtran.c pngrutil.c\
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \ pngset.c pngtrans.c pngwio.c pngwrite.c pngwtran.c pngwutil.c\
pngwtran.c pngmem.c pngerror.c pngpread.c \ png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
png.h pngconf.h pngpriv.h
libpng15_la_CPPFLAGS = @LIBPNG_DEFINES@ nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
# MAJOR UPGRADE: the version-number settings below must be changed. libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS = @LIBPNG_DEFINES@
libpng15_la_LDFLAGS = -no-undefined -export-dynamic \
-version-number 15:@PNGLIB_RELEASE@:0 libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined -export-dynamic \
-version-number @PNGLIB_MAJOR@@PNGLIB_MINOR@:@PNGLIB_RELEASE@:0
if HAVE_LD_VERSION_SCRIPT if HAVE_LD_VERSION_SCRIPT
# Versioned symbols and restricted exports # Versioned symbols and restricted exports
libpng15_la_LDFLAGS += -Wl,--version-script=libpng.vers if HAVE_SOLARIS_LD
libpng15_la_DEPENDENCIES = libpng.vers libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -Wl,-M Wl,libpng.vers
else else
# Only restricted exports when possible libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -Wl,--version-script=libpng.vers
libpng15_la_LDFLAGS += -export-symbols libpng.sym
libpng15_la_DEPENDENCIES = libpng.sym
endif endif
# Avoid depending upon Character Ranges. libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.vers
AN = '_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' else
# Only restricted exports when possible
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -export-symbols libpng.sym
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.sym
endif
#distribute headers in /usr/include/libpng/* #distribute headers in /usr/include/libpng/*
pkgincludedir= $(includedir)/$(PNGLIB_BASENAME) pkgincludedir= $(includedir)/$(PNGLIB_BASENAME)
pkginclude_HEADERS= png.h pngconf.h pkginclude_HEADERS= png.h pngconf.h
nodist_pkginclude_HEADERS= pnglibconf.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 = libpng15.pc pkgconfig_DATA = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc
#extra source distribution files. #extra source distribution files.
EXTRA_DIST= \ EXTRA_DIST= \
ANNOUNCE CHANGES INSTALL LICENSE README TODO \ ANNOUNCE CHANGES INSTALL LICENSE README TODO \
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \ pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
${srcdir}/projects/cbuilder5/* \ ${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
${srcdir}/projects/visualc6/* \
${srcdir}/projects/visualc71/* \
${srcdir}/projects/xcode/* \
${srcdir}/scripts/* \
${srcdir}/contrib/gregbook/* \
${srcdir}/contrib/pngminim/* \
${srcdir}/contrib/pngminus/* \
${srcdir}/contrib/pngsuite/* \
${srcdir}/contrib/visupng/* \
$(TESTS) \ $(TESTS) \
example.c libpng-1.5.0alpha01.txt CMakeLists.txt example.c libpng-manual.txt
CLEANFILES= pngout.png libpng15.pc libpng15-config libpng.vers \ SCRIPT_CLEANFILES=scripts/*.out scripts/*.chk scripts/pnglibconf.dfn
libpng.sym
CLEANFILES= dfn.c dfn?.out pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers libpng.sym \
check.new pnglibconf.* symbols.new pngtest-log.txt \
$(SCRIPT_CLEANFILES)
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \ MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
config.sub configure depcomp install-sh ltmain.sh missing config.sub configure depcomp install-sh ltmain.sh missing
# DFNCPP is normally just CPP - the C preprocessor - but on Solaris and maybe
# other operating systems (NeXT?) the C preprocessor selected by configure
# checks input tokens for validity - effectively it performs part of the ANSI-C
# parsing - and therefore fails with the .df files. configure.ac has special
# checks for this and sets DFNCPP appropriately.
DFNCPP = @DFNCPP@
SUFFIXES = .chk .dfn .out
$(PNGLIB_BASENAME).pc: libpng.pc $(PNGLIB_BASENAME).pc: libpng.pc
cp libpng.pc $@ cp libpng.pc $@
$(PNGLIB_BASENAME)-config: libpng-config $(PNGLIB_BASENAME)-config: libpng-config
cp libpng-config $@ cp libpng-config $@
libpng.sym: png.h pngconf.h scripts/sym.out scripts/vers.out: png.h pngconf.h pnglibconf.h
rm -f $@ $@.new scripts/symbols.out: png.h pngconf.h $(srcdir)/scripts/pnglibconf.h.prebuilt
$(CPP) @LIBPNG_DEFINES@ $(CPPFLAGS) -DPNG_BUILDSYMS $(srcdir)/png.h | \
$(SED) -n -e \
's|^.*PNG_FUNCTION_EXPORT[ ]*\([$(AN)]*\).*$$|$(SYMBOL_PREFIX)\1|p' \
-e 's|^.*PNG_DATA_EXPORT[ ]*\([$(AN)]*\).*$$|$(SYMBOL_PREFIX)\1|p' \
>$@.new
mv $@.new $@
libpng.vers: libpng.sym libpng.sym: scripts/sym.out
rm -f $@ $@.new rm -f $@
echo PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0 '{global:' > $@.new cp $? $@
$(SED) s/$$/\;/ libpng.sym >> $@.new libpng.vers: scripts/vers.out
echo 'local: *; };' >> $@.new rm -f $@
mv $@.new $@ cp $? $@
pnglibconf.h: pnglibconf.out
rm -f $@
cp $? $@
$(srcdir)/scripts/pnglibconf.h.prebuilt:
@echo "Attempting to build $@" >&2
@echo "This is a machine generated file, but if you want to make" >&2
@echo "a new one simply make 'scripts/pnglibconf.out' and copy that" >&2
@exit 1
test: check # The following is necessary to ensure that the local pnglibconf.h is used, not
# an installed one (this can happen immediately after on a clean system if
# 'make test' is the first thing the user does.)
pngvalid.o pngtest.o: pnglibconf.h
# We must use -DPNG_NO_USE_READ_MACROS here even when the library may actually
# be built with PNG_USE_READ_MACROS; this prevents the read macros from
# interfering with the symbol file format.
SYMBOL_CFLAGS = -DPNGLIB_LIBNAME='PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0'\
-DPNGLIB_VERSION='@PNGLIB_VERSION@'\
-DSYMBOL_PREFIX='$(SYMBOL_PREFIX)'\
-DPNG_NO_USE_READ_MACROS -DPNG_BUILDING_SYMBOL_TABLE
.dfn.out:
rm -f $@ dfn.c dfn?.out
test -d scripts || mkdir scripts
echo '#include "$<"' >dfn.c
$(DFNCPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) @LIBPNG_DEFINES@\
$(CPPFLAGS) $(SYMBOL_CFLAGS) dfn.c > dfn1.out
$(SED) -n -e 's|^.*PNG_DEFN_MAGIC-\(.*\)-PNG_DEFN_END.*$$|\1|p'\
dfn1.out >dfn2.out
$(SED) -e 's| *@@@ *||g' -e 's| *$$||' dfn2.out >dfn3.out
rm -f dfn.c dfn[12].out
mv dfn3.out $@
# The .dfn file for pnglibconf.h is machine generated
pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk
rm -f $@ dfn?.out
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn1.out\
${srcdir}/scripts/pnglibconf.dfa $(DFA_XTRA) 1>&2
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn2.out dfn1.out 1>&2
rm dfn1.out
mv dfn2.out $@
# Symbol checks (.def and .out files should match)
scripts/symbols.chk: scripts/checksym.awk scripts/symbols.def scripts/symbols.out
.out.chk:
rm -f $@ symbols.new
$(AWK) -f ${srcdir}/scripts/checksym.awk ${srcdir}/scripts/${*F}.def\
$< >&2
mv symbols.new $@
# used on demand to regenerate the standard header, CPPFLAGS should
# be empty - no non-standard defines
scripts/pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk
rm -f $@ dfn?.out
test -z "$(CPPFLAGS)"
echo "com @PNGLIB_VERSION@ STANDARD API DEFINITION" |\
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn1.out\
logunsupported=1 - ${srcdir}/scripts/pnglibconf.dfa 1>&2
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn2.out dfn1.out 1>&2
rm dfn1.out
mv dfn2.out $@
$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS): png.h pngconf.h \
pnglibconf.h pngpriv.h pngdebug.h pnginfo.h pngstruct.h
test: check-am
# Extra checks
check: scripts/symbols.chk
# Don't distribute the generated script files
dist-hook:
cd '$(top_distdir)'; rm -f $(SCRIPT_CLEANFILES)
# 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 pnglibconf.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 \ cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/pngconf.h \
pngconf.h pngconf.h
cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/pnglibconf.h \
pnglibconf.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 libpng15 to be used # do evil things to libpng to cause libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ to be used
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
@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 so.@PNGLIB_MAJOR@@PNGLIB_MINOR@.@PNGLIB_RELEASE@ sl dylib dll.a; do\
rm -f libpng.$$ext;\ rm -f libpng.$$ext;\
if test -f $(PNGLIB_BASENAME).$$ext; then\ if test -f $(PNGLIB_BASENAME).$$ext; then\
$(LN_S) $(PNGLIB_BASENAME).$$ext libpng.$$ext;\ $(LN_S) $(PNGLIB_BASENAME).$$ext libpng.$$ext;\
@@ -135,6 +210,8 @@ install-exec-hook:
done done
uninstall-hook: uninstall-hook:
cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h pnglibconf.h
rm -f $(DESTDIR)$(pkgconfigdir)/libpng.pc rm -f $(DESTDIR)$(pkgconfigdir)/libpng.pc
rm -f $(DESTDIR)$(bindir)/libpng-config rm -f $(DESTDIR)$(bindir)/libpng-config
rm -f $(DESTDIR)$(libdir)/libpng.a
rm -f $(DESTDIR)$(libdir)/libpng.la

View File

@@ -1,4 +1,4 @@
# Makefile.in generated by automake 1.11 from Makefile.am. # Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -18,12 +18,6 @@
# Makefile.am: # Makefile.am:
# Source file for Makefile.in (and hence Makefile) # Source file for Makefile.in (and hence Makefile)
# #
# Makefile.am need only be changed on a major version number
# change (e.g. libpng12 --> libpng13). In that case seach
# this file for every instance of the old base name (libpng12)
# and change to the new one (libpng13), then change the
# -version-number settings below so that the new values have
# the correct major part (first field).
@@ -46,23 +40,27 @@ PRE_UNINSTALL = :
POST_UNINSTALL = : POST_UNINSTALL = :
build_triplet = @build@ build_triplet = @build@
host_triplet = @host@ host_triplet = @host@
check_PROGRAMS = pngtest$(EXEEXT) check_PROGRAMS = pngtest$(EXEEXT) pngvalid$(EXEEXT)
@HAVE_LD_VERSION_SCRIPT_TRUE@am__append_1 = -Wl,--version-script=libpng.vers
@HAVE_LD_VERSION_SCRIPT_FALSE@am__append_2 = -export-symbols libpng.sym # Versioned symbols and restricted exports
@HAVE_LD_VERSION_SCRIPT_TRUE@@HAVE_SOLARIS_LD_TRUE@am__append_1 = -Wl,-M Wl,libpng.vers
@HAVE_LD_VERSION_SCRIPT_TRUE@@HAVE_SOLARIS_LD_FALSE@am__append_2 = -Wl,--version-script=libpng.vers
# Only restricted exports when possible
@HAVE_LD_VERSION_SCRIPT_FALSE@am__append_3 = -export-symbols libpng.sym
subdir = . subdir = .
DIST_COMMON = README $(am__configure_deps) $(dist_man_MANS) \ DIST_COMMON = README $(am__configure_deps) $(dist_man_MANS) \
$(pkginclude_HEADERS) $(srcdir)/Makefile.am \ $(pkginclude_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(srcdir)/libpng-config.in $(srcdir)/libpng.pc.in \ $(srcdir)/libpng-config.in $(srcdir)/libpng.pc.in \
$(top_srcdir)/configure INSTALL TODO config.guess config.sub \ $(top_srcdir)/configure INSTALL TODO config.guess config.sub \
depcomp install-sh ltmain.sh missing mkinstalldirs depcomp install-sh ltmain.sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4) $(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno configure.lineno config.status.lineno
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = libpng.pc libpng-config CONFIG_CLEAN_FILES = libpng.pc libpng-config
CONFIG_CLEAN_VPATH_FILES = CONFIG_CLEAN_VPATH_FILES =
@@ -89,24 +87,41 @@ am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
"$(DESTDIR)$(man3dir)" "$(DESTDIR)$(man5dir)" \ "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(man5dir)" \
"$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(pkgincludedir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(pkgincludedir)" \
"$(DESTDIR)$(pkgincludedir)"
LTLIBRARIES = $(lib_LTLIBRARIES) LTLIBRARIES = $(lib_LTLIBRARIES)
libpng15_la_LIBADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LIBADD =
am_libpng15_la_OBJECTS = libpng15_la-png.lo libpng15_la-pngset.lo \ am_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS = \
libpng15_la-pngget.lo libpng15_la-pngrutil.lo \ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-png.lo \
libpng15_la-pngtrans.lo libpng15_la-pngwutil.lo \ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngerror.lo \
libpng15_la-pngread.lo libpng15_la-pngrio.lo \ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngget.lo \
libpng15_la-pngwio.lo libpng15_la-pngwrite.lo \ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngmem.lo \
libpng15_la-pngrtran.lo libpng15_la-pngwtran.lo \ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngpread.lo \
libpng15_la-pngmem.lo libpng15_la-pngerror.lo \ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngread.lo \
libpng15_la-pngpread.lo libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrio.lo \
libpng15_la_OBJECTS = $(am_libpng15_la_OBJECTS) libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrtran.lo \
libpng15_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrutil.lo \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngset.lo \
$(libpng15_la_LDFLAGS) $(LDFLAGS) -o $@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngtrans.lo \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwio.lo \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwrite.lo \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwtran.lo \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.lo
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS =
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS = \
$(am_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS) \
$(nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS)
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LINK = $(LIBTOOL) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(AM_CFLAGS) $(CFLAGS) \
$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS) $(LDFLAGS) -o \
$@
am_pngtest_OBJECTS = pngtest.$(OBJEXT) am_pngtest_OBJECTS = pngtest.$(OBJEXT)
pngtest_OBJECTS = $(am_pngtest_OBJECTS) pngtest_OBJECTS = $(am_pngtest_OBJECTS)
pngtest_DEPENDENCIES = libpng15.la pngtest_DEPENDENCIES = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
am_pngvalid_OBJECTS = pngvalid.$(OBJEXT)
pngvalid_OBJECTS = $(am_pngvalid_OBJECTS)
pngvalid_DEPENDENCIES = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
SCRIPTS = $(bin_SCRIPTS) SCRIPTS = $(bin_SCRIPTS)
DEFAULT_INCLUDES = -I.@am__isrc@ DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/depcomp depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -121,14 +136,17 @@ CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@ $(LDFLAGS) -o $@
SOURCES = $(libpng15_la_SOURCES) $(pngtest_SOURCES) SOURCES = $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES) \
DIST_SOURCES = $(libpng15_la_SOURCES) $(pngtest_SOURCES) $(nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES) \
$(pngtest_SOURCES) $(pngvalid_SOURCES)
DIST_SOURCES = $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES) \
$(pngtest_SOURCES) $(pngvalid_SOURCES)
man3dir = $(mandir)/man3 man3dir = $(mandir)/man3
man5dir = $(mandir)/man5 man5dir = $(mandir)/man5
NROFF = nroff NROFF = nroff
MANS = $(dist_man_MANS) MANS = $(dist_man_MANS)
DATA = $(pkgconfig_DATA) DATA = $(pkgconfig_DATA)
HEADERS = $(pkginclude_HEADERS) HEADERS = $(nodist_pkginclude_HEADERS) $(pkginclude_HEADERS)
ETAGS = etags ETAGS = etags
CTAGS = ctags CTAGS = ctags
am__tty_colors = \ am__tty_colors = \
@@ -163,6 +181,13 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@ CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@ DEFS = @DEFS@
DEPDIR = @DEPDIR@ DEPDIR = @DEPDIR@
# DFNCPP is normally just CPP - the C preprocessor - but on Solaris and maybe
# other operating systems (NeXT?) the C preprocessor selected by configure
# checks input tokens for validity - effectively it performs part of the ANSI-C
# parsing - and therefore fails with the .df files. configure.ac has special
# checks for this and sets DFNCPP appropriately.
DFNCPP = @DFNCPP@
DLLTOOL = @DLLTOOL@ DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@ DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@ DUMPBIN = @DUMPBIN@
@@ -189,6 +214,7 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@ LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@ MKDIR_P = @MKDIR_P@
NM = @NM@ NM = @NM@
NMEDIT = @NMEDIT@ NMEDIT = @NMEDIT@
@@ -220,6 +246,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@ abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@ abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@ abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@ ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@ am__include = @am__include@
@@ -229,7 +256,7 @@ am__tar = @am__tar@
am__untar = @am__untar@ am__untar = @am__untar@
# generate the -config scripts if required # generate the -config scripts if required
binconfigs = libpng15-config binconfigs = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config
bindir = @bindir@ bindir = @bindir@
build = @build@ build = @build@
build_alias = @build_alias@ build_alias = @build_alias@
@@ -255,7 +282,6 @@ libdir = @libdir@
libexecdir = @libexecdir@ libexecdir = @libexecdir@
localedir = @localedir@ localedir = @localedir@
localstatedir = @localstatedir@ localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@ mandir = @mandir@
mkdir_p = @mkdir_p@ mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@ oldincludedir = @oldincludedir@
@@ -278,67 +304,75 @@ top_srcdir = @top_srcdir@
PNGLIB_BASENAME = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ PNGLIB_BASENAME = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
# libpng does not follow GNU file name conventions # libpng does not follow GNU file name conventions
# "color-tests" requires automake 1.11.1 or later. Enable it if you like,
# to get red "FAIL" and green "PASS" notations during tests.
# AUTOMAKE_OPTIONS = foreign color-tests
AUTOMAKE_OPTIONS = foreign AUTOMAKE_OPTIONS = foreign
pngtest_SOURCES = pngtest.c pngtest_SOURCES = pngtest.c
pngtest_LDADD = libpng15.la pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
TESTS = test-pngtest.sh pngvalid_SOURCES = pngvalid.c
pngvalid_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
TESTS = test-pngtest.sh test-pngvalid-simple.sh test-pngvalid-full.sh
TESTS_ENVIRONMENT = srcdir=$(srcdir) TESTS_ENVIRONMENT = srcdir=$(srcdir)
# man pages # man pages
dist_man_MANS = libpng.3 libpngpf.3 png.5 dist_man_MANS = libpng.3 libpngpf.3 png.5
EXTRA_SCRIPTS = libpng-config libpng15-config EXTRA_SCRIPTS = libpng-config libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config
bin_SCRIPTS = @binconfigs@ bin_SCRIPTS = @binconfigs@
# rules to build libpng, only build the old library on request # rules to build libpng, only build the old library on request
lib_LTLIBRARIES = libpng15.la lib_LTLIBRARIES = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
# EXTRA_LTLIBRARIES= libpng.la # EXTRA_LTLIBRARIES= libpng.la
libpng15_la_SOURCES = png.c pngset.c pngget.c pngrutil.c \ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngerror.c\
pngtrans.c pngwutil.c \ pngget.c pngmem.c pngpread.c pngread.c pngrio.c pngrtran.c pngrutil.c\
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \ pngset.c pngtrans.c pngwio.c pngwrite.c pngwtran.c pngwutil.c\
pngwtran.c pngmem.c pngerror.c pngpread.c \ png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
png.h pngconf.h pngpriv.h
libpng15_la_CPPFLAGS = @LIBPNG_DEFINES@ nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS = @LIBPNG_DEFINES@
# MAJOR UPGRADE: the version-number settings below must be changed. libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined \
libpng15_la_LDFLAGS = -no-undefined -export-dynamic -version-number \ -export-dynamic -version-number \
15:@PNGLIB_RELEASE@:0 $(am__append_1) $(am__append_2) @PNGLIB_MAJOR@@PNGLIB_MINOR@:@PNGLIB_RELEASE@:0 \
@HAVE_LD_VERSION_SCRIPT_FALSE@libpng15_la_DEPENDENCIES = libpng.sym $(am__append_1) $(am__append_2) $(am__append_3)
@HAVE_LD_VERSION_SCRIPT_TRUE@libpng15_la_DEPENDENCIES = libpng.vers @HAVE_LD_VERSION_SCRIPT_FALSE@libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.sym
@HAVE_LD_VERSION_SCRIPT_TRUE@libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.vers
# Avoid depending upon Character Ranges.
AN = '_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
pkginclude_HEADERS = png.h pngconf.h pkginclude_HEADERS = png.h pngconf.h
pkgconfig_DATA = libpng15.pc nodist_pkginclude_HEADERS = pnglibconf.h
pkgconfig_DATA = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc
#extra source distribution files. #extra source distribution files.
EXTRA_DIST = \ EXTRA_DIST = \
ANNOUNCE CHANGES INSTALL LICENSE README TODO \ ANNOUNCE CHANGES INSTALL LICENSE README TODO \
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \ pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
${srcdir}/projects/cbuilder5/* \ ${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
${srcdir}/projects/visualc6/* \
${srcdir}/projects/visualc71/* \
${srcdir}/projects/xcode/* \
${srcdir}/scripts/* \
${srcdir}/contrib/gregbook/* \
${srcdir}/contrib/pngminim/* \
${srcdir}/contrib/pngminus/* \
${srcdir}/contrib/pngsuite/* \
${srcdir}/contrib/visupng/* \
$(TESTS) \ $(TESTS) \
example.c libpng-1.5.0alpha01.txt CMakeLists.txt example.c libpng-manual.txt
CLEANFILES = pngout.png libpng15.pc libpng15-config libpng.vers \ SCRIPT_CLEANFILES = scripts/*.out scripts/*.chk scripts/pnglibconf.dfn
libpng.sym CLEANFILES = dfn.c dfn?.out pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers libpng.sym \
check.new pnglibconf.* symbols.new pngtest-log.txt \
$(SCRIPT_CLEANFILES)
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \ MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
config.sub configure depcomp install-sh ltmain.sh missing config.sub configure depcomp install-sh ltmain.sh missing
SUFFIXES = .chk .dfn .out
# We must use -DPNG_NO_USE_READ_MACROS here even when the library may actually
# be built with PNG_USE_READ_MACROS; this prevents the read macros from
# interfering with the symbol file format.
SYMBOL_CFLAGS = -DPNGLIB_LIBNAME='PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0'\
-DPNGLIB_VERSION='@PNGLIB_VERSION@'\
-DSYMBOL_PREFIX='$(SYMBOL_PREFIX)'\
-DPNG_NO_USE_READ_MACROS -DPNG_BUILDING_SYMBOL_TABLE
all: config.h all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am $(MAKE) $(AM_MAKEFLAGS) all-am
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .c .lo .o .obj .SUFFIXES: .chk .dfn .out .c .lo .o .obj
am--refresh: am--refresh:
@: @:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@@ -425,8 +459,8 @@ clean-libLTLIBRARIES:
echo "rm -f \"$${dir}/so_locations\""; \ echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \ rm -f "$${dir}/so_locations"; \
done done
libpng15.la: $(libpng15_la_OBJECTS) $(libpng15_la_DEPENDENCIES) libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la: $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES)
$(libpng15_la_LINK) -rpath $(libdir) $(libpng15_la_OBJECTS) $(libpng15_la_LIBADD) $(LIBS) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LINK) -rpath $(libdir) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LIBADD) $(LIBS)
clean-checkPROGRAMS: clean-checkPROGRAMS:
@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
@@ -439,6 +473,9 @@ clean-checkPROGRAMS:
pngtest$(EXEEXT): $(pngtest_OBJECTS) $(pngtest_DEPENDENCIES) pngtest$(EXEEXT): $(pngtest_OBJECTS) $(pngtest_DEPENDENCIES)
@rm -f pngtest$(EXEEXT) @rm -f pngtest$(EXEEXT)
$(LINK) $(pngtest_OBJECTS) $(pngtest_LDADD) $(LIBS) $(LINK) $(pngtest_OBJECTS) $(pngtest_LDADD) $(LIBS)
pngvalid$(EXEEXT): $(pngvalid_OBJECTS) $(pngvalid_DEPENDENCIES)
@rm -f pngvalid$(EXEEXT)
$(LINK) $(pngvalid_OBJECTS) $(pngvalid_LDADD) $(LIBS)
install-binSCRIPTS: $(bin_SCRIPTS) install-binSCRIPTS: $(bin_SCRIPTS)
@$(NORMAL_INSTALL) @$(NORMAL_INSTALL)
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
@@ -480,22 +517,23 @@ mostlyclean-compile:
distclean-compile: distclean-compile:
-rm -f *.tab.c -rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng15_la-png.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-png.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng15_la-pngerror.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngerror.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng15_la-pngget.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngget.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng15_la-pngmem.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngmem.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng15_la-pngpread.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngpread.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng15_la-pngread.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngread.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng15_la-pngrio.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrio.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng15_la-pngrtran.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrtran.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng15_la-pngrutil.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrutil.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng15_la-pngset.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngset.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng15_la-pngtrans.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngtrans.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng15_la-pngwio.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwio.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng15_la-pngwrite.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwrite.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng15_la-pngwtran.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwtran.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng15_la-pngwutil.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngtest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngtest.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngvalid.Po@am__quote@
.c.o: .c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -518,110 +556,110 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
libpng15_la-png.lo: png.c libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-png.lo: png.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng15_la-png.lo -MD -MP -MF $(DEPDIR)/libpng15_la-png.Tpo -c -o libpng15_la-png.lo `test -f 'png.c' || echo '$(srcdir)/'`png.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-png.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-png.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-png.lo `test -f 'png.c' || echo '$(srcdir)/'`png.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng15_la-png.Tpo $(DEPDIR)/libpng15_la-png.Plo @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-png.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-png.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='png.c' object='libpng15_la-png.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='png.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-png.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng15_la-png.lo `test -f 'png.c' || echo '$(srcdir)/'`png.c @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-png.lo `test -f 'png.c' || echo '$(srcdir)/'`png.c
libpng15_la-pngset.lo: pngset.c libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngerror.lo: pngerror.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng15_la-pngset.lo -MD -MP -MF $(DEPDIR)/libpng15_la-pngset.Tpo -c -o libpng15_la-pngset.lo `test -f 'pngset.c' || echo '$(srcdir)/'`pngset.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngerror.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngerror.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngerror.lo `test -f 'pngerror.c' || echo '$(srcdir)/'`pngerror.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng15_la-pngset.Tpo $(DEPDIR)/libpng15_la-pngset.Plo @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngerror.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngerror.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngset.c' object='libpng15_la-pngset.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngerror.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngerror.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng15_la-pngset.lo `test -f 'pngset.c' || echo '$(srcdir)/'`pngset.c @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngerror.lo `test -f 'pngerror.c' || echo '$(srcdir)/'`pngerror.c
libpng15_la-pngget.lo: pngget.c libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngget.lo: pngget.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng15_la-pngget.lo -MD -MP -MF $(DEPDIR)/libpng15_la-pngget.Tpo -c -o libpng15_la-pngget.lo `test -f 'pngget.c' || echo '$(srcdir)/'`pngget.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngget.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngget.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngget.lo `test -f 'pngget.c' || echo '$(srcdir)/'`pngget.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng15_la-pngget.Tpo $(DEPDIR)/libpng15_la-pngget.Plo @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngget.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngget.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngget.c' object='libpng15_la-pngget.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngget.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngget.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng15_la-pngget.lo `test -f 'pngget.c' || echo '$(srcdir)/'`pngget.c @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngget.lo `test -f 'pngget.c' || echo '$(srcdir)/'`pngget.c
libpng15_la-pngrutil.lo: pngrutil.c libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngmem.lo: pngmem.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng15_la-pngrutil.lo -MD -MP -MF $(DEPDIR)/libpng15_la-pngrutil.Tpo -c -o libpng15_la-pngrutil.lo `test -f 'pngrutil.c' || echo '$(srcdir)/'`pngrutil.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngmem.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngmem.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngmem.lo `test -f 'pngmem.c' || echo '$(srcdir)/'`pngmem.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng15_la-pngrutil.Tpo $(DEPDIR)/libpng15_la-pngrutil.Plo @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngmem.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngmem.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngrutil.c' object='libpng15_la-pngrutil.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngmem.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngmem.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng15_la-pngrutil.lo `test -f 'pngrutil.c' || echo '$(srcdir)/'`pngrutil.c @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngmem.lo `test -f 'pngmem.c' || echo '$(srcdir)/'`pngmem.c
libpng15_la-pngtrans.lo: pngtrans.c libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngpread.lo: pngpread.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng15_la-pngtrans.lo -MD -MP -MF $(DEPDIR)/libpng15_la-pngtrans.Tpo -c -o libpng15_la-pngtrans.lo `test -f 'pngtrans.c' || echo '$(srcdir)/'`pngtrans.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngpread.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngpread.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngpread.lo `test -f 'pngpread.c' || echo '$(srcdir)/'`pngpread.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng15_la-pngtrans.Tpo $(DEPDIR)/libpng15_la-pngtrans.Plo @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngpread.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngpread.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngtrans.c' object='libpng15_la-pngtrans.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngpread.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngpread.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng15_la-pngtrans.lo `test -f 'pngtrans.c' || echo '$(srcdir)/'`pngtrans.c @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngpread.lo `test -f 'pngpread.c' || echo '$(srcdir)/'`pngpread.c
libpng15_la-pngwutil.lo: pngwutil.c libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngread.lo: pngread.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng15_la-pngwutil.lo -MD -MP -MF $(DEPDIR)/libpng15_la-pngwutil.Tpo -c -o libpng15_la-pngwutil.lo `test -f 'pngwutil.c' || echo '$(srcdir)/'`pngwutil.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngread.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngread.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngread.lo `test -f 'pngread.c' || echo '$(srcdir)/'`pngread.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng15_la-pngwutil.Tpo $(DEPDIR)/libpng15_la-pngwutil.Plo @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngread.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngread.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngwutil.c' object='libpng15_la-pngwutil.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngread.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngread.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng15_la-pngwutil.lo `test -f 'pngwutil.c' || echo '$(srcdir)/'`pngwutil.c @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngread.lo `test -f 'pngread.c' || echo '$(srcdir)/'`pngread.c
libpng15_la-pngread.lo: pngread.c libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrio.lo: pngrio.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng15_la-pngread.lo -MD -MP -MF $(DEPDIR)/libpng15_la-pngread.Tpo -c -o libpng15_la-pngread.lo `test -f 'pngread.c' || echo '$(srcdir)/'`pngread.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrio.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrio.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrio.lo `test -f 'pngrio.c' || echo '$(srcdir)/'`pngrio.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng15_la-pngread.Tpo $(DEPDIR)/libpng15_la-pngread.Plo @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrio.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrio.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngread.c' object='libpng15_la-pngread.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngrio.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrio.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng15_la-pngread.lo `test -f 'pngread.c' || echo '$(srcdir)/'`pngread.c @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrio.lo `test -f 'pngrio.c' || echo '$(srcdir)/'`pngrio.c
libpng15_la-pngrio.lo: pngrio.c libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrtran.lo: pngrtran.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng15_la-pngrio.lo -MD -MP -MF $(DEPDIR)/libpng15_la-pngrio.Tpo -c -o libpng15_la-pngrio.lo `test -f 'pngrio.c' || echo '$(srcdir)/'`pngrio.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrtran.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrtran.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrtran.lo `test -f 'pngrtran.c' || echo '$(srcdir)/'`pngrtran.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng15_la-pngrio.Tpo $(DEPDIR)/libpng15_la-pngrio.Plo @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrtran.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrtran.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngrio.c' object='libpng15_la-pngrio.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngrtran.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrtran.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng15_la-pngrio.lo `test -f 'pngrio.c' || echo '$(srcdir)/'`pngrio.c @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrtran.lo `test -f 'pngrtran.c' || echo '$(srcdir)/'`pngrtran.c
libpng15_la-pngwio.lo: pngwio.c libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrutil.lo: pngrutil.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng15_la-pngwio.lo -MD -MP -MF $(DEPDIR)/libpng15_la-pngwio.Tpo -c -o libpng15_la-pngwio.lo `test -f 'pngwio.c' || echo '$(srcdir)/'`pngwio.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrutil.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrutil.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrutil.lo `test -f 'pngrutil.c' || echo '$(srcdir)/'`pngrutil.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng15_la-pngwio.Tpo $(DEPDIR)/libpng15_la-pngwio.Plo @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrutil.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrutil.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngwio.c' object='libpng15_la-pngwio.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngrutil.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrutil.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng15_la-pngwio.lo `test -f 'pngwio.c' || echo '$(srcdir)/'`pngwio.c @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrutil.lo `test -f 'pngrutil.c' || echo '$(srcdir)/'`pngrutil.c
libpng15_la-pngwrite.lo: pngwrite.c libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngset.lo: pngset.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng15_la-pngwrite.lo -MD -MP -MF $(DEPDIR)/libpng15_la-pngwrite.Tpo -c -o libpng15_la-pngwrite.lo `test -f 'pngwrite.c' || echo '$(srcdir)/'`pngwrite.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngset.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngset.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngset.lo `test -f 'pngset.c' || echo '$(srcdir)/'`pngset.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng15_la-pngwrite.Tpo $(DEPDIR)/libpng15_la-pngwrite.Plo @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngset.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngset.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngwrite.c' object='libpng15_la-pngwrite.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngset.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngset.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng15_la-pngwrite.lo `test -f 'pngwrite.c' || echo '$(srcdir)/'`pngwrite.c @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngset.lo `test -f 'pngset.c' || echo '$(srcdir)/'`pngset.c
libpng15_la-pngrtran.lo: pngrtran.c libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngtrans.lo: pngtrans.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng15_la-pngrtran.lo -MD -MP -MF $(DEPDIR)/libpng15_la-pngrtran.Tpo -c -o libpng15_la-pngrtran.lo `test -f 'pngrtran.c' || echo '$(srcdir)/'`pngrtran.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngtrans.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngtrans.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngtrans.lo `test -f 'pngtrans.c' || echo '$(srcdir)/'`pngtrans.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng15_la-pngrtran.Tpo $(DEPDIR)/libpng15_la-pngrtran.Plo @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngtrans.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngtrans.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngrtran.c' object='libpng15_la-pngrtran.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngtrans.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngtrans.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng15_la-pngrtran.lo `test -f 'pngrtran.c' || echo '$(srcdir)/'`pngrtran.c @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngtrans.lo `test -f 'pngtrans.c' || echo '$(srcdir)/'`pngtrans.c
libpng15_la-pngwtran.lo: pngwtran.c libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwio.lo: pngwio.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng15_la-pngwtran.lo -MD -MP -MF $(DEPDIR)/libpng15_la-pngwtran.Tpo -c -o libpng15_la-pngwtran.lo `test -f 'pngwtran.c' || echo '$(srcdir)/'`pngwtran.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwio.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwio.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwio.lo `test -f 'pngwio.c' || echo '$(srcdir)/'`pngwio.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng15_la-pngwtran.Tpo $(DEPDIR)/libpng15_la-pngwtran.Plo @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwio.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwio.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngwtran.c' object='libpng15_la-pngwtran.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngwio.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwio.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng15_la-pngwtran.lo `test -f 'pngwtran.c' || echo '$(srcdir)/'`pngwtran.c @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwio.lo `test -f 'pngwio.c' || echo '$(srcdir)/'`pngwio.c
libpng15_la-pngmem.lo: pngmem.c libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwrite.lo: pngwrite.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng15_la-pngmem.lo -MD -MP -MF $(DEPDIR)/libpng15_la-pngmem.Tpo -c -o libpng15_la-pngmem.lo `test -f 'pngmem.c' || echo '$(srcdir)/'`pngmem.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwrite.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwrite.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwrite.lo `test -f 'pngwrite.c' || echo '$(srcdir)/'`pngwrite.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng15_la-pngmem.Tpo $(DEPDIR)/libpng15_la-pngmem.Plo @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwrite.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwrite.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngmem.c' object='libpng15_la-pngmem.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngwrite.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwrite.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng15_la-pngmem.lo `test -f 'pngmem.c' || echo '$(srcdir)/'`pngmem.c @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwrite.lo `test -f 'pngwrite.c' || echo '$(srcdir)/'`pngwrite.c
libpng15_la-pngerror.lo: pngerror.c libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwtran.lo: pngwtran.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng15_la-pngerror.lo -MD -MP -MF $(DEPDIR)/libpng15_la-pngerror.Tpo -c -o libpng15_la-pngerror.lo `test -f 'pngerror.c' || echo '$(srcdir)/'`pngerror.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwtran.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwtran.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwtran.lo `test -f 'pngwtran.c' || echo '$(srcdir)/'`pngwtran.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng15_la-pngerror.Tpo $(DEPDIR)/libpng15_la-pngerror.Plo @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwtran.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwtran.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngerror.c' object='libpng15_la-pngerror.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngwtran.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwtran.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng15_la-pngerror.lo `test -f 'pngerror.c' || echo '$(srcdir)/'`pngerror.c @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwtran.lo `test -f 'pngwtran.c' || echo '$(srcdir)/'`pngwtran.c
libpng15_la-pngpread.lo: pngpread.c libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.lo: pngwutil.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng15_la-pngpread.lo -MD -MP -MF $(DEPDIR)/libpng15_la-pngpread.Tpo -c -o libpng15_la-pngpread.lo `test -f 'pngpread.c' || echo '$(srcdir)/'`pngpread.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.lo `test -f 'pngwutil.c' || echo '$(srcdir)/'`pngwutil.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng15_la-pngpread.Tpo $(DEPDIR)/libpng15_la-pngpread.Plo @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngpread.c' object='libpng15_la-pngpread.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngwutil.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng15_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng15_la-pngpread.lo `test -f 'pngpread.c' || echo '$(srcdir)/'`pngpread.c @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.lo `test -f 'pngwutil.c' || echo '$(srcdir)/'`pngwutil.c
mostlyclean-libtool: mostlyclean-libtool:
-rm -f *.lo -rm -f *.lo
@@ -727,6 +765,26 @@ uninstall-pkgconfigDATA:
test -n "$$files" || exit 0; \ test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(pkgconfigdir)' && rm -f" $$files ")"; \ echo " ( cd '$(DESTDIR)$(pkgconfigdir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(pkgconfigdir)" && rm -f $$files cd "$(DESTDIR)$(pkgconfigdir)" && rm -f $$files
install-nodist_pkgincludeHEADERS: $(nodist_pkginclude_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)"
@list='$(nodist_pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \
done
uninstall-nodist_pkgincludeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(nodist_pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(pkgincludedir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(pkgincludedir)" && rm -f $$files
install-pkgincludeHEADERS: $(pkginclude_HEADERS) install-pkgincludeHEADERS: $(pkginclude_HEADERS)
@$(NORMAL_INSTALL) @$(NORMAL_INSTALL)
test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)"
@@ -937,8 +995,12 @@ distdir: $(DISTFILES)
|| exit 1; \ || exit 1; \
fi; \ fi; \
done done
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" distdir="$(distdir)" \
dist-hook
-test -n "$(am__skip_mode_fix)" \ -test -n "$(am__skip_mode_fix)" \
|| find "$(distdir)" -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ || find "$(distdir)" -type d ! -perm -755 \
-exec chmod u+rwx,go+rx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
@@ -982,17 +1044,17 @@ dist dist-all: distdir
distcheck: dist distcheck: dist
case '$(DIST_ARCHIVES)' in \ case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \ *.tar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \ *.tar.bz2*) \
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lzma*) \ *.tar.lzma*) \
unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
*.tar.xz*) \ *.tar.xz*) \
xz -dc $(distdir).tar.xz | $(am__untar) ;;\ xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \ *.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \ *.shar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \ *.zip*) \
unzip $(distdir).zip ;;\ unzip $(distdir).zip ;;\
esac esac
@@ -1058,7 +1120,7 @@ check: check-am
all-am: Makefile $(LTLIBRARIES) $(SCRIPTS) $(MANS) $(DATA) $(HEADERS) \ all-am: Makefile $(LTLIBRARIES) $(SCRIPTS) $(MANS) $(DATA) $(HEADERS) \
config.h config.h
installdirs: installdirs:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(pkgincludedir)"; do \ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(pkgincludedir)" "$(DESTDIR)$(pkgincludedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done done
install: install-am install: install-am
@@ -1112,8 +1174,8 @@ info: info-am
info-am: info-am:
install-data-am: install-man install-pkgconfigDATA \ install-data-am: install-man install-nodist_pkgincludeHEADERS \
install-pkgincludeHEADERS install-pkgconfigDATA install-pkgincludeHEADERS
@$(NORMAL_INSTALL) @$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-data-hook $(MAKE) $(AM_MAKEFLAGS) install-data-hook
install-dvi: install-dvi-am install-dvi: install-dvi-am
@@ -1164,8 +1226,8 @@ ps: ps-am
ps-am: ps-am:
uninstall-am: uninstall-binSCRIPTS uninstall-libLTLIBRARIES \ uninstall-am: uninstall-binSCRIPTS uninstall-libLTLIBRARIES \
uninstall-man uninstall-pkgconfigDATA \ uninstall-man uninstall-nodist_pkgincludeHEADERS \
uninstall-pkgincludeHEADERS uninstall-pkgconfigDATA uninstall-pkgincludeHEADERS
@$(NORMAL_INSTALL) @$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) uninstall-hook $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
uninstall-man: uninstall-man3 uninstall-man5 uninstall-man: uninstall-man3 uninstall-man5
@@ -1176,69 +1238,127 @@ uninstall-man: uninstall-man3 uninstall-man5
.PHONY: CTAGS GTAGS all all-am am--refresh check check-TESTS check-am \ .PHONY: CTAGS GTAGS all all-am am--refresh check check-TESTS check-am \
clean clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \ clean clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \
clean-libtool ctags dist dist-all dist-bzip2 dist-gzip \ clean-libtool ctags dist dist-all dist-bzip2 dist-gzip \
dist-lzma dist-shar dist-tarZ dist-xz dist-zip distcheck \ dist-hook dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
distclean distclean-compile distclean-generic distclean-hdr \ distcheck distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distcleancheck distdir \ distclean-hdr distclean-libtool distclean-tags distcleancheck \
distuninstallcheck dvi dvi-am html html-am info info-am \ distdir distuninstallcheck dvi dvi-am html html-am info \
install install-am install-binSCRIPTS install-data \ info-am install install-am install-binSCRIPTS install-data \
install-data-am install-data-hook install-dvi install-dvi-am \ install-data-am install-data-hook install-dvi install-dvi-am \
install-exec install-exec-am install-exec-hook install-html \ install-exec install-exec-am install-exec-hook install-html \
install-html-am install-info install-info-am \ install-html-am install-info install-info-am \
install-libLTLIBRARIES install-man install-man3 install-man5 \ install-libLTLIBRARIES install-man install-man3 install-man5 \
install-pdf install-pdf-am install-pkgconfigDATA \ install-nodist_pkgincludeHEADERS install-pdf install-pdf-am \
install-pkgincludeHEADERS install-ps install-ps-am \ install-pkgconfigDATA install-pkgincludeHEADERS install-ps \
install-strip installcheck installcheck-am installdirs \ install-ps-am install-strip installcheck installcheck-am \
maintainer-clean maintainer-clean-generic mostlyclean \ installdirs maintainer-clean maintainer-clean-generic \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ mostlyclean mostlyclean-compile mostlyclean-generic \
pdf pdf-am ps ps-am tags uninstall uninstall-am \ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
uninstall-binSCRIPTS uninstall-hook uninstall-libLTLIBRARIES \ uninstall-am uninstall-binSCRIPTS uninstall-hook \
uninstall-man uninstall-man3 uninstall-man5 \ uninstall-libLTLIBRARIES uninstall-man uninstall-man3 \
uninstall-man5 uninstall-nodist_pkgincludeHEADERS \
uninstall-pkgconfigDATA uninstall-pkgincludeHEADERS uninstall-pkgconfigDATA uninstall-pkgincludeHEADERS
@HAVE_LD_VERSION_SCRIPT_TRUE@ # Versioned symbols and restricted exports
@HAVE_LD_VERSION_SCRIPT_FALSE@ # Only restricted exports when possible
$(PNGLIB_BASENAME).pc: libpng.pc $(PNGLIB_BASENAME).pc: libpng.pc
cp libpng.pc $@ cp libpng.pc $@
$(PNGLIB_BASENAME)-config: libpng-config $(PNGLIB_BASENAME)-config: libpng-config
cp libpng-config $@ cp libpng-config $@
libpng.sym: png.h pngconf.h scripts/sym.out scripts/vers.out: png.h pngconf.h pnglibconf.h
rm -f $@ $@.new scripts/symbols.out: png.h pngconf.h $(srcdir)/scripts/pnglibconf.h.prebuilt
$(CPP) @LIBPNG_DEFINES@ $(CPPFLAGS) -DPNG_BUILDSYMS $(srcdir)/png.h | \
$(SED) -n -e \
's|^.*PNG_FUNCTION_EXPORT[ ]*\([$(AN)]*\).*$$|$(SYMBOL_PREFIX)\1|p' \
-e 's|^.*PNG_DATA_EXPORT[ ]*\([$(AN)]*\).*$$|$(SYMBOL_PREFIX)\1|p' \
>$@.new
mv $@.new $@
libpng.vers: libpng.sym libpng.sym: scripts/sym.out
rm -f $@ $@.new rm -f $@
echo PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0 '{global:' > $@.new cp $? $@
$(SED) s/$$/\;/ libpng.sym >> $@.new libpng.vers: scripts/vers.out
echo 'local: *; };' >> $@.new rm -f $@
mv $@.new $@ cp $? $@
pnglibconf.h: pnglibconf.out
rm -f $@
cp $? $@
$(srcdir)/scripts/pnglibconf.h.prebuilt:
@echo "Attempting to build $@" >&2
@echo "This is a machine generated file, but if you want to make" >&2
@echo "a new one simply make 'scripts/pnglibconf.out' and copy that" >&2
@exit 1
test: check # The following is necessary to ensure that the local pnglibconf.h is used, not
# an installed one (this can happen immediately after on a clean system if
# 'make test' is the first thing the user does.)
pngvalid.o pngtest.o: pnglibconf.h
.dfn.out:
rm -f $@ dfn.c dfn?.out
test -d scripts || mkdir scripts
echo '#include "$<"' >dfn.c
$(DFNCPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) @LIBPNG_DEFINES@\
$(CPPFLAGS) $(SYMBOL_CFLAGS) dfn.c > dfn1.out
$(SED) -n -e 's|^.*PNG_DEFN_MAGIC-\(.*\)-PNG_DEFN_END.*$$|\1|p'\
dfn1.out >dfn2.out
$(SED) -e 's| *@@@ *||g' -e 's| *$$||' dfn2.out >dfn3.out
rm -f dfn.c dfn[12].out
mv dfn3.out $@
# The .dfn file for pnglibconf.h is machine generated
pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk
rm -f $@ dfn?.out
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn1.out\
${srcdir}/scripts/pnglibconf.dfa $(DFA_XTRA) 1>&2
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn2.out dfn1.out 1>&2
rm dfn1.out
mv dfn2.out $@
# Symbol checks (.def and .out files should match)
scripts/symbols.chk: scripts/checksym.awk scripts/symbols.def scripts/symbols.out
.out.chk:
rm -f $@ symbols.new
$(AWK) -f ${srcdir}/scripts/checksym.awk ${srcdir}/scripts/${*F}.def\
$< >&2
mv symbols.new $@
# used on demand to regenerate the standard header, CPPFLAGS should
# be empty - no non-standard defines
scripts/pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk
rm -f $@ dfn?.out
test -z "$(CPPFLAGS)"
echo "com @PNGLIB_VERSION@ STANDARD API DEFINITION" |\
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn1.out\
logunsupported=1 - ${srcdir}/scripts/pnglibconf.dfa 1>&2
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn2.out dfn1.out 1>&2
rm dfn1.out
mv dfn2.out $@
$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS): png.h pngconf.h \
pnglibconf.h pngpriv.h pngdebug.h pnginfo.h pngstruct.h
test: check-am
# Extra checks
check: scripts/symbols.chk
# Don't distribute the generated script files
dist-hook:
cd '$(top_distdir)'; rm -f $(SCRIPT_CLEANFILES)
# 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 pnglibconf.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 \ cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/pngconf.h \
pngconf.h pngconf.h
cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/pnglibconf.h \
pnglibconf.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 libpng15 to be used # do evil things to libpng to cause libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ to be used
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
@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 so.@PNGLIB_MAJOR@@PNGLIB_MINOR@.@PNGLIB_RELEASE@ sl dylib dll.a; do\
rm -f libpng.$$ext;\ rm -f libpng.$$ext;\
if test -f $(PNGLIB_BASENAME).$$ext; then\ if test -f $(PNGLIB_BASENAME).$$ext; then\
$(LN_S) $(PNGLIB_BASENAME).$$ext libpng.$$ext;\ $(LN_S) $(PNGLIB_BASENAME).$$ext libpng.$$ext;\
@@ -1246,9 +1366,11 @@ install-exec-hook:
done done
uninstall-hook: uninstall-hook:
cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h pnglibconf.h
rm -f $(DESTDIR)$(pkgconfigdir)/libpng.pc rm -f $(DESTDIR)$(pkgconfigdir)/libpng.pc
rm -f $(DESTDIR)$(bindir)/libpng-config rm -f $(DESTDIR)$(bindir)/libpng-config
rm -f $(DESTDIR)$(libdir)/libpng.a
rm -f $(DESTDIR)$(libdir)/libpng.la
# Tell versions [3.59,3.63) of GNU make to not export all variables. # Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded. # Otherwise a system limit (for SysV at least) may be exceeded.

95
README
View File

@@ -1,4 +1,4 @@
README for libpng version 1.5.0alpha01 - January 2, 2010 (shared library 15.0) README for libpng version 1.6.0alpha01 - September 3, 2011 (shared library 15.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.
@@ -58,7 +58,7 @@ on the PNG-implement mailing list and not on material submitted
privately to Guy, Andreas, or Glenn. They will forward any good privately to Guy, Andreas, or Glenn. They will forward any good
suggestions to the list. suggestions to the list.
For a detailed description on using libpng, read libpng.txt. For For a detailed description on using libpng, read libpng-manual.txt. For
examples of libpng in a program, see example.c and pngtest.c. For usage examples of libpng in a program, see example.c and pngtest.c. For usage
information and restrictions (what little they are) on libpng, see information and restrictions (what little they are) on libpng, see
png.h. For a description on using zlib (the compression library used by png.h. For a description on using zlib (the compression library used by
@@ -114,19 +114,16 @@ given in previous versions of this document. He and Andreas will
read mail addressed to the png-implement list, however. read mail addressed to the png-implement list, however.
Please do not send general questions about PNG. Send them to Please do not send general questions about PNG. Send them to
the (png-list at ccrc.wustl.edu, subscription required, write to png-mng-misc at lists.sf.net (subscription required; visit
majordomo at ccrc.wustl.edu with "subscribe png-list" in your message). https://lists.sourceforge.net/lists/listinfo/png-mng-misc to
On the other hand, subscribe). If you have a question about something
please do not send libpng questions to that address, send them to me
or to the png-implement list. I'll
get them in the end anyway. If you have a question about something
in the PNG specification that is related to using libpng, send it in the PNG specification that is related to using libpng, send it
to me. Send me any questions that start with "I was using libpng, to me. Send me any questions that start with "I was using libpng,
and ...". If in doubt, send questions to me. I'll bounce them and ...". If in doubt, send questions to me. I'll bounce them
to others, if necessary. to others, if necessary.
Please do not send suggestions on how to change PNG. We have Please do not send suggestions on how to change PNG. We have
been discussing PNG for nine years now, and it is official and been discussing PNG for sixteen years now, and it is official and
finished. If you have suggestions for libpng, however, I'll finished. If you have suggestions for libpng, however, I'll
gladly listen. Even if your suggestion is not used immediately, gladly listen. Even if your suggestion is not used immediately,
it may be used later. it may be used later.
@@ -141,13 +138,17 @@ Files in this distribution:
TODO => Things not implemented in the current library TODO => Things not implemented in the current library
Y2KINFO => Statement of Y2K compliance Y2KINFO => Statement of Y2K compliance
example.c => Example code for using libpng functions example.c => Example code for using libpng functions
libpng.3 => manual page for libpng (includes libpng.txt) libpng.3 => manual page for libpng (includes libpng-manual.txt)
libpng.txt => Description of libpng and its functions libpng-manual.txt => Description of libpng and its functions
libpngpf.3 => manual page for libpng's private functions libpngpf.3 => manual page for libpng's private functions
png.5 => manual page for the PNG format png.5 => manual page for the PNG format
png.c => Basic interface functions common to library png.c => Basic interface functions common to library
png.h => Library function and interface declarations png.h => Library function and interface declarations (public)
pngconf.h => System specific library configuration pngpriv.h => Library function and interface declarations (private)
pngconf.h => System specific library configuration (public)
pngstruct.h => png_struct declaration (private)
pnginfo.h => png_info struct declaration (private)
pngdebug.h => debugging macros (private)
pngerror.c => Error/warning message I/O functions pngerror.c => Error/warning message I/O functions
pngget.c => Functions for retrieving info from struct pngget.c => Functions for retrieving info from struct
pngmem.c => Memory handling functions pngmem.c => Memory handling functions
@@ -176,72 +177,16 @@ Files in this distribution:
visupng => Contains a MSVC workspace for VisualPng visupng => Contains a MSVC workspace for VisualPng
projects => Contains project files and workspaces for projects => Contains project files and workspaces for
building a DLL building a DLL
c5builder => Contains a Borland workspace for building cbuilder5 => Contains a Borland workspace for building
libpng and zlib libpng and zlib
visualc6 => Contains a Microsoft Visual C++ (MSVC) visualc6 => Contains a Microsoft Visual C++ (MSVC)
workspace for building libpng and zlib workspace for building libpng and zlib
visualc71 => Contains a Microsoft Visual C++ (MSVC)
workspace for building libpng and zlib
xcode => Contains an Apple xcode
workspace for building libpng and zlib
scripts => Directory containing scripts for building libpng: scripts => Directory containing scripts for building libpng:
descrip.mms => VMS makefile for MMS or MMK (see scripts/README.txt for the list of scripts)
makefile.std => Generic UNIX makefile (cc, creates static
libpng.a)
makefile.elf => Linux/ELF makefile symbol versioning,
gcc, creates libpng15.so.15.1.5.0alpha01)
makefile.linux => Linux/ELF makefile
(gcc, creates libpng15.so.15.1.5.0alpha01)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with
ansi2knr (Requires ansi2knr.c from
ftp://ftp.cs.wisc.edu/ghost)
makefile.aix => AIX makefile
makefile.cygwin => Cygwin/gcc makefile
makefile.darwin => Darwin makefile
makefile.dec => DEC Alpha UNIX makefile
makefile.freebsd => FreeBSD makefile
makefile.hpgcc => HPUX makefile using gcc
makefile.hpux => HPUX (10.20 and 11.00) makefile
makefile.hp64 => HPUX (10.20 and 11.00) makefile, 64 bit
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
makefile.intel => Intel C/C++ version 4.0 and later
makefile.mingw => Mingw/gcc makefile
makefile.netbsd => NetBSD/cc makefile, makes libpng.so.
makefile.ne15bsd => NetBSD/cc makefile, makes
libpng15.so
makefile.openbsd => OpenBSD makefile
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
makefile.sggcc => Silicon Graphics
(gcc, creates libpng15.so.15.1.5.0alpha01)
makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile
(gcc, creates libpng15.so.15.1.5.0alpha01)
makefile.so9 => Solaris 9 makefile
(gcc, creates libpng15.so.15.1.5.0alpha01)
makefile.32sunu => Sun Ultra 32-bit makefile
makefile.64sunu => Sun Ultra 64-bit makefile
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.mips => MIPS makefile
makefile.acorn => Acorn makefile
makefile.amiga => Amiga makefile
smakefile.ppc => AMIGA smakefile for SAS C V6.58/7.00 PPC
compiler (Requires SCOPTIONS, copied from
scripts/SCOPTIONS.ppc)
makefile.atari => Atari makefile
makefile.beos => BEOS makefile for X86
makefile.bor => Borland makefile (uses bcc)
makefile.bc32 => 32-bit Borland C++ (all modules compiled in C mode)
makefile.tc3 => Turbo C 3.0 makefile
makefile.dj2 => DJGPP 2 makefile
makefile.msc => Microsoft C makefile
makefile.vcwin32 => makefile for Microsoft Visual C++ 4.0 and
later (does not use assembler code)
makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def)
png32ce.def => module definition for makefile.cegccg
pngos2.def => OS/2 module definition file used by
makefile.os2
pngwin.def => module definition file used by
makefile.cygwin and makefile.mingw
makefile.watcom => Watcom 10a+ Makefile, 32-bit flat memory model
makevms.com => VMS build script
SCOPTIONS.ppc => Used with smakefile.ppc
Good luck, and happy coding. Good luck, and happy coding.

8
TODO
View File

@@ -2,12 +2,10 @@
TODO - list of things to do for libpng: TODO - list of things to do for libpng:
Final bug fixes. Final bug fixes.
Improve API by hiding the png_struct and png_info structs.
Finish work on the no-floating-point version (including gamma compensation)
Better C++ wrapper/full C++ implementation? Better C++ wrapper/full C++ implementation?
Fix problem with C++ and EXTERN "C". Fix problem with C++ and EXTERN "C".
cHRM transformation. cHRM transformation.
Improve setjmp/longjmp usage or remove it in favor of returning error codes. Remove setjmp/longjmp usage in favor of returning error codes.
Add "grayscale->palette" transformation and "palette->grayscale" detection. Add "grayscale->palette" transformation and "palette->grayscale" detection.
Improved dithering. Improved dithering.
Multi-lingual error and warning message support. Multi-lingual error and warning message support.
@@ -18,14 +16,12 @@ Better filter selection
(counting huffman bits/precompression? filter inertia? filter costs?). (counting huffman bits/precompression? filter inertia? filter costs?).
Histogram creation. Histogram creation.
Text conversion between different code pages (Latin-1 -> Mac and DOS). Text conversion between different code pages (Latin-1 -> Mac and DOS).
Build gamma tables using fixed point (and do away with floating point entirely).
Avoid building gamma tables whenever possible. Avoid building gamma tables whenever possible.
Use greater precision when changing to linear gamma for compositing against Use greater precision when changing to linear gamma for compositing against
background and doing rgb-to-gray transformation. background and doing rgb-to-gray transformation.
Investigate pre-incremented loop counters and other loop constructions. Investigate pre-incremented loop counters and other loop constructions.
Add interpolated method of handling interlacing. Add interpolated method of handling interlacing.
Provide for conditional compilation of 16-bit support (except for the
initial stripping down to 8-bits when reading a 16-bit PNG datastream).
Switch to the simpler zlib (zlib/libpng) license if legally possible. Switch to the simpler zlib (zlib/libpng) license if legally possible.
Extend pngvalid.c to validate more of the libpng transformations.
*/ */

2081
aclocal.m4 vendored

File diff suppressed because it is too large Load Diff

View File

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

196
config.guess vendored Executable file → Normal file
View File

@@ -1,10 +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, 2006, 2007, 2008 # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
# Free Software Foundation, Inc. # Free Software Foundation, Inc.
timestamp='2009-04-27' timestamp='2009-11-20'
# This file is free software; you can redistribute it and/or modify it # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
@@ -27,16 +27,16 @@ timestamp='2009-04-27'
# the same distribution terms that you use for the rest of that program. # the same distribution terms that you use for the rest of that program.
# Originally written by Per Bothner <per@bothner.com>. # Originally written by Per Bothner. Please send patches (context
# Please send patches to <config-patches@gnu.org>. Submit a context # diff format) to <config-patches@gnu.org> and include a ChangeLog
# diff and a properly formatted ChangeLog entry. # entry.
# #
# This script attempts to guess a canonical system name similar to # This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and # config.sub. If it succeeds, it prints the system name on stdout, and
# exits with 0. Otherwise, it exits with 1. # exits with 0. Otherwise, it exits with 1.
# #
# The plan is that this can be called by configure scripts if you # You can get the latest version of this script from:
# don't specify an explicit build system type. # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
me=`echo "$0" | sed -e 's,.*/,,'` me=`echo "$0" | sed -e 's,.*/,,'`
@@ -170,7 +170,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
arm*|i386|m68k|ns32k|sh3*|sparc|vax) arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep __ELF__ >/dev/null | grep -q __ELF__
then then
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
# Return netbsd for either. FIX? # Return netbsd for either. FIX?
@@ -333,6 +333,9 @@ 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:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
echo i386-pc-auroraux${UNAME_RELEASE}
exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
eval $set_cc_for_build eval $set_cc_for_build
SUN_ARCH="i386" SUN_ARCH="i386"
@@ -656,7 +659,7 @@ EOF
# => hppa64-hp-hpux11.23 # => hppa64-hp-hpux11.23
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
grep __LP64__ >/dev/null grep -q __LP64__
then then
HP_ARCH="hppa2.0w" HP_ARCH="hppa2.0w"
else else
@@ -807,12 +810,12 @@ EOF
i*:PW*:*) i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32 echo ${UNAME_MACHINE}-pc-pw32
exit ;; exit ;;
*:Interix*:[3456]*) *:Interix*:*)
case ${UNAME_MACHINE} in case ${UNAME_MACHINE} in
x86) x86)
echo i586-pc-interix${UNAME_RELEASE} echo i586-pc-interix${UNAME_RELEASE}
exit ;; exit ;;
EM64T | authenticamd | genuineintel) authenticamd | genuineintel | EM64T)
echo x86_64-unknown-interix${UNAME_RELEASE} echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;; exit ;;
IA64) IA64)
@@ -822,6 +825,9 @@ EOF
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks echo i${UNAME_MACHINE}-pc-mks
exit ;; exit ;;
8664:Windows_NT:*)
echo x86_64-pc-mks
exit ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*) i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem? # How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
@@ -851,6 +857,20 @@ EOF
i*86:Minix:*:*) i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix echo ${UNAME_MACHINE}-pc-minix
exit ;; exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;;
EV56) UNAME_MACHINE=alphaev56 ;;
PCA56) UNAME_MACHINE=alphapca56 ;;
PCA57) UNAME_MACHINE=alphapca56 ;;
EV6) UNAME_MACHINE=alphaev6 ;;
EV67) UNAME_MACHINE=alphaev67 ;;
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
exit ;;
arm*:Linux:*:*) arm*:Linux:*:*)
eval $set_cc_for_build eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
@@ -873,6 +893,17 @@ EOF
frv:Linux:*:*) frv:Linux:*:*)
echo frv-unknown-linux-gnu echo frv-unknown-linux-gnu
exit ;; exit ;;
i*86:Linux:*:*)
LIBC=gnu
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#ifdef __dietlibc__
LIBC=dietlibc
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
exit ;;
ia64:Linux:*:*) ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;; exit ;;
@@ -882,78 +913,34 @@ EOF
m68*:Linux:*:*) m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;; exit ;;
mips:Linux:*:*) mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c sed 's/^ //' << EOF >$dummy.c
#undef CPU #undef CPU
#undef mips #undef ${UNAME_MACHINE}
#undef mipsel #undef ${UNAME_MACHINE}el
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=mipsel CPU=${UNAME_MACHINE}el
#else #else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=mips CPU=${UNAME_MACHINE}
#else #else
CPU= CPU=
#endif #endif
#endif #endif
EOF EOF
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
/^CPU/{
s: ::g
p
}'`"
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
mips64:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
#undef mips64
#undef mips64el
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=mips64el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=mips64
#else
CPU=
#endif
#endif
EOF
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
/^CPU/{
s: ::g
p
}'`"
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;; ;;
or32:Linux:*:*) or32:Linux:*:*)
echo or32-unknown-linux-gnu echo or32-unknown-linux-gnu
exit ;; exit ;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
exit ;;
ppc64:Linux:*:*)
echo powerpc64-unknown-linux-gnu
exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;;
EV56) UNAME_MACHINE=alphaev56 ;;
PCA56) UNAME_MACHINE=alphapca56 ;;
PCA57) UNAME_MACHINE=alphapca56 ;;
EV6) UNAME_MACHINE=alphaev6 ;;
EV67) UNAME_MACHINE=alphaev67 ;;
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
exit ;;
padre:Linux:*:*) padre:Linux:*:*)
echo sparc-unknown-linux-gnu echo sparc-unknown-linux-gnu
exit ;; exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-gnu
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
@@ -962,8 +949,11 @@ EOF
*) echo hppa-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;;
esac esac
exit ;; exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*) ppc64:Linux:*:*)
echo hppa64-unknown-linux-gnu echo powerpc64-unknown-linux-gnu
exit ;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
exit ;; exit ;;
s390:Linux:*:* | s390x:Linux:*:*) s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux echo ${UNAME_MACHINE}-ibm-linux
@@ -986,66 +976,6 @@ EOF
xtensa*:Linux:*:*) xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;; exit ;;
i*86:Linux:*:*)
# The BFD linker knows what the default object file format is, so
# first see if it will tell us. cd to the root directory to prevent
# problems with other programs or directories called `ld' in the path.
# Set LC_ALL=C to ensure ld outputs messages in English.
ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
| sed -ne '/supported targets:/!d
s/[ ][ ]*/ /g
s/.*supported targets: *//
s/ .*//
p'`
case "$ld_supported_targets" in
elf32-i386)
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
;;
a.out-i386-linux)
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
exit ;;
"")
# Either a pre-BFD a.out linker (linux-gnuoldld) or
# one that does not give us useful --help.
echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
exit ;;
esac
# Determine whether the default compiler is a.out or elf
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#include <features.h>
#ifdef __ELF__
# ifdef __GLIBC__
# if __GLIBC__ >= 2
LIBC=gnu
# else
LIBC=gnulibc1
# endif
# else
LIBC=gnulibc1
# endif
#else
#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
LIBC=gnu
#else
LIBC=gnuaout
#endif
#endif
#ifdef __dietlibc__
LIBC=dietlibc
#endif
EOF
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
/^LIBC/{
s: ::g
p
}'`"
test x"${LIBC}" != x && {
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
exit
}
test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
;;
i*86:DYNIX/ptx:4*:*) i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# earlier versions are messed up and put the nodename in both # earlier versions are messed up and put the nodename in both
@@ -1074,7 +1004,7 @@ EOF
i*86:syllable:*:*) i*86:syllable:*:*)
echo ${UNAME_MACHINE}-pc-syllable echo ${UNAME_MACHINE}-pc-syllable
exit ;; exit ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
echo i386-unknown-lynxos${UNAME_RELEASE} echo i386-unknown-lynxos${UNAME_RELEASE}
exit ;; exit ;;
i*86:*DOS:*:*) i*86:*DOS:*:*)
@@ -1182,7 +1112,7 @@ EOF
rs6000:LynxOS:2.*:*) rs6000:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE} echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit ;; exit ;;
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
echo powerpc-unknown-lynxos${UNAME_RELEASE} echo powerpc-unknown-lynxos${UNAME_RELEASE}
exit ;; exit ;;
SM[BE]S:UNIX_SV:*:*) SM[BE]S:UNIX_SV:*:*)
@@ -1275,6 +1205,16 @@ EOF
*:Darwin:*:*) *:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
case $UNAME_PROCESSOR in case $UNAME_PROCESSOR in
i386)
eval $set_cc_for_build
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
UNAME_PROCESSOR="x86_64"
fi
fi ;;
unknown) UNAME_PROCESSOR=powerpc ;; unknown) UNAME_PROCESSOR=powerpc ;;
esac esac
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}

43
config.sub vendored Executable file → Normal file
View File

@@ -1,10 +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, 2006, 2007, 2008 # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
# Free Software Foundation, Inc. # Free Software Foundation, Inc.
timestamp='2009-04-17' timestamp='2009-11-20'
# This file is (in principle) common to ALL GNU software. # This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software # The presence of a machine in this file suggests that SOME GNU software
@@ -32,13 +32,16 @@ timestamp='2009-04-17'
# Please send patches to <config-patches@gnu.org>. Submit a context # Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted ChangeLog entry. # diff and a properly formatted GNU ChangeLog entry.
# #
# Configuration subroutine to validate and canonicalize a configuration type. # Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument. # Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1. # If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed. # Otherwise, we print the canonical config type on stdout and succeed.
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
# This file is supposed to be the same for all GNU packages # This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases # and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software. # that are meaningful with *any* GNU software.
@@ -149,10 +152,13 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple | -axis | -knuth | -cray) -apple | -axis | -knuth | -cray | -microblaze)
os= os=
basic_machine=$1 basic_machine=$1
;; ;;
-bluegene*)
os=-cnk
;;
-sim | -cisco | -oki | -wec | -winbond) -sim | -cisco | -oki | -wec | -winbond)
os= os=
basic_machine=$1 basic_machine=$1
@@ -281,6 +287,7 @@ case $basic_machine in
| pdp10 | pdp11 | pj | pjl \ | pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \ | pyramid \
| rx \
| score \ | score \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \ | sh64 | sh64le \
@@ -288,13 +295,14 @@ case $basic_machine in
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
| spu | strongarm \ | spu | strongarm \
| tahoe | thumb | tic4x | tic80 | tron \ | tahoe | thumb | tic4x | tic80 | tron \
| ubicom32 \
| v850 | v850e \ | v850 | v850e \
| we32k \ | we32k \
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
| z8k | z80) | z8k | z80)
basic_machine=$basic_machine-unknown basic_machine=$basic_machine-unknown
;; ;;
m6811 | m68hc11 | m6812 | m68hc12) m6811 | m68hc11 | m6812 | m68hc12 | picochip)
# Motorola 68HC11/12. # Motorola 68HC11/12.
basic_machine=$basic_machine-unknown basic_machine=$basic_machine-unknown
os=-none os=-none
@@ -337,7 +345,7 @@ case $basic_machine in
| lm32-* \ | lm32-* \
| m32c-* | 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-* | metag-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \ | mips16-* \
| mips64-* | mips64el-* \ | mips64-* | mips64el-* \
@@ -365,7 +373,7 @@ case $basic_machine in
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \ | pyramid-* \
| romp-* | rs6000-* \ | romp-* | rs6000-* | rx-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
@@ -374,6 +382,7 @@ case $basic_machine in
| tahoe-* | thumb-* \ | tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
| tron-* \ | tron-* \
| ubicom32-* \
| v850-* | v850e-* | vax-* \ | v850-* | v850e-* | vax-* \
| we32k-* \ | we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
@@ -467,6 +476,10 @@ case $basic_machine in
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux os=-linux
;; ;;
bluegene*)
basic_machine=powerpc-ibm
os=-cnk
;;
c90) c90)
basic_machine=c90-cray basic_machine=c90-cray
os=-unicos os=-unicos
@@ -719,6 +732,9 @@ case $basic_machine in
basic_machine=ns32k-utek basic_machine=ns32k-utek
os=-sysv os=-sysv
;; ;;
microblaze)
basic_machine=microblaze-xilinx
;;
mingw32) mingw32)
basic_machine=i386-pc basic_machine=i386-pc
os=-mingw32 os=-mingw32
@@ -1240,6 +1256,9 @@ case $os in
# First match some system type aliases # First match some system type aliases
# that might get confused with valid system types. # that might get confused with valid system types.
# -solaris* is a basic system type, with this one exception. # -solaris* is a basic system type, with this one exception.
-auroraux)
os=-auroraux
;;
-solaris1 | -solaris1.*) -solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'` os=`echo $os | sed -e 's|solaris1|sunos4|'`
;; ;;
@@ -1260,9 +1279,9 @@ case $os in
# Each alternative MUST END IN A *, to match a version number. # Each alternative MUST END IN A *, to match a version number.
# -sysv* is not here because it comes later, after sysvr4. # -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
| -kopensolaris* \ | -sym* | -kopensolaris* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \ | -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
@@ -1283,7 +1302,7 @@ case $os in
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops*) | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
# Remember, each alternative MUST END IN *, to match a version number. # Remember, each alternative MUST END IN *, to match a version number.
;; ;;
-qnx*) -qnx*)
@@ -1613,7 +1632,7 @@ case $basic_machine in
-sunos*) -sunos*)
vendor=sun vendor=sun
;; ;;
-aix*) -cnk*|-aix*)
vendor=ibm vendor=ibm
;; ;;
-beos*) -beos*)

3728
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -18,14 +18,14 @@ AC_PREREQ(2.59)
dnl Version number stuff here: dnl Version number stuff here:
AC_INIT([libpng], [1.5.0alpha01], [png-mng-implement@lists.sourceforge.net]) AC_INIT([libpng], [1.6.0alpha01], [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.5.0alpha01 PNGLIB_VERSION=1.6.0alpha01
PNGLIB_MAJOR=1 PNGLIB_MAJOR=1
PNGLIB_MINOR=5 PNGLIB_MINOR=6
PNGLIB_RELEASE=0 PNGLIB_RELEASE=0
dnl End of version number stuff dnl End of version number stuff
@@ -34,15 +34,38 @@ AC_CONFIG_SRCDIR([pngget.c])
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
# Checks for programs. # Checks for programs.
AC_LANG([C])
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_CHECK_TOOL(AWK, awk, :)
AC_PROG_INSTALL AC_PROG_INSTALL
AC_PROG_LN_S AC_PROG_LN_S
AC_PROG_MAKE_SET AC_PROG_MAKE_SET
AC_PROG_LIBTOOL LT_INIT([win32-dll])
# On Solaris 10 and 12 CPP gets set to cc -E, however this still
# does some input parsing. We need strict ANSI-C style tokenization,
# check this:
AC_REQUIRE_CPP
AC_MSG_CHECKING([for a C preprocessor that does not parse its input])
AC_TRY_CPP([1.5.0 16BIT],
[DFNCPP="$CPP"],
[DFNCPP=""
sav_CPP="$CPP"
for CPP in "${CC-cc} -E" "${CC-cc} -E -traditional-cpp" "/lib/cpp" "cpp"; do
AC_TRY_CPP([1.5.0 16BIT],
[DFNCPP="$CPP"]
[break],,)
done
CPP="$sav_CPP"])
if test -n "$DFNCPP"; then
AC_MSG_RESULT([$DFNCPP])
AC_SUBST(DFNCPP)
else
AC_MSG_FAILURE([not found], 1)
fi
# Checks for header files. # Checks for header files.
AC_HEADER_STDC AC_HEADER_STDC
@@ -57,14 +80,48 @@ AC_STRUCT_TM
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_ARG_WITH(zlib-prefix,
AC_HELP_STRING([--with-zlib-prefix],
[prefix that may have been used in installed zlib]),
[ZPREFIX=${withval}],
[ZPREFIX='z_'])
AC_CHECK_LIB(z, zlibVersion, ,
AC_CHECK_LIB(z, ${ZPREFIX}zlibVersion, ,
AC_ERROR([zlib not installed])))
LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG
LIBPNG_DEFINES=$LIBPNG_DEFINES LIBPNG_DEFINES=$LIBPNG_DEFINES
AC_SUBST(LIBPNG_DEFINES) AC_SUBST(LIBPNG_DEFINES)
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` # Special case for PE/COFF platforms: ld reports
# support for version-script, but doesn't actually
# DO anything with it.
case $host in
*cygwin* | *mingw32* | *interix* )
have_ld_version_script=no
AC_MSG_RESULT(no)
;;
* )
AC_MSG_CHECKING([if using Solaris linker])
SLD=`$LD --version 2>&1 | grep Solaris`
if test "$SLD"; then
have_solaris_ld=yes
AC_MSG_RESULT(yes)
else
have_solaris_ld=no
AC_MSG_RESULT(no)
fi
AM_CONDITIONAL(HAVE_SOLARIS_LD, test "$have_solaris_ld" = "yes")
if test "$have_solaris_ld" = "yes"; then
GLD=`$LD --help < /dev/null 2>&1 | grep 'M mapfile'`
else
GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
fi
if test "$GLD"; then if test "$GLD"; then
have_ld_version_script=yes have_ld_version_script=yes
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
@@ -73,6 +130,9 @@ else
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
AC_MSG_WARN(*** You have not enabled versioned symbols.) AC_MSG_WARN(*** You have not enabled versioned symbols.)
fi fi
;;
esac
AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes") AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
if test "$have_ld_version_script" = "yes"; then if test "$have_ld_version_script" = "yes"; then

View File

@@ -1,12 +1,12 @@
GNU GENERAL PUBLIC LICENSE GNU GENERAL PUBLIC LICENSE
Version 2, June 1991 Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc. Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed. of this license document, but changing it is not allowed.
Preamble Preamble
The licenses for most software are designed to take away your The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public freedom to share and change it. By contrast, the GNU General Public
@@ -56,7 +56,7 @@ patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and The precise terms and conditions for copying, distribution and
modification follow. modification follow.
GNU GENERAL PUBLIC LICENSE GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains 0. This License applies to any program or other work which contains
@@ -255,7 +255,7 @@ 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 preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally. of promoting the sharing and reuse of software generally.
NO WARRANTY NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS 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 FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
@@ -277,9 +277,9 @@ 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 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES. POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest 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 possible use to the public, the best way to achieve this is to make it

View File

@@ -63,9 +63,9 @@ BUILD INSTRUCTIONS
- Prerequisites (in order of compilation): - Prerequisites (in order of compilation):
- zlib http://zlib.net/ - 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
The pngbook demo programs are explicitly designed to demonstrate proper The pngbook demo programs are explicitly designed to demonstrate proper
coding techniques for using the libpng reference library. As a result, coding techniques for using the libpng reference library. As a result,
@@ -165,19 +165,19 @@ RUNNING THE PROGRAMS: (VERY) BRIEF INTRO
rpng is a simple PNG viewer that can display transparent PNGs with a rpng is a simple PNG viewer that can display transparent PNGs with a
specified background color; for example, specified background color; for example,
rpng -bgcolor #ff0000 toucan.png rpng -bgcolor \#ff0000 toucan.png
would display the image with a red background. rpng2 is a progressive would display the image with a red background. rpng2 is a progressive
viewer that simulates a web browser in some respects; it can display viewer that simulates a web browser in some respects; it can display
images against either a background color or a dynamically generated images against either a background color or a dynamically generated
background image. For example: background image. For example:
rpng2 -bgpat 16 toucan.png rpng2 -bgpat 16 toucan.png
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-notrans.ppm > toucan-notrans.png wpng -time < toucan-notrans.ppm > toucan-notrans.png
would convert the specified PPM file (using redirection) to PNG, auto- would convert the specified PPM file (using redirection) to PNG, auto-
matically setting the PNG modification-time chunk. matically setting the PNG modification-time chunk.

View File

@@ -229,8 +229,14 @@ uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes)
png_set_expand(png_ptr); png_set_expand(png_ptr);
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
png_set_expand(png_ptr); png_set_expand(png_ptr);
#ifdef PNG_READ_16_TO_8_SUPPORTED
if (bit_depth == 16) if (bit_depth == 16)
# ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
png_set_scale_16(png_ptr);
# else
png_set_strip_16(png_ptr); png_set_strip_16(png_ptr);
# endif
#endif
if (color_type == PNG_COLOR_TYPE_GRAY || if (color_type == PNG_COLOR_TYPE_GRAY ||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA) color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
png_set_gray_to_rgb(png_ptr); png_set_gray_to_rgb(png_ptr);
@@ -263,7 +269,8 @@ uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes)
return NULL; return NULL;
} }
Trace((stderr, "readpng_get_image: channels = %d, rowbytes = %ld, height = %ld\n", *pChannels, rowbytes, height)); Trace((stderr, "readpng_get_image: channels = %d, rowbytes = %ld, height = %ld\n",
*pChannels, rowbytes, height));
/* set the individual row_pointers to point at the correct offsets */ /* set the individual row_pointers to point at the correct offsets */

View File

@@ -55,8 +55,10 @@
#include <stdlib.h> /* for exit() prototype */ #include <stdlib.h> /* for exit() prototype */
#include <setjmp.h>
#include "png.h" /* libpng header; includes zlib.h and setjmp.h */ #include <zlib.h>
#include "png.h" /* libpng header from the local directory */
#include "readpng2.h" /* typedefs, common macros, public prototypes */ #include "readpng2.h" /* typedefs, common macros, public prototypes */
@@ -73,84 +75,10 @@ static void readpng2_error_handler(png_structp png_ptr, png_const_charp msg);
void readpng2_version_info(void) void readpng2_version_info(void)
{ {
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && \ fprintf(stderr, " Compiled with libpng %s; using libpng %s\n",
(defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) && \ PNG_LIBPNG_VER_STRING, png_libpng_ver);
defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
/*
* WARNING: This preprocessor approach means that the following code
* cannot be used with a libpng DLL older than 1.2.0--the
* compiled-in symbols for the new functions will not exist.
* (Could use dlopen() and dlsym() on Unix and corresponding
* calls for Windows, but not portable...)
*/
{
int mmxsupport = png_mmx_support();
if (mmxsupport < 0)
fprintf(stderr, " Compiled with libpng %s; using libpng %s "
"without MMX support.\n", PNG_LIBPNG_VER_STRING, png_libpng_ver);
else {
int compilerID;
png_uint_32 mmx_mask = png_get_mmx_flagmask(
PNG_SELECT_READ | PNG_SELECT_WRITE, &compilerID);
fprintf(stderr, " Compiled with libpng %s; using libpng %s " fprintf(stderr, " and with zlib %s; using zlib %s.\n",
"with MMX support\n (%s version).", PNG_LIBPNG_VER_STRING,
png_libpng_ver, compilerID == 1? "MSVC++" :
(compilerID == 2? "GNU C" : "unknown"));
fprintf(stderr, " Processor (x86%s) %s MMX instructions.\n",
#if defined(__x86_64__)
"_64",
#else
"",
#endif
mmxsupport? "supports" : "does not support");
if (mmxsupport > 0) {
int num_optims = 0;
fprintf(stderr,
" Potential MMX optimizations supported by libpng:\n");
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_FILTER_SUB)
++num_optims;
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_FILTER_UP)
++num_optims;
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_FILTER_AVG)
++num_optims;
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH)
++num_optims;
if (num_optims)
fprintf(stderr,
" decoding %s row filters (reading)\n",
(num_optims == 4)? "all non-trivial" : "some");
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) {
fprintf(stderr, " combining rows (reading)\n");
++num_optims;
}
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_INTERLACE) {
fprintf(stderr,
" expanding interlacing (reading)\n");
++num_optims;
}
mmx_mask &= ~( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
| PNG_ASM_FLAG_MMX_READ_INTERLACE \
| PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
| PNG_ASM_FLAG_MMX_READ_FILTER_UP \
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH );
if (mmx_mask) {
fprintf(stderr, " other (unknown)\n");
++num_optims;
}
if (num_optims == 0)
fprintf(stderr, " (none)\n");
}
}
}
#else
fprintf(stderr, " Compiled with libpng %s; using libpng %s "
"without MMX support.\n", PNG_LIBPNG_VER_STRING, png_libpng_ver);
#endif
fprintf(stderr, " Compiled with zlib %s; using zlib %s.\n",
ZLIB_VERSION, zlib_version); ZLIB_VERSION, zlib_version);
} }
@@ -203,7 +131,7 @@ int readpng2_init(mainprog_info *mainprog_ptr)
} }
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
/* prepare the reader to ignore all recognized chunks whose data won't be /* 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, * used, i.e., all chunks recognized by libpng except for IHDR, PLTE, IDAT,
* IEND, tRNS, bKGD, gAMA, and sRGB (small performance improvement) */ * IEND, tRNS, bKGD, gAMA, and sRGB (small performance improvement) */
@@ -212,7 +140,7 @@ int readpng2_init(mainprog_info *mainprog_ptr)
* version recognizes more chunks, add them to this list. If a * version recognizes more chunks, add them to this list. If a
* future version of readpng2.c recognizes more chunks, delete them * future version of readpng2.c recognizes more chunks, delete them
* from this list. */ * from this list. */
static const png_byte chunks_to_ignore[] = { static /* const */ png_byte chunks_to_ignore[] = {
99, 72, 82, 77, '\0', /* cHRM */ 99, 72, 82, 77, '\0', /* cHRM */
104, 73, 83, 84, '\0', /* hIST */ 104, 73, 83, 84, '\0', /* hIST */
105, 67, 67, 80, '\0', /* iCCP */ 105, 67, 67, 80, '\0', /* iCCP */
@@ -232,7 +160,7 @@ int readpng2_init(mainprog_info *mainprog_ptr)
png_set_keep_unknown_chunks(png_ptr, 1 /* PNG_HANDLE_CHUNK_NEVER */, png_set_keep_unknown_chunks(png_ptr, 1 /* PNG_HANDLE_CHUNK_NEVER */,
chunks_to_ignore, sizeof(chunks_to_ignore)/5); chunks_to_ignore, sizeof(chunks_to_ignore)/5);
} }
#endif /* PNG_UNKNOWN_CHUNKS_SUPPORTED */ #endif /* PNG_HANDLE_AS_UNKNOWN_SUPPORTED */
/* instead of doing png_init_io() here, now we set up our callback /* instead of doing png_init_io() here, now we set up our callback
@@ -242,96 +170,6 @@ int readpng2_init(mainprog_info *mainprog_ptr)
readpng2_info_callback, readpng2_row_callback, readpng2_end_callback); readpng2_info_callback, readpng2_row_callback, readpng2_end_callback);
/*
* may as well enable or disable MMX routines here, if supported;
*
* to enable all: mask = png_get_mmx_flagmask (
* PNG_SELECT_READ | PNG_SELECT_WRITE, &compilerID);
* flags = png_get_asm_flags (png_ptr);
* flags |= mask;
* png_set_asm_flags (png_ptr, flags);
*
* to disable all: mask = png_get_mmx_flagmask (
* PNG_SELECT_READ | PNG_SELECT_WRITE, &compilerID);
* flags = png_get_asm_flags (png_ptr);
* flags &= ~mask;
* png_set_asm_flags (png_ptr, flags);
*/
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) && \
defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
/*
* WARNING: This preprocessor approach means that the following code
* cannot be used with a libpng DLL older than 1.2.0--the
* compiled-in symbols for the new functions will not exist.
* (Could use dlopen() and dlsym() on Unix and corresponding
* calls for Windows, but not portable...)
*/
{
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
png_uint_32 mmx_disable_mask = 0;
png_uint_32 asm_flags, mmx_mask;
int compilerID;
if (mainprog_ptr->nommxfilters)
mmx_disable_mask |= ( PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
| PNG_ASM_FLAG_MMX_READ_FILTER_UP \
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH );
if (mainprog_ptr->nommxcombine)
mmx_disable_mask |= PNG_ASM_FLAG_MMX_READ_COMBINE_ROW;
if (mainprog_ptr->nommxinterlace)
mmx_disable_mask |= PNG_ASM_FLAG_MMX_READ_INTERLACE;
asm_flags = png_get_asm_flags(png_ptr);
png_set_asm_flags(png_ptr, asm_flags & ~mmx_disable_mask);
/* Now query libpng's asm settings, just for yuks. Note that this
* differs from the querying of its *potential* MMX capabilities
* in readpng2_version_info(); this is true runtime verification. */
asm_flags = png_get_asm_flags(png_ptr);
mmx_mask = png_get_mmx_flagmask(PNG_SELECT_READ | PNG_SELECT_WRITE,
&compilerID);
if (asm_flags & PNG_ASM_FLAG_MMX_SUPPORT_COMPILED)
fprintf(stderr,
" MMX support (%s version) is compiled into libpng\n",
compilerID == 1? "MSVC++" :
(compilerID == 2? "GNU C" : "unknown"));
else
fprintf(stderr, " MMX support is not compiled into libpng\n");
fprintf(stderr, " MMX instructions are %ssupported by CPU\n",
(asm_flags & PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU)? "" : "not ");
fprintf(stderr, " MMX read support for combining rows is %sabled\n",
(asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)? "en" : "dis");
fprintf(stderr,
" MMX read support for expanding interlacing is %sabled\n",
(asm_flags & PNG_ASM_FLAG_MMX_READ_INTERLACE)? "en" : "dis");
fprintf(stderr, " MMX read support for \"sub\" filter is %sabled\n",
(asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB)? "en" : "dis");
fprintf(stderr, " MMX read support for \"up\" filter is %sabled\n",
(asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP)? "en" : "dis");
fprintf(stderr, " MMX read support for \"avg\" filter is %sabled\n",
(asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG)? "en" : "dis");
fprintf(stderr, " MMX read support for \"Paeth\" filter is %sabled\n",
(asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH)? "en" : "dis");
asm_flags &= (mmx_mask & ~( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
| PNG_ASM_FLAG_MMX_READ_INTERLACE \
| PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
| PNG_ASM_FLAG_MMX_READ_FILTER_UP \
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ));
if (asm_flags)
fprintf(stderr,
" additional MMX support is also enabled (0x%02lx)\n",
asm_flags);
#else /* !PNG_ASSEMBLER_CODE_SUPPORTED */
fprintf(stderr, " MMX querying is disabled in libpng.\n");
#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
}
#endif
/* make sure we save our pointers for use in readpng2_decode_data() */ /* make sure we save our pointers for use in readpng2_decode_data() */
mainprog_ptr->png_ptr = png_ptr; mainprog_ptr->png_ptr = png_ptr;
@@ -380,7 +218,11 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
mainprog_info *mainprog_ptr; mainprog_info *mainprog_ptr;
int color_type, bit_depth; int color_type, bit_depth;
png_uint_32 width, height; png_uint_32 width, height;
#ifdef PNG_FLOATING_POINT_SUPPORTED
double gamma; double gamma;
#else
png_fixed_point gamma;
#endif
/* setjmp() doesn't make sense here, because we'd either have to exit(), /* setjmp() doesn't make sense here, because we'd either have to exit(),
@@ -469,8 +311,14 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
png_set_expand(png_ptr); png_set_expand(png_ptr);
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
png_set_expand(png_ptr); png_set_expand(png_ptr);
#ifdef PNG_READ_16_TO_8_SUPPORTED
if (bit_depth == 16) if (bit_depth == 16)
# ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
png_set_scale_16(png_ptr);
# else
png_set_strip_16(png_ptr); png_set_strip_16(png_ptr);
# endif
#endif
if (color_type == PNG_COLOR_TYPE_GRAY || if (color_type == PNG_COLOR_TYPE_GRAY ||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA) color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
png_set_gray_to_rgb(png_ptr); png_set_gray_to_rgb(png_ptr);
@@ -491,11 +339,19 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
* "gamma" value for the entire display system, i.e., the product of * "gamma" value for the entire display system, i.e., the product of
* LUT_exponent and CRT_exponent. */ * LUT_exponent and CRT_exponent. */
#ifdef PNG_FLOATING_POINT_SUPPORTED
if (png_get_gAMA(png_ptr, info_ptr, &gamma)) if (png_get_gAMA(png_ptr, info_ptr, &gamma))
png_set_gamma(png_ptr, mainprog_ptr->display_exponent, gamma); png_set_gamma(png_ptr, mainprog_ptr->display_exponent, gamma);
else else
png_set_gamma(png_ptr, mainprog_ptr->display_exponent, 0.45455); png_set_gamma(png_ptr, mainprog_ptr->display_exponent, 0.45455);
#else
if (png_get_gAMA_fixed(png_ptr, info_ptr, &gamma))
png_set_gamma_fixed(png_ptr,
(png_fixed_point)(100000*mainprog_ptr->display_exponent+.5), gamma);
else
png_set_gamma_fixed(png_ptr,
(png_fixed_point)(100000*mainprog_ptr->display_exponent+.5), 45455);
#endif
/* we'll let libpng expand interlaced images, too */ /* we'll let libpng expand interlaced images, too */
@@ -644,5 +500,12 @@ static void readpng2_error_handler(png_structp png_ptr, png_const_charp msg)
exit(99); exit(99);
} }
/* Now we have our data structure we can use the information in it
* to return control to our own higher level code (all the points
* where 'setjmp' is called in this file.) This will work with other
* error handling mechanisms as well - libpng always calls png_error
* when it can proceed no further, thus, so long as the error handler
* is intercepted, application code can do its own error recovery.
*/
longjmp(mainprog_ptr->jmpbuf, 1); longjmp(mainprog_ptr->jmpbuf, 1);
} }

View File

@@ -96,11 +96,6 @@ typedef struct _mainprog_info {
int rowbytes; int rowbytes;
int channels; int channels;
int need_bgcolor; int need_bgcolor;
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
int nommxfilters;
int nommxcombine;
int nommxinterlace;
#endif
int state; int state;
uch bg_red; uch bg_red;
uch bg_green; uch bg_green;

View File

@@ -85,7 +85,33 @@
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <windows.h> #include <windows.h>
#ifdef __CYGWIN__
/* getch replacement. Turns out, we don't really need this,
* but leave it here if we ever enable any of the uses of
* _getch in the main code
*/
#include <unistd.h>
#include <termio.h>
#include <sys/ioctl.h>
int repl_getch( void )
{
char ch;
int fd = fileno(stdin);
struct termio old_tty, new_tty;
ioctl(fd, TCGETA, &old_tty);
new_tty = old_tty;
new_tty.c_lflag &= ~(ICANON | ECHO | ISIG);
ioctl(fd, TCSETA, &new_tty);
fread(&ch, 1, sizeof(ch), stdin);
ioctl(fd, TCSETA, &old_tty);
return ch;
}
#define _getch repl_getch
#else
#include <conio.h> /* only for _getch() */ #include <conio.h> /* only for _getch() */
#endif
/* #define DEBUG : this enables the Trace() macros */ /* #define DEBUG : this enables the Trace() macros */
@@ -153,7 +179,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
filename = (char *)NULL; filename = (char *)NULL;
#ifndef __CYGWIN__
/* First reenable console output, which normally goes to the bit bucket /* First reenable console output, which normally goes to the bit bucket
* for windowed apps. Closing the console window will terminate the * for windowed apps. Closing the console window will terminate the
* app. Thanks to David.Geldreich@realviz.com for supplying the magical * app. Thanks to David.Geldreich@realviz.com for supplying the magical
@@ -162,6 +188,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
AllocConsole(); AllocConsole();
freopen("CONOUT$", "a", stderr); freopen("CONOUT$", "a", stderr);
freopen("CONOUT$", "a", stdout); freopen("CONOUT$", "a", stdout);
#endif
/* Next set the default value for our display-system exponent, i.e., /* Next set the default value for our display-system exponent, i.e.,
@@ -279,7 +306,9 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
/* print usage screen if any errors up to this point */ /* print usage screen if any errors up to this point */
if (error) { if (error) {
#ifndef __CYGWIN__
int ch; int ch;
#endif
fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname); fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname);
readpng_version_info(); readpng_version_info();
@@ -293,11 +322,15 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
"\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n" "\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
"\t\t used with transparent images\n" "\t\t used with transparent images\n"
"\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n" "\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
#ifndef __CYGWIN__
"Press Q or Esc to quit this usage screen.\n" "Press Q or Esc to quit this usage screen.\n"
#endif
"\n", PROGNAME, default_display_exponent); "\n", PROGNAME, default_display_exponent);
#ifndef __CYGWIN__
do do
ch = _getch(); ch = _getch();
while (ch != 'q' && ch != 'Q' && ch != 0x1B); while (ch != 'q' && ch != 'Q' && ch != 0x1B);
#endif
exit(1); exit(1);
} }
@@ -333,18 +366,24 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
if (error) { if (error) {
#ifndef __CYGWIN__
int ch; int ch;
#endif
fprintf(stderr, PROGNAME ": aborting.\n"); fprintf(stderr, PROGNAME ": aborting.\n");
#ifndef __CYGWIN__
do do
ch = _getch(); ch = _getch();
while (ch != 'q' && ch != 'Q' && ch != 0x1B); while (ch != 'q' && ch != 'Q' && ch != 0x1B);
#endif
exit(2); exit(2);
} else { } else {
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname); fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
#ifndef __CYGWIN__
fprintf(stderr, fprintf(stderr,
"\n [console window: closing this window will terminate %s]\n\n", "\n [console window: closing this window will terminate %s]\n\n",
PROGNAME); PROGNAME);
#endif
} }
@@ -417,7 +456,12 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
/* wait for the user to tell us when to quit */ /* wait for the user to tell us when to quit */
printf( printf(
"Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n"); #ifndef __CYGWIN__
"Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n"
#else
"Done. Press mouse button 1 (within image window) to quit.\n"
#endif
);
fflush(stdout); fflush(stdout);
while (GetMessage(&msg, NULL, 0, 0)) { while (GetMessage(&msg, NULL, 0, 0)) {

View File

@@ -81,8 +81,8 @@
#define PROGNAME "rpng-x" #define PROGNAME "rpng-x"
#define LONGNAME "Simple PNG Viewer for X" #define LONGNAME "Simple PNG Viewer for X"
#define VERSION "2.01 of 16 March 2008" #define VERSION "2.01 of 16 March 2008"
#define RESNAME "rpng" /* our X resource application name */ #define RESNAME "rpng" /* our X resource application name */
#define RESCLASS "Rpng" /* our X resource class name */ #define RESCLASS "Rpng" /* our X resource class name */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@@ -32,6 +32,7 @@
- 2.01: fixed 64-bit typo in readpng2.c - 2.01: fixed 64-bit typo in readpng2.c
- 2.02: fixed improper display of usage screen on PNG error(s); fixed - 2.02: fixed improper display of usage screen on PNG error(s); fixed
unexpected-EOF and file-read-error cases unexpected-EOF and file-read-error cases
- 2.03: removed runtime MMX-enabling/disabling and obsolete -mmx* options
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
@@ -95,7 +96,33 @@
#include <time.h> #include <time.h>
#include <math.h> /* only for PvdM background code */ #include <math.h> /* only for PvdM background code */
#include <windows.h> #include <windows.h>
#ifdef __CYGWIN__
/* getch replacement. Turns out, we don't really need this,
* but leave it here if we ever enable any of the uses of
* _getch in the main code
*/
#include <unistd.h>
#include <termio.h>
#include <sys/ioctl.h>
int repl_getch( void )
{
char ch;
int fd = fileno(stdin);
struct termio old_tty, new_tty;
ioctl(fd, TCGETA, &old_tty);
new_tty = old_tty;
new_tty.c_lflag &= ~(ICANON | ECHO | ISIG);
ioctl(fd, TCSETA, &new_tty);
fread(&ch, 1, sizeof(ch), stdin);
ioctl(fd, TCSETA, &old_tty);
return ch;
}
#define _getch repl_getch
#else
#include <conio.h> /* only for _getch() */ #include <conio.h> /* only for _getch() */
#endif
/* all for PvdM background code: */ /* all for PvdM background code: */
#ifndef PI #ifndef PI
@@ -269,7 +296,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
filename = (char *)NULL; filename = (char *)NULL;
memset(&rpng2_info, 0, sizeof(mainprog_info)); memset(&rpng2_info, 0, sizeof(mainprog_info));
#ifndef __CYGWIN__
/* Next reenable console output, which normally goes to the bit bucket /* Next reenable console output, which normally goes to the bit bucket
* for windowed apps. Closing the console window will terminate the * for windowed apps. Closing the console window will terminate the
* app. Thanks to David.Geldreich@realviz.com for supplying the magical * app. Thanks to David.Geldreich@realviz.com for supplying the magical
@@ -278,7 +305,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
AllocConsole(); AllocConsole();
freopen("CONOUT$", "a", stderr); freopen("CONOUT$", "a", stderr);
freopen("CONOUT$", "a", stdout); freopen("CONOUT$", "a", stdout);
#endif
/* Set the default value for our display-system exponent, i.e., the /* Set the default value for our display-system exponent, i.e., the
* product of the CRT exponent and the exponent corresponding to * product of the CRT exponent and the exponent corresponding to
@@ -395,18 +422,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
} }
} else if (!strncmp(*argv, "-timing", 2)) { } else if (!strncmp(*argv, "-timing", 2)) {
timing = TRUE; timing = TRUE;
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
} else if (!strncmp(*argv, "-nommxfilters", 7)) {
rpng2_info.nommxfilters = TRUE;
} else if (!strncmp(*argv, "-nommxcombine", 7)) {
rpng2_info.nommxcombine = TRUE;
} else if (!strncmp(*argv, "-nommxinterlace", 7)) {
rpng2_info.nommxinterlace = TRUE;
} else if (!strcmp(*argv, "-nommx")) {
rpng2_info.nommxfilters = TRUE;
rpng2_info.nommxcombine = TRUE;
rpng2_info.nommxinterlace = TRUE;
#endif
} else { } else {
if (**argv != '-') { if (**argv != '-') {
filename = *argv; filename = *argv;
@@ -424,15 +439,14 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
/* print usage screen if any errors up to this point */ /* print usage screen if any errors up to this point */
if (error) { if (error) {
#ifndef __CYGWIN__
int ch; int ch;
#endif
fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname); fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname);
readpng2_version_info(); readpng2_version_info();
fprintf(stderr, "\n" fprintf(stderr, "\n"
"Usage: %s [-gamma exp] [-bgcolor bg | -bgpat pat] [-timing]\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" " %*s file.png\n\n"
" exp \ttransfer-function exponent (``gamma'') of the display\n" " exp \ttransfer-function exponent (``gamma'') of the display\n"
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n" "\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
@@ -445,21 +459,24 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
"\t\t transparent images; overrides -bgcolor option\n" "\t\t transparent images; overrides -bgcolor option\n"
" -timing\tenables delay for every block read, to simulate modem\n" " -timing\tenables delay for every block read, to simulate modem\n"
"\t\t download of image (~36 Kbps)\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" "\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
#ifndef __CYGWIN__
"Press Q or Esc to quit this usage screen. ", "Press Q or Esc to quit this usage screen. ",
#else
,
#endif
PROGNAME, PROGNAME,
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) #if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) && \
!(defined(__CYGWIN__) || defined(__MINGW32__))
(int)strlen(PROGNAME), " ", (int)strlen(PROGNAME), " ",
#endif #endif
(int)strlen(PROGNAME), " ", default_display_exponent, num_bgpat); (int)strlen(PROGNAME), " ", default_display_exponent, num_bgpat);
fflush(stderr); fflush(stderr);
#ifndef __CYGWIN__
do do
ch = _getch(); ch = _getch();
while (ch != 'q' && ch != 'Q' && ch != 0x1B); while (ch != 'q' && ch != 'Q' && ch != 0x1B);
#endif
exit(1); exit(1);
} }
@@ -496,18 +513,24 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
if (error) { if (error) {
#ifndef __CYGWIN__
int ch; int ch;
#endif
fprintf(stderr, PROGNAME ": aborting.\n"); fprintf(stderr, PROGNAME ": aborting.\n");
#ifndef __CYGWIN__
do do
ch = _getch(); ch = _getch();
while (ch != 'q' && ch != 'Q' && ch != 0x1B); while (ch != 'q' && ch != 'Q' && ch != 0x1B);
#endif
exit(2); exit(2);
} else { } else {
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname); fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
#ifndef __CYGWIN__
fprintf(stderr, fprintf(stderr,
"\n [console window: closing this window will terminate %s]\n\n", "\n [console window: closing this window will terminate %s]\n\n",
PROGNAME); PROGNAME);
#endif
fflush(stderr); fflush(stderr);
} }
@@ -1150,7 +1173,12 @@ static void rpng2_win_finish_display()
rpng2_info.state = kDone; rpng2_info.state = kDone;
printf( printf(
"Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n"); #ifndef __CYGWIN__
"Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n"
#else
"Done. Press mouse button 1 (within image window) to quit.\n"
#endif
);
fflush(stdout); fflush(stdout);
} }

View File

@@ -40,6 +40,7 @@
- 2.02: fixed improper display of usage screen on PNG error(s); fixed - 2.02: fixed improper display of usage screen on PNG error(s); fixed
unexpected-EOF and file-read-error cases; fixed Trace() cut-and- unexpected-EOF and file-read-error cases; fixed Trace() cut-and-
paste bugs paste bugs
- 2.03: deleted runtime MMX-enabling/disabling and obsolete -mmx* options
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
@@ -94,9 +95,9 @@
#define PROGNAME "rpng2-x" #define PROGNAME "rpng2-x"
#define LONGNAME "Progressive PNG Viewer for X" #define LONGNAME "Progressive PNG Viewer for X"
#define VERSION "2.02 of 16 March 2008" #define VERSION "2.03 of 25 February 2010"
#define RESNAME "rpng2" /* our X resource application name */ #define RESNAME "rpng2" /* our X resource application name */
#define RESCLASS "Rpng" /* our X resource class name */ #define RESCLASS "Rpng" /* our X resource class name */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@@ -131,7 +132,7 @@
(e.type == KeyPress && /* v--- or 1 for shifted keys */ \ (e.type == KeyPress && /* v--- or 1 for shifted keys */ \
((k = XLookupKeysym(&e.xkey, 0)) == XK_q || k == XK_Escape))) ((k = XLookupKeysym(&e.xkey, 0)) == XK_q || k == XK_Escape)))
#define NO_24BIT_MASKS /* undef case not fully written--only for redisplay() */ #define NO_24BIT_MASKS /* undef case not fully written--only for redisplay() */
#define rgb1_max bg_freq #define rgb1_max bg_freq
#define rgb1_min bg_gray #define rgb1_min bg_gray
@@ -301,7 +302,7 @@ int main(int argc, char **argv)
int have_bg = FALSE; int have_bg = FALSE;
#ifdef FEATURE_LOOP #ifdef FEATURE_LOOP
int loop = FALSE; int loop = FALSE;
long loop_interval = -1; /* seconds (100,000 max) */ long loop_interval = -1; /* seconds (100,000 max) */
#endif #endif
double LUT_exponent; /* just the lookup table */ double LUT_exponent; /* just the lookup table */
double CRT_exponent = 2.2; /* just the monitor */ double CRT_exponent = 2.2; /* just the monitor */
@@ -434,18 +435,6 @@ int main(int argc, char **argv)
else if (loop_interval > 100000) /* bit more than one day */ else if (loop_interval > 100000) /* bit more than one day */
loop_interval = 100000; loop_interval = 100000;
} }
#endif
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
} else if (!strncmp(*argv, "-nommxfilters", 7)) {
rpng2_info.nommxfilters = TRUE;
} else if (!strncmp(*argv, "-nommxcombine", 7)) {
rpng2_info.nommxcombine = TRUE;
} else if (!strncmp(*argv, "-nommxinterlace", 7)) {
rpng2_info.nommxinterlace = TRUE;
} else if (!strcmp(*argv, "-nommx")) {
rpng2_info.nommxfilters = TRUE;
rpng2_info.nommxcombine = TRUE;
rpng2_info.nommxinterlace = TRUE;
#endif #endif
} else { } else {
if (**argv != '-') { if (**argv != '-') {
@@ -468,9 +457,6 @@ int main(int argc, char **argv)
readpng2_version_info(); readpng2_version_info();
fprintf(stderr, "\n" fprintf(stderr, "\n"
"Usage: %s [-display xdpy] [-gamma exp] [-bgcolor bg | -bgpat pat]\n" "Usage: %s [-display xdpy] [-gamma exp] [-bgcolor bg | -bgpat pat]\n"
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
" %*s [[-nommxfilters] [-nommxcombine] [-nommxinterlace] | -nommx]\n"
#endif
#ifdef FEATURE_LOOP #ifdef FEATURE_LOOP
" %*s [-usleep dur | -timing] [-pause] [-loop [sec]] file.png\n\n" " %*s [-usleep dur | -timing] [-pause] [-loop [sec]] file.png\n\n"
#else #else
@@ -490,10 +476,6 @@ int main(int argc, char **argv)
" -loop\tloops through background images after initial display\n" " -loop\tloops through background images after initial display\n"
"\t\t is complete (depends on -bgpat)\n" "\t\t is complete (depends on -bgpat)\n"
" sec \tseconds to display each background image (default = 2)\n" " sec \tseconds to display each background image (default = 2)\n"
#endif
#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 #endif
" dur \tduration in microseconds to wait after displaying each\n" " dur \tduration in microseconds to wait after displaying each\n"
"\t\t row (for demo purposes)\n" "\t\t row (for demo purposes)\n"
@@ -503,9 +485,6 @@ int main(int argc, char **argv)
"\nPress Q, Esc or mouse button 1 (within image window, after image\n" "\nPress Q, Esc or mouse button 1 (within image window, after image\n"
"is displayed) to quit.\n" "is displayed) to quit.\n"
"\n", PROGNAME, "\n", PROGNAME,
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
(int)strlen(PROGNAME), " ",
#endif
(int)strlen(PROGNAME), " ", default_display_exponent, num_bgpat-1); (int)strlen(PROGNAME), " ", default_display_exponent, num_bgpat-1);
exit(1); exit(1);
} }
@@ -802,8 +781,9 @@ static void rpng2_x_init(void)
if (rpng2_x_create_window()) { if (rpng2_x_create_window()) {
/* GRR TEMPORARY HACK: this is fundamentally no different from cases /* GRR TEMPORARY HACK: this is fundamentally no different from cases
* above; libpng should longjmp() back to us when png_ptr goes away. * above; libpng should call our error handler to longjmp() back to us
* If we/it segfault instead, seems like a libpng bug... */ * when png_ptr goes away. If we/it segfault instead, seems like a
* libpng bug... */
/* we're here via libpng callback, so if window fails, clean and bail */ /* we're here via libpng callback, so if window fails, clean and bail */
readpng2_cleanup(&rpng2_info); readpng2_cleanup(&rpng2_info);
@@ -1297,7 +1277,7 @@ static int rpng2_x_load_bg_image(void)
for (row = 0; row < rpng2_info.height; ++row) { for (row = 0; row < rpng2_info.height; ++row) {
src = bg_data + row*bg_rowbytes; src = bg_data + row*bg_rowbytes;
dest = ximage->data + row*ximage_rowbytes; dest = ximage->data + row*ximage_rowbytes;
if (bpp == 32) { /* slightly optimized version */ if (bpp == 32) { /* slightly optimized version */
for (i = rpng2_info.width; i > 0; --i) { for (i = rpng2_info.width; i > 0; --i) {
red = *src++; red = *src++;
green = *src++; green = *src++;

View File

@@ -104,7 +104,8 @@ int writepng_init(mainprog_info *mainprog_ptr)
/* setjmp() must be called in every function that calls a PNG-writing /* setjmp() must be called in every function that calls a PNG-writing
* libpng function, unless an alternate error handler was installed-- * libpng function, unless an alternate error handler was installed--
* but compatible error handlers must either use longjmp() themselves * but compatible error handlers must either use longjmp() themselves
* (as in this program) or exit immediately, so here we go: */ * (as in this program) or some other method to return control to
* application code, so here we go: */
if (setjmp(mainprog_ptr->jmpbuf)) { if (setjmp(mainprog_ptr->jmpbuf)) {
png_destroy_write_struct(&png_ptr, &info_ptr); png_destroy_write_struct(&png_ptr, &info_ptr);
@@ -388,5 +389,12 @@ static void writepng_error_handler(png_structp png_ptr, png_const_charp msg)
exit(99); exit(99);
} }
/* Now we have our data structure we can use the information in it
* to return control to our own higher level code (all the points
* where 'setjmp' is called in this file.) This will work with other
* error handling mechanisms as well - libpng always calls png_error
* when it can proceed no further, thus, so long as the error handler
* is intercepted, application code can do its own error recovery.
*/
longjmp(mainprog_ptr->jmpbuf, 1); longjmp(mainprog_ptr->jmpbuf, 1);
} }

4
contrib/pngminim/README Normal file
View File

@@ -0,0 +1,4 @@
This demonstrates the use of PNG_USER_CONFIG, pngusr.h and pngusr.dfa
to build minimal decoder, encoder, and progressive reader applications.
See the individual README and pngusr.dfa files for more explanation.

View File

@@ -1,9 +1,10 @@
This demonstrates the use of PNG_USER_CONFIG and pngusr.h This demonstrates the use of PNG_USER_CONFIG, pngusr.h and pngusr.dfa
To build a minimal read-only decoder with embedded libpng and zlib, run The makefile builds a minimal read-only decoder with embedded libpng
and zlib.
gather.sh # to collect needed files from pngminus, libpng, and zlib Specify the location of the zlib source (1.2.1 or later) as ZLIBSRC
make on the make command line.
If you prefer to use the shared libraries, go to contrib/pngminus If you prefer to use the shared libraries, go to contrib/pngminus
and build the png2pnm application there. and build the png2pnm application there.

View File

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

View File

@@ -5,27 +5,82 @@
CC=gcc CC=gcc
LD=$(CC) LD=$(CC)
RM=rm -f # If awk fails try
# make AWK=nawk
CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP \ # If cpp fails try
-DdeflateParams\(a,b,c\)=Z_OK -I. -O1 # make CPP=/lib/cpp
RM=rm -f
COPY=cp
CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP -I. -O1
C=.c C=.c
O=.o O=.o
L=.a L=.a
E= E=
ZOBJS = adler32$(O) crc32$(O) gzio$(O) \ # Where to find the source code:
infback$(O) inffast$(O) inflate$(O) inftrees$(O) \ PNGSRC =../../..
trees$(O) uncompr$(O) zutil$(O) ZLIBSRC=$(PNGSRC)/../zlib
PROGSRC=$(PNGSRC)/contrib/pngminus
OBJS = pngm2pnm$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \ # Zlib (minimal inflate requirements - crc32 is used by libpng)
# zutil can be eliminated if you provide your own zcalloc and zcfree
ZSRCS = adler32$(C) crc32$(C) \
inffast$(C) inflate$(C) inftrees$(C) \
zutil$(C)
# Standard headers
ZH = zlib.h crc32.h inffast.h inffixed.h \
inflate.h inftrees.h zutil.h
# Machine generated headers
ZCONF = zconf.h
# Headers callers use
ZINC = zlib.h $(ZCONF)
# Headers the Zlib source uses
ZHDRS = $(ZH) $(ZCONF)
ZOBJS = adler32$(O) crc32$(O) \
inffast$(O) inflate$(O) inftrees$(O) \
zutil$(O)
# libpng
PNGSRCS=png$(C) pngerror$(C) pngget$(C) pngmem$(C) \
pngread$(C) pngrio$(C) pngrtran$(C) pngrutil$(C) \
pngset$(C) pngtrans$(C)
# Standard headers
PNGH =png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
# Machine generated headers
PNGCONF=pnglibconf.h
# Headers callers use
PNGINC= png.h pngconf.h pngusr.h $(PNGCONF)
# Headers the PNG library uses
PNGHDRS=$(PNGH) $(PNGCONF) pngusr.h
PNGOBJS=png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \ pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \
pngset$(O) pngtrans$(O) $(ZOBJS) pngset$(O) pngtrans$(O)
PROGSRCS= pngm2pnm$(C)
PROGHDRS=
PROGDOCS=
PROGOBJS= pngm2pnm$(O)
OBJS = $(PROGOBJS) $(PNGOBJS) $(ZOBJS)
# implicit make rules ------------------------------------------------------- # implicit make rules -------------------------------------------------------
.c$(O): png.h pngconf.h pngpriv.h pngusr.h zlib.h # note: dependencies do not work on implicit rule lines
.c$(O):
$(CC) -c $(CFLAGS) $< $(CC) -c $(CFLAGS) $<
# dependencies # dependencies
@@ -34,11 +89,62 @@ all: pngm2pnm$(E)
pngm2pnm$(E): $(OBJS) pngm2pnm$(E): $(OBJS)
$(LD) -o pngm2pnm$(E) $(OBJS) $(LD) -o pngm2pnm$(E) $(OBJS)
strip pngm2pnm$(E)
# The DFA_XTRA setting turns all libpng options off then
# turns on those required for this minimal build.
# The CPP_FLAGS setting causes pngusr.h to be included in
# both the build of pnglibconf.h and, subsequently, when
# building libpng itself.
$(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak\
$(PNGSRC)/scripts/pnglibconf.dfa \
$(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa
$(RM) pnglibconf.h pnglibconf.dfn
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG"\
DFA_XTRA="pngusr.dfa" $@
clean: clean:
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
srcdir=$(PNGSRC) clean
$(RM) pngm2pnm$(O) $(RM) pngm2pnm$(O)
$(RM) pngm2pnm$(E) $(RM) pngm2pnm$(E)
$(RM) $(OBJS) $(RM) $(OBJS)
# distclean also removes the copied source and headers
distclean: clean
$(RM) -r scripts # historical reasons
$(RM) $(PNGSRCS) $(PNGH)
$(RM) $(ZSRCS) $(ZH) $(ZCONF)
$(RM) $(PROGSRCS) $(PROGHDRS) $(PROGDOCS)
# Header file dependencies:
$(PROGOBJS): $(PROGHDRS) $(PNGINC) $(ZINC)
$(PNGOBJS): $(PNGHDRS) $(ZINC)
$(ZOBJS): $(ZHDRS)
# Gather the source code from the respective directories
$(PNGSRCS) $(PNGH): $(PNGSRC)/$@
$(RM) $@
$(COPY) $(PNGSRC)/$@ $@
# No dependency on the ZLIBSRC target so that it only needs
# to be specified once.
$(ZSRCS) $(ZH):
$(RM) $@
$(COPY) $(ZLIBSRC)/$@ $@
# The unconfigured zconf.h varies in name according to the
# zlib release
$(ZCONF):
$(RM) $@
@for f in zconf.h.in zconf.in.h zconf.h; do\
test -r $(ZLIBSRC)/$$f &&\
echo $(COPY) $(ZLIBSRC)/$$f $@ &&\
$(COPY) $(ZLIBSRC)/$$f $@ && exit 0;\
done; echo copy: $(ZLIBSRC)/zconf.h not found; exit 1
pngm2pnm.c: $(PROGSRC)/png2pnm.c
$(RM) $@
$(COPY) $(PROGSRC)/png2pnm.c $@
# End of makefile for pngm2pnm # End of makefile for pngm2pnm

View File

@@ -0,0 +1,39 @@
# pngminim/decoder/pngusr.dfa
#
# Copyright (c) 2010-2011 Glenn Randers-Pehrson
#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# First all the build options off:
everything = off
# All that is required is some read code. This example switches
# on the sequential read code (see ../preader for a progressive
# read example).
option SEQUENTIAL_READ on
# You must choose fixed or floating point arithmetic:
# option FLOATING_POINT on
option FIXED_POINT on
# You must chose the internal fixed point implementation or to
# use the system floating point. The latter is considerably
# smaller (by about 1kbyte on an x86 system):
# option FLOATING_ARITHMETIC on
option FLOATING_ARITHMETIC off
# Your program will probably need other options. The example
# program here, pngm2pnm, requires the following. Take a look
# at pnglibconf.h to find out the full set of what has to be
# enabled to make the following work.
option SETJMP on
option STDIO on
option READ_EXPAND on
option READ_STRIP_16_TO_8 on

View File

@@ -1,6 +1,6 @@
/* minrdpngconf.h: headers to make a minimal png-read-only library /* minrdpngconf.h: headers to make a minimal png-read-only library
* *
* Copyright (c) 2007, 2009 Glenn Randers-Pehrson * Copyright (c) 2007, 2010-2011 Glenn Randers-Pehrson
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
@@ -12,62 +12,12 @@
#ifndef MINRDPNGCONF_H #ifndef MINRDPNGCONF_H
#define MINRDPNGCONF_H #define MINRDPNGCONF_H
#ifdef NJET /* To include pngusr.h set -DPNG_USER_CONFIG in CPPFLAGS */
/* No 16-bit support beyond reading with strip_16 */
#endif /* List options to turn off features of the build that do not
* affect the API (so are not recorded in pnglibconf.h)
*/
#define PNG_NO_WARNINGS #define PNG_NO_WARNINGS
#define png_warning(s1,s2) ""
#define png_chunk_warning(s1,s2) ""
#define PNG_NO_ERROR_TEXT
#define png_error(s1,s2) png_err(s1)
#define png_chunk_error(s1,s2) png_err(s1)
#define PNG_NO_READ_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
#define PNG_NO_READ_SWAP_ALPHA
#define PNG_NO_READ_INVERT_ALPHA
#define PNG_NO_READ_RGB_TO_GRAY
#define PNG_NO_READ_USER_TRANSFORM
#define PNG_NO_READ_bKGD
#define PNG_NO_READ_cHRM
#define PNG_NO_READ_gAMA
#define PNG_NO_READ_hIST
#define PNG_NO_READ_iCCP
#define PNG_NO_READ_pCAL
#define PNG_NO_READ_pHYs
#define PNG_NO_READ_sBIT
#define PNG_NO_READ_sCAL
#define PNG_NO_READ_sPLT
#define PNG_NO_READ_sRGB
#define PNG_NO_READ_TEXT
#define PNG_NO_READ_tIME
#define PNG_NO_READ_UNKNOWN_CHUNKS
#define PNG_NO_READ_USER_CHUNKS
#define PNG_NO_READ_EMPTY_PLTE
#define PNG_NO_READ_OPT_PLTE
#define PNG_NO_READ_STRIP_ALPHA
#define PNG_NO_READ_oFFs
#define PNG_NO_WRITE_SUPPORTED
#define PNG_NO_INFO_IMAGE
#define PNG_NO_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 */ #endif /* MINRDPNGCONF_H */

View File

@@ -1,9 +1,10 @@
This demonstrates the use of PNG_USER_CONFIG and pngusr.h This demonstrates the use of PNG_USER_CONFIG and pngusr.h
To build a minimal write-only decoder with embedded libpng and zlib, run The makefile builds a minimal write-only decoder with embedded libpng
and zlib.
gather.sh # to collect needed files from pngminus, libpng, and zlib Specify the location of the zlib source (1.2.1 or later) as ZLIBSRC
make on the make command line.
If you prefer to use the shared libraries, go to contrib/pngminus If you prefer to use the shared libraries, go to contrib/pngminus
and build the pnm2png application there. and build the pnm2png application there.

View File

@@ -1,27 +0,0 @@
#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 ; }

View File

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

View File

@@ -5,7 +5,14 @@
CC=gcc CC=gcc
LD=$(CC) LD=$(CC)
# If awk fails try
# make AWK=nawk
# If cpp fails try
# make CPP=/lib/cpp
RM=rm -f RM=rm -f
COPY=cp
CFLAGS=-DPNG_USER_CONFIG -DNO_GZIP -I. -O1 CFLAGS=-DPNG_USER_CONFIG -DNO_GZIP -I. -O1
@@ -14,17 +21,65 @@ O=.o
L=.a L=.a
E= E=
ZOBJS = adler32$(O) compress$(O) crc32$(O) deflate$(O) gzio$(O) \ # Where to find the source code:
dummy_inflate$(O) \ PNGSRC =../../..
trees$(O) uncompr$(O) zutil$(O) ZLIBSRC=$(PNGSRC)/../zlib
PROGSRC=$(PNGSRC)/contrib/pngminus
OBJS = pnm2pngm$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \ # Zlib
ZSRCS = adler32$(C) compress$(C) crc32$(C) deflate$(C) \
trees$(C) zutil$(C)
# Standard headers
#ZH = zlib.h crc32.h deflate.h trees.h zutil.h
ZH = zlib.h crc32.h deflate.h trees.h zutil.h
# Machine generated headers
ZCONF = zconf.h
# Headers callers use
ZINC = zlib.h $(ZCONF)
# Headers the Zlib source uses
ZHDRS = $(ZH) $(ZCONF)
# compress is not required; it is needed to link the zlib
# code because deflate defines an unused API function deflateBound
# which itself calls compressBound from compress.
ZOBJS = adler32$(O) compress$(O) crc32$(O) deflate$(O) \
trees$(O) zutil$(O)
# libpng
PNGSRCS=png$(C) pngerror$(C) pngget$(C) pngmem$(C) \
pngset$(C) pngtrans$(C) pngwio$(C) pngwrite$(C) \
pngwtran$(C) pngwutil$(C)
# Standard headers
PNGH =png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
# Machine generated headers
PNGCONF=pnglibconf.h
# Headers callers use
PNGINC= png.h pngconf.h pngusr.h $(PNGCONF)
# Headers the PNG library uses
PNGHDRS=$(PNGH) $(PNGCONF) pngusr.h
PNGOBJS=png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
pngset$(O) pngtrans$(O) pngwio$(O) pngwrite$(O) \ pngset$(O) pngtrans$(O) pngwio$(O) pngwrite$(O) \
pngwtran$(O) pngwutil$(O) $(ZOBJS) pngwtran$(O) pngwutil$(O)
PROGSRCS= pnm2pngm$(C)
PROGHDRS=
PROGDOCS=
PROGOBJS= pnm2pngm$(O)
OBJS = $(PROGOBJS) $(PNGOBJS) $(ZOBJS)
# implicit make rules ------------------------------------------------------- # implicit make rules -------------------------------------------------------
.c$(O): png.h pngconf.h pngpriv.h pngusr.h zlib.h .c$(O):
$(CC) -c $(CFLAGS) $< $(CC) -c $(CFLAGS) $<
# dependencies # dependencies
@@ -33,11 +88,62 @@ all: pnm2pngm$(E)
pnm2pngm$(E): $(OBJS) pnm2pngm$(E): $(OBJS)
$(LD) -o pnm2pngm$(E) $(OBJS) $(LD) -o pnm2pngm$(E) $(OBJS)
strip pnm2pngm$(E)
# The DFA_XTRA setting turns all libpng options off then
# turns on those required for this minimal build.
# The CPP_FLAGS setting causes pngusr.h to be included in
# both the build of pnglibconf.h and, subsequently, when
# building libpng itself.
$(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak\
$(PNGSRC)/scripts/pnglibconf.dfa \
$(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa
$(RM) pnglibconf.h pnglibconf.dfn
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG"\
DFA_XTRA="pngusr.dfa" $@
clean: clean:
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
srcdir=$(PNGSRC) clean
$(RM) pnm2pngm$(O) $(RM) pnm2pngm$(O)
$(RM) pnm2pngm$(E) $(RM) pnm2pngm$(E)
$(RM) $(OBJS) $(RM) $(OBJS)
# distclean also removes the copied source and headers
distclean: clean
$(RM) -r scripts # historical reasons
$(RM) $(PNGSRCS) $(PNGH)
$(RM) $(ZSRCS) $(ZH) $(ZCONF)
$(RM) $(PROGSRCS) $(PROGHDRS) $(PROGDOCS)
# Header file dependencies:
$(PROGOBJS): $(PROGHDRS) $(PNGINC) $(ZINC)
$(PNGOBJS): $(PNGHDRS) $(ZINC)
$(ZOBJS): $(ZHDRS)
# Gather the source code from the respective directories
$(PNGSRCS) $(PNGH): $(PNGSRC)/$@
$(RM) $@
$(COPY) $(PNGSRC)/$@ $@
# No dependency on the ZLIBSRC target so that it only needs
# to be specified once.
$(ZSRCS) $(ZH):
$(RM) $@
$(COPY) $(ZLIBSRC)/$@ $@
# The unconfigured zconf.h varies in name according to the
# zlib release
$(ZCONF):
$(RM) $@
@for f in zconf.h.in zconf.in.h zconf.h; do\
test -r $(ZLIBSRC)/$$f &&\
echo $(COPY) $(ZLIBSRC)/$$f $@ &&\
$(COPY) $(ZLIBSRC)/$$f $@ && exit 0;\
done; echo copy: $(ZLIBSRC)/zconf.h not found; exit 1
pnm2pngm.c: $(PROGSRC)/pnm2png.c
$(RM) $@
$(COPY) $(PROGSRC)/pnm2png.c $@
# End of makefile for pnm2pngm # End of makefile for pnm2pngm

View File

@@ -0,0 +1,35 @@
# pngminim/encoder/pngusr.dfa
#
# Copyright (c) 2010-2011 Glenn Randers-Pehrson
#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# First all the build options off:
everything = off
# Switch on the write code - this makes a minimalist encoder
option WRITE on
# You must choose fixed or floating point arithmetic:
# option FLOATING_POINT on
option FIXED_POINT on
# You must chose the internal fixed point implementation or to
# use the system floating point. The latter is considerably
# smaller (by about 1kbyte on an x86 system):
# option FLOATING_ARITHMETIC on
option FLOATING_ARITHMETIC off
# Your program will probably need other options. The example
# program here, pnm2pngm, requires the following. Take a look
# at pnglibconf.h to find out the full set of what has to be
# enabled to make the following work.
option SETJMP on
option STDIO on

View File

@@ -1,6 +1,6 @@
/* minwrpngconf.h: headers to make a minimal png-write-only library /* minwrpngconf.h: headers to make a minimal png-write-only library
* *
* Copyright (c) 2007, 2009 Glenn Randers-Pehrson * Copyright (c) 2007, 2010-2011 Glenn Randers-Pehrson
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
@@ -12,60 +12,12 @@
#ifndef MINWRPNGCONF_H #ifndef MINWRPNGCONF_H
#define MINWRPNGCONF_H #define MINWRPNGCONF_H
#define PNG_NO_READ_SUPPORTED /* To include pngusr.h set -DPNG_USER_CONFIG in CPPFLAGS */
/* List options to turn off features of the build that do not
* affect the API (so are not recorded in pnglibconf.h)
*/
#define PNG_NO_WARNINGS #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
#define PNG_NO_WRITE_SWAP_ALPHA
#define PNG_NO_WRITE_INVERT_ALPHA
#define PNG_NO_WRITE_RGB_TO_GRAY
#define PNG_NO_WRITE_USER_TRANSFORM
#define PNG_NO_WRITE_bKGD
#define PNG_NO_WRITE_cHRM
#define PNG_NO_WRITE_gAMA
#define PNG_NO_WRITE_hIST
#define PNG_NO_WRITE_iCCP
#define PNG_NO_WRITE_oFFs
#define PNG_NO_WRITE_pCAL
#define PNG_NO_WRITE_pHYs
#define PNG_NO_WRITE_sBIT
#define PNG_NO_WRITE_sCAL
#define PNG_NO_WRITE_sPLT
#define PNG_NO_WRITE_sRGB
#define PNG_NO_WRITE_TEXT
#define PNG_NO_WRITE_tIME
#define PNG_NO_WRITE_UNKNOWN_CHUNKS
#define PNG_NO_WRITE_USER_CHUNKS
#define PNG_NO_WRITE_EMPTY_PLTE
#define PNG_NO_WRITE_OPT_PLTE
#define PNG_NO_WRITE_FILTER
#define PNG_NO_WRITE_WEIGHTED_FILTER
#define PNG_NO_WRITE_INTERLACING_SUPPORTED
#define PNG_NO_WRITE_FLUSH
#define PNG_NO_INFO_IMAGE
#define PNG_NO_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 */ #endif /* MINWRPNGCONF_H */

View File

@@ -1,14 +1,15 @@
This demonstrates the use of PNG_USER_CONFIG and pngusr.h This demonstrates the use of PNG_USER_CONFIG and pngusr.h
To build a minimal read-only progressive decoder embedded libpng and The makefile builds a minimal read-only progressive decoder with
zlib and with your system's X library, run embedded libpng, zlib and your system's X library.
gather.sh # to collect needed files from gregbook, libpng, and zlib Specify the location of the zlib source (1.2.1 or later) as ZLIBSRC
on the make command line.
Edit makefile if required, to find your X library and include files, Edit makefile if required, to find your X library and include files,
then then
make make ZLIBSRC=directory
If you prefer to use the shared libraries, go to contrib/gregbook If you prefer to use the shared libraries, go to contrib/gregbook
and build the rpng2-x application there. and build the rpng2-x application there.

View File

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

View File

@@ -5,7 +5,14 @@
CC=gcc CC=gcc
LD=$(CC) LD=$(CC)
# If awk fails try
# make AWK=nawk
# If cpp fails try
# make CPP=/lib/cpp
RM=rm -f RM=rm -f
COPY=cp
#XINC = -I/usr/include # old-style, stock X distributions #XINC = -I/usr/include # old-style, stock X distributions
#XLIB = -L/usr/lib/X11 -lX11 # (including SGI IRIX) #XLIB = -L/usr/lib/X11 -lX11 # (including SGI IRIX)
@@ -23,38 +30,136 @@ XLIB = -L/usr/X11R6/lib -lX11
#LIBS = $(XLIB) #LIBS = $(XLIB)
LIBS = $(XLIB) -lm #platforms that need libm LIBS = $(XLIB) -lm #platforms that need libm
CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP \ CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP -I. $(XINC) -O1
-DdeflateParams\(a,b,c\)=Z_OK -I. $(XINC) -O1
C=.c C=.c
O=.o O=.o
L=.a L=.a
E= E=
ZOBJS = adler32$(O) crc32$(O) gzio$(O) \ # Where to find the source code:
infback$(O) inffast$(O) inflate$(O) inftrees$(O) \ PNGSRC =../../..
trees$(O) uncompr$(O) zutil$(O) ZLIBSRC=$(PNGSRC)/../zlib
PROGSRC=$(PNGSRC)/contrib/gregbook
OBJS = rpng2-x$(O) readpng2$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \ # Zlib (minimal inflate requirements - crc32 is used by libpng)
# zutil can be eliminated if you provide your own zcalloc and zcfree
ZSRCS = adler32$(C) crc32$(C) \
inffast$(C) inflate$(C) inftrees$(C) \
zutil$(C)
# Standard headers
ZH = zlib.h crc32.h inffast.h inffixed.h \
inflate.h inftrees.h zutil.h
# Machine generated headers
ZCONF = zconf.h
# Headers callers use
ZINC = zlib.h $(ZCONF)
# Headers the Zlib source uses
ZHDRS = $(ZH) $(ZCONF)
ZOBJS = adler32$(O) crc32$(O) \
inffast$(O) inflate$(O) inftrees$(O) \
zutil$(O)
# libpng
PNGSRCS=png$(C) pngerror$(C) pngget$(C) pngmem$(C) \
pngpread$(C) pngread$(C) pngrio$(C) pngrtran$(C) pngrutil$(C) \
pngset$(C) pngtrans$(C)
# Standard headers
PNGH =png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
# Machine generated headers
PNGCONF=pnglibconf.h
# Headers callers use
PNGINC= png.h pngconf.h pngusr.h $(PNGCONF)
# Headers the PNG library uses
PNGHDRS=$(PNGH) $(PNGCONF) pngusr.h
PNGOBJS=png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
pngpread$(O) pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \ pngpread$(O) pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \
pngset$(O) pngtrans$(O) $(ZOBJS) pngset$(O) pngtrans$(O)
PROGSRCS= rpng2-x$(C) readpng2$(C)
PROGHDRS= readpng2.h
PROGDOCS= COPYING LICENSE
PROGOBJS= rpng2-x$(O) readpng2$(O)
OBJS = $(PROGOBJS) $(PNGOBJS) $(ZOBJS)
# implicit make rules ------------------------------------------------------- # implicit make rules -------------------------------------------------------
.c$(O): png.h pngconf.h pngpriv.h readpng2.h pngusr.h zlib.h .c$(O):
$(CC) -c $(CFLAGS) $< $(CC) -c $(CFLAGS) $<
# dependencies # dependencies
all: rpng2-x$(E) all: $(PROGDOCS) rpng2-x$(E)
rpng2-x$(E): $(OBJS) rpng2-x$(E): $(OBJS)
$(LD) -o rpng2-x$(E) $(OBJS) $(LIBS) $(LD) -o rpng2-x$(E) $(OBJS) $(LIBS)
strip rpng2-x$(E)
# The DFA_XTRA setting turns all libpng options off then
# turns on those required for this minimal build.
# The CPP_FLAGS setting causes pngusr.h to be included in
# both the build of pnglibconf.h and, subsequently, when
# building libpng itself.
$(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak\
$(PNGSRC)/scripts/pnglibconf.dfa \
$(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa
$(RM) pnglibconf.h pnglibconf.dfn
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG"\
DFA_XTRA="pngusr.dfa" $@
clean: clean:
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
srcdir=$(PNGSRC) clean
$(RM) rpng2-x$(O) $(RM) rpng2-x$(O)
$(RM) rpng2-x$(E) $(RM) rpng2-x$(E)
$(RM) $(OBJS) $(RM) $(OBJS)
# distclean also removes the copied source and headers
distclean: clean
$(RM) -r scripts # historical reasons
$(RM) $(PNGSRCS) $(PNGH)
$(RM) $(ZSRCS) $(ZH) $(ZCONF)
$(RM) $(PROGSRCS) $(PROGHDRS) $(PROGDOCS)
# Header file dependencies:
$(PROGOBJS): $(PROGHDRS) $(PNGINC) $(ZINC)
$(PNGOBJS): $(PNGHDRS) $(ZINC)
$(ZOBJS): $(ZHDRS)
# Gather the source code from the respective directories
$(PNGSRCS) $(PNGH): $(PNGSRC)/$@
$(RM) $@
$(COPY) $(PNGSRC)/$@ $@
# No dependency on the ZLIBSRC target so that it only needs
# to be specified once.
$(ZSRCS) $(ZH):
$(RM) $@
$(COPY) $(ZLIBSRC)/$@ $@
# The unconfigured zconf.h varies in name according to the
# zlib release
$(ZCONF):
$(RM) $@
@for f in zconf.h.in zconf.in.h zconf.h; do\
test -r $(ZLIBSRC)/$$f &&\
echo $(COPY) $(ZLIBSRC)/$$f $@ &&\
$(COPY) $(ZLIBSRC)/$$f $@ && exit 0;\
done; echo copy: $(ZLIBSRC)/zconf.h not found; exit 1
$(PROGSRCS) $(PROGHDRS) $(PROGDOCS): $(PROGSRC)/$@
$(RM) $@
$(COPY) $(PROGSRC)/$@ $@
# End of makefile for rpng2-x # End of makefile for rpng2-x

View File

@@ -0,0 +1,40 @@
# pngminim/preader/pngusr.dfa
#
# Copyright (c) 2010-2011 Glenn Randers-Pehrson
#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# First all the build options off:
everything = off
# Just switch on the progressive read code
option PROGRESSIVE_READ on
# You may choose fixed or floating point APIs:
# option FLOATING_POINT on
option FIXED_POINT on
# You must chose the internal fixed point implementation or to
# use the system floating point. The latter is considerably
# smaller (by about 1kbyte on an x86 system):
option FLOATING_ARITHMETIC on
# option FLOATING_ARITHMETIC off
# Your program will probably need other options. The example
# program here, rpng2-x, requires the following. Take a look
# at pnglibconf.h to find out the full set of what has to be
# enabled to make the following work.
option SETJMP on
option STDIO on
option READ_bKGD on
option READ_GAMMA on
option READ_EXPAND on
option READ_STRIP_16_TO_8 on
option READ_GRAY_TO_RGB on

View File

@@ -1,6 +1,6 @@
/* minrdpngconf.h: headers to make a minimal png-read-only library /* minrdpngconf.h: headers to make a minimal png-read-only library
* *
* Copyright (c) 2009 Glenn Randers-Pehrson * Copyright (c) 2009, 2010-2011 Glenn Randers-Pehrson
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
@@ -12,52 +12,12 @@
#ifndef MINPRDPNGCONF_H #ifndef MINPRDPNGCONF_H
#define MINPRDPNGCONF_H #define MINPRDPNGCONF_H
/* To include pngusr.h set -DPNG_USER_CONFIG in CPPFLAGS */
/* List options to turn off features of the build that do not
* affect the API (so are not recorded in pnglibconf.h)
*/
#define PNG_NO_WARNINGS #define PNG_NO_WARNINGS
#define png_warning(s1,s2) ""
#define png_chunk_warning(s1,s2) ""
#define PNG_NO_ERROR_TEXT
#define png_error(s1,s2) png_err(s1)
#define png_chunk_error(s1,s2) png_err(s1)
#define PNG_NO_READ_DITHER
#define PNG_NO_READ_INVERT
#define PNG_NO_READ_SHIFT
#define PNG_NO_READ_PACK
#define PNG_NO_READ_PACKSWAP
#define PNG_NO_READ_FILLER
#define PNG_NO_READ_SWAP
#define PNG_NO_READ_SWAP_ALPHA
#define PNG_NO_READ_INVERT_ALPHA
#define PNG_NO_READ_RGB_TO_GRAY
#define PNG_NO_READ_USER_TRANSFORM
#define PNG_NO_READ_cHRM
#define PNG_NO_READ_hIST
#define PNG_NO_READ_iCCP
#define PNG_NO_READ_pCAL
#define PNG_NO_READ_pHYs
#define PNG_NO_READ_sBIT
#define PNG_NO_READ_sCAL
#define PNG_NO_READ_sPLT
#define PNG_NO_READ_TEXT
#define PNG_NO_READ_tIME
#define PNG_NO_READ_UNKNOWN_CHUNKS
#define PNG_NO_READ_USER_CHUNKS
#define PNG_NO_READ_EMPTY_PLTE
#define PNG_NO_READ_OPT_PLTE
#define PNG_NO_READ_STRIP_ALPHA
#define PNG_NO_READ_oFFs
#define PNG_NO_WRITE_SUPPORTED
#define PNG_NO_INFO_IMAGE
#define PNG_NO_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 /* MINPRDPNGCONF_H */ #endif /* MINPRDPNGCONF_H */

View File

@@ -8,9 +8,9 @@ LD=$(CC)
RM=rm -f RM=rm -f
#PNGPATH = /usr/local #PNGPATH = /usr/local
#PNGINC = -I$(PNGPATH)/include/libpng12 #PNGINC = -I$(PNGPATH)/include/libpng15
#PNGLIB = -L$(PNGPATH)/lib -lpng12 #PNGLIB = -L$(PNGPATH)/lib -lpng15
#PNGLIBS = $(PNGPATH)/lib/libpng12.a #PNGLIBS = $(PNGPATH)/lib/libpng15.a
PNGINC = -I../.. PNGINC = -I../..
PNGLIB = -L../.. -lpng PNGLIB = -L../.. -lpng
PNGLIBS = ../../libpng.a PNGLIBS = ../../libpng.a
@@ -23,9 +23,9 @@ ZINC = -I../../../zlib
ZLIB = -L../../../zlib -lz ZLIB = -L../../../zlib -lz
ZLIBS = ../../../zlib/libz.a ZLIBS = ../../../zlib/libz.a
CFLAGS=-O3 $(PNGINC) $(ZINC) CFLAGS=$(PNGINC) $(ZINC)
LDFLAGS=$(PNGLIB) $(ZLIB) LDLIBS=$(PNGLIB) $(ZLIB)
LDFLAGSS=$(PNGLIBS) $(ZLIBS) LDLIBSS=$(PNGLIBS) $(ZLIBS)
C=.c C=.c
O=.o O=.o
L=.a L=.a
@@ -40,19 +40,19 @@ png2pnm$(O): png2pnm$(C)
$(CC) -c $(CFLAGS) png2pnm$(C) $(CC) -c $(CFLAGS) png2pnm$(C)
png2pnm$(E): png2pnm$(O) png2pnm$(E): png2pnm$(O)
$(LD) -o png2pnm$(E) png2pnm$(O) $(LDFLAGS) -lm $(LD) $(LDFLAGS) -o png2pnm$(E) png2pnm$(O) $(LDLIBS) -lm
png2pnm-static$(E): png2pnm$(O) png2pnm-static$(E): png2pnm$(O)
$(LD) -o png2pnm-static$(E) png2pnm$(O) $(LDFLAGSS) -lm $(LD) $(LDFLAGS) -o png2pnm-static$(E) png2pnm$(O) $(LDLIBSS) -lm
pnm2png$(O): pnm2png$(C) pnm2png$(O): pnm2png$(C)
$(CC) -c $(CFLAGS) pnm2png$(C) $(CC) -c $(CFLAGS) pnm2png$(C)
pnm2png$(E): pnm2png$(O) pnm2png$(E): pnm2png$(O)
$(LD) -o pnm2png$(E) pnm2png$(O) $(LDFLAGS) -lm $(LD) $(LDFLAGS) -o pnm2png$(E) pnm2png$(O) $(LDLIBS) -lm
pnm2png-static$(E): pnm2png$(O) pnm2png-static$(E): pnm2png$(O)
$(LD) -o pnm2png-static$(E) pnm2png$(O) $(LDFLAGSS) -lm $(LD) $(LDFLAGS) -o pnm2png-static$(E) pnm2png$(O) $(LDLIBSS) -lm
clean: clean:
$(RM) png2pnm$(O) $(RM) png2pnm$(O)

View File

@@ -144,7 +144,7 @@ int main(int argc, char *argv[])
if (png2pnm (fp_rd, fp_wr, fp_al, raw, alpha) == FALSE) if (png2pnm (fp_rd, fp_wr, fp_al, raw, alpha) == FALSE)
{ {
fprintf (stderr, "PNG2PNM\n"); fprintf (stderr, "PNG2PNM\n");
fprintf (stderr, "Error: unsuccessful convertion of PNG-image\n"); fprintf (stderr, "Error: unsuccessful conversion of PNG-image\n");
exit(1); exit(1);
} }
@@ -188,7 +188,7 @@ void usage()
BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL alpha) BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL alpha)
{ {
png_struct *png_ptr = NULL; png_struct *png_ptr = NULL;
png_info *info_ptr = NULL; png_info *info_ptr = NULL;
png_byte buf[8]; png_byte buf[8];
png_byte *png_pixels = NULL; png_byte *png_pixels = NULL;
png_byte **row_pointers = NULL; png_byte **row_pointers = NULL;
@@ -381,7 +381,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
fputc ((int) *pix_ptr++ , pnm_file); fputc ((int) *pix_ptr++ , pnm_file);
else else
if (bit_depth == 16){ if (bit_depth == 16){
dep_16 = (long) *pix_ptr++; dep_16 = (long) *pix_ptr++;
fprintf (pnm_file, "%ld ", (dep_16 << 8) + ((long) *pix_ptr++)); fprintf (pnm_file, "%ld ", (dep_16 << 8) + ((long) *pix_ptr++));
} }
else else
@@ -401,9 +401,9 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
fputc ((int) *pix_ptr++ , alpha_file); fputc ((int) *pix_ptr++ , alpha_file);
else else
if (bit_depth == 16){ if (bit_depth == 16){
dep_16 = (long) *pix_ptr++; dep_16 = (long) *pix_ptr++;
fprintf (alpha_file, "%ld ", (dep_16 << 8) + (long) *pix_ptr++); fprintf (alpha_file, "%ld ", (dep_16 << 8) + (long) *pix_ptr++);
} }
else else
fprintf (alpha_file, "%ld ", (long) *pix_ptr++); fprintf (alpha_file, "%ld ", (long) *pix_ptr++);
} }

View File

@@ -1,41 +1,58 @@
pngsuite pngsuite
-------- --------
(c) Willem van Schaik, 1999 (c) Willem van Schaik, 1999, 2011
Permission to use, copy, and distribute these images for any purpose and Permission to use, copy, modify, and distribute these images for any
without fee is hereby granted. purpose and without fee is hereby granted.
These 15 images are part of the much larger PngSuite test-set of The 15 "bas*.png" images are part of the much larger PngSuite test-set of
images, available for developers of PNG supporting software. The images, available for developers of PNG supporting software. The
complete set, available at http:/www.schaik.com/pngsuite/, contains complete set, available at http:/www.schaik.com/pngsuite/, contains
a variety of images to test interlacing, gamma settings, ancillary a variety of images to test interlacing, gamma settings, ancillary
chunks, etc. chunks, etc.
The "ft*.png" images are "free/libre" replacements for the transparent
corresponding t*.png images in the PngSuite.
The images in this directory represent the basic PNG color-types: The images in this directory represent the basic PNG color-types:
grayscale (1-16 bit deep), full color (8 or 16 bit), paletted grayscale (1-16 bit deep), full color (8 or 16 bit), paletted
(1-8 bit) and grayscale or color images with alpha channel. You (1-8 bit) and grayscale or color images with alpha channel. You
can use them to test the proper functioning of PNG software. can use them to test the proper functioning of PNG software.
filename depth type filename depth type
------------ ------ -------------- ------------ ------ --------------
basn0g01.png 1-bit grayscale basn0g01.png 1-bit grayscale
basn0g02.png 2-bit grayscale basn0g02.png 2-bit grayscale
basn0g04.png 4-bit grayscale basn0g04.png 4-bit grayscale
basn0g08.png 8-bit grayscale basn0g08.png 8-bit grayscale
basn0g16.png 16-bit grayscale basn0g16.png 16-bit grayscale
basn2c08.png 8-bit truecolor basn2c08.png 8-bit truecolor
basn2c16.png 16-bit truecolor basn2c16.png 16-bit truecolor
basn3p01.png 1-bit paletted basn3p01.png 1-bit paletted
basn3p02.png 2-bit paletted basn3p02.png 2-bit paletted
basn3p04.png 4-bit paletted basn3p04.png 4-bit paletted
basn3p08.png 8-bit paletted basn3p08.png 8-bit paletted
basn4a08.png 8-bit gray with alpha basn4a08.png 8-bit gray with alpha
basn4a16.png 16-bit gray with alpha basn4a16.png 16-bit gray with alpha
basn6a08.png 8-bit RGBA basn6a08.png 8-bit RGBA
basn6a16.png 16-bit RGBA basn6a16.png 16-bit RGBA
Here is the correct result of typing "pngtest -m *.png" in ftbbn0g04.png 4-bit grayscale, black bKGD
ftbbn2c16.png 16-bit truecolor, black bKGD
ftbbn3p08.png 8-bit paletted, black bKGD
ftbgn2c16.png 16-bit truecolor, gray bKGD
ftbgn3p08.png 8-bit paletted, gray bKGD
ftbrn2c08.png 8-bit truecolor, red bKGD
ftbwn0g16.png 16-bit gray, white bKGD
ftbwn3p08.png 8-bit paletted, white bKGD
ftbyn3p08.png 8-bit paletted, yellow bKGD
ftp0n0g08.png 8-bit grayscale, opaque
ftp0n2c08.png 8-bit truecolor, opaque
ftp0n3p08.png 8-bit paletted, opaque
ftp1n3p08.png 8-bit paletted, no bKGD
Here is the correct result of typing "pngtest -m bas*.png" in
this directory: this directory:
Testing basn0g01.png: PASS (524 zero samples) Testing basn0g01.png: PASS (524 zero samples)

Binary file not shown.

After

Width:  |  Height:  |  Size: 429 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 719 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -1,12 +1,13 @@
//------------------------------------- /*-------------------------------------
// PNGFILE.C -- Image File Functions * PNGFILE.C -- Image File Functions
//------------------------------------- *-------------------------------------
*
// Copyright 2000, Willem van Schaik. * Copyright 2000, Willem van Schaik.
// *
// This code is released under the libpng license. * This code is released under the libpng license.
// For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
// and license in png.h * and license in png.h
*/
#include <windows.h> #include <windows.h>
#include <commdlg.h> #include <commdlg.h>
@@ -28,7 +29,7 @@ static png_structp png_ptr = NULL;
static png_infop info_ptr = NULL; static png_infop info_ptr = NULL;
// cexcept interface /* cexcept interface */
static void static void
png_cexcept_error(png_structp png_ptr, png_const_charp msg) png_cexcept_error(png_structp png_ptr, png_const_charp msg)
@@ -43,7 +44,7 @@ png_cexcept_error(png_structp png_ptr, png_const_charp msg)
} }
} }
// Windows open-file functions /* Windows open-file functions */
void PngFileInitialize (HWND hwnd) void PngFileInitialize (HWND hwnd)
{ {
@@ -57,13 +58,13 @@ void PngFileInitialize (HWND hwnd)
ofn.lpstrCustomFilter = NULL; ofn.lpstrCustomFilter = NULL;
ofn.nMaxCustFilter = 0; ofn.nMaxCustFilter = 0;
ofn.nFilterIndex = 0; ofn.nFilterIndex = 0;
ofn.lpstrFile = NULL; // Set in Open and Close functions ofn.lpstrFile = NULL; /* Set in Open and Close functions */
ofn.nMaxFile = MAX_PATH; ofn.nMaxFile = MAX_PATH;
ofn.lpstrFileTitle = NULL; // Set in Open and Close functions ofn.lpstrFileTitle = NULL; /* Set in Open and Close functions */
ofn.nMaxFileTitle = MAX_PATH; ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrInitialDir = NULL; ofn.lpstrInitialDir = NULL;
ofn.lpstrTitle = NULL; ofn.lpstrTitle = NULL;
ofn.Flags = 0; // Set in Open and Close functions ofn.Flags = 0; /* Set in Open and Close functions */
ofn.nFileOffset = 0; ofn.nFileOffset = 0;
ofn.nFileExtension = 0; ofn.nFileExtension = 0;
ofn.lpstrDefExt = TEXT ("png"); ofn.lpstrDefExt = TEXT ("png");
@@ -92,7 +93,7 @@ BOOL PngFileSaveDlg (HWND hwnd, PTSTR pstrFileName, PTSTR pstrTitleName)
return GetSaveFileName (&ofn); return GetSaveFileName (&ofn);
} }
// PNG image handler functions /* PNG image handler functions */
BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData, BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
int *piWidth, int *piHeight, int *piChannels, png_color *pBkgColor) int *piWidth, int *piHeight, int *piChannels, png_color *pBkgColor)
@@ -109,7 +110,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
static png_byte **ppbRowPointers = NULL; static png_byte **ppbRowPointers = NULL;
int i; int i;
// open the PNG input file /* open the PNG input file */
if (!pstrFileName) if (!pstrFileName)
{ {
@@ -123,7 +124,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
return FALSE; return FALSE;
} }
// first check the eight byte PNG signature /* first check the eight byte PNG signature */
fread(pbSig, 1, 8, pfFile); fread(pbSig, 1, 8, pfFile);
if (png_sig_cmp(pbSig, 0, 8)) if (png_sig_cmp(pbSig, 0, 8))
@@ -132,7 +133,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
return FALSE; return FALSE;
} }
// create the two png(-info) structures /* create the two png(-info) structures */
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL,
(png_error_ptr)png_cexcept_error, (png_error_ptr)NULL); (png_error_ptr)png_cexcept_error, (png_error_ptr)NULL);
@@ -153,7 +154,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
Try Try
{ {
// initialize the png structure /* initialize the png structure */
#ifdef PNG_STDIO_SUPPORTED #ifdef PNG_STDIO_SUPPORTED
png_init_io(png_ptr, pfFile); png_init_io(png_ptr, pfFile);
@@ -163,20 +164,26 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
png_set_sig_bytes(png_ptr, 8); png_set_sig_bytes(png_ptr, 8);
// read all PNG info up to image data /* read all PNG info up to image data */
png_read_info(png_ptr, info_ptr); png_read_info(png_ptr, info_ptr);
// get width, height, bit-depth and color-type /* get width, height, bit-depth and color-type */
png_get_IHDR(png_ptr, info_ptr, piWidth, piHeight, &iBitDepth, png_get_IHDR(png_ptr, info_ptr, piWidth, piHeight, &iBitDepth,
&iColorType, NULL, NULL, NULL); &iColorType, NULL, NULL, NULL);
// expand images of all color-type and bit-depth to 3x8 bit RGB images /* expand images of all color-type and bit-depth to 3x8-bit RGB */
// let the library process things like alpha, transparency, background /* let the library process alpha, transparency, background, etc. */
if (iBitDepth == 16) #ifdef PNG_READ_16_TO_8_SUPPORTED
png_set_strip_16(png_ptr); if (iBitDepth == 16)
# ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
png_set_scale_16(png_ptr);
# else
png_set_strip_16(png_ptr);
# endif
#endif
if (iColorType == PNG_COLOR_TYPE_PALETTE) if (iColorType == PNG_COLOR_TYPE_PALETTE)
png_set_expand(png_ptr); png_set_expand(png_ptr);
if (iBitDepth < 8) if (iBitDepth < 8)
@@ -187,7 +194,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
iColorType == PNG_COLOR_TYPE_GRAY_ALPHA) iColorType == PNG_COLOR_TYPE_GRAY_ALPHA)
png_set_gray_to_rgb(png_ptr); png_set_gray_to_rgb(png_ptr);
// set the background color to draw transparent and alpha images over. /* set the background color to draw transparent and alpha images over */
if (png_get_bKGD(png_ptr, info_ptr, &pBackground)) if (png_get_bKGD(png_ptr, info_ptr, &pBackground))
{ {
png_set_background(png_ptr, pBackground, PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); png_set_background(png_ptr, pBackground, PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
@@ -200,28 +207,28 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
pBkgColor = NULL; pBkgColor = NULL;
} }
// if required set gamma conversion /* if required set gamma conversion */
if (png_get_gAMA(png_ptr, info_ptr, &dGamma)) if (png_get_gAMA(png_ptr, info_ptr, &dGamma))
png_set_gamma(png_ptr, (double) 2.2, dGamma); png_set_gamma(png_ptr, (double) 2.2, dGamma);
// after the transformations have been registered update info_ptr data /* after the transformations are registered, update info_ptr data */
png_read_update_info(png_ptr, info_ptr); png_read_update_info(png_ptr, info_ptr);
// get again width, height and the new bit-depth and color-type /* get again width, height and the new bit-depth and color-type */
png_get_IHDR(png_ptr, info_ptr, piWidth, piHeight, &iBitDepth, png_get_IHDR(png_ptr, info_ptr, piWidth, piHeight, &iBitDepth,
&iColorType, NULL, NULL, NULL); &iColorType, NULL, NULL, NULL);
// row_bytes is the width x number of channels /* row_bytes is the width x number of channels */
ulRowBytes = png_get_rowbytes(png_ptr, info_ptr); ulRowBytes = png_get_rowbytes(png_ptr, info_ptr);
ulChannels = png_get_channels(png_ptr, info_ptr); ulChannels = png_get_channels(png_ptr, info_ptr);
*piChannels = ulChannels; *piChannels = ulChannels;
// now we can allocate memory to store the image /* now we can allocate memory to store the image */
if (pbImageData) if (pbImageData)
{ {
@@ -235,7 +242,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
} }
*ppbImageData = pbImageData; *ppbImageData = pbImageData;
// and allocate memory for an array of row-pointers /* and allocate memory for an array of row-pointers */
if ((ppbRowPointers = (png_bytepp) malloc((*piHeight) if ((ppbRowPointers = (png_bytepp) malloc((*piHeight)
* sizeof(png_bytep))) == NULL) * sizeof(png_bytep))) == NULL)
@@ -243,25 +250,25 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
png_error(png_ptr, "Visual PNG: out of memory"); png_error(png_ptr, "Visual PNG: out of memory");
} }
// set the individual row-pointers to point at the correct offsets /* set the individual row-pointers to point at the correct offsets */
for (i = 0; i < (*piHeight); i++) for (i = 0; i < (*piHeight); i++)
ppbRowPointers[i] = pbImageData + i * ulRowBytes; ppbRowPointers[i] = pbImageData + i * ulRowBytes;
// now we can go ahead and just read the whole image /* now we can go ahead and just read the whole image */
png_read_image(png_ptr, ppbRowPointers); png_read_image(png_ptr, ppbRowPointers);
// read the additional chunks in the PNG file (not really needed) /* read the additional chunks in the PNG file (not really needed) */
png_read_end(png_ptr, NULL); png_read_end(png_ptr, NULL);
// and we're done /* and we're done */
free (ppbRowPointers); free (ppbRowPointers);
ppbRowPointers = NULL; ppbRowPointers = NULL;
// yepp, done /* yepp, done */
} }
Catch (msg) Catch (msg)
@@ -295,7 +302,7 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
static png_byte **ppbRowPointers = NULL; static png_byte **ppbRowPointers = NULL;
int i; int i;
// open the PNG output file /* open the PNG output file */
if (!pstrFileName) if (!pstrFileName)
return FALSE; return FALSE;
@@ -303,7 +310,7 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
if (!(pfFile = fopen(pstrFileName, "wb"))) if (!(pfFile = fopen(pstrFileName, "wb")))
return FALSE; return FALSE;
// prepare the standard PNG structures /* prepare the standard PNG structures */
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL,
(png_error_ptr)png_cexcept_error, (png_error_ptr)NULL); (png_error_ptr)png_cexcept_error, (png_error_ptr)NULL);
@@ -322,7 +329,7 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
Try Try
{ {
// initialize the png structure /* initialize the png structure */
#ifdef PNG_STDIO_SUPPORTED #ifdef PNG_STDIO_SUPPORTED
png_init_io(png_ptr, pfFile); png_init_io(png_ptr, pfFile);
@@ -330,52 +337,52 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
png_set_write_fn(png_ptr, (png_voidp)pfFile, png_write_data, png_flush); png_set_write_fn(png_ptr, (png_voidp)pfFile, png_write_data, png_flush);
#endif #endif
// we're going to write a very simple 3x8 bit RGB image /* we're going to write a very simple 3x8-bit RGB image */
png_set_IHDR(png_ptr, info_ptr, iWidth, iHeight, ciBitDepth, png_set_IHDR(png_ptr, info_ptr, iWidth, iHeight, ciBitDepth,
PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE,
PNG_FILTER_TYPE_BASE); PNG_FILTER_TYPE_BASE);
// write the file header information /* write the file header information */
png_write_info(png_ptr, info_ptr); png_write_info(png_ptr, info_ptr);
// swap the BGR pixels in the DiData structure to RGB /* swap the BGR pixels in the DiData structure to RGB */
png_set_bgr(png_ptr); png_set_bgr(png_ptr);
// row_bytes is the width x number of channels /* row_bytes is the width x number of channels */
ulRowBytes = iWidth * ciChannels; ulRowBytes = iWidth * ciChannels;
// we can allocate memory for an array of row-pointers /* we can allocate memory for an array of row-pointers */
if ((ppbRowPointers = (png_bytepp) malloc(iHeight * sizeof(png_bytep))) == NULL) if ((ppbRowPointers = (png_bytepp) malloc(iHeight * sizeof(png_bytep))) == NULL)
Throw "Visualpng: Out of memory"; Throw "Visualpng: Out of memory";
// set the individual row-pointers to point at the correct offsets /* set the individual row-pointers to point at the correct offsets */
for (i = 0; i < iHeight; i++) for (i = 0; i < iHeight; i++)
ppbRowPointers[i] = pDiData + i * (((ulRowBytes + 3) >> 2) << 2); ppbRowPointers[i] = pDiData + i * (((ulRowBytes + 3) >> 2) << 2);
// write out the entire image data in one call /* write out the entire image data in one call */
png_write_image (png_ptr, ppbRowPointers); png_write_image (png_ptr, ppbRowPointers);
// write the additional chunks to the PNG file (not really needed) /* write the additional chunks to the PNG file (not really needed) */
png_write_end(png_ptr, info_ptr); png_write_end(png_ptr, info_ptr);
// and we're done /* and we're done */
free (ppbRowPointers); free (ppbRowPointers);
ppbRowPointers = NULL; ppbRowPointers = 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, (png_infopp) NULL); png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
// yepp, done /* yepp, done */
} }
Catch (msg) Catch (msg)
@@ -437,6 +444,7 @@ png_flush(png_structp png_ptr)
#endif #endif
//----------------- /*-----------------
// end of source * end of source
//----------------- *-----------------
*/

View File

@@ -1,12 +1,12 @@
//------------------------------------------ /*------------------------------------------*/
// PNGFILE.H -- Header File for pngfile.c /* PNGFILE.H -- Header File for pngfile.c*/
//------------------------------------------ /*------------------------------------------*/
// Copyright 2000, Willem van Schaik. /* Copyright 2000, Willem van Schaik.*/
// This code is released under the libpng license. /* This code is released under the libpng license.*/
// For conditions of distribution and use, see the disclaimer /* For conditions of distribution and use, see the disclaimer*/
// and license in png.h /* and license in png.h*/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@@ -1,41 +1,42 @@
//------------------------------------ /*------------------------------------
// VisualPng.C -- Shows a PNG image * VisualPng.C -- Shows a PNG image
//------------------------------------ *------------------------------------
*
* Copyright 2000, Willem van Schaik.
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/
// Copyright 2000, Willem van Schaik. /* switches */
// This code is released under the libpng license. /* defines */
// For conditions of distribution and use, see the disclaimer
// and license in png.h
// switches
// defines
#define PROGNAME "VisualPng" #define PROGNAME "VisualPng"
#define LONGNAME "Win32 Viewer for PNG-files" #define LONGNAME "Win32 Viewer for PNG-files"
#define VERSION "1.0 of 2000 June 07" #define VERSION "1.0 of 2000 June 07"
// constants /* constants */
#define MARGIN 8 #define MARGIN 8
// standard includes /* standard includes */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <windows.h> #include <windows.h>
// application includes /* application includes */
#include "png.h" #include "png.h"
#include "pngfile.h" #include "pngfile.h"
#include "resource.h" #include "resource.h"
// macros /* macros */
// function prototypes /* function prototypes */
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM); LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK AboutDlgProc (HWND, UINT, WPARAM, LPARAM) ; BOOL CALLBACK AboutDlgProc (HWND, UINT, WPARAM, LPARAM) ;
@@ -65,14 +66,14 @@ BOOL FillBitmap (
BYTE *pbImage, int cxImgSize, int cyImgSize, int cImgChannels, BYTE *pbImage, int cxImgSize, int cyImgSize, int cImgChannels,
BOOL bStretched); BOOL bStretched);
// a few global variables /* a few global variables */
static char *szProgName = PROGNAME; static char *szProgName = PROGNAME;
static char *szAppName = LONGNAME; static char *szAppName = LONGNAME;
static char *szIconName = PROGNAME; static char *szIconName = PROGNAME;
static char szCmdFileName [MAX_PATH]; static char szCmdFileName [MAX_PATH];
// MAIN routine /* MAIN routine */
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow) PSTR szCmdLine, int iCmdShow)
@@ -90,7 +91,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
wndclass.hInstance = hInstance; wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon (hInstance, szIconName) ; wndclass.hIcon = LoadIcon (hInstance, szIconName) ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW); wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
wndclass.hbrBackground = NULL; // (HBRUSH) GetStockObject (GRAY_BRUSH); wndclass.hbrBackground = NULL; /* (HBRUSH) GetStockObject (GRAY_BRUSH); */
wndclass.lpszMenuName = szProgName; wndclass.lpszMenuName = szProgName;
wndclass.lpszClassName = szProgName; wndclass.lpszClassName = szProgName;
@@ -101,7 +102,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
return 0; return 0;
} }
// if filename given on commandline, store it /* if filename given on commandline, store it */
if ((szCmdLine != NULL) && (*szCmdLine != '\0')) if ((szCmdLine != NULL) && (*szCmdLine != '\0'))
if (szCmdLine[0] == '"') if (szCmdLine[0] == '"')
strncpy (szCmdFileName, szCmdLine + 1, strlen(szCmdLine) - 2); strncpy (szCmdFileName, szCmdLine + 1, strlen(szCmdLine) - 2);
@@ -110,20 +111,20 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
else else
strcpy (szCmdFileName, ""); strcpy (szCmdFileName, "");
// calculate size of window-borders /* calculate size of window-borders */
ixBorders = 2 * (GetSystemMetrics (SM_CXBORDER) + ixBorders = 2 * (GetSystemMetrics (SM_CXBORDER) +
GetSystemMetrics (SM_CXDLGFRAME)); GetSystemMetrics (SM_CXDLGFRAME));
iyBorders = 2 * (GetSystemMetrics (SM_CYBORDER) + iyBorders = 2 * (GetSystemMetrics (SM_CYBORDER) +
GetSystemMetrics (SM_CYDLGFRAME)) + GetSystemMetrics (SM_CYDLGFRAME)) +
GetSystemMetrics (SM_CYCAPTION) + GetSystemMetrics (SM_CYCAPTION) +
GetSystemMetrics (SM_CYMENUSIZE) + GetSystemMetrics (SM_CYMENUSIZE) +
1; /* WvS: don't ask me why? */ 1; /* WvS: don't ask me why? */
hwnd = CreateWindow (szProgName, szAppName, hwnd = CreateWindow (szProgName, szAppName,
WS_OVERLAPPEDWINDOW, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
512 + 2 * MARGIN + ixBorders, 384 + 2 * MARGIN + iyBorders, 512 + 2 * MARGIN + ixBorders, 384 + 2 * MARGIN + iyBorders,
// CW_USEDEFAULT, CW_USEDEFAULT, /* CW_USEDEFAULT, CW_USEDEFAULT, */
NULL, NULL, hInstance, NULL); NULL, NULL, hInstance, NULL);
ShowWindow (hwnd, iCmdShow); ShowWindow (hwnd, iCmdShow);
@@ -180,29 +181,29 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
strcpy (szImgPathName, ""); strcpy (szImgPathName, "");
// in case we process file given on command-line /* in case we process file given on command-line */
if (szCmdFileName[0] != '\0') if (szCmdFileName[0] != '\0')
{ {
strcpy (szImgPathName, szCmdFileName); strcpy (szImgPathName, szCmdFileName);
// read the other png-files in the directory for later /* read the other png-files in the directory for later */
// next/previous commands /* next/previous commands */
BuildPngList (szImgPathName, &pPngFileList, &iPngFileCount, BuildPngList (szImgPathName, &pPngFileList, &iPngFileCount,
&iPngFileIndex); &iPngFileIndex);
// load the image from file /* load the image from file */
if (!LoadImageFile (hwnd, szImgPathName, if (!LoadImageFile (hwnd, szImgPathName,
&pbImage, &cxImgSize, &cyImgSize, &cImgChannels, &bkgColor)) &pbImage, &cxImgSize, &cyImgSize, &cImgChannels, &bkgColor))
return 0; return 0;
// invalidate the client area for later update /* invalidate the client area for later update */
InvalidateRect (hwnd, NULL, TRUE); InvalidateRect (hwnd, NULL, TRUE);
// display the PNG into the DIBitmap /* display the PNG into the DIBitmap */
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize, DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched); pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
@@ -214,11 +215,11 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
cxWinSize = LOWORD (lParam); cxWinSize = LOWORD (lParam);
cyWinSize = HIWORD (lParam); cyWinSize = HIWORD (lParam);
// invalidate the client area for later update /* invalidate the client area for later update */
InvalidateRect (hwnd, NULL, TRUE); InvalidateRect (hwnd, NULL, TRUE);
// display the PNG into the DIBitmap /* display the PNG into the DIBitmap */
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize, DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched); pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
@@ -242,28 +243,28 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
{ {
case IDM_FILE_OPEN: case IDM_FILE_OPEN:
// show the File Open dialog box /* show the File Open dialog box */
if (!PngFileOpenDlg (hwnd, szImgPathName, szTitleName)) if (!PngFileOpenDlg (hwnd, szImgPathName, szTitleName))
return 0; return 0;
// read the other png-files in the directory for later /* read the other png-files in the directory for later */
// next/previous commands /* next/previous commands */
BuildPngList (szImgPathName, &pPngFileList, &iPngFileCount, BuildPngList (szImgPathName, &pPngFileList, &iPngFileCount,
&iPngFileIndex); &iPngFileIndex);
// load the image from file /* load the image from file */
if (!LoadImageFile (hwnd, szImgPathName, if (!LoadImageFile (hwnd, szImgPathName,
&pbImage, &cxImgSize, &cyImgSize, &cImgChannels, &bkgColor)) &pbImage, &cxImgSize, &cyImgSize, &cImgChannels, &bkgColor))
return 0; return 0;
// invalidate the client area for later update /* invalidate the client area for later update */
InvalidateRect (hwnd, NULL, TRUE); InvalidateRect (hwnd, NULL, TRUE);
// display the PNG into the DIBitmap /* display the PNG into the DIBitmap */
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize, DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched); pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
@@ -272,12 +273,12 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
case IDM_FILE_SAVE: case IDM_FILE_SAVE:
// show the File Save dialog box /* show the File Save dialog box */
if (!PngFileSaveDlg (hwnd, szImgPathName, szTitleName)) if (!PngFileSaveDlg (hwnd, szImgPathName, szTitleName))
return 0; return 0;
// save the PNG to a disk file /* save the PNG to a disk file */
SetCursor (LoadCursor (NULL, IDC_WAIT)); SetCursor (LoadCursor (NULL, IDC_WAIT));
ShowCursor (TRUE); ShowCursor (TRUE);
@@ -295,7 +296,7 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
case IDM_FILE_NEXT: case IDM_FILE_NEXT:
// read next entry in the directory /* read next entry in the directory */
if (SearchPngList (pPngFileList, iPngFileCount, &iPngFileIndex, if (SearchPngList (pPngFileList, iPngFileCount, &iPngFileIndex,
NULL, szImgPathName)) NULL, szImgPathName))
@@ -303,17 +304,17 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
if (strcmp (szImgPathName, "") == 0) if (strcmp (szImgPathName, "") == 0)
return 0; return 0;
// load the image from file /* load the image from file */
if (!LoadImageFile (hwnd, szImgPathName, &pbImage, if (!LoadImageFile (hwnd, szImgPathName, &pbImage,
&cxImgSize, &cyImgSize, &cImgChannels, &bkgColor)) &cxImgSize, &cyImgSize, &cImgChannels, &bkgColor))
return 0; return 0;
// invalidate the client area for later update /* invalidate the client area for later update */
InvalidateRect (hwnd, NULL, TRUE); InvalidateRect (hwnd, NULL, TRUE);
// display the PNG into the DIBitmap /* display the PNG into the DIBitmap */
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize, DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched); pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
@@ -323,7 +324,7 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
case IDM_FILE_PREVIOUS: case IDM_FILE_PREVIOUS:
// read previous entry in the directory /* read previous entry in the directory */
if (SearchPngList (pPngFileList, iPngFileCount, &iPngFileIndex, if (SearchPngList (pPngFileList, iPngFileCount, &iPngFileIndex,
szImgPathName, NULL)) szImgPathName, NULL))
@@ -332,17 +333,17 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
if (strcmp (szImgPathName, "") == 0) if (strcmp (szImgPathName, "") == 0)
return 0; return 0;
// load the image from file /* load the image from file */
if (!LoadImageFile (hwnd, szImgPathName, &pbImage, &cxImgSize, if (!LoadImageFile (hwnd, szImgPathName, &pbImage, &cxImgSize,
&cyImgSize, &cImgChannels, &bkgColor)) &cyImgSize, &cImgChannels, &bkgColor))
return 0; return 0;
// invalidate the client area for later update /* invalidate the client area for later update */
InvalidateRect (hwnd, NULL, TRUE); InvalidateRect (hwnd, NULL, TRUE);
// display the PNG into the DIBitmap /* display the PNG into the DIBitmap */
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize, DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched); pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
@@ -352,9 +353,9 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
case IDM_FILE_EXIT: case IDM_FILE_EXIT:
// more cleanup needed... /* more cleanup needed... */
// free image buffer /* free image buffer */
if (pDib != NULL) if (pDib != NULL)
{ {
@@ -362,7 +363,7 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
pDib = NULL; pDib = NULL;
} }
// free file-list /* free file-list */
if (pPngFileList != NULL) if (pPngFileList != NULL)
{ {
@@ -370,7 +371,7 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
pPngFileList = NULL; pPngFileList = NULL;
} }
// let's go ... /* let's go ... */
exit (0); exit (0);
@@ -383,11 +384,11 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
else else
CheckMenuItem (hMenu, IDM_OPTIONS_STRETCH, MF_UNCHECKED); CheckMenuItem (hMenu, IDM_OPTIONS_STRETCH, MF_UNCHECKED);
// invalidate the client area for later update /* invalidate the client area for later update */
InvalidateRect (hwnd, NULL, TRUE); InvalidateRect (hwnd, NULL, TRUE);
// display the PNG into the DIBitmap /* display the PNG into the DIBitmap */
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize, DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched); pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
@@ -398,7 +399,7 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
DialogBox (hInstance, TEXT ("AboutBox"), hwnd, AboutDlgProc) ; DialogBox (hInstance, TEXT ("AboutBox"), hwnd, AboutDlgProc) ;
return 0; return 0;
} // end switch } /* end switch */
break; break;
@@ -450,10 +451,10 @@ BOOL CALLBACK AboutDlgProc (HWND hDlg, UINT message,
return FALSE ; return FALSE ;
} }
//--------------- /*---------------
// CenterAbout * CenterAbout
//--------------- *---------------
*/
BOOL CenterAbout (HWND hwndChild, HWND hwndParent) BOOL CenterAbout (HWND hwndChild, HWND hwndParent)
{ {
RECT rChild, rParent, rWorkArea; RECT rChild, rParent, rWorkArea;
@@ -461,19 +462,19 @@ BOOL CenterAbout (HWND hwndChild, HWND hwndParent)
int xNew, yNew; int xNew, yNew;
BOOL bResult; BOOL bResult;
// Get the Height and Width of the child window /* Get the Height and Width of the child window */
GetWindowRect (hwndChild, &rChild); GetWindowRect (hwndChild, &rChild);
wChild = rChild.right - rChild.left; wChild = rChild.right - rChild.left;
hChild = rChild.bottom - rChild.top; hChild = rChild.bottom - rChild.top;
// Get the Height and Width of the parent window /* Get the Height and Width of the parent window */
GetWindowRect (hwndParent, &rParent); GetWindowRect (hwndParent, &rParent);
wParent = rParent.right - rParent.left; wParent = rParent.right - rParent.left;
hParent = rParent.bottom - rParent.top; hParent = rParent.bottom - rParent.top;
// Get the limits of the 'workarea' /* Get the limits of the 'workarea' */
bResult = SystemParametersInfo( bResult = SystemParametersInfo(
SPI_GETWORKAREA, // system parameter to query or set SPI_GETWORKAREA, /* system parameter to query or set */
sizeof(RECT), sizeof(RECT),
&rWorkArea, &rWorkArea,
0); 0);
@@ -483,7 +484,7 @@ BOOL CenterAbout (HWND hwndChild, HWND hwndParent)
rWorkArea.bottom = GetSystemMetrics(SM_CYSCREEN); rWorkArea.bottom = GetSystemMetrics(SM_CYSCREEN);
} }
// Calculate new X position, then adjust for workarea /* Calculate new X position, then adjust for workarea */
xNew = rParent.left + ((wParent - wChild) /2); xNew = rParent.left + ((wParent - wChild) /2);
if (xNew < rWorkArea.left) { if (xNew < rWorkArea.left) {
xNew = rWorkArea.left; xNew = rWorkArea.left;
@@ -491,7 +492,7 @@ BOOL CenterAbout (HWND hwndChild, HWND hwndParent)
xNew = rWorkArea.right - wChild; xNew = rWorkArea.right - wChild;
} }
// Calculate new Y position, then adjust for workarea /* Calculate new Y position, then adjust for workarea */
yNew = rParent.top + ((hParent - hChild) /2); yNew = rParent.top + ((hParent - hChild) /2);
if (yNew < rWorkArea.top) { if (yNew < rWorkArea.top) {
yNew = rWorkArea.top; yNew = rWorkArea.top;
@@ -499,15 +500,15 @@ BOOL CenterAbout (HWND hwndChild, HWND hwndParent)
yNew = rWorkArea.bottom - hChild; yNew = rWorkArea.bottom - hChild;
} }
// Set it, and return /* Set it, and return */
return SetWindowPos (hwndChild, NULL, xNew, yNew, 0, 0, SWP_NOSIZE | return SetWindowPos (hwndChild, NULL, xNew, yNew, 0, 0, SWP_NOSIZE |
SWP_NOZORDER); SWP_NOZORDER);
} }
//---------------- /*----------------
// BuildPngList * BuildPngList
//---------------- *----------------
*/
BOOL BuildPngList (PTSTR pstrPathName, TCHAR **ppFileList, int *pFileCount, BOOL BuildPngList (PTSTR pstrPathName, TCHAR **ppFileList, int *pFileCount,
int *pFileIndex) int *pFileIndex)
{ {
@@ -523,7 +524,7 @@ BOOL BuildPngList (PTSTR pstrPathName, TCHAR **ppFileList, int *pFileCount,
int i, ii; int i, ii;
int j, jj; int j, jj;
// free previous file-list /* free previous file-list */
if (*ppFileList != NULL) if (*ppFileList != NULL)
{ {
@@ -531,7 +532,7 @@ BOOL BuildPngList (PTSTR pstrPathName, TCHAR **ppFileList, int *pFileCount,
*ppFileList = NULL; *ppFileList = NULL;
} }
// extract foldername, filename and search-name /* extract foldername, filename and search-name */
strcpy (szImgPathName, pstrPathName); strcpy (szImgPathName, pstrPathName);
strcpy (szImgFileName, strrchr (pstrPathName, '\\') + 1); strcpy (szImgFileName, strrchr (pstrPathName, '\\') + 1);
@@ -540,7 +541,7 @@ BOOL BuildPngList (PTSTR pstrPathName, TCHAR **ppFileList, int *pFileCount,
*(strrchr (szImgFindName, '\\') + 1) = '\0'; *(strrchr (szImgFindName, '\\') + 1) = '\0';
strcat (szImgFindName, "*.png"); strcat (szImgFindName, "*.png");
// first cycle: count number of files in directory for memory allocation /* first cycle: count number of files in directory for memory allocation */
*pFileCount = 0; *pFileCount = 0;
@@ -554,11 +555,11 @@ BOOL BuildPngList (PTSTR pstrPathName, TCHAR **ppFileList, int *pFileCount,
} }
FindClose(hFind); FindClose(hFind);
// allocation memory for file-list /* allocation memory for file-list */
*ppFileList = (TCHAR *) malloc (*pFileCount * MAX_PATH); *ppFileList = (TCHAR *) malloc (*pFileCount * MAX_PATH);
// second cycle: read directory and store filenames in file-list /* second cycle: read directory and store filenames in file-list */
hFind = FindFirstFile(szImgFindName, &finddata); hFind = FindFirstFile(szImgFindName, &finddata);
bOk = (hFind != (HANDLE) -1); bOk = (hFind != (HANDLE) -1);
@@ -580,7 +581,7 @@ BOOL BuildPngList (PTSTR pstrPathName, TCHAR **ppFileList, int *pFileCount,
} }
FindClose(hFind); FindClose(hFind);
// finally we must sort the file-list /* finally we must sort the file-list */
for (i = 0; i < *pFileCount - 1; i++) for (i = 0; i < *pFileCount - 1; i++)
{ {
@@ -594,7 +595,7 @@ BOOL BuildPngList (PTSTR pstrPathName, TCHAR **ppFileList, int *pFileCount,
strcpy (*ppFileList + jj, *ppFileList + ii); strcpy (*ppFileList + jj, *ppFileList + ii);
strcpy (*ppFileList + ii, szTmp); strcpy (*ppFileList + ii, szTmp);
// check if this was the current image that we moved /* check if this was the current image that we moved */
if (*pFileIndex == i) if (*pFileIndex == i)
*pFileIndex = j; *pFileIndex = j;
@@ -608,9 +609,10 @@ BOOL BuildPngList (PTSTR pstrPathName, TCHAR **ppFileList, int *pFileCount,
return TRUE; return TRUE;
} }
//---------------- /*----------------
// SearchPngList * SearchPngList
//---------------- *----------------
*/
BOOL SearchPngList ( BOOL SearchPngList (
TCHAR *pFileList, int FileCount, int *pFileIndex, TCHAR *pFileList, int FileCount, int *pFileIndex,
@@ -618,7 +620,7 @@ BOOL SearchPngList (
{ {
if (FileCount > 0) if (FileCount > 0)
{ {
// get previous entry /* get previous entry */
if (pstrPrevName != NULL) if (pstrPrevName != NULL)
{ {
@@ -630,7 +632,7 @@ BOOL SearchPngList (
strcpy (pstrPrevName, pFileList + (*pFileIndex * MAX_PATH)); strcpy (pstrPrevName, pFileList + (*pFileIndex * MAX_PATH));
} }
// get next entry /* get next entry */
if (pstrNextName != NULL) if (pstrNextName != NULL)
{ {
@@ -650,9 +652,10 @@ BOOL SearchPngList (
} }
} }
//----------------- /*-----------------
// LoadImageFile * LoadImageFile
//----------------- *-----------------
*/
BOOL LoadImageFile (HWND hwnd, PTSTR pstrPathName, BOOL LoadImageFile (HWND hwnd, PTSTR pstrPathName,
png_byte **ppbImage, int *pxImgSize, int *pyImgSize, png_byte **ppbImage, int *pxImgSize, int *pyImgSize,
@@ -660,7 +663,7 @@ BOOL LoadImageFile (HWND hwnd, PTSTR pstrPathName,
{ {
static TCHAR szTmp [MAX_PATH]; static TCHAR szTmp [MAX_PATH];
// if there's an existing PNG, free the memory /* if there's an existing PNG, free the memory */
if (*ppbImage) if (*ppbImage)
{ {
@@ -668,7 +671,7 @@ BOOL LoadImageFile (HWND hwnd, PTSTR pstrPathName,
*ppbImage = NULL; *ppbImage = NULL;
} }
// Load the entire PNG into memory /* Load the entire PNG into memory */
SetCursor (LoadCursor (NULL, IDC_WAIT)); SetCursor (LoadCursor (NULL, IDC_WAIT));
ShowCursor (TRUE); ShowCursor (TRUE);
@@ -694,10 +697,10 @@ BOOL LoadImageFile (HWND hwnd, PTSTR pstrPathName,
return TRUE; return TRUE;
} }
//---------------- /*----------------
// DisplayImage * DisplayImage
//---------------- *----------------
*/
BOOL DisplayImage (HWND hwnd, BYTE **ppDib, BOOL DisplayImage (HWND hwnd, BYTE **ppDib,
BYTE **ppDiData, int cxWinSize, int cyWinSize, BYTE **ppDiData, int cxWinSize, int cyWinSize,
BYTE *pbImage, int cxImgSize, int cyImgSize, int cImgChannels, BYTE *pbImage, int cxImgSize, int cyImgSize, int cImgChannels,
@@ -705,14 +708,14 @@ BOOL DisplayImage (HWND hwnd, BYTE **ppDib,
{ {
BYTE *pDib = *ppDib; BYTE *pDib = *ppDib;
BYTE *pDiData = *ppDiData; BYTE *pDiData = *ppDiData;
// BITMAPFILEHEADER *pbmfh; /* BITMAPFILEHEADER *pbmfh; */
BITMAPINFOHEADER *pbmih; BITMAPINFOHEADER *pbmih;
WORD wDIRowBytes; WORD wDIRowBytes;
png_color bkgBlack = {0, 0, 0}; png_color bkgBlack = {0, 0, 0};
png_color bkgGray = {127, 127, 127}; png_color bkgGray = {127, 127, 127};
png_color bkgWhite = {255, 255, 255}; png_color bkgWhite = {255, 255, 255};
// allocate memory for the Device Independant bitmap /* allocate memory for the Device Independant bitmap */
wDIRowBytes = (WORD) ((3 * cxWinSize + 3L) >> 2) << 2; wDIRowBytes = (WORD) ((3 * cxWinSize + 3L) >> 2) << 2;
@@ -733,7 +736,7 @@ BOOL DisplayImage (HWND hwnd, BYTE **ppDib,
*ppDib = pDib; *ppDib = pDib;
memset (pDib, 0, sizeof(BITMAPINFOHEADER)); memset (pDib, 0, sizeof(BITMAPINFOHEADER));
// initialize the dib-structure /* initialize the dib-structure */
pbmih = (BITMAPINFOHEADER *) pDib; pbmih = (BITMAPINFOHEADER *) pDib;
pbmih->biSize = sizeof(BITMAPINFOHEADER); pbmih->biSize = sizeof(BITMAPINFOHEADER);
@@ -745,11 +748,11 @@ BOOL DisplayImage (HWND hwnd, BYTE **ppDib,
pDiData = pDib + sizeof(BITMAPINFOHEADER); pDiData = pDib + sizeof(BITMAPINFOHEADER);
*ppDiData = pDiData; *ppDiData = pDiData;
// first fill bitmap with gray and image border /* first fill bitmap with gray and image border */
InitBitmap (pDiData, cxWinSize, cyWinSize); InitBitmap (pDiData, cxWinSize, cyWinSize);
// then fill bitmap with image /* then fill bitmap with image */
if (pbImage) if (pbImage)
{ {
@@ -762,16 +765,16 @@ BOOL DisplayImage (HWND hwnd, BYTE **ppDib,
return TRUE; return TRUE;
} }
//-------------- /*--------------
// InitBitmap * InitBitmap
//-------------- *--------------
*/
BOOL InitBitmap (BYTE *pDiData, int cxWinSize, int cyWinSize) BOOL InitBitmap (BYTE *pDiData, int cxWinSize, int cyWinSize)
{ {
BYTE *dst; BYTE *dst;
int x, y, col; int x, y, col;
// initialize the background with gray /* initialize the background with gray */
dst = pDiData; dst = pDiData;
for (y = 0; y < cyWinSize; y++) for (y = 0; y < cyWinSize; y++)
@@ -779,13 +782,13 @@ BOOL InitBitmap (BYTE *pDiData, int cxWinSize, int cyWinSize)
col = 0; col = 0;
for (x = 0; x < cxWinSize; x++) for (x = 0; x < cxWinSize; x++)
{ {
// fill with GRAY /* fill with GRAY */
*dst++ = 127; *dst++ = 127;
*dst++ = 127; *dst++ = 127;
*dst++ = 127; *dst++ = 127;
col += 3; col += 3;
} }
// rows start on 4 byte boundaries /* rows start on 4 byte boundaries */
while ((col % 4) != 0) while ((col % 4) != 0)
{ {
dst++; dst++;
@@ -796,10 +799,10 @@ BOOL InitBitmap (BYTE *pDiData, int cxWinSize, int cyWinSize)
return TRUE; return TRUE;
} }
//-------------- /*--------------
// FillBitmap * FillBitmap
//-------------- *--------------
*/
BOOL FillBitmap ( BOOL FillBitmap (
BYTE *pDiData, int cxWinSize, int cyWinSize, BYTE *pDiData, int cxWinSize, int cyWinSize,
BYTE *pbImage, int cxImgSize, int cyImgSize, int cImgChannels, BYTE *pbImage, int cxImgSize, int cyImgSize, int cImgChannels,
@@ -824,11 +827,12 @@ BOOL FillBitmap (
cxNewSize = cxWinSize - 2 * MARGIN; cxNewSize = cxWinSize - 2 * MARGIN;
cyNewSize = cyWinSize - 2 * MARGIN; cyNewSize = cyWinSize - 2 * MARGIN;
// stretch the image to it's window determined size /* stretch the image to it's window determined size */
// the following two are the same, but the first has side-effects /* the following two are mathematically the same, but the first
// because of rounding * has side-effects because of rounding
// if ((cyNewSize / cxNewSize) > (cyImgSize / cxImgSize)) */
/* if ((cyNewSize / cxNewSize) > (cyImgSize / cxImgSize)) */
if ((cyNewSize * cxImgSize) > (cyImgSize * cxNewSize)) if ((cyNewSize * cxImgSize) > (cyImgSize * cxNewSize))
{ {
cyNewSize = cxNewSize * cyImgSize / cxImgSize; cyNewSize = cxNewSize * cyImgSize / cxImgSize;
@@ -867,12 +871,12 @@ BOOL FillBitmap (
} }
} }
// calculate row-bytes /* calculate row-bytes */
wImgRowBytes = cImgChannels * cxNewSize; wImgRowBytes = cImgChannels * cxNewSize;
wDIRowBytes = (WORD) ((cDIChannels * cxWinSize + 3L) >> 2) << 2; wDIRowBytes = (WORD) ((cDIChannels * cxWinSize + 3L) >> 2) << 2;
// copy image to screen /* copy image to screen */
for (yImg = 0, yWin = cyImgPos; yImg < cyNewSize; yImg++, yWin++) for (yImg = 0, yWin = cyImgPos; yImg < cyNewSize; yImg++, yWin++)
{ {
@@ -888,7 +892,7 @@ BOOL FillBitmap (
r = *src++; r = *src++;
g = *src++; g = *src++;
b = *src++; b = *src++;
*dst++ = b; /* note the reverse order */ *dst++ = b; /* note the reverse order */
*dst++ = g; *dst++ = g;
*dst++ = r; *dst++ = r;
if (cImgChannels == 4) if (cImgChannels == 4)
@@ -898,7 +902,7 @@ BOOL FillBitmap (
} }
} }
// free memory /* free memory */
if (pStretchedImage != NULL) if (pStretchedImage != NULL)
{ {
@@ -908,28 +912,28 @@ BOOL FillBitmap (
} }
// process the image not-stretched /* process the image not-stretched */
else else
{ {
// calculate the central position /* calculate the central position */
cxImgPos = (cxWinSize - cxImgSize) / 2; cxImgPos = (cxWinSize - cxImgSize) / 2;
cyImgPos = (cyWinSize - cyImgSize) / 2; cyImgPos = (cyWinSize - cyImgSize) / 2;
// check for image larger than window /* check for image larger than window */
if (cxImgPos < MARGIN) if (cxImgPos < MARGIN)
cxImgPos = MARGIN; cxImgPos = MARGIN;
if (cyImgPos < MARGIN) if (cyImgPos < MARGIN)
cyImgPos = MARGIN; cyImgPos = MARGIN;
// calculate both row-bytes /* calculate both row-bytes */
wImgRowBytes = cImgChannels * cxImgSize; wImgRowBytes = cImgChannels * cxImgSize;
wDIRowBytes = (WORD) ((cDIChannels * cxWinSize + 3L) >> 2) << 2; wDIRowBytes = (WORD) ((cDIChannels * cxWinSize + 3L) >> 2) << 2;
// copy image to screen /* copy image to screen */
for (yImg = 0, yWin = cyImgPos; yImg < cyImgSize; yImg++, yWin++) for (yImg = 0, yWin = cyImgPos; yImg < cyImgSize; yImg++, yWin++)
{ {
@@ -945,7 +949,7 @@ BOOL FillBitmap (
r = *src++; r = *src++;
g = *src++; g = *src++;
b = *src++; b = *src++;
*dst++ = b; /* note the reverse order */ *dst++ = b; /* note the reverse order */
*dst++ = g; *dst++ = g;
*dst++ = r; *dst++ = r;
if (cImgChannels == 4) if (cImgChannels == 4)
@@ -959,6 +963,7 @@ BOOL FillBitmap (
return TRUE; return TRUE;
} }
//----------------- /*-----------------
// end of source * end of source
//----------------- *-----------------
*/

View File

@@ -2,15 +2,15 @@
#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.4.0 [January 2, 2010] * Last changed in libpng 1.5.4 [July 7, 2011]
* 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-2010 Glenn Randers-Pehrson * Maintained 1998-2011 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.)
*/ */
/* This is an example of how to use libpng to read and write PNG files. /* This is an example of how to use libpng to read and write PNG files.
* The file libpng.txt is much more verbose then this. If you have not * The file libpng-manual.txt is much more verbose then this. If you have not
* read it, do so first. This was designed to be a starting point of an * read it, do so first. This was designed to be a starting point of an
* implementation. This is not officially part of libpng, is hereby placed * implementation. This is not officially part of libpng, is hereby placed
* in the public domain, and therefore does not require a copyright notice. * in the public domain, and therefore does not require a copyright notice.
@@ -22,6 +22,10 @@
* see also the programs in the contrib directory. * see also the programs in the contrib directory.
*/ */
#define _POSIX_SOURCE 1 /* libpng and zlib are POSIX-compliant. You may
* change this if your application uses non-POSIX
* extensions. */
#include "png.h" #include "png.h"
/* The png_jmpbuf() macro, used in error handling, became available in /* The png_jmpbuf() macro, used in error handling, became available in
@@ -31,7 +35,7 @@
*/ */
#ifndef png_jmpbuf #ifndef png_jmpbuf
# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf) # define png_jmpbuf(png_ptr) ((png_ptr)->png_jmpbuf)
#endif #endif
/* Check to see if a file is a PNG file using png_sig_cmp(). png_sig_cmp() /* Check to see if a file is a PNG file using png_sig_cmp(). png_sig_cmp()
@@ -160,7 +164,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
* If you have enough memory to read in the entire image at once, * If you have enough memory to read in the entire image at once,
* and you need to specify only transforms that can be controlled * and you need to specify only transforms that can be controlled
* with one of the PNG_TRANSFORM_* bits (this presently excludes * with one of the PNG_TRANSFORM_* bits (this presently excludes
* dithering, filling, setting background, and doing gamma * quantizing, filling, setting background, and doing gamma
* adjustment), then you can read the entire image (including * adjustment), then you can read the entire image (including
* pixels) into the info structure with this call: * pixels) into the info structure with this call:
*/ */
@@ -183,8 +187,15 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
* are mutually exclusive. * are mutually exclusive.
*/ */
/* Tell libpng to strip 16 bit/color files down to 8 bits/color */ /* Tell libpng to strip 16 bit/color files down to 8 bits/color.
* Use accurate scaling if it's available, otherwise just chop off the
* low byte.
*/
#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
png_set_scale_16(png_ptr);
#else
png_set_strip_16(png_ptr); png_set_strip_16(png_ptr);
#endif
/* Strip alpha bytes from the input data without combining with the /* Strip alpha bytes from the input data without combining with the
* background (not recommended). * background (not recommended).
@@ -271,7 +282,8 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
png_set_gamma(png_ptr, screen_gamma, 0.45455); png_set_gamma(png_ptr, screen_gamma, 0.45455);
} }
/* Dither RGB files down to 8 bit palette or reduce palettes #ifdef PNG_READ_QUANTIZE_SUPPORTED
/* Quantize RGB files down to 8 bit palette or reduce palettes
* to the number of colors available on your screen. * to the number of colors available on your screen.
*/ */
if (color_type & PNG_COLOR_MASK_COLOR) if (color_type & PNG_COLOR_MASK_COLOR)
@@ -282,10 +294,10 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
/* This reduces the image to the application supplied palette */ /* This reduces the image to the application supplied palette */
if (/* We have our own palette */) if (/* We have our own palette */)
{ {
/* An array of colors to which the image should be dithered */ /* An array of colors to which the image should be quantized */
png_color std_color_cube[MAX_SCREEN_COLORS]; png_color std_color_cube[MAX_SCREEN_COLORS];
png_set_dither(png_ptr, std_color_cube, MAX_SCREEN_COLORS, png_set_quantize(png_ptr, std_color_cube, MAX_SCREEN_COLORS,
MAX_SCREEN_COLORS, 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 */
@@ -295,10 +307,11 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
png_get_hIST(png_ptr, info_ptr, &histogram); png_get_hIST(png_ptr, info_ptr, &histogram);
png_set_dither(png_ptr, palette, num_palette, png_set_quantize(png_ptr, palette, num_palette,
max_screen_colors, histogram, 0); max_screen_colors, histogram, 0);
} }
} }
#endif /* PNG_READ_QUANTIZE_SUPPORTED */
/* Invert monochrome files to have 0 as white and 1 as black */ /* Invert monochrome files to have 0 as white and 1 as black */
png_set_invert_mono(png_ptr); png_set_invert_mono(png_ptr);
@@ -509,20 +522,17 @@ row_callback(png_structp png_ptr, png_bytep new_row,
* shown below: * shown below:
*/ */
/* Check if row_num is in bounds. */ /* Get pointer to corresponding row in our
if ((row_num >= 0) && (row_num < height)) * PNG read buffer.
{ */
/* Get pointer to corresponding row in our png_bytep old_row = ((png_bytep *)our_data)[row_num];
* PNG read buffer.
*/ /* If both rows are allocated then copy the new row
png_bytep old_row = ((png_bytep *)our_data)[row_num]; * data to the corresponding row data.
*/
if ((old_row != NULL) && (new_row != NULL))
png_progressive_combine_row(png_ptr, old_row, new_row);
/* If both rows are allocated then copy the new row
* data to the corresponding row data.
*/
if ((old_row != NULL) && (new_row != NULL))
png_progressive_combine_row(png_ptr, old_row, new_row);
}
/* /*
* The rows and passes are called in order, so you don't really * The rows and passes are called in order, so you don't really
* need the row_num and pass, but I'm supplying them because it * need the row_num and pass, but I'm supplying them because it
@@ -656,14 +666,18 @@ void write_png(char *file_name /* , ... other image information ... */)
/* Optional significant bit (sBIT) chunk */ /* Optional significant bit (sBIT) chunk */
png_color_8 sig_bit; png_color_8 sig_bit;
/* If we are dealing with a grayscale image then */ /* If we are dealing with a grayscale image then */
sig_bit.gray = true_bit_depth; sig_bit.gray = true_bit_depth;
/* Otherwise, if we are dealing with a color image then */ /* Otherwise, if we are dealing with a color image then */
sig_bit.red = true_red_bit_depth; sig_bit.red = true_red_bit_depth;
sig_bit.green = true_green_bit_depth; sig_bit.green = true_green_bit_depth;
sig_bit.blue = true_blue_bit_depth; sig_bit.blue = true_blue_bit_depth;
/* If the image has an alpha channel then */ /* If the image has an alpha channel then */
sig_bit.alpha = true_alpha_bit_depth; sig_bit.alpha = true_alpha_bit_depth;
png_set_sBIT(png_ptr, info_ptr, &sig_bit); png_set_sBIT(png_ptr, info_ptr, &sig_bit);
@@ -676,17 +690,21 @@ void write_png(char *file_name /* , ... other image information ... */)
text_ptr[0].key = "Title"; text_ptr[0].key = "Title";
text_ptr[0].text = "Mona Lisa"; text_ptr[0].text = "Mona Lisa";
text_ptr[0].compression = PNG_TEXT_COMPRESSION_NONE; text_ptr[0].compression = PNG_TEXT_COMPRESSION_NONE;
text_ptr[0].itxt_length = 0;
text_ptr[0].lang = NULL;
text_ptr[0].lang_key = NULL;
text_ptr[1].key = "Author"; text_ptr[1].key = "Author";
text_ptr[1].text = "Leonardo DaVinci"; text_ptr[1].text = "Leonardo DaVinci";
text_ptr[1].compression = PNG_TEXT_COMPRESSION_NONE; text_ptr[1].compression = PNG_TEXT_COMPRESSION_NONE;
text_ptr[1].itxt_length = 0;
text_ptr[1].lang = NULL;
text_ptr[1].lang_key = NULL;
text_ptr[2].key = "Description"; text_ptr[2].key = "Description";
text_ptr[2].text = "<long text>"; text_ptr[2].text = "<long text>";
text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt; text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt;
#ifdef PNG_iTXt_SUPPORTED text_ptr[2].itxt_length = 0;
text_ptr[0].lang = NULL;
text_ptr[1].lang = NULL;
text_ptr[2].lang = NULL; text_ptr[2].lang = NULL;
#endif text_ptr[2].lang_key = NULL;
png_set_text(png_ptr, info_ptr, text_ptr, 3); png_set_text(png_ptr, info_ptr, text_ptr, 3);
/* Other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs */ /* Other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs */
@@ -751,6 +769,7 @@ void write_png(char *file_name /* , ... other image information ... */)
/* Turn on interlace handling if you are not using png_write_image() */ /* Turn on interlace handling if you are not using png_write_image() */
if (interlacing) if (interlacing)
number_passes = png_set_interlace_handling(png_ptr); number_passes = png_set_interlace_handling(png_ptr);
else else
number_passes = 1; number_passes = 1;

View File

@@ -3,7 +3,7 @@
# libpng-config # libpng-config
# provides configuration info for libpng. # provides configuration info for libpng.
# Copyright (C) 2002, 2004, 2006, 2007, 2010 Glenn Randers-Pehrson # Copyright (C) 2002, 2004, 2006, 2007 Glenn Randers-Pehrson
# This code is released under the libpng license. # This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer # For conditions of distribution and use, see the disclaimer
@@ -104,8 +104,8 @@ while test $# -gt 0; do
;; ;;
--ldopts) --ldopts)
echo ${ldopts} echo ${ldopts}
;; ;;
--ldflags) --ldflags)
echo ${ldopts} ${L_opts} ${R_opts} ${libs} echo ${ldopts} ${L_opts} ${R_opts} ${libs}
@@ -113,7 +113,7 @@ while test $# -gt 0; do
--static) --static)
R_opts="" R_opts=""
libs=${all_libs} libs=${all_libs}
;; ;;
*) *)

File diff suppressed because it is too large Load Diff

2596
libpng.3

File diff suppressed because it is too large Load Diff

View File

@@ -1,816 +1,28 @@
.TH LIBPNGPF 3 "January 2, 2010" .TH LIBPNGPF 3 "September 3, 2011"
.SH NAME .SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.5.0alpha01 libpng \- Portable Network Graphics (PNG) Reference Library 1.6.0alpha01
(private functions) (private functions)
.SH SYNOPSIS .SH SYNOPSIS
\fB#include <png.h>\fP
\fB#include \fI"pngpriv.h" \fB#include \fI"pngpriv.h"
\fI\fB \fI\fB
\fBvoid png_64bit_product (long \fP\fIv1\fP\fB, long \fP\fIv2\fP\fB, unsigned long \fI*hi_product, \fBAs of libpng version \fP\fI1.5.1\fP\fB, this section is no longer \fP\fImaintained\fP\fB, now \fIthat
\fBunsigned long \fI*lo_product\fP\fB);\fP \fBthe private function prototypes are hidden in pngpriv.h and not \fIaccessible
\fI\fB \fBto applications. Look in pngpriv.h for the prototypes and a short \fIdescription
\fI\fB \fBof each \fIfunction.
\fBvoid png_build_gamma_table (png_structp \fP\fIpng_ptr\fP\fB, png_byte \fIbit_depth\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_build_grayscale_palette (int \fP\fIbit_depth\fP\fB, png_colorp \fIpalette\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_calculate_crc (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIptr\fP\fB, png_size_t \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBint png_check_cHRM_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_fixed_point \fP\fIint_white_x\fP\fB, png_fixed_point \fP\fIint_white_y\fP\fB, png_fixed_point \fP\fIint_red_x\fP\fB, png_fixed_point \fP\fIint_red_y\fP\fB, png_fixed_point \fP\fIint_green_x\fP\fB, png_fixed_point \fP\fIint_green_y\fP\fB, png_fixed_point \fP\fIint_blue_x\fP\fB, png_fixed_point \fIint_blue_y\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_check_chunk_name (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIchunk_name\fP\fB);\fP
\fI\fB
\fI\fB
\fBpng_size_t png_check_keyword (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIkey\fP\fB, png_charpp \fInew_key\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_check_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIwidth\fP\fB, png_uint_32 \fP\fIheight\fP\fB, int \fP\fIbit_depth\fP\fB, int \fP\fIcolor_type\fP\fB, int \fP\fIinterlace_type\fP\fB, int \fP\fIcompression_type\fP\fB, int \fIfilter_type\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_combine_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIrow\fP\fB, int \fImask\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_correct_palette (png_structp \fP\fIpng_ptr\fP\fB, png_colorp \fP\fIpalette\fP\fB, int \fInum_palette\fP\fB);\fP
\fI\fB
\fI\fB
\fBint png_crc_error (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBint png_crc_finish (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIskip\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_crc_read (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuf\fP\fB, png_size_t \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBpng_voidp png_create_struct (int \fItype\fP\fB);\fP
\fI\fB
\fI\fB
\fBpng_voidp png_create_struct_2 (int \fP\fItype\fP\fB, png_malloc_ptr \fP\fImalloc_fn\fP\fB, png_voidp \fImem_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBint png_debug(int \fP\fIlevel\fP\fB, png_const_charp \fImessage\fP\fB);\fP
\fI\fB
\fBint png_debug1(int \fP\fIlevel\fP\fB, png_const_charp \fP\fImessage\fP\fB, \fIp1\fP\fB);\fP
\fI\fB
\fBint png_debug2(int \fP\fIlevel\fP\fB, png_const_charp \fP\fImessage\fP\fB, \fP\fIp1\fP\fB, \fIp2\fP\fB);\fP
\fI\fB
\fBvoid png_decompress_chunk (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIcomp_type\fP\fB, png_size_t \fP\fIchunklength\fP\fB, png_size_t \fP\fIprefix_length\fP\fB, png_size_t \fI*data_length\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_destroy_struct (png_voidp \fIstruct_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_destroy_struct_2 (png_voidp \fP\fIstruct_ptr\fP\fB, png_free_ptr \fP\fIfree_fn\fP\fB, png_voidp \fImem_ptr\fP\fB);\fP
\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_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
\fBvoid png_do_bgr (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_chop (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_dither (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIpalette_lookup\fP\fB, png_bytep \fIdither_lookup\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_expand (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_16p \fItrans_value\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_expand_palette (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_colorp \fP\fIpalette\fP\fB, png_bytep \fP\fItrans\fP\fB, int \fInum_trans\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_gamma (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIgamma_table\fP\fB, png_uint_16pp \fP\fIgamma_16_table\fP\fB, int \fIgamma_shift\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_gray_to_rgb (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_invert (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_pack (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fIbit_depth\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_packswap (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_read_filler (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fP\fIfiller\fP\fB, png_uint_32 \fIflags\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_read_interlace (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, int \fP\fIpass\fP\fB, png_uint_32 \fItransformations\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_read_invert_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
\fBvoid png_do_read_premultiply_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
\fBvoid png_do_read_swap_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_read_transformations (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBint png_do_rgb_to_gray (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_shift (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_8p \fIbit_depth\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_strip_filler (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fIflags\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_swap (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_unpack (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_unshift (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_8p \fIsig_bits\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_write_interlace (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, int \fIpass\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_write_invert_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_write_swap_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_write_transformations (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid *png_far_to_near (png_structp png_ptr,png_voidp \fP\fIptr\fP\fB, int \fIcheck\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_flush (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_bKGD (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_cHRM (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_gAMA (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_hIST (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_IEND (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_iCCP (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_iTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_oFFs (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_pCAL (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_pHYs (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_PLTE (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_sBIT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_sCAL (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_sPLT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_sRGB (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_tIME (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_tRNS (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_unknown (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_info_destroy (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_init_mmx_flags (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_init_read_transformations (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_process_IDAT_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIbuffer_length\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_process_some_data (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_check_crc (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_crc_finish (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_crc_skip (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_fill_buffer (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_handle_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_handle_unknown (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_handle_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_have_end (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_have_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_have_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_process_row (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_read_chunk (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_read_end (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_read_IDAT (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_read_sig (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_read_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_read_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_restore_buffer (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIbuffer_length\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_save_buffer (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_read_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP
\fI\fB
\fBvoid png_read_destroy (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_infop \fIend_info_ptr\fP\fB);\fP
\fI\fB
\fBvoid png_read_filter_row (png_structp \fP\fIpng_ptr\fP\fB, png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIprev_row\fP\fB, int \fIfilter\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_read_finish_row (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_read_push_finish_row (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_read_start_row (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_read_transform_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_reset_crc (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBint png_set_text_2 (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_textp \fP\fItext_ptr\fP\fB, int \fInum_text\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_cHRM (png_structp \fP\fIpng_ptr\fP\fB, double \fP\fIwhite_x\fP\fB, double \fP\fIwhite_y\fP\fB, double \fP\fIred_x\fP\fB, double \fP\fIred_y\fP\fB, double \fP\fIgreen_x\fP\fB, double \fP\fIgreen_y\fP\fB, double \fP\fIblue_x\fP\fB, double \fIblue_y\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_cHRM_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIwhite_x\fP\fB, png_uint_32 \fP\fIwhite_y\fP\fB, png_uint_32 \fP\fIred_x\fP\fB, png_uint_32 \fP\fIred_y\fP\fB, png_uint_32 \fP\fIgreen_x\fP\fB, png_uint_32 \fP\fIgreen_y\fP\fB, png_uint_32 \fP\fIblue_x\fP\fB, png_uint_32 \fIblue_y\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP
\fI\fB
\fBvoid png_write_destroy (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fBvoid png_write_filtered_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIfiltered_row\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_find_filter (png_structp \fP\fIpng_ptr\fP\fB, png_row_infop \fIrow_info\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_finish_row (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_gAMA (png_structp \fP\fIpng_ptr\fP\fB, double \fIfile_gamma\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_gAMA_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIint_file_gamma\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_hIST (png_structp \fP\fIpng_ptr\fP\fB, png_uint_16p \fP\fIhist\fP\fB, int \fInum_hist\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_iCCP (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIname\fP\fB, int \fP\fIcompression_type\fP\fB, png_charp \fP\fIprofile\fP\fB, int \fIproflen\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_IDAT (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_IEND (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIwidth\fP\fB, png_uint_32 \fP\fIheight\fP\fB, int \fP\fIbit_depth\fP\fB, int \fP\fIcolor_type\fP\fB, int \fP\fIcompression_type\fP\fB, int \fP\fIfilter_type\fP\fB, int \fIinterlace_type\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_iTXt (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIcompression\fP\fB, png_charp \fP\fIkey\fP\fB, png_charp \fP\fIlang\fP\fB, png_charp \fP\fItranslated_key\fP\fB, png_charp \fItext\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_oFFs (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIx_offset\fP\fB, png_uint_32 \fP\fIy_offset\fP\fB, int \fIunit_type\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_pCAL (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIpurpose\fP\fB, png_int_32 \fP\fIX0\fP\fB, png_int_32 \fP\fIX1\fP\fB, int \fP\fItype\fP\fB, int \fP\fInparams\fP\fB, png_charp \fP\fIunits\fP\fB, png_charpp \fIparams\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_pHYs (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIx_pixels_per_unit\fP\fB, png_uint_32 \fP\fIy_pixels_per_unit\fP\fB, int \fIunit_type\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_PLTE (png_structp \fP\fIpng_ptr\fP\fB, png_colorp \fP\fIpalette\fP\fB, png_uint_32 \fInum_pal\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_sBIT (png_structp \fP\fIpng_ptr\fP\fB, png_color_8p \fP\fIsbit\fP\fB, int \fIcolor_type\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_sCAL (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIunit\fP\fB, double \fP\fIwidth\fP\fB, double \fIheight\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_sCAL_s (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIunit\fP\fB, png_charp \fP\fIwidth\fP\fB, png_charp \fIheight\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_sRGB (png_structp \fP\fIpng_ptr\fP\fB, int \fIintent\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_sPLT (png_structp \fP\fIpng_ptr\fP\fB, png_spalette_p \fIpalette\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_start_row (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIkey\fP\fB, png_charp \fP\fItext\fP\fB, png_size_t \fItext_len\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_tIME (png_structp \fP\fIpng_ptr\fP\fB, png_timep \fImod_time\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_tRNS (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fItrans\fP\fB, png_color_16p \fP\fIvalues\fP\fB, int \fP\fInumber\fP\fB, int \fIcolor_type\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIkey\fP\fB, png_charp \fP\fItext\fP\fB, png_size_t \fP\fItext_len\fP\fB, int \fIcompression\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoidpf png_zalloc (voidpf \fP\fIpng_ptr\fP\fB, uInt \fP\fIitems\fP\fB, uInt \fIsize\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_zfree (voidpf \fP\fIpng_ptr\fP\fB, voidpf \fIptr\fP\fB);\fP
\fI\fB
\fI\fB \fI\fB
.SH DESCRIPTION .SH DESCRIPTION
The functions listed above are used privately by libpng The functions previously listed here are used privately by libpng
and are not recommended for use by applications. They are and are not recommended for use by applications. They are
not "exported" to applications using shared libraries. They not "exported" to applications using shared libraries.
are listed alphabetically here as an aid to libpng maintainers.
See png.h for more information on these functions.
.SH SEE ALSO .SH SEE ALSO
libpng(3), png(5) .BR "png"(5), " libpng"(3), " zlib"(3), " deflate"(5), " " and " zlib"(5)
.SH AUTHOR .SH AUTHOR
Glenn Randers-Pehrson Glenn Randers-Pehrson

3986
ltmain.sh

File diff suppressed because it is too large Load Diff

View File

@@ -1,162 +0,0 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
scriptversion=2009-04-28.21; # UTC
# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain.
#
# 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
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
do
if test -d "$file"; then
shift
else
break
fi
done
case $# in
0) exit 0 ;;
esac
# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and
# 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
for file
do
case $file in
/*) pathcomp=/ ;;
*) pathcomp= ;;
esac
oIFS=$IFS
IFS=/
set fnord $file
shift
IFS=$oIFS
for d
do
test "x$d" = x && continue
pathcomp=$pathcomp$d
case $pathcomp in
-*) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
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
exit $errstatus
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

4
png.5
View File

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

2173
png.c

File diff suppressed because it is too large Load Diff

2488
png.h

File diff suppressed because it is too large Load Diff

1683
pngconf.h

File diff suppressed because it is too large Load Diff

157
pngdebug.h Normal file
View File

@@ -0,0 +1,157 @@
/* pngdebug.h - Debugging macros for libpng, also used in pngtest.c
*
* Copyright (c) 1998-2011 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.)
*
* Last changed in libpng 1.5.0 [January 6, 2011]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/
/* Define PNG_DEBUG at compile time for debugging information. Higher
* numbers for PNG_DEBUG mean more debugging information. This has
* only been added since version 0.95 so it is not implemented throughout
* libpng yet, but more support will be added as needed.
*
* png_debug[1-2]?(level, message ,arg{0-2})
* Expands to a statement (either a simple expression or a compound
* do..while(0) statement) that outputs a message with parameter
* substitution if PNG_DEBUG is defined to 2 or more. If PNG_DEBUG
* is undefined, 0 or 1 every png_debug expands to a simple expression
* (actually ((void)0)).
*
* level: level of detail of message, starting at 0. A level 'n'
* message is preceded by 'n' tab characters (not implemented
* on Microsoft compilers unless PNG_DEBUG_FILE is also
* defined, to allow debug DLL compilation with no standard IO).
* message: a printf(3) style text string. A trailing '\n' is added
* to the message.
* arg: 0 to 2 arguments for printf(3) style substitution in message.
*/
#ifndef PNGDEBUG_H
#define PNGDEBUG_H
/* These settings control the formatting of messages in png.c and pngerror.c */
/* Moved to pngdebug.h at 1.5.0 */
# 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
#ifdef PNG_DEBUG
# if (PNG_DEBUG > 0)
# if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER)
# include <crtdbg.h>
# if (PNG_DEBUG > 1)
# ifndef _DEBUG
# define _DEBUG
# endif
# ifndef png_debug
# define png_debug(l,m) _RPT0(_CRT_WARN,m PNG_STRING_NEWLINE)
# endif
# ifndef png_debug1
# define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m PNG_STRING_NEWLINE,p1)
# endif
# ifndef png_debug2
# define png_debug2(l,m,p1,p2) \
_RPT2(_CRT_WARN,m PNG_STRING_NEWLINE,p1,p2)
# endif
# endif
# else /* PNG_DEBUG_FILE || !_MSC_VER */
# ifndef PNG_STDIO_SUPPORTED
# include <stdio.h> /* not included yet */
# endif
# ifndef PNG_DEBUG_FILE
# define PNG_DEBUG_FILE stderr
# endif /* PNG_DEBUG_FILE */
# if (PNG_DEBUG > 1)
/* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on
* non-ISO compilers
*/
# ifdef __STDC__
# ifndef png_debug
# define png_debug(l,m) \
do { \
int num_tabs=l; \
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
} while (0)
# endif
# ifndef png_debug1
# define png_debug1(l,m,p1) \
do { \
int num_tabs=l; \
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
} while (0)
# endif
# ifndef png_debug2
# define png_debug2(l,m,p1,p2) \
do { \
int num_tabs=l; \
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
} while (0)
# endif
# else /* __STDC __ */
# ifndef png_debug
# define png_debug(l,m) \
do { \
int num_tabs=l; \
char format[256]; \
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
m,PNG_STRING_NEWLINE); \
fprintf(PNG_DEBUG_FILE,format); \
} while (0)
# endif
# ifndef png_debug1
# define png_debug1(l,m,p1) \
do { \
int num_tabs=l; \
char format[256]; \
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
m,PNG_STRING_NEWLINE); \
fprintf(PNG_DEBUG_FILE,format,p1); \
} while (0)
# endif
# ifndef png_debug2
# define png_debug2(l,m,p1,p2) \
do { \
int num_tabs=l; \
char format[256]; \
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
m,PNG_STRING_NEWLINE); \
fprintf(PNG_DEBUG_FILE,format,p1,p2); \
} while (0)
# endif
# endif /* __STDC __ */
# endif /* (PNG_DEBUG > 1) */
# endif /* _MSC_VER */
# endif /* (PNG_DEBUG > 0) */
#endif /* PNG_DEBUG */
#ifndef png_debug
# define png_debug(l, m) ((void)0)
#endif
#ifndef png_debug1
# define png_debug1(l, m, p1) ((void)0)
#endif
#ifndef png_debug2
# define png_debug2(l, m, p1, p2) ((void)0)
#endif
#endif /* PNGDEBUG_H */

View File

@@ -1,8 +1,8 @@
/* 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.4.0 [January 2, 2010] * Last changed in libpng 1.5.4 [July 7, 2011]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson * Copyright (c) 1998-2011 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.)
* *
@@ -16,18 +16,17 @@
* at each function. * at each function.
*/ */
#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#include "pngpriv.h" #include "pngpriv.h"
static void /* PRIVATE */ #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
png_default_error PNGARG((png_structp png_ptr,
png_const_charp error_message)) PNG_NORETURN; static PNG_FUNCTION(void, png_default_error,PNGARG((png_structp png_ptr,
png_const_charp error_message)),PNG_NORETURN);
#ifdef PNG_WARNINGS_SUPPORTED #ifdef PNG_WARNINGS_SUPPORTED
static void /* PRIVATE */ static void /* PRIVATE */
png_default_warning PNGARG((png_structp png_ptr, png_default_warning PNGARG((png_structp png_ptr,
png_const_charp warning_message)); png_const_charp warning_message));
#endif /* PNG_WARNINGS_SUPPORTED */ #endif /* PNG_WARNINGS_SUPPORTED */
/* This function is called whenever there is a fatal error. This function /* This function is called whenever there is a fatal error. This function
@@ -36,42 +35,45 @@ png_default_warning PNGARG((png_structp png_ptr,
* to replace the error function at run-time. * to replace the error function at run-time.
*/ */
#ifdef PNG_ERROR_TEXT_SUPPORTED #ifdef PNG_ERROR_TEXT_SUPPORTED
void PNGAPI PNG_FUNCTION(void,PNGAPI
png_error(png_structp png_ptr, png_const_charp error_message) png_error,(png_structp png_ptr, png_const_charp error_message),PNG_NORETURN)
{ {
#ifdef PNG_ERROR_NUMBERS_SUPPORTED #ifdef PNG_ERROR_NUMBERS_SUPPORTED
char msg[16]; char msg[16];
if (png_ptr != NULL) if (png_ptr != NULL)
{ {
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 == PNG_LITERAL_SHARP) if (*error_message == PNG_LITERAL_SHARP)
{ {
/* Strip "#nnnn " from beginning of error message. */ /* Strip "#nnnn " from beginning of error message. */
int offset; int offset;
for (offset = 1; offset<15; offset++) for (offset = 1; offset<15; offset++)
if (error_message[offset] == ' ') if (error_message[offset] == ' ')
break; break;
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
{ if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
int i; {
for (i = 0; i < offset - 1; i++) int i;
msg[i] = error_message[i + 1]; for (i = 0; i < offset - 1; i++)
msg[i - 1] = '\0'; msg[i] = error_message[i + 1];
error_message = msg; msg[i - 1] = '\0';
} error_message = msg;
else }
error_message += offset;
} else
else error_message += offset;
{ }
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
{ else
msg[0] = '0'; {
msg[1] = '\0'; if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
error_message = msg; {
} msg[0] = '0';
msg[1] = '\0';
error_message = msg;
}
} }
} }
} }
@@ -84,18 +86,124 @@ png_error(png_structp png_ptr, png_const_charp error_message)
png_default_error(png_ptr, error_message); png_default_error(png_ptr, error_message);
} }
#else #else
void PNGAPI PNG_FUNCTION(void,PNGAPI
png_err(png_structp png_ptr) png_err,(png_structp png_ptr),PNG_NORETURN)
{ {
/* Prior to 1.5.2 the error_fn received a NULL pointer, expressed
* erroneously as '\0', instead of the empty string "". This was
* apparently an error, introduced in libpng-1.2.20, and png_default_error
* will crash in this case.
*/
if (png_ptr != NULL && png_ptr->error_fn != NULL) if (png_ptr != NULL && png_ptr->error_fn != NULL)
(*(png_ptr->error_fn))(png_ptr, '\0'); (*(png_ptr->error_fn))(png_ptr, "");
/* If the custom handler doesn't exist, or if it returns, /* If the custom handler doesn't exist, or if it returns,
use the default handler, which will not return. */ use the default handler, which will not return. */
png_default_error(png_ptr, '\0'); png_default_error(png_ptr, "");
} }
#endif /* PNG_ERROR_TEXT_SUPPORTED */ #endif /* PNG_ERROR_TEXT_SUPPORTED */
/* Utility to safely appends strings to a buffer. This never errors out so
* error checking is not required in the caller.
*/
size_t
png_safecat(png_charp buffer, size_t bufsize, size_t pos,
png_const_charp string)
{
if (buffer != NULL && pos < bufsize)
{
if (string != NULL)
while (*string != '\0' && pos < bufsize-1)
buffer[pos++] = *string++;
buffer[pos] = '\0';
}
return pos;
}
#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_TIME_RFC1123_SUPPORTED)
/* Utility to dump an unsigned value into a buffer, given a start pointer and
* and end pointer (which should point just *beyond* the end of the buffer!)
* Returns the pointer to the start of the formatted string.
*/
png_charp
png_format_number(png_const_charp start, png_charp end, int format,
png_alloc_size_t number)
{
int count = 0; /* number of digits output */
int mincount = 1; /* minimum number required */
int output = 0; /* digit output (for the fixed point format) */
*--end = '\0';
/* This is written so that the loop always runs at least once, even with
* number zero.
*/
while (end > start && (number != 0 || count < mincount))
{
static const char digits[] = "0123456789ABCDEF";
switch (format)
{
case PNG_NUMBER_FORMAT_fixed:
/* Needs five digits (the fraction) */
mincount = 5;
if (output || number % 10 != 0)
{
*--end = digits[number % 10];
output = 1;
}
number /= 10;
break;
case PNG_NUMBER_FORMAT_02u:
/* Expects at least 2 digits. */
mincount = 2;
/* fall through */
case PNG_NUMBER_FORMAT_u:
*--end = digits[number % 10];
number /= 10;
break;
case PNG_NUMBER_FORMAT_02x:
/* This format expects at least two digits */
mincount = 2;
/* fall through */
case PNG_NUMBER_FORMAT_x:
*--end = digits[number & 0xf];
number >>= 4;
break;
default: /* an error */
number = 0;
break;
}
/* Keep track of the number of digits added */
++count;
/* Float a fixed number here: */
if (format == PNG_NUMBER_FORMAT_fixed) if (count == 5) if (end > start)
{
/* End of the fraction, but maybe nothing was output? In that case
* drop the decimal point. If the number is a true zero handle that
* here.
*/
if (output)
*--end = '.';
else if (number == 0) /* and !output */
*--end = '0';
}
}
return end;
}
#endif
#ifdef PNG_WARNINGS_SUPPORTED #ifdef PNG_WARNINGS_SUPPORTED
/* This function is called whenever there is a non-fatal error. This function /* This function is called whenever there is a non-fatal error. This function
* should not be changed. If there is a need to handle warnings differently, * should not be changed. If there is a need to handle warnings differently,
@@ -110,22 +218,131 @@ png_warning(png_structp png_ptr, png_const_charp warning_message)
{ {
#ifdef PNG_ERROR_NUMBERS_SUPPORTED #ifdef PNG_ERROR_NUMBERS_SUPPORTED
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))
#endif #endif
{ {
if (*warning_message == PNG_LITERAL_SHARP) 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) if (png_ptr != NULL && png_ptr->warning_fn != NULL)
(*(png_ptr->warning_fn))(png_ptr, warning_message + offset); (*(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);
} }
/* These functions support 'formatted' warning messages with up to
* PNG_WARNING_PARAMETER_COUNT parameters. In the format string the parameter
* is introduced by @<number>, where 'number' starts at 1. This follows the
* standard established by X/Open for internationalizable error messages.
*/
void
png_warning_parameter(png_warning_parameters p, int number,
png_const_charp string)
{
if (number > 0 && number <= PNG_WARNING_PARAMETER_COUNT)
(void)png_safecat(p[number-1], (sizeof p[number-1]), 0, string);
}
void
png_warning_parameter_unsigned(png_warning_parameters p, int number, int format,
png_alloc_size_t value)
{
char buffer[PNG_NUMBER_BUFFER_SIZE];
png_warning_parameter(p, number, PNG_FORMAT_NUMBER(buffer, format, value));
}
void
png_warning_parameter_signed(png_warning_parameters p, int number, int format,
png_int_32 value)
{
png_alloc_size_t u;
png_charp str;
char buffer[PNG_NUMBER_BUFFER_SIZE];
/* Avoid overflow by doing the negate in a png_alloc_size_t: */
u = (png_alloc_size_t)value;
if (value < 0)
u = ~u + 1;
str = PNG_FORMAT_NUMBER(buffer, format, u);
if (value < 0 && str > buffer)
*--str = '-';
png_warning_parameter(p, number, str);
}
void
png_formatted_warning(png_structp png_ptr, png_warning_parameters p,
png_const_charp message)
{
/* The internal buffer is just 128 bytes - enough for all our messages,
* overflow doesn't happen because this code checks!
*/
size_t i;
char msg[128];
for (i=0; i<(sizeof msg)-1 && *message != '\0'; ++i)
{
if (*message == '@')
{
int parameter = -1;
switch (*++message)
{
case '1':
parameter = 0;
break;
case '2':
parameter = 1;
break;
case '\0':
continue; /* To break out of the for loop above. */
default:
break;
}
if (parameter >= 0 && parameter < PNG_WARNING_PARAMETER_COUNT)
{
/* Append this parameter */
png_const_charp parm = p[parameter];
png_const_charp pend = p[parameter] + (sizeof p[parameter]);
/* No need to copy the trailing '\0' here, but there is no guarantee
* that parm[] has been initialized, so there is no guarantee of a
* trailing '\0':
*/
for (; i<(sizeof msg)-1 && parm != '\0' && parm < pend; ++i)
msg[i] = *parm++;
++message;
continue;
}
/* else not a parameter and there is a character after the @ sign; just
* copy that.
*/
}
/* At this point *message can't be '\0', even in the bad parameter case
* above where there is a lone '@' at the end of the message string.
*/
msg[i] = *message++;
}
/* i is always less than (sizeof msg), so: */
msg[i] = '\0';
/* And this is the formatted message: */
png_warning(png_ptr, msg);
}
#endif /* PNG_WARNINGS_SUPPORTED */ #endif /* PNG_WARNINGS_SUPPORTED */
#ifdef PNG_BENIGN_ERRORS_SUPPORTED #ifdef PNG_BENIGN_ERRORS_SUPPORTED
@@ -133,9 +350,9 @@ void PNGAPI
png_benign_error(png_structp png_ptr, png_const_charp error_message) png_benign_error(png_structp png_ptr, png_const_charp error_message)
{ {
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN) if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
png_warning(png_ptr, error_message); png_warning(png_ptr, error_message);
else else
png_error(png_ptr, error_message); png_error(png_ptr, error_message);
} }
#endif #endif
@@ -155,7 +372,7 @@ static PNG_CONST char png_digit[16] = {
#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED) #if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED)
static void /* PRIVATE */ static void /* PRIVATE */
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
error_message) error_message)
{ {
int iout = 0, iin = 0; int iout = 0, iin = 0;
@@ -169,6 +386,7 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
buffer[iout++] = png_digit[c & 0x0f]; buffer[iout++] = png_digit[c & 0x0f];
buffer[iout++] = PNG_LITERAL_RIGHT_SQUARE_BRACKET; buffer[iout++] = PNG_LITERAL_RIGHT_SQUARE_BRACKET;
} }
else else
{ {
buffer[iout++] = (png_byte)c; buffer[iout++] = (png_byte)c;
@@ -177,30 +395,38 @@ 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_memcpy(buffer + iout, error_message, PNG_MAX_ERROR_TEXT);
buffer[iout + PNG_MAX_ERROR_TEXT - 1] = '\0'; iin = 0;
while (iin < PNG_MAX_ERROR_TEXT-1 && error_message[iin] != '\0')
buffer[iout++] = error_message[iin++];
/* iin < PNG_MAX_ERROR_TEXT, so the following is safe: */
buffer[iout] = '\0';
} }
} }
#endif /* PNG_WARNINGS_SUPPORTED || PNG_ERROR_TEXT_SUPPORTED */
#ifdef PNG_READ_SUPPORTED #if defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)
void PNGAPI PNG_FUNCTION(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),
PNG_NORETURN)
{ {
char msg[18+PNG_MAX_ERROR_TEXT]; 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);
else else
{ {
png_format_buffer(png_ptr, msg, error_message); png_format_buffer(png_ptr, msg, error_message);
png_error(png_ptr, msg); png_error(png_ptr, msg);
} }
} }
#endif /* PNG_READ_SUPPORTED */ #endif /* PNG_READ_SUPPORTED && PNG_ERROR_TEXT_SUPPORTED */
#endif /* PNG_WARNINGS_SUPPORTED || PNG_ERROR_TEXT_SUPPORTED */
#ifdef PNG_WARNINGS_SUPPORTED #ifdef PNG_WARNINGS_SUPPORTED
void PNGAPI void PNGAPI
@@ -208,11 +434,12 @@ png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
{ {
char msg[18+PNG_MAX_ERROR_TEXT]; 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);
else else
{ {
png_format_buffer(png_ptr, msg, warning_message); png_format_buffer(png_ptr, msg, warning_message);
png_warning(png_ptr, msg); png_warning(png_ptr, msg);
} }
} }
#endif /* PNG_WARNINGS_SUPPORTED */ #endif /* PNG_WARNINGS_SUPPORTED */
@@ -222,14 +449,37 @@ png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
void PNGAPI void PNGAPI
png_chunk_benign_error(png_structp png_ptr, png_const_charp error_message) png_chunk_benign_error(png_structp png_ptr, png_const_charp error_message)
{ {
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN) if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
png_chunk_warning(png_ptr, error_message); png_chunk_warning(png_ptr, error_message);
else
png_chunk_error(png_ptr, error_message); else
png_chunk_error(png_ptr, error_message);
} }
#endif #endif
#endif /* PNG_READ_SUPPORTED */ #endif /* PNG_READ_SUPPORTED */
#ifdef PNG_ERROR_TEXT_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
PNG_FUNCTION(void,
png_fixed_error,(png_structp png_ptr, png_const_charp name),PNG_NORETURN)
{
# define fixed_message "fixed point overflow in "
# define fixed_message_ln ((sizeof fixed_message)-1)
int iin;
char msg[fixed_message_ln+PNG_MAX_ERROR_TEXT];
png_memcpy(msg, fixed_message, fixed_message_ln);
iin = 0;
if (name != NULL) while (iin < (PNG_MAX_ERROR_TEXT-1) && name[iin] != 0)
{
msg[fixed_message_ln + iin] = name[iin];
++iin;
}
msg[fixed_message_ln + iin] = 0;
png_error(png_ptr, msg);
}
#endif
#endif
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
/* This API only exists if ANSI-C style error handling is used, /* This API only exists if ANSI-C style error handling is used,
* otherwise it is necessary for png_default_error to be overridden. * otherwise it is necessary for png_default_error to be overridden.
@@ -242,7 +492,7 @@ png_set_longjmp_fn(png_structp png_ptr, png_longjmp_ptr longjmp_fn,
return NULL; return NULL;
png_ptr->longjmp_fn = longjmp_fn; png_ptr->longjmp_fn = longjmp_fn;
return &png_ptr->jmpbuf; return &png_ptr->longjmp_buffer;
} }
#endif #endif
@@ -251,63 +501,73 @@ png_set_longjmp_fn(png_structp png_ptr, png_longjmp_ptr longjmp_fn,
* function is used by default, or if the program supplies NULL for the * function is used by default, or if the program supplies NULL for the
* error function pointer in png_set_error_fn(). * error function pointer in png_set_error_fn().
*/ */
static void /* PRIVATE */ static PNG_FUNCTION(void /* PRIVATE */,
png_default_error(png_structp png_ptr, png_const_charp error_message) png_default_error,(png_structp png_ptr, png_const_charp error_message),
PNG_NORETURN)
{ {
#ifdef PNG_CONSOLE_IO_SUPPORTED #ifdef PNG_CONSOLE_IO_SUPPORTED
#ifdef PNG_ERROR_NUMBERS_SUPPORTED #ifdef PNG_ERROR_NUMBERS_SUPPORTED
if (*error_message == PNG_LITERAL_SHARP) /* Check on NULL only added in 1.5.4 */
if (error_message != NULL && *error_message == PNG_LITERAL_SHARP)
{ {
/* Strip "#nnnn " from beginning of error message. */ /* Strip "#nnnn " from beginning of error message. */
int offset; int offset;
char error_number[16]; char error_number[16];
for (offset = 0; offset<15; offset++) for (offset = 0; offset<15; offset++)
{ {
error_number[offset] = error_message[offset + 1]; error_number[offset] = error_message[offset + 1];
if (error_message[offset] == ' ') if (error_message[offset] == ' ')
break; break;
} }
if ((offset > 1) && (offset < 15))
{ if ((offset > 1) && (offset < 15))
error_number[offset - 1] = '\0'; {
fprintf(stderr, "libpng error no. %s: %s", error_number[offset - 1] = '\0';
error_number, error_message + offset + 1); fprintf(stderr, "libpng error no. %s: %s",
fprintf(stderr, PNG_STRING_NEWLINE); error_number, error_message + offset + 1);
} fprintf(stderr, PNG_STRING_NEWLINE);
else }
{
fprintf(stderr, "libpng error: %s, offset=%d", else
error_message, offset); {
fprintf(stderr, PNG_STRING_NEWLINE); fprintf(stderr, "libpng error: %s, offset=%d",
} error_message, offset);
fprintf(stderr, PNG_STRING_NEWLINE);
}
} }
else else
#endif #endif
{ {
fprintf(stderr, "libpng error: %s", error_message); fprintf(stderr, "libpng error: %s", error_message ? error_message :
"undefined");
fprintf(stderr, PNG_STRING_NEWLINE); fprintf(stderr, PNG_STRING_NEWLINE);
} }
#else
PNG_UNUSED(error_message) /* Make compiler happy */
#endif #endif
png_longjmp(png_ptr, 1);
}
PNG_FUNCTION(void,PNGAPI
png_longjmp,(png_structp png_ptr, int val),PNG_NORETURN)
{
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
if (png_ptr && png_ptr->longjmp_fn) if (png_ptr && png_ptr->longjmp_fn)
{ {
# ifdef USE_FAR_KEYWORD # ifdef USE_FAR_KEYWORD
{ {
jmp_buf jmpbuf; jmp_buf tmp_jmpbuf;
png_memcpy(jmpbuf, png_ptr->jmpbuf, png_sizeof(jmp_buf)); png_memcpy(tmp_jmpbuf, png_ptr->longjmp_buffer, png_sizeof(jmp_buf));
png_ptr->longjmp_fn(jmpbuf, 1); png_ptr->longjmp_fn(tmp_jmpbuf, val);
} }
# else # else
png_ptr->longjmp_fn(png_ptr->jmpbuf, 1); png_ptr->longjmp_fn(png_ptr->longjmp_buffer, val);
# endif # endif
} }
#endif #endif
/* Here if not setjmp support or if png_ptr is null. */ /* Here if not setjmp support or if png_ptr is null. */
PNG_ABORT(); PNG_ABORT();
#ifndef PNG_CONSOLE_IO_SUPPORTED
error_message = error_message; /* Make compiler happy */
#endif
} }
#ifdef PNG_WARNINGS_SUPPORTED #ifdef PNG_WARNINGS_SUPPORTED
@@ -323,55 +583,63 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message)
# ifdef PNG_ERROR_NUMBERS_SUPPORTED # ifdef PNG_ERROR_NUMBERS_SUPPORTED
if (*warning_message == PNG_LITERAL_SHARP) 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'; {
fprintf(stderr, "libpng warning no. %s: %s", warning_number[offset + 1] = '\0';
warning_number, warning_message + offset); fprintf(stderr, "libpng warning no. %s: %s",
fprintf(stderr, PNG_STRING_NEWLINE); warning_number, warning_message + offset);
} fprintf(stderr, PNG_STRING_NEWLINE);
else }
{
fprintf(stderr, "libpng warning: %s", else
warning_message); {
fprintf(stderr, PNG_STRING_NEWLINE); fprintf(stderr, "libpng warning: %s",
} warning_message);
fprintf(stderr, PNG_STRING_NEWLINE);
}
} }
else else
# endif # endif
{ {
fprintf(stderr, "libpng warning: %s", warning_message); fprintf(stderr, "libpng warning: %s", warning_message);
fprintf(stderr, PNG_STRING_NEWLINE); fprintf(stderr, PNG_STRING_NEWLINE);
} }
#else #else
warning_message = warning_message; /* Make compiler happy */ PNG_UNUSED(warning_message) /* Make compiler happy */
#endif #endif
png_ptr = png_ptr; /* Make compiler happy */ PNG_UNUSED(png_ptr) /* Make compiler happy */
} }
#endif /* PNG_WARNINGS_SUPPORTED */ #endif /* PNG_WARNINGS_SUPPORTED */
/* This function is called when the application wants to use another method /* This function is called when the application wants to use another method
* of handling errors and warnings. Note that the error function MUST NOT * of handling errors and warnings. Note that the error function MUST NOT
* return to the calling routine or serious problems will occur. The return * return to the calling routine or serious problems will occur. The return
* method used in the default routine calls longjmp(png_ptr->jmpbuf, 1) * method used in the default routine calls longjmp(png_ptr->longjmp_buffer, 1)
*/ */
void PNGAPI void PNGAPI
png_set_error_fn(png_structp png_ptr, png_voidp error_ptr, png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warning_fn) png_error_ptr error_fn, png_error_ptr warning_fn)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
png_ptr->error_ptr = error_ptr; png_ptr->error_ptr = error_ptr;
png_ptr->error_fn = error_fn; png_ptr->error_fn = error_fn;
#ifdef PNG_WARNINGS_SUPPORTED
png_ptr->warning_fn = warning_fn; png_ptr->warning_fn = warning_fn;
#else
PNG_UNUSED(warning_fn)
#endif
} }
@@ -380,10 +648,11 @@ png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
* pointer before png_write_destroy and png_read_destroy are called. * pointer before png_write_destroy and png_read_destroy are called.
*/ */
png_voidp PNGAPI png_voidp PNGAPI
png_get_error_ptr(png_structp png_ptr) png_get_error_ptr(png_const_structp png_ptr)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
return NULL; return NULL;
return ((png_voidp)png_ptr->error_ptr); return ((png_voidp)png_ptr->error_ptr);
} }
@@ -394,8 +663,9 @@ 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);
} }
} }
#endif #endif

796
pngget.c

File diff suppressed because it is too large Load Diff

269
pnginfo.h Normal file
View File

@@ -0,0 +1,269 @@
/* pnginfo.h - header file for PNG reference library
*
* Copyright (c) 1998-2011 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.)
*
* Last changed in libpng 1.5.0 [January 6, 2011]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/
/* png_info is a structure that holds the information in a PNG file so
* that the application can find out the characteristics of the image.
* If you are reading the file, this structure will tell you what is
* in the PNG file. If you are writing the file, fill in the information
* you want to put into the PNG file, using png_set_*() functions, then
* call png_write_info().
*
* The names chosen should be very close to the PNG specification, so
* consult that document for information about the meaning of each field.
*
* With libpng < 0.95, it was only possible to directly set and read the
* the values in the png_info_struct, which meant that the contents and
* order of the values had to remain fixed. With libpng 0.95 and later,
* however, there are now functions that abstract the contents of
* png_info_struct from the application, so this makes it easier to use
* libpng with dynamic libraries, and even makes it possible to use
* libraries that don't have all of the libpng ancillary chunk-handing
* functionality. In libpng-1.5.0 this was moved into a separate private
* file that is not visible to applications.
*
* The following members may have allocated storage attached that should be
* cleaned up before the structure is discarded: palette, trans, text,
* pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile,
* splt_palettes, scal_unit, row_pointers, and unknowns. By default, these
* are automatically freed when the info structure is deallocated, if they were
* allocated internally by libpng. This behavior can be changed by means
* of the png_data_freer() function.
*
* More allocation details: all the chunk-reading functions that
* change these members go through the corresponding png_set_*
* functions. A function to clear these members is available: see
* png_free_data(). The png_set_* functions do not depend on being
* able to point info structure members to any of the storage they are
* passed (they make their own copies), EXCEPT that the png_set_text
* functions use the same storage passed to them in the text_ptr or
* itxt_ptr structure argument, and the png_set_rows and png_set_unknowns
* functions do not make their own copies.
*/
#ifndef PNGINFO_H
#define PNGINFO_H
struct png_info_def
{
/* the following are necessary for every PNG file */
png_uint_32 width; /* width of image in pixels (from IHDR) */
png_uint_32 height; /* height of image in pixels (from IHDR) */
png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */
png_size_t rowbytes; /* bytes needed to hold an untransformed row */
png_colorp palette; /* array of color values (valid & PNG_INFO_PLTE) */
png_uint_16 num_palette; /* number of color entries in "palette" (PLTE) */
png_uint_16 num_trans; /* number of transparent palette color (tRNS) */
png_byte bit_depth; /* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */
png_byte color_type; /* see PNG_COLOR_TYPE_ below (from IHDR) */
/* The following three should have been named *_method not *_type */
png_byte compression_type; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */
png_byte filter_type; /* must be PNG_FILTER_TYPE_BASE (from IHDR) */
png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
/* The following is informational only on read, and not used on writes. */
png_byte channels; /* number of data channels per pixel (1, 2, 3, 4) */
png_byte pixel_depth; /* number of bits per pixel */
png_byte spare_byte; /* to align the data, and for future use */
png_byte signature[8]; /* magic bytes read by libpng from start of file */
/* The rest of the data is optional. If you are reading, check the
* valid field to see if the information in these are valid. If you
* are writing, set the valid field to those chunks you want written,
* and initialize the appropriate fields below.
*/
#if defined(PNG_gAMA_SUPPORTED)
/* The gAMA chunk describes the gamma characteristics of the system
* on which the image was created, normally in the range [1.0, 2.5].
* Data is valid if (valid & PNG_INFO_gAMA) is non-zero.
*/
png_fixed_point gamma;
#endif
#ifdef PNG_sRGB_SUPPORTED
/* GR-P, 0.96a */
/* Data valid if (valid & PNG_INFO_sRGB) non-zero. */
png_byte srgb_intent; /* sRGB rendering intent [0, 1, 2, or 3] */
#endif
#ifdef PNG_TEXT_SUPPORTED
/* The tEXt, and zTXt chunks contain human-readable textual data in
* uncompressed, compressed, and optionally compressed forms, respectively.
* The data in "text" is an array of pointers to uncompressed,
* null-terminated C strings. Each chunk has a keyword that describes the
* textual data contained in that chunk. Keywords are not required to be
* unique, and the text string may be empty. Any number of text chunks may
* be in an image.
*/
int num_text; /* number of comments read or comments to write */
int max_text; /* current size of text array */
png_textp text; /* array of comments read or comments to write */
#endif /* PNG_TEXT_SUPPORTED */
#ifdef PNG_tIME_SUPPORTED
/* The tIME chunk holds the last time the displayed image data was
* modified. See the png_time struct for the contents of this struct.
*/
png_time mod_time;
#endif
#ifdef PNG_sBIT_SUPPORTED
/* The sBIT chunk specifies the number of significant high-order bits
* in the pixel data. Values are in the range [1, bit_depth], and are
* only specified for the channels in the pixel data. The contents of
* the low-order bits is not specified. Data is valid if
* (valid & PNG_INFO_sBIT) is non-zero.
*/
png_color_8 sig_bit; /* significant bits in color channels */
#endif
#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_EXPAND_SUPPORTED) || \
defined(PNG_READ_BACKGROUND_SUPPORTED)
/* The tRNS chunk supplies transparency data for paletted images and
* other image types that don't need a full alpha channel. There are
* "num_trans" transparency values for a paletted image, stored in the
* same order as the palette colors, starting from index 0. Values
* for the data are in the range [0, 255], ranging from fully transparent
* to fully opaque, respectively. For non-paletted images, there is a
* single color specified that should be treated as fully transparent.
* Data is valid if (valid & PNG_INFO_tRNS) is non-zero.
*/
png_bytep trans_alpha; /* alpha values for paletted image */
png_color_16 trans_color; /* transparent color for non-palette image */
#endif
#if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
/* The bKGD chunk gives the suggested image background color if the
* display program does not have its own background color and the image
* is needs to composited onto a background before display. The colors
* in "background" are normally in the same color space/depth as the
* pixel data. Data is valid if (valid & PNG_INFO_bKGD) is non-zero.
*/
png_color_16 background;
#endif
#ifdef PNG_oFFs_SUPPORTED
/* The oFFs chunk gives the offset in "offset_unit_type" units rightwards
* and downwards from the top-left corner of the display, page, or other
* application-specific co-ordinate space. See the PNG_OFFSET_ defines
* below for the unit types. Valid if (valid & PNG_INFO_oFFs) non-zero.
*/
png_int_32 x_offset; /* x offset on page */
png_int_32 y_offset; /* y offset on page */
png_byte offset_unit_type; /* offset units type */
#endif
#ifdef PNG_pHYs_SUPPORTED
/* The pHYs chunk gives the physical pixel density of the image for
* display or printing in "phys_unit_type" units (see PNG_RESOLUTION_
* defines below). Data is valid if (valid & PNG_INFO_pHYs) is non-zero.
*/
png_uint_32 x_pixels_per_unit; /* horizontal pixel density */
png_uint_32 y_pixels_per_unit; /* vertical pixel density */
png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */
#endif
#ifdef PNG_hIST_SUPPORTED
/* The hIST chunk contains the relative frequency or importance of the
* various palette entries, so that a viewer can intelligently select a
* reduced-color palette, if required. Data is an array of "num_palette"
* values in the range [0,65535]. Data valid if (valid & PNG_INFO_hIST)
* is non-zero.
*/
png_uint_16p hist;
#endif
#ifdef PNG_cHRM_SUPPORTED
/* The cHRM chunk describes the CIE color characteristics of the monitor
* on which the PNG was created. This data allows the viewer to do gamut
* mapping of the input image to ensure that the viewer sees the same
* colors in the image as the creator. Values are in the range
* [0.0, 0.8]. Data valid if (valid & PNG_INFO_cHRM) non-zero.
*/
png_fixed_point x_white;
png_fixed_point y_white;
png_fixed_point x_red;
png_fixed_point y_red;
png_fixed_point x_green;
png_fixed_point y_green;
png_fixed_point x_blue;
png_fixed_point y_blue;
#endif
#ifdef PNG_pCAL_SUPPORTED
/* The pCAL chunk describes a transformation between the stored pixel
* values and original physical data values used to create the image.
* The integer range [0, 2^bit_depth - 1] maps to the floating-point
* range given by [pcal_X0, pcal_X1], and are further transformed by a
* (possibly non-linear) transformation function given by "pcal_type"
* and "pcal_params" into "pcal_units". Please see the PNG_EQUATION_
* defines below, and the PNG-Group's PNG extensions document for a
* complete description of the transformations and how they should be
* implemented, and for a description of the ASCII parameter strings.
* Data values are valid if (valid & PNG_INFO_pCAL) non-zero.
*/
png_charp pcal_purpose; /* pCAL chunk description string */
png_int_32 pcal_X0; /* minimum value */
png_int_32 pcal_X1; /* maximum value */
png_charp pcal_units; /* Latin-1 string giving physical units */
png_charpp pcal_params; /* ASCII strings containing parameter values */
png_byte pcal_type; /* equation type (see PNG_EQUATION_ below) */
png_byte pcal_nparams; /* number of parameters given in pcal_params */
#endif
/* New members added in libpng-1.0.6 */
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) || \
defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
/* Storage for unknown chunks that the library doesn't recognize. */
png_unknown_chunkp unknown_chunks;
int unknown_chunks_num;
#endif
#ifdef PNG_iCCP_SUPPORTED
/* iCCP chunk data. */
png_charp iccp_name; /* profile name */
png_bytep iccp_profile; /* International Color Consortium profile data */
png_uint_32 iccp_proflen; /* ICC profile data length */
png_byte iccp_compression; /* Always zero */
#endif
#ifdef PNG_sPLT_SUPPORTED
/* Data on sPLT chunks (there may be more than one). */
png_sPLT_tp splt_palettes;
png_uint_32 splt_palettes_num;
#endif
#ifdef PNG_sCAL_SUPPORTED
/* The sCAL chunk describes the actual physical dimensions of the
* subject matter of the graphic. The chunk contains a unit specification
* a byte value, and two ASCII strings representing floating-point
* values. The values are width and height corresponsing to one pixel
* in the image. Data values are valid if (valid & PNG_INFO_sCAL) is
* non-zero.
*/
png_byte scal_unit; /* unit of physical scale */
png_charp scal_s_width; /* string containing height */
png_charp scal_s_height; /* string containing width */
#endif
#ifdef PNG_INFO_IMAGE_SUPPORTED
/* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS)
non-zero */
/* Data valid if (valid & PNG_INFO_IDAT) non-zero */
png_bytepp row_pointers; /* the image bits */
#endif
};
#endif /* PNGINFO_H */

270
pngmem.c
View File

@@ -1,8 +1,8 @@
/* pngmem.c - stub functions for memory allocation /* pngmem.c - stub functions for memory allocation
* *
* Last changed in libpng 1.4.0 [January 2, 2010] * Last changed in libpng 1.5.4 [July 7, 2011]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson * Copyright (c) 1998-2011 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,40 +17,42 @@
* identify the replacement functions. * identify the replacement functions.
*/ */
#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#include "pngpriv.h" #include "pngpriv.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
/* Borland DOS special memory handler */ /* Borland DOS special memory handler */
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__) #if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
/* If you change this, be sure to change the one in png.h also */ /* If you change this, be sure to change the one in png.h also */
/* Allocate memory for a png_struct. The malloc and memset can be replaced /* Allocate memory for a png_struct. The malloc and memset can be replaced
by a single call to calloc() if this is thought to improve performance. */ by a single call to calloc() if this is thought to improve performance. */
png_voidp /* PRIVATE */ PNG_FUNCTION(png_voidp /* PRIVATE */,
png_create_struct(int type) png_create_struct,(int type),PNG_ALLOCATED)
{ {
#ifdef PNG_USER_MEM_SUPPORTED # ifdef PNG_USER_MEM_SUPPORTED
return (png_create_struct_2(type, NULL, 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. */
png_voidp /* PRIVATE */ PNG_FUNCTION(png_voidp /* PRIVATE */,
png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr) png_create_struct_2,(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr),
PNG_ALLOCATED)
{ {
#endif /* PNG_USER_MEM_SUPPORTED */ # endif /* PNG_USER_MEM_SUPPORTED */
png_size_t size; png_size_t size;
png_voidp struct_ptr; png_voidp struct_ptr;
if (type == PNG_STRUCT_INFO) if (type == PNG_STRUCT_INFO)
size = png_sizeof(png_info); size = png_sizeof(png_info);
else if (type == PNG_STRUCT_PNG) else if (type == PNG_STRUCT_PNG)
size = png_sizeof(png_struct); size = png_sizeof(png_struct);
else else
return (png_get_copyright(NULL)); return (png_get_copyright(NULL));
#ifdef PNG_USER_MEM_SUPPORTED # ifdef PNG_USER_MEM_SUPPORTED
if (malloc_fn != NULL) if (malloc_fn != NULL)
{ {
png_struct dummy_struct; png_struct dummy_struct;
@@ -58,11 +60,13 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
png_ptr->mem_ptr=mem_ptr; png_ptr->mem_ptr=mem_ptr;
struct_ptr = (*(malloc_fn))(png_ptr, (png_uint_32)size); struct_ptr = (*(malloc_fn))(png_ptr, (png_uint_32)size);
} }
else else
#endif /* PNG_USER_MEM_SUPPORTED */ # endif /* PNG_USER_MEM_SUPPORTED */
struct_ptr = (png_voidp)farmalloc(size); struct_ptr = (png_voidp)farmalloc(size);
if (struct_ptr != NULL) if (struct_ptr != NULL)
png_memset(struct_ptr, 0, size); png_memset(struct_ptr, 0, size);
return (struct_ptr); return (struct_ptr);
} }
@@ -70,7 +74,7 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
void /* PRIVATE */ 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, NULL, NULL); png_destroy_struct_2(struct_ptr, NULL, NULL);
} }
@@ -79,10 +83,10 @@ void /* PRIVATE */
png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn, png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
png_voidp mem_ptr) png_voidp mem_ptr)
{ {
#endif # endif
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;
@@ -91,7 +95,8 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
(*(free_fn))(png_ptr, struct_ptr); (*(free_fn))(png_ptr, struct_ptr);
return; return;
} }
#endif /* PNG_USER_MEM_SUPPORTED */
# endif /* PNG_USER_MEM_SUPPORTED */
farfree (struct_ptr); farfree (struct_ptr);
} }
} }
@@ -115,55 +120,62 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
* result, we would be truncating potentially larger memory requests * result, we would be truncating potentially larger memory requests
* (which should cause a fatal error) and introducing major problems. * (which should cause a fatal error) and introducing major problems.
*/ */
png_voidp PNGAPI PNG_FUNCTION(png_voidp,PNGAPI
png_calloc(png_structp png_ptr, png_alloc_size_t size) png_calloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{ {
png_voidp ret; png_voidp ret;
ret = (png_malloc(png_ptr, size)); ret = (png_malloc(png_ptr, size));
if (ret != NULL) if (ret != NULL)
png_memset(ret,0,(png_size_t)size); png_memset(ret,0,(png_size_t)size);
return (ret); return (ret);
} }
png_voidp PNGAPI PNG_FUNCTION(png_voidp,PNGAPI
png_malloc(png_structp png_ptr, png_alloc_size_t size) png_malloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{ {
png_voidp ret; png_voidp ret;
if (png_ptr == NULL || size == 0) if (png_ptr == NULL || size == 0)
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_FUNCTION(png_voidp,PNGAPI
png_malloc_default(png_structp png_ptr, png_alloc_size_t size) png_malloc_default,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{ {
png_voidp ret; png_voidp ret;
#endif /* PNG_USER_MEM_SUPPORTED */ # endif /* PNG_USER_MEM_SUPPORTED */
if (png_ptr == NULL || size == 0) if (png_ptr == NULL || size == 0)
return (NULL); return (NULL);
#ifdef PNG_MAX_MALLOC_64K # ifdef PNG_MAX_MALLOC_64K
if (size > (png_uint_32)65536L) if (size > (png_uint_32)65536L)
{ {
png_warning(png_ptr, "Cannot Allocate > 64K"); png_warning(png_ptr, "Cannot Allocate > 64K");
ret = NULL; ret = NULL;
} }
else else
#endif # endif
if (size != (size_t)size) if (size != (size_t)size)
ret = NULL; ret = NULL;
else if (size == (png_uint_32)65536L) else if (size == (png_uint_32)65536L)
{ {
if (png_ptr->offset_table == NULL) if (png_ptr->offset_table == NULL)
@@ -175,8 +187,9 @@ png_malloc_default(png_structp png_ptr, png_alloc_size_t size)
int num_blocks; int num_blocks;
png_uint_32 total_size; png_uint_32 total_size;
png_bytep table; png_bytep table;
int i; int i, mem_level, window_bits;
png_byte huge * hptr; png_byte huge * hptr;
int window_bits
if (ret != NULL) if (ret != NULL)
{ {
@@ -184,12 +197,23 @@ png_malloc_default(png_structp png_ptr, png_alloc_size_t size)
ret = NULL; ret = NULL;
} }
if (png_ptr->zlib_window_bits > 14) window_bits =
num_blocks = (int)(1 << (png_ptr->zlib_window_bits - 14)); png_ptr->zlib_window_bits >= png_ptr->zlib_text_window_bits ?
png_ptr->zlib_window_bits : png_ptr->zlib_text_window_bits;
if (window_bits > 14)
num_blocks = (int)(1 << (window_bits - 14));
else else
num_blocks = 1; num_blocks = 1;
if (png_ptr->zlib_mem_level >= 7)
num_blocks += (int)(1 << (png_ptr->zlib_mem_level - 7)); mem_level =
png_ptr->zlib_mem_level >= png_ptr->zlib_text_mem_level ?
png_ptr->zlib_mem_level : png_ptr->zlib_text_mem_level;
if (mem_level >= 7)
num_blocks += (int)(1 << (mem_level - 7));
else else
num_blocks++; num_blocks++;
@@ -199,25 +223,27 @@ png_malloc_default(png_structp png_ptr, png_alloc_size_t size)
if (table == NULL) if (table == NULL)
{ {
#ifndef PNG_USER_MEM_SUPPORTED # ifndef PNG_USER_MEM_SUPPORTED
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Out Of Memory"); /* Note "O" and "M" */ png_error(png_ptr, "Out Of Memory"); /* Note "O", "M" */
else else
png_warning(png_ptr, "Out Of Memory"); png_warning(png_ptr, "Out Of Memory");
#endif # endif
return (NULL); return (NULL);
} }
if ((png_size_t)table & 0xfff0) if ((png_size_t)table & 0xfff0)
{ {
#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, png_error(png_ptr,
"Farmalloc didn't return normalized pointer"); "Farmalloc didn't return normalized pointer");
else else
png_warning(png_ptr, png_warning(png_ptr,
"Farmalloc didn't return normalized pointer"); "Farmalloc didn't return normalized pointer");
#endif # endif
return (NULL); return (NULL);
} }
@@ -227,12 +253,13 @@ png_malloc_default(png_structp png_ptr, png_alloc_size_t size)
if (png_ptr->offset_table_ptr == NULL) if (png_ptr->offset_table_ptr == NULL)
{ {
#ifndef PNG_USER_MEM_SUPPORTED # ifndef PNG_USER_MEM_SUPPORTED
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Out Of memory"); /* Note "O" and "M" */ png_error(png_ptr, "Out Of memory"); /* Note "O", "m" */
else else
png_warning(png_ptr, "Out Of memory"); png_warning(png_ptr, "Out Of memory");
#endif # endif
return (NULL); return (NULL);
} }
@@ -242,6 +269,7 @@ png_malloc_default(png_structp png_ptr, png_alloc_size_t size)
hptr = (png_byte huge *)((long)(hptr) & 0xfffffff0L); hptr = (png_byte huge *)((long)(hptr) & 0xfffffff0L);
hptr = hptr + 16L; /* "hptr += 16L" fails on Turbo C++ 3.0 */ hptr = hptr + 16L; /* "hptr += 16L" fails on Turbo C++ 3.0 */
} }
for (i = 0; i < num_blocks; i++) for (i = 0; i < num_blocks; i++)
{ {
png_ptr->offset_table_ptr[i] = (png_bytep)hptr; png_ptr->offset_table_ptr[i] = (png_bytep)hptr;
@@ -256,29 +284,32 @@ png_malloc_default(png_structp png_ptr, png_alloc_size_t size)
if (png_ptr->offset_table_count >= png_ptr->offset_table_number) if (png_ptr->offset_table_count >= png_ptr->offset_table_number)
{ {
#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);
} }
ret = png_ptr->offset_table_ptr[png_ptr->offset_table_count++]; ret = png_ptr->offset_table_ptr[png_ptr->offset_table_count++];
} }
else else
ret = farmalloc(size); ret = farmalloc(size);
#ifndef PNG_USER_MEM_SUPPORTED # ifndef PNG_USER_MEM_SUPPORTED
if (ret == NULL) if (ret == NULL)
{ {
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Out of memory"); /* Note "o" and "m" */ png_error(png_ptr, "Out of memory"); /* Note "o" and "m" */
else else
png_warning(png_ptr, "Out of memory"); /* Note "o" and "m" */ png_warning(png_ptr, "Out of memory"); /* Note "o" and "m" */
} }
#endif # endif
return (ret); return (ret);
} }
@@ -293,12 +324,13 @@ png_free(png_structp png_ptr, png_voidp ptr)
if (png_ptr == NULL || ptr == NULL) if (png_ptr == NULL || ptr == NULL)
return; return;
#ifdef PNG_USER_MEM_SUPPORTED # ifdef PNG_USER_MEM_SUPPORTED
if (png_ptr->free_fn != NULL) if (png_ptr->free_fn != NULL)
{ {
(*(png_ptr->free_fn))(png_ptr, ptr); (*(png_ptr->free_fn))(png_ptr, ptr);
return; return;
} }
else else
png_free_default(png_ptr, ptr); png_free_default(png_ptr, ptr);
} }
@@ -306,7 +338,7 @@ png_free(png_structp png_ptr, png_voidp ptr)
void PNGAPI void PNGAPI
png_free_default(png_structp png_ptr, png_voidp ptr) png_free_default(png_structp png_ptr, png_voidp ptr)
{ {
#endif /* PNG_USER_MEM_SUPPORTED */ # endif /* PNG_USER_MEM_SUPPORTED */
if (png_ptr == NULL || ptr == NULL) if (png_ptr == NULL || ptr == NULL)
return; return;
@@ -334,9 +366,7 @@ png_free_default(png_structp png_ptr, png_voidp ptr)
} }
if (ptr != NULL) if (ptr != NULL)
{
farfree(ptr); farfree(ptr);
}
} }
#else /* Not the Borland DOS special memory handler */ #else /* Not the Borland DOS special memory handler */
@@ -344,52 +374,58 @@ png_free_default(png_structp png_ptr, png_voidp ptr)
/* 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
memset can be replaced by a single call to calloc() if this is thought memset can be replaced by a single call to calloc() if this is thought
to improve performance noticably. */ to improve performance noticably. */
png_voidp /* PRIVATE */ PNG_FUNCTION(png_voidp /* PRIVATE */,
png_create_struct(int type) png_create_struct,(int type),PNG_ALLOCATED)
{ {
#ifdef PNG_USER_MEM_SUPPORTED # ifdef PNG_USER_MEM_SUPPORTED
return (png_create_struct_2(type, NULL, 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
memset can be replaced by a single call to calloc() if this is thought memset can be replaced by a single call to calloc() if this is thought
to improve performance noticably. */ to improve performance noticably. */
png_voidp /* PRIVATE */ PNG_FUNCTION(png_voidp /* PRIVATE */,
png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr) png_create_struct_2,(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr),
PNG_ALLOCATED)
{ {
#endif /* PNG_USER_MEM_SUPPORTED */ # endif /* PNG_USER_MEM_SUPPORTED */
png_size_t size; png_size_t size;
png_voidp struct_ptr; png_voidp struct_ptr;
if (type == PNG_STRUCT_INFO) if (type == PNG_STRUCT_INFO)
size = png_sizeof(png_info); size = png_sizeof(png_info);
else if (type == PNG_STRUCT_PNG) else if (type == PNG_STRUCT_PNG)
size = png_sizeof(png_struct); size = png_sizeof(png_struct);
else else
return (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;
png_ptr->mem_ptr=mem_ptr; png_ptr->mem_ptr=mem_ptr;
struct_ptr = (*(malloc_fn))(png_ptr, size); struct_ptr = (*(malloc_fn))(png_ptr, size);
if (struct_ptr != NULL) if (struct_ptr != NULL)
png_memset(struct_ptr, 0, size); png_memset(struct_ptr, 0, size);
return (struct_ptr); return (struct_ptr);
} }
#endif /* PNG_USER_MEM_SUPPORTED */ # endif /* PNG_USER_MEM_SUPPORTED */
#if defined(__TURBOC__) && !defined(__FLAT__) # if defined(__TURBOC__) && !defined(__FLAT__)
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
#endif # endif
if (struct_ptr != NULL) if (struct_ptr != NULL)
png_memset(struct_ptr, 0, size); png_memset(struct_ptr, 0, size);
@@ -401,7 +437,7 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
void /* PRIVATE */ 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, NULL, NULL); png_destroy_struct_2(struct_ptr, NULL, NULL);
} }
@@ -410,10 +446,10 @@ void /* PRIVATE */
png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn, png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
png_voidp mem_ptr) png_voidp mem_ptr)
{ {
#endif /* PNG_USER_MEM_SUPPORTED */ # endif /* PNG_USER_MEM_SUPPORTED */
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;
@@ -422,16 +458,19 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
(*(free_fn))(png_ptr, struct_ptr); (*(free_fn))(png_ptr, struct_ptr);
return; return;
} }
#endif /* PNG_USER_MEM_SUPPORTED */ # endif /* PNG_USER_MEM_SUPPORTED */
#if defined(__TURBOC__) && !defined(__FLAT__) # if defined(__TURBOC__) && !defined(__FLAT__)
farfree(struct_ptr); farfree(struct_ptr);
#else
# if defined(_MSC_VER) && defined(MAXSEG_64K) # else
# if defined(_MSC_VER) && defined(MAXSEG_64K)
hfree(struct_ptr); hfree(struct_ptr);
# else
# else
free(struct_ptr); free(struct_ptr);
# endif
#endif # endif
# endif
} }
} }
@@ -442,80 +481,92 @@ 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_FUNCTION(png_voidp,PNGAPI
png_calloc(png_structp png_ptr, png_alloc_size_t size) png_calloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{ {
png_voidp ret; png_voidp ret;
ret = (png_malloc(png_ptr, size)); ret = (png_malloc(png_ptr, size));
if (ret != NULL) if (ret != NULL)
png_memset(ret,0,(png_size_t)size); png_memset(ret,0,(png_size_t)size);
return (ret); return (ret);
} }
png_voidp PNGAPI PNG_FUNCTION(png_voidp,PNGAPI
png_malloc(png_structp png_ptr, png_alloc_size_t size) png_malloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{ {
png_voidp ret; png_voidp ret;
#ifdef PNG_USER_MEM_SUPPORTED # ifdef PNG_USER_MEM_SUPPORTED
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_FUNCTION(png_voidp,PNGAPI
png_malloc_default(png_structp png_ptr, png_alloc_size_t size) png_malloc_default,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{ {
png_voidp ret; png_voidp ret;
#endif /* PNG_USER_MEM_SUPPORTED */ # endif /* PNG_USER_MEM_SUPPORTED */
if (png_ptr == NULL || size == 0) if (png_ptr == NULL || size == 0)
return (NULL); return (NULL);
#ifdef PNG_MAX_MALLOC_64K # ifdef PNG_MAX_MALLOC_64K
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
return NULL; return NULL;
} }
#endif # endif
/* Check for overflow */ /* Check for overflow */
#if defined(__TURBOC__) && !defined(__FLAT__) # if defined(__TURBOC__) && !defined(__FLAT__)
if (size != (unsigned long)size) if (size != (unsigned long)size)
ret = NULL; ret = NULL;
else else
ret = farmalloc(size); ret = farmalloc(size);
#else
# if defined(_MSC_VER) && defined(MAXSEG_64K) # else
# if defined(_MSC_VER) && defined(MAXSEG_64K)
if (size != (unsigned long)size) if (size != (unsigned long)size)
ret = NULL; ret = NULL;
else else
ret = halloc(size, 1); ret = halloc(size, 1);
# else
# else
if (size != (size_t)size) if (size != (size_t)size)
ret = NULL; ret = NULL;
else else
ret = malloc((size_t)size); ret = malloc((size_t)size);
# endif # endif
#endif # endif
#ifndef PNG_USER_MEM_SUPPORTED # ifndef PNG_USER_MEM_SUPPORTED
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");
#endif # endif
return (ret); return (ret);
} }
@@ -529,34 +580,38 @@ png_free(png_structp png_ptr, png_voidp ptr)
if (png_ptr == NULL || ptr == NULL) if (png_ptr == NULL || ptr == NULL)
return; return;
#ifdef PNG_USER_MEM_SUPPORTED # ifdef PNG_USER_MEM_SUPPORTED
if (png_ptr->free_fn != NULL) if (png_ptr->free_fn != NULL)
{ {
(*(png_ptr->free_fn))(png_ptr, ptr); (*(png_ptr->free_fn))(png_ptr, ptr);
return; return;
} }
else else
png_free_default(png_ptr, ptr); png_free_default(png_ptr, ptr);
} }
void PNGAPI void PNGAPI
png_free_default(png_structp png_ptr, png_voidp ptr) png_free_default(png_structp png_ptr, png_voidp ptr)
{ {
if (png_ptr == NULL || ptr == NULL) if (png_ptr == NULL || ptr == NULL)
return; return;
#endif /* PNG_USER_MEM_SUPPORTED */ # endif /* PNG_USER_MEM_SUPPORTED */
#if defined(__TURBOC__) && !defined(__FLAT__) # if defined(__TURBOC__) && !defined(__FLAT__)
farfree(ptr); farfree(ptr);
#else
# if defined(_MSC_VER) && defined(MAXSEG_64K)
hfree(ptr);
# else
free(ptr);
# endif
#endif
}
# else
# if defined(_MSC_VER) && defined(MAXSEG_64K)
hfree(ptr);
# else
free(ptr);
# endif
# endif
}
#endif /* Not Borland DOS special memory handler */ #endif /* Not Borland DOS special memory handler */
/* 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()
@@ -564,8 +619,8 @@ png_free_default(png_structp png_ptr, png_voidp ptr)
* 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_FUNCTION(png_voidp,PNGAPI
png_malloc_warn(png_structp png_ptr, png_alloc_size_t size) png_malloc_warn,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{ {
png_voidp ptr; png_voidp ptr;
png_uint_32 save_flags; png_uint_32 save_flags;
@@ -601,10 +656,11 @@ png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
* pointer before png_write_destroy and png_read_destroy are called. * pointer before png_write_destroy and png_read_destroy are called.
*/ */
png_voidp PNGAPI png_voidp PNGAPI
png_get_mem_ptr(png_structp png_ptr) png_get_mem_ptr(png_const_structp png_ptr)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
return (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 */

View File

@@ -1,8 +1,8 @@
/* pngpread.c - read a png file in push mode /* pngpread.c - read a png file in push mode
* *
* Last changed in libpng 1.4.0 [January 2, 2010] * Last changed in libpng 1.5.2 [March 31, 2011]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson * Copyright (c) 1998-2011 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.)
* *
@@ -11,11 +11,10 @@
* and license in png.h * and license in png.h
*/ */
#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
#include "pngpriv.h" #include "pngpriv.h"
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
/* Push model modes */ /* Push model modes */
#define PNG_READ_SIG_MODE 0 #define PNG_READ_SIG_MODE 0
#define PNG_READ_CHUNK_MODE 1 #define PNG_READ_CHUNK_MODE 1
@@ -29,7 +28,7 @@
void PNGAPI 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) if (png_ptr == NULL || info_ptr == NULL)
return; return;
@@ -42,6 +41,64 @@ png_process_data(png_structp png_ptr, png_infop info_ptr,
} }
} }
png_size_t PNGAPI
png_process_data_pause(png_structp png_ptr, int save)
{
if (png_ptr != NULL)
{
/* It's easiest for the caller if we do the save, then the caller doesn't
* have to supply the same data again:
*/
if (save)
png_push_save_buffer(png_ptr);
else
{
/* This includes any pending saved bytes: */
png_size_t remaining = png_ptr->buffer_size;
png_ptr->buffer_size = 0;
/* So subtract the saved buffer size, unless all the data
* is actually 'saved', in which case we just return 0
*/
if (png_ptr->save_buffer_size < remaining)
return remaining - png_ptr->save_buffer_size;
}
}
return 0;
}
png_uint_32 PNGAPI
png_process_data_skip(png_structp png_ptr)
{
png_uint_32 remaining = 0;
if (png_ptr != NULL && png_ptr->process_mode == PNG_SKIP_MODE &&
png_ptr->skip_length > 0)
{
/* At the end of png_process_data the buffer size must be 0 (see the loop
* above) so we can detect a broken call here:
*/
if (png_ptr->buffer_size != 0)
png_error(png_ptr,
"png_process_data_skip called inside png_process_data");
/* If is impossible for there to be a saved buffer at this point -
* otherwise we could not be in SKIP mode. This will also happen if
* png_process_skip is called inside png_process_data (but only very
* rarely.)
*/
if (png_ptr->save_buffer_size != 0)
png_error(png_ptr, "png_process_data_skip called with saved data");
remaining = png_ptr->skip_length;
png_ptr->skip_length = 0;
png_ptr->process_mode = PNG_READ_CHUNK_MODE;
}
return remaining;
}
/* What we do with the incoming data depends on what we were previously /* What we do with the incoming data depends on what we were previously
* doing before we ran out of data... * doing before we ran out of data...
*/ */
@@ -127,7 +184,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,6 +192,7 @@ png_push_read_sig(png_structp png_ptr, png_infop info_ptr)
if (num_checked < 4 && if (num_checked < 4 &&
png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4)) png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4))
png_error(png_ptr, "Not a PNG file"); png_error(png_ptr, "Not a PNG file");
else else
png_error(png_ptr, "PNG file corrupted by ASCII conversion"); png_error(png_ptr, "PNG file corrupted by ASCII conversion");
} }
@@ -231,8 +289,8 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
} }
if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
if (png_ptr->mode & PNG_AFTER_IDAT) if (png_ptr->mode & PNG_AFTER_IDAT)
png_ptr->mode |= PNG_HAVE_CHUNK_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))
{ {
@@ -285,7 +343,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_error(png_ptr, "Missing IHDR before IDAT"); png_error(png_ptr, "Missing IHDR before IDAT");
else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
!(png_ptr->mode & PNG_HAVE_PLTE)) !(png_ptr->mode & PNG_HAVE_PLTE))
png_error(png_ptr, "Missing PLTE before IDAT"); png_error(png_ptr, "Missing PLTE before IDAT");
} }
} }
@@ -329,7 +387,9 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_ptr->mode |= PNG_HAVE_IDAT; png_ptr->mode |= PNG_HAVE_IDAT;
png_ptr->process_mode = PNG_READ_IDAT_MODE; png_ptr->process_mode = PNG_READ_IDAT_MODE;
png_push_have_info(png_ptr, info_ptr); png_push_have_info(png_ptr, info_ptr);
png_ptr->zstream.avail_out = (uInt)png_ptr->irowbytes; png_ptr->zstream.avail_out =
(uInt) PNG_ROWBYTES(png_ptr->pixel_depth,
png_ptr->iwidth) + 1;
png_ptr->zstream.next_out = png_ptr->row_buf; png_ptr->zstream.next_out = png_ptr->row_buf;
return; return;
} }
@@ -580,32 +640,45 @@ png_push_crc_finish(png_structp png_ptr)
{ {
if (png_ptr->skip_length && png_ptr->save_buffer_size) if (png_ptr->skip_length && png_ptr->save_buffer_size)
{ {
png_size_t save_size; png_size_t save_size = png_ptr->save_buffer_size;
png_uint_32 skip_length = png_ptr->skip_length;
/* We want the smaller of 'skip_length' and 'save_buffer_size', but
* they are of different types and we don't know which variable has the
* fewest bits. Carefully select the smaller and cast it to the type of
* the larger - this cannot overflow. Do not cast in the following test
* - it will break on either 16 or 64 bit platforms.
*/
if (skip_length < save_size)
save_size = (png_size_t)skip_length;
if (png_ptr->skip_length < (png_uint_32)png_ptr->save_buffer_size)
save_size = (png_size_t)png_ptr->skip_length;
else else
save_size = png_ptr->save_buffer_size; skip_length = (png_uint_32)save_size;
png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size); png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size);
png_ptr->skip_length -= save_size; png_ptr->skip_length -= skip_length;
png_ptr->buffer_size -= save_size; png_ptr->buffer_size -= save_size;
png_ptr->save_buffer_size -= save_size; png_ptr->save_buffer_size -= save_size;
png_ptr->save_buffer_ptr += save_size; png_ptr->save_buffer_ptr += save_size;
} }
if (png_ptr->skip_length && png_ptr->current_buffer_size) if (png_ptr->skip_length && png_ptr->current_buffer_size)
{ {
png_size_t save_size; png_size_t save_size = png_ptr->current_buffer_size;
png_uint_32 skip_length = png_ptr->skip_length;
/* We want the smaller of 'skip_length' and 'current_buffer_size', here,
* the same problem exists as above and the same solution.
*/
if (skip_length < save_size)
save_size = (png_size_t)skip_length;
if (png_ptr->skip_length < (png_uint_32)png_ptr->current_buffer_size)
save_size = (png_size_t)png_ptr->skip_length;
else else
save_size = png_ptr->current_buffer_size; skip_length = (png_uint_32)save_size;
png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size); png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size);
png_ptr->skip_length -= save_size; png_ptr->skip_length -= skip_length;
png_ptr->buffer_size -= save_size; png_ptr->buffer_size -= save_size;
png_ptr->current_buffer_size -= save_size; png_ptr->current_buffer_size -= save_size;
png_ptr->current_buffer_ptr += save_size; png_ptr->current_buffer_ptr += save_size;
@@ -623,7 +696,7 @@ png_push_crc_finish(png_structp png_ptr)
} }
} }
void PNGAPI void PNGCBAPI
png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length) png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
{ {
png_bytep ptr; png_bytep ptr;
@@ -638,6 +711,7 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
if (length < png_ptr->save_buffer_size) if (length < png_ptr->save_buffer_size)
save_size = length; save_size = length;
else else
save_size = png_ptr->save_buffer_size; save_size = png_ptr->save_buffer_size;
@@ -678,28 +752,35 @@ png_push_save_buffer(png_structp png_ptr)
istop = png_ptr->save_buffer_size; istop = png_ptr->save_buffer_size;
for (i = 0, sp = png_ptr->save_buffer_ptr, dp = png_ptr->save_buffer; for (i = 0, sp = png_ptr->save_buffer_ptr, dp = png_ptr->save_buffer;
i < istop; i++, sp++, dp++) i < istop; i++, sp++, dp++)
{ {
*dp = *sp; *dp = *sp;
} }
} }
} }
if (png_ptr->save_buffer_size + png_ptr->current_buffer_size > if (png_ptr->save_buffer_size + png_ptr->current_buffer_size >
png_ptr->save_buffer_max) png_ptr->save_buffer_max)
{ {
png_size_t new_max; png_size_t new_max;
png_bytep old_buffer; png_bytep old_buffer;
if (png_ptr->save_buffer_size > PNG_SIZE_MAX - if (png_ptr->save_buffer_size > PNG_SIZE_MAX -
(png_ptr->current_buffer_size + 256)) (png_ptr->current_buffer_size + 256))
{ {
png_error(png_ptr, "Potential overflow of save_buffer"); png_error(png_ptr, "Potential overflow of save_buffer");
} }
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_warn(png_ptr,
(png_size_t)new_max); (png_size_t)new_max);
if (png_ptr->save_buffer == NULL)
{
png_free(png_ptr, old_buffer);
png_error(png_ptr, "Insufficient memory for save_buffer");
}
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;
@@ -748,8 +829,10 @@ png_push_read_IDAT(png_structp png_ptr)
if (png_memcmp(png_ptr->chunk_name, 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))
png_error(png_ptr, "Not enough compressed data"); png_error(png_ptr, "Not enough compressed data");
return; return;
} }
@@ -757,49 +840,52 @@ png_push_read_IDAT(png_structp png_ptr)
} }
if (png_ptr->idat_size && png_ptr->save_buffer_size) if (png_ptr->idat_size && png_ptr->save_buffer_size)
{ {
png_size_t save_size; png_size_t save_size = png_ptr->save_buffer_size;
png_uint_32 idat_size = png_ptr->idat_size;
if (png_ptr->idat_size < (png_uint_32)png_ptr->save_buffer_size) /* We want the smaller of 'idat_size' and 'current_buffer_size', but they
{ * are of different types and we don't know which variable has the fewest
save_size = (png_size_t)png_ptr->idat_size; * bits. Carefully select the smaller and cast it to the type of the
* larger - this cannot overflow. Do not cast in the following test - it
* will break on either 16 or 64 bit platforms.
*/
if (idat_size < save_size)
save_size = (png_size_t)idat_size;
/* Check for overflow */
if ((png_uint_32)save_size != png_ptr->idat_size)
png_error(png_ptr, "save_size overflowed in pngpread");
}
else else
save_size = png_ptr->save_buffer_size; idat_size = (png_uint_32)save_size;
png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size); png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size);
if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED)) png_process_IDAT_data(png_ptr, png_ptr->save_buffer_ptr, save_size);
png_process_IDAT_data(png_ptr, png_ptr->save_buffer_ptr, save_size);
png_ptr->idat_size -= save_size; png_ptr->idat_size -= idat_size;
png_ptr->buffer_size -= save_size; png_ptr->buffer_size -= save_size;
png_ptr->save_buffer_size -= save_size; png_ptr->save_buffer_size -= save_size;
png_ptr->save_buffer_ptr += save_size; png_ptr->save_buffer_ptr += save_size;
} }
if (png_ptr->idat_size && png_ptr->current_buffer_size) if (png_ptr->idat_size && png_ptr->current_buffer_size)
{ {
png_size_t save_size; png_size_t save_size = png_ptr->current_buffer_size;
png_uint_32 idat_size = png_ptr->idat_size;
if (png_ptr->idat_size < (png_uint_32)png_ptr->current_buffer_size) /* We want the smaller of 'idat_size' and 'current_buffer_size', but they
{ * are of different types and we don't know which variable has the fewest
save_size = (png_size_t)png_ptr->idat_size; * bits. Carefully select the smaller and cast it to the type of the
* larger - this cannot overflow.
*/
if (idat_size < save_size)
save_size = (png_size_t)idat_size;
/* Check for overflow */
if ((png_uint_32)save_size != png_ptr->idat_size)
png_error(png_ptr, "save_size overflowed in pngpread");
}
else else
save_size = png_ptr->current_buffer_size; idat_size = (png_uint_32)save_size;
png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size); png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size);
if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED))
png_process_IDAT_data(png_ptr, png_ptr->current_buffer_ptr, save_size);
png_ptr->idat_size -= save_size; png_process_IDAT_data(png_ptr, png_ptr->current_buffer_ptr, save_size);
png_ptr->idat_size -= idat_size;
png_ptr->buffer_size -= save_size; png_ptr->buffer_size -= save_size;
png_ptr->current_buffer_size -= save_size; png_ptr->current_buffer_size -= save_size;
png_ptr->current_buffer_ptr += save_size; png_ptr->current_buffer_ptr += save_size;
@@ -822,60 +908,104 @@ void /* PRIVATE */
png_process_IDAT_data(png_structp png_ptr, png_bytep buffer, png_process_IDAT_data(png_structp png_ptr, png_bytep buffer,
png_size_t buffer_length) png_size_t buffer_length)
{ {
int ret; /* The caller checks for a non-zero buffer length. */
if (!(buffer_length > 0) || buffer == NULL)
if ((png_ptr->flags & PNG_FLAG_ZLIB_FINISHED) && buffer_length) png_error(png_ptr, "No IDAT data (internal error)");
png_benign_error(png_ptr, "Extra compression data");
/* This routine must process all the data it has been given
* before returning, calling the row callback as required to
* handle the uncompressed results.
*/
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 (;;)
/* Keep going until the decompressed data is all processed
* or the stream marked as finished.
*/
while (png_ptr->zstream.avail_in > 0 &&
!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED))
{ {
ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH); int ret;
if (ret != Z_OK)
/* We have data for zlib, but we must check that zlib
* has someplace to put the results. It doesn't matter
* if we don't expect any results -- it may be the input
* data is just the LZ end code.
*/
if (!(png_ptr->zstream.avail_out > 0))
{ {
if (ret == Z_STREAM_END) png_ptr->zstream.avail_out =
{ (uInt) PNG_ROWBYTES(png_ptr->pixel_depth,
if (png_ptr->zstream.avail_in) png_ptr->iwidth) + 1;
png_benign_error(png_ptr, "Extra compressed data");
if (!(png_ptr->zstream.avail_out))
{
png_push_process_row(png_ptr);
}
png_ptr->mode |= PNG_AFTER_IDAT;
png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
break;
}
else if (ret == Z_BUF_ERROR)
break;
else
png_error(png_ptr, "Decompression Error");
}
if (!(png_ptr->zstream.avail_out))
{
if ((
#ifdef PNG_READ_INTERLACING_SUPPORTED
png_ptr->interlaced && png_ptr->pass > 6) ||
(!png_ptr->interlaced &&
#endif
png_ptr->row_number == png_ptr->num_rows))
{
if (png_ptr->zstream.avail_in)
png_warning(png_ptr, "Too much data in IDAT chunks");
png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
break;
}
png_push_process_row(png_ptr);
png_ptr->zstream.avail_out = (uInt)png_ptr->irowbytes;
png_ptr->zstream.next_out = png_ptr->row_buf; png_ptr->zstream.next_out = png_ptr->row_buf;
} }
else /* Using Z_SYNC_FLUSH here means that an unterminated
break; * LZ stream (a stream with a missing end code) can still
* be handled, otherwise (Z_NO_FLUSH) a future zlib
* implementation might defer output and therefore
* change the current behavior (see comments in inflate.c
* for why this doesn't happen at present with zlib 1.2.5).
*/
ret = inflate(&png_ptr->zstream, Z_SYNC_FLUSH);
/* Check for any failure before proceeding. */
if (ret != Z_OK && ret != Z_STREAM_END)
{
/* Terminate the decompression. */
png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
/* This may be a truncated stream (missing or
* damaged end code). Treat that as a warning.
*/
if (png_ptr->row_number >= png_ptr->num_rows ||
png_ptr->pass > 6)
png_warning(png_ptr, "Truncated compressed data in IDAT");
else
png_error(png_ptr, "Decompression error in IDAT");
/* Skip the check on unprocessed input */
return;
}
/* Did inflate output any data? */
if (png_ptr->zstream.next_out != png_ptr->row_buf)
{
/* Is this unexpected data after the last row?
* If it is, artificially terminate the LZ output
* here.
*/
if (png_ptr->row_number >= png_ptr->num_rows ||
png_ptr->pass > 6)
{
/* Extra data. */
png_warning(png_ptr, "Extra compressed data in IDAT");
png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
/* Do no more processing; skip the unprocessed
* input check below.
*/
return;
}
/* Do we have a complete row? */
if (png_ptr->zstream.avail_out == 0)
png_push_process_row(png_ptr);
}
/* And check for the end of the stream. */
if (ret == Z_STREAM_END)
png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
} }
/* All the data should have been processed, if anything
* is left at this point we have bytes of IDAT data
* after the zlib end code.
*/
if (png_ptr->zstream.avail_in > 0)
png_warning(png_ptr, "Extra compression data in IDAT");
} }
void /* PRIVATE */ void /* PRIVATE */
@@ -891,13 +1021,15 @@ png_push_process_row(png_structp png_ptr)
png_ptr->row_info.width); png_ptr->row_info.width);
png_read_filter_row(png_ptr, &(png_ptr->row_info), png_read_filter_row(png_ptr, &(png_ptr->row_info),
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(png_ptr->prev_row, png_ptr->row_buf, png_ptr->rowbytes + 1); png_memcpy(png_ptr->prev_row, png_ptr->row_buf, png_ptr->rowbytes + 1);
if (png_ptr->transformations || (png_ptr->flags&PNG_FLAG_STRIP_ALPHA)) #ifdef PNG_READ_TRANSFORMS_SUPPORTED
if (png_ptr->transformations)
png_do_read_transformations(png_ptr); png_do_read_transformations(png_ptr);
#endif
#ifdef PNG_READ_INTERLACING_SUPPORTED #ifdef PNG_READ_INTERLACING_SUPPORTED
/* Blow up interlaced rows to full size */ /* Blow up interlaced rows to full size */
@@ -906,7 +1038,7 @@ png_push_process_row(png_structp png_ptr)
if (png_ptr->pass < 6) if (png_ptr->pass < 6)
/* old interface (pre-1.0.9): /* old interface (pre-1.0.9):
png_do_read_interlace(&(png_ptr->row_info), png_do_read_interlace(&(png_ptr->row_info),
png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations); png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations);
*/ */
png_do_read_interlace(png_ptr); png_do_read_interlace(png_ptr);
@@ -1062,6 +1194,8 @@ png_push_process_row(png_structp png_ptr)
break; break;
} }
default:
case 6: case 6:
{ {
png_push_have_row(png_ptr, png_ptr->row_buf + 1); png_push_have_row(png_ptr, png_ptr->row_buf + 1);
@@ -1113,15 +1247,15 @@ 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(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++;
if ((png_ptr->pass == 1 && png_ptr->width < 5) || if ((png_ptr->pass == 1 && png_ptr->width < 5) ||
(png_ptr->pass == 3 && png_ptr->width < 3) || (png_ptr->pass == 3 && png_ptr->width < 3) ||
(png_ptr->pass == 5 && png_ptr->width < 2)) (png_ptr->pass == 5 && png_ptr->width < 2))
png_ptr->pass++; png_ptr->pass++;
if (png_ptr->pass > 7) if (png_ptr->pass > 7)
png_ptr->pass--; png_ptr->pass--;
@@ -1130,20 +1264,17 @@ png_read_push_finish_row(png_structp png_ptr)
break; break;
png_ptr->iwidth = (png_ptr->width + png_ptr->iwidth = (png_ptr->width +
png_pass_inc[png_ptr->pass] - 1 - png_pass_inc[png_ptr->pass] - 1 -
png_pass_start[png_ptr->pass]) / png_pass_start[png_ptr->pass]) /
png_pass_inc[png_ptr->pass]; png_pass_inc[png_ptr->pass];
png_ptr->irowbytes = PNG_ROWBYTES(png_ptr->pixel_depth,
png_ptr->iwidth) + 1;
if (png_ptr->transformations & PNG_INTERLACE) if (png_ptr->transformations & PNG_INTERLACE)
break; break;
png_ptr->num_rows = (png_ptr->height + png_ptr->num_rows = (png_ptr->height +
png_pass_yinc[png_ptr->pass] - 1 - png_pass_yinc[png_ptr->pass] - 1 -
png_pass_ystart[png_ptr->pass]) / png_pass_ystart[png_ptr->pass]) /
png_pass_yinc[png_ptr->pass]; png_pass_yinc[png_ptr->pass];
} while (png_ptr->iwidth == 0 || png_ptr->num_rows == 0); } while (png_ptr->iwidth == 0 || png_ptr->num_rows == 0);
} }
@@ -1153,12 +1284,13 @@ png_read_push_finish_row(png_structp png_ptr)
#ifdef PNG_READ_tEXt_SUPPORTED #ifdef PNG_READ_tEXt_SUPPORTED
void /* PRIVATE */ void /* PRIVATE */
png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
length) length)
{ {
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_UNUSED(info_ptr) /* To quiet some compiler warnings */
png_error(png_ptr, "Out of place tEXt"); png_error(png_ptr, "Out of place tEXt");
info_ptr = info_ptr; /* To quiet some compiler warnings */ /* NOT REACHED */
} }
#ifdef PNG_MAX_MALLOC_64K #ifdef PNG_MAX_MALLOC_64K
@@ -1173,7 +1305,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_size_t)(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;
@@ -1226,14 +1358,12 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
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_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 text_ptr->itxt_length = 0;
text_ptr->lang = NULL; text_ptr->lang = NULL;
text_ptr->lang_key = NULL; text_ptr->lang_key = NULL;
#endif
text_ptr->text = text; text_ptr->text = text;
ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1); ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1);
@@ -1243,7 +1373,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
@@ -1254,10 +1384,11 @@ png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
length) length)
{ {
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_UNUSED(info_ptr) /* To quiet some compiler warnings */
info_ptr = info_ptr; /* To quiet some compiler warnings */ png_error(png_ptr, "Out of place zTXt");
} /* NOT REACHED */
}
#ifdef PNG_MAX_MALLOC_64K #ifdef PNG_MAX_MALLOC_64K
/* We can't handle zTXt chunks > 64K, since we don't have enough space /* We can't handle zTXt chunks > 64K, since we don't have enough space
@@ -1273,7 +1404,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_size_t)(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;
@@ -1338,9 +1469,9 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
text++; text++;
png_ptr->zstream.next_in = (png_bytep )text; png_ptr->zstream.next_in = (png_bytep)text;
png_ptr->zstream.avail_in = (uInt)(png_ptr->current_text_size - png_ptr->zstream.avail_in = (uInt)(png_ptr->current_text_size -
(text - key)); (text - key));
png_ptr->zstream.next_out = png_ptr->zbuf; png_ptr->zstream.next_out = png_ptr->zbuf;
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
@@ -1361,42 +1492,45 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
png_free(png_ptr, text); png_free(png_ptr, text);
return; return;
} }
if (!(png_ptr->zstream.avail_out) || ret == Z_STREAM_END) if (!(png_ptr->zstream.avail_out) || ret == Z_STREAM_END)
{ {
if (text == NULL) if (text == NULL)
{ {
text = (png_charp)png_malloc(png_ptr, text = (png_charp)png_malloc(png_ptr,
(png_ptr->zbuf_size (png_ptr->zbuf_size
- png_ptr->zstream.avail_out + 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);
text_size = key_size + png_ptr->zbuf_size - text_size = key_size + png_ptr->zbuf_size -
png_ptr->zstream.avail_out; png_ptr->zstream.avail_out;
*(text + text_size) = '\0'; *(text + text_size) = '\0';
} }
else else
{ {
png_charp tmp; png_charp tmp;
tmp = text; tmp = text;
text = (png_charp)png_malloc(png_ptr, text_size + text = (png_charp)png_malloc(png_ptr, text_size +
(png_ptr->zbuf_size (png_ptr->zbuf_size
- png_ptr->zstream.avail_out + 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,
png_ptr->zbuf_size - png_ptr->zstream.avail_out); png_ptr->zbuf_size - png_ptr->zstream.avail_out);
text_size += png_ptr->zbuf_size - png_ptr->zstream.avail_out; text_size += png_ptr->zbuf_size - png_ptr->zstream.avail_out;
*(text + text_size) = '\0'; *(text + text_size) = '\0';
} }
if (ret != Z_STREAM_END) if (ret != Z_STREAM_END)
{ {
png_ptr->zstream.next_out = png_ptr->zbuf; png_ptr->zstream.next_out = png_ptr->zbuf;
@@ -1432,10 +1566,9 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
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 text_ptr->itxt_length = 0;
text_ptr->lang = NULL; text_ptr->lang = NULL;
text_ptr->lang_key = NULL; text_ptr->lang_key = NULL;
#endif
text_ptr->text = text; text_ptr->text = text;
ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1); ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1);
@@ -1444,7 +1577,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
@@ -1452,13 +1585,14 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
#ifdef PNG_READ_iTXt_SUPPORTED #ifdef PNG_READ_iTXt_SUPPORTED
void /* PRIVATE */ void /* PRIVATE */
png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
length) length)
{ {
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_UNUSED(info_ptr) /* To quiet some compiler warnings */
info_ptr = info_ptr; /* To quiet some compiler warnings */ png_error(png_ptr, "Out of place iTXt");
} /* NOT REACHED */
}
#ifdef PNG_MAX_MALLOC_64K #ifdef PNG_MAX_MALLOC_64K
png_ptr->skip_length = 0; /* This may not be necessary */ png_ptr->skip_length = 0; /* This may not be necessary */
@@ -1472,7 +1606,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_size_t)(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;
@@ -1498,6 +1632,7 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
png_ptr->current_text_left -= text_size; png_ptr->current_text_left -= text_size;
png_ptr->current_text_ptr += text_size; png_ptr->current_text_ptr += text_size;
} }
if (!(png_ptr->current_text_left)) if (!(png_ptr->current_text_left))
{ {
png_textp text_ptr; png_textp text_ptr;
@@ -1541,15 +1676,15 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
if (lang_key < key + png_ptr->current_text_size - 1) if (lang_key < key + png_ptr->current_text_size - 1)
{ {
for (; *text; text++) for (; *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_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;
@@ -1576,7 +1711,7 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
*/ */
void /* PRIVATE */ 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;
@@ -1584,15 +1719,15 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
{ {
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED #ifdef 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
#ifdef PNG_READ_USER_CHUNKS_SUPPORTED #ifdef 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");
info_ptr = info_ptr; /* To quiet some compiler warnings */ PNG_UNUSED(info_ptr) /* To quiet some compiler warnings */
} }
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED #ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
@@ -1601,16 +1736,16 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
#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_memcpy((png_charp)png_ptr->unknown_chunk.name,
(png_charp)png_ptr->chunk_name, (png_charp)png_ptr->chunk_name,
png_sizeof(png_ptr->unknown_chunk.name)); png_sizeof(png_ptr->unknown_chunk.name));
png_ptr->unknown_chunk.name[png_sizeof(png_ptr->unknown_chunk.name) - 1] png_ptr->unknown_chunk.name[png_sizeof(png_ptr->unknown_chunk.name) - 1]
= '\0'; = '\0';
png_ptr->unknown_chunk.size = (png_size_t)length; png_ptr->unknown_chunk.size = (png_size_t)length;
@@ -1620,7 +1755,7 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
else else
{ {
png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr, png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr,
(png_size_t)length); (png_size_t)length);
png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length); png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length);
} }
@@ -1630,7 +1765,7 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
/* Callback to user unknown chunk handler */ /* Callback to user unknown chunk handler */
int ret; int ret;
ret = (*(png_ptr->read_user_chunk_fn)) ret = (*(png_ptr->read_user_chunk_fn))
(png_ptr, &png_ptr->unknown_chunk); (png_ptr, &png_ptr->unknown_chunk);
if (ret < 0) if (ret < 0)
png_chunk_error(png_ptr, "error in user chunk"); png_chunk_error(png_ptr, "error in user chunk");
@@ -1639,16 +1774,16 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
{ {
if (!(png_ptr->chunk_name[0] & 0x20)) if (!(png_ptr->chunk_name[0] & 0x20))
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)
png_chunk_error(png_ptr, "unknown critical chunk"); png_chunk_error(png_ptr, "unknown critical chunk");
png_set_unknown_chunks(png_ptr, info_ptr, png_set_unknown_chunks(png_ptr, info_ptr,
&png_ptr->unknown_chunk, 1); &png_ptr->unknown_chunk, 1);
} }
} }
else else
#endif #endif
png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1); png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1);
png_free(png_ptr, png_ptr->unknown_chunk.data); png_free(png_ptr, png_ptr->unknown_chunk.data);
png_ptr->unknown_chunk.data = NULL; png_ptr->unknown_chunk.data = NULL;
} }
@@ -1682,8 +1817,8 @@ png_push_have_row(png_structp png_ptr, png_bytep row)
} }
void PNGAPI void PNGAPI
png_progressive_combine_row (png_structp png_ptr, png_progressive_combine_row (png_structp png_ptr, png_bytep old_row,
png_bytep old_row, png_bytep new_row) png_const_bytep new_row)
{ {
PNG_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};
@@ -1697,8 +1832,8 @@ png_progressive_combine_row (png_structp png_ptr,
void PNGAPI void PNGAPI
png_set_progressive_read_fn(png_structp png_ptr, png_voidp progressive_ptr, 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) if (png_ptr == NULL)
return; return;
@@ -1711,7 +1846,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_const_structp png_ptr)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
return (NULL); return (NULL);

1209
pngpriv.h

File diff suppressed because it is too large Load Diff

429
pngread.c

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,8 @@
/* pngrio.c - functions for data input /* pngrio.c - functions for data input
* *
* Last changed in libpng 1.4.0 [January 2, 2010] * Last changed in libpng 1.5.0 [January 6, 2011]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson * Copyright (c) 1998-2011 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.)
* *
@@ -18,11 +18,10 @@
* libpng use it at run time with png_set_read_fn(...). * libpng use it at run time with png_set_read_fn(...).
*/ */
#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#ifdef PNG_READ_SUPPORTED
#include "pngpriv.h" #include "pngpriv.h"
#ifdef PNG_READ_SUPPORTED
/* Read the data from whatever input you are using. The default routine /* Read the data from whatever input you are using. The default routine
* reads from a file pointer. Note that this routine sometimes gets called * reads from a file pointer. Note that this routine sometimes gets called
* with very small lengths, so you should implement some kind of simple * with very small lengths, so you should implement some kind of simple
@@ -36,6 +35,7 @@ png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
if (png_ptr->read_data_fn != NULL) if (png_ptr->read_data_fn != NULL)
(*(png_ptr->read_data_fn))(png_ptr, data, length); (*(png_ptr->read_data_fn))(png_ptr, data, length);
else else
png_error(png_ptr, "Call to NULL read function"); png_error(png_ptr, "Call to NULL read function");
} }
@@ -46,14 +46,15 @@ png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
* read_data function and use it at run time with png_set_read_fn(), rather * read_data function and use it at run time with png_set_read_fn(), rather
* than changing the library. * than changing the library.
*/ */
#ifndef USE_FAR_KEYWORD # ifndef USE_FAR_KEYWORD
void PNGAPI void PNGCBAPI
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length) png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{ {
png_size_t check; png_size_t check;
if (png_ptr == NULL) if (png_ptr == NULL)
return; 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.
*/ */
@@ -62,7 +63,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
if (check != length) if (check != length)
png_error(png_ptr, "Read Error"); png_error(png_ptr, "Read Error");
} }
#else # else
/* This is the model-independent version. Since the standard I/O library /* This is the model-independent version. Since the standard I/O library
can't handle far buffers in the medium and small models, we have to copy can't handle far buffers in the medium and small models, we have to copy
the data. the data.
@@ -71,7 +72,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
#define NEAR_BUF_SIZE 1024 #define NEAR_BUF_SIZE 1024
#define MIN(a,b) (a <= b ? a : b) #define MIN(a,b) (a <= b ? a : b)
static void PNGAPI static void PNGCBAPI
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length) png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{ {
png_size_t check; png_size_t check;
@@ -80,46 +81,57 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
if (png_ptr == NULL) if (png_ptr == NULL)
return; 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)
{ {
check = fread(n_data, 1, length, io_ptr); check = fread(n_data, 1, length, io_ptr);
} }
else else
{ {
png_byte buf[NEAR_BUF_SIZE]; png_byte buf[NEAR_BUF_SIZE];
png_size_t read, remaining, err; png_size_t read, remaining, err;
check = 0; check = 0;
remaining = length; remaining = length;
do do
{ {
read = MIN(NEAR_BUF_SIZE, remaining); read = MIN(NEAR_BUF_SIZE, remaining);
err = fread(buf, 1, read, io_ptr); err = fread(buf, 1, read, io_ptr);
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;
data += read; data += read;
remaining -= read; remaining -= read;
} }
while (remaining != 0); while (remaining != 0);
} }
if ((png_uint_32)check != (png_uint_32)length) if ((png_uint_32)check != (png_uint_32)length)
png_error(png_ptr, "read Error"); png_error(png_ptr, "read Error");
} }
#endif # endif
#endif #endif
/* This function allows the application to supply a new input function /* This function allows the application to supply a new input function
* for libpng if standard C streams aren't being used. * for libpng if standard C streams aren't being used.
* *
* This function takes as its arguments: * This function takes as its arguments:
*
* png_ptr - pointer to a png input data structure * png_ptr - pointer to a png input data structure
*
* io_ptr - pointer to user supplied structure containing info about * io_ptr - pointer to user supplied structure containing info about
* the input functions. May be NULL. * the input functions. May be NULL.
*
* read_data_fn - pointer to a new input function that takes as its * read_data_fn - pointer to a new input function that takes as its
* arguments a pointer to a png_struct, a pointer to * arguments a pointer to a png_struct, a pointer to
* a location where input data can be stored, and a 32-bit * a location where input data can be stored, and a 32-bit
@@ -135,11 +147,13 @@ png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
png_ptr->io_ptr = io_ptr; png_ptr->io_ptr = io_ptr;
#ifdef PNG_STDIO_SUPPORTED #ifdef PNG_STDIO_SUPPORTED
if (read_data_fn != NULL) if (read_data_fn != NULL)
png_ptr->read_data_fn = read_data_fn; png_ptr->read_data_fn = read_data_fn;
else else
png_ptr->read_data_fn = png_default_read_data; png_ptr->read_data_fn = png_default_read_data;
#else #else
@@ -151,9 +165,8 @@ png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
{ {
png_ptr->write_data_fn = NULL; png_ptr->write_data_fn = NULL;
png_warning(png_ptr, png_warning(png_ptr,
"It's an error to set both read_data_fn and write_data_fn in the "); "Can't set both read_data_fn and write_data_fn in the"
png_warning(png_ptr, " same structure");
"same structure. Resetting write_data_fn to NULL");
} }
#ifdef PNG_WRITE_FLUSH_SUPPORTED #ifdef PNG_WRITE_FLUSH_SUPPORTED

3531
pngrtran.c

File diff suppressed because it is too large Load Diff

1862
pngrutil.c

File diff suppressed because it is too large Load Diff

749
pngset.c

File diff suppressed because it is too large Load Diff

344
pngstruct.h Normal file
View File

@@ -0,0 +1,344 @@
/* pngstruct.h - header file for PNG reference library
*
* Copyright (c) 1998-2011 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.)
*
* Last changed in libpng 1.5.5 [(PENDING RELEASE)]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/
/* The structure that holds the information to read and write PNG files.
* The only people who need to care about what is inside of this are the
* people who will be modifying the library for their own special needs.
* It should NOT be accessed directly by an application.
*/
#ifndef PNGSTRUCT_H
#define PNGSTRUCT_H
/* zlib.h defines the structure z_stream, an instance of which is included
* in this structure and is required for decompressing the LZ compressed
* data in PNG files.
*/
#include "zlib.h"
struct png_struct_def
{
#ifdef PNG_SETJMP_SUPPORTED
jmp_buf longjmp_buffer; /* used in png_error */
png_longjmp_ptr longjmp_fn;/* setjmp non-local goto function. */
#endif
png_error_ptr error_fn; /* function for printing errors and aborting */
#ifdef PNG_WARNINGS_SUPPORTED
png_error_ptr warning_fn; /* function for printing warnings */
#endif
png_voidp error_ptr; /* user supplied struct for error functions */
png_rw_ptr write_data_fn; /* function for writing output data */
png_rw_ptr read_data_fn; /* function for reading input data */
png_voidp io_ptr; /* ptr to application struct for I/O functions */
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
png_user_transform_ptr read_user_transform_fn; /* user read transform */
#endif
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
png_user_transform_ptr write_user_transform_fn; /* user write transform */
#endif
/* These were added in libpng-1.0.2 */
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
png_voidp user_transform_ptr; /* user supplied struct for user transform */
png_byte user_transform_depth; /* bit depth of user transformed pixels */
png_byte user_transform_channels; /* channels in user transformed pixels */
#endif
#endif
png_uint_32 mode; /* tells us where we are in the PNG file */
png_uint_32 flags; /* flags indicating various things to libpng */
png_uint_32 transformations; /* which transformations to perform */
z_stream zstream; /* pointer to decompression structure (below) */
png_bytep zbuf; /* buffer for zlib */
uInt zbuf_size; /* size of zbuf (typically 65536) */
#ifdef PNG_WRITE_SUPPORTED
/* Added in 1.5.4: state to keep track of whether the zstream has been
* initialized and if so whether it is for IDAT or some other chunk.
*/
#define PNG_ZLIB_UNINITIALIZED 0
#define PNG_ZLIB_FOR_IDAT 1
#define PNG_ZLIB_FOR_TEXT 2 /* anything other than IDAT */
#define PNG_ZLIB_USE_MASK 3 /* bottom two bits */
#define PNG_ZLIB_IN_USE 4 /* a flag value */
png_uint_32 zlib_state; /* State of zlib initialization */
/* End of material added at libpng 1.5.4 */
int zlib_level; /* holds zlib compression level */
int zlib_method; /* holds zlib compression method */
int zlib_window_bits; /* holds zlib compression window bits */
int zlib_mem_level; /* holds zlib compression memory level */
int zlib_strategy; /* holds zlib compression strategy */
#endif
/* Added at libpng 1.5.4 */
#if defined(PNG_WRITE_COMPRESSED_TEXT_SUPPORTED) || \
defined(PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED)
int zlib_text_level; /* holds zlib compression level */
int zlib_text_method; /* holds zlib compression method */
int zlib_text_window_bits; /* holds zlib compression window bits */
int zlib_text_mem_level; /* holds zlib compression memory level */
int zlib_text_strategy; /* holds zlib compression strategy */
#endif
/* End of material added at libpng 1.5.4 */
png_uint_32 width; /* width of image in pixels */
png_uint_32 height; /* height of image in pixels */
png_uint_32 num_rows; /* number of rows in current pass */
png_uint_32 usr_width; /* width of row at start of write */
png_size_t rowbytes; /* size of row in bytes */
png_uint_32 iwidth; /* width of current interlaced row in pixels */
png_uint_32 row_number; /* current row in interlace pass */
png_bytep prev_row; /* buffer to save previous (unfiltered) row */
png_bytep row_buf; /* buffer to save current (unfiltered) row */
png_bytep sub_row; /* buffer to save "sub" row when filtering */
png_bytep up_row; /* buffer to save "up" row when filtering */
png_bytep avg_row; /* buffer to save "avg" row when filtering */
png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */
png_row_info row_info; /* used for transformation routines */
png_size_t info_rowbytes; /* Added in 1.5.4: cache of updated row bytes */
png_uint_32 idat_size; /* current IDAT size for read */
png_uint_32 crc; /* current chunk CRC value */
png_colorp palette; /* palette from the input file */
png_uint_16 num_palette; /* number of color entries in palette */
png_uint_16 num_trans; /* number of transparency values */
png_byte chunk_name[5]; /* null-terminated name of current chunk */
png_byte compression; /* file compression type (always 0) */
png_byte filter; /* file filter type (always 0) */
png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
png_byte pass; /* current interlace pass (0 - 6) */
png_byte do_filter; /* row filter flags (see PNG_FILTER_ below ) */
png_byte color_type; /* color type of file */
png_byte bit_depth; /* bit depth of file */
png_byte usr_bit_depth; /* bit depth of users row */
png_byte pixel_depth; /* number of bits per pixel */
png_byte channels; /* number of channels in file */
png_byte usr_channels; /* channels at start of write */
png_byte sig_bytes; /* magic bytes read/written from start of file */
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
png_uint_16 filler; /* filler bytes for pixel expansion */
#endif
#if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
defined(PNG_READ_ALPHA_MODE_SUPPORTED)
png_byte background_gamma_type;
png_fixed_point background_gamma;
png_color_16 background; /* background color in screen gamma space */
#ifdef PNG_READ_GAMMA_SUPPORTED
png_color_16 background_1; /* background normalized to gamma 1.0 */
#endif
#endif /* PNG_bKGD_SUPPORTED */
#ifdef PNG_WRITE_FLUSH_SUPPORTED
png_flush_ptr output_flush_fn; /* Function for flushing output */
png_uint_32 flush_dist; /* how many rows apart to flush, 0 - no flush */
png_uint_32 flush_rows; /* number of rows written since last flush */
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
int gamma_shift; /* number of "insignificant" bits in 16-bit gamma */
png_fixed_point gamma; /* file gamma value */
png_fixed_point screen_gamma; /* screen gamma value (display_exponent) */
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
png_bytep gamma_table; /* gamma table for 8-bit depth files */
png_bytep gamma_from_1; /* converts from 1.0 to screen */
png_bytep gamma_to_1; /* converts from file to 1.0 */
png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */
png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */
png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED)
png_color_8 sig_bit; /* significant bits in each available channel */
#endif
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
png_color_8 shift; /* shift for significant bit tranformation */
#endif
#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \
|| defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
png_bytep trans_alpha; /* alpha values for paletted files */
png_color_16 trans_color; /* transparent color for non-paletted files */
#endif
png_read_status_ptr read_row_fn; /* called after each row is decoded */
png_write_status_ptr write_row_fn; /* called after each row is encoded */
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
png_progressive_info_ptr info_fn; /* called after header data fully read */
png_progressive_row_ptr row_fn; /* called after a prog. row is decoded */
png_progressive_end_ptr end_fn; /* called after image is complete */
png_bytep save_buffer_ptr; /* current location in save_buffer */
png_bytep save_buffer; /* buffer for previously read data */
png_bytep current_buffer_ptr; /* current location in current_buffer */
png_bytep current_buffer; /* buffer for recently used data */
png_uint_32 push_length; /* size of current input chunk */
png_uint_32 skip_length; /* bytes to skip in input data */
png_size_t save_buffer_size; /* amount of data now in save_buffer */
png_size_t save_buffer_max; /* total size of save_buffer */
png_size_t buffer_size; /* total amount of available input data */
png_size_t current_buffer_size; /* amount of data now in current_buffer */
int process_mode; /* what push library is currently doing */
int cur_palette; /* current push library palette index */
# ifdef PNG_TEXT_SUPPORTED
png_size_t current_text_size; /* current size of text input data */
png_size_t current_text_left; /* how much text left to read in input */
png_charp current_text; /* current text chunk buffer */
png_charp current_text_ptr; /* current location in current_text */
# endif /* PNG_PROGRESSIVE_READ_SUPPORTED && PNG_TEXT_SUPPORTED */
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
/* For the Borland special 64K segment handler */
png_bytepp offset_table_ptr;
png_bytep offset_table;
png_uint_16 offset_table_number;
png_uint_16 offset_table_count;
png_uint_16 offset_table_count_free;
#endif
#ifdef PNG_READ_QUANTIZE_SUPPORTED
png_bytep palette_lookup; /* lookup table for quantizing */
png_bytep quantize_index; /* index translation for palette files */
#endif
#if defined(PNG_READ_QUANTIZE_SUPPORTED) || defined(PNG_hIST_SUPPORTED)
png_uint_16p hist; /* histogram */
#endif
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
png_byte heuristic_method; /* heuristic for row filter selection */
png_byte num_prev_filters; /* number of weights for previous rows */
png_bytep prev_filters; /* filter type(s) of previous row(s) */
png_uint_16p filter_weights; /* weight(s) for previous line(s) */
png_uint_16p inv_filter_weights; /* 1/weight(s) for previous line(s) */
png_uint_16p filter_costs; /* relative filter calculation cost */
png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */
#endif
#ifdef PNG_TIME_RFC1123_SUPPORTED
char time_buffer[29]; /* String to hold RFC 1123 time text */
#endif
/* New members added in libpng-1.0.6 */
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
#ifdef PNG_USER_CHUNKS_SUPPORTED
png_voidp user_chunk_ptr;
png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
#endif
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
int num_chunk_list;
png_bytep chunk_list;
#endif
#ifdef PNG_READ_sRGB_SUPPORTED
/* Added in 1.5.5 to record an sRGB chunk in the png. */
png_byte is_sRGB;
#endif
/* New members added in libpng-1.0.3 */
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
png_byte rgb_to_gray_status;
/* Added in libpng 1.5.5 to record setting of coefficients: */
png_byte rgb_to_gray_coefficients_set;
/* These were changed from png_byte in libpng-1.0.6 */
png_uint_16 rgb_to_gray_red_coeff;
png_uint_16 rgb_to_gray_green_coeff;
/* deleted in 1.5.5: rgb_to_gray_blue_coeff; */
#endif
/* New member added in libpng-1.0.4 (renamed in 1.0.9) */
#if defined(PNG_MNG_FEATURES_SUPPORTED) || \
defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
/* Changed from png_byte to png_uint_32 at version 1.2.0 */
png_uint_32 mng_features_permitted;
#endif
/* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */
#ifdef PNG_MNG_FEATURES_SUPPORTED
png_byte filter_type;
#endif
/* New members added in libpng-1.2.0 */
/* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */
#ifdef PNG_USER_MEM_SUPPORTED
png_voidp mem_ptr; /* user supplied struct for mem functions */
png_malloc_ptr malloc_fn; /* function for allocating memory */
png_free_ptr free_fn; /* function for freeing memory */
#endif
/* New member added in libpng-1.0.13 and 1.2.0 */
png_bytep big_row_buf; /* buffer to save current (unfiltered) row */
#ifdef PNG_READ_QUANTIZE_SUPPORTED
/* The following three members were added at version 1.0.14 and 1.2.4 */
png_bytep quantize_sort; /* working sort array */
png_bytep index_to_palette; /* where the original index currently is
in the palette */
png_bytep palette_to_index; /* which original index points to this
palette color */
#endif
/* New members added in libpng-1.0.16 and 1.2.6 */
png_byte compression_type;
#ifdef PNG_USER_LIMITS_SUPPORTED
png_uint_32 user_width_max;
png_uint_32 user_height_max;
/* Added in libpng-1.4.0: Total number of sPLT, text, and unknown
* chunks that can be stored (0 means unlimited).
*/
png_uint_32 user_chunk_cache_max;
/* Total memory that a zTXt, sPLT, iTXt, iCCP, or unknown chunk
* can occupy when decompressed. 0 means unlimited.
*/
png_alloc_size_t user_chunk_malloc_max;
#endif
/* New member added in libpng-1.0.25 and 1.2.17 */
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
/* Storage for unknown chunk that the library doesn't recognize. */
png_unknown_chunk unknown_chunk;
#endif
/* New members added in libpng-1.2.26 */
png_size_t old_big_row_buf_size;
png_size_t old_prev_row_size;
/* New member added in libpng-1.2.30 */
png_charp chunkdata; /* buffer for reading chunk data */
#ifdef PNG_IO_STATE_SUPPORTED
/* New member added in libpng-1.4.0 */
png_uint_32 io_state;
#endif
};
#endif /* PNGSTRUCT_H */

357
pngtest.c

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

@@ -1,8 +1,8 @@
/* 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.4.0 [January 2, 2010] * Last changed in libpng 1.5.4 [July 7, 2011]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson * Copyright (c) 1998-2011 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.)
* *
@@ -11,11 +11,10 @@
* and license in png.h * and license in png.h
*/ */
#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#include "pngpriv.h" #include "pngpriv.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#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
@@ -25,6 +24,7 @@ png_set_bgr(png_structp png_ptr)
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
png_ptr->transformations |= PNG_BGR; png_ptr->transformations |= PNG_BGR;
} }
#endif #endif
@@ -38,6 +38,7 @@ png_set_swap(png_structp png_ptr)
if (png_ptr == NULL) if (png_ptr == NULL)
return; 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;
} }
@@ -52,6 +53,7 @@ png_set_packing(png_structp png_ptr)
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
if (png_ptr->bit_depth < 8) if (png_ptr->bit_depth < 8)
{ {
png_ptr->transformations |= PNG_PACK; png_ptr->transformations |= PNG_PACK;
@@ -69,6 +71,7 @@ png_set_packswap(png_structp png_ptr)
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
if (png_ptr->bit_depth < 8) if (png_ptr->bit_depth < 8)
png_ptr->transformations |= PNG_PACKSWAP; png_ptr->transformations |= PNG_PACKSWAP;
} }
@@ -76,12 +79,13 @@ png_set_packswap(png_structp png_ptr)
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
void PNGAPI void PNGAPI
png_set_shift(png_structp png_ptr, png_color_8p true_bits) png_set_shift(png_structp png_ptr, png_const_color_8p true_bits)
{ {
png_debug(1, "in png_set_shift"); png_debug(1, "in png_set_shift");
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
png_ptr->transformations |= PNG_SHIFT; png_ptr->transformations |= PNG_SHIFT;
png_ptr->shift = *true_bits; png_ptr->shift = *true_bits;
} }
@@ -117,10 +121,13 @@ png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
png_ptr->transformations |= PNG_FILLER; png_ptr->transformations |= PNG_FILLER;
png_ptr->filler = (png_uint_16)filler; png_ptr->filler = (png_uint_16)filler;
if (filler_loc == PNG_FILLER_AFTER) if (filler_loc == PNG_FILLER_AFTER)
png_ptr->flags |= PNG_FLAG_FILLER_AFTER; png_ptr->flags |= PNG_FLAG_FILLER_AFTER;
else else
png_ptr->flags &= ~PNG_FLAG_FILLER_AFTER; png_ptr->flags &= ~PNG_FLAG_FILLER_AFTER;
@@ -135,7 +142,7 @@ png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
} }
/* Also I added this in libpng-1.0.2a (what happens when we expand /* Also I added this in libpng-1.0.2a (what happens when we expand
* a less-than-8-bit grayscale to GA? */ * a less-than-8-bit grayscale to GA?) */
if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY && png_ptr->bit_depth >= 8) if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY && png_ptr->bit_depth >= 8)
{ {
@@ -151,6 +158,7 @@ png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc)
if (png_ptr == NULL) if (png_ptr == NULL)
return; 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;
} }
@@ -166,6 +174,7 @@ png_set_swap_alpha(png_structp png_ptr)
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
png_ptr->transformations |= PNG_SWAP_ALPHA; png_ptr->transformations |= PNG_SWAP_ALPHA;
} }
#endif #endif
@@ -179,6 +188,7 @@ png_set_invert_alpha(png_structp png_ptr)
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
png_ptr->transformations |= PNG_INVERT_ALPHA; png_ptr->transformations |= PNG_INVERT_ALPHA;
} }
#endif #endif
@@ -191,6 +201,7 @@ png_set_invert_mono(png_structp png_ptr)
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
png_ptr->transformations |= PNG_INVERT_MONO; png_ptr->transformations |= PNG_INVERT_MONO;
} }
@@ -206,8 +217,8 @@ png_do_invert(png_row_infop row_info, png_bytep row)
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;
png_uint_32 i; png_size_t i;
png_uint_32 istop = row_info->rowbytes; png_size_t istop = row_info->rowbytes;
for (i = 0; i < istop; i++) for (i = 0; i < istop; i++)
{ {
@@ -215,36 +226,41 @@ png_do_invert(png_row_infop row_info, png_bytep row)
rp++; rp++;
} }
} }
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA && else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA &&
row_info->bit_depth == 8) row_info->bit_depth == 8)
{ {
png_bytep rp = row; png_bytep rp = row;
png_uint_32 i; png_size_t i;
png_uint_32 istop = row_info->rowbytes; png_size_t istop = row_info->rowbytes;
for (i = 0; i < istop; i+=2) for (i = 0; i < istop; i += 2)
{ {
*rp = (png_byte)(~(*rp)); *rp = (png_byte)(~(*rp));
rp+=2; rp += 2;
} }
} }
#ifdef PNG_16BIT_SUPPORTED
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA && else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA &&
row_info->bit_depth == 16) row_info->bit_depth == 16)
{ {
png_bytep rp = row; png_bytep rp = row;
png_uint_32 i; png_size_t i;
png_uint_32 istop = row_info->rowbytes; png_size_t istop = row_info->rowbytes;
for (i = 0; i < istop; i+=4) for (i = 0; i < istop; i += 4)
{ {
*rp = (png_byte)(~(*rp)); *rp = (png_byte)(~(*rp));
*(rp+1) = (png_byte)(~(*(rp+1))); *(rp + 1) = (png_byte)(~(*(rp + 1)));
rp+=4; rp += 4;
} }
} }
#endif
} }
#endif #endif
#ifdef PNG_16BIT_SUPPORTED
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
/* Swaps byte order on 16 bit depth images */ /* Swaps byte order on 16 bit depth images */
void /* PRIVATE */ void /* PRIVATE */
@@ -252,8 +268,7 @@ png_do_swap(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_swap"); png_debug(1, "in png_do_swap");
if ( if (row_info->bit_depth == 16)
row_info->bit_depth == 16)
{ {
png_bytep rp = row; png_bytep rp = row;
png_uint_32 i; png_uint_32 i;
@@ -268,6 +283,7 @@ png_do_swap(png_row_infop row_info, png_bytep row)
} }
} }
#endif #endif
#endif
#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED) #if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
static PNG_CONST png_byte onebppswaptable[256] = { static PNG_CONST png_byte onebppswaptable[256] = {
@@ -381,19 +397,22 @@ png_do_packswap(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_packswap"); png_debug(1, "in png_do_packswap");
if ( if (row_info->bit_depth < 8)
row_info->bit_depth < 8)
{ {
png_bytep rp, end, table; png_bytep rp;
png_const_bytep end, table;
end = row + row_info->rowbytes; end = row + row_info->rowbytes;
if (row_info->bit_depth == 1) if (row_info->bit_depth == 1)
table = (png_bytep)onebppswaptable; table = onebppswaptable;
else if (row_info->bit_depth == 2) else if (row_info->bit_depth == 2)
table = (png_bytep)twobppswaptable; table = twobppswaptable;
else if (row_info->bit_depth == 4) else if (row_info->bit_depth == 4)
table = (png_bytep)fourbppswaptable; table = fourbppswaptable;
else else
return; return;
@@ -405,158 +424,119 @@ png_do_packswap(png_row_infop row_info, png_bytep row)
#if defined(PNG_WRITE_FILLER_SUPPORTED) || \ #if defined(PNG_WRITE_FILLER_SUPPORTED) || \
defined(PNG_READ_STRIP_ALPHA_SUPPORTED) defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
/* Remove filler or alpha byte(s) */ /* Remove a channel - this used to be 'png_do_strip_filler' but it used a
* somewhat weird combination of flags to determine what to do. All the calls
* to png_do_strip_filler are changed in 1.5.2 to call this instead with the
* correct arguments.
*
* The routine isn't general - the channel must be the channel at the start or
* end (not in the middle) of each pixel.
*/
void /* PRIVATE */ void /* PRIVATE */
png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags) png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
{ {
png_debug(1, "in png_do_strip_filler"); png_bytep sp = row; /* source pointer */
png_bytep dp = row; /* destination pointer */
png_bytep ep = row + row_info->rowbytes; /* One beyond end of row */
/* At the start sp will point to the first byte to copy and dp to where
* it is copied to. ep always points just beyond the end of the row, so
* the loop simply copies (channels-1) channels until sp reaches ep.
*
* at_start: 0 -- convert AG, XG, ARGB, XRGB, AAGG, XXGG, etc.
* nonzero -- convert GA, GX, RGBA, RGBX, GGAA, RRGGBBXX, etc.
*/
/* GA, GX, XG cases */
if (row_info->channels == 2)
{ {
png_bytep sp=row; if (row_info->bit_depth == 8)
png_bytep dp=row;
png_uint_32 row_width=row_info->width;
png_uint_32 i;
if ((row_info->color_type == PNG_COLOR_TYPE_RGB ||
(row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA &&
(flags & PNG_FLAG_STRIP_ALPHA))) &&
row_info->channels == 4)
{ {
if (row_info->bit_depth == 8) if (at_start) /* Skip initial filler */
{ ++sp;
/* This converts from RGBX or RGBA to RGB */ else /* Skip initial channel and, for sp, the filler */
if (flags & PNG_FLAG_FILLER_AFTER) sp += 2, ++dp;
{
dp+=3; sp+=4;
for (i = 1; i < row_width; i++)
{
*dp++ = *sp++;
*dp++ = *sp++;
*dp++ = *sp++;
sp++;
}
}
/* This converts from XRGB or ARGB to RGB */
else
{
for (i = 0; i < row_width; i++)
{
sp++;
*dp++ = *sp++;
*dp++ = *sp++;
*dp++ = *sp++;
}
}
row_info->pixel_depth = 24;
row_info->rowbytes = row_width * 3;
}
else /* if (row_info->bit_depth == 16) */
{
if (flags & PNG_FLAG_FILLER_AFTER)
{
/* This converts from RRGGBBXX or RRGGBBAA to RRGGBB */
sp += 8; dp += 6;
for (i = 1; i < row_width; i++)
{
/* This could be (although png_memcpy is probably slower):
png_memcpy(dp, sp, 6);
sp += 8;
dp += 6;
*/
*dp++ = *sp++; /* For a 1 pixel wide image there is nothing to do */
*dp++ = *sp++; while (sp < ep)
*dp++ = *sp++; *dp++ = *sp, sp += 2;
*dp++ = *sp++;
*dp++ = *sp++;
*dp++ = *sp++;
sp += 2;
}
}
else
{
/* This converts from XXRRGGBB or AARRGGBB to RRGGBB */
for (i = 0; i < row_width; i++)
{
/* This could be (although png_memcpy is probably slower):
png_memcpy(dp, sp, 6);
sp += 8;
dp += 6;
*/
sp+=2; row_info->pixel_depth = 8;
*dp++ = *sp++;
*dp++ = *sp++;
*dp++ = *sp++;
*dp++ = *sp++;
*dp++ = *sp++;
*dp++ = *sp++;
}
}
row_info->pixel_depth = 48;
row_info->rowbytes = row_width * 6;
}
row_info->channels = 3;
} }
else if ((row_info->color_type == PNG_COLOR_TYPE_GRAY ||
(row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA && else if (row_info->bit_depth == 16)
(flags & PNG_FLAG_STRIP_ALPHA))) &&
row_info->channels == 2)
{ {
if (row_info->bit_depth == 8) if (at_start) /* Skip initial filler */
{ sp += 2;
/* This converts from GX or GA to G */ else /* Skip initial channel and, for sp, the filler */
if (flags & PNG_FLAG_FILLER_AFTER) sp += 4, dp += 2;
{
for (i = 0; i < row_width; i++) while (sp < ep)
{ *dp++ = *sp++, *dp++ = *sp, sp += 3;
*dp++ = *sp++;
sp++; row_info->pixel_depth = 16;
}
}
/* This converts from XG or AG to G */
else
{
for (i = 0; i < row_width; i++)
{
sp++;
*dp++ = *sp++;
}
}
row_info->pixel_depth = 8;
row_info->rowbytes = row_width;
}
else /* if (row_info->bit_depth == 16) */
{
if (flags & PNG_FLAG_FILLER_AFTER)
{
/* This converts from GGXX or GGAA to GG */
sp += 4; dp += 2;
for (i = 1; i < row_width; i++)
{
*dp++ = *sp++;
*dp++ = *sp++;
sp += 2;
}
}
else
{
/* This converts from XXGG or AAGG to GG */
for (i = 0; i < row_width; i++)
{
sp += 2;
*dp++ = *sp++;
*dp++ = *sp++;
}
}
row_info->pixel_depth = 16;
row_info->rowbytes = row_width * 2;
}
row_info->channels = 1;
} }
if (flags & PNG_FLAG_STRIP_ALPHA)
row_info->color_type &= ~PNG_COLOR_MASK_ALPHA; else
return; /* bad bit depth */
row_info->channels = 1;
/* Finally fix the color type if it records an alpha channel */
if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
row_info->color_type = PNG_COLOR_TYPE_GRAY;
} }
/* RGBA, RGBX, XRGB cases */
else if (row_info->channels == 4)
{
if (row_info->bit_depth == 8)
{
if (at_start) /* Skip initial filler */
++sp;
else /* Skip initial channels and, for sp, the filler */
sp += 4, dp += 3;
/* Note that the loop adds 3 to dp and 4 to sp each time. */
while (sp < ep)
*dp++ = *sp++, *dp++ = *sp++, *dp++ = *sp, sp += 2;
row_info->pixel_depth = 24;
}
else if (row_info->bit_depth == 16)
{
if (at_start) /* Skip initial filler */
sp += 2;
else /* Skip initial channels and, for sp, the filler */
sp += 8, dp += 6;
while (sp < ep)
{
/* Copy 6 bytes, skip 2 */
*dp++ = *sp++, *dp++ = *sp++;
*dp++ = *sp++, *dp++ = *sp++;
*dp++ = *sp++, *dp++ = *sp, sp += 3;
}
row_info->pixel_depth = 48;
}
else
return; /* bad bit depth */
row_info->channels = 3;
/* Finally fix the color type if it records an alpha channel */
if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
row_info->color_type = PNG_COLOR_TYPE_RGB;
}
else
return; /* The filler channel has gone already */
/* Fix the rowbytes value. */
row_info->rowbytes = dp-row;
} }
#endif #endif
@@ -567,8 +547,7 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_bgr"); png_debug(1, "in png_do_bgr");
if ( if ((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;
if (row_info->bit_depth == 8) if (row_info->bit_depth == 8)
@@ -585,6 +564,7 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
*(rp + 2) = save; *(rp + 2) = save;
} }
} }
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
{ {
png_bytep rp; png_bytep rp;
@@ -598,6 +578,8 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
} }
} }
} }
#ifdef PNG_16BIT_SUPPORTED
else if (row_info->bit_depth == 16) else if (row_info->bit_depth == 16)
{ {
if (row_info->color_type == PNG_COLOR_TYPE_RGB) if (row_info->color_type == PNG_COLOR_TYPE_RGB)
@@ -615,6 +597,7 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
*(rp + 5) = save; *(rp + 5) = save;
} }
} }
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
{ {
png_bytep rp; png_bytep rp;
@@ -631,12 +614,14 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
} }
} }
} }
#endif
} }
} }
#endif /* PNG_READ_BGR_SUPPORTED or PNG_WRITE_BGR_SUPPORTED */ #endif /* PNG_READ_BGR_SUPPORTED or PNG_WRITE_BGR_SUPPORTED */
#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)
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
void PNGAPI 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)
@@ -645,15 +630,9 @@ png_set_user_transform_info(png_structp png_ptr, png_voidp
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
#ifdef 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
if (user_transform_ptr || user_transform_depth || user_transform_channels)
png_warning(png_ptr,
"This version of libpng does not support user transform info");
#endif
} }
#endif #endif
@@ -662,15 +641,38 @@ png_set_user_transform_info(png_structp png_ptr, png_voidp
* associated with this pointer before png_write_destroy and png_read_destroy * associated with this pointer before png_write_destroy and png_read_destroy
* are called. * are called.
*/ */
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
png_voidp PNGAPI png_voidp PNGAPI
png_get_user_transform_ptr(png_structp png_ptr) png_get_user_transform_ptr(png_const_structp png_ptr)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
return (NULL); return (NULL);
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
return ((png_voidp)png_ptr->user_transform_ptr); return ((png_voidp)png_ptr->user_transform_ptr);
#else
return (NULL);
#endif
} }
#endif
#ifdef PNG_USER_TRANSFORM_INFO_SUPPORTED
png_uint_32 PNGAPI
png_get_current_row_number(png_const_structp png_ptr)
{
/* See the comments in png.h - this is the sub-image row when reading and
* interlaced image.
*/
if (png_ptr != NULL)
return png_ptr->row_number;
return PNG_UINT_32_MAX; /* help the app not to fail silently */
}
png_byte PNGAPI
png_get_current_pass_number(png_const_structp png_ptr)
{
if (png_ptr != NULL)
return png_ptr->pass;
return 8; /* invalid */
}
#endif /* PNG_USER_TRANSFORM_INFO_SUPPORTED */
#endif /* PNG_READ_USER_TRANSFORM_SUPPORTED ||
PNG_WRITE_USER_TRANSFORM_SUPPORTED */
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */

9586
pngvalid.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,8 @@
/* pngwio.c - functions for data output /* pngwio.c - functions for data output
* *
* Last changed in libpng 1.4.0 [January 2, 2010] * Last changed in libpng 1.5.0 [January 6, 2011]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson * Copyright (c) 1998-2011 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.)
* *
@@ -18,11 +18,10 @@
* them at run time with png_set_write_fn(...). * them at run time with png_set_write_fn(...).
*/ */
#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#ifdef PNG_WRITE_SUPPORTED
#include "pngpriv.h" #include "pngpriv.h"
#ifdef PNG_WRITE_SUPPORTED
/* 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
* with very small lengths, so you should implement some kind of simple * with very small lengths, so you should implement some kind of simple
@@ -31,10 +30,12 @@
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_write_data(png_structp png_ptr, png_bytep data, png_size_t length) png_write_data(png_structp png_ptr, png_const_bytep data, png_size_t length)
{ {
/* NOTE: write_data_fn must not change the buffer! */
if (png_ptr->write_data_fn != NULL ) if (png_ptr->write_data_fn != NULL )
(*(png_ptr->write_data_fn))(png_ptr, data, length); (*(png_ptr->write_data_fn))(png_ptr, (png_bytep)data, length);
else else
png_error(png_ptr, "Call to NULL write function"); png_error(png_ptr, "Call to NULL write function");
} }
@@ -46,14 +47,16 @@ png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
* than changing the library. * than changing the library.
*/ */
#ifndef USE_FAR_KEYWORD #ifndef USE_FAR_KEYWORD
void PNGAPI void PNGCBAPI
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length) png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{ {
png_uint_32 check; png_size_t check;
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
check = fwrite(data, 1, length, (png_FILE_p)(png_ptr->io_ptr)); check = fwrite(data, 1, length, (png_FILE_p)(png_ptr->io_ptr));
if (check != length) if (check != length)
png_error(png_ptr, "Write Error"); png_error(png_ptr, "Write Error");
} }
@@ -66,7 +69,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
#define NEAR_BUF_SIZE 1024 #define NEAR_BUF_SIZE 1024
#define MIN(a,b) (a <= b ? a : b) #define MIN(a,b) (a <= b ? a : b)
void PNGAPI void PNGCBAPI
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length) png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{ {
png_uint_32 check; png_uint_32 check;
@@ -75,24 +78,29 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
if (png_ptr == NULL) if (png_ptr == NULL)
return; 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)
{ {
check = fwrite(near_data, 1, length, io_ptr); check = fwrite(near_data, 1, length, io_ptr);
} }
else else
{ {
png_byte buf[NEAR_BUF_SIZE]; png_byte buf[NEAR_BUF_SIZE];
png_size_t written, remaining, err; png_size_t written, remaining, err;
check = 0; check = 0;
remaining = length; remaining = length;
do do
{ {
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 */
err = fwrite(buf, 1, written, io_ptr); err = fwrite(buf, 1, written, io_ptr);
if (err != written) if (err != written)
break; break;
@@ -104,6 +112,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
} }
while (remaining != 0); while (remaining != 0);
} }
if (check != length) if (check != length)
png_error(png_ptr, "Write Error"); png_error(png_ptr, "Write Error");
} }
@@ -123,17 +132,19 @@ png_flush(png_structp png_ptr)
(*(png_ptr->output_flush_fn))(png_ptr); (*(png_ptr->output_flush_fn))(png_ptr);
} }
#ifdef PNG_STDIO_SUPPORTED # ifdef PNG_STDIO_SUPPORTED
void PNGAPI void PNGCBAPI
png_default_flush(png_structp png_ptr) png_default_flush(png_structp png_ptr)
{ {
png_FILE_p io_ptr; png_FILE_p io_ptr;
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr)); io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
fflush(io_ptr); fflush(io_ptr);
} }
#endif # endif
#endif #endif
/* This function allows the application to supply new output functions for /* This function allows the application to supply new output functions for
@@ -155,7 +166,7 @@ png_default_flush(png_structp png_ptr)
* 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
* or pending transmission. If the output method doesn't do * or pending transmission. If the output method doesn't do
* any buffering of ouput, a function prototype must still be * any buffering of output, a function prototype must still be
* 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
@@ -167,7 +178,7 @@ png_default_flush(png_structp png_ptr)
*/ */
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) if (png_ptr == NULL)
return; return;
@@ -185,30 +196,32 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
#endif #endif
#ifdef PNG_WRITE_FLUSH_SUPPORTED #ifdef PNG_WRITE_FLUSH_SUPPORTED
#ifdef PNG_STDIO_SUPPORTED # ifdef PNG_STDIO_SUPPORTED
if (output_flush_fn != NULL) if (output_flush_fn != NULL)
png_ptr->output_flush_fn = output_flush_fn; png_ptr->output_flush_fn = output_flush_fn;
else else
png_ptr->output_flush_fn = png_default_flush; png_ptr->output_flush_fn = png_default_flush;
#else
# else
png_ptr->output_flush_fn = output_flush_fn; png_ptr->output_flush_fn = output_flush_fn;
#endif # endif
#endif /* PNG_WRITE_FLUSH_SUPPORTED */ #endif /* PNG_WRITE_FLUSH_SUPPORTED */
/* It is an error to read while writing a png file */ /* It is an error to read while writing a png file */
if (png_ptr->read_data_fn != NULL) if (png_ptr->read_data_fn != NULL)
{ {
png_ptr->read_data_fn = NULL; png_ptr->read_data_fn = NULL;
png_warning(png_ptr, png_warning(png_ptr,
"Attempted to set both read_data_fn and write_data_fn in"); "Can't set both read_data_fn and write_data_fn in the"
png_warning(png_ptr, " same structure");
"the same structure. Resetting read_data_fn to NULL");
} }
} }
#ifdef USE_FAR_KEYWORD #ifdef USE_FAR_KEYWORD
#ifdef _MSC_VER # ifdef _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;
@@ -236,6 +249,6 @@ void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check)
return(near_ptr); return(near_ptr);
} }
# endif # endif
# endif #endif
#endif /* PNG_WRITE_SUPPORTED */ #endif /* PNG_WRITE_SUPPORTED */

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,8 @@
/* 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.4.0 [January 2, 2010] * Last changed in libpng 1.5.4 [July 7, 2011]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson * Copyright (c) 1998-2011 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.)
* *
@@ -11,11 +11,11 @@
* and license in png.h * and license in png.h
*/ */
#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#ifdef PNG_WRITE_SUPPORTED
#include "pngpriv.h" #include "pngpriv.h"
#ifdef PNG_WRITE_SUPPORTED
#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
/* 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.
*/ */
@@ -30,52 +30,62 @@ png_do_write_transformations(png_structp png_ptr)
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED #ifdef 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
(png_ptr, /* png_ptr */ function */
&(png_ptr->row_info), /* row_info: */ (png_ptr, /* png_ptr */
/* png_uint_32 width; width of row */ &(png_ptr->row_info), /* row_info: */
/* png_uint_32 rowbytes; number of bytes in row */ /* png_uint_32 width; width of row */
/* png_byte color_type; color type of pixels */ /* png_size_t rowbytes; number of bytes in row */
/* png_byte bit_depth; bit depth of samples */ /* png_byte color_type; color type of pixels */
/* png_byte channels; number of channels (1-4) */ /* png_byte bit_depth; bit depth of samples */
/* png_byte pixel_depth; bits per pixel (depth*channels) */ /* png_byte channels; number of channels (1-4) */
png_ptr->row_buf + 1); /* start of pixel data for row */ /* png_byte pixel_depth; bits per pixel (depth*channels) */
png_ptr->row_buf + 1); /* start of pixel data for row */
#endif #endif
#ifdef PNG_WRITE_FILLER_SUPPORTED #ifdef PNG_WRITE_FILLER_SUPPORTED
if (png_ptr->transformations & PNG_FILLER) if (png_ptr->transformations & PNG_FILLER)
png_do_strip_filler(&(png_ptr->row_info), png_ptr->row_buf + 1, png_do_strip_channel(&(png_ptr->row_info), png_ptr->row_buf + 1,
png_ptr->flags); !(png_ptr->flags & PNG_FLAG_FILLER_AFTER));
#endif #endif
#ifdef PNG_WRITE_PACKSWAP_SUPPORTED #ifdef PNG_WRITE_PACKSWAP_SUPPORTED
if (png_ptr->transformations & PNG_PACKSWAP) if (png_ptr->transformations & PNG_PACKSWAP)
png_do_packswap(&(png_ptr->row_info), png_ptr->row_buf + 1); png_do_packswap(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif #endif
#ifdef PNG_WRITE_PACK_SUPPORTED #ifdef PNG_WRITE_PACK_SUPPORTED
if (png_ptr->transformations & PNG_PACK) if (png_ptr->transformations & PNG_PACK)
png_do_pack(&(png_ptr->row_info), png_ptr->row_buf + 1, png_do_pack(&(png_ptr->row_info), png_ptr->row_buf + 1,
(png_uint_32)png_ptr->bit_depth); (png_uint_32)png_ptr->bit_depth);
#endif #endif
#ifdef PNG_WRITE_SWAP_SUPPORTED #ifdef PNG_WRITE_SWAP_SUPPORTED
if (png_ptr->transformations & PNG_SWAP_BYTES) if (png_ptr->transformations & PNG_SWAP_BYTES)
png_do_swap(&(png_ptr->row_info), png_ptr->row_buf + 1); png_do_swap(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif #endif
#ifdef PNG_WRITE_SHIFT_SUPPORTED #ifdef PNG_WRITE_SHIFT_SUPPORTED
if (png_ptr->transformations & PNG_SHIFT) if (png_ptr->transformations & PNG_SHIFT)
png_do_shift(&(png_ptr->row_info), png_ptr->row_buf + 1, png_do_shift(&(png_ptr->row_info), png_ptr->row_buf + 1,
&(png_ptr->shift)); &(png_ptr->shift));
#endif #endif
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED #ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
if (png_ptr->transformations & PNG_SWAP_ALPHA) if (png_ptr->transformations & PNG_SWAP_ALPHA)
png_do_write_swap_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1); png_do_write_swap_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif #endif
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED #ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
if (png_ptr->transformations & PNG_INVERT_ALPHA) if (png_ptr->transformations & PNG_INVERT_ALPHA)
png_do_write_invert_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1); png_do_write_invert_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif #endif
#ifdef PNG_WRITE_BGR_SUPPORTED #ifdef PNG_WRITE_BGR_SUPPORTED
if (png_ptr->transformations & PNG_BGR) if (png_ptr->transformations & PNG_BGR)
png_do_bgr(&(png_ptr->row_info), png_ptr->row_buf + 1); png_do_bgr(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif #endif
#ifdef PNG_WRITE_INVERT_SUPPORTED #ifdef PNG_WRITE_INVERT_SUPPORTED
if (png_ptr->transformations & PNG_INVERT_MONO) if (png_ptr->transformations & PNG_INVERT_MONO)
png_do_invert(&(png_ptr->row_info), png_ptr->row_buf + 1); png_do_invert(&(png_ptr->row_info), png_ptr->row_buf + 1);
@@ -113,9 +123,12 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
{ {
if (*sp != 0) if (*sp != 0)
v |= mask; v |= mask;
sp++; sp++;
if (mask > 1) if (mask > 1)
mask >>= 1; mask >>= 1;
else else
{ {
mask = 0x80; mask = 0x80;
@@ -124,10 +137,13 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
v = 0; v = 0;
} }
} }
if (mask != 0x80) if (mask != 0x80)
*dp = (png_byte)v; *dp = (png_byte)v;
break; break;
} }
case 2: case 2:
{ {
png_bytep sp, dp; png_bytep sp, dp;
@@ -139,12 +155,14 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
dp = row; dp = row;
shift = 6; shift = 6;
v = 0; v = 0;
for (i = 0; i < row_width; i++) for (i = 0; i < row_width; i++)
{ {
png_byte value; png_byte value;
value = (png_byte)(*sp & 0x03); value = (png_byte)(*sp & 0x03);
v |= (value << shift); v |= (value << shift);
if (shift == 0) if (shift == 0)
{ {
shift = 6; shift = 6;
@@ -152,14 +170,19 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
dp++; dp++;
v = 0; v = 0;
} }
else else
shift -= 2; shift -= 2;
sp++; sp++;
} }
if (shift != 6) if (shift != 6)
*dp = (png_byte)v; *dp = (png_byte)v;
break; break;
} }
case 4: case 4:
{ {
png_bytep sp, dp; png_bytep sp, dp;
@@ -171,6 +194,7 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
dp = row; dp = row;
shift = 4; shift = 4;
v = 0; v = 0;
for (i = 0; i < row_width; i++) for (i = 0; i < row_width; i++)
{ {
png_byte value; png_byte value;
@@ -185,20 +209,27 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
dp++; dp++;
v = 0; v = 0;
} }
else else
shift -= 4; shift -= 4;
sp++; sp++;
} }
if (shift != 4) if (shift != 4)
*dp = (png_byte)v; *dp = (png_byte)v;
break; break;
} }
default:
break;
} }
row_info->bit_depth = (png_byte)bit_depth; row_info->bit_depth = (png_byte)bit_depth;
row_info->pixel_depth = (png_byte)(bit_depth * row_info->channels); row_info->pixel_depth = (png_byte)(bit_depth * row_info->channels);
row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,
row_info->width); row_info->width);
} }
} }
#endif #endif
@@ -212,12 +243,12 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
* data to 0 to 15. * data to 0 to 15.
*/ */
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_const_color_8p bit_depth)
{ {
png_debug(1, "in png_do_shift"); png_debug(1, "in png_do_shift");
if ( if (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];
int channels = 0; int channels = 0;
@@ -227,19 +258,23 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
shift_start[channels] = row_info->bit_depth - bit_depth->red; shift_start[channels] = row_info->bit_depth - bit_depth->red;
shift_dec[channels] = bit_depth->red; shift_dec[channels] = bit_depth->red;
channels++; channels++;
shift_start[channels] = row_info->bit_depth - bit_depth->green; shift_start[channels] = row_info->bit_depth - bit_depth->green;
shift_dec[channels] = bit_depth->green; shift_dec[channels] = bit_depth->green;
channels++; channels++;
shift_start[channels] = row_info->bit_depth - bit_depth->blue; shift_start[channels] = row_info->bit_depth - bit_depth->blue;
shift_dec[channels] = bit_depth->blue; shift_dec[channels] = bit_depth->blue;
channels++; channels++;
} }
else else
{ {
shift_start[channels] = row_info->bit_depth - bit_depth->gray; shift_start[channels] = row_info->bit_depth - bit_depth->gray;
shift_dec[channels] = bit_depth->gray; shift_dec[channels] = bit_depth->gray;
channels++; channels++;
} }
if (row_info->color_type & PNG_COLOR_MASK_ALPHA) if (row_info->color_type & PNG_COLOR_MASK_ALPHA)
{ {
shift_start[channels] = row_info->bit_depth - bit_depth->alpha; shift_start[channels] = row_info->bit_depth - bit_depth->alpha;
@@ -251,14 +286,16 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
if (row_info->bit_depth < 8) if (row_info->bit_depth < 8)
{ {
png_bytep bp = row; png_bytep bp = row;
png_uint_32 i; png_size_t i;
png_byte mask; png_byte mask;
png_uint_32 row_bytes = row_info->rowbytes; png_size_t row_bytes = row_info->rowbytes;
if (bit_depth->gray == 1 && row_info->bit_depth == 2) if (bit_depth->gray == 1 && row_info->bit_depth == 2)
mask = 0x55; mask = 0x55;
else if (row_info->bit_depth == 4 && bit_depth->gray == 3) else if (row_info->bit_depth == 4 && bit_depth->gray == 3)
mask = 0x11; mask = 0x11;
else else
mask = 0xff; mask = 0xff;
@@ -269,15 +306,18 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
v = *bp; v = *bp;
*bp = 0; *bp = 0;
for (j = shift_start[0]; j > -shift_dec[0]; j -= shift_dec[0]) for (j = shift_start[0]; j > -shift_dec[0]; j -= shift_dec[0])
{ {
if (j > 0) if (j > 0)
*bp |= (png_byte)((v << j) & 0xff); *bp |= (png_byte)((v << j) & 0xff);
else else
*bp |= (png_byte)((v >> (-j)) & mask); *bp |= (png_byte)((v >> (-j)) & mask);
} }
} }
} }
else if (row_info->bit_depth == 8) else if (row_info->bit_depth == 8)
{ {
png_bytep bp = row; png_bytep bp = row;
@@ -293,15 +333,18 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
v = *bp; v = *bp;
*bp = 0; *bp = 0;
for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c]) for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c])
{ {
if (j > 0) if (j > 0)
*bp |= (png_byte)((v << j) & 0xff); *bp |= (png_byte)((v << j) & 0xff);
else else
*bp |= (png_byte)((v >> (-j)) & 0xff); *bp |= (png_byte)((v >> (-j)) & 0xff);
} }
} }
} }
else else
{ {
png_bytep bp; png_bytep bp;
@@ -316,10 +359,12 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
v = (png_uint_16)(((png_uint_16)(*bp) << 8) + *(bp + 1)); v = (png_uint_16)(((png_uint_16)(*bp) << 8) + *(bp + 1));
value = 0; value = 0;
for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c]) for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c])
{ {
if (j > 0) if (j > 0)
value |= (png_uint_16)((v << j) & (png_uint_16)0xffff); value |= (png_uint_16)((v << j) & (png_uint_16)0xffff);
else else
value |= (png_uint_16)((v >> (-j)) & (png_uint_16)0xffff); value |= (png_uint_16)((v >> (-j)) & (png_uint_16)0xffff);
} }
@@ -340,12 +385,13 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
{ {
if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
{ {
/* This converts from ARGB to RGBA */
if (row_info->bit_depth == 8) if (row_info->bit_depth == 8)
{ {
/* This converts from ARGB to RGBA */
png_bytep sp, dp; png_bytep sp, dp;
png_uint_32 i; png_uint_32 i;
png_uint_32 row_width = row_info->width; png_uint_32 row_width = row_info->width;
for (i = 0, sp = dp = row; i < row_width; i++) for (i = 0, sp = dp = row; i < row_width; i++)
{ {
png_byte save = *(sp++); png_byte save = *(sp++);
@@ -355,9 +401,11 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
*(dp++) = save; *(dp++) = save;
} }
} }
/* This converts from AARRGGBB to RRGGBBAA */
#ifdef PNG_WRITE_16BIT_SUPPORTED
else else
{ {
/* This converts from AARRGGBB to RRGGBBAA */
png_bytep sp, dp; png_bytep sp, dp;
png_uint_32 i; png_uint_32 i;
png_uint_32 row_width = row_info->width; png_uint_32 row_width = row_info->width;
@@ -377,12 +425,14 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
*(dp++) = save[1]; *(dp++) = save[1];
} }
} }
#endif /* PNG_WRITE_16BIT_SUPPORTED */
} }
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
{ {
/* This converts from AG to GA */
if (row_info->bit_depth == 8) if (row_info->bit_depth == 8)
{ {
/* This converts from AG to GA */
png_bytep sp, dp; png_bytep sp, dp;
png_uint_32 i; png_uint_32 i;
png_uint_32 row_width = row_info->width; png_uint_32 row_width = row_info->width;
@@ -394,9 +444,11 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
*(dp++) = save; *(dp++) = save;
} }
} }
/* This converts from AAGG to GGAA */
#ifdef PNG_WRITE_16BIT_SUPPORTED
else else
{ {
/* This converts from AAGG to GGAA */
png_bytep sp, dp; png_bytep sp, dp;
png_uint_32 i; png_uint_32 i;
png_uint_32 row_width = row_info->width; png_uint_32 row_width = row_info->width;
@@ -412,6 +464,7 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
*(dp++) = save[1]; *(dp++) = save[1];
} }
} }
#endif /* PNG_WRITE_16BIT_SUPPORTED */
} }
} }
} }
@@ -426,12 +479,13 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
{ {
if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
{ {
/* This inverts the alpha channel in RGBA */
if (row_info->bit_depth == 8) if (row_info->bit_depth == 8)
{ {
/* This inverts the alpha channel in RGBA */
png_bytep sp, dp; png_bytep sp, dp;
png_uint_32 i; png_uint_32 i;
png_uint_32 row_width = row_info->width; png_uint_32 row_width = row_info->width;
for (i = 0, sp = dp = row; i < row_width; i++) for (i = 0, sp = dp = row; i < row_width; i++)
{ {
/* Does nothing /* Does nothing
@@ -443,9 +497,11 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
*(dp++) = (png_byte)(255 - *(sp++)); *(dp++) = (png_byte)(255 - *(sp++));
} }
} }
/* This inverts the alpha channel in RRGGBBAA */
#ifdef PNG_WRITE_16BIT_SUPPORTED
else else
{ {
/* This inverts the alpha channel in RRGGBBAA */
png_bytep sp, dp; png_bytep sp, dp;
png_uint_32 i; png_uint_32 i;
png_uint_32 row_width = row_info->width; png_uint_32 row_width = row_info->width;
@@ -465,12 +521,14 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
*(dp++) = (png_byte)(255 - *(sp++)); *(dp++) = (png_byte)(255 - *(sp++));
} }
} }
#endif /* PNG_WRITE_16BIT_SUPPORTED */
} }
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
{ {
/* This inverts the alpha channel in GA */
if (row_info->bit_depth == 8) if (row_info->bit_depth == 8)
{ {
/* This inverts the alpha channel in GA */
png_bytep sp, dp; png_bytep sp, dp;
png_uint_32 i; png_uint_32 i;
png_uint_32 row_width = row_info->width; png_uint_32 row_width = row_info->width;
@@ -481,9 +539,11 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
*(dp++) = (png_byte)(255 - *(sp++)); *(dp++) = (png_byte)(255 - *(sp++));
} }
} }
/* This inverts the alpha channel in GGAA */
#ifdef PNG_WRITE_16BIT_SUPPORTED
else else
{ {
/* This inverts the alpha channel in GGAA */
png_bytep sp, dp; png_bytep sp, dp;
png_uint_32 i; png_uint_32 i;
png_uint_32 row_width = row_info->width; png_uint_32 row_width = row_info->width;
@@ -499,10 +559,12 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
*(dp++) = (png_byte)(255 - *(sp++)); *(dp++) = (png_byte)(255 - *(sp++));
} }
} }
#endif /* PNG_WRITE_16BIT_SUPPORTED */
} }
} }
} }
#endif #endif
#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
#ifdef PNG_MNG_FEATURES_SUPPORTED #ifdef PNG_MNG_FEATURES_SUPPORTED
/* Undoes intrapixel differencing */ /* Undoes intrapixel differencing */
@@ -511,8 +573,7 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_write_intrapixel"); png_debug(1, "in png_do_write_intrapixel");
if ( if ((row_info->color_type & PNG_COLOR_MASK_COLOR))
(row_info->color_type & PNG_COLOR_MASK_COLOR))
{ {
int bytes_per_pixel; int bytes_per_pixel;
png_uint_32 row_width = row_info->width; png_uint_32 row_width = row_info->width;
@@ -523,17 +584,21 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
if (row_info->color_type == PNG_COLOR_TYPE_RGB) if (row_info->color_type == PNG_COLOR_TYPE_RGB)
bytes_per_pixel = 3; bytes_per_pixel = 3;
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
bytes_per_pixel = 4; bytes_per_pixel = 4;
else else
return; return;
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel) for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
{ {
*(rp) = (png_byte)((*rp - *(rp+1))&0xff); *(rp) = (png_byte)((*rp - *(rp + 1)) & 0xff);
*(rp+2) = (png_byte)((*(rp+2) - *(rp+1))&0xff); *(rp + 2) = (png_byte)((*(rp + 2) - *(rp + 1)) & 0xff);
} }
} }
#ifdef PNG_WRITE_16BIT_SUPPORTED
else if (row_info->bit_depth == 16) else if (row_info->bit_depth == 16)
{ {
png_bytep rp; png_bytep rp;
@@ -541,24 +606,27 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
if (row_info->color_type == PNG_COLOR_TYPE_RGB) if (row_info->color_type == PNG_COLOR_TYPE_RGB)
bytes_per_pixel = 6; bytes_per_pixel = 6;
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
bytes_per_pixel = 8; bytes_per_pixel = 8;
else else
return; return;
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel) for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
{ {
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);
*(rp+5) = (png_byte)(blue & 0xff); *(rp + 5) = (png_byte)(blue & 0xff);
} }
} }
#endif /* PNG_WRITE_16BIT_SUPPORTED */
} }
} }
#endif /* PNG_MNG_FEATURES_SUPPORTED */ #endif /* PNG_MNG_FEATURES_SUPPORTED */

1282
pngwutil.c

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +0,0 @@
The cbuilder5 project has not been updated to libpng-1.4.0.
It needs to depend on pngpriv.h
It needs to *not* depend on pnggccrd.c or pngvcrd.c
It needs to DEFINE PNG_NO_PEDANTIC_WARNING while building
the library, but not while building an application.
If an updated version is not received, this project will
be removed when libpng-1.4.0 is released.

View File

@@ -1,22 +0,0 @@
USEUNIT("libpng.cpp");
USEUNIT("..\..\png.c");
USEUNIT("..\..\pngerror.c");
USEUNIT("..\..\pngget.c");
USEUNIT("..\..\pngmem.c");
USEUNIT("..\..\pngpread.c");
USEUNIT("..\..\pngread.c");
USEUNIT("..\..\pngrio.c");
USEUNIT("..\..\pngrtran.c");
USEUNIT("..\..\pngrutil.c");
USEUNIT("..\..\pngset.c");
USEUNIT("..\..\pngtrans.c");
USEUNIT("..\..\pngwio.c");
USEUNIT("..\..\pngwrite.c");
USEUNIT("..\..\pngwtran.c");
USEUNIT("..\..\pngwutil.c");
USELIB("..\..\..\zlib\zlib.lib");
//---------------------------------------------------------------------------
This file is used by the project manager only and should be treated like the project file
DllEntryPoint

View File

@@ -1,25 +0,0 @@
#------------------------------------------------------------------------------
VERSION = BWS.01
#------------------------------------------------------------------------------
!ifndef ROOT
ROOT = $(MAKEDIR)\..
!endif
#------------------------------------------------------------------------------
MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$**
DCC = $(ROOT)\bin\dcc32.exe $**
BRCC = $(ROOT)\bin\brcc32.exe $**
#------------------------------------------------------------------------------
PROJECTS = libpngstat.lib libpng.dll
#------------------------------------------------------------------------------
default: $(PROJECTS)
#------------------------------------------------------------------------------
libpngstat.lib: libpngstat.bpr
$(ROOT)\bin\bpr2mak -t$(ROOT)\bin\deflib.bmk $**
$(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
libpng.dll: libpng.bpr
$(ROOT)\bin\bpr2mak $**
$(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak

View File

@@ -1,157 +0,0 @@
<?xml version='1.0' encoding='utf-8' ?>
<!-- C++Builder XML Project -->
<PROJECT>
<MACROS>
<VERSION value="BCB.05.03"/>
<PROJECT value="libpng.dll"/>
<OBJFILES value="libpng.obj ..\..\pngwutil.obj ..\..\pngerror.obj ..\..\pngget.obj
..\..\pngmem.obj ..\..\pngpread.obj ..\..\pngread.obj ..\..\pngrio.obj
..\..\pngrtran.obj ..\..\pngrutil.obj ..\..\pngset.obj ..\..\pngtrans.obj
..\..\pngwio.obj ..\..\pngwrite.obj ..\..\pngwtran.obj ..\..\png.obj"/>
<RESFILES value=""/>
<DEFFILE value=""/>
<RESDEPEN value="$(RESFILES)"/>
<LIBFILES value="..\..\..\zlib\zlib.lib"/>
<LIBRARIES value="bcbsmp50.lib dclocx50.lib NMFast50.lib Tee50.lib Vclx50.lib Vcl50.lib"/>
<SPARELIBS value="Vcl50.lib Vclx50.lib Tee50.lib NMFast50.lib dclocx50.lib bcbsmp50.lib"/>
<PACKAGES value="Vcl50.bpi Vclx50.bpi bcbsmp50.bpi Qrpt50.bpi Vcldb50.bpi Vclbde50.bpi
ibsmp50.bpi vcldbx50.bpi TeeUI50.bpi TeeDB50.bpi Tee50.bpi TeeQR50.bpi
VCLIB50.bpi bcbie50.bpi vclie50.bpi Inetdb50.bpi Inet50.bpi NMFast50.bpi
dclocx50.bpi bcb97axserver50.bpi SIMULUSCOMPONENTS.bpi Simulus2.bpi"/>
<PATHCPP value=".;..\.."/>
<PATHPAS value=".;"/>
<PATHRC value=".;"/>
<PATHASM value=".;"/>
<DEBUGLIBPATH value="$(BCB)\lib\debug"/>
<RELEASELIBPATH value="$(BCB)\lib\release"/>
<LINKER value="tlink32"/>
<USERDEFINES value="PNG_BUILD_DLL;PNG_NO_MODULEDEF"/>
<SYSDEFINES value="NO_STRICT;_NO_VCL;_RTLDLL"/>
<MAINSOURCE value="libpng.bpf"/>
<INCLUDEPATH value="..\..;..\..\..\zlib;$(BCB)\include"/>
<LIBPATH value="..\..;$(BCB)\lib\obj;$(BCB)\lib"/>
<WARNINGS value="-w8092 -w8091 -w8090 -w8089 -w8087 -wprc -wucp -wstv -wstu -wsig -wpin
-wnod -wnak -wdef -wcln -wbbf -wasm -wamp -wamb"/>
</MACROS>
<OPTIONS>
<CFLAG1 value="-WD -O2 -w -Vx -Ve -x- -RT- -X- -a8 -5 -b- -d -k- -vi -tWD -tWM -c"/>
<PFLAGS value="-$Y- -$L- -$D- -$C- -v -JPHNE -M"/>
<RFLAGS value=""/>
<AFLAGS value="/mx /w2 /zn"/>
<LFLAGS value="-D&quot;&quot; -aa -Tpd -x -Gn -Gi -w"/>
</OPTIONS>
<LINKER>
<ALLOBJ value="c0d32.obj $(OBJFILES)"/>
<ALLRES value="$(RESFILES)"/>
<ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib"/>
</LINKER>
<IDEOPTIONS>
[Version Info]
IncludeVerInfo=0
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=1
Locale=2057
CodePage=1252
[Version Info Keys]
CompanyName=
FileDescription=
FileVersion=1.0.0.0
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
Comments=
[HistoryLists\hlIncludePath]
Count=18
Item0=..\..;..\..\..\zlib;$(BCB)\include
Item1=..\..;P:\My Documents\Source\PNG+ZLib\zlib;$(BCB)\include
Item2=..\..;..\Source\ThirdParty\PortableNetworkGraphics\external;..\Source\ThirdParty\PortableNetworkGraphics;..\Source\ThirdParty\ZLibCompression\external;$(BCB)\include
Item3=..\Source\ThirdParty\PortableNetworkGraphics\external;..\Source\ThirdParty\PortableNetworkGraphics;..\Source\ThirdParty\ZLibCompression\external;$(BCB)\include
Item4=..\Source\ThirdParty\PortableNetworkGraphics\external;..\Source\ThirdParty\PortableNetworkGraphics;..\Source\ThirdParty\ZLibCompression;$(BCB)\include
Item5=..\Source\ThirdParty\PortableNetworkGraphics;..\Source\ThirdParty\ZLibCompression;$(BCB)\include
Item6=..\Source\ThirdParty\PortableNetworkGraphics;P:\Development\Source\ThirdParty\ZLibCompression;$(BCB)\include
Item7=..\Source\ThirdParty\PortableNetworkGraphics;$(BCB)\include
Item8=$(BCB)\include
Item9=..\Source;..\Source\General\Templates;..\Source\SIMUtilities;$(BCB)\include;$(BCB)\include\vcl
Item10=P:\Development\Source\;P:\Development\Source\General\Templates\;P:\Development\Source\SIMUtilities\;$(BCB)\include;$(BCB)\include\vcl
Item11=P:\Development\Source;P:\Development\Source\General\Templates\;P:\Development\Source\SIMUtilities\;$(BCB)\include;$(BCB)\include\vcl
Item12=P:\Development\Source\General\Templates\;P:\Development\Source\SIMUtilities\;$(BCB)\include;$(BCB)\include\vcl
Item13=P:\Development\Source\General\Templates\;P:\Development\Source\SIMUtilities;$(BCB)\include;$(BCB)\include\vcl
Item14=P:\Development\Source\General\Templates\;$(BCB)\include;$(BCB)\include\vcl
Item15=P:\Development\Source\General\Templates;$(BCB)\include;$(BCB)\include\vcl
Item16=P:\Development\Source;$(BCB)\include;$(BCB)\include\vcl
Item17=$(BCB)\include;$(BCB)\include\vcl
[HistoryLists\hlLibraryPath]
Count=10
Item0=..\..;$(BCB)\lib\obj;$(BCB)\lib
Item1=..\..;..\Source\ThirdParty\PortableNetworkGraphics\external;..\Source\ThirdParty\PortableNetworkGraphics;$(BCB)\lib\obj;$(BCB)\lib
Item2=..\Source\ThirdParty\PortableNetworkGraphics\external;..\Source\ThirdParty\PortableNetworkGraphics;$(BCB)\lib\obj;$(BCB)\lib
Item3=..\Source\ThirdParty\PortableNetworkGraphics;$(BCB)\lib\obj;$(BCB)\lib
Item4=$(BCB)\lib\obj;$(BCB)\lib
Item5=..\Source\SIMUtilities;..\Source;$(BCB)\lib\obj;$(BCB)\lib
Item6=P:\Development\Source\SIMUtilities\;P:\Development\Source\;$(BCB)\lib\obj;$(BCB)\lib
Item7=P:\Development\Source\SIMUtilities;P:\Development\Source\;$(BCB)\lib\obj;$(BCB)\lib
Item8=P:\Development\Source\;$(BCB)\lib\obj;$(BCB)\lib
Item9=P:\Development\Source;$(BCB)\lib\obj;$(BCB)\lib
[HistoryLists\hlDebugSourcePath]
Count=1
Item0=$(BCB)\source\vcl
[HistoryLists\hlConditionals]
Count=20
Item0=ZLIB_DLL;Z_PREFIX;PNG_BUILD_DLL;PNG_NO_MODULEDEF
Item1=_DEBUG;ZLIB_DLL;Z_PREFIX;PNG_BUILD_DLL;PNG_NO_MODULEDEF
Item2=PNG_BUILD_DLL;ZLIB_DLL;_DEBUG;PNG_NO_MODULEDEF
Item3=PNG_BUILD_DLL;ZLIB_DLL;_DEBUG;PNG_DEBUG=5;PNG_NO_MODULEDEF;PNG_NO_GLOBAL_ARRAYS
Item4=PNG_BUILD_DLL;ZLIB_DLL;_DEBUG;PNG_DEBUG=5;PNG_NO_MODULEDEF;PNG_SETJMP_NOT_SUPPORTED;PNG_DEBUG_FILE=stderr
Item5=PNG_BUILD_DLL;ZLIB_DLL;_DEBUG;PNG_DEBUG;PNG_NO_MODULEDEF;PNG_SETJMP_NOT_SUPPORTED
Item6=PNG_BUILD_DLL;ZLIB_DLL;_DEBUG;PNG_DEBUG=5;PNG_NO_MODULEDEF;PNG_SETJMP_NOT_SUPPORTED
Item7=PNG_BUILD_DLL;ZLIB_DLL;_DEBUG;PNG_DEBUG=5;PNG_NO_MODULEDEF
Item8=PNG_BUILD_DLL;ZLIB_DLL;_DEBUG;PNG_DEBUG=5
Item9=PNG_BUILD_DLL;ZLIB_DLL;_DEBUG
Item10=PNG_BUILD_DLL;ZLIB_DLL
Item11=PNG_BUILD_DLL
Item12=PNG_DLL;PNG_BUILD_DLL;ZLIB_DLL
Item13=PNG_DLL;PNG_BUILD_DLL;PNG_NO_GLOBAL_ARRAYS;ZLIB_DLL
Item14=PNG_DLL;PNG_BUILD_DLL;PNG_NO_GLOBAL_ARRAYS
Item15=PNG_DLL;PNG_BUILD_DLL
Item16=PNG_DLL;PNG_BUILD_DLL;PNG_MODULEDEF
Item17=_HTML_FORM
Item18=_DEBUG;_HTML_FORM
Item19=_DEBUG
[HistoryLists\hlIntOutputDir]
Count=2
Item0=..\Obj
Item1=P:\Development\Obj
[Debugging]
DebugSourceDirs=
[Parameters]
RunParams=
HostApplication=P:\Development\Executables\LibPNGTestApp.exe
RemoteHost=
RemotePath=
RemoteDebug=0
[Compiler]
ShowInfoMsgs=0
LinkDebugVcl=0
LinkCGLIB=0
</IDEOPTIONS>
</PROJECT>

View File

@@ -1,29 +0,0 @@
//---------------------------------------------------------------------------
#include <windows.h>
//---------------------------------------------------------------------------
// Important note about DLL memory management when your DLL uses the
// static version of the RunTime Library:
//
// If your DLL exports any functions that pass String objects (or structs/
// classes containing nested Strings) as parameter or function results,
// you will need to add the library MEMMGR.LIB to both the DLL project and
// any other projects that use the DLL. You will also need to use MEMMGR.LIB
// if any other projects which use the DLL will be performing new or delete
// operations on any non-TObject-derived classes which are exported from the
// DLL. Adding MEMMGR.LIB to your project will change the DLL and its calling
// EXE's to use the BORLNDMM.DLL as their memory manager. In these cases,
// the file BORLNDMM.DLL should be deployed along with your DLL.
//
// To avoid using BORLNDMM.DLL, pass string information using "char *" or
// ShortString parameters.
//
// If your DLL uses the dynamic version of the RTL, you do not need to
// explicitly add MEMMGR.LIB as this will be done implicitly for you
//---------------------------------------------------------------------------
int WINAPI DllEntryPoint(HINSTANCE, unsigned long, void*)
{
return 1;
}
//---------------------------------------------------------------------------

View File

@@ -1,25 +0,0 @@
Project files to build libpng using Borland C++ Builder v5.0
In order to build and use libpng, please follow these steps:
1). Install zlib in a directory at the same level with libpng.
2). In a console window, go to the zlib directory and type:
make -f win32\Makefile.bor
After performing this step, you should have a file named
zlib.lib in the zlib directory.
3). Add the following conditional define to your project:
PNG_USE_DLL
4). Add libpng.lib or libpngstat.lib to the project.
Build the project.
5). If the build fails, add the paths to png.h and zlib.h to
your include path, and restart the build.
By default, the libpng project uses zlib as a static library. If
you wish to use zlib as a DLL, please read the important notes from
the zlib DLL FAQ, found inside the zlib distribution.
See the libpng documentation for instructions on how to use the code.

View File

@@ -1,22 +0,0 @@
USEUNIT("..\..\png.c");
USEUNIT("..\..\pngerror.c");
USEUNIT("..\..\pngget.c");
USEUNIT("..\..\pngmem.c");
USEUNIT("..\..\pngpread.c");
USEUNIT("..\..\pngread.c");
USEUNIT("..\..\pngrio.c");
USEUNIT("..\..\pngrtran.c");
USEUNIT("..\..\pngrutil.c");
USEUNIT("..\..\pngset.c");
USEUNIT("..\..\pngtrans.c");
USEUNIT("..\..\pngwio.c");
USEUNIT("..\..\pngwrite.c");
USEUNIT("..\..\pngwtran.c");
USEUNIT("..\..\pngwutil.c");
USELIB("..\..\..\zlib\zlib.lib");
//---------------------------------------------------------------------------
#define Library
// To add a file to the library use the Project menu 'Add to Project'.

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