Third-Party: Update zlib and libpng

This commit is contained in:
Vicki Pfau 2022-08-30 20:18:51 -07:00
parent a62afb6a56
commit 055d062944
304 changed files with 25501 additions and 15047 deletions

View File

@ -1,35 +1,47 @@
Libpng 1.6.34 - September 29, 2017
libpng 1.6.37 - April 14, 2019
==============================
This is a public release of libpng, intended for use in production codes.
This is a public release of libpng, intended for use in production code.
Files available for download:
Source files with LF line endings (for Unix/Linux) and with a
"configure" script
Files available for download
----------------------------
libpng-1.6.34.tar.xz (LZMA-compressed, recommended)
libpng-1.6.34.tar.gz
Source files with LF line endings (for Unix/Linux):
Source files with CRLF line endings (for Windows), without the
"configure" script
* libpng-1.6.37.tar.xz (LZMA-compressed, recommended)
* libpng-1.6.37.tar.gz
lpng1634.7z (LZMA-compressed, recommended)
lpng1634.zip
Source files with CRLF line endings (for Windows):
* lp1637.7z (LZMA-compressed, recommended)
* lp1637.zip
Other information:
libpng-1.6.34-README.txt
libpng-1.6.34-LICENSE.txt
libpng-1.6.34-*.asc (armored detached GPG signatures)
* README.md
* LICENSE.md
* AUTHORS.md
* TRADEMARK.md
Changes since the last public release (1.6.33):
Removed contrib/pngsuite/i*.png; some of these were incorrect and caused
test failures.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
Changes since the previous public release (version 1.6.36)
----------------------------------------------------------
* Fixed a use-after-free vulnerability (CVE-2019-7317) in png_image_free.
* Fixed a memory leak in the ARM NEON implementation of png_do_expand_palette.
* Fixed a memory leak in pngtest.c.
* Fixed two vulnerabilities (CVE-2018-14048, CVE-2018-14550) in
contrib/pngminus; refactor.
* Changed the license of contrib/pngminus to MIT; refresh makefile and docs.
(Contributed by Willem van Schaik)
* Fixed a typo in the libpng license v2.
(Contributed by Miguel Ojeda)
* Added makefiles for AddressSanitizer-enabled builds.
* Cleaned up various makefiles.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
Subscription is required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe)
or to glennrp at users.sourceforge.net
Glenn R-P
to subscribe.

45
src/third-party/libpng/AUTHORS vendored Normal file
View File

@ -0,0 +1,45 @@
PNG REFERENCE LIBRARY AUTHORS
=============================
This is the list of PNG Reference Library ("libpng") Contributing
Authors, for copyright and licensing purposes.
* Andreas Dilger
* Cosmin Truta
* Dave Martindale
* Eric S. Raymond
* Gilles Vollant
* Glenn Randers-Pehrson
* Greg Roelofs
* Guy Eric Schalnat
* James Yu
* John Bowler
* Kevin Bracey
* Magnus Holmgren
* Mandar Sahastrabuddhe
* Mans Rullgard
* Matt Sarett
* Mike Klein
* Paul Schmidt
* Sam Bushell
* Samuel Williams
* Simon-Pierre Cadieux
* Tim Wegner
* Tom Lane
* Tom Tanner
* Vadim Barkov
* Willem van Schaik
* Zhijie Liang
* Arm Holdings
- Richard Townsend
* Google Inc.
- Matt Sarett
- Mike Klein
The build projects, the build scripts, the test scripts, and other
files in the "projects", "scripts" and "tests" directories, have other
copyright owners, but are released under the libpng license.
Some files in the "contrib" directory, and some tools-generated files
that are distributed with libpng, have other copyright owners, and are
released under other open source licenses.

View File

@ -1,4 +1,3 @@
#if 0
CHANGES - changes for libpng
version 0.1 [March 29, 1995]
@ -1454,7 +1453,7 @@ Version 1.2.6beta4 [July 28, 2004]
sequential read support.
Added some "#if PNG_WRITE_SUPPORTED" blocks.
Added #ifdef to remove some redundancy in png_malloc_default().
Use png_malloc instead of png_zalloc to allocate the pallete.
Use png_malloc instead of png_zalloc to allocate the palette.
Version 1.0.16rc1 and 1.2.6rc1 [August 4, 2004]
Fixed buffer overflow vulnerability (CVE-2004-0597) in png_handle_tRNS().
@ -3259,7 +3258,7 @@ Version 1.5.2beta01 [February 13, 2011]
Revised PNG_EXPORTA macro to not use an empty parameter, to accommodate the
old VisualC++ preprocessor.
Turned on interlace handling in png_read_png().
Fixed gcc pendantic warnings.
Fixed gcc pedantic warnings.
Handle longjmp in Cygwin.
Fixed png_get_current_row_number() in the interlaced case.
Cleaned up ALPHA flags and transformations.
@ -3359,7 +3358,7 @@ Version 1.5.3beta05 [May 6, 2011]
Pass "" instead of '\0' to png_default_error() in png_err(). This mistake
was introduced in libpng-1.2.20beta01. This fixes CVE-2011-2691.
Added PNG_WRITE_OPTIMIZE_CMF_SUPPORTED macro to make the zlib "CMF" byte
optimization configureable.
optimization configurable.
IDAT compression failed if preceded by a compressed text chunk (bug
introduced in libpng-1.5.3beta01-02). This was because the attempt to
reset the zlib stream in png_write_IDAT happened after the first IDAT
@ -3643,7 +3642,7 @@ Version 1.5.6beta05 [October 12, 2011]
Fixed bug in png_write_chunk_header() debug print, introduced in 1.5.6beta01.
Version 1.5.6beta06 [October 17, 2011]
Removed two redundant tests for unitialized row.
Removed two redundant tests for uninitialized row.
Fixed a relatively harmless memory overwrite in compressed text writing
with a 1 byte zlib buffer.
Add ability to call png_read_update_info multiple times to pngvalid.c.
@ -3689,7 +3688,7 @@ Version 1.5.7beta01 [November 4, 2011]
crash. The pngmem.c implementation of png_malloc() included a cast
to png_size_t which would fail on large allocations on 16-bit systems.
Fix for the preprocessor of the Intel C compiler. The preprocessor
splits adjacent @ signs with a space; this changes the concatentation
splits adjacent @ signs with a space; this changes the concatenation
token from @-@-@ to PNG_JOIN; that should work with all compiler
preprocessors.
Paeth filter speed improvements from work by Siarhei Siamashka. This
@ -3735,7 +3734,7 @@ Version 1.5.7beta03 [November 17, 2011]
gray (on palette) itself.
Fixes for C++ compilation using g++ When libpng source is compiled
using g++. The compiler imposes C++ rules on the C source; thus it
is desireable to make the source work with either C or C++ rules
is desirable to make the source work with either C or C++ rules
without throwing away useful error information. This change adds
png_voidcast to allow C semantic (void*) cases or the corresponding
C++ static_cast operation, as appropriate.
@ -4061,7 +4060,7 @@ Version 1.6.0beta17 [March 10, 2012]
possible to call png_inflate() incrementally. A warning is no longer
issued if the language tag or translated keyword in the iTXt chunk
has zero length.
If benign errors are disabled use maximum window on ancilliary inflate.
If benign errors are disabled use maximum window on ancillary inflate.
This works round a bug introduced in 1.5.4 where compressed ancillary
chunks could end up with a too-small windowBits value in the deflate
header.
@ -4176,7 +4175,7 @@ Version 1.6.0beta27 [August 11, 2012]
declared even though the functions are never actually defined. This
change provides a dummy definition so that the declarations work, yet any
implementation will fail to compile because of an incomplete type.
Re-eliminated the use of strcpy() in pngtest.c. An unncessary use of
Re-eliminated the use of strcpy() in pngtest.c. An unnecessary use of
strcpy() was accidentally re-introduced in libpng16; this change replaces
it with strncpy().
Eliminated use of png_sizeof(); use sizeof() instead.
@ -4309,7 +4308,7 @@ Version 1.6.0beta31 [November 1, 2012]
resulting in VS2010 having to update the files.
Removed non-working ICC profile support code that was mostly added to
libpng-1.6.0beta29 and beta30. There was too much code for too little
gain; implementing full ICC color correction may be desireable but is left
gain; implementing full ICC color correction may be desirable but is left
up to applications.
Version 1.6.0beta32 [November 25, 2012]
@ -4592,7 +4591,7 @@ Version 1.6.3beta07 [June 8, 2013]
the optimizations ('check' vs 'api') are exposed in the public header files
except that the new setting PNG_ARM_NEON_OPT documents how libpng makes the
decision about whether or not to use the optimizations.
Protect symbol prefixing against CC/CPPFLAGS/CFLAGS useage.
Protect symbol prefixing against CC/CPPFLAGS/CFLAGS usage.
Previous iOS/Xcode fixes for the ARM NEON optimizations moved the test
on __ARM_NEON__ from configure time to compile time. This breaks symbol
prefixing because the definition of the special png_init_filter_functions
@ -5635,7 +5634,7 @@ Version 1.6.24beta02 [June 23, 2016]
to All and adds a list of the warnings that need to be turned off. This is
semi-documentary; the intent is to tell libpng users which warnings have
been examined and judged non-fixable at present. The warning about
structure padding is fixable, but it would be a signficant change (moving
structure padding is fixable, but it would be a significant change (moving
structure members around).
Version 1.6.24beta03 [July 4, 2016]
@ -5781,7 +5780,7 @@ Version 1.6.28rc01 [January 3, 2017]
Added option to Cmake build allowing a custom location of zlib to be
specified in a scenario where libpng is being built as a subproject
alongside zlib by another project (Sam Serrels).
Changed png_ptr->options from a png_byte to png_uint_32, to accomodate
Changed png_ptr->options from a png_byte to png_uint_32, to accommodate
up to 16 options.
Version 1.6.28rc02 [January 4, 2017]
@ -5932,7 +5931,7 @@ Version 1.6.32beta04 [August 2, 2017]
Update libpng.3 and libpng-manual.txt about eXIf functions.
Version 1.6.32beta05 [August 2, 2017]
Restored png_get_eXIf() and png_set_eXIf() to maintain API compatability.
Restored png_get_eXIf() and png_set_eXIf() to maintain API compatibility.
Version 1.6.32beta06 [August 2, 2017]
Removed png_get_eXIf_1() and png_set_eXIf_1().
@ -6038,14 +6037,73 @@ Version 1.6.33 [September 28, 2017]
Add end_info structure and png_read_end() to the libpng fuzzer.
Version 1.6.34 [September 29, 2017]
Removed contrib/pngsuite/i*.png; some of these were incorrect and caused
test failures.
Removed contrib/pngsuite/i*.png; some of them caused test failures.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
Version 1.6.35beta01 [March 6, 2018]
Restored 21 of the contrib/pngsuite/i*.png, which do not cause test
failures. Placed the remainder in contrib/pngsuite/interlaced/i*.png.
Added calls to png_set_*() transforms commonly used by browsers to
the fuzzer.
Removed some unnecessary brackets in pngrtran.c
Fixed miscellaneous typos (Patch by github user "luzpaz").
Change "ASM C" to "C ASM" in CMakeLists.txt
Fixed incorrect handling of bKGD chunk in sub-8-bit files (Cosmin)
Added hardware optimization directories to zip and 7z distributions.
Fixed incorrect bitmask for options.
Fixed many spelling typos.
Version 1.6.35beta02 [March 28, 2018]
Make png_get_iCCP consistent with man page (allow compression-type argument
to be NULL, bug report by Lenard Szolnoki).
Version 1.6.35 [July 15, 2018]
Replaced the remaining uses of png_size_t with size_t (Cosmin)
Fixed the calculation of row_factor in png_check_chunk_length
(reported by Thuan Pham in SourceForge issue #278)
Added missing parentheses to a macro definition
(suggested by "irwir" in GitHub issue #216)
Version 1.6.36 [December 1, 2018]
Optimized png_do_expand_palette for ARM processors.
Improved performance by around 10-22% on a recent ARM Chromebook.
(Contributed by Richard Townsend, ARM Holdings)
Fixed manipulation of machine-specific optimization options.
(Contributed by Vicki Pfau)
Used memcpy instead of manual pointer arithmetic on Intel SSE2.
(Contributed by Samuel Williams)
Fixed build errors with MSVC on ARM64.
(Contributed by Zhijie Liang)
Fixed detection of libm in CMakeLists.
(Contributed by Cameron Cawley)
Fixed incorrect creation of pkg-config file in CMakeLists.
(Contributed by Kyle Bentley)
Fixed the CMake build on Windows MSYS by avoiding symlinks.
Fixed a build warning on OpenBSD.
(Contributed by Theo Buehler)
Fixed various typos in comments.
(Contributed by "luz.paz")
Raised the minimum required CMake version from 3.0.2 to 3.1.
Removed yet more of the vestigial support for pre-ANSI C compilers.
Removed ancient makefiles for ancient systems that have been broken
across all previous libpng-1.6.x versions.
Removed the Y2K compliance statement and the export control
information.
Applied various code style and documentation fixes.
Version 1.6.37 [April 14, 2019]
Fixed a use-after-free vulnerability (CVE-2019-7317) in png_image_free.
Fixed a memory leak in the ARM NEON implementation of png_do_expand_palette.
Fixed a memory leak in pngtest.c.
Fixed two vulnerabilities (CVE-2018-14048, CVE-2018-14550) in
contrib/pngminus; refactor.
Changed the license of contrib/pngminus to MIT; refresh makefile and docs.
(Contributed by Willem van Schaik)
Fixed a typo in the libpng license v2.
(Contributed by Miguel Ojeda)
Added makefiles for AddressSanitizer-enabled builds.
Cleaned up various makefiles.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
Subscription is required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe)
or to glennrp at users.sourceforge.net
Glenn R-P
#endif
to subscribe.

View File

@ -1,42 +1,32 @@
# CMakeLists.txt
# Copyright (C) 2007,2009-2017 Glenn Randers-Pehrson
# Copyright (C) 2018 Cosmin Truta
# Copyright (C) 2007,2009-2018 Glenn Randers-Pehrson
# Written by Christian Ehrlicher, 2007
# Revised by Roger Lowman, 2009-2010
# Revised by Clifford Yapp, 2011-2012
# Revised by Clifford Yapp, 2011-2012,2017
# Revised by Roger Leigh, 2016
# Revised by Andreas Franek, 2016
# Revised by Sam Serrels, 2017
# Revised by Vadim Barkov, 2017
# Revised by Vicky Pfau, 2018
# Revised by Cameron Cawley, 2018
# Revised by Cosmin Truta, 2018
# Revised by Kyle Bentley, 2018
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
cmake_minimum_required(VERSION 3.0.2)
cmake_policy(VERSION 3.0.2)
cmake_minimum_required(VERSION 3.1)
cmake_policy(VERSION 3.1)
# Set MacOSX @rpath usage globally.
if (POLICY CMP0020)
cmake_policy(SET CMP0020 NEW)
endif(POLICY CMP0020)
if (POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif(POLICY CMP0042)
# Use new variable expansion policy.
if (POLICY CMP0053)
cmake_policy(SET CMP0053 NEW)
endif(POLICY CMP0053)
if (POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif(POLICY CMP0054)
set(CMAKE_CONFIGURATION_TYPES "Release;Debug;MinSizeRel;RelWithDebInfo")
project(libpng ASM C)
project(libpng C ASM)
enable_testing()
set(PNGLIB_MAJOR 1)
set(PNGLIB_MINOR 6)
set(PNGLIB_RELEASE 34)
set(PNGLIB_RELEASE 37)
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
@ -44,25 +34,19 @@ include(GNUInstallDirs)
# needed packages
#Allow users to specify location of Zlib,
# Useful if zlib is being built alongside this as a sub-project
# Allow users to specify location of Zlib.
# Useful if zlib is being built alongside this as a sub-project.
option(PNG_BUILD_ZLIB "Custom zlib Location, else find_package is used" OFF)
IF(NOT PNG_BUILD_ZLIB)
if(NOT PNG_BUILD_ZLIB)
find_package(ZLIB REQUIRED)
include_directories(${ZLIB_INCLUDE_DIR})
ENDIF(NOT PNG_BUILD_ZLIB)
endif()
if(NOT WIN32)
find_library(M_LIBRARY
NAMES m
PATHS /usr/lib /usr/local/lib
)
if(NOT M_LIBRARY)
message(STATUS "math lib 'libm' not found; floating point support disabled")
endif()
if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU)
find_library(M_LIBRARY m)
else()
# not needed on windows
# libm is not needed and/or not available
set(M_LIBRARY "")
endif()
@ -73,16 +57,14 @@ option(PNG_TESTS "Build libpng tests" ON)
# Many more configuration options could be added here
option(PNG_FRAMEWORK "Build OS X framework" OFF)
option(PNG_DEBUG "Build with debug output" OFF)
option(PNGARG "Disable ANSI-C prototypes" OFF)
option(PNG_HARDWARE_OPTIMIZATIONS "Enable Hardware Optimizations" ON)
option(PNG_DEBUG "Build with debug output" OFF)
option(PNG_HARDWARE_OPTIMIZATIONS "Enable hardware optimizations" ON)
set(PNG_PREFIX "" CACHE STRING "Prefix to add to the API function names")
set(DFA_XTRA "" CACHE FILEPATH "File containing extra configuration settings")
if(PNG_HARDWARE_OPTIMIZATIONS)
# set definitions and sources for arm
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR
CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64")
@ -96,12 +78,13 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR
list(FIND PNG_ARM_NEON_POSSIBLE_VALUES ${PNG_ARM_NEON} index)
if(index EQUAL -1)
message(FATAL_ERROR
" PNG_ARM_NEON must be one of [${PNG_ARM_NEON_POSSIBLE_VALUES}]")
"PNG_ARM_NEON must be one of [${PNG_ARM_NEON_POSSIBLE_VALUES}]")
elseif(NOT ${PNG_ARM_NEON} STREQUAL "off")
set(libpng_arm_sources
arm/arm_init.c
arm/filter_neon.S
arm/filter_neon_intrinsics.c)
arm/filter_neon_intrinsics.c
arm/palette_neon_intrinsics.c)
if(${PNG_ARM_NEON} STREQUAL "on")
add_definitions(-DPNG_ARM_NEON_OPT=2)
@ -115,7 +98,7 @@ endif()
# set definitions and sources for powerpc
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc*" OR
CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc64*" )
CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc64*")
set(PNG_POWERPC_VSX_POSSIBLE_VALUES on off)
set(PNG_POWERPC_VSX "on" CACHE STRING "Enable POWERPC VSX optimizations:
off: disable the optimizations.")
@ -124,7 +107,7 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc*" OR
list(FIND PNG_POWERPC_VSX_POSSIBLE_VALUES ${PNG_POWERPC_VSX} index)
if(index EQUAL -1)
message(FATAL_ERROR
" PNG_POWERPC_VSX must be one of [${PNG_POWERPC_VSX_POSSIBLE_VALUES}]")
"PNG_POWERPC_VSX must be one of [${PNG_POWERPC_VSX_POSSIBLE_VALUES}]")
elseif(NOT ${PNG_POWERPC_VSX} STREQUAL "off")
set(libpng_powerpc_sources
powerpc/powerpc_init.c
@ -139,7 +122,7 @@ endif()
# set definitions and sources for intel
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^i?86" OR
CMAKE_SYSTEM_PROCESSOR MATCHES "^x86_64*" )
CMAKE_SYSTEM_PROCESSOR MATCHES "^x86_64*")
set(PNG_INTEL_SSE_POSSIBLE_VALUES on off)
set(PNG_INTEL_SSE "on" CACHE STRING "Enable INTEL_SSE optimizations:
off: disable the optimizations")
@ -148,7 +131,7 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^i?86" OR
list(FIND PNG_INTEL_SSE_POSSIBLE_VALUES ${PNG_INTEL_SSE} index)
if(index EQUAL -1)
message(FATAL_ERROR
" PNG_INTEL_SSE must be one of [${PNG_INTEL_SSE_POSSIBLE_VALUES}]")
"PNG_INTEL_SSE must be one of [${PNG_INTEL_SSE_POSSIBLE_VALUES}]")
elseif(NOT ${PNG_INTEL_SSE} STREQUAL "off")
set(libpng_intel_sources
intel/intel_init.c
@ -163,7 +146,7 @@ endif()
# set definitions and sources for MIPS
if(CMAKE_SYSTEM_PROCESSOR MATCHES "mipsel*" OR
CMAKE_SYSTEM_PROCESSOR MATCHES "mips64el*" )
CMAKE_SYSTEM_PROCESSOR MATCHES "mips64el*")
set(PNG_MIPS_MSA_POSSIBLE_VALUES on off)
set(PNG_MIPS_MSA "on" CACHE STRING "Enable MIPS_MSA optimizations:
off: disable the optimizations")
@ -172,7 +155,7 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "mipsel*" OR
list(FIND PNG_MIPS_MSA_POSSIBLE_VALUES ${PNG_MIPS_MSA} index)
if(index EQUAL -1)
message(FATAL_ERROR
" PNG_MIPS_MSA must be one of [${PNG_MIPS_MSA_POSSIBLE_VALUES}]")
"PNG_MIPS_MSA must be one of [${PNG_MIPS_MSA_POSSIBLE_VALUES}]")
elseif(NOT ${PNG_MIPS_MSA} STREQUAL "off")
set(libpng_mips_sources
mips/mips_init.c
@ -184,6 +167,33 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "mipsel*" OR
add_definitions(-DPNG_MIPS_MSA_OPT=0)
endif()
endif()
else(PNG_HARDWARE_OPTIMIZATIONS)
# set definitions and sources for arm
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR
CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64")
add_definitions(-DPNG_ARM_NEON_OPT=0)
endif()
# set definitions and sources for powerpc
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc*" OR
CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc64*")
add_definitions(-DPNG_POWERPC_VSX_OPT=0)
endif()
# set definitions and sources for intel
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^i?86" OR
CMAKE_SYSTEM_PROCESSOR MATCHES "^x86_64*")
add_definitions(-DPNG_INTEL_SSE_OPT=0)
endif()
# set definitions and sources for MIPS
if(CMAKE_SYSTEM_PROCESSOR MATCHES "mipsel*" OR
CMAKE_SYSTEM_PROCESSOR MATCHES "mips64el*")
add_definitions(-DPNG_MIPS_MSA_OPT=0)
endif()
endif(PNG_HARDWARE_OPTIMIZATIONS)
# SET LIBNAME
@ -241,17 +251,17 @@ function(symbol_prefix)
foreach(line ${OUT})
string(REGEX MATCH "^PREFIX=" found_match "${line}")
if(found_match)
STRING(REGEX REPLACE "^PREFIX=(.*\)" "\\1" prefix "${line}")
string(REGEX REPLACE "^PREFIX=(.*\)" "\\1" prefix "${line}")
string(REGEX MATCH "__USER_LABEL_PREFIX__" found_match "${prefix}")
if(found_match)
STRING(REGEX REPLACE "(.*)__USER_LABEL_PREFIX__(.*)" "\\1\\2" prefix "${prefix}")
string(REGEX REPLACE "(.*)__USER_LABEL_PREFIX__(.*)" "\\1\\2" prefix "${prefix}")
endif()
set(SYMBOL_PREFIX "${prefix}")
endif()
endforeach()
message(STATUS "Symbol prefix: ${SYMBOL_PREFIX}")
set(SYMBOL_PREFIX "${SYMBOL_PREFIX}" PARENT_SCOPE)
message(STATUS "Symbol prefix: ${SYMBOL_PREFIX}")
set(SYMBOL_PREFIX "${SYMBOL_PREFIX}" PARENT_SCOPE)
endfunction()
if(UNIX)
@ -276,11 +286,11 @@ else()
set(oneValueArgs INPUT OUTPUT)
set(multiValueArgs DEPENDS)
cmake_parse_arguments(_GC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if (NOT _GC_INPUT)
message(FATAL_ERROR "Invalid arguments. generate_out requires input.")
if(NOT _GC_INPUT)
message(FATAL_ERROR "generate_chk: Missing INPUT argument")
endif()
if (NOT _GC_OUTPUT)
message(FATAL_ERROR "Invalid arguments. generate_out requires output.")
if(NOT _GC_OUTPUT)
message(FATAL_ERROR "generate_chk: Missing OUTPUT argument")
endif()
add_custom_command(OUTPUT "${_GC_OUTPUT}"
@ -299,11 +309,11 @@ else()
set(oneValueArgs INPUT OUTPUT)
set(multiValueArgs DEPENDS)
cmake_parse_arguments(_GO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if (NOT _GO_INPUT)
message(FATAL_ERROR "Invalid arguments. generate_out requires input.")
if(NOT _GO_INPUT)
message(FATAL_ERROR "generate_out: Missing INPUT argument")
endif()
if (NOT _GO_OUTPUT)
message(FATAL_ERROR "Invalid arguments. generate_out requires output.")
if(NOT _GO_OUTPUT)
message(FATAL_ERROR "generate_out: Missing OUTPUT argument")
endif()
add_custom_command(OUTPUT "${_GO_OUTPUT}"
@ -322,8 +332,8 @@ else()
set(oneValueArgs OUTPUT)
set(multiValueArgs DEPENDS)
cmake_parse_arguments(_GSO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if (NOT _GSO_OUTPUT)
message(FATAL_ERROR "Invalid arguments. generate_source requires output.")
if(NOT _GSO_OUTPUT)
message(FATAL_ERROR "generate_source: Missing OUTPUT argument")
endif()
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_GSO_OUTPUT}"
@ -424,7 +434,7 @@ else()
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
# A single target handles generation of all generated files. If
# they are dependend upon separately by multiple targets, this
# they are depended upon separately by multiple targets, this
# confuses parallel make (it would require a separate top-level
# target for each file to track the dependencies properly).
add_custom_target(genfiles DEPENDS
@ -505,7 +515,7 @@ set(png_fix_itxt_sources
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
endif(MSVC)
endif()
if(PNG_DEBUG)
add_definitions(-DPNG_DEBUG)
@ -585,7 +595,7 @@ if(NOT PNG_LIB_TARGETS)
message(SEND_ERROR
"No library variant selected to build. "
"Please enable at least one of the following options: "
" PNG_STATIC, PNG_SHARED, PNG_FRAMEWORK")
"PNG_STATIC, PNG_SHARED, PNG_FRAMEWORK")
endif()
if(PNG_SHARED AND WIN32)
@ -598,11 +608,11 @@ function(png_add_test)
set(multiValueArgs OPTIONS FILES)
cmake_parse_arguments(_PAT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if (NOT _PAT_NAME)
message(FATAL_ERROR "Invalid arguments. png_add_test requires name.")
if(NOT _PAT_NAME)
message(FATAL_ERROR "png_add_test: Missing NAME argument")
endif()
if (NOT _PAT_COMMAND)
message(FATAL_ERROR "Invalid arguments. png_add_test requires command.")
if(NOT _PAT_COMMAND)
message(FATAL_ERROR "png_add_test: Missing COMMAND argument")
endif()
set(TEST_OPTIONS "${_PAT_OPTIONS}")
@ -610,19 +620,11 @@ function(png_add_test)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/scripts/test.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake" @ONLY)
if(CMAKE_MAJOR_VERSION GREATER 2) # have generator expressions
add_test(NAME "${_PAT_NAME}"
COMMAND "${CMAKE_COMMAND}"
"-DLIBPNG=$<TARGET_FILE:png>"
"-DTEST_COMMAND=$<TARGET_FILE:${_PAT_COMMAND}>"
-P "${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake")
else() # old 2.x add_test; limited and won't work well on Windows
# Note LIBPNG is a dummy value as there are no generator expressions
add_test("${_PAT_NAME}" "${CMAKE_COMMAND}"
"-DLIBPNG=${CMAKE_CURRENT_BINARY_DIR}/libpng.so"
"-DTEST_COMMAND=./${_PAT_COMMAND}"
-P "${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake")
endif()
add_test(NAME "${_PAT_NAME}"
COMMAND "${CMAKE_COMMAND}"
"-DLIBPNG=$<TARGET_FILE:png>"
"-DTEST_COMMAND=$<TARGET_FILE:${_PAT_COMMAND}>"
-P "${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake")
endfunction()
if(PNG_TESTS AND PNG_SHARED)
@ -687,11 +689,11 @@ if(PNG_TESTS AND PNG_SHARED)
set(TEST_PNG_VALID TRUE)
if(TEST_PNG_ALPHA)
if (NOT "${alpha_type}" STREQUAL "alpha")
if(NOT "${alpha_type}" STREQUAL "alpha")
set(TEST_PNG_VALID FALSE)
endif()
else()
if ("${alpha_type}" STREQUAL "alpha")
if("${alpha_type}" STREQUAL "alpha")
set(TEST_PNG_VALID FALSE)
endif()
endif()
@ -760,51 +762,44 @@ endif()
# copies if different.
include(CMakeParseArguments)
function(CREATE_SYMLINK DEST_FILE)
function(create_symlink DEST_FILE)
cmake_parse_arguments(S "" "FILE;TARGET" "" ${ARGN})
if(NOT S_TARGET AND NOT S_FILE)
message(FATAL_ERROR "Specify either a TARGET or a FILE for CREATE_SYMLINK to link to.")
endif(NOT S_TARGET AND NOT S_FILE)
message(FATAL_ERROR "create_symlink: Missing TARGET or FILE argument")
endif()
if(S_TARGET AND S_FILE)
message(FATAL_ERROR "CREATE_SYMLINK called with both source file ${S_FILE} and build target ${S_TARGET} arguments - can only handle 1 type per call.")
endif(S_TARGET AND S_FILE)
message(FATAL_ERROR "create_symlink: Both source file ${S_FILE} and build target ${S_TARGET} arguments are present; can only have one.")
endif()
if(S_FILE)
# If we don't need to symlink something that's coming from a build target,
# we can go ahead and symlink/copy at configure time.
if(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS)
if(CMAKE_HOST_WIN32 AND NOT CYGWIN)
execute_process(
COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${S_FILE} ${DEST_FILE}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
)
else(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS)
COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${S_FILE} ${DEST_FILE}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
else()
execute_process(
COMMAND ${CMAKE_COMMAND} -E create_symlink ${S_FILE} ${DEST_FILE}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
)
endif(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS)
endif(S_FILE)
COMMAND ${CMAKE_COMMAND} -E create_symlink ${S_FILE} ${DEST_FILE}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
endif()
endif()
if(S_TARGET)
# We need to use generator expressions, which can be a bit tricky, so for
# simplicity make the symlink a POST_BUILD step and use the TARGET
# signature of add_custom_command.
if(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS)
if(CMAKE_HOST_WIN32 AND NOT CYGWIN)
add_custom_command(TARGET ${S_TARGET} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_if_different $<TARGET_LINKER_FILE_NAME:${S_TARGET}> $<TARGET_LINKER_FILE_DIR:${S_TARGET}>/${DEST_FILE}
)
else(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS)
COMMAND "${CMAKE_COMMAND}" -E copy_if_different $<TARGET_LINKER_FILE_NAME:${S_TARGET}> $<TARGET_LINKER_FILE_DIR:${S_TARGET}>/${DEST_FILE})
else()
add_custom_command(TARGET ${S_TARGET} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E create_symlink $<TARGET_LINKER_FILE_NAME:${S_TARGET}> $<TARGET_LINKER_FILE_DIR:${S_TARGET}>/${DEST_FILE}
)
endif(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS)
endif(S_TARGET)
COMMAND "${CMAKE_COMMAND}" -E create_symlink $<TARGET_LINKER_FILE_NAME:${S_TARGET}> $<TARGET_LINKER_FILE_DIR:${S_TARGET}>/${DEST_FILE})
endif()
endif()
endfunction()
@ -816,103 +811,95 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genout.cmake.in
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/gensrc.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake @ONLY)
# libpng is a library so default to 'lib'
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
set(CMAKE_INSTALL_LIBDIR lib)
endif(NOT DEFINED CMAKE_INSTALL_LIBDIR)
endif()
# 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.
# Only do this on Windows for Cygwin - the files don't make much sense outside
# a UNIX look alike
# of a UNIX look-alike.
if(NOT WIN32 OR CYGWIN OR MINGW)
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix ${CMAKE_INSTALL_PREFIX})
set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
set(includedir ${CMAKE_INSTALL_PREFIX}/include)
set(libdir ${CMAKE_INSTALL_FULL_LIBDIR})
set(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR})
set(LIBS "-lz -lm")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc @ONLY)
CREATE_SYMLINK(libpng.pc FILE ${PNGLIB_NAME}.pc)
create_symlink(libpng.pc FILE ${PNGLIB_NAME}.pc)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config @ONLY)
CREATE_SYMLINK(libpng-config FILE ${PNGLIB_NAME}-config)
endif(NOT WIN32 OR CYGWIN OR MINGW)
create_symlink(libpng-config FILE ${PNGLIB_NAME}-config)
endif()
# SET UP LINKS
if(PNG_SHARED)
set_target_properties(png PROPERTIES
# VERSION 16.${PNGLIB_RELEASE}.1.6.34
# VERSION 16.${PNGLIB_RELEASE}.1.6.37
VERSION 16.${PNGLIB_RELEASE}.0
SOVERSION 16
CLEAN_DIRECT_OUTPUT 1)
endif()
# If CMake > 2.4.x, we set a variable used below to export
# targets to an export file.
# TODO: Use VERSION_GREATER after our cmake_minimum_required >= 2.6.2
if(CMAKE_MAJOR_VERSION GREATER 1 AND CMAKE_MINOR_VERSION GREATER 4)
set(PNG_EXPORT_RULE EXPORT libpng)
elseif(CMAKE_MAJOR_VERSION GREATER 2) # future proof
set(PNG_EXPORT_RULE EXPORT libpng)
endif()
# INSTALL
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
install(TARGETS ${PNG_LIB_TARGETS}
${PNG_EXPORT_RULE}
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
FRAMEWORK DESTINATION ${CMAKE_INSTALL_LIBDIR})
EXPORT libpng
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
FRAMEWORK DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(PNG_SHARED)
# Create a symlink for libpng.dll.a => libpng16.dll.a on Cygwin
if(CYGWIN OR MINGW)
CREATE_SYMLINK(libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} TARGET png)
install(FILES $<TARGET_LINKER_FILE_DIR:png>/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(CYGWIN OR MINGW)
create_symlink(libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} TARGET png)
install(FILES $<TARGET_LINKER_FILE_DIR:png>/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
if(NOT WIN32)
CREATE_SYMLINK(libpng${CMAKE_SHARED_LIBRARY_SUFFIX} TARGET png)
install(FILES $<TARGET_LINKER_FILE_DIR:png>/libpng${CMAKE_SHARED_LIBRARY_SUFFIX} DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(NOT WIN32)
endif(PNG_SHARED)
create_symlink(libpng${CMAKE_SHARED_LIBRARY_SUFFIX} TARGET png)
install(FILES $<TARGET_LINKER_FILE_DIR:png>/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
endif()
if(PNG_STATIC)
if(NOT WIN32 OR CYGWIN OR MINGW)
CREATE_SYMLINK( libpng${CMAKE_STATIC_LIBRARY_SUFFIX} TARGET png_static)
install(FILES $<TARGET_LINKER_FILE_DIR:png_static>/libpng${CMAKE_STATIC_LIBRARY_SUFFIX} DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(NOT WIN32 OR CYGWIN OR MINGW)
endif()
create_symlink(libpng${CMAKE_STATIC_LIBRARY_SUFFIX} TARGET png_static)
install(FILES $<TARGET_LINKER_FILE_DIR:png_static>/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
endif()
endif()
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
install(FILES ${libpng_public_hdrs} DESTINATION include)
install(FILES ${libpng_public_hdrs} DESTINATION include/${PNGLIB_NAME})
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL)
install(FILES ${libpng_public_hdrs} DESTINATION include)
install(FILES ${libpng_public_hdrs} DESTINATION include/${PNGLIB_NAME})
endif()
if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL )
if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL)
if(NOT WIN32 OR CYGWIN OR MINGW)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config DESTINATION bin)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
DESTINATION bin)
endif(NOT WIN32 OR CYGWIN OR MINGW)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config DESTINATION bin)
endif()
endif()
if(NOT SKIP_INSTALL_PROGRAMS AND NOT SKIP_INSTALL_ALL )
if(NOT SKIP_INSTALL_PROGRAMS AND NOT SKIP_INSTALL_ALL)
install(TARGETS ${PNG_BIN_TARGETS}
RUNTIME DESTINATION bin)
RUNTIME DESTINATION bin)
endif()
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL)
# Install man pages
if(NOT PNG_MAN_DIR)
set(PNG_MAN_DIR "share/man")
endif()
install(FILES libpng.3 libpngpf.3 DESTINATION ${PNG_MAN_DIR}/man3)
install(FILES png.5 DESTINATION ${PNG_MAN_DIR}/man5)
install(FILES libpng.3 libpngpf.3 DESTINATION ${PNG_MAN_DIR}/man3)
install(FILES png.5 DESTINATION ${PNG_MAN_DIR}/man5)
# Install pkg-config files
if(NOT CMAKE_HOST_WIN32 OR CYGWIN OR MINGW)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc
@ -923,12 +910,11 @@ if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
DESTINATION bin)
endif(NOT CMAKE_HOST_WIN32 OR CYGWIN OR MINGW)
endif()
endif()
# On versions of CMake that support it, create an export file CMake
# users can include() to import our targets
if(PNG_EXPORT_RULE AND NOT SKIP_INSTALL_EXPORT AND NOT SKIP_INSTALL_ALL )
# Create an export file that CMake users can include() to import our targets.
if(NOT SKIP_INSTALL_EXPORT AND NOT SKIP_INSTALL_ALL)
install(EXPORT libpng DESTINATION lib/libpng FILE lib${PNG_LIB_NAME}.cmake)
endif()

View File

@ -284,7 +284,7 @@ those sections that are actually used will be loaded into memory.
XIV. Enabling or disabling hardware optimizations
Certain hardware capabilites, such as the Intel SSE instructions,
Certain hardware capabilities, such as the Intel SSE instructions,
are normally detected at run time. Enable them with configure options
such as one of

View File

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

View File

@ -1,7 +1,7 @@
# Makefile.am, the source file for Makefile.in (and hence Makefile), is
#
# Copyright (c) 2018 Cosmin Truta
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
# Last changed in libpng 1.6.25 [September 1, 2016]
#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
@ -95,7 +95,8 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngerror.c\
if PNG_ARM_NEON
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += arm/arm_init.c\
arm/filter_neon.S arm/filter_neon_intrinsics.c
arm/filter_neon.S arm/filter_neon_intrinsics.c \
arm/palette_neon_intrinsics.c
endif
if PNG_MIPS_MSA
@ -147,7 +148,7 @@ pkgconfig_DATA = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc
# from those directories being included. This only works if the configure is
# not done in the source directory!
EXTRA_DIST= \
ANNOUNCE CHANGES INSTALL LICENSE README TODO \
ANNOUNCE AUTHORS CHANGES INSTALL LICENSE README TODO TRADEMARK \
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
$(TESTS) $(XFAIL_TESTS) tests/pngstest \

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.15 from Makefile.am.
# Makefile.in generated by automake 1.16.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -16,8 +16,8 @@
# Makefile.am, the source file for Makefile.in (and hence Makefile), is
#
# Copyright (c) 2018 Cosmin Truta
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
# Last changed in libpng 1.6.25 [September 1, 2016]
#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
@ -106,7 +106,8 @@ check_PROGRAMS = pngtest$(EXEEXT) pngunknown$(EXEEXT) \
@HAVE_CLOCK_GETTIME_TRUE@am__append_1 = timepng
bin_PROGRAMS = pngfix$(EXEEXT) png-fix-itxt$(EXEEXT)
@PNG_ARM_NEON_TRUE@am__append_2 = arm/arm_init.c\
@PNG_ARM_NEON_TRUE@ arm/filter_neon.S arm/filter_neon_intrinsics.c
@PNG_ARM_NEON_TRUE@ arm/filter_neon.S arm/filter_neon_intrinsics.c \
@PNG_ARM_NEON_TRUE@ arm/palette_neon_intrinsics.c
@PNG_MIPS_MSA_TRUE@am__append_3 = mips/mips_init.c\
@PNG_MIPS_MSA_TRUE@ mips/filter_msa_intrinsics.c
@ -142,6 +143,12 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = libpng.pc libpng-config
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libdir)" \
"$(DESTDIR)$(bindir)" "$(DESTDIR)$(man3dir)" \
"$(DESTDIR)$(man5dir)" "$(DESTDIR)$(pkgconfigdir)" \
"$(DESTDIR)$(pkgincludedir)" "$(DESTDIR)$(pkgincludedir)"
@HAVE_CLOCK_GETTIME_TRUE@am__EXEEXT_1 = timepng$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS)
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@ -169,10 +176,6 @@ am__uninstall_files_from_dir = { \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
"$(DESTDIR)$(bindir)" "$(DESTDIR)$(man3dir)" \
"$(DESTDIR)$(man5dir)" "$(DESTDIR)$(pkgconfigdir)" \
"$(DESTDIR)$(pkgincludedir)" "$(DESTDIR)$(pkgincludedir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LIBADD =
am__libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES_DIST = png.c \
@ -181,12 +184,14 @@ am__libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES_DIST = png.c \
pngwtran.c pngwutil.c png.h pngconf.h pngdebug.h pnginfo.h \
pngpriv.h pngstruct.h pngusr.dfa arm/arm_init.c \
arm/filter_neon.S arm/filter_neon_intrinsics.c \
mips/mips_init.c mips/filter_msa_intrinsics.c \
intel/intel_init.c intel/filter_sse2_intrinsics.c \
powerpc/powerpc_init.c powerpc/filter_vsx_intrinsics.c
arm/palette_neon_intrinsics.c mips/mips_init.c \
mips/filter_msa_intrinsics.c intel/intel_init.c \
intel/filter_sse2_intrinsics.c powerpc/powerpc_init.c \
powerpc/filter_vsx_intrinsics.c
am__dirstamp = $(am__leading_dot)dirstamp
@PNG_ARM_NEON_TRUE@am__objects_1 = arm/arm_init.lo arm/filter_neon.lo \
@PNG_ARM_NEON_TRUE@ arm/filter_neon_intrinsics.lo
@PNG_ARM_NEON_TRUE@ arm/filter_neon_intrinsics.lo \
@PNG_ARM_NEON_TRUE@ arm/palette_neon_intrinsics.lo
@PNG_MIPS_MSA_TRUE@am__objects_2 = mips/mips_init.lo \
@PNG_MIPS_MSA_TRUE@ mips/filter_msa_intrinsics.lo
@PNG_INTEL_SSE_TRUE@am__objects_3 = intel/intel_init.lo \
@ -211,8 +216,6 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LINK = $(LIBTOOL) $(AM_V_lt) \
$(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS) $(LDFLAGS) -o \
$@
@HAVE_CLOCK_GETTIME_TRUE@am__EXEEXT_1 = timepng$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS)
am_png_fix_itxt_OBJECTS = contrib/tools/png-fix-itxt.$(OBJEXT)
png_fix_itxt_OBJECTS = $(am_png_fix_itxt_OBJECTS)
png_fix_itxt_LDADD = $(LDADD)
@ -255,11 +258,36 @@ am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/png.Plo ./$(DEPDIR)/pngerror.Plo \
./$(DEPDIR)/pngget.Plo ./$(DEPDIR)/pngmem.Plo \
./$(DEPDIR)/pngpread.Plo ./$(DEPDIR)/pngread.Plo \
./$(DEPDIR)/pngrio.Plo ./$(DEPDIR)/pngrtran.Plo \
./$(DEPDIR)/pngrutil.Plo ./$(DEPDIR)/pngset.Plo \
./$(DEPDIR)/pngtest.Po ./$(DEPDIR)/pngtrans.Plo \
./$(DEPDIR)/pngwio.Plo ./$(DEPDIR)/pngwrite.Plo \
./$(DEPDIR)/pngwtran.Plo ./$(DEPDIR)/pngwutil.Plo \
arm/$(DEPDIR)/arm_init.Plo arm/$(DEPDIR)/filter_neon.Plo \
arm/$(DEPDIR)/filter_neon_intrinsics.Plo \
arm/$(DEPDIR)/palette_neon_intrinsics.Plo \
contrib/libtests/$(DEPDIR)/pngimage.Po \
contrib/libtests/$(DEPDIR)/pngstest.Po \
contrib/libtests/$(DEPDIR)/pngunknown.Po \
contrib/libtests/$(DEPDIR)/pngvalid.Po \
contrib/libtests/$(DEPDIR)/timepng.Po \
contrib/tools/$(DEPDIR)/png-fix-itxt.Po \
contrib/tools/$(DEPDIR)/pngcp.Po \
contrib/tools/$(DEPDIR)/pngfix.Po \
intel/$(DEPDIR)/filter_sse2_intrinsics.Plo \
intel/$(DEPDIR)/intel_init.Plo \
mips/$(DEPDIR)/filter_msa_intrinsics.Plo \
mips/$(DEPDIR)/mips_init.Plo \
powerpc/$(DEPDIR)/filter_vsx_intrinsics.Plo \
powerpc/$(DEPDIR)/powerpc_init.Plo
am__mv = mv -f
CPPASCOMPILE = $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)
LTCPPASCOMPILE = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \
LTCPPASCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CCAS) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CCASFLAGS) $(CCASFLAGS)
@ -506,7 +534,7 @@ TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
$(TEST_LOG_FLAGS)
am__DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.in \
$(srcdir)/config.h.in $(srcdir)/libpng-config.in \
$(srcdir)/libpng.pc.in INSTALL README TODO compile \
$(srcdir)/libpng.pc.in AUTHORS INSTALL README TODO compile \
config.guess config.sub depcomp install-sh ltmain.sh missing \
test-driver
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@ -756,7 +784,7 @@ pkgconfig_DATA = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc
# from those directories being included. This only works if the configure is
# not done in the source directory!
EXTRA_DIST = \
ANNOUNCE CHANGES INSTALL LICENSE README TODO \
ANNOUNCE AUTHORS CHANGES INSTALL LICENSE README TODO TRADEMARK \
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
$(TESTS) $(XFAIL_TESTS) tests/pngstest \
@ -814,8 +842,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@ -845,83 +873,6 @@ libpng.pc: $(top_builddir)/config.status $(srcdir)/libpng.pc.in
cd $(top_builddir) && $(SHELL) ./config.status $@
libpng-config: $(top_builddir)/config.status $(srcdir)/libpng-config.in
cd $(top_builddir) && $(SHELL) ./config.status $@
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
list2="$$list2 $$p"; \
else :; fi; \
done; \
test -z "$$list2" || { \
echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
}
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
for p in $$list; do \
$(am__strip_dir) \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; \
locs=`for p in $$list; do echo $$p; done | \
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
sort -u`; \
test -z "$$locs" || { \
echo rm -f $${locs}; \
rm -f $${locs}; \
}
arm/$(am__dirstamp):
@$(MKDIR_P) arm
@: > arm/$(am__dirstamp)
arm/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) arm/$(DEPDIR)
@: > arm/$(DEPDIR)/$(am__dirstamp)
arm/arm_init.lo: arm/$(am__dirstamp) arm/$(DEPDIR)/$(am__dirstamp)
arm/filter_neon.lo: arm/$(am__dirstamp) arm/$(DEPDIR)/$(am__dirstamp)
arm/filter_neon_intrinsics.lo: arm/$(am__dirstamp) \
arm/$(DEPDIR)/$(am__dirstamp)
mips/$(am__dirstamp):
@$(MKDIR_P) mips
@: > mips/$(am__dirstamp)
mips/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) mips/$(DEPDIR)
@: > mips/$(DEPDIR)/$(am__dirstamp)
mips/mips_init.lo: mips/$(am__dirstamp) mips/$(DEPDIR)/$(am__dirstamp)
mips/filter_msa_intrinsics.lo: mips/$(am__dirstamp) \
mips/$(DEPDIR)/$(am__dirstamp)
intel/$(am__dirstamp):
@$(MKDIR_P) intel
@: > intel/$(am__dirstamp)
intel/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) intel/$(DEPDIR)
@: > intel/$(DEPDIR)/$(am__dirstamp)
intel/intel_init.lo: intel/$(am__dirstamp) \
intel/$(DEPDIR)/$(am__dirstamp)
intel/filter_sse2_intrinsics.lo: intel/$(am__dirstamp) \
intel/$(DEPDIR)/$(am__dirstamp)
powerpc/$(am__dirstamp):
@$(MKDIR_P) powerpc
@: > powerpc/$(am__dirstamp)
powerpc/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) powerpc/$(DEPDIR)
@: > powerpc/$(DEPDIR)/$(am__dirstamp)
powerpc/powerpc_init.lo: powerpc/$(am__dirstamp) \
powerpc/$(DEPDIR)/$(am__dirstamp)
powerpc/filter_vsx_intrinsics.lo: powerpc/$(am__dirstamp) \
powerpc/$(DEPDIR)/$(am__dirstamp)
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la: $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES) $(EXTRA_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES)
$(AM_V_CCLD)$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LINK) -rpath $(libdir) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LIBADD) $(LIBS)
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
@ -980,6 +931,85 @@ clean-checkPROGRAMS:
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
list2="$$list2 $$p"; \
else :; fi; \
done; \
test -z "$$list2" || { \
echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
}
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
for p in $$list; do \
$(am__strip_dir) \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; \
locs=`for p in $$list; do echo $$p; done | \
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
sort -u`; \
test -z "$$locs" || { \
echo rm -f $${locs}; \
rm -f $${locs}; \
}
arm/$(am__dirstamp):
@$(MKDIR_P) arm
@: > arm/$(am__dirstamp)
arm/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) arm/$(DEPDIR)
@: > arm/$(DEPDIR)/$(am__dirstamp)
arm/arm_init.lo: arm/$(am__dirstamp) arm/$(DEPDIR)/$(am__dirstamp)
arm/filter_neon.lo: arm/$(am__dirstamp) arm/$(DEPDIR)/$(am__dirstamp)
arm/filter_neon_intrinsics.lo: arm/$(am__dirstamp) \
arm/$(DEPDIR)/$(am__dirstamp)
arm/palette_neon_intrinsics.lo: arm/$(am__dirstamp) \
arm/$(DEPDIR)/$(am__dirstamp)
mips/$(am__dirstamp):
@$(MKDIR_P) mips
@: > mips/$(am__dirstamp)
mips/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) mips/$(DEPDIR)
@: > mips/$(DEPDIR)/$(am__dirstamp)
mips/mips_init.lo: mips/$(am__dirstamp) mips/$(DEPDIR)/$(am__dirstamp)
mips/filter_msa_intrinsics.lo: mips/$(am__dirstamp) \
mips/$(DEPDIR)/$(am__dirstamp)
intel/$(am__dirstamp):
@$(MKDIR_P) intel
@: > intel/$(am__dirstamp)
intel/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) intel/$(DEPDIR)
@: > intel/$(DEPDIR)/$(am__dirstamp)
intel/intel_init.lo: intel/$(am__dirstamp) \
intel/$(DEPDIR)/$(am__dirstamp)
intel/filter_sse2_intrinsics.lo: intel/$(am__dirstamp) \
intel/$(DEPDIR)/$(am__dirstamp)
powerpc/$(am__dirstamp):
@$(MKDIR_P) powerpc
@: > powerpc/$(am__dirstamp)
powerpc/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) powerpc/$(DEPDIR)
@: > powerpc/$(DEPDIR)/$(am__dirstamp)
powerpc/powerpc_init.lo: powerpc/$(am__dirstamp) \
powerpc/$(DEPDIR)/$(am__dirstamp)
powerpc/filter_vsx_intrinsics.lo: powerpc/$(am__dirstamp) \
powerpc/$(DEPDIR)/$(am__dirstamp)
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la: $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES) $(EXTRA_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES)
$(AM_V_CCLD)$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LINK) -rpath $(libdir) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LIBADD) $(LIBS)
contrib/tools/$(am__dirstamp):
@$(MKDIR_P) contrib/tools
@: > contrib/tools/$(am__dirstamp)
@ -1097,39 +1127,46 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/png.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngerror.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngget.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngmem.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngpread.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngread.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngrio.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngrtran.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngrutil.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngset.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngtest.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngtrans.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngwio.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngwrite.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngwtran.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngwutil.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@arm/$(DEPDIR)/arm_init.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@arm/$(DEPDIR)/filter_neon.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@arm/$(DEPDIR)/filter_neon_intrinsics.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/pngimage.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/pngstest.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/pngunknown.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/pngvalid.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/timepng.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@contrib/tools/$(DEPDIR)/png-fix-itxt.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@contrib/tools/$(DEPDIR)/pngcp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@contrib/tools/$(DEPDIR)/pngfix.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@intel/$(DEPDIR)/filter_sse2_intrinsics.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@intel/$(DEPDIR)/intel_init.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@mips/$(DEPDIR)/filter_msa_intrinsics.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@mips/$(DEPDIR)/mips_init.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@powerpc/$(DEPDIR)/filter_vsx_intrinsics.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@powerpc/$(DEPDIR)/powerpc_init.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/png.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngerror.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngget.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngmem.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngpread.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngread.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngrio.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngrtran.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngrutil.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngset.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngtest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngtrans.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngwio.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngwrite.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngwtran.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngwutil.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@arm/$(DEPDIR)/arm_init.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@arm/$(DEPDIR)/filter_neon.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@arm/$(DEPDIR)/filter_neon_intrinsics.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@arm/$(DEPDIR)/palette_neon_intrinsics.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/pngimage.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/pngstest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/pngunknown.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/pngvalid.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/timepng.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@contrib/tools/$(DEPDIR)/png-fix-itxt.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@contrib/tools/$(DEPDIR)/pngcp.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@contrib/tools/$(DEPDIR)/pngfix.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@intel/$(DEPDIR)/filter_sse2_intrinsics.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@intel/$(DEPDIR)/intel_init.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@mips/$(DEPDIR)/filter_msa_intrinsics.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@mips/$(DEPDIR)/mips_init.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@powerpc/$(DEPDIR)/filter_vsx_intrinsics.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@powerpc/$(DEPDIR)/powerpc_init.Plo@am__quote@ # am--include-marker
$(am__depfiles_remade):
@$(MKDIR_P) $(@D)
@echo '# dummy' >$@-t && $(am__mv) $@-t $@
am--depfiles: $(am__depfiles_remade)
.S.o:
@am__fastdepCCAS_TRUE@ $(AM_V_CPPAS)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@ -1520,7 +1557,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
fi; \
$$success || exit 1
check-TESTS:
check-TESTS: $(check_PROGRAMS)
@list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list
@list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
@ -1787,7 +1824,10 @@ tests/pngimage-full.log: tests/pngimage-full
@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT)
distdir: $(DISTFILES)
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
$(am__remove_distdir)
test -d "$(distdir)" || mkdir "$(distdir)"
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
@ -1830,7 +1870,7 @@ distdir: $(DISTFILES)
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r "$(distdir)"
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
$(am__post_remove_distdir)
dist-bzip2: distdir
@ -1855,7 +1895,7 @@ dist-shar: distdir
@echo WARNING: "Support for shar distribution archives is" \
"deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
$(am__post_remove_distdir)
dist-zip: distdir
@ -1873,7 +1913,7 @@ dist dist-all:
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lz*) \
@ -1883,7 +1923,7 @@ distcheck: dist
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
@ -1957,12 +1997,12 @@ check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) check-am
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(MANS) $(DATA) \
all-am: Makefile $(PROGRAMS) $(LTLIBRARIES) $(SCRIPTS) $(MANS) $(DATA) \
$(HEADERS) config.h
install-binPROGRAMS: install-libLTLIBRARIES
installdirs:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(pkgincludedir)" "$(DESTDIR)$(pkgincludedir)"; do \
for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(pkgincludedir)" "$(DESTDIR)$(pkgincludedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: $(BUILT_SOURCES)
@ -2024,7 +2064,40 @@ clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
distclean: distclean-am
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf ./$(DEPDIR) arm/$(DEPDIR) contrib/libtests/$(DEPDIR) contrib/tools/$(DEPDIR) intel/$(DEPDIR) mips/$(DEPDIR) powerpc/$(DEPDIR)
-rm -f ./$(DEPDIR)/png.Plo
-rm -f ./$(DEPDIR)/pngerror.Plo
-rm -f ./$(DEPDIR)/pngget.Plo
-rm -f ./$(DEPDIR)/pngmem.Plo
-rm -f ./$(DEPDIR)/pngpread.Plo
-rm -f ./$(DEPDIR)/pngread.Plo
-rm -f ./$(DEPDIR)/pngrio.Plo
-rm -f ./$(DEPDIR)/pngrtran.Plo
-rm -f ./$(DEPDIR)/pngrutil.Plo
-rm -f ./$(DEPDIR)/pngset.Plo
-rm -f ./$(DEPDIR)/pngtest.Po
-rm -f ./$(DEPDIR)/pngtrans.Plo
-rm -f ./$(DEPDIR)/pngwio.Plo
-rm -f ./$(DEPDIR)/pngwrite.Plo
-rm -f ./$(DEPDIR)/pngwtran.Plo
-rm -f ./$(DEPDIR)/pngwutil.Plo
-rm -f arm/$(DEPDIR)/arm_init.Plo
-rm -f arm/$(DEPDIR)/filter_neon.Plo
-rm -f arm/$(DEPDIR)/filter_neon_intrinsics.Plo
-rm -f arm/$(DEPDIR)/palette_neon_intrinsics.Plo
-rm -f contrib/libtests/$(DEPDIR)/pngimage.Po
-rm -f contrib/libtests/$(DEPDIR)/pngstest.Po
-rm -f contrib/libtests/$(DEPDIR)/pngunknown.Po
-rm -f contrib/libtests/$(DEPDIR)/pngvalid.Po
-rm -f contrib/libtests/$(DEPDIR)/timepng.Po
-rm -f contrib/tools/$(DEPDIR)/png-fix-itxt.Po
-rm -f contrib/tools/$(DEPDIR)/pngcp.Po
-rm -f contrib/tools/$(DEPDIR)/pngfix.Po
-rm -f intel/$(DEPDIR)/filter_sse2_intrinsics.Plo
-rm -f intel/$(DEPDIR)/intel_init.Plo
-rm -f mips/$(DEPDIR)/filter_msa_intrinsics.Plo
-rm -f mips/$(DEPDIR)/mips_init.Plo
-rm -f powerpc/$(DEPDIR)/filter_vsx_intrinsics.Plo
-rm -f powerpc/$(DEPDIR)/powerpc_init.Plo
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-hdr distclean-libtool distclean-tags
@ -2076,7 +2149,40 @@ installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -rf ./$(DEPDIR) arm/$(DEPDIR) contrib/libtests/$(DEPDIR) contrib/tools/$(DEPDIR) intel/$(DEPDIR) mips/$(DEPDIR) powerpc/$(DEPDIR)
-rm -f ./$(DEPDIR)/png.Plo
-rm -f ./$(DEPDIR)/pngerror.Plo
-rm -f ./$(DEPDIR)/pngget.Plo
-rm -f ./$(DEPDIR)/pngmem.Plo
-rm -f ./$(DEPDIR)/pngpread.Plo
-rm -f ./$(DEPDIR)/pngread.Plo
-rm -f ./$(DEPDIR)/pngrio.Plo
-rm -f ./$(DEPDIR)/pngrtran.Plo
-rm -f ./$(DEPDIR)/pngrutil.Plo
-rm -f ./$(DEPDIR)/pngset.Plo
-rm -f ./$(DEPDIR)/pngtest.Po
-rm -f ./$(DEPDIR)/pngtrans.Plo
-rm -f ./$(DEPDIR)/pngwio.Plo
-rm -f ./$(DEPDIR)/pngwrite.Plo
-rm -f ./$(DEPDIR)/pngwtran.Plo
-rm -f ./$(DEPDIR)/pngwutil.Plo
-rm -f arm/$(DEPDIR)/arm_init.Plo
-rm -f arm/$(DEPDIR)/filter_neon.Plo
-rm -f arm/$(DEPDIR)/filter_neon_intrinsics.Plo
-rm -f arm/$(DEPDIR)/palette_neon_intrinsics.Plo
-rm -f contrib/libtests/$(DEPDIR)/pngimage.Po
-rm -f contrib/libtests/$(DEPDIR)/pngstest.Po
-rm -f contrib/libtests/$(DEPDIR)/pngunknown.Po
-rm -f contrib/libtests/$(DEPDIR)/pngvalid.Po
-rm -f contrib/libtests/$(DEPDIR)/timepng.Po
-rm -f contrib/tools/$(DEPDIR)/png-fix-itxt.Po
-rm -f contrib/tools/$(DEPDIR)/pngcp.Po
-rm -f contrib/tools/$(DEPDIR)/pngfix.Po
-rm -f intel/$(DEPDIR)/filter_sse2_intrinsics.Plo
-rm -f intel/$(DEPDIR)/intel_init.Plo
-rm -f mips/$(DEPDIR)/filter_msa_intrinsics.Plo
-rm -f mips/$(DEPDIR)/mips_init.Plo
-rm -f powerpc/$(DEPDIR)/filter_vsx_intrinsics.Plo
-rm -f powerpc/$(DEPDIR)/powerpc_init.Plo
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
@ -2104,19 +2210,19 @@ uninstall-man: uninstall-man3 uninstall-man5
.MAKE: all check check-am install install-am install-data-am \
install-exec-am install-strip uninstall-am
.PHONY: CTAGS GTAGS TAGS all all-am am--refresh check check-TESTS \
check-am clean clean-binPROGRAMS clean-checkPROGRAMS \
clean-cscope clean-generic clean-libLTLIBRARIES clean-libtool \
cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \
dist-gzip dist-hook dist-lzip dist-shar dist-tarZ dist-xz \
dist-zip distcheck distclean distclean-compile \
distclean-generic distclean-hdr distclean-libtool \
distclean-tags distcleancheck distdir distuninstallcheck dvi \
dvi-am html html-am info info-am install install-am \
install-binPROGRAMS install-binSCRIPTS install-data \
install-data-am install-data-hook install-dvi install-dvi-am \
install-exec install-exec-am install-exec-hook install-html \
install-html-am install-info install-info-am \
.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles am--refresh check \
check-TESTS check-am clean clean-binPROGRAMS \
clean-checkPROGRAMS clean-cscope clean-generic \
clean-libLTLIBRARIES clean-libtool cscope cscopelist-am ctags \
ctags-am dist dist-all dist-bzip2 dist-gzip dist-hook \
dist-lzip dist-shar dist-tarZ dist-xz dist-zip distcheck \
distclean distclean-compile distclean-generic distclean-hdr \
distclean-libtool distclean-tags distcleancheck distdir \
distuninstallcheck dvi dvi-am html html-am info info-am \
install install-am install-binPROGRAMS install-binSCRIPTS \
install-data install-data-am install-data-hook install-dvi \
install-dvi-am install-exec install-exec-am install-exec-hook \
install-html install-html-am install-info install-info-am \
install-libLTLIBRARIES install-man install-man3 install-man5 \
install-nodist_pkgincludeHEADERS install-pdf install-pdf-am \
install-pkgconfigDATA install-pkgincludeHEADERS install-ps \

View File

@ -1,15 +1,16 @@
README for libpng version 1.6.34 - September 29, 2017 (shared library 16.0)
See the note about version numbers near the top of png.h
README for libpng version 1.6.37 - April 14, 2019
=================================================
See the note about version numbers near the top of png.h.
See INSTALL for instructions on how to install libpng.
Libpng comes in several distribution formats. Get libpng-*.tar.gz or
libpng-*.tar.xz or if you want UNIX-style line endings in the text files,
or lpng*.7z or lpng*.zip if you want DOS-style line endings.
libpng-*.tar.xz or if you want UNIX-style line endings in the text
files, or lpng*.7z or lpng*.zip if you want DOS-style line endings.
Version 0.89 was the first official release of libpng. Don't let the
fact that it's the first release fool you. The libpng library has been in
extensive use and testing since mid-1995. By late 1997 it had
fact that it's the first release fool you. The libpng library has been
in extensive use and testing since mid-1995. By late 1997 it had
finally gotten to the stage where there hadn't been significant
changes to the API in some time, and people have a bad feeling about
libraries with versions < 1.0. Version 1.0.0 was released in
@ -60,94 +61,59 @@ the library action on the detection of chunk CRC errors. It is possible
to set different actions based on whether the CRC error occurred in a
critical or an ancillary chunk.
The changes made to the library, and bugs fixed are based on discussions
on the PNG-implement mailing list and not on material submitted
privately to Guy, Andreas, or Glenn. They will forward any good
suggestions to the list.
For a detailed description on using libpng, read libpng-manual.txt. For
examples of libpng in a program, see example.c and pngtest.c. For usage
information and restrictions (what little they are) on libpng, see
png.h. For a description on using zlib (the compression library used by
libpng) and zlib's restrictions, see zlib.h
For a detailed description on using libpng, read libpng-manual.txt.
For examples of libpng in a program, see example.c and pngtest.c. For
usage information and restrictions (what little they are) on libpng,
see png.h. For a description on using zlib (the compression library
used by libpng) and zlib's restrictions, see zlib.h
I have included a general makefile, as well as several machine and
compiler specific ones, but you may have to modify one for your own needs.
compiler specific ones, but you may have to modify one for your own
needs.
You should use zlib 1.0.4 or later to run this, but it MAY work with
versions as old as zlib 0.95. Even so, there are bugs in older zlib
versions which can cause the output of invalid compression streams for
some images. You will definitely need zlib 1.0.4 or later if you are
taking advantage of the MS-DOS "far" structure allocation for the small
and medium memory models. You should also note that zlib is a
compression library that is useful for more things than just PNG files.
You can use zlib as a drop-in replacement for fread() and fwrite() if
you are so inclined.
some images.
zlib should be available at the same place that libpng is, or at zlib.net.
You should also note that zlib is a compression library that is useful
for more things than just PNG files. You can use zlib as a drop-in
replacement for fread() and fwrite(), if you are so inclined.
zlib should be available at the same place that libpng is, or at
https://zlib.net.
You may also want a copy of the PNG specification. It is available
as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find
these at http://www.libpng.org/pub/png/pngdocs.html .
This code is currently being archived at libpng.sourceforge.io in the
[DOWNLOAD] area, and at http://libpng.download/src . If you
can't find it in any of those places, e-mail me, and I'll help you find it.
[DOWNLOAD] area, and at http://libpng.download/src .
I am not a lawyer, but I believe that the Export Control Classification
Number (ECCN) for libpng is EAR99, which means not subject to export
controls or International Traffic in Arms Regulations (ITAR) because it
is open source, publicly available software, that does not contain any
encryption software. See the EAR, paragraphs 734.3(b)(3) and 734.7(b).
If you have any code changes, requests, problems, etc., please e-mail
them to me. Also, I'd appreciate any make files or project files,
and any modifications you needed to make to get libpng to compile,
along with a #define variable to tell what compiler/system you are on.
If you needed to add transformations to libpng, or wish libpng would
provide the image in a different way, drop me a note (and code, if
possible), so I can consider supporting the transformation.
Finally, if you get any warning messages when compiling libpng
(note: not zlib), and they are easy to fix, I'd appreciate the
fix. Please mention "libpng" somewhere in the subject line. Thanks.
This release was created and will be supported by myself (of course
based in a large way on Guy's and Andreas' earlier work), and the PNG
This release, based in a large way on Glenn's, Guy's and Andreas'
earlier work, was created and will be supported by myself and the PNG
development group.
Send comments/corrections/commendations to png-mng-implement at
lists.sourceforge.net (subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe) or to glennrp at users.sourceforge.net
to subscribe).
You can't reach Guy, the original libpng author, at the addresses
given in previous versions of this document. He and Andreas will
read mail addressed to the png-implement list, however.
Please do not send general questions about PNG. Send them to
png-mng-misc at lists.sf.net (subscription required; visit
Send general questions about the PNG specification to png-mng-misc
at lists.sourceforge.net (subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-misc to
subscribe). If you have a question about something
in the PNG specification that is related to using libpng, send it
to me. Send me any questions that start with "I was using libpng,
and ...". If in doubt, send questions to me. I'll bounce them
to others, if necessary.
Please do not send suggestions on how to change PNG. We have
been discussing PNG for twenty years now, and it is official and
finished. If you have suggestions for libpng, however, I'll
gladly listen. Even if your suggestion is not used immediately,
it may be used later.
subscribe).
Files in this distribution:
ANNOUNCE => Announcement of this version, with recent changes
AUTHORS => List of contributing authors
CHANGES => Description of changes between libpng versions
KNOWNBUG => List of known bugs and deficiencies
LICENSE => License to use and redistribute libpng
README => This file
TODO => Things not implemented in the current library
Y2KINFO => Statement of Y2K compliance
TRADEMARK => Trademark information
example.c => Example code for using libpng functions
libpng.3 => manual page for libpng (includes libpng-manual.txt)
libpng-manual.txt => Description of libpng and its functions
@ -208,15 +174,10 @@ Files in this distribution:
scripts => Directory containing scripts for building libpng:
(see scripts/README.txt for the list of scripts)
Good luck, and happy coding.
Good luck, and happy coding!
-Glenn Randers-Pehrson (current maintainer, since 1998)
Internet: glennrp at users.sourceforge.net
-Andreas Eric Dilger (former maintainer, 1996-1997)
Internet: adilger at enel.ucalgary.ca
Web: http://www-mddsp.enel.ucalgary.ca/People/adilger/
-Guy Eric Schalnat (original author and former maintainer, 1995-1996)
(formerly of Group 42, Inc)
Internet: gschal at infinet.com
* Cosmin Truta (current maintainer, since 2018)
* Glenn Randers-Pehrson (former maintainer, 1998-2018)
* Andreas Eric Dilger (former maintainer, 1996-1997)
* Guy Eric Schalnat (original author and former maintainer, 1995-1996)
(formerly of Group 42, Inc.)

View File

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

8
src/third-party/libpng/TRADEMARK vendored Normal file
View File

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

View File

@ -1,6 +1,6 @@
# generated automatically by aclocal 1.15 -*- Autoconf -*-
# generated automatically by aclocal 1.16.1 -*- Autoconf -*-
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -20,7 +20,7 @@ You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
# Copyright (C) 2002-2014 Free Software Foundation, Inc.
# Copyright (C) 2002-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -32,10 +32,10 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.])
# generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.15'
[am__api_version='1.16'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.15], [],
m4_if([$1], [1.16.1], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.15])dnl
[AM_AUTOMAKE_VERSION([1.16.1])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# Figure out how to run the assembler. -*- Autoconf -*-
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -78,7 +78,7 @@ _AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -130,7 +130,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997-2014 Free Software Foundation, Inc.
# Copyright (C) 1997-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -161,7 +161,7 @@ AC_CONFIG_COMMANDS_PRE(
Usually this means the macro was only invoked conditionally.]])
fi])])
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -352,13 +352,12 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
@ -366,49 +365,41 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
# Older Autoconf quotes --file arguments for eval, but not when files
# are listed without --file. Let's play safe and only enable the eval
# if we detect the quoting.
case $CONFIG_FILES in
*\'*) eval set x "$CONFIG_FILES" ;;
*) set x $CONFIG_FILES ;;
esac
# TODO: see whether this extra hack can be removed once we start
# requiring Autoconf 2.70 or later.
AS_CASE([$CONFIG_FILES],
[*\'*], [eval set x "$CONFIG_FILES"],
[*], [set x $CONFIG_FILES])
shift
for mf
# Used to flag and report bootstrapping failures.
am_rc=0
for am_mf
do
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
# We used to match only the files named 'Makefile.in', but
# some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
# Grep'ing the whole file is not good either: AIX grep has a line
am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile which includes
# dependency-tracking related rules and includes.
# Grep'ing the whole file directly is not great: AIX grep has a line
# limit of 2048, but all sed's we know have understand at least 4000.
if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
dirpart=`AS_DIRNAME("$mf")`
else
continue
fi
# Extract the definition of DEPDIR, am__include, and am__quote
# from the Makefile without running 'make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "$am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`AS_DIRNAME(["$file"])`
AS_MKDIR_P([$dirpart/$fdir])
# echo "creating $dirpart/$file"
echo '# dummy' > "$dirpart/$file"
done
sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
|| continue
am_dirpart=`AS_DIRNAME(["$am_mf"])`
am_filepart=`AS_BASENAME(["$am_mf"])`
AM_RUN_LOG([cd "$am_dirpart" \
&& sed -e '/# am--include-marker/d' "$am_filepart" \
| $MAKE -f - am--depfiles]) || am_rc=$?
done
if test $am_rc -ne 0; then
AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
for automatic dependency tracking. Try re-running configure with the
'--disable-dependency-tracking' option to at least be able to build
the package (albeit without support for automatic dependency tracking).])
fi
AS_UNSET([am_dirpart])
AS_UNSET([am_filepart])
AS_UNSET([am_mf])
AS_UNSET([am_rc])
rm -f conftest-deps.mk
}
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
@ -417,18 +408,17 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
# -----------------------------
# This macro should only be invoked once -- use via AC_REQUIRE.
#
# This code is only required when automatic dependency tracking
# is enabled. FIXME. This creates each '.P' file that we will
# need in order to bootstrap the dependency handling code.
# This code is only required when automatic dependency tracking is enabled.
# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
# order to bootstrap the dependency handling code.
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles],
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
[AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -515,8 +505,8 @@ AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
# For better backward compatibility. To be removed once Automake 1.9.x
# dies out for good. For more background, see:
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
# We need awk for the "check" target (and possibly the TAP driver). The
# system "awk" is bad on some platforms.
@ -583,7 +573,7 @@ END
Aborting the configuration process, to ensure you take notice of the issue.
You can download and install GNU coreutils to get an 'rm' implementation
that behaves properly: <http://www.gnu.org/software/coreutils/>.
that behaves properly: <https://www.gnu.org/software/coreutils/>.
If you want to complete the configuration process using your problematic
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
@ -625,7 +615,7 @@ for _am_header in $config_headers :; do
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -646,7 +636,7 @@ if test x"${install_sh+set}" != xset; then
fi
AC_SUBST([install_sh])])
# Copyright (C) 2003-2014 Free Software Foundation, Inc.
# Copyright (C) 2003-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -668,7 +658,7 @@ AC_SUBST([am__leading_dot])])
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
# From Jim Meyering
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -703,7 +693,7 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -711,49 +701,42 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
# AM_MAKE_INCLUDE()
# -----------------
# Check to see how make treats includes.
# Check whether make has an 'include' directive that can support all
# the idioms we need for our automatic dependency tracking code.
AC_DEFUN([AM_MAKE_INCLUDE],
[am_make=${MAKE-make}
cat > confinc << 'END'
[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
cat > confinc.mk << 'END'
am__doit:
@echo this is the am__doit target
@echo this is the am__doit target >confinc.out
.PHONY: am__doit
END
# If we don't find an include directive, just comment out the code.
AC_MSG_CHECKING([for style of include used by $am_make])
am__include="#"
am__quote=
_am_result=none
# First try GNU make style include.
echo "include confinc" > confmf
# Ignore all kinds of additional output from 'make'.
case `$am_make -s -f confmf 2> /dev/null` in #(
*the\ am__doit\ target*)
am__include=include
am__quote=
_am_result=GNU
;;
esac
# Now try BSD make style include.
if test "$am__include" = "#"; then
echo '.include "confinc"' > confmf
case `$am_make -s -f confmf 2> /dev/null` in #(
*the\ am__doit\ target*)
am__include=.include
am__quote="\""
_am_result=BSD
;;
esac
fi
AC_SUBST([am__include])
AC_SUBST([am__quote])
AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
# BSD make does it like this.
echo '.include "confinc.mk" # ignored' > confmf.BSD
# Other make implementations (GNU, Solaris 10, AIX) do it like this.
echo 'include confinc.mk # ignored' > confmf.GNU
_am_result=no
for s in GNU BSD; do
AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
AS_CASE([$?:`cat confinc.out 2>/dev/null`],
['0:this is the am__doit target'],
[AS_CASE([$s],
[BSD], [am__include='.include' am__quote='"'],
[am__include='include' am__quote=''])])
if test "$am__include" != "#"; then
_am_result="yes ($s style)"
break
fi
done
rm -f confinc.* confmf.*
AC_MSG_RESULT([${_am_result}])
AC_SUBST([am__include])])
AC_SUBST([am__quote])])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997-2014 Free Software Foundation, Inc.
# Copyright (C) 1997-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -792,7 +775,7 @@ fi
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -821,7 +804,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -868,7 +851,7 @@ AC_LANG_POP([C])])
# For backward compatibility.
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -887,7 +870,7 @@ AC_DEFUN([AM_RUN_LOG],
# Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -968,7 +951,7 @@ AC_CONFIG_COMMANDS_PRE(
rm -f conftest.file
])
# Copyright (C) 2009-2014 Free Software Foundation, Inc.
# Copyright (C) 2009-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -1028,7 +1011,7 @@ AC_SUBST([AM_BACKSLASH])dnl
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
])
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -1056,7 +1039,7 @@ fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Copyright (C) 2006-2014 Free Software Foundation, Inc.
# Copyright (C) 2006-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -1075,7 +1058,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004-2014 Free Software Foundation, Inc.
# Copyright (C) 2004-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,

View File

@ -1,14 +1,15 @@
/* arm_init.c - NEON optimised filter functions
*
* Copyright (c) 2018 Cosmin Truta
* Copyright (c) 2014,2016 Glenn Randers-Pehrson
* Written by Mans Rullgard, 2011.
* Last changed in libpng 1.6.22 [May 26, 2016]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/
/* Below, after checking __linux__, various non-C90 POSIX 1003.1 functions are
* called.
*/

View File

@ -1,9 +1,9 @@
/* filter_neon.S - NEON optimised filter functions
*
* Copyright (c) 2018 Cosmin Truta
* Copyright (c) 2014,2017 Glenn Randers-Pehrson
* Written by Mans Rullgard, 2011.
* Last changed in libpng 1.6.31 [July 27, 2017]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer

View File

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

View File

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

View File

@ -194,7 +194,7 @@ case "$mode" in
if test -d .git
then
exec >&2
echo "ERROR: running autoreconf on an initialized sytem"
echo "ERROR: running autoreconf on an initialized system"
echo " This is not necessary; it is only necessary to remake the"
echo " autotools generated files if Makefile.am or configure.ac"
echo " change and make does the right thing with:"

View File

@ -1,9 +1,9 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2012-10-14.11; # UTC
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
@ -17,7 +17,7 @@ scriptversion=2012-10-14.11; # UTC
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@ -255,7 +255,8 @@ EOF
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
@ -339,9 +340,9 @@ exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

File diff suppressed because it is too large Load Diff

View File

@ -18,9 +18,6 @@
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `memset' function. */
#undef HAVE_MEMSET
/* Define to 1 if you have the `pow' function. */
#undef HAVE_POW

View File

@ -1,8 +1,8 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright 1992-2014 Free Software Foundation, Inc.
# Copyright 1992-2018 Free Software Foundation, Inc.
timestamp='2014-12-03'
timestamp='2018-03-08'
# 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
@ -15,7 +15,7 @@ timestamp='2014-12-03'
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
# along with this program; if not, see <https://www.gnu.org/licenses/>.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@ -33,7 +33,7 @@ timestamp='2014-12-03'
# 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
# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
@ -53,12 +53,11 @@ timestamp='2014-12-03'
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
Usage: $0 [OPTION] CPU-MFR-OPSYS
$0 [OPTION] ALIAS
Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
Canonicalize a configuration name.
Operation modes:
Options:
-h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit
@ -68,7 +67,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
Copyright 1992-2014 Free Software Foundation, Inc.
Copyright 1992-2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@ -95,7 +94,7 @@ while test $# -gt 0 ; do
*local*)
# First pass through any local machine types.
echo $1
echo "$1"
exit ;;
* )
@ -113,24 +112,24 @@ esac
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
maybe_os=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | \
kopensolaris*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
kopensolaris*-gnu* | cloudabi*-eabi* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
android-linux)
os=-linux-android
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
;;
*)
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ]
then os=`echo $1 | sed 's/.*-/-/'`
basic_machine=`echo "$1" | sed 's/-[^-]*$//'`
if [ "$basic_machine" != "$1" ]
then os=`echo "$1" | sed 's/.*-/-/'`
else os=; fi
;;
esac
@ -179,44 +178,44 @@ case $os in
;;
-sco6)
os=-sco5v6
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-sco5)
os=-sco3.2v5
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-sco4)
os=-sco3.2v4
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2.[4-9]*)
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2v[4-9]*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-sco5v6*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-sco*)
os=-sco3.2v2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-udk*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-isc)
os=-isc2.2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-clix*)
basic_machine=clipper-intergraph
;;
-isc*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-lynx*178)
os=-lynxos178
@ -228,10 +227,7 @@ case $os in
os=-lynxos
;;
-ptx*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
;;
-windowsnt*)
os=`echo $os | sed -e 's/windowsnt/winnt/'`
basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'`
;;
-psos*)
os=-psos
@ -255,15 +251,16 @@ case $basic_machine in
| arc | arceb \
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
| avr | avr32 \
| ba \
| be32 | be64 \
| bfin \
| c4x | c8051 | clipper \
| d10v | d30v | dlx | dsp16xx \
| epiphany \
| fido | fr30 | frv \
| e2k | epiphany \
| fido | fr30 | frv | ft32 \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \
| i370 | i860 | i960 | ia64 \
| i370 | i860 | i960 | ia16 | ia64 \
| ip2k | iq2000 \
| k1om \
| le32 | le64 \
@ -299,13 +296,14 @@ case $basic_machine in
| nios | nios2 | nios2eb | nios2el \
| ns16k | ns32k \
| open8 | or1k | or1knd | or32 \
| pdp10 | pdp11 | pj | pjl \
| pdp10 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \
| pru \
| pyramid \
| riscv32 | riscv64 \
| rl78 | rx \
| 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[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
@ -314,7 +312,7 @@ case $basic_machine in
| ubicom32 \
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
| visium \
| we32k \
| wasm32 \
| x86 | xc16x | xstormy16 | xtensa \
| z8k | z80)
basic_machine=$basic_machine-unknown
@ -335,7 +333,7 @@ case $basic_machine in
basic_machine=$basic_machine-unknown
os=-none
;;
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65)
;;
ms1)
basic_machine=mt-unknown
@ -364,7 +362,7 @@ case $basic_machine in
;;
# Object if more than one company name word.
*-*-*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2
exit 1
;;
# Recognize the basic CPU types with company name.
@ -376,17 +374,18 @@ case $basic_machine in
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
| ba-* \
| be32-* | be64-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
| c8051-* | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| e2k-* | elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \
| i*86-* | i860-* | i960-* | ia16-* | ia64-* \
| ip2k-* | iq2000-* \
| k1om-* \
| le32-* | le64-* \
@ -427,13 +426,15 @@ case $basic_machine in
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
| pru-* \
| pyramid-* \
| riscv32-* | riscv64-* \
| rl78-* | romp-* | rs6000-* | rx-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
| tahoe-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tile*-* \
@ -442,6 +443,7 @@ case $basic_machine in
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
| vax-* \
| visium-* \
| wasm32-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \
@ -455,7 +457,7 @@ case $basic_machine in
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
386bsd)
basic_machine=i386-unknown
basic_machine=i386-pc
os=-bsd
;;
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
@ -489,7 +491,7 @@ case $basic_machine in
basic_machine=x86_64-pc
;;
amd64-*)
basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
amdahl)
basic_machine=580-amdahl
@ -518,6 +520,9 @@ case $basic_machine in
basic_machine=i386-pc
os=-aros
;;
asmjs)
basic_machine=asmjs-unknown
;;
aux)
basic_machine=m68k-apple
os=-aux
@ -531,7 +536,7 @@ case $basic_machine in
os=-linux
;;
blackfin-*)
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'`
os=-linux
;;
bluegene*)
@ -539,13 +544,13 @@ case $basic_machine in
os=-cnk
;;
c54x-*)
basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
c55x-*)
basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
c6x-*)
basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
c90)
basic_machine=c90-cray
@ -634,10 +639,18 @@ case $basic_machine in
basic_machine=rs6000-bull
os=-bosx
;;
dpx2* | dpx2*-bull)
dpx2*)
basic_machine=m68k-bull
os=-sysv3
;;
e500v[12])
basic_machine=powerpc-unknown
os=$os"spe"
;;
e500v[12]-*)
basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
os=$os"spe"
;;
ebmon29k)
basic_machine=a29k-amd
os=-ebmon
@ -727,9 +740,6 @@ case $basic_machine in
hp9k8[0-9][0-9] | hp8[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hppa-next)
os=-nextstep3
;;
hppaosf)
basic_machine=hppa1.1-hp
os=-osf
@ -742,26 +752,26 @@ case $basic_machine in
basic_machine=i370-ibm
;;
i*86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
os=-sysv32
;;
i*86v4*)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
os=-sysv4
;;
i*86v)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
os=-sysv
;;
i*86sol2)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
os=-solaris2
;;
i386mach)
basic_machine=i386-mach
os=-mach
;;
i386-vsta | vsta)
vsta)
basic_machine=i386-unknown
os=-vsta
;;
@ -780,19 +790,16 @@ case $basic_machine in
os=-sysv
;;
leon-*|leon[3-9]-*)
basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'`
;;
m68knommu)
basic_machine=m68k-unknown
os=-linux
;;
m68knommu-*)
basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'`
os=-linux
;;
m88k-omron*)
basic_machine=m88k-omron
;;
magnum | m3230)
basic_machine=mips-mips
os=-sysv
@ -824,10 +831,10 @@ case $basic_machine in
os=-mint
;;
mips3*-*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`
;;
mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown
;;
monitor)
basic_machine=m68k-rom68k
@ -846,7 +853,7 @@ case $basic_machine in
os=-msdos
;;
ms1-*)
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'`
;;
msys)
basic_machine=i686-pc
@ -888,7 +895,7 @@ case $basic_machine in
basic_machine=v70-nec
os=-sysv
;;
next | m*-next )
next | m*-next)
basic_machine=m68k-next
case $os in
-nextstep* )
@ -933,6 +940,12 @@ case $basic_machine in
nsr-tandem)
basic_machine=nsr-tandem
;;
nsv-tandem)
basic_machine=nsv-tandem
;;
nsx-tandem)
basic_machine=nsx-tandem
;;
op50n-* | op60c-*)
basic_machine=hppa1.1-oki
os=-proelf
@ -965,7 +978,7 @@ case $basic_machine in
os=-linux
;;
parisc-*)
basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'`
os=-linux
;;
pbd)
@ -981,7 +994,7 @@ case $basic_machine in
basic_machine=i386-pc
;;
pc98-*)
basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
pentium | p5 | k5 | k6 | nexgen | viac3)
basic_machine=i586-pc
@ -996,16 +1009,16 @@ case $basic_machine in
basic_machine=i786-pc
;;
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
pentiumpro-* | p6-* | 6x86-* | athlon-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
pentium4-*)
basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
pn)
basic_machine=pn-gould
@ -1015,23 +1028,23 @@ case $basic_machine in
ppc | ppcbe) basic_machine=powerpc-unknown
;;
ppc-* | ppcbe-*)
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle | ppc-le | powerpc-little)
ppcle | powerpclittle)
basic_machine=powerpcle-unknown
;;
ppcle-* | powerpclittle-*)
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
ppc64) basic_machine=powerpc64-unknown
;;
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
ppc64le | powerpc64little | ppc64-le | powerpc64-little)
ppc64le | powerpc64little)
basic_machine=powerpc64le-unknown
;;
ppc64le-* | powerpc64little-*)
basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
ps2)
basic_machine=i386-ibm
@ -1085,17 +1098,10 @@ case $basic_machine in
sequent)
basic_machine=i386-sequent
;;
sh)
basic_machine=sh-hitachi
os=-hms
;;
sh5el)
basic_machine=sh5le-unknown
;;
sh64)
basic_machine=sh64-unknown
;;
sparclite-wrs | simso-wrs)
simso-wrs)
basic_machine=sparclite-wrs
os=-vxworks
;;
@ -1114,7 +1120,7 @@ case $basic_machine in
os=-sysv4
;;
strongarm-* | thumb-*)
basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
sun2)
basic_machine=m68000-sun
@ -1236,6 +1242,9 @@ case $basic_machine in
basic_machine=hppa1.1-winbond
os=-proelf
;;
x64)
basic_machine=x86_64-pc
;;
xbox)
basic_machine=i686-pc
os=-mingw32
@ -1244,20 +1253,12 @@ case $basic_machine in
basic_machine=xps100-honeywell
;;
xscale-* | xscalee[bl]-*)
basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'`
;;
ymp)
basic_machine=ymp-cray
os=-unicos
;;
z8k-*-coff)
basic_machine=z8k-unknown
os=-sim
;;
z80-*-coff)
basic_machine=z80-unknown
os=-sim
;;
none)
basic_machine=none-none
os=-none
@ -1286,10 +1287,6 @@ case $basic_machine in
vax)
basic_machine=vax-dec
;;
pdp10)
# there are many clones, so DEC is not a safe bet
basic_machine=pdp10-unknown
;;
pdp11)
basic_machine=pdp11-dec
;;
@ -1299,9 +1296,6 @@ case $basic_machine in
sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown
;;
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
basic_machine=sparc-sun
;;
cydra)
basic_machine=cydra-cydrome
;;
@ -1321,7 +1315,7 @@ case $basic_machine in
# Make sure to match an already-canonicalized machine name.
;;
*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2
exit 1
;;
esac
@ -1329,10 +1323,10 @@ esac
# Here we canonicalize certain aliases for manufacturers.
case $basic_machine in
*-digital*)
basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'`
;;
*-commodore*)
basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'`
;;
*)
;;
@ -1343,8 +1337,8 @@ esac
if [ x"$os" != x"" ]
then
case $os in
# First match some system type aliases
# that might get confused with valid system types.
# First match some system type aliases that might get confused
# with valid system types.
# -solaris* is a basic system type, with this one exception.
-auroraux)
os=-auroraux
@ -1355,45 +1349,48 @@ case $os in
-solaris)
os=-solaris2
;;
-svr4*)
os=-sysv4
;;
-unixware*)
os=-sysv4.2uw
;;
-gnu/linux*)
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
;;
# First accept the basic system types.
# es1800 is here to avoid being matched by es* (a different OS)
-es1800*)
os=-ose
;;
# Now accept the basic system types.
# The portable systems comes first.
# 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.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
| -sym* | -kopensolaris* | -plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
| -aos* | -aros* | -cloudabi* | -sortix* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
| -bitrig* | -openbsd* | -solidbsd* \
| -hiux* | -knetbsd* | -mirbsd* | -netbsd* \
| -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* | -hcos* \
| -chorusos* | -chorusrdb* | -cegcc* | -glidix* \
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -morphos* | -superux* | -rtmk* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
| -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \
| -midnightbsd*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@ -1410,12 +1407,12 @@ case $os in
-nto*)
os=`echo $os | sed -e 's|nto|nto-qnx|'`
;;
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
| -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
-sim | -xray | -os68k* | -v88r* \
| -windows* | -osx | -abug | -netware* | -os9* \
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
;;
-mac*)
os=`echo $os | sed -e 's|mac|macos|'`
os=`echo "$os" | sed -e 's|mac|macos|'`
;;
-linux-dietlibc)
os=-linux-dietlibc
@ -1424,10 +1421,10 @@ case $os in
os=`echo $os | sed -e 's|linux|linux-gnu|'`
;;
-sunos5*)
os=`echo $os | sed -e 's|sunos5|solaris2|'`
os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
;;
-sunos6*)
os=`echo $os | sed -e 's|sunos6|solaris3|'`
os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
;;
-opened*)
os=-openedition
@ -1438,12 +1435,6 @@ case $os in
-wince*)
os=-wince
;;
-osfrose*)
os=-osfrose
;;
-osf*)
os=-osf
;;
-utek*)
os=-bsd
;;
@ -1468,7 +1459,7 @@ case $os in
-nova*)
os=-rtmk-nova
;;
-ns2 )
-ns2)
os=-nextstep2
;;
-nsk*)
@ -1490,7 +1481,7 @@ case $os in
-oss*)
os=-sysv3
;;
-svr4)
-svr4*)
os=-sysv4
;;
-svr3)
@ -1505,32 +1496,38 @@ case $os in
-ose*)
os=-ose
;;
-es1800*)
os=-ose
;;
-xenix)
os=-xenix
;;
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
os=-mint
;;
-aros*)
os=-aros
;;
-zvmoe)
os=-zvmoe
;;
-dicos*)
os=-dicos
;;
-pikeos*)
# Until real need of OS specific support for
# particular features comes up, bare metal
# configurations are quite functional.
case $basic_machine in
arm*)
os=-eabi
;;
*)
os=-elf
;;
esac
;;
-nacl*)
;;
-ios)
;;
-none)
;;
*)
# Get rid of the `-' at the beginning of $os.
os=`echo $os | sed 's/[^-]*-//'`
echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2
exit 1
;;
esac
@ -1620,12 +1617,12 @@ case $basic_machine in
sparc-* | *-sun)
os=-sunos4.1.1
;;
pru-*)
os=-elf
;;
*-be)
os=-beos
;;
*-haiku)
os=-haiku
;;
*-ibm)
os=-aix
;;
@ -1665,7 +1662,7 @@ case $basic_machine in
m88k-omron*)
os=-luna
;;
*-next )
*-next)
os=-nextstep
;;
*-sequent)
@ -1680,9 +1677,6 @@ case $basic_machine in
i370-*)
os=-mvs
;;
*-next)
os=-nextstep3
;;
*-gould)
os=-sysv
;;
@ -1792,15 +1786,15 @@ case $basic_machine in
vendor=stratus
;;
esac
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"`
;;
esac
echo $basic_machine$os
echo "$basic_machine$os"
exit
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"

View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for libpng 1.6.34.
# Generated by GNU Autoconf 2.69 for libpng 1.6.37.
#
# Report bugs to <png-mng-implement@lists.sourceforge.net>.
#
@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='libpng'
PACKAGE_TARNAME='libpng'
PACKAGE_VERSION='1.6.34'
PACKAGE_STRING='libpng 1.6.34'
PACKAGE_VERSION='1.6.37'
PACKAGE_STRING='libpng 1.6.37'
PACKAGE_BUGREPORT='png-mng-implement@lists.sourceforge.net'
PACKAGE_URL=''
@ -713,7 +713,6 @@ am__nodep
AMDEPBACKSLASH
AMDEP_FALSE
AMDEP_TRUE
am__quote
am__include
DEPDIR
OBJEXT
@ -790,7 +789,8 @@ PACKAGE_VERSION
PACKAGE_TARNAME
PACKAGE_NAME
PATH_SEPARATOR
SHELL'
SHELL
am__quote'
ac_subst_files=''
ac_user_opts='
enable_option_checking
@ -1372,7 +1372,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures libpng 1.6.34 to adapt to many kinds of systems.
\`configure' configures libpng 1.6.37 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1442,7 +1442,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of libpng 1.6.34:";;
short | recursive ) echo "Configuration of libpng 1.6.37:";;
esac
cat <<\_ACEOF
@ -1622,7 +1622,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
libpng configure 1.6.34
libpng configure 1.6.37
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@ -1954,7 +1954,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by libpng $as_me 1.6.34, which was
It was created by libpng $as_me 1.6.37, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@ -2310,7 +2310,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# dist-xz requires automake 1.11 or later
# 1.12.2 fixes a security issue in 1.11.2 and 1.12.1
# 1.13 is required for parallel tests
am__api_version='1.15'
am__api_version='1.16'
ac_aux_dir=
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
@ -2825,7 +2825,7 @@ fi
# Define the identity of the package.
PACKAGE='libpng'
VERSION='1.6.34'
VERSION='1.6.37'
cat >>confdefs.h <<_ACEOF
@ -2855,8 +2855,8 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
# For better backward compatibility. To be removed once Automake 1.9.x
# dies out for good. For more background, see:
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
mkdir_p='$(MKDIR_P)'
# We need awk for the "check" target (and possibly the TAP driver). The
@ -2907,7 +2907,7 @@ END
Aborting the configuration process, to ensure you take notice of the issue.
You can download and install GNU coreutils to get an 'rm' implementation
that behaves properly: <http://www.gnu.org/software/coreutils/>.
that behaves properly: <https://www.gnu.org/software/coreutils/>.
If you want to complete the configuration process using your problematic
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
@ -2946,10 +2946,10 @@ fi
PNGLIB_VERSION=1.6.34
PNGLIB_VERSION=1.6.37
PNGLIB_MAJOR=1
PNGLIB_MINOR=6
PNGLIB_RELEASE=34
PNGLIB_RELEASE=37
@ -3814,45 +3814,45 @@ DEPDIR="${am__leading_dot}deps"
ac_config_commands="$ac_config_commands depfiles"
am_make=${MAKE-make}
cat > confinc << 'END'
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5
$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; }
cat > confinc.mk << 'END'
am__doit:
@echo this is the am__doit target
@echo this is the am__doit target >confinc.out
.PHONY: am__doit
END
# If we don't find an include directive, just comment out the code.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
$as_echo_n "checking for style of include used by $am_make... " >&6; }
am__include="#"
am__quote=
_am_result=none
# First try GNU make style include.
echo "include confinc" > confmf
# Ignore all kinds of additional output from 'make'.
case `$am_make -s -f confmf 2> /dev/null` in #(
*the\ am__doit\ target*)
am__include=include
am__quote=
_am_result=GNU
;;
esac
# Now try BSD make style include.
if test "$am__include" = "#"; then
echo '.include "confinc"' > confmf
case `$am_make -s -f confmf 2> /dev/null` in #(
*the\ am__doit\ target*)
am__include=.include
am__quote="\""
_am_result=BSD
# BSD make does it like this.
echo '.include "confinc.mk" # ignored' > confmf.BSD
# Other make implementations (GNU, Solaris 10, AIX) do it like this.
echo 'include confinc.mk # ignored' > confmf.GNU
_am_result=no
for s in GNU BSD; do
{ echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5
(${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
case $?:`cat confinc.out 2>/dev/null` in #(
'0:this is the am__doit target') :
case $s in #(
BSD) :
am__include='.include' am__quote='"' ;; #(
*) :
am__include='include' am__quote='' ;;
esac ;; #(
*) :
;;
esac
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
$as_echo "$_am_result" >&6; }
rm -f confinc confmf
esac
if test "$am__include" != "#"; then
_am_result="yes ($s style)"
break
fi
done
rm -f confinc.* confmf.*
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5
$as_echo "${_am_result}" >&6; }
# Check whether --enable-dependency-tracking was given.
if test "${enable_dependency_tracking+set}" = set; then :
@ -13066,19 +13066,6 @@ fi
fi
for ac_func in memset
do :
ac_fn_c_check_func "$LINENO" "memset" "ac_cv_func_memset"
if test "x$ac_cv_func_memset" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_MEMSET 1
_ACEOF
else
as_fn_error $? "memset not found in libc" "$LINENO" 5
fi
done
for ac_func in pow
do :
ac_fn_c_check_func "$LINENO" "pow" "ac_cv_func_pow"
@ -14367,7 +14354,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by libpng $as_me 1.6.34, which was
This file was extended by libpng $as_me 1.6.37, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -14433,7 +14420,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
libpng config.status 1.6.34
libpng config.status 1.6.37
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@ -14552,7 +14539,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
#
# INIT-COMMANDS
#
AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"
# The HP-UX ksh and POSIX shell print the target directory to stdout
@ -15452,29 +15439,35 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
# Older Autoconf quotes --file arguments for eval, but not when files
# are listed without --file. Let's play safe and only enable the eval
# if we detect the quoting.
case $CONFIG_FILES in
*\'*) eval set x "$CONFIG_FILES" ;;
*) set x $CONFIG_FILES ;;
esac
# TODO: see whether this extra hack can be removed once we start
# requiring Autoconf 2.70 or later.
case $CONFIG_FILES in #(
*\'*) :
eval set x "$CONFIG_FILES" ;; #(
*) :
set x $CONFIG_FILES ;; #(
*) :
;;
esac
shift
for mf
# Used to flag and report bootstrapping failures.
am_rc=0
for am_mf
do
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
# We used to match only the files named 'Makefile.in', but
# some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
# Grep'ing the whole file is not good either: AIX grep has a line
am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile which includes
# dependency-tracking related rules and includes.
# Grep'ing the whole file directly is not great: AIX grep has a line
# limit of 2048, but all sed's we know have understand at least 4000.
if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
dirpart=`$as_dirname -- "$mf" ||
$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$mf" : 'X\(//\)[^/]' \| \
X"$mf" : 'X\(//\)$' \| \
X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$mf" |
sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
|| continue
am_dirpart=`$as_dirname -- "$am_mf" ||
$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$am_mf" : 'X\(//\)[^/]' \| \
X"$am_mf" : 'X\(//\)$' \| \
X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$am_mf" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
@ -15492,53 +15485,48 @@ $as_echo X"$mf" |
q
}
s/.*/./; q'`
else
continue
fi
# Extract the definition of DEPDIR, am__include, and am__quote
# from the Makefile without running 'make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "$am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`$as_dirname -- "$file" ||
$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$file" : 'X\(//\)[^/]' \| \
X"$file" : 'X\(//\)$' \| \
X"$file" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
am_filepart=`$as_basename -- "$am_mf" ||
$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \
X"$am_mf" : 'X\(//\)$' \| \
X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X/"$am_mf" |
sed '/^.*\/\([^/][^/]*\)\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
/^X\/\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
/^X\/\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
as_dir=$dirpart/$fdir; as_fn_mkdir_p
# echo "creating $dirpart/$file"
echo '# dummy' > "$dirpart/$file"
done
{ echo "$as_me:$LINENO: cd "$am_dirpart" \
&& sed -e '/# am--include-marker/d' "$am_filepart" \
| $MAKE -f - am--depfiles" >&5
(cd "$am_dirpart" \
&& sed -e '/# am--include-marker/d' "$am_filepart" \
| $MAKE -f - am--depfiles) >&5 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } || am_rc=$?
done
if test $am_rc -ne 0; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "Something went wrong bootstrapping makefile fragments
for automatic dependency tracking. Try re-running configure with the
'--disable-dependency-tracking' option to at least be able to build
the package (albeit without support for automatic dependency tracking).
See \`config.log' for more details" "$LINENO" 5; }
fi
{ am_dirpart=; unset am_dirpart;}
{ am_filepart=; unset am_filepart;}
{ am_mf=; unset am_mf;}
{ am_rc=; unset am_rc;}
rm -f conftest-deps.mk
}
;;
"libtool":C)

View File

@ -1,7 +1,7 @@
# configure.ac
# Copyright (c) 2018 Cosmin Truta
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
# Last changed in libpng 1.6.25 [September 1, 2016]
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
@ -25,7 +25,7 @@ AC_PREREQ([2.68])
dnl Version number stuff here:
AC_INIT([libpng],[1.6.34],[png-mng-implement@lists.sourceforge.net])
AC_INIT([libpng],[1.6.37],[png-mng-implement@lists.sourceforge.net])
AC_CONFIG_MACRO_DIR([scripts])
# libpng does not follow GNU file name conventions (hence 'foreign')
@ -46,10 +46,10 @@ dnl automake, so the following is not necessary (and is not defined anyway):
dnl AM_PREREQ([1.11.2])
dnl stop configure from automagically running automake
PNGLIB_VERSION=1.6.34
PNGLIB_VERSION=1.6.37
PNGLIB_MAJOR=1
PNGLIB_MINOR=6
PNGLIB_RELEASE=34
PNGLIB_RELEASE=37
dnl End of version number stuff
@ -144,7 +144,6 @@ AC_C_RESTRICT
# Checks for library functions.
AC_FUNC_STRTOD
AC_CHECK_FUNCS([memset], , AC_MSG_ERROR(memset not found in libc))
AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_MSG_ERROR(cannot find pow)) )
# Some later POSIX 1003.1 functions are required for test programs, failure here

View File

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

View File

@ -10,7 +10,7 @@
* without processing the image. Notice that some header information may occur
* after the image data. Textual data and comments are an example; the approach
* in this file won't work reliably for such data because it only looks for the
* information in the section of the file that preceeds the image data.
* information in the section of the file that precedes the image data.
*
* Compile and link against libpng and zlib, plus anything else required on the
* system you use.

View File

@ -42,7 +42,7 @@ component(png_const_bytep row, png_uint_32 x, unsigned int c,
png_uint_32 bit_offset_hi = bit_depth * ((x >> 6) * channels);
png_uint_32 bit_offset_lo = bit_depth * ((x & 0x3f) * channels + c);
row = (png_const_bytep)(((PNG_CONST png_byte (*)[8])row) + bit_offset_hi);
row = (png_const_bytep)(((const png_byte (*)[8])row) + bit_offset_hi);
row += bit_offset_lo >> 3;
bit_offset_lo &= 0x07;
@ -73,7 +73,7 @@ static void
print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
png_uint_32 x)
{
PNG_CONST unsigned int bit_depth = png_get_bit_depth(png_ptr, info_ptr);
unsigned int bit_depth = png_get_bit_depth(png_ptr, info_ptr);
switch (png_get_color_type(png_ptr, info_ptr))
{
@ -87,7 +87,7 @@ print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
*/
case PNG_COLOR_TYPE_PALETTE:
{
PNG_CONST int index = component(row, x, 0, bit_depth, 1);
int index = component(row, x, 0, bit_depth, 1);
png_colorp palette = NULL;
int num_palette = 0;

View File

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

View File

@ -661,7 +661,7 @@ generate_row(png_bytep row, size_t rowbytes, unsigned int y, int color_type,
{
case 1:
{
const png_uint_32 luma = colors[1];
png_uint_32 luma = colors[1];
png_uint_32 x;
for (x=0; x<=size_max; ++x)
@ -672,8 +672,8 @@ generate_row(png_bytep row, size_t rowbytes, unsigned int y, int color_type,
case 2:
{
const png_uint_32 luma = colors[1];
const png_uint_32 alpha = colors[2];
png_uint_32 luma = colors[1];
png_uint_32 alpha = colors[2];
png_uint_32 x;
for (x=0; x<size_max; ++x)
@ -688,9 +688,9 @@ generate_row(png_bytep row, size_t rowbytes, unsigned int y, int color_type,
case 3:
{
const png_uint_32 red = colors[1];
const png_uint_32 green = colors[2];
const png_uint_32 blue = colors[3];
png_uint_32 red = colors[1];
png_uint_32 green = colors[2];
png_uint_32 blue = colors[3];
png_uint_32 x;
for (x=0; x<=size_max; ++x)
@ -707,10 +707,10 @@ generate_row(png_bytep row, size_t rowbytes, unsigned int y, int color_type,
case 4:
{
const png_uint_32 red = colors[1];
const png_uint_32 green = colors[2];
const png_uint_32 blue = colors[3];
const png_uint_32 alpha = colors[4];
png_uint_32 red = colors[1];
png_uint_32 green = colors[2];
png_uint_32 blue = colors[3];
png_uint_32 alpha = colors[4];
png_uint_32 x;
for (x=0; x<=size_max; ++x)
@ -812,7 +812,7 @@ write_png(const char **name, FILE *fp, int color_type, int bit_depth,
png_error(png_ptr, "OOM allocating info structure");
{
const unsigned int size =
unsigned int size =
image_size_of_type(color_type, bit_depth, colors, small);
unsigned int ysize;
png_fixed_point real_gamma = 45455; /* For sRGB */
@ -824,7 +824,7 @@ write_png(const char **name, FILE *fp, int color_type, int bit_depth,
*/
if (small)
{
const unsigned int pixel_depth =
unsigned int pixel_depth =
pixel_depth_of_type(color_type, bit_depth);
if (pixel_depth <= 8U)
@ -950,7 +950,7 @@ write_png(const char **name, FILE *fp, int color_type, int bit_depth,
int passes = 1;
# endif /* !WRITE_INTERLACING */
int pass;
png_size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
row = malloc(rowbytes);
@ -1094,7 +1094,7 @@ load_file(png_const_charp name, png_bytepp result)
return 0;
}
static png_size_t
static size_t
load_fake(png_charp param, png_bytepp profile)
{
char *endptr = NULL;
@ -1164,7 +1164,7 @@ insert_iCCP(png_structp png_ptr, png_infop info_ptr, int nparams,
{
case '<':
{
png_size_t filelen = load_file(params[1]+1, &profile);
size_t filelen = load_file(params[1]+1, &profile);
if (filelen > 0xfffffffc) /* Maximum profile length */
{
fprintf(stderr, "%s: file too long (%lu) for an ICC profile\n",
@ -1179,7 +1179,7 @@ insert_iCCP(png_structp png_ptr, png_infop info_ptr, int nparams,
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
{
png_size_t fake_len = load_fake(params[1], &profile);
size_t fake_len = load_fake(params[1], &profile);
if (fake_len > 0) /* else a simple parameter */
{
@ -1274,7 +1274,7 @@ set_text(png_structp png_ptr, png_infop info_ptr, png_textp text,
case '5': case '6': case '7': case '8': case '9':
{
png_bytep data = NULL;
png_size_t fake_len = load_fake(param, &data);
size_t fake_len = load_fake(param, &data);
if (fake_len > 0) /* else a simple parameter */
{
@ -1378,10 +1378,10 @@ static void
insert_sBIT(png_structp png_ptr, png_infop info_ptr, int nparams,
png_charpp params)
{
const int ct = png_get_color_type(png_ptr, info_ptr);
const int c = (ct & PNG_COLOR_MASK_COLOR ? 3 : 1) +
int ct = png_get_color_type(png_ptr, info_ptr);
int c = (ct & PNG_COLOR_MASK_COLOR ? 3 : 1) +
(ct & PNG_COLOR_MASK_ALPHA ? 1 : 0);
const unsigned int maxval =
unsigned int maxval =
ct & PNG_COLOR_MASK_PALETTE ? 8U : png_get_bit_depth(png_ptr, info_ptr);
png_color_8 sBIT;
@ -1856,7 +1856,7 @@ main(int argc, char **argv)
/* Check the colors */
{
const unsigned int lim = (color_type == PNG_COLOR_TYPE_PALETTE ? 255U :
unsigned int lim = (color_type == PNG_COLOR_TYPE_PALETTE ? 255U :
(1U<<bit_depth)-1);
unsigned int i;

View File

@ -551,7 +551,7 @@ struct display
png_structp original_pp; /* used on the original read */
png_infop original_ip; /* set by the original read */
png_size_t original_rowbytes; /* of the original rows: */
size_t original_rowbytes; /* of the original rows: */
png_bytepp original_rows; /* from the original read */
/* Original chunks valid */
@ -807,7 +807,7 @@ display_cache_file(struct display *dp, const char *filename)
static void
buffer_read(struct display *dp, struct buffer *bp, png_bytep data,
png_size_t size)
size_t size)
{
struct buffer_list *last = bp->current;
size_t read_count = bp->read_count;
@ -855,7 +855,7 @@ buffer_read(struct display *dp, struct buffer *bp, png_bytep data,
}
static void PNGCBAPI
read_function(png_structp pp, png_bytep data, png_size_t size)
read_function(png_structp pp, png_bytep data, size_t size)
{
buffer_read(get_dp(pp), get_buffer(pp), data, size);
}
@ -927,7 +927,7 @@ update_display(struct display *dp)
png_structp pp;
png_infop ip;
/* Now perform the initial read with a 0 tranform. */
/* Now perform the initial read with a 0 transform. */
read_png(dp, &dp->original_file, "original read", 0/*no transform*/);
/* Move the result to the 'original' fields */
@ -1267,7 +1267,7 @@ compare_read(struct display *dp, int applied_transforms)
#ifdef PNG_WRITE_PNG_SUPPORTED
static void
buffer_write(struct display *dp, struct buffer *buffer, png_bytep data,
png_size_t size)
size_t size)
/* Generic write function used both from the write callback provided to
* libpng and from the generic read code.
*/
@ -1311,7 +1311,7 @@ buffer_write(struct display *dp, struct buffer *buffer, png_bytep data,
}
static void PNGCBAPI
write_function(png_structp pp, png_bytep data, png_size_t size)
write_function(png_structp pp, png_bytep data, size_t size)
{
buffer_write(get_dp(pp), get_buffer(pp), data, size);
}
@ -1446,7 +1446,7 @@ test_one_file(struct display *dp, const char *filename)
* unsigned, because some transforms are negative on a 16-bit system.
*/
unsigned int active = dp->active_transforms;
const int exhaustive = (dp->options & EXHAUSTIVE) != 0;
int exhaustive = (dp->options & EXHAUSTIVE) != 0;
unsigned int current = first_transform(active);
unsigned int bad_transforms = 0;
unsigned int bad_combo = ~0U; /* bitwise AND of failing transforms */
@ -1572,7 +1572,7 @@ do_test(struct display *dp, const char *file)
}
int
main(const int argc, const char * const * const argv)
main(int argc, char **argv)
{
/* For each file on the command line test it with a range of transforms */
int option_end, ilog = 0;
@ -1674,7 +1674,7 @@ main(const int argc, const char * const * const argv)
/* Here on any return, including failures, except user/internal issues
*/
{
const int pass = (d.options & STRICT) ?
int pass = (d.options & STRICT) ?
RESULT_STRICT(d.results) : RESULT_RELAXED(d.results);
if (!pass)

View File

@ -372,7 +372,7 @@ print_opts(png_uint_32 opts)
*/
#define FORMAT_COUNT 64
#define FORMAT_MASK 0x3f
static PNG_CONST char * PNG_CONST format_names[FORMAT_COUNT] =
static const char * const format_names[FORMAT_COUNT] =
{
"sRGB-gray",
"sRGB-gray+alpha",
@ -578,11 +578,11 @@ typedef struct
int stride_extra;
FILE *input_file;
png_voidp input_memory;
png_size_t input_memory_size;
size_t input_memory_size;
png_bytep buffer;
ptrdiff_t stride;
png_size_t bufsize;
png_size_t allocsize;
size_t bufsize;
size_t allocsize;
char tmpfile_name[32];
png_uint_16 colormap[256*4];
}
@ -665,7 +665,7 @@ static void initimage(Image *image, png_uint_32 opts, const char *file_name,
static void
allocbuffer(Image *image)
{
png_size_t size = PNG_IMAGE_BUFFER_SIZE(image->image, image->stride);
size_t size = PNG_IMAGE_BUFFER_SIZE(image->image, image->stride);
if (size+32 > image->bufsize)
{
@ -1142,7 +1142,7 @@ get_pixel(png_uint_32 format))(Pixel *p, png_const_voidp pb)
}
}
/* Convertion between pixel formats. The code above effectively eliminates the
/* Conversion between pixel formats. The code above effectively eliminates the
* component ordering changes leaving three basic changes:
*
* 1) Remove an alpha channel by pre-multiplication or compositing on a
@ -2036,7 +2036,7 @@ typedef struct
/* Precalculated values: */
int in_opaque; /* Value of input alpha that is opaque */
int is_palette; /* Sample values come from the palette */
int accumulate; /* Accumlate component errors (don't log) */
int accumulate; /* Accumulate component errors (don't log) */
int output_8bit; /* Output is 8-bit (else 16-bit) */
void (*in_gp)(Pixel*, png_const_voidp);
@ -2346,8 +2346,8 @@ static int
logpixel(const Transform *transform, png_uint_32 x, png_uint_32 y,
const Pixel *in, const Pixel *calc, const Pixel *out, const char *reason)
{
const png_uint_32 in_format = transform->in_image->image.format;
const png_uint_32 out_format = transform->out_image->image.format;
png_uint_32 in_format = transform->in_image->image.format;
png_uint_32 out_format = transform->out_image->image.format;
png_uint_32 back_format = out_format & ~PNG_FORMAT_FLAG_ALPHA;
const char *via_linear = "";
@ -2602,12 +2602,12 @@ compare_two_images(Image *a, Image *b, int via_linear,
ptrdiff_t strideb = b->stride;
png_const_bytep rowa = a->buffer+16;
png_const_bytep rowb = b->buffer+16;
const png_uint_32 width = a->image.width;
const png_uint_32 height = a->image.height;
const png_uint_32 formata = a->image.format;
const png_uint_32 formatb = b->image.format;
const unsigned int a_sample = PNG_IMAGE_SAMPLE_SIZE(formata);
const unsigned int b_sample = PNG_IMAGE_SAMPLE_SIZE(formatb);
png_uint_32 width = a->image.width;
png_uint_32 height = a->image.height;
png_uint_32 formata = a->image.format;
png_uint_32 formatb = b->image.format;
unsigned int a_sample = PNG_IMAGE_SAMPLE_SIZE(formata);
unsigned int b_sample = PNG_IMAGE_SAMPLE_SIZE(formatb);
int alpha_added, alpha_removed;
int bchannels;
png_uint_32 y;
@ -2726,7 +2726,7 @@ compare_two_images(Image *a, Image *b, int via_linear,
result = 0;
}
/* If reqested copy the error values back from the Transform. */
/* If requested, copy the error values back from the Transform. */
if (a->opts & ACCUMULATE)
{
tr.error_ptr[0] = tr.error[0];
@ -2790,8 +2790,7 @@ compare_two_images(Image *a, Image *b, int via_linear,
(formata & (formatb ^ PNG_FORMAT_FLAG_COLOR) & PNG_FORMAT_FLAG_COLOR)))
{
/* Was an alpha channel changed? */
const png_uint_32 alpha_changed = (formata ^ formatb) &
PNG_FORMAT_FLAG_ALPHA;
png_uint_32 alpha_changed = (formata ^ formatb) & PNG_FORMAT_FLAG_ALPHA;
/* Was an alpha channel removed? (The third test.) If so the direct
* comparison is only possible if the input alpha is opaque.
@ -2932,7 +2931,7 @@ compare_two_images(Image *a, Image *b, int via_linear,
}
}
/* If reqested copy the error values back from the Transform. */
/* If requested, copy the error values back from the Transform. */
if (a->opts & ACCUMULATE)
{
tr.error_ptr[0] = tr.error[0];
@ -3627,7 +3626,7 @@ main(int argc, char **argv)
if (arg[0] == '-')
{
const int term = (arg[1] == '0' ? 0 : '\n');
int term = (arg[1] == '0' ? 0 : '\n');
unsigned int ich = 0;
/* Loop reading files, use a static buffer to simplify this and just

View File

@ -56,7 +56,7 @@
defined(PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED)
#if PNG_LIBPNG_VER < 10500
/* This deliberately lacks the PNG_CONST. */
/* This deliberately lacks the const. */
typedef png_byte *png_const_bytep;
/* This is copied from 1.5.1 png.h: */
@ -85,7 +85,7 @@ typedef png_byte *png_const_bytep;
#define PNG_WRITE_16BIT_SUPPORTED
#define PNG_READ_16BIT_SUPPORTED
/* This comes from pnglibconf.h afer 1.5: */
/* This comes from pnglibconf.h after 1.5: */
#define PNG_FP_1 100000
#define PNG_GAMMA_THRESHOLD_FIXED\
((png_fixed_point)(PNG_GAMMA_THRESHOLD * PNG_FP_1))

View File

@ -21,6 +21,7 @@
#define _POSIX_SOURCE 1
#define _ISOC99_SOURCE 1 /* For floating point */
#define _GNU_SOURCE 1 /* For the floating point exception extension */
#define _BSD_SOURCE 1 /* For the floating point exception extension */
#include <signal.h>
#include <stdio.h>
@ -102,7 +103,7 @@ typedef png_byte *png_const_bytep;
#define PNG_WRITE_16BIT_SUPPORTED
#define PNG_READ_16BIT_SUPPORTED
/* This comes from pnglibconf.h afer 1.5: */
/* This comes from pnglibconf.h after 1.5: */
#define PNG_FP_1 100000
#define PNG_GAMMA_THRESHOLD_FIXED\
((png_fixed_point)(PNG_GAMMA_THRESHOLD * PNG_FP_1))
@ -711,7 +712,7 @@ typedef struct png_store_file
unsigned int IDAT_bits; /* Number of bits in IDAT size */
png_uint_32 IDAT_size; /* Total size of IDAT data */
png_uint_32 id; /* must be correct (see FILEID) */
png_size_t datacount; /* In this (the last) buffer */
size_t datacount; /* In this (the last) buffer */
png_store_buffer data; /* Last buffer in file */
int npalette; /* Number of entries in palette */
store_palette_entry* palette; /* May be NULL */
@ -777,10 +778,10 @@ typedef struct png_store
png_infop piread;
png_store_file* current; /* Set when reading */
png_store_buffer* next; /* Set when reading */
png_size_t readpos; /* Position in *next */
size_t readpos; /* Position in *next */
png_byte* image; /* Buffer for reading interlaced images */
png_size_t cb_image; /* Size of this buffer */
png_size_t cb_row; /* Row size of the image(s) */
size_t cb_image; /* Size of this buffer */
size_t cb_row; /* Row size of the image(s) */
uLong IDAT_crc;
png_uint_32 IDAT_len; /* Used when re-chunking IDAT chunks */
png_uint_32 IDAT_pos; /* Used when re-chunking IDAT chunks */
@ -791,7 +792,7 @@ typedef struct png_store
png_store_file* saved;
png_structp pwrite; /* Used when writing a new file */
png_infop piwrite;
png_size_t writepos; /* Position in .new */
size_t writepos; /* Position in .new */
char wname[FILE_NAME_SIZE];
png_store_buffer new; /* The end of the new PNG file being written. */
store_pool write_memory_pool;
@ -961,7 +962,7 @@ bits_of(png_uint_32 num)
return b; /* 0..32 */
}
/* Main interface to file storeage, after writing a new PNG file (see the API
/* Main interface to file storage, after writing a new PNG file (see the API
* below) call store_storefile to store the result with the given name and id.
*/
static void
@ -1125,7 +1126,7 @@ static png_bytep
store_image_row(const png_store* ps, png_const_structp pp, int nImage,
png_uint_32 y)
{
png_size_t coffset = (nImage * ps->image_h + y) * (ps->cb_row + 5) + 2;
size_t coffset = (nImage * ps->image_h + y) * (ps->cb_row + 5) + 2;
if (ps->image == NULL)
png_error(pp, "no allocated image");
@ -1160,9 +1161,9 @@ store_image_free(png_store *ps, png_const_structp pp)
static void
store_ensure_image(png_store *ps, png_const_structp pp, int nImages,
png_size_t cbRow, png_uint_32 cRows)
size_t cbRow, png_uint_32 cRows)
{
png_size_t cb = nImages * cRows * (cbRow + 5);
size_t cb = nImages * cRows * (cbRow + 5);
if (ps->cb_image < cb)
{
@ -1234,7 +1235,7 @@ store_image_check(const png_store* ps, png_const_structp pp, int iImage)
png_error(pp, "image overwrite");
else
{
png_size_t cbRow = ps->cb_row;
size_t cbRow = ps->cb_row;
png_uint_32 rows = ps->image_h;
image += iImage * (cbRow+5) * ps->image_h;
@ -1278,7 +1279,7 @@ valid_chunktype(png_uint_32 chunktype)
}
static void PNGCBAPI
store_write(png_structp ppIn, png_bytep pb, png_size_t st)
store_write(png_structp ppIn, png_bytep pb, size_t st)
{
png_const_structp pp = ppIn;
png_store *ps = voidcast(png_store*, png_get_io_ptr(pp));
@ -1346,13 +1347,13 @@ store_write(png_structp ppIn, png_bytep pb, png_size_t st)
else /* chunkpos >= 8 */
{
png_size_t cb = st;
size_t cb = st;
if (cb > STORE_BUFFER_SIZE - writepos)
cb = STORE_BUFFER_SIZE - writepos;
if (cb > chunklen - chunkpos/* bytes left in chunk*/)
cb = (png_size_t)/*SAFE*/(chunklen - chunkpos);
cb = (size_t)/*SAFE*/(chunklen - chunkpos);
memcpy(ps->new.buffer + writepos, pb, cb);
chunkpos += (png_uint_32)/*SAFE*/cb;
@ -1440,7 +1441,7 @@ store_read_buffer_next(png_store *ps)
* during progressive read, where the io_ptr is set internally by libpng.
*/
static void
store_read_imp(png_store *ps, png_bytep pb, png_size_t st)
store_read_imp(png_store *ps, png_bytep pb, size_t st)
{
if (ps->current == NULL || ps->next == NULL)
png_error(ps->pread, "store state damaged");
@ -1463,14 +1464,13 @@ store_read_imp(png_store *ps, png_bytep pb, png_size_t st)
}
}
static png_size_t
store_read_chunk(png_store *ps, png_bytep pb, const png_size_t max,
const png_size_t min)
static size_t
store_read_chunk(png_store *ps, png_bytep pb, size_t max, size_t min)
{
png_uint_32 chunklen = ps->chunklen;
png_uint_32 chunktype = ps->chunktype;
png_uint_32 chunkpos = ps->chunkpos;
png_size_t st = max;
size_t st = max;
if (st > 0) do
{
@ -1601,8 +1601,8 @@ store_read_chunk(png_store *ps, png_bytep pb, const png_size_t max,
store_read_imp(ps, pb, avail);
ps->IDAT_crc = crc32(ps->IDAT_crc, pb, avail);
pb += (png_size_t)/*SAFE*/avail;
st -= (png_size_t)/*SAFE*/avail;
pb += (size_t)/*SAFE*/avail;
st -= (size_t)/*SAFE*/avail;
chunkpos += (png_uint_32)/*SAFE*/avail;
IDAT_size -= (png_uint_32)/*SAFE*/avail;
IDAT_pos += (png_uint_32)/*SAFE*/avail;
@ -1669,10 +1669,10 @@ store_read_chunk(png_store *ps, png_bytep pb, const png_size_t max,
else /* Return chunk bytes, including the CRC */
{
png_size_t avail = st;
size_t avail = st;
if (avail > chunklen - chunkpos)
avail = (png_size_t)/*SAFE*/(chunklen - chunkpos);
avail = (size_t)/*SAFE*/(chunklen - chunkpos);
store_read_imp(ps, pb, avail);
pb += avail;
@ -1698,7 +1698,7 @@ store_read_chunk(png_store *ps, png_bytep pb, const png_size_t max,
}
static void PNGCBAPI
store_read(png_structp ppIn, png_bytep pb, png_size_t st)
store_read(png_structp ppIn, png_bytep pb, size_t st)
{
png_const_structp pp = ppIn;
png_store *ps = voidcast(png_store*, png_get_io_ptr(pp));
@ -1724,7 +1724,7 @@ store_progressive_read(png_store *ps, png_structp pp, png_infop pi)
while (store_read_buffer_avail(ps) > 0)
{
static png_uint_32 noise = 2;
png_size_t cb;
size_t cb;
png_byte buffer[512];
/* Generate 15 more bits of stuff: */
@ -2590,7 +2590,7 @@ static double digitize(double value, int depth, int do_round)
* rounding and 'do_round' should be 1, if it is 0 the digitized value will
* be truncated.
*/
const unsigned int digitization_factor = (1U << depth) -1;
unsigned int digitization_factor = (1U << depth) - 1;
/* Limiting the range is done as a convenience to the caller - it's easier to
* do it once here than every time at the call site.
@ -2991,7 +2991,7 @@ modifier_setbuffer(png_modifier *pm)
* png_struct.
*/
static void
modifier_read_imp(png_modifier *pm, png_bytep pb, png_size_t st)
modifier_read_imp(png_modifier *pm, png_bytep pb, size_t st)
{
while (st > 0)
{
@ -3137,7 +3137,7 @@ modifier_read_imp(png_modifier *pm, png_bytep pb, png_size_t st)
*/
if (len+12 <= sizeof pm->buffer)
{
png_size_t s = len+12-pm->buffer_count;
size_t s = len+12-pm->buffer_count;
store_read_chunk(&pm->this, pm->buffer+pm->buffer_count, s, s);
pm->buffer_count = len+12;
@ -3196,7 +3196,7 @@ modifier_read_imp(png_modifier *pm, png_bytep pb, png_size_t st)
/* The callback: */
static void PNGCBAPI
modifier_read(png_structp ppIn, png_bytep pb, png_size_t st)
modifier_read(png_structp ppIn, png_bytep pb, size_t st)
{
png_const_structp pp = ppIn;
png_modifier *pm = voidcast(png_modifier*, png_get_io_ptr(pp));
@ -3226,7 +3226,7 @@ modifier_progressive_read(png_modifier *pm, png_structp pp, png_infop pi)
for (;;)
{
static png_uint_32 noise = 1;
png_size_t cb, cbAvail;
size_t cb, cbAvail;
png_byte buffer[512];
/* Generate 15 more bits of stuff: */
@ -3688,8 +3688,8 @@ init_standard_palette(png_store *ps, png_structp pp, png_infop pi, int npalette,
#ifdef PNG_WRITE_tRNS_SUPPORTED
static void
set_random_tRNS(png_structp pp, png_infop pi, const png_byte colour_type,
const int bit_depth)
set_random_tRNS(png_structp pp, png_infop pi, png_byte colour_type,
int bit_depth)
{
/* To make this useful the tRNS color needs to match at least one pixel.
* Random values are fine for gray, including the 16-bit case where we know
@ -3697,7 +3697,7 @@ set_random_tRNS(png_structp pp, png_infop pi, const png_byte colour_type,
* method as only 65536 different RGB values are generated.
*/
png_color_16 tRNS;
const png_uint_16 mask = (png_uint_16)((1U << bit_depth)-1);
png_uint_16 mask = (png_uint_16)((1U << bit_depth)-1);
R8(tRNS); /* makes unset fields random */
@ -4338,7 +4338,7 @@ make_size_image(png_store* const ps, png_byte const colour_type,
/* Make a name and get an appropriate id for the store: */
char name[FILE_NAME_SIZE];
const png_uint_32 id = FILEID(colour_type, bit_depth, 0/*palette*/,
png_uint_32 id = FILEID(colour_type, bit_depth, 0/*palette*/,
interlace_type, w, h, do_interlace);
standard_name_from_id(name, sizeof name, 0, id);
@ -4414,7 +4414,7 @@ make_size_image(png_store* const ps, png_byte const colour_type,
for (pass=0; pass<npasses; ++pass)
{
/* The following two are for checking the macros: */
const png_uint_32 wPass = PNG_PASS_COLS(w, pass);
png_uint_32 wPass = PNG_PASS_COLS(w, pass);
/* If do_interlace is set we don't call png_write_row for every
* row because some of them are empty. In fact, for a 1x1 image,
@ -4646,7 +4646,7 @@ make_error(png_store* const ps, png_byte const colour_type,
Try
{
png_infop pi;
const png_structp pp = set_store_for_write(ps, &pi, name);
png_structp pp = set_store_for_write(ps, &pi, name);
png_uint_32 w, h;
gnu_volatile(pp)
@ -4706,7 +4706,7 @@ make_error(png_store* const ps, png_byte const colour_type,
else
{
/* Now write the whole image, just to make sure that the detected, or
* undetected, errro has not created problems inside libpng. This
* undetected, error has not created problems inside libpng. This
* doesn't work if there was a png_error in png_write_info because that
* can abort before PLTE was written.
*/
@ -5001,7 +5001,7 @@ standard_display_init(standard_display *dp, png_store* ps, png_uint_32 id,
dp->npalette = 0;
/* Preset the transparent color to black: */
memset(&dp->transparent, 0, sizeof dp->transparent);
/* Preset the palette to full intensity/opaque througout: */
/* Preset the palette to full intensity/opaque throughout: */
memset(dp->palette, 0xff, sizeof dp->palette);
}
@ -5270,7 +5270,7 @@ standard_info_part1(standard_display *dp, png_structp pp, png_infop pi)
*/
standard_palette_validate(dp, pp, pi);
/* In any case always check for a tranparent color (notice that the
/* In any case always check for a transparent color (notice that the
* colour type 3 case must not give a successful return on the get_tRNS call
* with these arguments!)
*/
@ -5469,14 +5469,14 @@ progressive_row(png_structp ppIn, png_bytep new_row, png_uint_32 y, int pass)
static void
sequential_row(standard_display *dp, png_structp pp, png_infop pi,
const int iImage, const int iDisplay)
int iImage, int iDisplay)
{
const int npasses = dp->npasses;
const int do_interlace = dp->do_interlace &&
int npasses = dp->npasses;
int do_interlace = dp->do_interlace &&
dp->interlace_type == PNG_INTERLACE_ADAM7;
const png_uint_32 height = standard_height(pp, dp->id);
const png_uint_32 width = standard_width(pp, dp->id);
const png_store* ps = dp->ps;
png_uint_32 height = standard_height(pp, dp->id);
png_uint_32 width = standard_width(pp, dp->id);
const png_store* ps = dp->ps;
int pass;
for (pass=0; pass<npasses; ++pass)
@ -5870,7 +5870,7 @@ test_size(png_modifier* const pm, png_byte const colour_type,
*/
static const png_byte hinc[] = {1, 3, 11, 1, 5};
static const png_byte winc[] = {1, 9, 5, 7, 1};
const int save_bdlo = bdlo;
int save_bdlo = bdlo;
for (; bdlo <= bdhi; ++bdlo)
{
@ -6078,12 +6078,12 @@ image_pixel_init(image_pixel *this, png_const_bytep row, png_byte colour_type,
png_byte bit_depth, png_uint_32 x, store_palette palette,
const image_pixel *format /*from pngvalid transform of input*/)
{
const png_byte sample_depth = (png_byte)(colour_type ==
PNG_COLOR_TYPE_PALETTE ? 8 : bit_depth);
const unsigned int max = (1U<<sample_depth)-1;
const int swap16 = (format != 0 && format->swap16);
const int littleendian = (format != 0 && format->littleendian);
const int sig_bits = (format != 0 && format->sig_bits);
png_byte sample_depth =
(png_byte)(colour_type == PNG_COLOR_TYPE_PALETTE ? 8 : bit_depth);
unsigned int max = (1U<<sample_depth)-1;
int swap16 = (format != 0 && format->swap16);
int littleendian = (format != 0 && format->littleendian);
int sig_bits = (format != 0 && format->sig_bits);
/* Initially just set everything to the same number and the alpha to opaque.
* Note that this currently assumes a simple palette where entry x has colour
@ -6101,7 +6101,7 @@ image_pixel_init(image_pixel *this, png_const_bytep row, png_byte colour_type,
/* This permits the caller to default to the sample value. */
if (palette != 0)
{
const unsigned int i = this->palette_index;
unsigned int i = this->palette_index;
this->red = palette[i].red;
this->green = palette[i].green;
@ -6432,8 +6432,8 @@ static void
image_transform_mod_end(const image_transform *this, image_pixel *that,
png_const_structp pp, const transform_display *display)
{
const unsigned int scale = (1U<<that->sample_depth)-1;
const int sig_bits = that->sig_bits;
unsigned int scale = (1U<<that->sample_depth)-1;
int sig_bits = that->sig_bits;
UNUSED(this)
UNUSED(pp)
@ -6756,19 +6756,19 @@ transform_image_validate(transform_display *dp, png_const_structp pp,
{
/* Constants for the loop below: */
const png_store* const ps = dp->this.ps;
const png_byte in_ct = dp->this.colour_type;
const png_byte in_bd = dp->this.bit_depth;
const png_uint_32 w = dp->this.w;
const png_uint_32 h = dp->this.h;
const png_byte out_ct = dp->output_colour_type;
const png_byte out_bd = dp->output_bit_depth;
const png_byte sample_depth = (png_byte)(out_ct ==
PNG_COLOR_TYPE_PALETTE ? 8 : out_bd);
const png_byte red_sBIT = dp->this.red_sBIT;
const png_byte green_sBIT = dp->this.green_sBIT;
const png_byte blue_sBIT = dp->this.blue_sBIT;
const png_byte alpha_sBIT = dp->this.alpha_sBIT;
const int have_tRNS = dp->this.is_transparent;
png_byte in_ct = dp->this.colour_type;
png_byte in_bd = dp->this.bit_depth;
png_uint_32 w = dp->this.w;
png_uint_32 h = dp->this.h;
png_byte out_ct = dp->output_colour_type;
png_byte out_bd = dp->output_bit_depth;
png_byte sample_depth =
(png_byte)(out_ct == PNG_COLOR_TYPE_PALETTE ? 8 : out_bd);
png_byte red_sBIT = dp->this.red_sBIT;
png_byte green_sBIT = dp->this.green_sBIT;
png_byte blue_sBIT = dp->this.blue_sBIT;
png_byte alpha_sBIT = dp->this.alpha_sBIT;
int have_tRNS = dp->this.is_transparent;
double digitization_error;
store_palette out_palette;
@ -6780,7 +6780,7 @@ transform_image_validate(transform_display *dp, png_const_structp pp,
store_image_check(dp->this.ps, pp, 0);
/* Read the palette corresponding to the output if the output colour type
* indicates a palette, othewise set out_palette to garbage.
* indicates a palette, otherwise set out_palette to garbage.
*/
if (out_ct == PNG_COLOR_TYPE_PALETTE)
{
@ -6929,7 +6929,7 @@ transform_end(png_structp ppIn, png_infop pi)
/* A single test run. */
static void
transform_test(png_modifier *pmIn, const png_uint_32 idIn,
transform_test(png_modifier *pmIn, png_uint_32 idIn,
const image_transform* transform_listIn, const char * const name)
{
transform_display d;
@ -7764,7 +7764,7 @@ static void
image_transform_png_set_rgb_to_gray_set(const image_transform *this,
transform_display *that, png_structp pp, png_infop pi)
{
const int error_action = 1; /* no error, no defines in png.h */
int error_action = 1; /* no error, no defines in png.h */
# ifdef PNG_FLOATING_POINT_SUPPORTED
png_set_rgb_to_gray(pp, error_action, data.red_to_set, data.green_to_set);
@ -7905,10 +7905,10 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
# if DIGITIZE
{
png_modifier *pm = display->pm;
const unsigned int sample_depth = that->sample_depth;
const unsigned int calc_depth = (pm->assume_16_bit_calculations ? 16 :
unsigned int sample_depth = that->sample_depth;
unsigned int calc_depth = (pm->assume_16_bit_calculations ? 16 :
sample_depth);
const unsigned int gamma_depth =
unsigned int gamma_depth =
(sample_depth == 16 ?
display->max_gamma_8 :
(pm->assume_16_bit_calculations ?
@ -7991,7 +7991,7 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
/* Now calculate the actual gray values. Although the error in the
* coefficients depends on whether they were specified on the command
* line (in which case truncation to 15 bits happened) or not (rounding
* was used) the maxium error in an individual coefficient is always
* was used) the maximum error in an individual coefficient is always
* 2/32768, because even in the rounding case the requirement that
* coefficients add up to 32768 can cause a larger rounding error.
*
@ -8002,7 +8002,7 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
b * data.blue_coefficient;
{
const int do_round = data.gamma != 1 || calc_depth == 16;
int do_round = data.gamma != 1 || calc_depth == 16;
const double ce = 2. / 32768;
graylo = DD(rlo * (data.red_coefficient-ce) +
@ -8207,7 +8207,7 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
that->bluef = that->greenf = that->redf = gray;
that->bluee = that->greene = that->rede = err;
/* The sBIT is the minium of the three colour channel sBITs. */
/* The sBIT is the minimum of the three colour channel sBITs. */
if (that->red_sBIT > that->green_sBIT)
that->red_sBIT = that->green_sBIT;
if (that->red_sBIT > that->blue_sBIT)
@ -8626,7 +8626,7 @@ image_transform_png_set_filler_mod(const image_transform *this,
(that->colour_type == PNG_COLOR_TYPE_RGB ||
that->colour_type == PNG_COLOR_TYPE_GRAY))
{
const unsigned int max = (1U << that->bit_depth)-1;
unsigned int max = (1U << that->bit_depth)-1;
that->alpha = data.filler & max;
that->alphaf = ((double)that->alpha) / max;
that->alphae = 0;
@ -8693,7 +8693,7 @@ image_transform_png_set_add_alpha_mod(const image_transform *this,
(that->colour_type == PNG_COLOR_TYPE_RGB ||
that->colour_type == PNG_COLOR_TYPE_GRAY))
{
const unsigned int max = (1U << that->bit_depth)-1;
unsigned int max = (1U << that->bit_depth)-1;
that->alpha = data.filler & max;
that->alphaf = ((double)that->alpha) / max;
that->alphae = 0;
@ -8884,7 +8884,7 @@ image_transform_png_set_shift_set(const image_transform *this,
* field is randomized independently. This acts as a check that
* libpng does use the correct field.
*/
const unsigned int depth = that->this.bit_depth;
unsigned int depth = that->this.bit_depth;
data.red = (png_byte)/*SAFE*/(random_mod(depth)+1);
data.green = (png_byte)/*SAFE*/(random_mod(depth)+1);
@ -9299,12 +9299,12 @@ gamma_info_imp(gamma_display *dp, png_structp pp, png_infop pi)
int mode = dp->do_background - ALPHA_MODE_OFFSET;
/* The gamma value is the output gamma, and is in the standard,
* non-inverted, represenation. It provides a default for the PNG file
* non-inverted, representation. It provides a default for the PNG file
* gamma, but since the file has a gAMA chunk this does not matter.
*/
const double sg = dp->screen_gamma;
# ifndef PNG_FLOATING_POINT_SUPPORTED
const png_fixed_point g = fix(sg);
png_fixed_point g = fix(sg);
# endif
# ifdef PNG_FLOATING_POINT_SUPPORTED
@ -9352,7 +9352,7 @@ gamma_info_imp(gamma_display *dp, png_structp pp, png_infop pi)
*/
const double bg = dp->background_gamma;
# ifndef PNG_FLOATING_POINT_SUPPORTED
const png_fixed_point g = fix(bg);
png_fixed_point g = fix(bg);
# endif
# ifdef PNG_FLOATING_POINT_SUPPORTED
@ -9426,7 +9426,7 @@ static void
init_validate_info(validate_info *vi, gamma_display *dp, png_const_structp pp,
int in_depth, int out_depth)
{
const unsigned int outmax = (1U<<out_depth)-1;
unsigned int outmax = (1U<<out_depth)-1;
vi->pp = pp;
vi->dp = dp;
@ -9588,14 +9588,14 @@ gamma_component_compose(int do_background, double input_sample, double alpha,
/* This API returns the encoded *input* component, in the range 0..1 */
static double
gamma_component_validate(const char *name, const validate_info *vi,
const unsigned int id, const unsigned int od,
unsigned int id, unsigned int od,
const double alpha /* <0 for the alpha channel itself */,
const double background /* component background value */)
{
const unsigned int isbit = id >> vi->isbit_shift;
const unsigned int sbit_max = vi->sbit_max;
const unsigned int outmax = vi->outmax;
const int do_background = vi->do_background;
unsigned int isbit = id >> vi->isbit_shift;
unsigned int sbit_max = vi->sbit_max;
unsigned int outmax = vi->outmax;
int do_background = vi->do_background;
double i;
@ -9746,7 +9746,7 @@ gamma_component_validate(const char *name, const validate_info *vi,
*
* pngvalid calculations:
* input_sample: linear result; i linearized and composed, range 0..1
* encoded_sample: encoded result; input_sample scaled to ouput bit depth
* encoded_sample: encoded result; input_sample scaled to output bit depth
*
* libpng calculations:
* output: linear result; od scaled to 0..1 and linearized
@ -10161,13 +10161,13 @@ gamma_image_validate(gamma_display *dp, png_const_structp pp,
{
/* Get some constants derived from the input and output file formats: */
const png_store* const ps = dp->this.ps;
const png_byte in_ct = dp->this.colour_type;
const png_byte in_bd = dp->this.bit_depth;
const png_uint_32 w = dp->this.w;
const png_uint_32 h = dp->this.h;
png_byte in_ct = dp->this.colour_type;
png_byte in_bd = dp->this.bit_depth;
png_uint_32 w = dp->this.w;
png_uint_32 h = dp->this.h;
const size_t cbRow = dp->this.cbRow;
const png_byte out_ct = png_get_color_type(pp, pi);
const png_byte out_bd = png_get_bit_depth(pp, pi);
png_byte out_ct = png_get_color_type(pp, pi);
png_byte out_bd = png_get_bit_depth(pp, pi);
/* There are three sources of error, firstly the quantization in the
* file encoding, determined by sbit and/or the file depth, secondly
@ -10183,10 +10183,10 @@ gamma_image_validate(gamma_display *dp, png_const_structp pp,
* Since the library must quantize the output to 8 or 16 bits there is
* a fundamental limit on the accuracy of the output of +/-.5 - this
* quantization limit is included in addition to the other limits
* specified by the paramaters to the API. (Effectively, add .5
* specified by the parameters to the API. (Effectively, add .5
* everywhere.)
*
* The behavior of the 'sbit' paramter is defined by section 12.5
* The behavior of the 'sbit' parameter is defined by section 12.5
* (sample depth scaling) of the PNG spec. That section forces the
* decoder to assume that the PNG values have been scaled if sBIT is
* present:
@ -10208,11 +10208,11 @@ gamma_image_validate(gamma_display *dp, png_const_structp pp,
* The basic tests below do not do this, however if 'use_input_precision'
* is set a subsequent test is performed above.
*/
const unsigned int samples_per_pixel = (out_ct & 2U) ? 3U : 1U;
unsigned int samples_per_pixel = (out_ct & 2U) ? 3U : 1U;
int processing;
png_uint_32 y;
const store_palette_entry *in_palette = dp->this.palette;
const int in_is_transparent = dp->this.is_transparent;
int in_is_transparent = dp->this.is_transparent;
int process_tRNS;
int out_npalette = -1;
int out_is_transparent = 0; /* Just refers to the palette case */
@ -10260,9 +10260,9 @@ gamma_image_validate(gamma_display *dp, png_const_structp pp,
double alpha = 1; /* serves as a flag value */
/* Record the palette index for index images. */
const unsigned int in_index =
unsigned int in_index =
in_ct == 3 ? sample(std, 3, in_bd, x, 0, 0, 0) : 256;
const unsigned int out_index =
unsigned int out_index =
out_ct == 3 ? sample(std, 3, out_bd, x, 0, 0, 0) : 256;
/* Handle input alpha - png_set_background will cause the output
@ -10271,7 +10271,7 @@ gamma_image_validate(gamma_display *dp, png_const_structp pp,
if ((in_ct & PNG_COLOR_MASK_ALPHA) != 0 ||
(in_ct == 3 && in_is_transparent))
{
const unsigned int input_alpha = in_ct == 3 ?
unsigned int input_alpha = in_ct == 3 ?
dp->this.palette[in_index].alpha :
sample(std, in_ct, in_bd, x, samples_per_pixel, 0, 0);
@ -10396,14 +10396,14 @@ gamma_end(png_structp ppIn, png_infop pi)
* maxpc: maximum percentage error (as a percentage)
*/
static void
gamma_test(png_modifier *pmIn, const png_byte colour_typeIn,
const png_byte bit_depthIn, const int palette_numberIn,
const int interlace_typeIn,
gamma_test(png_modifier *pmIn, png_byte colour_typeIn,
png_byte bit_depthIn, int palette_numberIn,
int interlace_typeIn,
const double file_gammaIn, const double screen_gammaIn,
const png_byte sbitIn, const int threshold_testIn,
png_byte sbitIn, int threshold_testIn,
const char *name,
const int use_input_precisionIn, const int scale16In,
const int expand16In, const int do_backgroundIn,
int use_input_precisionIn, int scale16In,
int expand16In, int do_backgroundIn,
const png_color_16 *bkgd_colorIn, double bkgd_gammaIn)
{
gamma_display d;
@ -10607,11 +10607,11 @@ perform_gamma_threshold_tests(png_modifier *pm)
}
static void gamma_transform_test(png_modifier *pm,
const png_byte colour_type, const png_byte bit_depth,
const int palette_number,
const int interlace_type, const double file_gamma,
const double screen_gamma, const png_byte sbit,
const int use_input_precision, const int scale16)
png_byte colour_type, png_byte bit_depth,
int palette_number,
int interlace_type, const double file_gamma,
const double screen_gamma, png_byte sbit,
int use_input_precision, int scale16)
{
size_t pos = 0;
char name[64];
@ -10768,12 +10768,12 @@ static void perform_gamma_scale16_tests(png_modifier *pm)
#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
defined(PNG_READ_ALPHA_MODE_SUPPORTED)
static void gamma_composition_test(png_modifier *pm,
const png_byte colour_type, const png_byte bit_depth,
const int palette_number,
const int interlace_type, const double file_gamma,
png_byte colour_type, png_byte bit_depth,
int palette_number,
int interlace_type, const double file_gamma,
const double screen_gamma,
const int use_input_precision, const int do_background,
const int expand_16)
int use_input_precision, int do_background,
int expand_16)
{
size_t pos = 0;
png_const_charp base;
@ -11729,7 +11729,7 @@ int main(int argc, char **argv)
/* Some default values (set the behavior for 'make check' here).
* These values simply control the maximum error permitted in the gamma
* transformations. The practial limits for human perception are described
* transformations. The practical limits for human perception are described
* below (the setting for maxpc16), however for 8 bit encodings it isn't
* possible to meet the accepted capabilities of human vision - i.e. 8 bit
* images can never be good enough, regardless of encoding.

View File

@ -60,7 +60,7 @@ read_png(FILE *fp)
png_read_info(png_ptr, info_ptr);
{
png_size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
/* Failure to initialize these is harmless */
row = malloc(rowbytes);

View File

@ -108,7 +108,7 @@ int validation_ascii_to_fp(int count, int argc, char **argv)
do
{
png_size_t index;
size_t index;
int state, failed = 0;
char buffer[64];
@ -176,7 +176,7 @@ int validation_ascii_to_fp(int count, int argc, char **argv)
}
else if (PNG_FP_IS_POSITIVE(state) && !(test > 0))
{
fprintf(stderr, "%g[%d] -> '%s' but postive value not so reported\n",
fprintf(stderr, "%g[%d] -> '%s' but positive value not so reported\n",
test, precision, buffer);
failed = 1;
assert(!PNG_FP_IS_NEGATIVE(state));
@ -329,10 +329,10 @@ static int check_one_character(checkfp_command *co, checkfp_control c, int ch)
{
/* Test this character (ch) to ensure the parser does the correct thing.
*/
png_size_t index = 0;
size_t index = 0;
const char test = (char)ch;
const int number_is_valid = png_check_fp_number(&test, 1, &c.state, &index);
const int character_accepted = (index == 1);
int number_is_valid = png_check_fp_number(&test, 1, &c.state, &index);
int character_accepted = (index == 1);
if (c.check_state != exponent && isdigit(ch) && ch != '0')
c.is_zero = 0;

View File

@ -65,7 +65,7 @@ typedef struct
} io_data;
static PNG_CALLBACK(void, read_and_copy,
(png_structp png_ptr, png_bytep buffer, png_size_t cb))
(png_structp png_ptr, png_bytep buffer, size_t cb))
{
io_data *io = (io_data*)png_get_io_ptr(png_ptr);
@ -100,7 +100,7 @@ static void read_by_row(png_structp png_ptr, png_infop info_ptr,
png_read_info(png_ptr, info_ptr);
{
png_size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
row = voidcast(png_bytep,malloc(rowbytes));
display = voidcast(png_bytep,malloc(rowbytes));

View File

@ -16,9 +16,10 @@
FROM gcr.io/oss-fuzz-base/base-builder
MAINTAINER glennrp@gmail.com
RUN apt-get update && apt-get install -y make autoconf automake libtool zlib1g-dev
RUN apt-get update && \
apt-get install -y make autoconf automake libtool
RUN git clone --depth 1 https://github.com/madler/zlib.git
RUN git clone --depth 1 https://github.com/glennrp/libpng.git
RUN (cd libpng; git log | head -1)
RUN cp libpng/contrib/oss-fuzz/build.sh $SRC
WORKDIR libpng
COPY build.sh $SRC/

View File

@ -24,13 +24,13 @@ The files are
Filename or derived Copyright License
========================= ========== ================ ==========
Dockerfile* derived 2017, Glenn R-P Apache 2.0
build.sh* derived 2017, Glenn R-P Apache 2.0
build.sh derived 2017, Glenn R-P Apache 2.0
libpng_read_fuzzer.cc derived 2017, Glenn R-P Chromium
libpng_read_fuzzer.options original 2015, Chrome Devs Chromium
png.dict original 2015, Chrome Devs Chromium
README.txt (this file) original 2017, Glenn R-P libpng
* Dockerfile and build.sh are copies of the files used by oss-fuzz.
* Dockerfile is a copy of the file used by oss-fuzz. build.sh,
png.dict and libpng_read_fuzzer.* are the actual files used by oss-fuzz,
which retrieves them from the libpng repository at Github.

View File

@ -1,5 +1,5 @@
#!/bin/bash -eu
# Copyright 2017 Glenn Randers-Pehrson
# Copyright 2017-2018 Glenn Randers-Pehrson
# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
@ -14,12 +14,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Last changed in libpng 1.6.33 [September 28, 2017]
# Last changed in libpng 1.6.35 [July 15, 2018]
#
# Revisions by Glenn Randers-Pehson, 2017:
# Revisions by Glenn Randers-Pehrson, 2017:
# 1. Build only the library, not the tools (changed "make -j$(nproc) all" to
# "make -j$(nproc) libpng16.la").
# 2. Disabled WARNING and WRITE options in pnglibconf.dfa.
# 3. Build zlib alongside libpng
################################################################################
# Disable logging via library build configuration control.
@ -30,9 +31,9 @@ cat scripts/pnglibconf.dfa | \
> scripts/pnglibconf.dfa.temp
mv scripts/pnglibconf.dfa.temp scripts/pnglibconf.dfa
# build the library.
# build the libpng library.
autoreconf -f -i
./configure
./configure --with-libpng-prefix=OSS_FUZZ_
make -j$(nproc) clean
make -j$(nproc) libpng16.la

View File

@ -1,11 +1,11 @@
// libpng_read_fuzzer.cc
// Copyright 2017 Glenn Randers-Pehrson
// Copyright 2017-2018 Glenn Randers-Pehrson
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that may
// be found in the LICENSE file https://cs.chromium.org/chromium/src/LICENSE
// Last changed in libpng 1.6.32 [August 24, 2017]
// Last changed in libpng 1.6.35 [July 15, 2018]
// The modifications in 2017 by Glenn Randers-Pehrson include
// 1. addition of a PNG_CLEANUP macro,
@ -13,6 +13,7 @@
// 3. adding "#include <string.h>" which is needed on some platforms
// to provide memcpy().
// 4. adding read_end_info() and creating an end_info structure.
// 5. adding calls to png_set_*() transforms commonly used by browsers.
#include <stddef.h>
#include <stdint.h>
@ -67,7 +68,7 @@ struct PngObjectHandler {
}
};
void user_read_data(png_structp png_ptr, png_bytep data, png_size_t length) {
void user_read_data(png_structp png_ptr, png_bytep data, size_t length) {
BufState* buf_state = static_cast<BufState*>(png_get_io_ptr(png_ptr));
if (length > buf_state->bytes_left) {
png_error(png_ptr, "read error");
@ -136,9 +137,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
// Reading.
png_read_info(png_handler.png_ptr, png_handler.info_ptr);
png_handler.row_ptr = png_malloc(
png_handler.png_ptr, png_get_rowbytes(png_handler.png_ptr,
png_handler.info_ptr));
// reset error handler to put png_deleter into scope.
if (setjmp(png_jmpbuf(png_handler.png_ptr))) {
@ -163,8 +161,20 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
return 0;
}
// Set several transforms that browsers typically use:
png_set_gray_to_rgb(png_handler.png_ptr);
png_set_expand(png_handler.png_ptr);
png_set_packing(png_handler.png_ptr);
png_set_scale_16(png_handler.png_ptr);
png_set_tRNS_to_alpha(png_handler.png_ptr);
int passes = png_set_interlace_handling(png_handler.png_ptr);
png_start_read_image(png_handler.png_ptr);
png_read_update_info(png_handler.png_ptr, png_handler.info_ptr);
png_handler.row_ptr = png_malloc(
png_handler.png_ptr, png_get_rowbytes(png_handler.png_ptr,
png_handler.info_ptr));
for (int pass = 0; pass < passes; ++pass) {
for (png_uint_32 y = 0; y < height; ++y) {

View File

@ -1,190 +0,0 @@
// libpng_read_fuzzer.cc
// Copyright 2017 Glenn Randers-Pehrson
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that may
// be found in the LICENSE file https://cs.chromium.org/chromium/src/LICENSE
// Last changed in libpng 1.6.33beta03 [September 27, 2017]
// The modifications in 2017 by Glenn Randers-Pehrson include
// 1. addition of a PNG_CLEANUP macro,
// 2. setting the option to ignore ADLER32 checksums,
// 3. adding "#include <string.h>" which is needed on some platforms
// to provide memcpy().
// 4. adding read_end_info() and creating an end_info structure.
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <vector>
#define PNG_INTERNAL
#include "png.h"
struct BufState {
const uint8_t* data;
size_t bytes_left;
};
struct PngObjectHandler {
png_infop info_ptr = nullptr;
png_structp png_ptr = nullptr;
png_infop end_info_ptr = nullptr;
png_voidp row_ptr = nullptr;
BufState* buf_state = nullptr;
~PngObjectHandler() {
if (row_ptr)
png_free(png_ptr, row_ptr);
if (end_info_ptr)
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info_ptr);
else if (info_ptr)
png_destroy_read_struct(&png_ptr, &info_ptr, nullptr);
else
png_destroy_read_struct(&png_ptr, nullptr, nullptr);
delete buf_state;
}
};
void user_read_data(png_structp png_ptr, png_bytep data, png_size_t length) {
BufState* buf_state = static_cast<BufState*>(png_get_io_ptr(png_ptr));
if (length > buf_state->bytes_left) {
png_error(png_ptr, "read error");
}
memcpy(data, buf_state->data, length);
buf_state->bytes_left -= length;
buf_state->data += length;
}
static const int kPngHeaderSize = 8;
// Entry point for LibFuzzer.
// Roughly follows the libpng book example:
// http://www.libpng.org/pub/png/book/chapter13.html
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
if (size < kPngHeaderSize) {
return 0;
}
std::vector<unsigned char> v(data, data + size);
if (png_sig_cmp(v.data(), 0, kPngHeaderSize)) {
// not a PNG.
return 0;
}
PngObjectHandler png_handler;
png_handler.png_ptr = nullptr;
png_handler.row_ptr = nullptr;
png_handler.info_ptr = nullptr;
png_handler.end_info_ptr = nullptr;
png_handler.png_ptr = png_create_read_struct
(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
if (!png_handler.png_ptr) {
return 0;
}
#define PNG_CLEANUP \
if(png_handler.png_ptr) \
{ \
if (png_handler.row_ptr) \
png_free(png_handler.png_ptr, png_handler.row_ptr); \
if (png_handler.end_info_ptr) \
png_destroy_read_struct(&png_handler.png_ptr, &png_handler.info_ptr,\
&png_handler.end_info_ptr); \
else if (png_handler.info_ptr) \
png_destroy_read_struct(&png_handler.png_ptr, &png_handler.info_ptr,\
nullptr); \
else \
png_destroy_read_struct(&png_handler.png_ptr, nullptr, nullptr); \
png_handler.png_ptr = nullptr; \
png_handler.row_ptr = nullptr; \
png_handler.info_ptr = nullptr; \
png_handler.end_info_ptr = nullptr; \
}
png_handler.info_ptr = png_create_info_struct(png_handler.png_ptr);
if (!png_handler.info_ptr) {
PNG_CLEANUP
return 0;
}
png_handler.end_info_ptr = png_create_info_struct(png_handler.png_ptr);
if (!png_handler.end_info_ptr) {
PNG_CLEANUP
return 0;
}
/* Treat benign errors as warnings */
png_set_benign_errors(png_handler.png_ptr, 1);
png_set_crc_action(png_handler.png_ptr, PNG_CRC_QUIET_USE, PNG_CRC_QUIET_USE);
#ifdef PNG_IGNORE_ADLER32
png_set_option(png_handler.png_ptr, PNG_IGNORE_ADLER32, PNG_OPTION_ON);
#endif
// Setting up reading from buffer.
png_handler.buf_state = new BufState();
png_handler.buf_state->data = data + kPngHeaderSize;
png_handler.buf_state->bytes_left = size - kPngHeaderSize;
png_set_read_fn(png_handler.png_ptr, png_handler.buf_state, user_read_data);
png_set_sig_bytes(png_handler.png_ptr, kPngHeaderSize);
if (setjmp(png_jmpbuf(png_handler.png_ptr))) {
PNG_CLEANUP
return 0;
}
// Reading.
png_read_info(png_handler.png_ptr, png_handler.info_ptr);
png_read_update_info(png_handler.png_ptr, png_handler.info_ptr);
png_handler.row_ptr = png_malloc(
png_handler.png_ptr, png_get_rowbytes(png_handler.png_ptr,
png_handler.info_ptr));
// reset error handler to put png_deleter into scope.
if (setjmp(png_jmpbuf(png_handler.png_ptr))) {
PNG_CLEANUP
return 0;
}
png_uint_32 width, height;
int bit_depth, color_type, interlace_type, compression_type;
int filter_type;
if (!png_get_IHDR(png_handler.png_ptr, png_handler.info_ptr, &width,
&height, &bit_depth, &color_type, &interlace_type,
&compression_type, &filter_type)) {
PNG_CLEANUP
return 0;
}
// This is going to be too slow.
if (width && height > 100000000 / width) {
PNG_CLEANUP
return 0;
}
int passes = png_set_interlace_handling(png_handler.png_ptr);
png_start_read_image(png_handler.png_ptr);
/* To do: prevent the optimizer from removing this code entirely */
for (int pass = 0; pass < passes; ++pass) {
for (png_uint_32 y = 0; y < height; ++y) {
png_read_row(png_handler.png_ptr,
static_cast<png_bytep>(png_handler.row_ptr), nullptr);
}
}
png_read_end(png_handler.png_ptr, png_handler.end_info_ptr);
PNG_CLEANUP
/* TO do: exercise the progressive reader here */
return 0;
}

View File

@ -0,0 +1,13 @@
pnm2png / png2pnm --- conversion from PBM/PGM/PPM-file to PNG-file
copyright (C) 1999-2019 by Willem van Schaik <willem at schaik dot com>
version 1.0 - 1999.10.15 - First version.
1.1 - 2015.07.29 - Fixed leaks (Glenn Randers-Pehrson)
1.2 - 2017.04.22 - Add buffer-size check
1.3 - 2017.08.24 - Fix potential overflow in buffer-size check
(Glenn Randers-Pehrson)
1.4 - 2017.08.28 - Add PNGMINUS_UNUSED (Christian Hesse)
1.5 - 2018.08.05 - Fix buffer overflow in tokenizer (Cosmin Truta)
1.6 - 2018.08.05 - Improve portability and fix style (Cosmin Truta)
1.7 - 2019.01.22 - Change license to MIT (Willem van Schaik)

View File

@ -0,0 +1,24 @@
cmake_minimum_required(VERSION 3.1)
cmake_policy(VERSION 3.1)
project(PNGMINUS C)
option(PNGMINUS_USE_STATIC_LIBRARIES "Use the static library builds" ON)
# libpng
add_subdirectory(../.. libpng)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../..)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/libpng)
if(PNGMINUS_USE_STATIC_LIBRARIES)
set(PNGMINUS_PNG_LIBRARY png_static)
else()
set(PNGMINUS_PNG_LIBRARY png)
endif()
# png2pnm
add_executable(png2pnm png2pnm.c)
target_link_libraries(png2pnm ${PNGMINUS_PNG_LIBRARY})
# pnm2png
add_executable(pnm2png pnm2png.c)
target_link_libraries(pnm2png ${PNGMINUS_PNG_LIBRARY})

View File

@ -0,0 +1,22 @@
pnm2png / png2pnm --- conversion from PBM/PGM/PPM-file to PNG-file
copyright (C) 1999-2019 by Willem van Schaik <willem at schaik dot com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The software is provided "as is", without warranty of any kind, express or
implied, including but not limited to the warranties of merchantability,
fitness for a particular purpose and noninfringement. In no event shall the
authors or copyight holders be liable for any claim, damages or other
liability, whether in an action of contract, tort or otherwise, arising from,
out of or in connection with the software or the use or other dealings in the
software.

View File

@ -0,0 +1,62 @@
# Makefile for PngMinus (png2pnm and pnm2png)
# Linux / Unix
#CC = cc
CC = gcc
LD = $(CC)
RM = rm -f
PNGINC = -I../..
PNGLIB_SHARED = -L../.. -lpng
PNGLIB_STATIC = ../../libpng.a
# Uncomment the following if you have a custom zlib build at ../../../zlib
#ZINC = -I../../../zlib
#ZLIB_SHARED = -L../../../zlib -lz
#ZLIB_STATIC = ../../../zlib/libz.a
# Use the system zlib otherwise
ZLIB_SHARED = -lz
ZLIB_STATIC = -lz
CPPFLAGS = $(PNGINC) $(ZINC)
CFLAGS =
LDFLAGS =
LIBS_SHARED = $(PNGLIB_SHARED) $(ZLIB_SHARED)
LIBS_STATIC = $(PNGLIB_STATIC) $(ZLIB_STATIC)
EXEEXT =
#EXEEXT = .exe
# dependencies
all: png2pnm$(EXEEXT) pnm2png$(EXEEXT) png2pnm-static$(EXEEXT) pnm2png-static$(EXEEXT)
png2pnm.o: png2pnm.c
$(CC) -c $(CPPFLAGS) $(CFLAGS) png2pnm.c
pnm2png.o: pnm2png.c
$(CC) -c $(CPPFLAGS) $(CFLAGS) pnm2png.c
png2pnm$(EXEEXT): png2pnm.o
$(LD) $(LDFLAGS) -o png2pnm$(EXEEXT) png2pnm.o $(LIBS_SHARED) -lm
pnm2png$(EXEEXT): pnm2png.o
$(LD) $(LDFLAGS) -o pnm2png$(EXEEXT) pnm2png.o $(LIBS_SHARED) -lm
png2pnm-static$(EXEEXT): png2pnm.o
$(LD) $(LDFLAGS) -o png2pnm-static$(EXEEXT) png2pnm.o $(LIBS_STATIC) -lm
pnm2png-static$(EXEEXT): pnm2png.o
$(LD) $(LDFLAGS) -o pnm2png-static$(EXEEXT) pnm2png.o $(LIBS_STATIC) -lm
clean:
$(RM) png2pnm.o
$(RM) pnm2png.o
$(RM) png2pnm$(EXEEXT)
$(RM) pnm2png$(EXEEXT)
$(RM) png2pnm-static$(EXEEXT)
$(RM) pnm2png-static$(EXEEXT)
# End of makefile for png2pnm / pnm2png

View File

@ -1,26 +1,16 @@
PngMinus
--------
(copyright Willem van Schaik, 1999)
(copyright Willem van Schaik, 1999-2019)
License
-------
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and
that both that copyright notice and this permission notice appear in
supporting documentation. This software is provided "as is" without
express or implied warranty.
Some history
------------
Soon after the creation of PNG in 1995, the need was felt for a set of
pnmtopng / pngtopnm utilities. Independantly Alexander Lehmann and I
pnmtopng / pngtopnm utilities. Independently Alexander Lehmann and I
(Willem van Schaik) started such a project. Luckily we discovered this
and merged the two together into pnmtopng.tar.gz, which is available
from a/o ftp://ftp.simplesystems.org/pub/libpng/png/.
and merged the two, which later became part of NetPBM, available from
SourceForge.
These two utilities have many, many options and make use of most of the
features of PNG, like gamma, alpha, sbit, text-chunks, etc. This makes
@ -35,8 +25,8 @@ makes the whole setup a bit bulky. But that's unavoidable given the many
features of pnmtopng.
What now
--------
What now (1999)
---------------
At this moment libpng is in a very stable state and can do much of the
work done in pnmtopng. Also, pnmtopng needs to be upgraded to the new
interface of libpng. Hence, it is time for a rewrite from the ground up
@ -49,8 +39,8 @@ a small prototype that contains only the basic functionality. It doesn't
have any of the options to read or write special chunks and it will do
no gamma correction. But this makes it also a simple program that is
quite easy to understand and can serve well as a template for other
software developments. (By now there are of course a couple of programs,
like Greg Roelofs' rpng/wpng, that can be used just as good.)
software developments. By now there are of course a couple of programs,
like Greg Roelofs' rpng/wpng, that can be used just as good.
Can and can not
@ -60,7 +50,8 @@ PngMinus. Because I started this development in good-old Turbo-C, I
avoided the use the netpbm library, which requires DOS extenders. Again,
another reason to call it PngMinus (minus netpbm :-). So, part of the
program are some elementary routines to read / write pgm- and ppm-files.
It does not read b&w pbm-files.
It does not handle B&W pbm-files, but instead you could do pgm with bit-
depth 1.
The downside of this approach is that you can not use them on images
that require blocks of memory bigger than 64k (the DOS version). For
@ -96,58 +87,34 @@ To list the options type "png2pnm -h" or "pnm2png -h".
Just like Scandinavian furniture
--------------------------------
You have to put it together yourself. I did test the software under
MS-DOS with Turbo-C 3.0 and under RedHat Linux 4.2 with gcc. In both
cases I used libpng-1.0.4 and zlib-1.1.3. Later versions should be OK,
however some older libpng versions have a bug in pngmem.c when using
Turbo-C 3.0 (see below).
You have to put it together yourself. I developed the software on MS-DOS
with Turbo-C 3.0 and RedHat Linux 4.2 with gcc. In both cases I used
libpng-1.0.4 and zlib-1.1.3. By now (2019) it is twenty years later and
more current versions are OK.
You can build it using one of the two makefiles (make -f makefile.###)
or use the batch/script files pngminus.bat / pngminus.sh. This assumes
that you have built the libraries in ../libpng and ../zlib. Using Linux,
make sure that you have built libpng with makefile.std and not
makefile.linux (also called .lnx in earlier versions of libpng). The
latter creates a .so shared-library, while the PngMinus makefile assumes
a normal .a static library.
The makefile assumes that the libpng libraries can be found in ../.. and
libz in ../../../zlib. But you can change this to for example ../libpng
and ../zlib. The makefile creates two versions of each program, one with
static library support and the other using shared libraries.
If you create a ../pngsuite directory and then store the basn####.png
files from PngSuite (http://www.schaik.com/pngsuite/) in there, you can
test in one go the proper functioning of PngMinus, see png2pnm.bat and
pnm2png.bat (or the .sh versions).
test the proper functioning of PngMinus by running pngminus.sh.
Warranty
-------
Please, remember that this was just a small experiment to learn a few
things. It will have many unforeseen features <vbg>. Who said bugs? Use
it when you are in need for something simple or when you want to start
developing your own stuff.
The Turbo bug
-------------
** pngmem.old
hptr = (png_byte huge *)((long)(hptr) & 0xfffffff0L);
hptr += 16L;
** pngmem.c
hptr = (png_byte huge *)((long)(hptr) & 0xfffffff0L);
hptr = hptr + 16L;
**
** pngmem.old
png_ptr->offset_table_ptr[i] = (png_bytep)hptr;
hptr += (png_uint_32)65536L;
** pngmem.c
png_ptr->offset_table_ptr[i] = (png_bytep)hptr;
hptr = hptr + 65536L;
**
things. It will have many unforeseen features <vbg> ... who said bugs? Use
it when you are in need for something simple or when you want a starting
point for developing your own stuff.
The end
-------
Willem van Schaik
mailto:willem at schaik.com
mailto:willem at schaik dot com
http://www.schaik.com/png/
-------
Oct 1999
Oct 1999, Jan 2019

View File

@ -1,66 +0,0 @@
# Makefile for PngMinus (png2pnm and pnm2png)
# Linux / Unix
#CC=cc
CC=gcc
LD=$(CC)
RM=rm -f
#PNGPATH = /usr/local
#PNGINC = -I$(PNGPATH)/include/libpng16
#PNGLIB = -L$(PNGPATH)/lib -lpng16
#PNGLIBS = $(PNGPATH)/lib/libpng16.a
PNGINC = -I../..
PNGLIB = -L../.. -lpng
PNGLIBS = ../../libpng.a
#ZPATH = /usr/local
#ZINC = -I$(ZPATH)/include
#ZLIB = -L$(ZPATH)/lib -lz
#ZLIBS = $(ZPATH)/lib/libz.a
ZINC = -I../../../zlib
ZLIB = -L../../../zlib -lz
ZLIBS = ../../../zlib/libz.a
CPPFLAGS=$(PNGINC) $(ZINC)
CFLAGS=
LDLIBS=$(PNGLIB) $(ZLIB)
LDLIBSS=$(PNGLIBS) $(ZLIBS)
C=.c
O=.o
L=.a
E=
# dependencies
#all: png2pnm$(E) pnm2png$(E)
all: png2pnm$(E) pnm2png$(E) png2pnm-static$(E) pnm2png-static$(E)
png2pnm$(O): png2pnm$(C)
$(CC) -c $(CPPFLAGS) $(CFLAGS) png2pnm$(C)
png2pnm$(E): png2pnm$(O)
$(LD) $(LDFLAGS) -o png2pnm$(E) png2pnm$(O) $(LDLIBS) -lm
png2pnm-static$(E): png2pnm$(O)
$(LD) $(LDFLAGS) -o png2pnm-static$(E) png2pnm$(O) $(LDLIBSS) -lm
pnm2png$(O): pnm2png$(C)
$(CC) -c $(CPPFLAGS) $(CFLAGS) pnm2png$(C)
pnm2png$(E): pnm2png$(O)
$(LD) $(LDFLAGS) -o pnm2png$(E) pnm2png$(O) $(LDLIBS) -lm
pnm2png-static$(E): pnm2png$(O)
$(LD) $(LDFLAGS) -o pnm2png-static$(E) pnm2png$(O) $(LDLIBSS) -lm
clean:
$(RM) png2pnm$(O)
$(RM) pnm2png$(O)
$(RM) png2pnm$(E)
$(RM) pnm2png$(E)
$(RM) png2pnm-static$(E)
$(RM) pnm2png-static$(E)
# End of makefile for png2pnm / pnm2png

View File

@ -1,38 +0,0 @@
# Makefile for PngMinus (png2pnm and pnm2png)
# TurboC++ 3.0
CC=tcc -Ic:\tc3\inc
LD=tcc -Lc:\tc3\lib
LB=tlib
RM=del
CP=copy
MODEL=l
CPPFLAGS=-I..\libpng -I..\zlib
CFLAGS=-O -m$(MODEL)
LDFLAGS=-m$(MODEL) -L..\libpng -L..\zlib
C=.c
O=.obj
L=.lib
E=.exe
# dependencies
all: png2pnm$(E) pnm2png$(E)
png2pnm$(O): png2pnm$(C)
$(CC) -c $(CPPFLAGS) $(CFLAGS) png2pnm$(C)
png2pnm$(E): png2pnm$(O)
$(LD) $(LDFLAGS) png2pnm$(O) libpng$(L) zlib$(L)
pnm2png$(O): pnm2png$(C)
$(CC) -c $(CPPFLAGS) $(CFLAGS) pnm2png$(C)
pnm2png$(E): pnm2png$(O)
$(LD) $(LDFLAGS) pnm2png$(O) libpng$(L) zlib$(L)
clean:
$(RM) *$(O)
$(RM) *$(E)
# End of makefile for png2pnm / pnm2png

View File

@ -7,7 +7,7 @@ png2pnm.exe -noraw ..\pngsuite\basn0g16.png basn0g16.pgm
REM -- full-color
png2pnm.exe -noraw ..\pngsuite\basn2c08.png basn2c08.ppm
png2pnm.exe -noraw ..\pngsuite\basn2c16.png basn2c16.ppm
REM -- palletted
REM -- paletted
png2pnm.exe -noraw ..\pngsuite\basn3p01.png basn3p01.ppm
png2pnm.exe -noraw ..\pngsuite\basn3p02.png basn3p02.ppm
png2pnm.exe -noraw ..\pngsuite\basn3p04.png basn3p04.ppm
@ -27,7 +27,7 @@ png2pnm.exe -raw ..\pngsuite\basn0g16.png rawn0g16.pgm
REM -- full-color
png2pnm.exe -raw ..\pngsuite\basn2c08.png rawn2c08.ppm
png2pnm.exe -raw ..\pngsuite\basn2c16.png rawn2c16.ppm
REM -- palletted
REM -- paletted
png2pnm.exe -raw ..\pngsuite\basn3p01.png rawn3p01.ppm
png2pnm.exe -raw ..\pngsuite\basn3p02.png rawn3p02.ppm
png2pnm.exe -raw ..\pngsuite\basn3p04.png rawn3p04.ppm

View File

@ -1,28 +1,14 @@
/*
* png2pnm.c --- conversion from PNG-file to PGM/PPM-file
* copyright (C) 1999,2017 by Willem van Schaik <willem at schaik.com>
* copyright (C) 1999-2019 by Willem van Schaik <willem at schaik dot com>
*
* version 1.0 - 1999.10.15 - First version.
* 1.1 - 2017.04.22 - Add buffer-size check (Glenn Randers-Pehrson)
* 1.2 - 2017.08.24 - Fix potential overflow in buffer-size check
* (Glenn Randers-Pehrson)
* 1.3 - 2017.08.28 - Add PNGMINUS_UNUSED (Christian Hesse)
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear in
* supporting documentation. This software is provided "as is" without
* express or implied warranty.
* This software is released under the MIT license. For conditions of
* distribution and use, see the LICENSE file part of this package.
*/
#include <stdio.h>
#include <stdlib.h>
#ifdef __TURBOC__
#include <mem.h>
#include <fcntl.h>
#endif
#include <zlib.h>
#ifndef BOOL
#define BOOL unsigned char
@ -34,45 +20,25 @@
#define FALSE (BOOL) 0
#endif
#ifdef __TURBOC__
#define STDIN 0
#define STDOUT 1
#define STDERR 2
#endif
/* to make png2pnm verbose so we can find problems (needs to be before png.h) */
/* make png2pnm verbose so we can find problems (needs to be before png.h) */
#ifndef PNG_DEBUG
#define PNG_DEBUG 0
#endif
#include "png.h"
/* Define png_jmpbuf() in case we are using a pre-1.0.6 version of libpng */
#ifndef png_jmpbuf
# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
#endif
#ifndef PNGMINUS_UNUSED
/* Unused formal parameter warnings are silenced using the following macro
* which is expected to have no bad effects on performance (optimizing
* compilers will probably remove it entirely).
*/
# define PNGMINUS_UNUSED(param) (void)param
#endif
/* function prototypes */
int main (int argc, char *argv[]);
int main (int argc, char *argv[]);
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);
/*
* main
*/
int main(int argc, char *argv[])
int main (int argc, char *argv[])
{
FILE *fp_rd = stdin;
FILE *fp_wr = stdout;
@ -99,21 +65,21 @@ int main(int argc, char *argv[])
if ((fp_al = fopen (argv[argi], "wb")) == NULL)
{
fprintf (stderr, "PNM2PNG\n");
fprintf (stderr, "Error: can not create alpha-channel file %s\n",
argv[argi]);
fprintf (stderr, "Error: cannot create alpha-channel file %s\n",
argv[argi]);
exit (1);
}
break;
case 'h':
case '?':
usage();
exit(0);
usage ();
exit (0);
break;
default:
fprintf (stderr, "PNG2PNM\n");
fprintf (stderr, "Error: unknown option %s\n", argv[argi]);
usage();
exit(1);
usage ();
exit (1);
break;
} /* end switch */
}
@ -121,9 +87,9 @@ int main(int argc, char *argv[])
{
if ((fp_rd = fopen (argv[argi], "rb")) == NULL)
{
fprintf (stderr, "PNG2PNM\n");
fprintf (stderr, "Error: file %s does not exist\n", argv[argi]);
exit (1);
fprintf (stderr, "PNG2PNM\n");
fprintf (stderr, "Error: file %s does not exist\n", argv[argi]);
exit (1);
}
}
else if (fp_wr == stdout)
@ -131,7 +97,7 @@ int main(int argc, char *argv[])
if ((fp_wr = fopen (argv[argi], "wb")) == NULL)
{
fprintf (stderr, "PNG2PNM\n");
fprintf (stderr, "Error: can not create file %s\n", argv[argi]);
fprintf (stderr, "Error: cannot create file %s\n", argv[argi]);
exit (1);
}
}
@ -139,21 +105,17 @@ int main(int argc, char *argv[])
{
fprintf (stderr, "PNG2PNM\n");
fprintf (stderr, "Error: too many parameters\n");
usage();
exit(1);
usage ();
exit (1);
}
} /* end for */
#ifdef __TURBOC__
#if defined(O_BINARY) && (O_BINARY != 0)
/* set stdin/stdout if required to binary */
if (fp_rd == stdin)
{
setmode (STDIN, O_BINARY);
}
setmode (fileno (stdin), O_BINARY);
if ((raw) && (fp_wr == stdout))
{
setmode (STDOUT, O_BINARY);
}
setmode (fileno (stdout), O_BINARY);
#endif
/* call the conversion program itself */
@ -161,7 +123,7 @@ int main(int argc, char *argv[])
{
fprintf (stderr, "PNG2PNM\n");
fprintf (stderr, "Error: unsuccessful conversion of PNG-image\n");
exit(1);
exit (1);
}
/* close input file */
@ -179,23 +141,18 @@ int main(int argc, char *argv[])
* usage
*/
void usage()
void usage ()
{
fprintf (stderr, "PNG2PNM\n");
fprintf (stderr, " by Willem van Schaik, 1999\n");
#ifdef __TURBOC__
fprintf (stderr, " for Turbo-C and Borland-C compilers\n");
#else
fprintf (stderr, " for Linux (and Unix) compilers\n");
#endif
fprintf (stderr, "Usage: png2pnm [options] <file>.png [<file>.pnm]\n");
fprintf (stderr, " or: ... | png2pnm [options]\n");
fprintf (stderr, "Options:\n");
fprintf (stderr,
" -r[aw] write pnm-file in binary format (P4/P5/P6) (default)\n");
" -r[aw] write pnm-file in binary format (P4/P5/P6) (default)\n");
fprintf (stderr, " -n[oraw] write pnm-file in ascii format (P1/P2/P3)\n");
fprintf (stderr,
" -a[lpha] <file>.pgm write PNG alpha channel as pgm-file\n");
" -a[lpha] <file>.pgm write PNG alpha channel as pgm-file\n");
fprintf (stderr, " -h | -? print this help-information\n");
}
@ -204,10 +161,10 @@ void usage()
*/
BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
volatile BOOL raw, BOOL alpha)
BOOL raw, BOOL alpha)
{
png_struct *png_ptr = NULL;
png_info *info_ptr = NULL;
png_info *info_ptr = NULL;
png_byte buf[8];
png_byte *png_pixels = NULL;
png_byte **row_pointers = NULL;
@ -231,24 +188,24 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
return FALSE;
ret = png_sig_cmp (buf, 0, 8);
if (ret)
if (ret != 0)
return FALSE;
/* create png and info structures */
png_ptr = png_create_read_struct (png_get_libpng_ver(NULL),
NULL, NULL, NULL);
NULL, NULL, NULL);
if (!png_ptr)
return FALSE; /* out of memory */
return FALSE; /* out of memory */
info_ptr = png_create_info_struct (png_ptr);
if (!info_ptr)
{
png_destroy_read_struct (&png_ptr, NULL, NULL);
return FALSE; /* out of memory */
return FALSE; /* out of memory */
}
if (setjmp (png_jmpbuf(png_ptr)))
if (setjmp (png_jmpbuf (png_ptr)))
{
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
return FALSE;
@ -256,15 +213,14 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
/* set up the input control for C streams */
png_init_io (png_ptr, png_file);
png_set_sig_bytes (png_ptr, 8); /* we already read the 8 signature bytes */
png_set_sig_bytes (png_ptr, 8); /* we already read the 8 signature bytes */
/* read the file information */
png_read_info (png_ptr, info_ptr);
/* get size and bit-depth of the PNG-image */
png_get_IHDR (png_ptr, info_ptr,
&width, &height, &bit_depth, &color_type,
NULL, NULL, NULL);
png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
NULL, NULL, NULL);
/* set-up the transformations */
@ -284,7 +240,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
png_set_strip_16 (png_ptr);
/* transform grayscale images into full-color */
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);
/* only if file has a file gamma, we do a correction */
if (png_get_gAMA (png_ptr, info_ptr, &file_gamma))
@ -298,14 +254,14 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
/* get the new color-type and bit-depth (after expansion/stripping) */
png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
NULL, NULL, NULL);
NULL, NULL, NULL);
/* check for 16-bit files */
if (bit_depth == 16)
{
raw = FALSE;
#ifdef __TURBOC__
pnm_file->flags &= ~((unsigned) _F_BIN);
#if defined(O_BINARY) && (O_BINARY != 0)
setmode (fileno (pnm_file), O_BINARY);
#endif
}
@ -333,25 +289,25 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
/* row_bytes is the width x number of channels x (bit-depth / 8) */
row_bytes = png_get_rowbytes (png_ptr, info_ptr);
if ((row_bytes == 0 || (size_t)height > ((size_t)(-1))/(size_t)row_bytes))
if ((row_bytes == 0) ||
((size_t) height > (size_t) (-1) / (size_t) row_bytes))
{
/* too big */
/* too big */
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
return FALSE;
}
if ((png_pixels = (png_byte *)
malloc ((size_t)row_bytes * (size_t)height * sizeof (png_byte))) == NULL)
malloc ((size_t) row_bytes * (size_t) height)) == NULL)
{
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
return FALSE;
}
if ((row_pointers = (png_byte **)
malloc ((size_t)height * sizeof (png_bytep))) == NULL)
malloc ((size_t) height * sizeof (png_byte *))) == NULL)
{
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
free (png_pixels);
png_pixels = NULL;
return FALSE;
}
@ -366,7 +322,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
png_read_end (png_ptr, info_ptr);
/* clean up after the read, and free any memory allocated - REQUIRED */
png_destroy_read_struct (&png_ptr, &info_ptr, (png_infopp) NULL);
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
/* write header of PNM file */
@ -406,14 +362,21 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
for (i = 0; i < (channels - alpha_present); i++)
{
if (raw)
fputc ((int) *pix_ptr++ , pnm_file);
{
fputc ((int) *pix_ptr++, pnm_file);
}
else
if (bit_depth == 16){
{
if (bit_depth == 16)
{
dep_16 = (long) *pix_ptr++;
fprintf (pnm_file, "%ld ", (dep_16 << 8) + ((long) *pix_ptr++));
}
else
{
fprintf (pnm_file, "%ld ", (long) *pix_ptr++);
}
}
}
if (alpha_present)
{
@ -426,17 +389,23 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
else /* output alpha-channel as pgm file */
{
if (raw)
fputc ((int) *pix_ptr++ , alpha_file);
{
fputc ((int) *pix_ptr++, alpha_file);
}
else
{
if (bit_depth == 16)
{
dep_16 = (long) *pix_ptr++;
fprintf (alpha_file, "%ld ", (dep_16 << 8) + (long) *pix_ptr++);
}
else
{
fprintf (alpha_file, "%ld ", (long) *pix_ptr++);
}
}
}
} /* if alpha_present */
} /* end if alpha_present */
if (!raw)
if (col % 4 == 3)
@ -448,13 +417,11 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
fprintf (pnm_file, "\n");
} /* end for row */
if (row_pointers != (unsigned char**) NULL)
if (row_pointers != NULL)
free (row_pointers);
if (png_pixels != (unsigned char*) NULL)
if (png_pixels != NULL)
free (png_pixels);
PNGMINUS_UNUSED(raw); /* to quiet a Coverity defect */
return TRUE;
} /* end of source */

View File

@ -8,7 +8,7 @@
# -- full-color
./png2pnm -noraw ../pngsuite/basn2c08.png basn2c08.ppm
./png2pnm -noraw ../pngsuite/basn2c16.png basn2c16.ppm
# -- palletted
# -- paletted
./png2pnm -noraw ../pngsuite/basn3p01.png basn3p01.ppm
./png2pnm -noraw ../pngsuite/basn3p02.png basn3p02.ppm
./png2pnm -noraw ../pngsuite/basn3p04.png basn3p04.ppm
@ -28,7 +28,7 @@
# -- full-color
./png2pnm -raw ../pngsuite/basn2c08.png rawn2c08.ppm
./png2pnm -raw ../pngsuite/basn2c16.png rawn2c16.ppm
# -- palletted
# -- paletted
./png2pnm -raw ../pngsuite/basn3p01.png rawn3p01.ppm
./png2pnm -raw ../pngsuite/basn3p02.png rawn3p02.ppm
./png2pnm -raw ../pngsuite/basn3p04.png rawn3p04.ppm

View File

@ -1,4 +1,4 @@
make -f makefile.tc3
make
call png2pnm.bat
call pnm2png.bat

View File

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

View File

@ -7,7 +7,7 @@ pnm2png.exe basn0g16.pgm basn0g16.png
REM -- full-color
pnm2png.exe basn2c08.ppm basn2c08.png
pnm2png.exe basn2c16.ppm basn2c16.png
REM -- palletted
REM -- paletted
pnm2png.exe basn3p01.ppm basn3p01.png
pnm2png.exe basn3p02.ppm basn3p02.png
pnm2png.exe basn3p04.ppm basn3p04.png
@ -27,7 +27,7 @@ pnm2png.exe rawn0g16.pgm rawn0g16.png
REM -- full-color
pnm2png.exe rawn2c08.ppm rawn2c08.png
pnm2png.exe rawn2c16.ppm rawn2c16.png
REM -- palletted
REM -- paletted
pnm2png.exe rawn3p01.ppm rawn3p01.png
pnm2png.exe rawn3p02.ppm rawn3p02.png
pnm2png.exe rawn3p04.ppm rawn3p04.png

View File

@ -1,29 +1,14 @@
/*
* pnm2png.c --- conversion from PBM/PGM/PPM-file to PNG-file
* copyright (C) 1999,2015,2017 by Willem van Schaik <willem at schaik.com>
* copyright (C) 1999-2019 by Willem van Schaik <willem at schaik dot com>
*
* version 1.0 - 1999.10.15 - First version.
* version 1.1 - 2015.07.29 - Fixed leaks (Glenn Randers-Pehrson)
* version 1.2 - 2017.04.22 - Add buffer-size check
* 1.3 - 2017.08.24 - Fix potential overflow in buffer-size check
* (Glenn Randers-Pehrson)
* 1.4 - 2017.08.28 - Add PNGMINUS_UNUSED (Christian Hesse)
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear in
* supporting documentation. This software is provided "as is" without
* express or implied warranty.
* This software is released under the MIT license. For conditions of
* distribution and use, see the LICENSE file part of this package.
*/
#include <stdio.h>
#include <stdlib.h>
#ifdef __TURBOC__
#include <mem.h>
#include <fcntl.h>
#endif
#include <zlib.h>
#ifndef BOOL
#define BOOL unsigned char
@ -35,38 +20,20 @@
#define FALSE (BOOL) 0
#endif
#define STDIN 0
#define STDOUT 1
#define STDERR 2
/* to make pnm2png verbose so we can find problems (needs to be before png.h) */
/* make pnm2png verbose so we can find problems (needs to be before png.h) */
#ifndef PNG_DEBUG
#define PNG_DEBUG 0
#endif
#include "png.h"
/* Define png_jmpbuf() in case we are using a pre-1.0.6 version of libpng */
#ifndef png_jmpbuf
# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
#endif
#ifndef PNGMINUS_UNUSED
/* Unused formal parameter warnings are silenced using the following macro
* which is expected to have no bad effects on performance (optimizing
* compilers will probably remove it entirely).
*/
# define PNGMINUS_UNUSED(param) (void)param
#endif
/* function prototypes */
int main (int argc, char *argv[]);
int main (int argc, char *argv[]);
void usage ();
BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
BOOL alpha);
void get_token(FILE *pnm_file, char *token);
BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file,
BOOL interlace, BOOL alpha);
void get_token (FILE *pnm_file, char *token_buf, size_t token_buf_size);
png_uint_32 get_data (FILE *pnm_file, int depth);
png_uint_32 get_value (FILE *pnm_file, int depth);
@ -74,7 +41,7 @@ png_uint_32 get_value (FILE *pnm_file, int depth);
* main
*/
int main(int argc, char *argv[])
int main (int argc, char *argv[])
{
FILE *fp_rd = stdin;
FILE *fp_al = NULL;
@ -99,20 +66,20 @@ int main(int argc, char *argv[])
{
fprintf (stderr, "PNM2PNG\n");
fprintf (stderr, "Error: alpha-channel file %s does not exist\n",
argv[argi]);
argv[argi]);
exit (1);
}
break;
case 'h':
case '?':
usage();
exit(0);
usage ();
exit (0);
break;
default:
fprintf (stderr, "PNM2PNG\n");
fprintf (stderr, "Error: unknown option %s\n", argv[argi]);
usage();
exit(1);
usage ();
exit (1);
break;
} /* end switch */
}
@ -130,7 +97,7 @@ int main(int argc, char *argv[])
if ((fp_wr = fopen (argv[argi], "wb")) == NULL)
{
fprintf (stderr, "PNM2PNG\n");
fprintf (stderr, "Error: can not create PNG-file %s\n", argv[argi]);
fprintf (stderr, "Error: cannot create PNG-file %s\n", argv[argi]);
exit (1);
}
}
@ -138,21 +105,19 @@ int main(int argc, char *argv[])
{
fprintf (stderr, "PNM2PNG\n");
fprintf (stderr, "Error: too many parameters\n");
usage();
usage ();
exit (1);
}
} /* end for */
#ifdef __TURBOC__
/* set stdin/stdout to binary, we're reading the PNM always! in binary format */
#if defined(O_BINARY) && (O_BINARY != 0)
/* set stdin/stdout to binary,
* we're reading the PNM always! in binary format
*/
if (fp_rd == stdin)
{
setmode (STDIN, O_BINARY);
}
setmode (fileno (stdin), O_BINARY);
if (fp_wr == stdout)
{
setmode (STDOUT, O_BINARY);
}
setmode (fileno (stdout), O_BINARY);
#endif
/* call the conversion program itself */
@ -178,15 +143,10 @@ int main(int argc, char *argv[])
* usage
*/
void usage()
void usage ()
{
fprintf (stderr, "PNM2PNG\n");
fprintf (stderr, " by Willem van Schaik, 1999\n");
#ifdef __TURBOC__
fprintf (stderr, " for Turbo-C and Borland-C compilers\n");
#else
fprintf (stderr, " for Linux (and Unix) compilers\n");
#endif
fprintf (stderr, "Usage: pnm2png [options] <file>.<pnm> [<file>.png]\n");
fprintf (stderr, " or: ... | pnm2png [options]\n");
fprintf (stderr, "Options:\n");
@ -200,31 +160,31 @@ void usage()
* pnm2png
*/
BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
BOOL alpha)
BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file,
BOOL interlace, BOOL alpha)
{
png_struct *png_ptr = NULL;
png_info *info_ptr = NULL;
png_byte *png_pixels = NULL;
png_byte **row_pointers = NULL;
png_byte *pix_ptr = NULL;
volatile png_uint_32 row_bytes;
volatile png_uint_32 row_bytes;
char type_token[16];
char width_token[16];
char height_token[16];
char maxval_token[16];
volatile int color_type=1;
unsigned long ul_width=0, ul_alpha_width=0;
unsigned long ul_height=0, ul_alpha_height=0;
unsigned long ul_maxval=0;
volatile png_uint_32 width=0, height=0;
volatile png_uint_32 alpha_width=0, alpha_height=0;
volatile int color_type = 1;
unsigned long ul_width = 0, ul_alpha_width = 0;
unsigned long ul_height = 0, ul_alpha_height = 0;
unsigned long ul_maxval = 0;
volatile png_uint_32 width = 0, height = 0;
volatile png_uint_32 alpha_width = 0, alpha_height = 0;
png_uint_32 maxval;
volatile int bit_depth = 0;
int channels=0;
volatile int bit_depth = 0;
int channels = 0;
int alpha_depth = 0;
int alpha_present=0;
int alpha_present = 0;
int row, col;
BOOL raw, alpha_raw = FALSE;
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
@ -235,7 +195,7 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
/* read header of PNM file */
get_token(pnm_file, type_token);
get_token (pnm_file, type_token, sizeof (type_token));
if (type_token[0] != 'P')
{
return FALSE;
@ -245,30 +205,31 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
raw = (type_token[1] == '4');
color_type = PNG_COLOR_TYPE_GRAY;
get_token(pnm_file, width_token);
get_token (pnm_file, width_token, sizeof (width_token));
sscanf (width_token, "%lu", &ul_width);
width = (png_uint_32) ul_width;
get_token(pnm_file, height_token);
get_token (pnm_file, height_token, sizeof (height_token));
sscanf (height_token, "%lu", &ul_height);
height = (png_uint_32) ul_height;
bit_depth = 1;
packed_bitmap = TRUE;
#else
fprintf (stderr, "PNM2PNG built without PNG_WRITE_INVERT_SUPPORTED and \n");
fprintf (stderr, "PNM2PNG built without PNG_WRITE_INVERT_SUPPORTED and\n");
fprintf (stderr, "PNG_WRITE_PACK_SUPPORTED can't read PBM (P1,P4) files\n");
return FALSE;
#endif
}
else if ((type_token[1] == '2') || (type_token[1] == '5'))
{
raw = (type_token[1] == '5');
color_type = PNG_COLOR_TYPE_GRAY;
get_token(pnm_file, width_token);
get_token (pnm_file, width_token, sizeof (width_token));
sscanf (width_token, "%lu", &ul_width);
width = (png_uint_32) ul_width;
get_token(pnm_file, height_token);
get_token (pnm_file, height_token, sizeof (height_token));
sscanf (height_token, "%lu", &ul_height);
height = (png_uint_32) ul_height;
get_token(pnm_file, maxval_token);
get_token (pnm_file, maxval_token, sizeof (maxval_token));
sscanf (maxval_token, "%lu", &ul_maxval);
maxval = (png_uint_32) ul_maxval;
@ -280,20 +241,22 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
bit_depth = 4;
else if (maxval <= 255)
bit_depth = 8;
else /* if (maxval <= 65535) */
else if (maxval <= 65535U)
bit_depth = 16;
else /* maxval > 65535U */
return FALSE;
}
else if ((type_token[1] == '3') || (type_token[1] == '6'))
{
raw = (type_token[1] == '6');
color_type = PNG_COLOR_TYPE_RGB;
get_token(pnm_file, width_token);
get_token (pnm_file, width_token, sizeof (width_token));
sscanf (width_token, "%lu", &ul_width);
width = (png_uint_32) ul_width;
get_token(pnm_file, height_token);
get_token (pnm_file, height_token, sizeof (height_token));
sscanf (height_token, "%lu", &ul_height);
height = (png_uint_32) ul_height;
get_token(pnm_file, maxval_token);
get_token (pnm_file, maxval_token, sizeof (maxval_token));
sscanf (maxval_token, "%lu", &ul_maxval);
maxval = (png_uint_32) ul_maxval;
if (maxval <= 1)
@ -304,8 +267,10 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
bit_depth = 4;
else if (maxval <= 255)
bit_depth = 8;
else /* if (maxval <= 65535) */
else if (maxval <= 65535U)
bit_depth = 16;
else /* maxval > 65535U */
return FALSE;
}
else
{
@ -321,7 +286,7 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
if (color_type == PNG_COLOR_TYPE_RGB)
color_type = PNG_COLOR_TYPE_RGB_ALPHA;
get_token(alpha_file, type_token);
get_token (alpha_file, type_token, sizeof (type_token));
if (type_token[0] != 'P')
{
return FALSE;
@ -329,17 +294,17 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
else if ((type_token[1] == '2') || (type_token[1] == '5'))
{
alpha_raw = (type_token[1] == '5');
get_token(alpha_file, width_token);
get_token (alpha_file, width_token, sizeof (width_token));
sscanf (width_token, "%lu", &ul_alpha_width);
alpha_width=(png_uint_32) ul_alpha_width;
alpha_width = (png_uint_32) ul_alpha_width;
if (alpha_width != width)
return FALSE;
get_token(alpha_file, height_token);
get_token (alpha_file, height_token, sizeof (height_token));
sscanf (height_token, "%lu", &ul_alpha_height);
alpha_height = (png_uint_32) ul_alpha_height;
if (alpha_height != height)
return FALSE;
get_token(alpha_file, maxval_token);
get_token (alpha_file, maxval_token, sizeof (maxval_token));
sscanf (maxval_token, "%lu", &ul_maxval);
maxval = (png_uint_32) ul_maxval;
if (maxval <= 1)
@ -350,8 +315,10 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
alpha_depth = 4;
else if (maxval <= 255)
alpha_depth = 8;
else /* if (maxval <= 65535) */
else if (maxval <= 65535U)
alpha_depth = 16;
else /* maxval > 65535U */
return FALSE;
if (alpha_depth != bit_depth)
return FALSE;
}
@ -379,21 +346,29 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
if (packed_bitmap)
{
/* row data is as many bytes as can fit width x channels x bit_depth */
row_bytes = (width * channels * bit_depth + 7) / 8;
}
else
#endif
/* row_bytes is the width x number of channels x (bit-depth / 8) */
row_bytes = width * channels * ((bit_depth <= 8) ? 1 : 2);
if ((row_bytes == 0 || (size_t)height > ((size_t)(-1))/(size_t)row_bytes))
{
/* too big */
/* row_bytes is the width x number of channels x (bit-depth / 8) */
row_bytes = width * channels * ((bit_depth <= 8) ? 1 : 2);
}
if ((row_bytes == 0) ||
((size_t) height > (size_t) (-1) / (size_t) row_bytes))
{
/* too big */
return FALSE;
}
if ((png_pixels = (png_byte *)
malloc ((size_t)row_bytes * (size_t)height * sizeof (png_byte))) == NULL)
malloc ((size_t) row_bytes * (size_t) height)) == NULL)
{
/* out of memory */
return FALSE;
}
/* read data from PNM file */
pix_ptr = png_pixels;
@ -404,9 +379,12 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
if (packed_bitmap)
{
for (i = 0; i < (int) row_bytes; i++)
{
/* png supports this format natively so no conversion is needed */
*pix_ptr++ = get_data (pnm_file, 8);
} else
}
}
else
#endif
{
for (col = 0; col < (int) width; col++)
@ -414,10 +392,15 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
for (i = 0; i < (channels - alpha_present); i++)
{
if (raw)
{
*pix_ptr++ = get_data (pnm_file, bit_depth);
}
else
{
if (bit_depth <= 8)
{
*pix_ptr++ = get_value (pnm_file, bit_depth);
}
else
{
tmp16 = get_value (pnm_file, bit_depth);
@ -426,41 +409,46 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
*pix_ptr = (png_byte) (tmp16 & 0xFF);
pix_ptr++;
}
}
}
if (alpha) /* read alpha-channel from pgm file */
{
if (alpha_raw)
{
*pix_ptr++ = get_data (alpha_file, alpha_depth);
}
else
{
if (alpha_depth <= 8)
{
*pix_ptr++ = get_value (alpha_file, bit_depth);
}
else
{
tmp16 = get_value (alpha_file, bit_depth);
*pix_ptr++ = (png_byte) ((tmp16 >> 8) & 0xFF);
*pix_ptr++ = (png_byte) (tmp16 & 0xFF);
}
} /* if alpha */
} /* if packed_bitmap */
}
} /* end if alpha */
} /* end if packed_bitmap */
} /* end for col */
} /* end for row */
/* prepare the standard PNG structures */
png_ptr = png_create_write_struct (png_get_libpng_ver(NULL), NULL, NULL,
NULL);
png_ptr = png_create_write_struct (png_get_libpng_ver(NULL),
NULL, NULL, NULL);
if (!png_ptr)
{
free (png_pixels);
png_pixels = NULL;
return FALSE;
}
info_ptr = png_create_info_struct (png_ptr);
if (!info_ptr)
{
png_destroy_write_struct (&png_ptr, (png_infopp) NULL);
png_destroy_write_struct (&png_ptr, NULL);
free (png_pixels);
png_pixels = NULL;
return FALSE;
}
@ -472,12 +460,10 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
}
#endif
/* setjmp() must be called in every function that calls a PNG-reading libpng function */
if (setjmp (png_jmpbuf(png_ptr)))
if (setjmp (png_jmpbuf (png_ptr)))
{
png_destroy_write_struct (&png_ptr, &info_ptr);
free (png_pixels);
png_pixels = NULL;
return FALSE;
}
@ -486,21 +472,20 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
/* we're going to write more or less the same PNG as the input file */
png_set_IHDR (png_ptr, info_ptr, width, height, bit_depth, color_type,
(!interlace) ? PNG_INTERLACE_NONE : PNG_INTERLACE_ADAM7,
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
(!interlace) ? PNG_INTERLACE_NONE : PNG_INTERLACE_ADAM7,
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
/* write the file header information */
png_write_info (png_ptr, info_ptr);
/* if needed we will allocate memory for an new array of row-pointers */
if (row_pointers == (unsigned char**) NULL)
if (row_pointers == NULL)
{
if ((row_pointers = (png_byte **)
malloc (height * sizeof (png_bytep))) == NULL)
malloc (height * sizeof (png_byte *))) == NULL)
{
png_destroy_write_struct (&png_ptr, &info_ptr);
free (png_pixels);
png_pixels = NULL;
return FALSE;
}
}
@ -518,62 +503,60 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
/* clean up after the write, and free any memory allocated */
png_destroy_write_struct (&png_ptr, &info_ptr);
if (row_pointers != (unsigned char**) NULL)
if (row_pointers != NULL)
free (row_pointers);
if (png_pixels != (unsigned char*) NULL)
if (png_pixels != NULL)
free (png_pixels);
PNGMINUS_UNUSED(raw); /* Quiet a Coverity defect */
return TRUE;
} /* end of pnm2png */
/*
* get_token() - gets the first string after whitespace
* get_token - gets the first string after whitespace
*/
void get_token(FILE *pnm_file, char *token)
void get_token (FILE *pnm_file, char *token_buf, size_t token_buf_size)
{
int i = 0;
size_t i = 0;
int ret;
/* remove white-space and comment lines */
do
{
ret = fgetc(pnm_file);
ret = fgetc (pnm_file);
if (ret == '#')
{
/* the rest of this line is a comment */
do
{
ret = fgetc(pnm_file);
ret = fgetc (pnm_file);
}
while ((ret != '\n') && (ret != '\r') && (ret != EOF));
}
if (ret == EOF) break;
token[i] = (unsigned char) ret;
token_buf[i] = (char) ret;
}
while ((token[i] == '\n') || (token[i] == '\r') || (token[i] == ' '));
while ((ret == '\n') || (ret == '\r') || (ret == ' '));
/* read string */
do
{
ret = fgetc(pnm_file);
ret = fgetc (pnm_file);
if (ret == EOF) break;
i++;
token[i] = (unsigned char) ret;
if (++i == token_buf_size - 1) break;
token_buf[i] = (char) ret;
}
while ((token[i] != '\n') && (token[i] != '\r') && (token[i] != ' '));
while ((ret != '\n') && (ret != '\r') && (ret != ' '));
token[i] = '\0';
token_buf[i] = '\0';
return;
}
/*
* get_data() - takes first byte and converts into next pixel value,
* taking as much bits as defined by bit-depth and
* using the bit-depth to fill up a byte (0Ah -> AAh)
* get_data - takes first byte and converts into next pixel value,
* taking as much bits as defined by bit-depth and
* using the bit-depth to fill up a byte (0Ah -> AAh)
*/
png_uint_32 get_data (FILE *pnm_file, int depth)
@ -605,14 +588,14 @@ png_uint_32 get_data (FILE *pnm_file, int depth)
}
/*
* get_value() - takes first (numeric) string and converts into number,
* using the bit-depth to fill up a byte (0Ah -> AAh)
* get_value - takes first (numeric) string and converts into number,
* using the bit-depth to fill up a byte (0Ah -> AAh)
*/
png_uint_32 get_value (FILE *pnm_file, int depth)
{
static png_uint_32 mask = 0;
png_byte token[16];
char token[16];
unsigned long ul_ret_value;
png_uint_32 ret_value;
int i = 0;
@ -621,8 +604,8 @@ png_uint_32 get_value (FILE *pnm_file, int depth)
for (i = 0; i < depth; i++)
mask = (mask << 1) | 0x01;
get_token (pnm_file, (char *) token);
sscanf ((const char *) token, "%lu", &ul_ret_value);
get_token (pnm_file, token, sizeof (token));
sscanf (token, "%lu", &ul_ret_value);
ret_value = (png_uint_32) ul_ret_value;
ret_value &= mask;
@ -635,4 +618,3 @@ png_uint_32 get_value (FILE *pnm_file, int depth)
}
/* end of source */

View File

@ -8,7 +8,7 @@
# -- full-color
./pnm2png basn2c08.ppm basn2c08.png
./pnm2png basn2c16.ppm basn2c16.png
# -- palletted
# -- paletted
./pnm2png basn3p01.ppm basn3p01.png
./pnm2png basn3p02.ppm basn3p02.png
./pnm2png basn3p04.ppm basn3p04.png
@ -28,7 +28,7 @@
# -- full-color
./pnm2png rawn2c08.ppm rawn2c08.png
./pnm2png rawn2c16.ppm rawn2c16.png
# -- palletted
# -- paletted
./pnm2png rawn3p01.ppm rawn3p01.png
./pnm2png rawn3p02.ppm rawn3p02.png
./pnm2png rawn3p04.ppm rawn3p04.png

View File

@ -16,6 +16,8 @@ chunks, etc.
The "ft*.png" images are "free/libre" replacements for the transparent
corresponding t*.png images in the PngSuite.
The "i*.png" images are the same images, but interlaced.
The images in this directory represent the basic PNG color-types:
grayscale (1-16 bit deep), full color (8 or 16 bit), paletted
(1-8 bit) and grayscale or color images with alpha channel. You

View File

@ -0,0 +1,9 @@
basn0g01.png
basn0g02.png
basn0g04.png
basn3p01.png
basn3p02.png
basn3p04.png
ftbbn0g01.png
ftbbn0g02.png
ftbbn0g04.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 558 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 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.4 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: 847 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: 1.5 KiB

View File

@ -0,0 +1,2 @@
These images fail the "pngimage-quick" and "pngimage-full" tests.

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 489 B

View File

@ -46,7 +46,7 @@ everything should be static. It must define the function:
static int png_have_vsx(png_structp png_ptr);
That function must return 1 if ARM NEON instructions are supported, 0 if not.
That function must return 1 if POWERPC_VSX instructions are supported, 0 if not.
It must not execute png_error unless it detects a bug. A png_error will prevent
the reading of the PNG and in the future, writing too.

View File

@ -23,14 +23,12 @@
static int
png_have_vsx(png_structp png_ptr)
{
const unsigned long auxv = getauxval( AT_HWCAP );
unsigned long auxv = getauxval(AT_HWCAP);
PNG_UNUSED(png_ptr)
if(auxv & (PPC_FEATURE_HAS_ALTIVEC|PPC_FEATURE_HAS_VSX ))
if(auxv & (PPC_FEATURE_HAS_ALTIVEC|PPC_FEATURE_HAS_VSX))
return 1;
else
return 0;
}

View File

@ -74,7 +74,7 @@ case "$1" in
--coverage)
# Comments below indicate cases known to be required and not duplicated
# in other (required) cases; the aim is to get a minimal set that gives
# the maxium code coverage.
# the maximum code coverage.
mpg none gray-alpha 8 # required: code coverage, sRGB opaque component
mpg none palette 8 # required: basic palette read
mpg 1.8 gray 2 # required: tests gamma threshold code

View File

@ -54,7 +54,7 @@ doed(){
}
# In beta versions the version string which appears in files can be a little
# long and cause spuriously overlong lines. To avoid this subtitute the version
# long and cause spuriously overlong lines. To avoid this substitute the version
# string with a 'standard' version a.b.cc before checking for long lines.
if test -r png.h
then

View File

@ -388,7 +388,7 @@ main(int argc, char **argv)
if (!test_only)
{
printf("PNG_CONST png_uint_16 png_sRGB_table[256] =\n{\n ");
printf("const png_uint_16 png_sRGB_table[256] =\n{\n ");
for (i=0; i<255; )
{
do
@ -401,7 +401,7 @@ main(int argc, char **argv)
printf("%d\n};\n\n", png_sRGB_table[i]);
printf("PNG_CONST png_uint_16 png_sRGB_base[512] =\n{\n ");
printf("const png_uint_16 png_sRGB_base[512] =\n{\n ");
for (i=0; i<511; )
{
do
@ -413,7 +413,7 @@ main(int argc, char **argv)
}
printf("%d\n};\n\n", png_sRGB_base[i]);
printf("PNG_CONST png_byte png_sRGB_delta[512] =\n{\n ");
printf("const png_byte png_sRGB_delta[512] =\n{\n ");
for (i=0; i<511; )
{
do

View File

@ -191,7 +191,7 @@ vl_strategy[] =
/* This controls the order of search. */
{ "huffman", Z_HUFFMAN_ONLY },
{ "RLE", Z_RLE },
{ "fixed", Z_FIXED }, /* the remainder do window searchs */
{ "fixed", Z_FIXED }, /* the remainder do window searches */
{ "filtered", Z_FILTERED },
{ "default", Z_DEFAULT_STRATEGY },
{ all, 0 }
@ -336,7 +336,7 @@ static const option options[] =
# define VLC(name) VLCIDAT(name) VLCiCCP(name) VLCzTXt(name)
# ifdef PNG_SW_COMPRESS_png_level
/* The libpng compression level isn't searched beause it justs sets the
/* The libpng compression level isn't searched because it justs sets the
* other things that are searched!
*/
VLO("compression", compression, 0)
@ -735,7 +735,7 @@ option_index(struct display *dp, const char *opt, size_t len)
static int
get_option(struct display *dp, const char *opt, int *value)
{
const png_byte i = option_index(dp, opt, strlen(opt));
png_byte i = option_index(dp, opt, strlen(opt));
if (dp->entry[i]) /* option was set on command line */
{
@ -789,7 +789,7 @@ record_opt(struct display *dp, png_byte opt, const char *entry_name)
* numerical value.
*/
{
const unsigned int sp = dp->csp; /* stack entry of next searched option */
unsigned int sp = dp->csp; /* stack entry of next searched option */
if (sp >= dp->tsp)
{
@ -797,7 +797,7 @@ record_opt(struct display *dp, png_byte opt, const char *entry_name)
* searched entry or the start of the dp->curr buffer if there is nothing
* on the stack yet (sp == 0).
*/
const int offset = set_opt_string_(dp, sp, opt, entry_name);
int offset = set_opt_string_(dp, sp, opt, entry_name);
if (sp > 0)
dp->stack[sp-1].opt_string_end = offset;
@ -1222,7 +1222,7 @@ advance_opt(struct display *dp, png_byte opt, int search)
}
static int
getallopts_(struct display *dp, const png_byte opt, int *value, int record)
getallopts_(struct display *dp, png_byte opt, int *value, int record)
/* Like getop but iterate over all the values if the option was set to "all".
*/
{
@ -1259,7 +1259,7 @@ getsearchopts(struct display *dp, const char *opt_str, int *value)
/* As above except that if the option was not set try a search */
{
png_byte istrat;
const png_byte opt = option_index(dp, opt_str, strlen(opt_str));
png_byte opt = option_index(dp, opt_str, strlen(opt_str));
int record = options[opt].search;
const char *entry_name;
@ -1725,7 +1725,7 @@ display_start_read(struct display *dp, const char *filename)
}
static void PNGCBAPI
read_function(png_structp pp, png_bytep data, png_size_t size)
read_function(png_structp pp, png_bytep data, size_t size)
{
struct display *dp = get_dp(pp);
@ -1881,7 +1881,7 @@ display_start_write(struct display *dp, const char *filename)
}
static void PNGCBAPI
write_function(png_structp pp, png_bytep data, png_size_t size)
write_function(png_structp pp, png_bytep data, size_t size)
{
struct display *dp = get_dp(pp);
@ -2117,7 +2117,7 @@ better_options(const struct display *dp)
*
* This function looks through the stack from the bottom up looking for an
* option that does not match the current best value. When it finds one it
* checks to see if it is more or less desireable and returns true or false
* checks to see if it is more or less desirable and returns true or false
* as appropriate.
*
* Notice that this means that the order options are pushed onto the stack
@ -2220,7 +2220,7 @@ cp_one_file(struct display *dp, const char *filename, const char *destname)
strcpy(dp->best, dp->curr);
dp->best_size = dp->write_size;
if (dp->nsp > 0) /* interating over lists */
if (dp->nsp > 0) /* iterating over lists */
{
char *tmpname, tmpbuf[(sizeof dp->namebuf) + 4];
assert(dp->curr[0] == ' ' && dp->tsp > 0);
@ -2302,7 +2302,7 @@ cppng(struct display *dp, const char *file, const char *gv dest)
}
int
main(const int argc, const char * const * const argv)
main(int argc, char **argv)
{
/* For each file on the command line test it with a range of transforms */
int option_end;
@ -2379,7 +2379,7 @@ main(const int argc, const char * const * const argv)
/* Here on any return, including failures, except user/internal issues
*/
{
const int pass = (d.options & STRICT) ?
int pass = (d.options & STRICT) ?
RESULT_STRICT(d.results) : RESULT_RELAXED(d.results);
if (!pass)

View File

@ -772,7 +772,7 @@ skip_chunk_type(const struct global *global, png_uint_32 type)
return 0;
/* Chunks that specify gamma encoding which should therefore only be
* removed the the user insists:
* removed if the user insists:
*/
case png_gAMA: case png_sRGB:
if (global->skip >= SKIP_ALL)
@ -2363,7 +2363,7 @@ zlib_advance(struct zlib *zlib, png_uint_32 nbytes)
flush = Z_NO_FLUSH;
out_bytes = 0;
/* NOTE: expression 3 is only evaluted on 'continue', because of the
/* NOTE: expression 3 is only evaluated on 'continue', because of the
* 'break' at the end of this loop below.
*/
for (;endrc == ZLIB_OK;
@ -2514,7 +2514,7 @@ zlib_run(struct zlib *zlib)
*/
for (;;)
{
const unsigned int count = list->count;
unsigned int count = list->count;
unsigned int i;
for (i = 0; i<count; ++i)
@ -2664,7 +2664,7 @@ zlib_check(struct file *file, png_uint_32 offset)
* this case, so do the optimization anyway.
*/
if (zlib.cksum)
chunk_message(zlib.chunk, "zlib checkum");
chunk_message(zlib.chunk, "zlib checksum");
break;
@ -2791,7 +2791,7 @@ process_chunk(struct file *file, png_uint_32 file_crc, png_uint_32 next_length,
* to read_chunk.
*/
{
const png_uint_32 type = file->type;
png_uint_32 type = file->type;
if (file->global->verbose > 1)
{
@ -3152,7 +3152,7 @@ read_chunk(struct file *file)
}
}
/* Control gets to here if the the stream seems invalid or damaged in some
/* Control gets to here if the stream seems invalid or damaged in some
* way. Either there was a problem reading all the expected data (this
* chunk's data, its CRC and the length and type of the next chunk) or the
* next chunk length/type are invalid. Notice that the cases that end up
@ -3678,7 +3678,7 @@ usage(const char *prog)
size_t i;
static const char *usage_string[] = {
" Tests, optimizes and optionally fixes the zlib header in PNG files.",
" Optionally, when fixing, strips ancilliary chunks from the file.",
" Optionally, when fixing, strips ancillary chunks from the file.",
0,
"OPTIONS",
" OPERATION",
@ -3710,7 +3710,7 @@ usage(const char *prog)
" practice most programs will ignore it.",
" bKGD [transform]: This is used by libpng transforms."
" --max=<number>:",
" Use IDAT chunks sized <number>. If no number is given the the IDAT",
" Use IDAT chunks sized <number>. If no number is given the IDAT",
" chunks will be the maximum size permitted; 2^31-1 bytes. If the option",
" is omitted the original chunk sizes will not be changed. When the",
" option is given --strip=unsafe is set automatically. This may be",

View File

@ -410,15 +410,14 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
#ifndef PNG_STDIO_SUPPORTED
static void
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
png_read_data(png_structp png_ptr, png_bytep data, size_t length)
{
png_size_t check;
size_t check;
/* 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 size_t
* instead of an int, which is what fread() actually returns.
*/
check = (png_size_t)fread(data, (png_size_t)1, length,
(FILE *)png_ptr->io_ptr);
check = fread(data, 1, length, (FILE *)png_ptr->io_ptr);
if (check != length)
{
@ -427,7 +426,7 @@ png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
}
static void
png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
png_write_data(png_structp png_ptr, png_bytep data, size_t length)
{
png_uint_32 check;

View File

@ -23,8 +23,8 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
int iWidth, int iHeight, png_color BkgColor);
#ifndef PNG_STDIO_SUPPORTED
static void png_read_data(png_structp png_ptr, png_bytep data, png_size_t length);
static void png_write_data(png_structp png_ptr, png_bytep data, png_size_t length);
static void png_read_data(png_structp png_ptr, png_bytep data, size_t length);
static void png_write_data(png_structp png_ptr, png_bytep data, size_t length);
static void png_flush(png_structp png_ptr);
#endif

View File

@ -716,7 +716,7 @@ BOOL DisplayImage (HWND hwnd, BYTE **ppDib,
png_color bkgGray = {127, 127, 127};
png_color bkgWhite = {255, 255, 255};
/* allocate memory for the Device Independant bitmap */
/* allocate memory for the Device Independent bitmap */
wDIRowBytes = (WORD) ((3 * cxWinSize + 3L) >> 2) << 2;

View File

@ -1,9 +1,9 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2013-05-30.07; # UTC
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -16,7 +16,7 @@ scriptversion=2013-05-30.07; # UTC
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@ -783,9 +783,9 @@ exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

View File

@ -2,18 +2,20 @@
#if 0 /* in case someone actually tries to compile this */
/* example.c - an example of using libpng
* Last changed in libpng 1.6.24 [August 4, 2016]
*
* Maintained 2018 Cosmin Truta
* Maintained 1998-2016 Glenn Randers-Pehrson
* Maintained 1996, 1997 Andreas Dilger)
* Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* Maintained 1996-1997 Andreas Dilger
* Written 1995-1996 Guy Eric Schalnat, Group 42, Inc.
*
* To the extent possible under law, the authors have waived
* all copyright and related or neighboring rights to this file.
* This work is published from: United States.
* This work is published from: United States, Canada.
*/
/* This is an example of how to use libpng to read and write PNG files.
* 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
* 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
* implementation. This is not officially part of libpng, is hereby placed
* in the public domain, and therefore does not require a copyright notice.
*
@ -24,16 +26,17 @@
* see also the programs in the contrib directory.
*/
/* The simple, but restricted, approach to reading a PNG file or data stream
* just requires two function calls, as in the following complete program.
* Writing a file just needs one function call, so long as the data has an
/* The simple, but restricted approach to reading a PNG file or data stream
* requires just two function calls, as in the following complete program.
* Writing a file needs just one function call, so long as the data has an
* appropriate layout.
*
* The following code reads PNG image data from a file and writes it, in a
* potentially new format, to a new file. While this code will compile there is
* minimal (insufficient) error checking; for a more realistic version look at
* contrib/examples/pngtopng.c
* potentially new format, to a new file. While this code will compile, there
* is minimal (insufficient) error checking. For a more realistic version,
* see contrib/examples/pngtopng.c
*/
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
@ -68,28 +71,28 @@ int main(int argc, const char **argv)
*/
buffer = malloc(PNG_IMAGE_SIZE(image));
/* If enough memory was available read the image in the desired format
* then write the result out to the new file. 'background' is not
* necessary when reading the image because the alpha channel is
/* If enough memory was available, read the image in the desired
* format, then write the result out to the new file. 'background' is
* not necessary when reading the image, because the alpha channel is
* preserved; if it were to be removed, for example if we requested
* PNG_FORMAT_RGB, then either a solid background color would have to
* be supplied or the output buffer would have to be initialized to the
* actual background of the image.
* be supplied, or the output buffer would have to be initialized to
* the actual background of the image.
*
* The fourth argument to png_image_finish_read is the 'row_stride' -
* this is the number of components allocated for the image in each
* row. It has to be at least as big as the value returned by
* PNG_IMAGE_ROW_STRIDE, but if you just allocate space for the
* default, minimum, size using PNG_IMAGE_SIZE as above you can pass
* default, minimum size, using PNG_IMAGE_SIZE as above, you can pass
* zero.
*
* The final argument is a pointer to a buffer for the colormap;
* colormaps have exactly the same format as a row of image pixels (so
* you choose what format to make the colormap by setting
* colormaps have exactly the same format as a row of image pixels
* (so you choose what format to make the colormap by setting
* image.format). A colormap is only returned if
* PNG_FORMAT_FLAG_COLORMAP is also set in image.format, so in this
* case NULL is passed as the final argument. If you do want to force
* all images into an index/color-mapped format then you can use:
* all images into an index/color-mapped format, then you can use:
*
* PNG_IMAGE_COLORMAP_SIZE(image)
*
@ -111,17 +114,15 @@ int main(int argc, const char **argv)
exit(0);
}
}
else
{
/* Calling png_image_free is optional unless the simplified API was
* not run to completion. In this case if there wasn't enough
* memory for 'buffer' we didn't complete the read, so we must free
* the image:
* not run to completion. In this case, if there wasn't enough
* memory for 'buffer', we didn't complete the read, so we must
* free the image:
*/
if (buffer == NULL)
png_image_free(&image);
else
free(buffer);
}
@ -130,65 +131,67 @@ int main(int argc, const char **argv)
* textual message in the 'png_image' structure:
*/
fprintf(stderr, "pngtopng: error: %s\n", image.message);
exit (1);
exit(1);
}
fprintf(stderr, "pngtopng: usage: pngtopng input-file output-file\n");
exit(1);
exit(2);
}
/* That's it ;-) Of course you probably want to do more with PNG files than
* just converting them all to 32-bit RGBA PNG files; you can do that between
* the call to png_image_finish_read and png_image_write_to_file. You can also
* ask for the image data to be presented in a number of different formats. You
* do this by simply changing the 'format' parameter set before allocating the
* buffer.
* ask for the image data to be presented in a number of different formats.
* You do this by simply changing the 'format' parameter set before allocating
* the buffer.
*
* The format parameter consists of five flags that define various aspects of
* the image, you can simply add these together to get the format or you can use
* one of the predefined macros from png.h (as above):
* the image. You can simply add these together to get the format, or you can
* use one of the predefined macros from png.h (as above):
*
* PNG_FORMAT_FLAG_COLOR: if set the image will have three color components per
* pixel (red, green and blue), if not set the image will just have one
* PNG_FORMAT_FLAG_COLOR: if set, the image will have three color components
* per pixel (red, green and blue); if not set, the image will just have one
* luminance (grayscale) component.
*
* PNG_FORMAT_FLAG_ALPHA: if set each pixel in the image will have an additional
* alpha value; a linear value that describes the degree the image pixel
* covers (overwrites) the contents of the existing pixel on the display.
* PNG_FORMAT_FLAG_ALPHA: if set, each pixel in the image will have an
* additional alpha value; a linear value that describes the degree the
* image pixel covers (overwrites) the contents of the existing pixel on the
* display.
*
* PNG_FORMAT_FLAG_LINEAR: if set the components of each pixel will be returned
* as a series of 16-bit linear values, if not set the components will be
* returned as a series of 8-bit values encoded according to the 'sRGB'
* standard. The 8-bit format is the normal format for images intended for
* direct display, because almost all display devices do the inverse of the
* sRGB transformation to the data they receive. The 16-bit format is more
* common for scientific data and image data that must be further processed;
* because it is linear simple math can be done on the component values.
* Regardless of the setting of this flag the alpha channel is always linear,
* although it will be 8 bits or 16 bits wide as specified by the flag.
* PNG_FORMAT_FLAG_LINEAR: if set, the components of each pixel will be
* returned as a series of 16-bit linear values; if not set, the components
* will be returned as a series of 8-bit values encoded according to the
* sRGB standard. The 8-bit format is the normal format for images intended
* for direct display, because almost all display devices do the inverse of
* the sRGB transformation to the data they receive. The 16-bit format is
* more common for scientific data and image data that must be further
* processed; because it is linear, simple math can be done on the component
* values. Regardless of the setting of this flag, the alpha channel is
* always linear, although it will be 8 bits or 16 bits wide as specified by
* the flag.
*
* PNG_FORMAT_FLAG_BGR: if set the components of a color pixel will be returned
* in the order blue, then green, then red. If not set the pixel components
* are in the order red, then green, then blue.
* PNG_FORMAT_FLAG_BGR: if set, the components of a color pixel will be
* returned in the order blue, then green, then red. If not set, the pixel
* components are in the order red, then green, then blue.
*
* PNG_FORMAT_FLAG_AFIRST: if set the alpha channel (if present) precedes the
* color or grayscale components. If not set the alpha channel follows the
* PNG_FORMAT_FLAG_AFIRST: if set, the alpha channel (if present) precedes the
* color or grayscale components. If not set, the alpha channel follows the
* components.
*
* You do not have to read directly from a file. You can read from memory or,
* on systems that support it, from a <stdio.h> FILE*. This is controlled by
* the particular png_image_read_from_ function you call at the start. Likewise
* on write you can write to a FILE* if your system supports it. Check the
* macro PNG_STDIO_SUPPORTED to see if stdio support has been included in your
* libpng build.
* the particular png_image_read_from_ function you call at the start.
* Likewise, on write, you can write to a FILE* if your system supports it.
* Check the macro PNG_STDIO_SUPPORTED to see if stdio support has been
* included in your libpng build.
*
* If you read 16-bit (PNG_FORMAT_FLAG_LINEAR) data you may need to write it in
* the 8-bit format for display. You do this by setting the convert_to_8bit
* If you read 16-bit (PNG_FORMAT_FLAG_LINEAR) data, you may need to write it
* in the 8-bit format for display. You do this by setting the convert_to_8bit
* flag to 'true'.
*
* Don't repeatedly convert between the 8-bit and 16-bit forms. There is
* significant data loss when 16-bit data is converted to the 8-bit encoding and
* the current libpng implementation of conversion to 16-bit is also
* significant data loss when 16-bit data is converted to the 8-bit encoding,
* and the current libpng implementation of conversion to 16-bit is also
* significantly lossy. The latter will be fixed in the future, but the former
* is unavoidable - the 8-bit format just doesn't have enough resolution.
*/
@ -199,10 +202,10 @@ int main(int argc, const char **argv)
* interfaces.
*
* All these interfaces require that you do your own error handling - your
* program must be able to arrange for control to return to your own code any
* time libpng encounters a problem. There are several ways to do this, but the
* standard way is to use the ANSI-C (C90) <setjmp.h> interface to establish a
* return point within your own code. You must do this if you do not use the
* program must be able to arrange for control to return to your own code, any
* time libpng encounters a problem. There are several ways to do this, but
* the standard way is to use the <setjmp.h> interface to establish a return
* point within your own code. You must do this if you do not use the
* simplified interface (above).
*
* The first step is to include the header files you need, including the libpng
@ -214,7 +217,7 @@ int main(int argc, const char **argv)
/* The png_jmpbuf() macro, used in error handling, became available in
* libpng version 1.0.6. If you want to be able to run your code with older
* versions of libpng, you must define the macro yourself (but only if it
* is not already defined by libpng!).
* is not already defined by libpng!)
*/
#ifndef png_jmpbuf
@ -222,10 +225,10 @@ int main(int argc, const char **argv)
#endif
/* Check to see if a file is a PNG file using png_sig_cmp(). png_sig_cmp()
* returns zero if the image is a PNG and nonzero if it isn't a PNG.
* returns zero if the image is a PNG, and nonzero otherwise.
*
* The function check_if_png() shown here, but not used, returns nonzero (true)
* if the file can be opened and is a PNG, 0 (false) otherwise.
* if the file can be opened and is a PNG, and 0 (false) otherwise.
*
* If this call is successful, and you are going to keep the file open,
* you should call png_set_sig_bytes(png_ptr, PNG_BYTES_TO_CHECK); once
@ -238,7 +241,7 @@ int main(int argc, const char **argv)
*
* Many applications already read the first 2 or 4 bytes from the start
* of the image to determine the file type, so it would be easiest just
* to pass the bytes to png_sig_cmp() or even skip that if you know
* to pass the bytes to png_sig_cmp(), or even skip that if you know
* you have a PNG file, and call png_set_sig_bytes().
*/
#define PNG_BYTES_TO_CHECK 4
@ -250,14 +253,14 @@ int check_if_png(char *file_name, FILE **fp)
if ((*fp = fopen(file_name, "rb")) == NULL)
return 0;
/* Read in some of the signature bytes */
/* Read in some of the signature bytes. */
if (fread(buf, 1, PNG_BYTES_TO_CHECK, *fp) != PNG_BYTES_TO_CHECK)
return 0;
/* Compare the first PNG_BYTES_TO_CHECK bytes of the signature.
Return nonzero (true) if they match */
return(!png_sig_cmp(buf, (png_size_t)0, PNG_BYTES_TO_CHECK));
* Return nonzero (true) if they match.
*/
return(!png_sig_cmp(buf, 0, PNG_BYTES_TO_CHECK));
}
/* Read a PNG file. You may want to return an error code if the read
@ -267,7 +270,7 @@ int check_if_png(char *file_name, FILE **fp)
* some or all of the magic bytes read - see comments above).
*/
#ifdef open_file /* prototype 1 */
void read_png(char *file_name) /* We need to open the file */
void read_png(char *file_name) /* We need to open the file */
{
png_structp png_ptr;
png_infop info_ptr;
@ -280,7 +283,7 @@ void read_png(char *file_name) /* We need to open the file */
return (ERROR);
#else no_open_file /* prototype 2 */
void read_png(FILE *fp, int sig_read) /* File is already open */
void read_png(FILE *fp, int sig_read) /* File is already open */
{
png_structp png_ptr;
png_infop info_ptr;
@ -292,7 +295,7 @@ void read_png(FILE *fp, int sig_read) /* File is already open */
* functions. If you want to use the default stderr and longjump method,
* you can supply NULL for the last three parameters. We also supply the
* the compiler header file version, so that we know if the application
* was compiled with a compatible version of the library. REQUIRED
* was compiled with a compatible version of the library. REQUIRED.
*/
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
png_voidp user_error_ptr, user_error_fn, user_warning_fn);
@ -316,35 +319,33 @@ void read_png(FILE *fp, int sig_read) /* File is already open */
* the normal method of doing things with libpng). REQUIRED unless you
* set up your own error handlers in the png_create_read_struct() earlier.
*/
if (setjmp(png_jmpbuf(png_ptr)))
{
/* Free all of the memory associated with the png_ptr and info_ptr */
/* Free all of the memory associated with the png_ptr and info_ptr. */
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
fclose(fp);
/* If we get here, we had a problem reading the file */
/* If we get here, we had a problem reading the file. */
return (ERROR);
}
/* One of the following I/O initialization methods is REQUIRED */
/* One of the following I/O initialization methods is REQUIRED. */
#ifdef streams /* PNG file I/O method 1 */
/* Set up the input control if you are using standard C streams */
/* Set up the input control if you are using standard C streams. */
png_init_io(png_ptr, fp);
#else no_streams /* PNG file I/O method 2 */
/* If you are using replacement read functions, instead of calling
* png_init_io() here you would call:
* png_init_io(), you would call:
*/
png_set_read_fn(png_ptr, (void *)user_io_ptr, user_read_fn);
/* where user_io_ptr is a structure you want available to the callbacks */
/* where user_io_ptr is a structure you want available to the callbacks. */
#endif no_streams /* Use only one I/O method! */
/* If we have already read some of the signature */
png_set_sig_bytes(png_ptr, sig_read);
#ifdef hilevel
/*
* 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
* with one of the PNG_TRANSFORM_* bits (this presently excludes
* quantizing, filling, setting background, and doing gamma
@ -354,10 +355,10 @@ void read_png(FILE *fp, int sig_read) /* File is already open */
png_read_png(png_ptr, info_ptr, png_transforms, NULL);
#else
/* OK, you're doing it the hard way, with the lower-level functions */
/* OK, you're doing it the hard way, with the lower-level functions. */
/* The call to png_read_info() gives us all of the information from the
* PNG file before the first IDAT (image data chunk). REQUIRED
* PNG file before the first IDAT (image data chunk). REQUIRED.
*/
png_read_info(png_ptr, info_ptr);
@ -385,20 +386,21 @@ void read_png(FILE *fp, int sig_read) /* File is already open */
*/
png_set_strip_alpha(png_ptr);
/* Extract multiple pixels with bit depths of 1, 2, and 4 from a single
/* Extract multiple pixels with bit depths of 1, 2 or 4 from a single
* byte into separate bytes (useful for paletted and grayscale images).
*/
png_set_packing(png_ptr);
/* Change the order of packed pixels to least significant bit first
* (not useful if you are using png_set_packing). */
* (not useful if you are using png_set_packing).
*/
png_set_packswap(png_ptr);
/* Expand paletted colors into true RGB triplets */
/* Expand paletted colors into true RGB triplets. */
if (color_type == PNG_COLOR_TYPE_PALETTE)
png_set_palette_to_rgb(png_ptr);
/* Expand grayscale images to the full 8 bits from 1, 2, or 4 bits/pixel */
/* Expand grayscale images to the full 8 bits from 1, 2 or 4 bits/pixel. */
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
png_set_expand_gray_1_2_4_to_8(png_ptr);
@ -409,12 +411,11 @@ void read_png(FILE *fp, int sig_read) /* File is already open */
png_set_tRNS_to_alpha(png_ptr);
/* Set the background color to draw transparent and alpha images over.
* It is possible to set the red, green, and blue components directly
* for paletted images instead of supplying a palette index. Note that
* It is possible to set the red, green and blue components directly
* for paletted images, instead of supplying a palette index. Note that,
* even if the PNG file supplies a background, you are not required to
* use it - you should use the (solid) application background if it has one.
*/
png_color_16 my_background, *image_background;
if (png_get_bKGD(png_ptr, info_ptr, &image_background) != 0)
@ -424,32 +425,29 @@ void read_png(FILE *fp, int sig_read) /* File is already open */
png_set_background(png_ptr, &my_background,
PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
/* Some suggestions as to how to get a screen gamma value
/* Some suggestions as to how to get a screen gamma value.
*
* Note that screen gamma is the display_exponent, which includes
* the CRT_exponent and any correction for viewing conditions
* the CRT_exponent and any correction for viewing conditions.
*/
if (/* We have a user-defined screen gamma value */)
{
screen_gamma = user-defined screen_gamma;
}
/* This is one way that applications share the same screen gamma value */
/* This is one way that applications share the same screen gamma value. */
else if ((gamma_str = getenv("SCREEN_GAMMA")) != NULL)
{
screen_gamma = atof(gamma_str);
}
/* If we don't have another value */
else
{
screen_gamma = PNG_DEFAULT_sRGB; /* A good guess for a PC monitor
in a dimly lit room */
screen_gamma = PNG_GAMMA_MAC_18 or 1.0; /* Good guesses for Mac systems */
screen_gamma = PNG_DEFAULT_sRGB; /* A good guess for a PC monitor
in a dimly lit room */
screen_gamma = PNG_GAMMA_MAC_18 or 1.0; /* Good guesses for Mac
systems */
}
/* Tell libpng to handle the gamma conversion for you. The final call
* is a good guess for PC generated images, but it should be configurable
* by the user at run time by the user. It is strongly suggested that
* your application support gamma correction.
* by the user at run time. Gamma correction support in your application
* is strongly recommended.
*/
int intent;
@ -466,7 +464,7 @@ void read_png(FILE *fp, int sig_read) /* File is already open */
}
#ifdef PNG_READ_QUANTIZE_SUPPORTED
/* Quantize RGB files down to 8-bit palette or reduce palettes
/* Quantize RGB files down to 8-bit palette, or reduce palettes
* to the number of colors available on your screen.
*/
if ((color_type & PNG_COLOR_MASK_COLOR) != 0)
@ -474,29 +472,26 @@ void read_png(FILE *fp, int sig_read) /* File is already open */
int num_palette;
png_colorp palette;
/* This reduces the image to the application supplied palette */
/* This reduces the image to the application-supplied palette. */
if (/* We have our own palette */)
{
/* An array of colors to which the image should be quantized */
/* An array of colors to which the image should be quantized. */
png_color std_color_cube[MAX_SCREEN_COLORS];
png_set_quantize(png_ptr, std_color_cube, MAX_SCREEN_COLORS,
MAX_SCREEN_COLORS, NULL, 0);
}
/* This reduces the image to the palette supplied in the file */
/* This reduces the image to the palette supplied in the file. */
else if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette) != 0)
{
png_uint_16p histogram = NULL;
png_get_hIST(png_ptr, info_ptr, &histogram);
png_set_quantize(png_ptr, palette, num_palette,
max_screen_colors, histogram, 0);
}
}
#endif /* READ_QUANTIZE */
/* 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);
/* If you want to shift the pixel values from the range [0,255] or
@ -506,22 +501,21 @@ void read_png(FILE *fp, int sig_read) /* File is already open */
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT) != 0)
{
png_color_8p sig_bit_p;
png_get_sBIT(png_ptr, info_ptr, &sig_bit_p);
png_set_shift(png_ptr, sig_bit_p);
}
/* Flip the RGB pixels to BGR (or RGBA to BGRA) */
/* Flip the RGB pixels to BGR (or RGBA to BGRA). */
if ((color_type & PNG_COLOR_MASK_COLOR) != 0)
png_set_bgr(png_ptr);
/* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */
/* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR). */
png_set_swap_alpha(png_ptr);
/* Swap bytes of 16-bit files to least significant byte first */
/* Swap bytes of 16-bit files to least significant byte first. */
png_set_swap(png_ptr);
/* Add filler (or alpha) byte (before/after each RGB triplet) */
/* Add filler (or alpha) byte (before/after each RGB triplet). */
png_set_filler(png_ptr, 0xffff, PNG_FILLER_AFTER);
#ifdef PNG_READ_INTERLACING_SUPPORTED
@ -534,40 +528,31 @@ void read_png(FILE *fp, int sig_read) /* File is already open */
number_passes = 1;
#endif /* READ_INTERLACING */
/* Optional call to gamma correct and add the background to the palette
* and update info structure. REQUIRED if you are expecting libpng to
* update the palette for you (ie you selected such a transform above).
* update the palette for you (i.e. you selected such a transform above).
*/
png_read_update_info(png_ptr, info_ptr);
/* Allocate the memory to hold the image using the fields of info_ptr. */
/* The easiest way to read the image: */
png_bytep row_pointers[height];
/* Clear the pointer array */
for (row = 0; row < height; row++)
row_pointers[row] = NULL;
row_pointers[row] = NULL; /* Clear the pointer array */
for (row = 0; row < height; row++)
row_pointers[row] = png_malloc(png_ptr, png_get_rowbytes(png_ptr,
info_ptr));
/* Now it's time to read the image. One of these methods is REQUIRED */
/* Now it's time to read the image. One of these methods is REQUIRED. */
#ifdef entire /* Read the entire image in one go */
png_read_image(png_ptr, row_pointers);
#else no_entire /* Read the image one or more scanlines at a time */
/* The other way to read images - deal with interlacing: */
for (pass = 0; pass < number_passes; pass++)
{
#ifdef single /* Read the image a single row at a time */
for (y = 0; y < height; y++)
{
png_read_rows(png_ptr, &row_pointers[y], NULL, 1);
}
#else no_single /* Read the image several rows at a time */
for (y = 0; y < height; y += number_of_rows)
@ -581,24 +566,24 @@ void read_png(FILE *fp, int sig_read) /* File is already open */
#endif no_sparkle /* Use only one of these two methods */
}
/* If you want to display the image after every pass, do so here */
/* If you want to display the image after every pass, do so here. */
#endif no_single /* Use only one of these two methods */
}
#endif no_entire /* Use only one of these two methods */
/* Read rest of file, and get additional chunks in info_ptr - REQUIRED */
/* Read rest of file, and get additional chunks in info_ptr. REQUIRED. */
png_read_end(png_ptr, info_ptr);
#endif hilevel
/* At this point you have read the entire image */
/* At this point you have read the entire image. */
/* Clean up after the read, and free any memory allocated - REQUIRED */
/* Clean up after the read, and free any memory allocated. REQUIRED. */
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
/* Close the file */
/* Close the file. */
fclose(fp);
/* That's it */
/* That's it! */
return (OK);
}
@ -610,34 +595,30 @@ initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr)
/* Create and initialize the png_struct with the desired error handler
* functions. If you want to use the default stderr and longjump method,
* you can supply NULL for the last three parameters. We also check that
* the library version is compatible in case we are using dynamically
* the library version is compatible, in case we are using dynamically
* linked libraries.
*/
*png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
png_voidp user_error_ptr, user_error_fn, user_warning_fn);
if (*png_ptr == NULL)
{
*info_ptr = NULL;
return (ERROR);
}
*info_ptr = png_create_info_struct(png_ptr);
if (*info_ptr == NULL)
{
png_destroy_read_struct(png_ptr, info_ptr, NULL);
return (ERROR);
}
if (setjmp(png_jmpbuf((*png_ptr))))
{
png_destroy_read_struct(png_ptr, info_ptr, NULL);
return (ERROR);
}
/* This one's new. You will need to provide all three
* function callbacks, even if you aren't using them all.
/* You will need to provide all three function callbacks,
* even if you aren't using all of them.
* If you aren't using all functions, you can specify NULL
* parameters. Even when all three functions are NULL,
* you need to call png_set_progressive_read_fn().
@ -650,7 +631,6 @@ initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr)
*/
png_set_progressive_read_fn(*png_ptr, (void *)stream_data,
info_callback, row_callback, end_callback);
return (OK);
}
@ -660,18 +640,18 @@ process_data(png_structp *png_ptr, png_infop *info_ptr,
{
if (setjmp(png_jmpbuf((*png_ptr))))
{
/* Free the png_ptr and info_ptr memory on error */
/* Free the png_ptr and info_ptr memory on error. */
png_destroy_read_struct(png_ptr, info_ptr, NULL);
return (ERROR);
}
/* This one's new also. Simply give it chunks of data as
* they arrive from the data stream (in order, of course).
/* Give chunks of data as they arrive from the data stream
* (in order, of course).
* On segmented machines, don't give it any more than 64K.
* The library seems to run fine with sizes of 4K, although
* you can give it much less if necessary (I assume you can
* you can give it much less if necessary. (I assume you can
* give it chunks of 1 byte, but I haven't tried with less
* than 256 bytes yet). When this function returns, you may
* than 256 bytes yet.) When this function returns, you may
* want to display any rows that were generated in the row
* callback, if you aren't already displaying them there.
*/
@ -693,8 +673,7 @@ info_callback(png_structp png_ptr, png_infop info)
row_callback(png_structp png_ptr, png_bytep new_row,
png_uint_32 row_num, int pass)
{
/*
* This function is called for every row in the image. If the
/* This function is called for every row in the image. If the
* image is interlaced, and you turned on the interlace handler,
* this function will be called for every row in every pass.
*
@ -705,25 +684,22 @@ row_callback(png_structp png_ptr, png_bytep new_row,
* The new row data pointer "new_row" may be NULL, indicating there is
* no new data to be replaced (in cases of interlace loading).
*
* If new_row is not NULL then you need to call
* png_progressive_combine_row() to replace the corresponding row as
* If new_row is not NULL, then you need to call
* png_progressive_combine_row(), to replace the corresponding row as
* shown below:
*/
/* Get pointer to corresponding row in our
* PNG read buffer.
*/
/* Get pointer to corresponding row in our PNG read buffer. */
png_bytep old_row = ((png_bytep *)our_data)[row_num];
#ifdef PNG_READ_INTERLACING_SUPPORTED
/* If both rows are allocated then copy the new row
/* If both rows are allocated, then copy the new row
* data to the corresponding row data.
*/
if ((old_row != NULL) && (new_row != NULL))
png_progressive_combine_row(png_ptr, old_row, new_row);
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
* may make your life easier.
*
@ -734,7 +710,6 @@ row_callback(png_structp png_ptr, png_bytep new_row,
* (it just does the memcpy for you) if it will make the code
* easier. Thus, you can just do this for all cases:
*/
png_progressive_combine_row(png_ptr, old_row, new_row);
/* where old_row is what was displayed for previous rows. Note
@ -781,14 +756,13 @@ void write_png(char *file_name /* , ... other image information ... */)
*/
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,
png_voidp user_error_ptr, user_error_fn, user_warning_fn);
if (png_ptr == NULL)
{
fclose(fp);
return (ERROR);
}
/* Allocate/initialize the image information data. REQUIRED */
/* Allocate/initialize the image information data. REQUIRED. */
info_ptr = png_create_info_struct(png_ptr);
if (info_ptr == NULL)
{
@ -797,30 +771,30 @@ void write_png(char *file_name /* , ... other image information ... */)
return (ERROR);
}
/* Set error handling. REQUIRED if you aren't supplying your own
/* Set up error handling. REQUIRED if you aren't supplying your own
* error handling functions in the png_create_write_struct() call.
*/
if (setjmp(png_jmpbuf(png_ptr)))
{
/* If we get here, we had a problem writing the file */
/* If we get here, we had a problem writing the file. */
fclose(fp);
png_destroy_write_struct(&png_ptr, &info_ptr);
return (ERROR);
}
/* One of the following I/O initialization functions is REQUIRED */
/* One of the following I/O initialization functions is REQUIRED. */
#ifdef streams /* I/O initialization method 1 */
/* Set up the output control if you are using standard C streams */
/* Set up the output control if you are using standard C streams. */
png_init_io(png_ptr, fp);
#else no_streams /* I/O initialization method 2 */
/* If you are using replacement write functions, instead of calling
* png_init_io() here you would call
* png_init_io(), you would call:
*/
png_set_write_fn(png_ptr, (void *)user_io_ptr, user_write_fn,
user_IO_flush_function);
/* where user_io_ptr is a structure you want available to the callbacks */
/* where user_io_ptr is a structure you want available to the callbacks. */
#endif no_streams /* Only use one initialization method */
#ifdef hilevel
@ -831,30 +805,32 @@ void write_png(char *file_name /* , ... other image information ... */)
png_write_png(png_ptr, info_ptr, png_transforms, NULL);
#else
/* This is the hard way */
/* This is the hard way. */
/* Set the image information here. Width and height are up to 2^31,
* bit_depth is one of 1, 2, 4, 8, or 16, but valid values also depend on
* the color_type selected. color_type is one of PNG_COLOR_TYPE_GRAY,
* bit_depth is one of 1, 2, 4, 8 or 16, but valid values also depend on
* the color_type selected. color_type is one of PNG_COLOR_TYPE_GRAY,
* PNG_COLOR_TYPE_GRAY_ALPHA, PNG_COLOR_TYPE_PALETTE, PNG_COLOR_TYPE_RGB,
* or PNG_COLOR_TYPE_RGB_ALPHA. interlace is either PNG_INTERLACE_NONE or
* PNG_INTERLACE_ADAM7, and the compression_type and filter_type MUST
* currently be PNG_COMPRESSION_TYPE_BASE and PNG_FILTER_TYPE_BASE. REQUIRED
* currently be PNG_COMPRESSION_TYPE_BASE and PNG_FILTER_TYPE_BASE.
* REQUIRED.
*/
png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, PNG_COLOR_TYPE_???,
PNG_INTERLACE_????, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth,
PNG_COLOR_TYPE_???, PNG_INTERLACE_????,
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
/* Set the palette if there is one. REQUIRED for indexed-color images */
palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH
* (sizeof (png_color)));
/* Set the palette if there is one. REQUIRED for indexed-color images. */
palette = (png_colorp)png_malloc(png_ptr,
PNG_MAX_PALETTE_LENGTH * (sizeof (png_color)));
/* ... Set palette colors ... */
png_set_PLTE(png_ptr, info_ptr, palette, PNG_MAX_PALETTE_LENGTH);
/* You must not free palette here, because png_set_PLTE only makes a link to
* the palette that you malloced. Wait until you are about to destroy
/* You must not free palette here, because png_set_PLTE only makes a link
* to the palette that you allocated. Wait until you are about to destroy
* the png structure.
*/
/* Optional significant bit (sBIT) chunk */
/* Optional significant bit (sBIT) chunk. */
png_color_8 sig_bit;
/* If we are dealing with a grayscale image then */
@ -870,18 +846,17 @@ void write_png(char *file_name /* , ... other image information ... */)
png_set_sBIT(png_ptr, info_ptr, &sig_bit);
/* Optional gamma chunk is strongly suggested if you have any guess
* as to the correct gamma of the image.
*/
png_set_gAMA(png_ptr, info_ptr, gamma);
/* Optionally write comments into the image */
/* Optionally write comments into the image. */
{
png_text text_ptr[3];
char key0[]="Title";
char text0[]="Mona Lisa";
char key0[] = "Title";
char text0[] = "Mona Lisa";
text_ptr[0].key = key0;
text_ptr[0].text = text0;
text_ptr[0].compression = PNG_TEXT_COMPRESSION_NONE;
@ -889,8 +864,8 @@ void write_png(char *file_name /* , ... other image information ... */)
text_ptr[0].lang = NULL;
text_ptr[0].lang_key = NULL;
char key1[]="Author";
char text1[]="Leonardo DaVinci";
char key1[] = "Author";
char text1[] = "Leonardo DaVinci";
text_ptr[1].key = key1;
text_ptr[1].text = text1;
text_ptr[1].compression = PNG_TEXT_COMPRESSION_NONE;
@ -898,8 +873,8 @@ void write_png(char *file_name /* , ... other image information ... */)
text_ptr[1].lang = NULL;
text_ptr[1].lang_key = NULL;
char key2[]="Description";
char text2[]="<long text>";
char key2[] = "Description";
char text2[] = "<long text>";
text_ptr[2].key = key2;
text_ptr[2].text = text2;
text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt;
@ -910,14 +885,14 @@ void write_png(char *file_name /* , ... other image information ... */)
png_set_text(write_ptr, write_info_ptr, text_ptr, 3);
}
/* Other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs */
/* Other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs. */
/* Note that if sRGB is present the gAMA and cHRM chunks must be ignored
/* Note that if sRGB is present, the gAMA and cHRM chunks must be ignored
* on read and, if your application chooses to write them, they must
* be written in accordance with the sRGB profile
* be written in accordance with the sRGB profile.
*/
/* Write the file header information. REQUIRED */
/* Write the file header information. REQUIRED. */
png_write_info(png_ptr, info_ptr);
/* If you want, you can write the info in two steps, in case you need to
@ -941,7 +916,7 @@ void write_png(char *file_name /* , ... other image information ... */)
* all optional. Only call them if you want them.
*/
/* Invert monochrome pixels */
/* Invert monochrome pixels. */
png_set_invert_mono(png_ptr);
/* Shift the pixels up to a legal bit depth and fill in
@ -949,30 +924,29 @@ void write_png(char *file_name /* , ... other image information ... */)
*/
png_set_shift(png_ptr, &sig_bit);
/* Pack pixels into bytes */
/* Pack pixels into bytes. */
png_set_packing(png_ptr);
/* Swap location of alpha bytes from ARGB to RGBA */
/* Swap location of alpha bytes from ARGB to RGBA. */
png_set_swap_alpha(png_ptr);
/* Get rid of filler (OR ALPHA) bytes, pack XRGB/RGBX/ARGB/RGBA into
* RGB (4 channels -> 3 channels). The second parameter is not used.
* RGB (4 channels -> 3 channels). The second parameter is not used.
*/
png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
/* Flip BGR pixels to RGB */
/* Flip BGR pixels to RGB. */
png_set_bgr(png_ptr);
/* Swap bytes of 16-bit files to most significant byte first */
/* Swap bytes of 16-bit files to most significant byte first. */
png_set_swap(png_ptr);
/* Swap bits of 1-bit, 2-bit, 4-bit packed pixel formats */
/* Swap bits of 1-bit, 2-bit, 4-bit packed pixel formats. */
png_set_packswap(png_ptr);
/* Turn on interlace handling if you are not using png_write_image() */
/* Turn on interlace handling if you are not using png_write_image(). */
if (interlacing != 0)
number_passes = png_set_interlace_handling(png_ptr);
else
number_passes = 1;
@ -982,29 +956,28 @@ void write_png(char *file_name /* , ... other image information ... */)
*/
png_uint_32 k, height, width;
/* In this example, "image" is a one-dimensional array of bytes */
/* In this example, "image" is a one-dimensional array of bytes. */
/* Guard against integer overflow */
if (height > PNG_SIZE_MAX/(width*bytes_per_pixel)) {
png_error(png_ptr, "Image_data buffer would be too large");
}
png_byte image[height*width*bytes_per_pixel];
/* Guard against integer overflow. */
if (height > PNG_SIZE_MAX / (width * bytes_per_pixel))
png_error(png_ptr, "Image data buffer would be too large");
png_byte image[height * width * bytes_per_pixel];
png_bytep row_pointers[height];
if (height > PNG_UINT_32_MAX/(sizeof (png_bytep)))
png_error (png_ptr, "Image is too tall to process in memory");
if (height > PNG_UINT_32_MAX / (sizeof (png_bytep)))
png_error(png_ptr, "Image is too tall to process in memory");
/* Set up pointers into your "image" byte array */
/* Set up pointers into your "image" byte array. */
for (k = 0; k < height; k++)
row_pointers[k] = image + k*width*bytes_per_pixel;
row_pointers[k] = image + k * width * bytes_per_pixel;
/* One of the following output methods is REQUIRED */
/* One of the following output methods is REQUIRED. */
#ifdef entire /* Write out the entire image data in one call */
png_write_image(png_ptr, row_pointers);
/* The other way to write the image - deal with interlacing */
/* The other way to write the image - deal with interlacing. */
#else no_entire /* Write out the image data by one or more scanlines */
@ -1016,27 +989,27 @@ void write_png(char *file_name /* , ... other image information ... */)
/* Write a few rows at a time. */
png_write_rows(png_ptr, &row_pointers[first_row], number_of_rows);
/* If you are only writing one row at a time, this works */
/* If you are only writing one row at a time, this works. */
for (y = 0; y < height; y++)
png_write_rows(png_ptr, &row_pointers[y], 1);
}
#endif no_entire /* Use only one output method */
/* You can write optional chunks like tEXt, zTXt, and tIME at the end
* as well. Shouldn't be necessary in 1.2.0 and up as all the public
* chunks are supported and you can use png_set_unknown_chunks() to
* as well. Shouldn't be necessary in 1.2.0 and up, as all the public
* chunks are supported, and you can use png_set_unknown_chunks() to
* register unknown chunks into the info structure to be written out.
*/
/* It is REQUIRED to call this to finish writing the rest of the file */
/* It is REQUIRED to call this to finish writing the rest of the file. */
png_write_end(png_ptr, info_ptr);
#endif hilevel
/* If you png_malloced a palette, free it here (don't free info_ptr->palette,
* as recommended in versions 1.0.5m and earlier of this example; if
* libpng mallocs info_ptr->palette, libpng will free it). If you
* allocated it with malloc() instead of png_malloc(), use free() instead
* of png_free().
/* If you png_malloced a palette, free it here.
* (Don't free info_ptr->palette, as shown in versions 1.0.5m and earlier of
* this example; if libpng mallocs info_ptr->palette, libpng will free it).
* If you allocated it with malloc() instead of png_malloc(), use free()
* instead of png_free().
*/
png_free(png_ptr, palette);
palette = NULL;
@ -1047,19 +1020,20 @@ void write_png(char *file_name /* , ... other image information ... */)
*/
png_free(png_ptr, trans);
trans = NULL;
/* Whenever you use png_free() it is a good idea to set the pointer to
/* Whenever you use png_free(), it is a good idea to set the pointer to
* NULL in case your application inadvertently tries to png_free() it
* again. When png_free() sees a NULL it returns without action, thus
* avoiding the double-free security problem.
* again. When png_free() sees a NULL it returns without action, avoiding
* the double-free problem.
*/
/* Clean up after the write, and free any memory allocated */
/* Clean up after the write, and free any allocated memory. */
png_destroy_write_struct(&png_ptr, &info_ptr);
/* Close the file */
/* Close the file. */
fclose(fp);
/* That's it */
/* That's it! */
return (OK);
}

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