Compare commits
47 Commits
v1.5.2
...
v1.0.29rc2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39acfab5bc | ||
|
|
43a349ae4a | ||
|
|
02f800dbd6 | ||
|
|
f9d6ce301d | ||
|
|
725c747abe | ||
|
|
3f7bcb635e | ||
|
|
cb15afd5ce | ||
|
|
0e0798b796 | ||
|
|
a41eecbdd4 | ||
|
|
01f17eee9e | ||
|
|
430d11ea06 | ||
|
|
bfb1ddd2c9 | ||
|
|
0a7bbf8697 | ||
|
|
59e559b2a2 | ||
|
|
9bc3a1fdd4 | ||
|
|
14ae6c1d94 | ||
|
|
1719fac606 | ||
|
|
c79c23c0d5 | ||
|
|
918dc976d5 | ||
|
|
928d84e713 | ||
|
|
764b52ad45 | ||
|
|
551892bb60 | ||
|
|
1a2e75ccf1 | ||
|
|
fb088b9cca | ||
|
|
a3a5d7c172 | ||
|
|
295e9df783 | ||
|
|
ef860dab8f | ||
|
|
e696c7205a | ||
|
|
1ff473f3fd | ||
|
|
b88935a8b2 | ||
|
|
64b481e714 | ||
|
|
0f5e1e5a39 | ||
|
|
6fbb54d253 | ||
|
|
fba872492b | ||
|
|
82282113b9 | ||
|
|
a095d92224 | ||
|
|
ff518067c3 | ||
|
|
db576fa76b | ||
|
|
b6c4193528 | ||
|
|
df8fc6680e | ||
|
|
f47b4b1bf7 | ||
|
|
4fc3118b59 | ||
|
|
3bdb7fed6e | ||
|
|
0e928a62e9 | ||
|
|
88f07c8451 | ||
|
|
787081f75b | ||
|
|
80b4f15ae3 |
127
ANNOUNCE
@@ -1,61 +1,110 @@
|
|||||||
|
|
||||||
Libpng 1.5.2 - March 31, 2011
|
Libpng 1.0.29rc2 - September 26, 2007
|
||||||
|
|
||||||
This is a public release of libpng, intended for use in production codes.
|
This is not intended to be a public release. It will be replaced
|
||||||
|
within a few weeks by a public version or by another test version.
|
||||||
|
|
||||||
Files available for download:
|
Files available for download:
|
||||||
|
|
||||||
Source files with LF line endings (for Unix/Linux) and with a
|
Source files with LF line endings (for Unix/Linux) and with a
|
||||||
"configure" script
|
"configure" script
|
||||||
|
|
||||||
libpng-1.5.2.tar.xz (LZMA-compressed, recommended)
|
libpng-1.0.29rc2.tar.gz
|
||||||
libpng-1.5.2.tar.gz
|
libpng-1.0.29rc2.tar.bz2
|
||||||
libpng-1.5.2.tar.bz2
|
|
||||||
|
Source files with LF line endings (for Unix/Linux) without the
|
||||||
|
"configure" script
|
||||||
|
|
||||||
|
libpng-1.0.29rc2-no-config.tar.gz
|
||||||
|
libpng-1.0.29rc2-no-config.tar.bz2
|
||||||
|
|
||||||
Source files with CRLF line endings (for Windows), without the
|
Source files with CRLF line endings (for Windows), without the
|
||||||
"configure" script
|
"configure" script
|
||||||
|
|
||||||
lpng152.7z (LZMA-compressed, recommended)
|
lp1029r02.zip
|
||||||
lpng152.zip
|
lp1029r02.tar.bz2
|
||||||
|
|
||||||
|
Project files
|
||||||
|
|
||||||
|
libpng-1.0.29rc2-project-netware.zip
|
||||||
|
libpng-1.0.29rc2-project-wince.zip
|
||||||
|
|
||||||
Other information:
|
Other information:
|
||||||
|
|
||||||
libpng-1.5.2-README.txt
|
libpng-1.0.29rc2-README.txt
|
||||||
libpng-1.5.2-LICENSE.txt
|
libpng-1.0.29rc2-KNOWNBUGS.txt
|
||||||
|
libpng-1.0.29rc2-LICENSE.txt
|
||||||
|
libpng-1.0.29rc2-Y2K-compliance.txt
|
||||||
|
|
||||||
Changes since the last public release (1.5.2):
|
Changes since the last public release (1.0.27):
|
||||||
|
|
||||||
More -Wshadow fixes for older gcc compilers. Older gcc versions apparently
|
version 1.2.20beta01 [August 19, 2007]
|
||||||
check formal parameters names in function declarations (as well as
|
Fixed problem with compiling pnggccrd.c on Intel-Apple platforms.
|
||||||
definitions) to see if they match a name in the global namespace.
|
Added PNG_NO_ERROR_TEXT feature, with demo in contrib/pngminim
|
||||||
Revised PNG_EXPORTA macro to not use an empty parameter, to accommodate the
|
Removed define PNG_WARN_UNINITIALIZED_ROW 1 /* 0: warning; 1: error */
|
||||||
old VisualC++ preprocessor.
|
because it caused some trouble.
|
||||||
Turned on interlace handling in png_read_png().
|
|
||||||
Fixed gcc pendantic warnings.
|
version 1.2.20beta02 [August 20, 2007]
|
||||||
Handle longjmp in Cygwin.
|
Avoid compiling pnggccrd.c on Intel-Apple platforms.
|
||||||
Fixed png_get_current_row_number() in the interlaced case.
|
|
||||||
Cleaned up ALPHA flags and transformations.
|
version 1.2.20beta03 [August 20, 2007]
|
||||||
Implemented expansion to 16 bits.
|
Added "/D PNG_NO_MMX_CODE" to the non-mmx builds of projects/visualc6
|
||||||
Fixed mistake in the descriptions of user read_transform and write_transform
|
and visualc71.
|
||||||
function prototypes in the manual. The row_info struct is png_row_infop.
|
|
||||||
Corrected png_get_current_row_number documentation
|
version 1.2.20beta04 [August 21, 2007]
|
||||||
Fixed the read/write row callback documentation.
|
Revised pngvcrd.c for improved efficiency (Steve Snyder).
|
||||||
This documents the current behavior, where the callback is called after
|
|
||||||
every row with information pertaining to the next row.
|
version 1.2.20rc1 [August 23, 2007]
|
||||||
Fixed scripts/makefile.vcwin32
|
Revised pngconf.h to set PNG_NO_MMX_CODE for gcc-3.x compilers.
|
||||||
Updated contrib/pngsuite/README to add the word "modify".
|
|
||||||
Define PNG_ALLOCATED and other attributes to blank when _MSC_VER<1300.
|
version 1.2.20rc2 [August 27, 2007]
|
||||||
ifdef out mask arrays in pngread.c when interlacing is not supported.
|
Revised scripts/CMakeLists.txt
|
||||||
Added a hint to try CPP=/bin/cpp if "cpp -E" fails in scripts/pnglibconf.mak
|
Revised #ifdefs to ensure one and only one of pnggccrd.c, pngvcrd.c,
|
||||||
and in contrib/pngminim/*/makefile, eg., on SunOS 5.10, and removed "strip"
|
or part of pngrutil.c is selected.
|
||||||
from the makefiles.
|
|
||||||
Fixed a bug (present since libpng-1.0.7) that makes png_handle_sPLT() fail
|
version 1.2.20rc3 [September 26, 2007]
|
||||||
to compile when PNG_NO_POINTER_INDEXING is defined (Chubanov Kirill)
|
Remove a little more code in pngwutil.c when PNG_NO_WRITE_FILTER is selected.
|
||||||
Don't include standard header files in png.h while building the symbol table,
|
Added /D _CRT_SECURE_NO_WARNINGS to visual6c and visualc71 projects.
|
||||||
to avoid cpp failure on SunOS (introduced PNG_BUILDING_SYMBOL_TABLE macro).
|
Compile png_mmx_support() in png.c even when PNG_NO_MMX_CODE is defined.
|
||||||
|
Restored a "superfluous" #ifdef that was removed from 1.2.20rc2 pnggccrd.c,
|
||||||
|
breaking the png_mmx_support() function.
|
||||||
|
|
||||||
|
version 1.2.20rc4 [September 1, 2007]
|
||||||
|
Removed Intel contributions (MMX, Optimized C).
|
||||||
|
|
||||||
|
version 1.2.20rc5 [September 2, 2007]
|
||||||
|
Restored configure and Makefile.in to rc3 and put a snippet of code in
|
||||||
|
pnggccrd.c, to ensure configure makes the same PNG_NO_MMX_CODE selection
|
||||||
|
|
||||||
|
version 1.2.20rc6 [September 2, 2007]
|
||||||
|
Fixed bugs in scripts/CMakeLists.txt
|
||||||
|
Removed pngvcrd.c references from msvc projects.
|
||||||
|
|
||||||
|
version 1.0.28 and 1.2.20 [September 8, 2007]
|
||||||
|
Removed "(NO READ SUPPORT)" from png_get_header_version() string.
|
||||||
|
|
||||||
|
version 1.2.21beta1 [September 14, 2007]
|
||||||
|
Fixed various mistakes reported by George Cook and Jeff Phillips:
|
||||||
|
logical vs bitwise NOT in pngrtran.c, bug introduced in 1.2.19rc2
|
||||||
|
16-bit cheap transparency expansion, bug introduced in 1.2.19beta2
|
||||||
|
errors with sizeof(unknown_chunk.name), bugs introduced in 1.2.19beta11
|
||||||
|
<= compare with unsigned var in pngset.c, should be ==.
|
||||||
|
|
||||||
|
version 1.2.21beta2 [September 18, 2007]
|
||||||
|
Removed some extraneous typecasts.
|
||||||
|
|
||||||
|
version 1.2.21rc1 [September 25, 2007]
|
||||||
|
Fixed potential out-of-bounds reads in png_handle_pCAL() and
|
||||||
|
png_handle_ztXt() ("flayer" results reported by Tavis Ormandy).
|
||||||
|
|
||||||
|
version 1.2.21rc2 [September 26, 2007]
|
||||||
|
Fixed potential out-of-bounds reads in png_handle_sCAL(),
|
||||||
|
png_handle_iTXt(), and png_push_read_tEXt().
|
||||||
|
Remove some PNG_CONST declarations from pngwutil.c to avoid compiler warnings
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
|
||||||
|
(subscription required; visit
|
||||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||||
to subscribe) or to glennrp at users.sourceforge.net
|
to subscribe) or to glennrp at users.sourceforge.net
|
||||||
|
|
||||||
|
|||||||
406
CMakeLists.txt
@@ -1,406 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 2.4.4)
|
|
||||||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
|
|
||||||
|
|
||||||
if(UNIX AND NOT DEFINED CMAKE_BUILD_TYPE)
|
|
||||||
if(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION EQUAL 4)
|
|
||||||
# workaround CMake 2.4.x bug
|
|
||||||
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
|
|
||||||
"Choose the type of build, options are:
|
|
||||||
None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used)
|
|
||||||
Debug
|
|
||||||
Release
|
|
||||||
RelWithDebInfo
|
|
||||||
MinSizeRel.")
|
|
||||||
else()
|
|
||||||
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
|
|
||||||
"Choose the type of build, options are:
|
|
||||||
None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used)
|
|
||||||
Debug
|
|
||||||
Release
|
|
||||||
RelWithDebInfo
|
|
||||||
MinSizeRel.")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
project(libpng C)
|
|
||||||
enable_testing()
|
|
||||||
|
|
||||||
# Copyright (C) 2007-2011 Glenn Randers-Pehrson
|
|
||||||
|
|
||||||
# This code is released under the libpng license.
|
|
||||||
# For conditions of distribution and use, see the disclaimer
|
|
||||||
# and license in png.h
|
|
||||||
|
|
||||||
set(PNGLIB_MAJOR 1)
|
|
||||||
set(PNGLIB_MINOR 5)
|
|
||||||
set(PNGLIB_RELEASE 2)
|
|
||||||
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
|
||||||
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
|
|
||||||
|
|
||||||
# needed packages
|
|
||||||
find_package(ZLIB REQUIRED)
|
|
||||||
include_directories(${ZLIB_INCLUDE_DIR})
|
|
||||||
|
|
||||||
if(NOT WIN32)
|
|
||||||
find_library(M_LIBRARY
|
|
||||||
NAMES m
|
|
||||||
PATHS /usr/lib /usr/local/lib
|
|
||||||
)
|
|
||||||
if(NOT M_LIBRARY)
|
|
||||||
message(STATUS
|
|
||||||
"math library 'libm' not found - floating point support disabled")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
# not needed on windows
|
|
||||||
set(M_LIBRARY "")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# COMMAND LINE OPTIONS
|
|
||||||
if(DEFINED PNG_SHARED)
|
|
||||||
option(PNG_SHARED "Build shared lib" ${PNG_SHARED})
|
|
||||||
else()
|
|
||||||
option(PNG_SHARED "Build shared lib" ON)
|
|
||||||
endif()
|
|
||||||
if(DEFINED PNG_STATIC)
|
|
||||||
option(PNG_STATIC "Build static lib" ${PNG_STATIC})
|
|
||||||
else()
|
|
||||||
option(PNG_STATIC "Build static lib" ON)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(MINGW)
|
|
||||||
option(PNG_TESTS "Build pngtest" NO)
|
|
||||||
else()
|
|
||||||
option(PNG_TESTS "Build pngtest" YES)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
option(PNG_NO_CONSOLE_IO "FIXME" YES)
|
|
||||||
option(PNG_NO_STDIO "FIXME" YES)
|
|
||||||
option(PNG_DEBUG "Build with debug output" NO)
|
|
||||||
option(PNGARG "FIXME" YES)
|
|
||||||
#TODO:
|
|
||||||
# PNG_CONSOLE_IO_SUPPORTED
|
|
||||||
|
|
||||||
# maybe needs improving, but currently I don't know when we can enable what :)
|
|
||||||
set(png_asm_tmp "OFF")
|
|
||||||
if(NOT WIN32)
|
|
||||||
find_program(uname_executable NAMES uname PATHS /bin /usr/bin /usr/local/bin)
|
|
||||||
if(uname_executable)
|
|
||||||
exec_program(${uname_executable}
|
|
||||||
ARGS --machine OUTPUT_VARIABLE uname_output)
|
|
||||||
if("uname_output" MATCHES "^.*i[1-9]86.*$")
|
|
||||||
set(png_asm_tmp "ON")
|
|
||||||
else("uname_output" MATCHES "^.*i[1-9]86.*$")
|
|
||||||
set(png_asm_tmp "OFF")
|
|
||||||
endif("uname_output" MATCHES "^.*i[1-9]86.*$")
|
|
||||||
endif(uname_executable)
|
|
||||||
else()
|
|
||||||
# this env var is normally only set on win64
|
|
||||||
set(TEXT "ProgramFiles(x86)")
|
|
||||||
if("$ENV{${TEXT}}" STREQUAL "")
|
|
||||||
set(png_asm_tmp "ON")
|
|
||||||
endif("$ENV{${TEXT}}" STREQUAL "")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# SET LIBNAME
|
|
||||||
set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
|
||||||
|
|
||||||
# to distinguish between debug and release lib
|
|
||||||
set(CMAKE_DEBUG_POSTFIX "d")
|
|
||||||
|
|
||||||
# Use the prebuilt pnglibconf.h file from the scripts folder
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h)
|
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
|
|
||||||
# OUR SOURCES
|
|
||||||
set(libpng_public_hdrs
|
|
||||||
png.h
|
|
||||||
pngconf.h
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h
|
|
||||||
)
|
|
||||||
set(libpng_sources
|
|
||||||
${libpng_public_hdrs}
|
|
||||||
pngdebug.h
|
|
||||||
pnginfo.h
|
|
||||||
pngpriv.h
|
|
||||||
pngstruct.h
|
|
||||||
png.c
|
|
||||||
pngerror.c
|
|
||||||
pngget.c
|
|
||||||
pngmem.c
|
|
||||||
pngpread.c
|
|
||||||
pngread.c
|
|
||||||
pngrio.c
|
|
||||||
pngrtran.c
|
|
||||||
pngrutil.c
|
|
||||||
pngset.c
|
|
||||||
pngtrans.c
|
|
||||||
pngwio.c
|
|
||||||
pngwrite.c
|
|
||||||
pngwtran.c
|
|
||||||
pngwutil.c
|
|
||||||
)
|
|
||||||
set(pngtest_sources
|
|
||||||
pngtest.c
|
|
||||||
)
|
|
||||||
# SOME NEEDED DEFINITIONS
|
|
||||||
|
|
||||||
add_definitions(-DPNG_CONFIGURE_LIBPNG)
|
|
||||||
|
|
||||||
if(_AIX)
|
|
||||||
add_definitions(-D_ALL_SOURCE)
|
|
||||||
endif(_AIX)
|
|
||||||
|
|
||||||
if(MSVC)
|
|
||||||
add_definitions(-DPNG_NO_MODULEDEF -D_CRT_SECURE_NO_DEPRECATE)
|
|
||||||
endif(MSVC)
|
|
||||||
|
|
||||||
if(PNG_SHARED OR NOT MSVC)
|
|
||||||
#if building msvc static this has NOT to be defined
|
|
||||||
add_definitions(-DZLIB_DLL)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
if(PNG_CONSOLE_IO_SUPPORTED)
|
|
||||||
add_definitions(-DPNG_CONSOLE_IO_SUPPORTED)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(PNG_NO_CONSOLE_IO)
|
|
||||||
add_definitions(-DPNG_NO_CONSOLE_IO)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(PNG_NO_STDIO)
|
|
||||||
add_definitions(-DPNG_NO_STDIO)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(PNG_DEBUG)
|
|
||||||
add_definitions(-DPNG_DEBUG)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT M_LIBRARY AND NOT WIN32)
|
|
||||||
add_definitions(-DPNG_NO_FLOATING_POINT_SUPPORTED)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# NOW BUILD OUR TARGET
|
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIR})
|
|
||||||
|
|
||||||
if(PNG_SHARED)
|
|
||||||
add_library(${PNG_LIB_NAME} SHARED ${libpng_sources})
|
|
||||||
if(MSVC)
|
|
||||||
# msvc does not append 'lib' - do it here to have consistent name
|
|
||||||
set_target_properties(${PNG_LIB_NAME} PROPERTIES PREFIX "lib")
|
|
||||||
set_target_properties(${PNG_LIB_NAME} PROPERTIES IMPORT_PREFIX "lib")
|
|
||||||
endif()
|
|
||||||
target_link_libraries(${PNG_LIB_NAME} ${ZLIB_LIBRARY} ${M_LIBRARY})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(PNG_STATIC)
|
|
||||||
# does not work without changing name
|
|
||||||
set(PNG_LIB_NAME_STATIC ${PNG_LIB_NAME}_static)
|
|
||||||
add_library(${PNG_LIB_NAME_STATIC} STATIC ${libpng_sources})
|
|
||||||
if(MSVC)
|
|
||||||
# msvc does not append 'lib' - do it here to have consistent name
|
|
||||||
set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES PREFIX "lib")
|
|
||||||
endif()
|
|
||||||
target_link_libraries(${PNG_LIB_NAME_STATIC} ${ZLIB_LIBRARY} ${M_LIBRARY})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
if(PNG_SHARED AND WIN32)
|
|
||||||
set_target_properties(${PNG_LIB_NAME} PROPERTIES DEFINE_SYMBOL PNG_BUILD_DLL)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(PNG_TESTS AND PNG_SHARED)
|
|
||||||
# does not work with msvc due to png_lib_ver issue
|
|
||||||
add_executable(pngtest ${pngtest_sources})
|
|
||||||
target_link_libraries(pngtest ${PNG_LIB_NAME})
|
|
||||||
add_test(pngtest ./pngtest ${CMAKE_CURRENT_SOURCE_DIR}/pngtest.png)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#
|
|
||||||
# Set a variable with CMake code which:
|
|
||||||
# Creates a symlink from src to dest (if possible) or alternatively
|
|
||||||
# copies if different.
|
|
||||||
macro(_png_generate_symlink_code CODE SRC DEST)
|
|
||||||
if(WIN32 AND NOT CYGWIN)
|
|
||||||
set(_png_gsc_message "Copying ${SRC} to ${DEST} if needed")
|
|
||||||
set(_png_gsc_operation "copy_if_different")
|
|
||||||
else()
|
|
||||||
set(_png_gsc_message "Symlinking ${SRC} to ${DEST}")
|
|
||||||
set(_png_gsc_operation "create_symlink")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(${CODE} "
|
|
||||||
message(STATUS \"${_png_gsc_message}\")
|
|
||||||
execute_process(COMMAND \${CMAKE_COMMAND} -E ${_png_gsc_operation}
|
|
||||||
\"${SRC}\" \"${DEST}\")
|
|
||||||
")
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
# CREATE PKGCONFIG FILES
|
|
||||||
# we use the same files like ./configure, so we have to set its vars
|
|
||||||
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
|
||||||
set(CMAKE_INSTALL_LIBDIR lib)
|
|
||||||
endif(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
|
||||||
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(LIBS "-lz -lm")
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc @ONLY)
|
|
||||||
_png_generate_symlink_code(PNG_PC_INSTALL_CODE
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/libpng.pc)
|
|
||||||
install(CODE ${PNG_PC_INSTALL_CODE})
|
|
||||||
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config @ONLY)
|
|
||||||
_png_generate_symlink_code(PNG_CONFIG_INSTALL_CODE
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/libpng-config)
|
|
||||||
install(CODE ${PNG_CONFIG_INSTALL_CODE})
|
|
||||||
|
|
||||||
# SET UP LINKS
|
|
||||||
if(PNG_SHARED)
|
|
||||||
set_target_properties(${PNG_LIB_NAME} PROPERTIES
|
|
||||||
# VERSION 15.${PNGLIB_RELEASE}.1.5.2
|
|
||||||
VERSION 15.${PNGLIB_RELEASE}.0
|
|
||||||
SOVERSION 15
|
|
||||||
CLEAN_DIRECT_OUTPUT 1)
|
|
||||||
endif()
|
|
||||||
if(PNG_STATIC)
|
|
||||||
# MSVC doesn't use a different file extension for shared vs. static
|
|
||||||
# libs. We are able to change OUTPUT_NAME to remove the _static
|
|
||||||
# for all other platforms.
|
|
||||||
if(NOT MSVC)
|
|
||||||
set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES
|
|
||||||
OUTPUT_NAME ${PNG_LIB_NAME}
|
|
||||||
CLEAN_DIRECT_OUTPUT 1)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# If CMake > 2.4.x, we set a variable used below to export
|
|
||||||
# targets to an export file.
|
|
||||||
# TODO: Use VERSION_GREATER after our cmake_minimum_required >= 2.6.2
|
|
||||||
if(CMAKE_MAJOR_VERSION GREATER 1 AND CMAKE_MINOR_VERSION GREATER 4)
|
|
||||||
set(PNG_EXPORT_RULE EXPORT libpng)
|
|
||||||
elseif(CMAKE_MAJOR_VERSION GREATER 2) # future proof
|
|
||||||
set(PNG_EXPORT_RULE EXPORT libpng)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# INSTALL
|
|
||||||
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
|
|
||||||
if(PNG_SHARED)
|
|
||||||
install(TARGETS ${PNG_LIB_NAME}
|
|
||||||
${PNG_EXPORT_RULE}
|
|
||||||
RUNTIME DESTINATION bin
|
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
||||||
|
|
||||||
# Create a symlink for libpng.dll.a => libpng15.dll.a on Cygwin
|
|
||||||
if(CYGWIN)
|
|
||||||
_png_generate_symlink_code(PNG_SHARED_IMPLIB_INSTALL_CODE
|
|
||||||
${PNGLIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}
|
|
||||||
libpng${CMAKE_IMPORT_LIBRARY_SUFFIX})
|
|
||||||
install(CODE ${PNG_SHARED_IMPLIB_INSTALL_CODE})
|
|
||||||
install(FILES
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
|
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT WIN32)
|
|
||||||
IF(CMAKE_LIBRARY_OUTPUT_DIRECTORY)
|
|
||||||
_png_generate_symlink_code(PNG_SHARED_INSTALL_CODE
|
|
||||||
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${PNGLIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
|
|
||||||
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX})
|
|
||||||
install(CODE ${PNG_SHARED_INSTALL_CODE})
|
|
||||||
install(FILES
|
|
||||||
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
|
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
||||||
ELSE(CMAKE_LIBRARY_OUTPUT_DIRECTORY)
|
|
||||||
_png_generate_symlink_code(PNG_SHARED_INSTALL_CODE
|
|
||||||
${PNGLIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
|
|
||||||
libpng${CMAKE_SHARED_LIBRARY_SUFFIX})
|
|
||||||
install(CODE ${PNG_SHARED_INSTALL_CODE})
|
|
||||||
install(FILES
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
|
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
||||||
ENDIF(CMAKE_LIBRARY_OUTPUT_DIRECTORY)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(PNG_STATIC)
|
|
||||||
install(TARGETS ${PNG_LIB_NAME_STATIC}
|
|
||||||
${PNG_EXPORT_RULE}
|
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
||||||
if(NOT WIN32 OR CYGWIN)
|
|
||||||
IF(CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
|
|
||||||
_png_generate_symlink_code(PNG_STATIC_INSTALL_CODE
|
|
||||||
${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${PNGLIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}
|
|
||||||
${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX})
|
|
||||||
install(CODE ${PNG_STATIC_INSTALL_CODE})
|
|
||||||
install(FILES
|
|
||||||
${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}
|
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
||||||
ELSE(CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
|
|
||||||
_png_generate_symlink_code(PNG_STATIC_INSTALL_CODE
|
|
||||||
${PNGLIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}
|
|
||||||
libpng${CMAKE_STATIC_LIBRARY_SUFFIX})
|
|
||||||
install(CODE ${PNG_STATIC_INSTALL_CODE})
|
|
||||||
install(FILES
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}
|
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
||||||
ENDIF(CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
|
|
||||||
install(FILES ${libpng_public_hdrs} DESTINATION include)
|
|
||||||
install(FILES ${libpng_public_hdrs} DESTINATION include/${PNGLIB_NAME})
|
|
||||||
endif()
|
|
||||||
if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL )
|
|
||||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config DESTINATION bin)
|
|
||||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
|
|
||||||
DESTINATION bin)
|
|
||||||
endif()
|
|
||||||
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
|
|
||||||
# Install man pages
|
|
||||||
if(NOT PNG_MAN_DIR)
|
|
||||||
set(PNG_MAN_DIR "share/man")
|
|
||||||
endif()
|
|
||||||
install(FILES libpng.3 libpngpf.3 DESTINATION ${PNG_MAN_DIR}/man3)
|
|
||||||
install(FILES png.5 DESTINATION ${PNG_MAN_DIR}/man5)
|
|
||||||
# Install pkg-config files
|
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc
|
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
|
||||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config
|
|
||||||
DESTINATION bin)
|
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc
|
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
|
||||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
|
|
||||||
DESTINATION bin)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# On versions of CMake that support it, create an export file CMake
|
|
||||||
# users can include() to import our targets
|
|
||||||
if(PNG_EXPORT_RULE AND NOT SKIP_INSTALL_EXPORT AND NOT SKIP_INSTALL_ALL )
|
|
||||||
install(EXPORT libpng DESTINATION lib/libpng FILE lib${PNG_LIB_NAME}.cmake)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# what's with libpng-$VER%.txt and all the extra files?
|
|
||||||
|
|
||||||
|
|
||||||
# UNINSTALL
|
|
||||||
# do we need this?
|
|
||||||
|
|
||||||
|
|
||||||
# DIST
|
|
||||||
# do we need this?
|
|
||||||
|
|
||||||
# to create msvc import lib for mingw compiled shared lib
|
|
||||||
# pexports libpng.dll > libpng.def
|
|
||||||
# lib /def:libpng.def /machine:x86
|
|
||||||
|
|
||||||
160
INSTALL
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
Installing libpng
|
Installing libpng version 1.0.29rc2 - September 26, 2007
|
||||||
|
|
||||||
On Unix/Linux and similar systems, you can simply type
|
On Unix/Linux and similar systems, you can simply type
|
||||||
|
|
||||||
@@ -13,16 +13,10 @@ If configure does not work on your system and you have a reasonably
|
|||||||
up-to-date set of tools, running ./autogen.sh before running ./configure
|
up-to-date set of tools, running ./autogen.sh before running ./configure
|
||||||
may fix the problem. You can also run the individual commands in
|
may fix the problem. You can also run the individual commands in
|
||||||
autogen.sh with the --force option, if supported by your version of
|
autogen.sh with the --force option, if supported by your version of
|
||||||
the tools. To be really sure that you aren't using any of the included
|
the tools. If you run 'libtoolize --force', though, this will replace
|
||||||
pre-built scripts, you can do this:
|
the distributed, patched, version of ltmain.sh with an unpatched version
|
||||||
|
and your shared library builds may fail to produce libraries with the
|
||||||
./configure --enable-maintainer-mode
|
correct version numbers.
|
||||||
make maintainer-clean
|
|
||||||
./autogen.sh
|
|
||||||
./configure [--prefix=/path] [other options]
|
|
||||||
make
|
|
||||||
make install
|
|
||||||
make check
|
|
||||||
|
|
||||||
Instead, you can use one of the custom-built makefiles in the
|
Instead, you can use one of the custom-built makefiles in the
|
||||||
"scripts" directory
|
"scripts" directory
|
||||||
@@ -31,29 +25,27 @@ Instead, you can use one of the custom-built makefiles in the
|
|||||||
make test
|
make test
|
||||||
make install
|
make install
|
||||||
|
|
||||||
The files that are presently available in the scripts directory
|
|
||||||
are listed and described in scripts/README.txt.
|
|
||||||
|
|
||||||
Or you can use one of the "projects" in the "projects" directory.
|
Or you can use one of the "projects" in the "projects" directory.
|
||||||
|
|
||||||
|
If you want to use "cmake" (see www.cmake.org), copy CMakeLists.txt
|
||||||
|
from the "scripts" directory to this directory and type
|
||||||
|
|
||||||
|
cmake . [-DPNG_MMX=YES] -DCMAKE_INSTALL_PREFIX=/path
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
|
||||||
Before installing libpng, you must first install zlib, if it
|
Before installing libpng, you must first install zlib, if it
|
||||||
is not already on your system. zlib can usually be found
|
is not already on your system. zlib can usually be found
|
||||||
wherever you got libpng. zlib can be placed in another directory,
|
wherever you got libpng. zlib can be placed in another directory,
|
||||||
at the same level as libpng.
|
at the same level as libpng.
|
||||||
|
|
||||||
If you want to use "cmake" (see www.cmake.org), type
|
|
||||||
|
|
||||||
cmake . -DCMAKE_INSTALL_PREFIX=/path
|
|
||||||
make
|
|
||||||
make install
|
|
||||||
|
|
||||||
If your system already has a preinstalled zlib you will still need
|
If your system already has a preinstalled zlib you will still need
|
||||||
to have access to the zlib.h and zconf.h include files that
|
to have access to the zlib.h and zconf.h include files that
|
||||||
correspond to the version of zlib that's installed.
|
correspond to the version of zlib that's installed.
|
||||||
|
|
||||||
You can rename the directories that you downloaded (they
|
You can rename the directories that you downloaded (they
|
||||||
might be called "libpng-x.y.z" or "libpngNN" and "zlib-1.2.5"
|
might be called "libpng-1.0.29rc2" or "lpng109" and "zlib-1.2.1"
|
||||||
or "zlib125") so that you have directories called "zlib" and "libpng".
|
or "zlib121") so that you have directories called "zlib" and "libpng".
|
||||||
|
|
||||||
Your directory structure should look like this:
|
Your directory structure should look like this:
|
||||||
|
|
||||||
@@ -63,25 +55,19 @@ Your directory structure should look like this:
|
|||||||
README
|
README
|
||||||
*.h
|
*.h
|
||||||
*.c
|
*.c
|
||||||
CMakeLists.txt => "cmake" script
|
|
||||||
configuration files:
|
|
||||||
configure.ac, configure, Makefile.am, Makefile.in,
|
|
||||||
autogen.sh, config.guess, ltmain.sh, missing, libpng.pc.in,
|
|
||||||
libpng-config.in, aclocal.m4, config.h.in, config.sub,
|
|
||||||
depcomp, install-sh, mkinstalldirs, test-pngtest.sh
|
|
||||||
contrib
|
contrib
|
||||||
gregbook
|
gregbook
|
||||||
pngminim
|
|
||||||
pngminus
|
pngminus
|
||||||
pngsuite
|
pngsuite
|
||||||
visupng
|
visupng
|
||||||
projects
|
projects
|
||||||
visualc71
|
beos
|
||||||
vstudio
|
c5builder (Borland)
|
||||||
|
visualc6 (msvc)
|
||||||
|
netware.txt
|
||||||
|
wince.txt
|
||||||
scripts
|
scripts
|
||||||
makefile.*
|
makefile.*
|
||||||
*.def (module definition files)
|
|
||||||
etc.
|
|
||||||
pngtest.png
|
pngtest.png
|
||||||
etc.
|
etc.
|
||||||
zlib
|
zlib
|
||||||
@@ -96,13 +82,80 @@ distribution of libpng. It is available in both tar.gz (UNIX style line
|
|||||||
endings) and zip (DOS style line endings) formats.
|
endings) and zip (DOS style line endings) formats.
|
||||||
|
|
||||||
If you are building libpng with MSVC, you can enter the
|
If you are building libpng with MSVC, you can enter the
|
||||||
libpng projects\visualc6 or visualc71 directory and follow the instructions
|
libpng projects\visualc6 directory and follow the instructions in
|
||||||
in README.txt.
|
projects\visualc6\README.txt.
|
||||||
|
|
||||||
Otherwise enter the zlib directory and follow the instructions in zlib/README,
|
You can build libpng for WindowsCE by downloading and installing
|
||||||
|
the projects\wince directory as instructed in the projects\wince.txt file, and
|
||||||
|
then following the instructions in the README* files. Similarly, you can
|
||||||
|
build libpng for Netware or Beos as instructed in projects\netware.txt
|
||||||
|
or projects\beos.
|
||||||
|
|
||||||
|
Else enter the zlib directory and follow the instructions in zlib/README,
|
||||||
then come back here and run "configure" or choose the appropriate
|
then come back here and run "configure" or choose the appropriate
|
||||||
makefile.sys in the scripts directory.
|
makefile.sys in the scripts directory.
|
||||||
|
|
||||||
|
The files that are presently available in the scripts directory
|
||||||
|
include
|
||||||
|
|
||||||
|
CMakeLists.txt => "cmake" script
|
||||||
|
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
||||||
|
makefile.elf => Linux/ELF makefile symbol versioning,
|
||||||
|
gcc, creates libpng10.so.0.1.0.29rc2)
|
||||||
|
makefile.linux => Linux/ELF makefile
|
||||||
|
(gcc, creates libpng10.so.0.1.0.29rc2)
|
||||||
|
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
||||||
|
makefile.knr => Archaic UNIX Makefile that converts files with
|
||||||
|
ansi2knr (Requires ansi2knr.c from
|
||||||
|
ftp://ftp.cs.wisc.edu/ghost)
|
||||||
|
makefile.aix => AIX/gcc makefile
|
||||||
|
makefile.cygwin => Cygwin/gcc makefile
|
||||||
|
makefile.darwin => Darwin makefile, can use on MacosX
|
||||||
|
makefile.dec => DEC Alpha UNIX makefile
|
||||||
|
makefile.freebsd => FreeBSD makefile
|
||||||
|
makefile.hpgcc => HPUX makefile using gcc
|
||||||
|
makefile.hpux => HPUX (10.20 and 11.00) makefile
|
||||||
|
makefile.hp64 => HPUX (10.20 and 11.00) makefile, 64-bit
|
||||||
|
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
|
||||||
|
makefile.intel => Intel C/C++ version 4.0 and later
|
||||||
|
libpng.icc => Project file for IBM VisualAge/C++ version 4.0 or later
|
||||||
|
makefile.netbsd => NetBSD/cc makefile, uses PNGGCCRD, makes libpng.so.
|
||||||
|
makefile.ne10bsd => NetBSD/cc makefile, uses PNGGCCRD,
|
||||||
|
makes libpng10.so
|
||||||
|
makefile.openbsd => OpenBSD makefile
|
||||||
|
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
|
||||||
|
makefile.sggcc => Silicon Graphics (gcc,
|
||||||
|
creates libpng10.so.0.1.0.29rc2)
|
||||||
|
makefile.sunos => Sun makefile
|
||||||
|
makefile.solaris => Solaris 2.X makefile (gcc,
|
||||||
|
creates libpng10.so.0.1.0.29rc2)
|
||||||
|
makefile.solaris-x86 => Solaris/intelMMX 2.X makefile (gcc,
|
||||||
|
creates libpng10.so.0.1.0.29rc2)
|
||||||
|
makefile.so9 => Solaris 9 makefile (gcc,
|
||||||
|
creates libpng10.so.0.1.0.29rc2)
|
||||||
|
makefile.32sunu => Sun Ultra 32-bit makefile
|
||||||
|
makefile.64sunu => Sun Ultra 64-bit makefile
|
||||||
|
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||||
|
makefile.mips => MIPS makefile
|
||||||
|
makefile.acorn => Acorn makefile
|
||||||
|
makefile.amiga => Amiga makefile
|
||||||
|
smakefile.ppc => AMIGA smakefile for SAS C V6.58/7.00 PPC compiler
|
||||||
|
(Requires SCOPTIONS, copied from scripts/SCOPTIONS.ppc)
|
||||||
|
makefile.atari => Atari makefile
|
||||||
|
makefile.beos => BEOS makefile for X86
|
||||||
|
makefile.bor => Borland makefile (uses bcc)
|
||||||
|
makefile.bc32 => 32-bit Borland C++ (all modules compiled in C mode)
|
||||||
|
makefile.tc3 => Turbo C 3.0 makefile
|
||||||
|
makefile.dj2 => DJGPP 2 makefile
|
||||||
|
makefile.msc => Microsoft C makefile
|
||||||
|
makefile.vcwin32 => makefile for Microsoft Visual C++ 4.0 and later
|
||||||
|
makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def)
|
||||||
|
pngos2.def => OS/2 module definition file used by makefile.os2
|
||||||
|
makefile.watcom => Watcom 10a+ Makefile, 32-bit flat memory model
|
||||||
|
makevms.com => VMS build script
|
||||||
|
descrip.mms => VMS makefile for MMS or MMK
|
||||||
|
SCOPTIONS.ppc => Used with smakefile.ppc
|
||||||
|
|
||||||
Copy the file (or files) that you need from the
|
Copy the file (or files) that you need from the
|
||||||
scripts directory into this directory, for example
|
scripts directory into this directory, for example
|
||||||
|
|
||||||
@@ -112,7 +165,7 @@ scripts directory into this directory, for example
|
|||||||
Read the makefile to see if you need to change any source or
|
Read the makefile to see if you need to change any source or
|
||||||
target directories to match your preferences.
|
target directories to match your preferences.
|
||||||
|
|
||||||
Then read pnglibconf.dfa to see if you want to make any configuration
|
Then read pngconf.h to see if you want to make any configuration
|
||||||
changes.
|
changes.
|
||||||
|
|
||||||
Then just run "make" which will create the libpng library in
|
Then just run "make" which will create the libpng library in
|
||||||
@@ -130,6 +183,37 @@ do that, run "make install" in the zlib directory first if necessary).
|
|||||||
Some also allow you to run "make test-installed" after you have
|
Some also allow you to run "make test-installed" after you have
|
||||||
run "make install".
|
run "make install".
|
||||||
|
|
||||||
Further information can be found in the README and libpng-manual.txt
|
If you encounter a compiler error message complaining about the
|
||||||
|
lines
|
||||||
|
__png.h__ already includes setjmp.h;
|
||||||
|
__dont__ include it again.;
|
||||||
|
This means you have compiled another module that includes setjmp.h,
|
||||||
|
which is hazardous because the two modules might not include exactly
|
||||||
|
the same setjmp.h. If you are sure that you know what you are doing
|
||||||
|
and that they are exactly the same, then you can comment out or
|
||||||
|
delete the two lines. Better yet, use the cexcept interface
|
||||||
|
instead, as demonstrated in contrib/visupng of the libpng distribution.
|
||||||
|
|
||||||
|
Further information can be found in the README and libpng.txt
|
||||||
files, in the individual makefiles, in png.h, and the manual pages
|
files, in the individual makefiles, in png.h, and the manual pages
|
||||||
libpng.3 and png.5.
|
libpng.3 and png.5.
|
||||||
|
|
||||||
|
|
||||||
|
Using the ./configure script -- 16 December 2002.
|
||||||
|
=================================================
|
||||||
|
|
||||||
|
|
||||||
|
The ./configure script should work compatibly with what scripts/makefile.*
|
||||||
|
did, however there are some options you need to add to configure explicitly,
|
||||||
|
which previously was done semi-automatically (if you didn't edit
|
||||||
|
scripts/makefile.* yourself, that is)
|
||||||
|
|
||||||
|
|
||||||
|
CFLAGS="-Wall -O -funroll-loops \
|
||||||
|
-malign-loops=2 -malign-functions=2" ./configure --prefix=/usr/include \
|
||||||
|
--with-pkgconfigdir=/usr/lib/pkgconfig --includedir=/usr/include
|
||||||
|
|
||||||
|
You can alternatively specify --includedir=/usr/include, /usr/local/include,
|
||||||
|
/usr/include/png12, or whatever.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
22
KNOWNBUG
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
Known bugs in libpng version 1.0.29rc2
|
||||||
|
|
||||||
|
1. February 23, 2006: The custom makefiles don't build libpng with -lz.
|
||||||
|
|
||||||
|
STATUS: This is a subject of debate. The change will probably be made
|
||||||
|
as a part of a major overhaul of the makefiles in libpng version 1.3.0.
|
||||||
|
|
||||||
|
2. February 24, 2006: The Makefile generated by the "configure" script
|
||||||
|
fails to install symbolic links
|
||||||
|
libpng12.so => libpng12.so.0.1.2.9betaN
|
||||||
|
that are generated by the custom makefiles.
|
||||||
|
|
||||||
|
3. September 4, 2007: There is a report that pngtest crashes on MacOS 10.
|
||||||
|
|
||||||
|
STATUS: workarounds are
|
||||||
|
1) Compile without optimization (crashes are observed with
|
||||||
|
-arch i386 and -O2 or -O3, using gcc-4.0.1.
|
||||||
|
2) Compile pngtest.c with PNG_DEBUG defined (the bug goes away if
|
||||||
|
you try to look at it).
|
||||||
|
3) Ignore the crash. The library itself seems to be OK.
|
||||||
|
|
||||||
8
LICENSE
@@ -8,10 +8,8 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
|
|||||||
If you modify libpng you may insert additional notices immediately following
|
If you modify libpng you may insert additional notices immediately following
|
||||||
this sentence.
|
this sentence.
|
||||||
|
|
||||||
This code is released under the libpng license.
|
libpng versions 1.2.6, August 15, 2004, through 1.0.29rc2, September 26, 2007, are
|
||||||
|
Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are
|
||||||
libpng versions 1.2.6, August 15, 2004, through 1.5.2, March 31, 2011, are
|
|
||||||
Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
|
|
||||||
distributed according to the same disclaimer and license as libpng-1.2.5
|
distributed according to the same disclaimer and license as libpng-1.2.5
|
||||||
with the following individual added to the list of Contributing Authors
|
with the following individual added to the list of Contributing Authors
|
||||||
|
|
||||||
@@ -108,4 +106,4 @@ certification mark of the Open Source Initiative.
|
|||||||
|
|
||||||
Glenn Randers-Pehrson
|
Glenn Randers-Pehrson
|
||||||
glennrp at users.sourceforge.net
|
glennrp at users.sourceforge.net
|
||||||
March 31, 2011
|
September 26, 2007
|
||||||
|
|||||||
212
Makefile.am
@@ -1,94 +1,92 @@
|
|||||||
# Makefile.am:
|
# Makefile.am:
|
||||||
# Source file for Makefile.in (and hence Makefile)
|
# Source file for Makefile.in (and hence Makefile)
|
||||||
#
|
#
|
||||||
|
# Makefile.am need only be changed on a major version number
|
||||||
|
# change (e.g. libpng12 --> libpng13). In that case seach
|
||||||
|
# this file for every instance of the old base name (libpng12)
|
||||||
|
# and change to the new one (libpng13), then change the
|
||||||
|
# -version-number settings below so that the new values have
|
||||||
|
# the correct major part (first field).
|
||||||
|
|
||||||
PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
|
PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
|
||||||
|
|
||||||
# libpng does not follow GNU file name conventions
|
# libpng does not follow GNU file name conventions
|
||||||
|
|
||||||
# "color-tests" requires automake 1.11.1 or later. Enable it if you like,
|
|
||||||
# to get red "FAIL" and green "PASS" notations during tests.
|
|
||||||
# AUTOMAKE_OPTIONS = foreign color-tests
|
|
||||||
AUTOMAKE_OPTIONS = foreign
|
AUTOMAKE_OPTIONS = foreign
|
||||||
|
|
||||||
# test programs - run on make check, make distcheck
|
# test programs - run on make check, make distcheck
|
||||||
check_PROGRAMS= pngtest pngvalid
|
check_PROGRAMS= pngtest
|
||||||
pngtest_SOURCES = pngtest.c
|
pngtest_SOURCES = pngtest.c
|
||||||
pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
pngtest_LDADD = libpng10.la
|
||||||
pngvalid_SOURCES = pngvalid.c
|
TESTS = test-pngtest.sh
|
||||||
pngvalid_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
|
||||||
TESTS = test-pngtest.sh test-pngvalid-simple.sh test-pngvalid-full.sh
|
|
||||||
TESTS_ENVIRONMENT= srcdir=$(srcdir)
|
TESTS_ENVIRONMENT= srcdir=$(srcdir)
|
||||||
|
|
||||||
# man pages
|
# man pages
|
||||||
dist_man_MANS= libpng.3 libpngpf.3 png.5
|
dist_man_MANS= libpng.3 libpngpf.3 png.5
|
||||||
|
|
||||||
# generate the -config scripts if required
|
# generate the -config scripts if required
|
||||||
binconfigs= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config
|
binconfigs= libpng10-config
|
||||||
EXTRA_SCRIPTS= libpng-config libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config
|
EXTRA_SCRIPTS= libpng-config libpng10-config
|
||||||
bin_SCRIPTS= @binconfigs@
|
bin_SCRIPTS= @binconfigs@
|
||||||
|
|
||||||
# rules to build libpng, only build the old library on request
|
# rules to build libpng, only build the old library on request
|
||||||
lib_LTLIBRARIES=libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
lib_LTLIBRARIES=libpng10.la @compatlib@
|
||||||
# EXTRA_LTLIBRARIES= libpng.la
|
EXTRA_LTLIBRARIES= libpng.la
|
||||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngerror.c\
|
libpng10_la_SOURCES = png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
|
||||||
pngget.c pngmem.c pngpread.c pngread.c pngrio.c pngrtran.c pngrutil.c\
|
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
|
||||||
pngset.c pngtrans.c pngwio.c pngwrite.c pngwtran.c pngwutil.c\
|
pngwtran.c pngmem.c pngerror.c pngpread.c \
|
||||||
png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
|
png.h pngconf.h
|
||||||
|
libpng_la_SOURCES = $(libpng10_la_SOURCES)
|
||||||
|
|
||||||
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
|
libpng_la_CPPFLAGS = @LIBPNG_DEFINES@
|
||||||
|
libpng10_la_CPPFLAGS = @LIBPNG_DEFINES@
|
||||||
|
|
||||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS = @LIBPNG_DEFINES@
|
# MAJOR UPGRADE: the version-number settings below must be changed.
|
||||||
|
libpng10_la_LDFLAGS = -no-undefined -export-dynamic \
|
||||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined -export-dynamic \
|
-version-number 0:@PNGLIB_RELEASE@:0
|
||||||
-version-number @PNGLIB_MAJOR@@PNGLIB_MINOR@:@PNGLIB_RELEASE@:0
|
# -rpath is needed as automake doesn't know the directory
|
||||||
|
libpng_la_LDFLAGS = -rpath '$(libdir)' -no-undefined -export-dynamic \
|
||||||
|
-version-number 2:@PNGLIB_RELEASE@:0
|
||||||
|
|
||||||
if HAVE_LD_VERSION_SCRIPT
|
if HAVE_LD_VERSION_SCRIPT
|
||||||
# Versioned symbols and restricted exports
|
# Versioned symbols and restricted exports
|
||||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -Wl,--version-script=libpng.vers
|
libpng10_la_LDFLAGS += -Wl,--version-script=libpng.vers
|
||||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.vers
|
libpng10_la_DEPENDENCIES = libpng.vers
|
||||||
else
|
else
|
||||||
# Only restricted exports when possible
|
# Only restricted exports when possible
|
||||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -export-symbols libpng.sym
|
libpng10_la_LDFLAGS += -export-symbols libpng.sym
|
||||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.sym
|
libpng10_la_DEPENDENCIES = libpng.sym
|
||||||
endif
|
endif
|
||||||
|
libpng_la_DEPENDENCIES = $(libpng10_la_DEPENDENCIES)
|
||||||
|
|
||||||
#distribute headers in /usr/include/libpng/*
|
#distribute headers in /usr/include/libpng/*
|
||||||
pkgincludedir= $(includedir)/$(PNGLIB_BASENAME)
|
pkgincludedir= $(includedir)/$(PNGLIB_BASENAME)
|
||||||
pkginclude_HEADERS= png.h pngconf.h
|
pkginclude_HEADERS= png.h pngconf.h
|
||||||
nodist_pkginclude_HEADERS= pnglibconf.h
|
|
||||||
|
|
||||||
# pkg-config stuff, note that libpng.pc is always required in order
|
# pkg-config stuff, note that libpng.pc is always required in order
|
||||||
# to get the correct library
|
# to get the correct library
|
||||||
pkgconfigdir = @pkgconfigdir@
|
pkgconfigdir = @pkgconfigdir@
|
||||||
pkgconfig_DATA = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc
|
pkgconfig_DATA = libpng10.pc
|
||||||
|
|
||||||
#extra source distribution files.
|
#extra source distribution files.
|
||||||
EXTRA_DIST= \
|
EXTRA_DIST= \
|
||||||
ANNOUNCE CHANGES INSTALL LICENSE README TODO \
|
ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO \
|
||||||
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
|
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
|
||||||
${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
|
${srcdir}/projects/cbuilder5/* \
|
||||||
|
${srcdir}/projects/beos/* \
|
||||||
|
${srcdir}/projects/visualc6/* \
|
||||||
|
${srcdir}/projects/visualc71/* \
|
||||||
|
${srcdir}/projects/wince.txt \
|
||||||
|
${srcdir}/projects/netware.txt \
|
||||||
|
${srcdir}/scripts/* \
|
||||||
|
${srcdir}/contrib/gregbook/* \
|
||||||
|
${srcdir}/contrib/pngminus/* \
|
||||||
|
${srcdir}/contrib/pngsuite/* \
|
||||||
|
${srcdir}/contrib/visupng/* \
|
||||||
$(TESTS) \
|
$(TESTS) \
|
||||||
CMakeLists.txt example.c libpng-manual.txt
|
example.c libpng.txt pngvcrd.c
|
||||||
|
|
||||||
SCRIPT_CLEANFILES=scripts/*.out scripts/*.chk scripts/pnglibconf.dfn
|
CLEANFILES= pngout.png libpng10.pc libpng10-config libpng.vers \
|
||||||
|
libpng.sym
|
||||||
CLEANFILES= dfn.c dfn?.out pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc \
|
|
||||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers libpng.sym \
|
|
||||||
check.new pnglibconf.* symbols.new pngtest-log.txt \
|
|
||||||
$(SCRIPT_CLEANFILES)
|
|
||||||
|
|
||||||
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
|
|
||||||
config.sub configure depcomp install-sh ltmain.sh missing
|
|
||||||
|
|
||||||
# DFNCPP is normally just CPP - the C preprocessor - but on Solaris and maybe
|
|
||||||
# other operating systems (NeXT?) the C preprocessor selected by configure
|
|
||||||
# checks input tokens for validity - effectively it performs part of the ANSI-C
|
|
||||||
# parsing - and therefore fails with the .df files. configure.ac has special
|
|
||||||
# checks for this and sets DFNCPP appropriately.
|
|
||||||
DFNCPP = @DFNCPP@
|
|
||||||
|
|
||||||
SUFFIXES = .chk .dfn .out
|
|
||||||
|
|
||||||
$(PNGLIB_BASENAME).pc: libpng.pc
|
$(PNGLIB_BASENAME).pc: libpng.pc
|
||||||
cp libpng.pc $@
|
cp libpng.pc $@
|
||||||
@@ -96,107 +94,38 @@ $(PNGLIB_BASENAME).pc: libpng.pc
|
|||||||
$(PNGLIB_BASENAME)-config: libpng-config
|
$(PNGLIB_BASENAME)-config: libpng-config
|
||||||
cp libpng-config $@
|
cp libpng-config $@
|
||||||
|
|
||||||
scripts/sym.out scripts/vers.out: png.h pngconf.h pnglibconf.h
|
libpng.sym: png.h pngconf.h
|
||||||
scripts/symbols.out: png.h pngconf.h scripts/pnglibconf.h.prebuilt
|
rm -f $@ $@.new
|
||||||
|
$(CPP) @LIBPNG_DEFINES@ $(CPPFLAGS) -DPNG_BUILDSYMS $(srcdir)/png.h | \
|
||||||
|
$(SED) -n -e 's|^.*PNG_FUNCTION_EXPORT[ ]*\([a-zA-Z0-9_]*\).*$$|\1|p' \
|
||||||
|
-e 's|^.*PNG_DATA_EXPORT[ ]*\([a-zA-Z0-9_]*\).*$$|\1|p' \
|
||||||
|
>$@.new
|
||||||
|
mv $@.new $@
|
||||||
|
|
||||||
libpng.sym: scripts/sym.out
|
libpng.vers: libpng.sym
|
||||||
rm -f $@
|
rm -f $@ $@.new
|
||||||
cp $? $@
|
$(ECHO) PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0 '{global:' > $@.new
|
||||||
libpng.vers: scripts/vers.out
|
$(SED) s/$$/\;/ libpng.sym >> $@.new
|
||||||
rm -f $@
|
$(ECHO) 'local: *; };' >> $@.new
|
||||||
cp $? $@
|
mv $@.new $@
|
||||||
pnglibconf.h: pnglibconf.out
|
|
||||||
rm -f $@
|
|
||||||
cp $? $@
|
|
||||||
scripts/pnglibconf.h.prebuilt:
|
|
||||||
@echo "This is a machine generated file, but if you want to make" >&2
|
|
||||||
@echo "a new one simply make 'scripts/pnglibconf.out' and copy that" >&2
|
|
||||||
@exit 1
|
|
||||||
|
|
||||||
# The following is necessary to ensure that the local pnglibconf.h is used, not
|
test: check
|
||||||
# an installed one (this can happen immediately after on a clean system if
|
|
||||||
# 'make test' is the first thing the user does.)
|
|
||||||
pngvalid.o pngtest.o: pnglibconf.h
|
|
||||||
|
|
||||||
# We must use -DPNG_NO_USE_READ_MACROS here even when the library may actually
|
|
||||||
# be built with PNG_USE_READ_MACROS; this stops the read macros interfering
|
|
||||||
# with the symbol file format.
|
|
||||||
SYMBOL_CFLAGS = -DPNGLIB_LIBNAME='PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0'\
|
|
||||||
-DPNGLIB_VERSION='@PNGLIB_VERSION@'\
|
|
||||||
-DSYMBOL_PREFIX='$(SYMBOL_PREFIX)'\
|
|
||||||
-DPNG_NO_USE_READ_MACROS -DPNG_BUILDING_SYMBOL_TABLE
|
|
||||||
|
|
||||||
.dfn.out:
|
|
||||||
rm -f $@ dfn.c dfn?.out
|
|
||||||
test -d scripts || mkdir scripts
|
|
||||||
echo '#include "$<"' >dfn.c
|
|
||||||
$(DFNCPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) @LIBPNG_DEFINES@\
|
|
||||||
$(CPPFLAGS) $(SYMBOL_CFLAGS) dfn.c > dfn1.out
|
|
||||||
$(SED) -n -e 's|^.*PNG_DEFN_MAGIC-\(.*\)-PNG_DEFN_END.*$$|\1|p'\
|
|
||||||
dfn1.out >dfn2.out
|
|
||||||
$(SED) -e 's| *@@@ *||g' -e 's| *$$||' dfn2.out >dfn3.out
|
|
||||||
rm -f dfn.c dfn[12].out
|
|
||||||
mv dfn3.out $@
|
|
||||||
|
|
||||||
# The .dfn file for pnglibconf.h is machine generated
|
|
||||||
pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk
|
|
||||||
rm -f $@ dfn?.out
|
|
||||||
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn1.out\
|
|
||||||
${srcdir}/scripts/pnglibconf.dfa $(DFA_XTRA) 1>&2
|
|
||||||
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn2.out dfn1.out 1>&2
|
|
||||||
rm dfn1.out
|
|
||||||
mv dfn2.out $@
|
|
||||||
|
|
||||||
# Symbol checks (.def and .out files should match)
|
|
||||||
scripts/symbols.chk: scripts/checksym.awk scripts/symbols.def scripts/symbols.out
|
|
||||||
.out.chk:
|
|
||||||
rm -f $@ symbols.new
|
|
||||||
$(AWK) -f ${srcdir}/scripts/checksym.awk ${srcdir}/scripts/${*F}.def\
|
|
||||||
$< >&2
|
|
||||||
mv symbols.new $@
|
|
||||||
|
|
||||||
# used on demand to regenerate the standard header, CPPFLAGS should
|
|
||||||
# be empty - no non-standard defines
|
|
||||||
scripts/pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk
|
|
||||||
rm -f $@ dfn?.out
|
|
||||||
test -z "$(CPPFLAGS)"
|
|
||||||
echo "com @PNGLIB_VERSION@ STANDARD API DEFINITION" |\
|
|
||||||
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn1.out\
|
|
||||||
logunsupported=2 - ${srcdir}/scripts/pnglibconf.dfa 1>&2
|
|
||||||
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn2.out dfn1.out 1>&2
|
|
||||||
rm dfn1.out
|
|
||||||
mv dfn2.out $@
|
|
||||||
|
|
||||||
$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS): png.h pngconf.h \
|
|
||||||
pnglibconf.h pngpriv.h pngdebug.h pnginfo.h pngstruct.h
|
|
||||||
|
|
||||||
test: check-am
|
|
||||||
|
|
||||||
# Extra checks
|
|
||||||
check: scripts/symbols.chk
|
|
||||||
|
|
||||||
# Don't distribute the generated script files
|
|
||||||
dist-hook:
|
|
||||||
cd '$(top_distdir)'; rm -f $(SCRIPT_CLEANFILES)
|
|
||||||
|
|
||||||
# install the .../include headers as links to the new ones
|
# install the .../include headers as links to the new ones
|
||||||
install-data-hook:
|
install-data-hook:
|
||||||
cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h pnglibconf.h
|
cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h
|
||||||
cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/png.h png.h
|
cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/png.h png.h
|
||||||
cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/pngconf.h \
|
cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/pngconf.h pngconf.h
|
||||||
pngconf.h
|
|
||||||
cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/pnglibconf.h \
|
|
||||||
pnglibconf.h
|
|
||||||
cd $(DESTDIR)$(pkgconfigdir); rm -f libpng.pc
|
cd $(DESTDIR)$(pkgconfigdir); rm -f libpng.pc
|
||||||
cd $(DESTDIR)$(pkgconfigdir); $(LN_S) $(PNGLIB_BASENAME).pc libpng.pc
|
cd $(DESTDIR)$(pkgconfigdir); $(LN_S) $(PNGLIB_BASENAME).pc libpng.pc
|
||||||
|
|
||||||
# do evil things to libpng to cause libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ to be used
|
# do evil things to libpng to cause libpng10 to be used
|
||||||
install-exec-hook:
|
install-exec-hook:
|
||||||
cd $(DESTDIR)$(bindir); rm -f libpng-config
|
cd $(DESTDIR)$(bindir); rm -f libpng-config
|
||||||
cd $(DESTDIR)$(bindir); $(LN_S) $(PNGLIB_BASENAME)-config libpng-config
|
cd $(DESTDIR)$(bindir); $(LN_S) $(PNGLIB_BASENAME)-config libpng-config
|
||||||
@set -x;\
|
@set -x;\
|
||||||
cd $(DESTDIR)$(libdir);\
|
cd $(DESTDIR)$(libdir);\
|
||||||
for ext in a la so so.@PNGLIB_MAJOR@@PNGLIB_MINOR@.@PNGLIB_RELEASE@ sl dylib dll.a; do\
|
for ext in a la so sl dylib; do\
|
||||||
rm -f libpng.$$ext;\
|
rm -f libpng.$$ext;\
|
||||||
if test -f $(PNGLIB_BASENAME).$$ext; then\
|
if test -f $(PNGLIB_BASENAME).$$ext; then\
|
||||||
$(LN_S) $(PNGLIB_BASENAME).$$ext libpng.$$ext;\
|
$(LN_S) $(PNGLIB_BASENAME).$$ext libpng.$$ext;\
|
||||||
@@ -204,8 +133,13 @@ install-exec-hook:
|
|||||||
done
|
done
|
||||||
|
|
||||||
uninstall-hook:
|
uninstall-hook:
|
||||||
cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h pnglibconf.h
|
cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h
|
||||||
rm -f $(DESTDIR)$(pkgconfigdir)/libpng.pc
|
rm -f $(DESTDIR)$(pkgconfigdir)/libpng.pc
|
||||||
rm -f $(DESTDIR)$(bindir)/libpng-config
|
rm -f $(DESTDIR)$(bindir)/libpng-config
|
||||||
rm -f $(DESTDIR)$(libdir)/libpng.a
|
@if test -n "@compatlib@"; then\
|
||||||
rm -f $(DESTDIR)$(libdir)/libpng.la
|
set -x;\
|
||||||
|
cd $(DESTDIR)$(libdir);\
|
||||||
|
for ext in a la so sl dylib; do\
|
||||||
|
rm -f libpng.$$ext;\
|
||||||
|
done;\
|
||||||
|
fi
|
||||||
|
|||||||
1296
Makefile.in
126
README
@@ -1,11 +1,11 @@
|
|||||||
README for libpng version 1.5.2 - March 31, 2011 (shared library 15.0)
|
README for libpng version 1.0.29rc2 - September 26, 2007 (shared library 10.0)
|
||||||
See the note about version numbers near the top of png.h
|
See the note about version numbers near the top of png.h
|
||||||
|
|
||||||
See INSTALL for instructions on how to install libpng.
|
See INSTALL for instructions on how to install libpng.
|
||||||
|
|
||||||
Libpng comes in several distribution formats. Get libpng-*.tar.gz,
|
Libpng comes in several distribution formats. Get libpng-*.tar.gz
|
||||||
libpng-*.tar.xz or libpng-*.tar.bz2 if you want UNIX-style line endings
|
or libpng-*.tar.bz2 if you want UNIX-style line endings in the text
|
||||||
in the text files, or lpng*.zip if you want DOS-style line endings.
|
files, or lpng*.zip if you want DOS-style line endings.
|
||||||
|
|
||||||
Version 0.89 was the first official release of libpng. Don't let the
|
Version 0.89 was the first official release of libpng. Don't let the
|
||||||
fact that it's the first release fool you. The libpng library has been in
|
fact that it's the first release fool you. The libpng library has been in
|
||||||
@@ -54,11 +54,11 @@ to set different actions based on whether the CRC error occurred in a
|
|||||||
critical or an ancillary chunk.
|
critical or an ancillary chunk.
|
||||||
|
|
||||||
The changes made to the library, and bugs fixed are based on discussions
|
The changes made to the library, and bugs fixed are based on discussions
|
||||||
on the PNG-implement mailing list and not on material submitted
|
on the PNG-implement mailing list
|
||||||
privately to Guy, Andreas, or Glenn. They will forward any good
|
and not on material submitted privately to Guy, Andreas, or Glenn. They will
|
||||||
suggestions to the list.
|
forward any good suggestions to the list.
|
||||||
|
|
||||||
For a detailed description on using libpng, read libpng-manual.txt. For
|
For a detailed description on using libpng, read libpng.txt. For
|
||||||
examples of libpng in a program, see example.c and pngtest.c. For usage
|
examples of libpng in a program, see example.c and pngtest.c. For usage
|
||||||
information and restrictions (what little they are) on libpng, see
|
information and restrictions (what little they are) on libpng, see
|
||||||
png.h. For a description on using zlib (the compression library used by
|
png.h. For a description on using zlib (the compression library used by
|
||||||
@@ -101,17 +101,16 @@ Finally, if you get any warning messages when compiling libpng
|
|||||||
fix. Please mention "libpng" somewhere in the subject line. Thanks.
|
fix. Please mention "libpng" somewhere in the subject line. Thanks.
|
||||||
|
|
||||||
This release was created and will be supported by myself (of course
|
This release was created and will be supported by myself (of course
|
||||||
based in a large way on Guy's and Andreas' earlier work), and the PNG
|
based in a large way on Guy's and Andreas' earlier work), and the PNG group.
|
||||||
development group.
|
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
lists.sourceforge.net (subscription required; visit
|
(subscription required; visit
|
||||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||||
to subscribe) or to glennrp at users.sourceforge.net
|
to subscribe) or to glennrp at users.sourceforge.net
|
||||||
|
|
||||||
You can't reach Guy, the original libpng author, at the addresses
|
You can't reach Guy, the original libpng author, at the addresses
|
||||||
given in previous versions of this document. He and Andreas will
|
given in previous versions of this document. He and Andreas will read mail
|
||||||
read mail addressed to the png-implement list, however.
|
addressed to the png-implement list, however.
|
||||||
|
|
||||||
Please do not send general questions about PNG. Send them to
|
Please do not send general questions about PNG. Send them to
|
||||||
the (png-list at ccrc.wustl.edu, subscription required, write to
|
the (png-list at ccrc.wustl.edu, subscription required, write to
|
||||||
@@ -141,17 +140,14 @@ Files in this distribution:
|
|||||||
TODO => Things not implemented in the current library
|
TODO => Things not implemented in the current library
|
||||||
Y2KINFO => Statement of Y2K compliance
|
Y2KINFO => Statement of Y2K compliance
|
||||||
example.c => Example code for using libpng functions
|
example.c => Example code for using libpng functions
|
||||||
libpng.3 => manual page for libpng (includes libpng-manual.txt)
|
libpng.3 => manual page for libpng (includes libpng.txt)
|
||||||
libpng-manual.txt => Description of libpng and its functions
|
libpng.txt => Description of libpng and its functions
|
||||||
libpngpf.3 => manual page for libpng's private functions
|
libpngpf.3 => manual page for libpng's private functions
|
||||||
png.5 => manual page for the PNG format
|
png.5 => manual page for the PNG format
|
||||||
png.c => Basic interface functions common to library
|
png.c => Basic interface functions common to library
|
||||||
png.h => Library function and interface declarations (public)
|
png.h => Library function and interface declarations
|
||||||
pngpriv.h => Library function and interface declarations (private)
|
pngconf.h => System specific library configuration
|
||||||
pngconf.h => System specific library configuration (public)
|
pngasmrd.h => Header file for assembler-coded functions
|
||||||
pngstruct.h => png_struct declaration (private)
|
|
||||||
pnginfo.h => png_info struct declaration (private)
|
|
||||||
pngdebug.h => debugging macros (private)
|
|
||||||
pngerror.c => Error/warning message I/O functions
|
pngerror.c => Error/warning message I/O functions
|
||||||
pngget.c => Functions for retrieving info from struct
|
pngget.c => Functions for retrieving info from struct
|
||||||
pngmem.c => Memory handling functions
|
pngmem.c => Memory handling functions
|
||||||
@@ -178,22 +174,84 @@ Files in this distribution:
|
|||||||
pngminus => Simple pnm2png and png2pnm programs
|
pngminus => Simple pnm2png and png2pnm programs
|
||||||
pngsuite => Test images
|
pngsuite => Test images
|
||||||
visupng => Contains a MSVC workspace for VisualPng
|
visupng => Contains a MSVC workspace for VisualPng
|
||||||
projects => Contains project files and workspaces for
|
projects => Contains project files and workspaces for building DLL
|
||||||
building a DLL
|
beos => Contains a Beos workspace for building libpng
|
||||||
cbuilder5 => Contains a Borland workspace for building
|
c5builder => Contains a Borland workspace for building libpng
|
||||||
libpng and zlib
|
and zlib
|
||||||
visualc6 => Contains a Microsoft Visual C++ (MSVC)
|
visualc6 => Contains a Microsoft Visual C++ (MSVC) workspace
|
||||||
workspace for building libpng and zlib
|
for building libpng and zlib
|
||||||
visualc71 => Contains a Microsoft Visual C++ (MSVC)
|
netware.txt => Contains instructions for downloading a set of
|
||||||
workspace for building libpng and zlib
|
project files for building libpng and zlib on
|
||||||
xcode => Contains an Apple xcode
|
Netware.
|
||||||
workspace for building libpng and zlib
|
wince.txt => Contains instructions for downloading a Microsoft
|
||||||
|
Visual C++ (Windows CD Toolkit) workspace for
|
||||||
|
building libpng and zlib on WindowsCE
|
||||||
scripts => Directory containing scripts for building libpng:
|
scripts => Directory containing scripts for building libpng:
|
||||||
(see scripts/README.txt for the list of scripts)
|
descrip.mms => VMS makefile for MMS or MMK
|
||||||
|
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
||||||
|
makefile.elf => Linux/ELF makefile symbol versioning,
|
||||||
|
gcc, creates libpng10.so.0.1.0.29rc2)
|
||||||
|
makefile.linux => Linux/ELF makefile
|
||||||
|
(gcc, creates libpng10.so.0.1.0.29rc2)
|
||||||
|
makefile.gcmmx => Linux/ELF makefile
|
||||||
|
(gcc, creates libpng10.so.0.1.0.29rc2,
|
||||||
|
uses assembler code tuned for Intel MMX platform)
|
||||||
|
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
||||||
|
makefile.knr => Archaic UNIX Makefile that converts files with
|
||||||
|
ansi2knr (Requires ansi2knr.c from
|
||||||
|
ftp://ftp.cs.wisc.edu/ghost)
|
||||||
|
makefile.aix => AIX makefile
|
||||||
|
makefile.cygwin => Cygwin/gcc makefile
|
||||||
|
makefile.darwin => Darwin makefile
|
||||||
|
makefile.dec => DEC Alpha UNIX makefile
|
||||||
|
makefile.freebsd => FreeBSD makefile
|
||||||
|
makefile.hpgcc => HPUX makefile using gcc
|
||||||
|
makefile.hpux => HPUX (10.20 and 11.00) makefile
|
||||||
|
makefile.hp64 => HPUX (10.20 and 11.00) makefile, 64 bit
|
||||||
|
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
|
||||||
|
makefile.intel => Intel C/C++ version 4.0 and later
|
||||||
|
libpng.icc => Project file, IBM VisualAge/C++ 4.0 or later
|
||||||
|
makefile.netbsd => NetBSD/cc makefile, PNGGCCRD, makes libpng.so.
|
||||||
|
makefile.ne10bsd => NetBSD/cc makefile, PNGGCCRD, makes libpng10.so
|
||||||
|
makefile.openbsd => OpenBSD makefile
|
||||||
|
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
|
||||||
|
makefile.sggcc => Silicon Graphics
|
||||||
|
(gcc, creates libpng10.so.0.1.0.29rc2)
|
||||||
|
makefile.sunos => Sun makefile
|
||||||
|
makefile.solaris => Solaris 2.X makefile
|
||||||
|
(gcc, creates libpng10.so.0.1.0.29rc2)
|
||||||
|
makefile.so9 => Solaris 9 makefile
|
||||||
|
(gcc, creates libpng10.so.0.1.0.29rc2)
|
||||||
|
makefile.32sunu => Sun Ultra 32-bit makefile
|
||||||
|
makefile.64sunu => Sun Ultra 64-bit makefile
|
||||||
|
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||||
|
makefile.mips => MIPS makefile
|
||||||
|
makefile.acorn => Acorn makefile
|
||||||
|
makefile.amiga => Amiga makefile
|
||||||
|
smakefile.ppc => AMIGA smakefile for SAS C V6.58/7.00 PPC
|
||||||
|
compiler (Requires SCOPTIONS, copied from
|
||||||
|
scripts/SCOPTIONS.ppc)
|
||||||
|
makefile.atari => Atari makefile
|
||||||
|
makefile.beos => BEOS makefile for X86
|
||||||
|
makefile.bor => Borland makefile (uses bcc)
|
||||||
|
makefile.bc32 => 32-bit Borland C++ (all modules compiled in C mode)
|
||||||
|
makefile.tc3 => Turbo C 3.0 makefile
|
||||||
|
makefile.dj2 => DJGPP 2 makefile
|
||||||
|
makefile.msc => Microsoft C makefile
|
||||||
|
makefile.vcawin32=> makefile for Microsoft Visual C++ 5.0 and
|
||||||
|
later (uses assembler code tuned for Intel MMX
|
||||||
|
platform)
|
||||||
|
makefile.vcwin32 => makefile for Microsoft Visual C++ 4.0 and
|
||||||
|
later (does not use assembler code)
|
||||||
|
makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def)
|
||||||
|
pngos2.def => OS/2 module definition file used by makefile.os2
|
||||||
|
makefile.watcom => Watcom 10a+ Makefile, 32-bit flat memory model
|
||||||
|
makevms.com => VMS build script
|
||||||
|
SCOPTIONS.ppc => Used with smakefile.ppc
|
||||||
|
|
||||||
Good luck, and happy coding.
|
Good luck, and happy coding.
|
||||||
|
|
||||||
-Glenn Randers-Pehrson (current maintainer, since 1998)
|
-Glenn Randers-Pehrson (current maintainer)
|
||||||
Internet: glennrp at users.sourceforge.net
|
Internet: glennrp at users.sourceforge.net
|
||||||
|
|
||||||
-Andreas Eric Dilger (former maintainer, 1996-1997)
|
-Andreas Eric Dilger (former maintainer, 1996-1997)
|
||||||
|
|||||||
13
TODO
@@ -1,11 +1,12 @@
|
|||||||
/*
|
|
||||||
TODO - list of things to do for libpng:
|
TODO - list of things to do for libpng:
|
||||||
|
|
||||||
Final bug fixes.
|
Final bug fixes.
|
||||||
|
Improve API by hiding the png_struct and png_info structs.
|
||||||
|
Finish work on the no-floating-point version (including gamma compensation)
|
||||||
Better C++ wrapper/full C++ implementation?
|
Better C++ wrapper/full C++ implementation?
|
||||||
Fix problem with C++ and EXTERN "C".
|
Fix problem with C++ and EXTERN "C".
|
||||||
cHRM transformation.
|
cHRM transformation.
|
||||||
Remove setjmp/longjmp usage in favor of returning error codes.
|
Improve setjmp/longjmp usage or remove it in favor of returning error codes.
|
||||||
Add "grayscale->palette" transformation and "palette->grayscale" detection.
|
Add "grayscale->palette" transformation and "palette->grayscale" detection.
|
||||||
Improved dithering.
|
Improved dithering.
|
||||||
Multi-lingual error and warning message support.
|
Multi-lingual error and warning message support.
|
||||||
@@ -16,12 +17,8 @@ Better filter selection
|
|||||||
(counting huffman bits/precompression? filter inertia? filter costs?).
|
(counting huffman bits/precompression? filter inertia? filter costs?).
|
||||||
Histogram creation.
|
Histogram creation.
|
||||||
Text conversion between different code pages (Latin-1 -> Mac and DOS).
|
Text conversion between different code pages (Latin-1 -> Mac and DOS).
|
||||||
Avoid building gamma tables whenever possible.
|
Should we always malloc 2^bit_depth PLTE/tRNS/hIST entries for safety?
|
||||||
|
Build gamma tables using fixed point (and do away with floating point entirely).
|
||||||
Use greater precision when changing to linear gamma for compositing against
|
Use greater precision when changing to linear gamma for compositing against
|
||||||
background and doing rgb-to-gray transformation.
|
background and doing rgb-to-gray transformation.
|
||||||
Investigate pre-incremented loop counters and other loop constructions.
|
Investigate pre-incremented loop counters and other loop constructions.
|
||||||
Add interpolated method of handling interlacing.
|
|
||||||
Switch to the simpler zlib (zlib/libpng) license if legally possible.
|
|
||||||
Extend pngvalid.c to validate more of the libpng transformations.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|||||||
55
Y2KINFO
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
Y2K compliance in libpng:
|
||||||
|
=========================
|
||||||
|
|
||||||
|
September 26, 2007
|
||||||
|
|
||||||
|
Since the PNG Development group is an ad-hoc body, we can't make
|
||||||
|
an official declaration.
|
||||||
|
|
||||||
|
This is your unofficial assurance that libpng from version 0.71 and
|
||||||
|
upward through 1.0.29rc2 are Y2K compliant. It is my belief that earlier
|
||||||
|
versions were also Y2K compliant.
|
||||||
|
|
||||||
|
Libpng only has three year fields. One is a 2-byte unsigned integer
|
||||||
|
that will hold years up to 65535. The other two hold the date in text
|
||||||
|
format, and will hold years up to 9999.
|
||||||
|
|
||||||
|
The integer is
|
||||||
|
"png_uint_16 year" in png_time_struct.
|
||||||
|
|
||||||
|
The strings are
|
||||||
|
"png_charp time_buffer" in png_struct and
|
||||||
|
"near_time_buffer", which is a local character string in png.c.
|
||||||
|
|
||||||
|
There are seven time-related functions:
|
||||||
|
|
||||||
|
png_convert_to_rfc_1123() in png.c
|
||||||
|
(formerly png_convert_to_rfc_1152() in error)
|
||||||
|
png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c
|
||||||
|
png_convert_from_time_t() in pngwrite.c
|
||||||
|
png_get_tIME() in pngget.c
|
||||||
|
png_handle_tIME() in pngrutil.c, called in pngread.c
|
||||||
|
png_set_tIME() in pngset.c
|
||||||
|
png_write_tIME() in pngwutil.c, called in pngwrite.c
|
||||||
|
|
||||||
|
All appear to handle dates properly in a Y2K environment. The
|
||||||
|
png_convert_from_time_t() function calls gmtime() to convert from system
|
||||||
|
clock time, which returns (year - 1900), which we properly convert to
|
||||||
|
the full 4-digit year. There is a possibility that applications using
|
||||||
|
libpng are not passing 4-digit years into the png_convert_to_rfc_1123()
|
||||||
|
function, or that they are incorrectly passing only a 2-digit year
|
||||||
|
instead of "year - 1900" into the png_convert_from_struct_tm() function,
|
||||||
|
but this is not under our control. The libpng documentation has always
|
||||||
|
stated that it works with 4-digit years, and the APIs have been
|
||||||
|
documented as such.
|
||||||
|
|
||||||
|
The tIME chunk itself is also Y2K compliant. It uses a 2-byte unsigned
|
||||||
|
integer to hold the year, and can hold years as large as 65535.
|
||||||
|
|
||||||
|
zlib, upon which libpng depends, is also Y2K compliant. It contains
|
||||||
|
no date-related code.
|
||||||
|
|
||||||
|
|
||||||
|
Glenn Randers-Pehrson
|
||||||
|
libpng maintainer
|
||||||
|
PNG Development Group
|
||||||
10536
aclocal.m4
vendored
35
autogen.sh
@@ -4,31 +4,22 @@
|
|||||||
#
|
#
|
||||||
# WARNING: if you run this you will change the versions
|
# WARNING: if you run this you will change the versions
|
||||||
# of the tools which are used and, maybe, required!
|
# of the tools which are used and, maybe, required!
|
||||||
|
touch Makefile.am configure.ac
|
||||||
# You can define your own replacements in your environment.
|
|
||||||
# $AUTOCONF, $AUTOMAKE, $AUTOHEADER, $AUTOPOINT, $ACLOCAL and $LIBTOOLIZE
|
|
||||||
|
|
||||||
touch Makefile.am configure.ac
|
|
||||||
{
|
{
|
||||||
LT=${LIBTOOLIZE-libtoolize}
|
echo "running libtoolize" >&2
|
||||||
echo "running $LT" >&2
|
libtoolize --copy --automake
|
||||||
$LT --force --copy --automake
|
|
||||||
} && {
|
} && {
|
||||||
AL=${ACLOCAL-aclocal}
|
echo "running aclocal" >&2
|
||||||
echo "running $AL" >&2
|
aclocal
|
||||||
$AL
|
|
||||||
} && {
|
} && {
|
||||||
AH=${AUTOHEADER-autoheader}
|
echo "running autoheader [ignore the warnings]" >&2
|
||||||
echo "running $AH [ignore the warnings]" >&2
|
autoheader
|
||||||
$AH
|
|
||||||
} && {
|
} && {
|
||||||
AM=${AUTOMAKE-automake}
|
echo "running automake" >&2
|
||||||
echo "running $AM" >&2
|
automake --foreign -a -c
|
||||||
$AM --force-missing --foreign -a -c
|
|
||||||
} && {
|
} && {
|
||||||
AC=${AUTOCONF-autoconf}
|
echo "running autoconf" >&2
|
||||||
echo "running $AC" >&2
|
autoconf
|
||||||
$AC
|
|
||||||
} &&
|
} &&
|
||||||
echo "autogen complete" >&2 ||
|
echo "autogen complete" >&2 ||
|
||||||
echo "ERROR: autogen.sh failed, autogen is incomplete" >&2
|
echo "ERROR: autogen.sh failed, autogen is incomplete" >&2
|
||||||
|
|||||||
376
config.guess
vendored
Normal file → Executable file
@@ -1,10 +1,9 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Attempt to guess a canonical system name.
|
# Attempt to guess a canonical system name.
|
||||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
timestamp='2009-11-20'
|
timestamp='2005-12-23'
|
||||||
|
|
||||||
# This file is free software; you can redistribute it and/or modify it
|
# This file is free software; you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU General Public License as published by
|
# under the terms of the GNU General Public License as published by
|
||||||
@@ -27,16 +26,16 @@ timestamp='2009-11-20'
|
|||||||
# the same distribution terms that you use for the rest of that program.
|
# the same distribution terms that you use for the rest of that program.
|
||||||
|
|
||||||
|
|
||||||
# Originally written by Per Bothner. Please send patches (context
|
# Originally written by Per Bothner <per@bothner.com>.
|
||||||
# diff format) to <config-patches@gnu.org> and include a ChangeLog
|
# Please send patches to <config-patches@gnu.org>. Submit a context
|
||||||
# entry.
|
# diff and a properly formatted ChangeLog entry.
|
||||||
#
|
#
|
||||||
# This script attempts to guess a canonical system name similar to
|
# This script attempts to guess a canonical system name similar to
|
||||||
# config.sub. If it succeeds, it prints the system name on stdout, and
|
# config.sub. If it succeeds, it prints the system name on stdout, and
|
||||||
# exits with 0. Otherwise, it exits with 1.
|
# exits with 0. Otherwise, it exits with 1.
|
||||||
#
|
#
|
||||||
# You can get the latest version of this script from:
|
# The plan is that this can be called by configure scripts if you
|
||||||
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
|
# don't specify an explicit build system type.
|
||||||
|
|
||||||
me=`echo "$0" | sed -e 's,.*/,,'`
|
me=`echo "$0" | sed -e 's,.*/,,'`
|
||||||
|
|
||||||
@@ -56,8 +55,8 @@ version="\
|
|||||||
GNU config.guess ($timestamp)
|
GNU config.guess ($timestamp)
|
||||||
|
|
||||||
Originally written by Per Bothner.
|
Originally written by Per Bothner.
|
||||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
|
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
||||||
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This is free software; see the source for copying conditions. There is NO
|
This is free software; see the source for copying conditions. There is NO
|
||||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||||
@@ -107,7 +106,7 @@ set_cc_for_build='
|
|||||||
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
|
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
|
||||||
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
|
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
|
||||||
: ${TMPDIR=/tmp} ;
|
: ${TMPDIR=/tmp} ;
|
||||||
{ tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
|
{ tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
|
||||||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
|
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
|
||||||
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
|
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
|
||||||
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
|
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
|
||||||
@@ -139,6 +138,23 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
|
|||||||
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
|
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
|
||||||
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
|
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
|
||||||
|
|
||||||
|
if [ "${UNAME_SYSTEM}" = "Linux" ] ; then
|
||||||
|
eval $set_cc_for_build
|
||||||
|
cat << EOF > $dummy.c
|
||||||
|
#include <features.h>
|
||||||
|
#ifdef __UCLIBC__
|
||||||
|
# ifdef __UCLIBC_CONFIG_VERSION__
|
||||||
|
LIBC=uclibc __UCLIBC_CONFIG_VERSION__
|
||||||
|
# else
|
||||||
|
LIBC=uclibc
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
LIBC=gnu
|
||||||
|
#endif
|
||||||
|
EOF
|
||||||
|
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep LIBC= | sed -e 's: ::g'`
|
||||||
|
fi
|
||||||
|
|
||||||
# Note: order is significant - the case branches are not exclusive.
|
# Note: order is significant - the case branches are not exclusive.
|
||||||
|
|
||||||
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||||
@@ -161,7 +177,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
arm*) machine=arm-unknown ;;
|
arm*) machine=arm-unknown ;;
|
||||||
sh3el) machine=shl-unknown ;;
|
sh3el) machine=shl-unknown ;;
|
||||||
sh3eb) machine=sh-unknown ;;
|
sh3eb) machine=sh-unknown ;;
|
||||||
sh5el) machine=sh5le-unknown ;;
|
|
||||||
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
|
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
|
||||||
esac
|
esac
|
||||||
# The Operating System including object format, if it has switched
|
# The Operating System including object format, if it has switched
|
||||||
@@ -170,7 +185,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
|
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
|
||||||
eval $set_cc_for_build
|
eval $set_cc_for_build
|
||||||
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||||
| grep -q __ELF__
|
| grep __ELF__ >/dev/null
|
||||||
then
|
then
|
||||||
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
|
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
|
||||||
# Return netbsd for either. FIX?
|
# Return netbsd for either. FIX?
|
||||||
@@ -208,11 +223,8 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
*:ekkoBSD:*:*)
|
*:ekkoBSD:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
|
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
*:SolidBSD:*:*)
|
|
||||||
echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
|
|
||||||
exit ;;
|
|
||||||
macppc:MirBSD:*:*)
|
macppc:MirBSD:*:*)
|
||||||
echo powerpc-unknown-mirbsd${UNAME_RELEASE}
|
echo powerppc-unknown-mirbsd${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
*:MirBSD:*:*)
|
*:MirBSD:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
|
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
|
||||||
@@ -324,33 +336,14 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
case `/usr/bin/uname -p` in
|
case `/usr/bin/uname -p` in
|
||||||
sparc) echo sparc-icl-nx7; exit ;;
|
sparc) echo sparc-icl-nx7; exit ;;
|
||||||
esac ;;
|
esac ;;
|
||||||
s390x:SunOS:*:*)
|
|
||||||
echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
|
||||||
exit ;;
|
|
||||||
sun4H:SunOS:5.*:*)
|
sun4H:SunOS:5.*:*)
|
||||||
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||||
exit ;;
|
exit ;;
|
||||||
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
|
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
|
||||||
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||||
exit ;;
|
exit ;;
|
||||||
i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
|
i86pc:SunOS:5.*:*)
|
||||||
echo i386-pc-auroraux${UNAME_RELEASE}
|
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||||
exit ;;
|
|
||||||
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
|
|
||||||
eval $set_cc_for_build
|
|
||||||
SUN_ARCH="i386"
|
|
||||||
# If there is a compiler, see if it is configured for 64-bit objects.
|
|
||||||
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
|
|
||||||
# This test works for both compilers.
|
|
||||||
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
|
|
||||||
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
|
|
||||||
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
|
|
||||||
grep IS_64BIT_ARCH >/dev/null
|
|
||||||
then
|
|
||||||
SUN_ARCH="x86_64"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
|
||||||
exit ;;
|
exit ;;
|
||||||
sun4*:SunOS:6*:*)
|
sun4*:SunOS:6*:*)
|
||||||
# According to config.sub, this is the proper way to canonicalize
|
# According to config.sub, this is the proper way to canonicalize
|
||||||
@@ -551,7 +544,7 @@ EOF
|
|||||||
echo rs6000-ibm-aix3.2
|
echo rs6000-ibm-aix3.2
|
||||||
fi
|
fi
|
||||||
exit ;;
|
exit ;;
|
||||||
*:AIX:*:[456])
|
*:AIX:*:[45])
|
||||||
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
|
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
|
||||||
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
|
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
|
||||||
IBM_ARCH=rs6000
|
IBM_ARCH=rs6000
|
||||||
@@ -659,7 +652,7 @@ EOF
|
|||||||
# => hppa64-hp-hpux11.23
|
# => hppa64-hp-hpux11.23
|
||||||
|
|
||||||
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
|
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
|
||||||
grep -q __LP64__
|
grep __LP64__ >/dev/null
|
||||||
then
|
then
|
||||||
HP_ARCH="hppa2.0w"
|
HP_ARCH="hppa2.0w"
|
||||||
else
|
else
|
||||||
@@ -791,8 +784,6 @@ EOF
|
|||||||
case ${UNAME_MACHINE} in
|
case ${UNAME_MACHINE} in
|
||||||
pc98)
|
pc98)
|
||||||
echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||||
amd64)
|
|
||||||
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
|
||||||
*)
|
*)
|
||||||
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||||
esac
|
esac
|
||||||
@@ -800,7 +791,7 @@ EOF
|
|||||||
i*:CYGWIN*:*)
|
i*:CYGWIN*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-cygwin
|
echo ${UNAME_MACHINE}-pc-cygwin
|
||||||
exit ;;
|
exit ;;
|
||||||
*:MINGW*:*)
|
i*:MINGW*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-mingw32
|
echo ${UNAME_MACHINE}-pc-mingw32
|
||||||
exit ;;
|
exit ;;
|
||||||
i*:windows32*:*)
|
i*:windows32*:*)
|
||||||
@@ -810,24 +801,12 @@ EOF
|
|||||||
i*:PW*:*)
|
i*:PW*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-pw32
|
echo ${UNAME_MACHINE}-pc-pw32
|
||||||
exit ;;
|
exit ;;
|
||||||
*:Interix*:*)
|
x86:Interix*:[345]*)
|
||||||
case ${UNAME_MACHINE} in
|
echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
|
||||||
x86)
|
exit ;;
|
||||||
echo i586-pc-interix${UNAME_RELEASE}
|
|
||||||
exit ;;
|
|
||||||
authenticamd | genuineintel | EM64T)
|
|
||||||
echo x86_64-unknown-interix${UNAME_RELEASE}
|
|
||||||
exit ;;
|
|
||||||
IA64)
|
|
||||||
echo ia64-unknown-interix${UNAME_RELEASE}
|
|
||||||
exit ;;
|
|
||||||
esac ;;
|
|
||||||
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
|
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
|
||||||
echo i${UNAME_MACHINE}-pc-mks
|
echo i${UNAME_MACHINE}-pc-mks
|
||||||
exit ;;
|
exit ;;
|
||||||
8664:Windows_NT:*)
|
|
||||||
echo x86_64-pc-mks
|
|
||||||
exit ;;
|
|
||||||
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
|
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
|
||||||
# How do we know it's Interix rather than the generic POSIX subsystem?
|
# How do we know it's Interix rather than the generic POSIX subsystem?
|
||||||
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
|
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
|
||||||
@@ -857,6 +836,74 @@ EOF
|
|||||||
i*86:Minix:*:*)
|
i*86:Minix:*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-minix
|
echo ${UNAME_MACHINE}-pc-minix
|
||||||
exit ;;
|
exit ;;
|
||||||
|
arm*:Linux:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||||
|
exit ;;
|
||||||
|
cris:Linux:*:*)
|
||||||
|
echo cris-axis-linux-${LIBC}
|
||||||
|
exit ;;
|
||||||
|
crisv32:Linux:*:*)
|
||||||
|
echo crisv32-axis-linux-${LIBC}
|
||||||
|
exit ;;
|
||||||
|
frv:Linux:*:*)
|
||||||
|
echo frv-unknown-linux-${LIBC}
|
||||||
|
exit ;;
|
||||||
|
ia64:Linux:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||||
|
exit ;;
|
||||||
|
m32r*:Linux:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||||
|
exit ;;
|
||||||
|
m68*:Linux:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||||
|
exit ;;
|
||||||
|
mips:Linux:*:*)
|
||||||
|
eval $set_cc_for_build
|
||||||
|
sed 's/^ //' << EOF >$dummy.c
|
||||||
|
#undef CPU
|
||||||
|
#undef mips
|
||||||
|
#undef mipsel
|
||||||
|
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
|
||||||
|
CPU=mipsel
|
||||||
|
#else
|
||||||
|
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
|
||||||
|
CPU=mips
|
||||||
|
#else
|
||||||
|
CPU=
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
EOF
|
||||||
|
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`"
|
||||||
|
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
|
||||||
|
;;
|
||||||
|
mips64:Linux:*:*)
|
||||||
|
eval $set_cc_for_build
|
||||||
|
sed 's/^ //' << EOF >$dummy.c
|
||||||
|
#undef CPU
|
||||||
|
#undef mips64
|
||||||
|
#undef mips64el
|
||||||
|
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
|
||||||
|
CPU=mips64el
|
||||||
|
#else
|
||||||
|
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
|
||||||
|
CPU=mips64
|
||||||
|
#else
|
||||||
|
CPU=
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
EOF
|
||||||
|
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`"
|
||||||
|
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
|
||||||
|
;;
|
||||||
|
or32:Linux:*:*)
|
||||||
|
echo or32-unknown-linux-${LIBC}
|
||||||
|
exit ;;
|
||||||
|
ppc:Linux:*:*)
|
||||||
|
echo powerpc-unknown-linux-${LIBC}
|
||||||
|
exit ;;
|
||||||
|
ppc64:Linux:*:*)
|
||||||
|
echo powerpc64-unknown-linux-${LIBC}
|
||||||
|
exit ;;
|
||||||
alpha:Linux:*:*)
|
alpha:Linux:*:*)
|
||||||
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
|
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
|
||||||
EV5) UNAME_MACHINE=alphaev5 ;;
|
EV5) UNAME_MACHINE=alphaev5 ;;
|
||||||
@@ -867,115 +914,100 @@ EOF
|
|||||||
EV67) UNAME_MACHINE=alphaev67 ;;
|
EV67) UNAME_MACHINE=alphaev67 ;;
|
||||||
EV68*) UNAME_MACHINE=alphaev68 ;;
|
EV68*) UNAME_MACHINE=alphaev68 ;;
|
||||||
esac
|
esac
|
||||||
objdump --private-headers /bin/sh | grep -q ld.so.1
|
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
|
||||||
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
|
if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
|
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||||
exit ;;
|
|
||||||
arm*:Linux:*:*)
|
|
||||||
eval $set_cc_for_build
|
|
||||||
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
|
||||||
| grep -q __ARM_EABI__
|
|
||||||
then
|
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
|
||||||
else
|
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
|
|
||||||
fi
|
|
||||||
exit ;;
|
|
||||||
avr32*:Linux:*:*)
|
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
|
||||||
exit ;;
|
|
||||||
cris:Linux:*:*)
|
|
||||||
echo cris-axis-linux-gnu
|
|
||||||
exit ;;
|
|
||||||
crisv32:Linux:*:*)
|
|
||||||
echo crisv32-axis-linux-gnu
|
|
||||||
exit ;;
|
|
||||||
frv:Linux:*:*)
|
|
||||||
echo frv-unknown-linux-gnu
|
|
||||||
exit ;;
|
|
||||||
i*86:Linux:*:*)
|
|
||||||
LIBC=gnu
|
|
||||||
eval $set_cc_for_build
|
|
||||||
sed 's/^ //' << EOF >$dummy.c
|
|
||||||
#ifdef __dietlibc__
|
|
||||||
LIBC=dietlibc
|
|
||||||
#endif
|
|
||||||
EOF
|
|
||||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
|
|
||||||
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
|
|
||||||
exit ;;
|
|
||||||
ia64:Linux:*:*)
|
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
|
||||||
exit ;;
|
|
||||||
m32r*:Linux:*:*)
|
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
|
||||||
exit ;;
|
|
||||||
m68*:Linux:*:*)
|
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
|
||||||
exit ;;
|
|
||||||
mips:Linux:*:* | mips64:Linux:*:*)
|
|
||||||
eval $set_cc_for_build
|
|
||||||
sed 's/^ //' << EOF >$dummy.c
|
|
||||||
#undef CPU
|
|
||||||
#undef ${UNAME_MACHINE}
|
|
||||||
#undef ${UNAME_MACHINE}el
|
|
||||||
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
|
|
||||||
CPU=${UNAME_MACHINE}el
|
|
||||||
#else
|
|
||||||
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
|
|
||||||
CPU=${UNAME_MACHINE}
|
|
||||||
#else
|
|
||||||
CPU=
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
EOF
|
|
||||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
|
|
||||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
|
|
||||||
;;
|
|
||||||
or32:Linux:*:*)
|
|
||||||
echo or32-unknown-linux-gnu
|
|
||||||
exit ;;
|
|
||||||
padre:Linux:*:*)
|
|
||||||
echo sparc-unknown-linux-gnu
|
|
||||||
exit ;;
|
|
||||||
parisc64:Linux:*:* | hppa64:Linux:*:*)
|
|
||||||
echo hppa64-unknown-linux-gnu
|
|
||||||
exit ;;
|
exit ;;
|
||||||
parisc:Linux:*:* | hppa:Linux:*:*)
|
parisc:Linux:*:* | hppa:Linux:*:*)
|
||||||
# Look for CPU level
|
# Look for CPU level
|
||||||
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
|
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
|
||||||
PA7*) echo hppa1.1-unknown-linux-gnu ;;
|
PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
|
||||||
PA8*) echo hppa2.0-unknown-linux-gnu ;;
|
PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
|
||||||
*) echo hppa-unknown-linux-gnu ;;
|
*) echo hppa-unknown-linux-${LIBC} ;;
|
||||||
esac
|
esac
|
||||||
exit ;;
|
exit ;;
|
||||||
ppc64:Linux:*:*)
|
parisc64:Linux:*:* | hppa64:Linux:*:*)
|
||||||
echo powerpc64-unknown-linux-gnu
|
echo hppa64-unknown-linux-${LIBC}
|
||||||
exit ;;
|
|
||||||
ppc:Linux:*:*)
|
|
||||||
echo powerpc-unknown-linux-gnu
|
|
||||||
exit ;;
|
exit ;;
|
||||||
s390:Linux:*:* | s390x:Linux:*:*)
|
s390:Linux:*:* | s390x:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-ibm-linux
|
echo ${UNAME_MACHINE}-ibm-linux
|
||||||
exit ;;
|
exit ;;
|
||||||
sh64*:Linux:*:*)
|
sh64*:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||||
exit ;;
|
exit ;;
|
||||||
sh*:Linux:*:*)
|
sh*:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||||
exit ;;
|
exit ;;
|
||||||
sparc:Linux:*:* | sparc64:Linux:*:*)
|
sparc:Linux:*:* | sparc64:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||||
exit ;;
|
exit ;;
|
||||||
vax:Linux:*:*)
|
vax:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-dec-linux-gnu
|
echo ${UNAME_MACHINE}-dec-linux-${LIBC}
|
||||||
exit ;;
|
exit ;;
|
||||||
x86_64:Linux:*:*)
|
x86_64:Linux:*:*)
|
||||||
echo x86_64-unknown-linux-gnu
|
echo x86_64-unknown-linux-${LIBC}
|
||||||
exit ;;
|
|
||||||
xtensa*:Linux:*:*)
|
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
|
||||||
exit ;;
|
exit ;;
|
||||||
|
i*86:Linux:*:*)
|
||||||
|
# The BFD linker knows what the default object file format is, so
|
||||||
|
# first see if it will tell us. cd to the root directory to prevent
|
||||||
|
# problems with other programs or directories called `ld' in the path.
|
||||||
|
# Set LC_ALL=C to ensure ld outputs messages in English.
|
||||||
|
ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
|
||||||
|
| sed -ne '/supported targets:/!d
|
||||||
|
s/[ ][ ]*/ /g
|
||||||
|
s/.*supported targets: *//
|
||||||
|
s/ .*//
|
||||||
|
p'`
|
||||||
|
case "$ld_supported_targets" in
|
||||||
|
elf32-i386)
|
||||||
|
TENTATIVE="${UNAME_MACHINE}-pc-linux-${LIBC}"
|
||||||
|
;;
|
||||||
|
a.out-i386-linux)
|
||||||
|
echo "${UNAME_MACHINE}-pc-linux-${LIBC}aout"
|
||||||
|
exit ;;
|
||||||
|
coff-i386)
|
||||||
|
echo "${UNAME_MACHINE}-pc-linux-${LIBC}coff"
|
||||||
|
exit ;;
|
||||||
|
"")
|
||||||
|
# Either a pre-BFD a.out linker (linux-gnuoldld) or
|
||||||
|
# one that does not give us useful --help.
|
||||||
|
echo "${UNAME_MACHINE}-pc-linux-${LIBC}oldld"
|
||||||
|
exit ;;
|
||||||
|
esac
|
||||||
|
# This should get integrated into the C code below, but now we hack
|
||||||
|
if [ "$LIBC" != "gnu" ] ; then echo "$TENTATIVE" && exit 0 ; fi
|
||||||
|
# Determine whether the default compiler is a.out or elf
|
||||||
|
eval $set_cc_for_build
|
||||||
|
sed 's/^ //' << EOF >$dummy.c
|
||||||
|
#include <features.h>
|
||||||
|
#ifdef __ELF__
|
||||||
|
# ifdef __GLIBC__
|
||||||
|
# if __GLIBC__ >= 2
|
||||||
|
LIBC=gnu
|
||||||
|
# else
|
||||||
|
LIBC=gnulibc1
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
LIBC=gnulibc1
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
#if defined(__INTEL_COMPILER) || defined(__PGI)
|
||||||
|
LIBC=gnu
|
||||||
|
#else
|
||||||
|
LIBC=gnuaout
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#ifdef __dietlibc__
|
||||||
|
LIBC=dietlibc
|
||||||
|
#endif
|
||||||
|
EOF
|
||||||
|
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^LIBC/{s: ::g;p;}'`"
|
||||||
|
test x"${LIBC}" != x && {
|
||||||
|
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
|
||||||
|
;;
|
||||||
i*86:DYNIX/ptx:4*:*)
|
i*86:DYNIX/ptx:4*:*)
|
||||||
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
|
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
|
||||||
# earlier versions are messed up and put the nodename in both
|
# earlier versions are messed up and put the nodename in both
|
||||||
@@ -1004,7 +1036,7 @@ EOF
|
|||||||
i*86:syllable:*:*)
|
i*86:syllable:*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-syllable
|
echo ${UNAME_MACHINE}-pc-syllable
|
||||||
exit ;;
|
exit ;;
|
||||||
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
|
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
|
||||||
echo i386-unknown-lynxos${UNAME_RELEASE}
|
echo i386-unknown-lynxos${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
i*86:*DOS:*:*)
|
i*86:*DOS:*:*)
|
||||||
@@ -1048,11 +1080,8 @@ EOF
|
|||||||
pc:*:*:*)
|
pc:*:*:*)
|
||||||
# Left here for compatibility:
|
# Left here for compatibility:
|
||||||
# uname -m prints for DJGPP always 'pc', but it prints nothing about
|
# uname -m prints for DJGPP always 'pc', but it prints nothing about
|
||||||
# the processor, so we play safe by assuming i586.
|
# the processor, so we play safe by assuming i386.
|
||||||
# Note: whatever this is, it MUST be the same as what config.sub
|
echo i386-pc-msdosdjgpp
|
||||||
# prints for the "djgpp" host, or else GDB configury will decide that
|
|
||||||
# this is a cross-build.
|
|
||||||
echo i586-pc-msdosdjgpp
|
|
||||||
exit ;;
|
exit ;;
|
||||||
Intel:Mach:3*:*)
|
Intel:Mach:3*:*)
|
||||||
echo i386-pc-mach3
|
echo i386-pc-mach3
|
||||||
@@ -1090,16 +1119,6 @@ EOF
|
|||||||
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
|
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
|
||||||
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||||
&& { echo i486-ncr-sysv4; exit; } ;;
|
&& { echo i486-ncr-sysv4; exit; } ;;
|
||||||
NCR*:*:4.2:* | MPRAS*:*:4.2:*)
|
|
||||||
OS_REL='.3'
|
|
||||||
test -r /etc/.relid \
|
|
||||||
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
|
|
||||||
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
|
||||||
&& { echo i486-ncr-sysv4.3${OS_REL}; exit; }
|
|
||||||
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
|
|
||||||
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; }
|
|
||||||
/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
|
|
||||||
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
|
|
||||||
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
|
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
|
||||||
echo m68k-unknown-lynxos${UNAME_RELEASE}
|
echo m68k-unknown-lynxos${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
@@ -1112,7 +1131,7 @@ EOF
|
|||||||
rs6000:LynxOS:2.*:*)
|
rs6000:LynxOS:2.*:*)
|
||||||
echo rs6000-unknown-lynxos${UNAME_RELEASE}
|
echo rs6000-unknown-lynxos${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
|
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
|
||||||
echo powerpc-unknown-lynxos${UNAME_RELEASE}
|
echo powerpc-unknown-lynxos${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
SM[BE]S:UNIX_SV:*:*)
|
SM[BE]S:UNIX_SV:*:*)
|
||||||
@@ -1175,9 +1194,6 @@ EOF
|
|||||||
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
|
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
|
||||||
echo i586-pc-beos
|
echo i586-pc-beos
|
||||||
exit ;;
|
exit ;;
|
||||||
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
|
|
||||||
echo i586-pc-haiku
|
|
||||||
exit ;;
|
|
||||||
SX-4:SUPER-UX:*:*)
|
SX-4:SUPER-UX:*:*)
|
||||||
echo sx4-nec-superux${UNAME_RELEASE}
|
echo sx4-nec-superux${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
@@ -1187,15 +1203,6 @@ EOF
|
|||||||
SX-6:SUPER-UX:*:*)
|
SX-6:SUPER-UX:*:*)
|
||||||
echo sx6-nec-superux${UNAME_RELEASE}
|
echo sx6-nec-superux${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
SX-7:SUPER-UX:*:*)
|
|
||||||
echo sx7-nec-superux${UNAME_RELEASE}
|
|
||||||
exit ;;
|
|
||||||
SX-8:SUPER-UX:*:*)
|
|
||||||
echo sx8-nec-superux${UNAME_RELEASE}
|
|
||||||
exit ;;
|
|
||||||
SX-8R:SUPER-UX:*:*)
|
|
||||||
echo sx8r-nec-superux${UNAME_RELEASE}
|
|
||||||
exit ;;
|
|
||||||
Power*:Rhapsody:*:*)
|
Power*:Rhapsody:*:*)
|
||||||
echo powerpc-apple-rhapsody${UNAME_RELEASE}
|
echo powerpc-apple-rhapsody${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
@@ -1205,16 +1212,6 @@ EOF
|
|||||||
*:Darwin:*:*)
|
*:Darwin:*:*)
|
||||||
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
|
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
|
||||||
case $UNAME_PROCESSOR in
|
case $UNAME_PROCESSOR in
|
||||||
i386)
|
|
||||||
eval $set_cc_for_build
|
|
||||||
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
|
|
||||||
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
|
|
||||||
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
|
|
||||||
grep IS_64BIT_ARCH >/dev/null
|
|
||||||
then
|
|
||||||
UNAME_PROCESSOR="x86_64"
|
|
||||||
fi
|
|
||||||
fi ;;
|
|
||||||
unknown) UNAME_PROCESSOR=powerpc ;;
|
unknown) UNAME_PROCESSOR=powerpc ;;
|
||||||
esac
|
esac
|
||||||
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
|
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
|
||||||
@@ -1296,9 +1293,6 @@ EOF
|
|||||||
i*86:rdos:*:*)
|
i*86:rdos:*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-rdos
|
echo ${UNAME_MACHINE}-pc-rdos
|
||||||
exit ;;
|
exit ;;
|
||||||
i*86:AROS:*:*)
|
|
||||||
echo ${UNAME_MACHINE}-pc-aros
|
|
||||||
exit ;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
#echo '(No uname command or uname output not recognized.)' 1>&2
|
#echo '(No uname command or uname output not recognized.)' 1>&2
|
||||||
@@ -1459,9 +1453,9 @@ This script, last modified $timestamp, has failed to recognize
|
|||||||
the operating system you are using. It is advised that you
|
the operating system you are using. It is advised that you
|
||||||
download the most up to date version of the config scripts from
|
download the most up to date version of the config scripts from
|
||||||
|
|
||||||
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
|
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
|
||||||
and
|
and
|
||||||
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
|
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
|
||||||
|
|
||||||
If the version you run ($0) is already up to date, please
|
If the version you run ($0) is already up to date, please
|
||||||
send the following data and any information you think might be
|
send the following data and any information you think might be
|
||||||
|
|||||||
@@ -45,10 +45,6 @@
|
|||||||
/* Define to 1 if you have the <unistd.h> header file. */
|
/* Define to 1 if you have the <unistd.h> header file. */
|
||||||
#undef HAVE_UNISTD_H
|
#undef HAVE_UNISTD_H
|
||||||
|
|
||||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
|
||||||
*/
|
|
||||||
#undef LT_OBJDIR
|
|
||||||
|
|
||||||
/* Name of package */
|
/* Name of package */
|
||||||
#undef PACKAGE
|
#undef PACKAGE
|
||||||
|
|
||||||
@@ -64,9 +60,6 @@
|
|||||||
/* Define to the one symbol short name of this package. */
|
/* Define to the one symbol short name of this package. */
|
||||||
#undef PACKAGE_TARNAME
|
#undef PACKAGE_TARNAME
|
||||||
|
|
||||||
/* Define to the home page for this package. */
|
|
||||||
#undef PACKAGE_URL
|
|
||||||
|
|
||||||
/* Define to the version of this package. */
|
/* Define to the version of this package. */
|
||||||
#undef PACKAGE_VERSION
|
#undef PACKAGE_VERSION
|
||||||
|
|
||||||
|
|||||||
220
config.sub
vendored
Normal file → Executable file
@@ -1,10 +1,9 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Configuration validation subroutine script.
|
# Configuration validation subroutine script.
|
||||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
timestamp='2009-11-20'
|
timestamp='2005-12-23'
|
||||||
|
|
||||||
# This file is (in principle) common to ALL GNU software.
|
# This file is (in principle) common to ALL GNU software.
|
||||||
# The presence of a machine in this file suggests that SOME GNU software
|
# The presence of a machine in this file suggests that SOME GNU software
|
||||||
@@ -32,16 +31,13 @@ timestamp='2009-11-20'
|
|||||||
|
|
||||||
|
|
||||||
# Please send patches to <config-patches@gnu.org>. Submit a context
|
# Please send patches to <config-patches@gnu.org>. Submit a context
|
||||||
# diff and a properly formatted GNU ChangeLog entry.
|
# diff and a properly formatted ChangeLog entry.
|
||||||
#
|
#
|
||||||
# Configuration subroutine to validate and canonicalize a configuration type.
|
# Configuration subroutine to validate and canonicalize a configuration type.
|
||||||
# Supply the specified configuration type as an argument.
|
# Supply the specified configuration type as an argument.
|
||||||
# If it is invalid, we print an error message on stderr and exit with code 1.
|
# If it is invalid, we print an error message on stderr and exit with code 1.
|
||||||
# Otherwise, we print the canonical config type on stdout and succeed.
|
# Otherwise, we print the canonical config type on stdout and succeed.
|
||||||
|
|
||||||
# You can get the latest version of this script from:
|
|
||||||
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
|
|
||||||
|
|
||||||
# This file is supposed to be the same for all GNU packages
|
# This file is supposed to be the same for all GNU packages
|
||||||
# and recognize all the CPU types, system types and aliases
|
# and recognize all the CPU types, system types and aliases
|
||||||
# that are meaningful with *any* GNU software.
|
# that are meaningful with *any* GNU software.
|
||||||
@@ -75,8 +71,8 @@ Report bugs and patches to <config-patches@gnu.org>."
|
|||||||
version="\
|
version="\
|
||||||
GNU config.sub ($timestamp)
|
GNU config.sub ($timestamp)
|
||||||
|
|
||||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
|
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
||||||
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This is free software; see the source for copying conditions. There is NO
|
This is free software; see the source for copying conditions. There is NO
|
||||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||||
@@ -125,7 +121,6 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
|||||||
case $maybe_os in
|
case $maybe_os in
|
||||||
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
|
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
|
||||||
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
|
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
|
||||||
kopensolaris*-gnu* | \
|
|
||||||
storm-chaos* | os2-emx* | rtmk-nova*)
|
storm-chaos* | os2-emx* | rtmk-nova*)
|
||||||
os=-$maybe_os
|
os=-$maybe_os
|
||||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||||
@@ -152,13 +147,10 @@ case $os in
|
|||||||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||||
-apple | -axis | -knuth | -cray | -microblaze)
|
-apple | -axis | -knuth | -cray)
|
||||||
os=
|
os=
|
||||||
basic_machine=$1
|
basic_machine=$1
|
||||||
;;
|
;;
|
||||||
-bluegene*)
|
|
||||||
os=-cnk
|
|
||||||
;;
|
|
||||||
-sim | -cisco | -oki | -wec | -winbond)
|
-sim | -cisco | -oki | -wec | -winbond)
|
||||||
os=
|
os=
|
||||||
basic_machine=$1
|
basic_machine=$1
|
||||||
@@ -248,24 +240,20 @@ case $basic_machine in
|
|||||||
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
|
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
|
||||||
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
|
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
|
||||||
| am33_2.0 \
|
| am33_2.0 \
|
||||||
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
|
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
|
||||||
| bfin \
|
| bfin \
|
||||||
| c4x | clipper \
|
| c4x | clipper \
|
||||||
| d10v | d30v | dlx | dsp16xx \
|
| d10v | d30v | dlx | dsp16xx | dvp \
|
||||||
| fido | fr30 | frv \
|
| fr30 | frv \
|
||||||
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||||
| i370 | i860 | i960 | ia64 \
|
| i370 | i860 | i960 | ia64 \
|
||||||
| ip2k | iq2000 \
|
| ip2k | iq2000 \
|
||||||
| lm32 \
|
| m32r | m32rle | m68000 | m68k | m88k | maxq | mb | microblaze | mcore \
|
||||||
| m32c | m32r | m32rle | m68000 | m68k | m88k \
|
|
||||||
| maxq | mb | microblaze | mcore | mep | metag \
|
|
||||||
| mips | mipsbe | mipseb | mipsel | mipsle \
|
| mips | mipsbe | mipseb | mipsel | mipsle \
|
||||||
| mips16 \
|
| mips16 \
|
||||||
| mips64 | mips64el \
|
| mips64 | mips64el \
|
||||||
| mips64octeon | mips64octeonel \
|
|
||||||
| mips64orion | mips64orionel \
|
|
||||||
| mips64r5900 | mips64r5900el \
|
|
||||||
| mips64vr | mips64vrel \
|
| mips64vr | mips64vrel \
|
||||||
|
| mips64orion | mips64orionel \
|
||||||
| mips64vr4100 | mips64vr4100el \
|
| mips64vr4100 | mips64vr4100el \
|
||||||
| mips64vr4300 | mips64vr4300el \
|
| mips64vr4300 | mips64vr4300el \
|
||||||
| mips64vr5000 | mips64vr5000el \
|
| mips64vr5000 | mips64vr5000el \
|
||||||
@@ -278,31 +266,29 @@ case $basic_machine in
|
|||||||
| mipsisa64sr71k | mipsisa64sr71kel \
|
| mipsisa64sr71k | mipsisa64sr71kel \
|
||||||
| mipstx39 | mipstx39el \
|
| mipstx39 | mipstx39el \
|
||||||
| mn10200 | mn10300 \
|
| mn10200 | mn10300 \
|
||||||
| moxie \
|
|
||||||
| mt \
|
| mt \
|
||||||
| msp430 \
|
| msp430 \
|
||||||
| nios | nios2 \
|
|
||||||
| ns16k | ns32k \
|
| ns16k | ns32k \
|
||||||
| or32 \
|
| or32 \
|
||||||
| pdp10 | pdp11 | pj | pjl \
|
| pdp10 | pdp11 | pj | pjl \
|
||||||
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
|
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
|
||||||
| pyramid \
|
| pyramid \
|
||||||
| rx \
|
| sh | sh[1234] | sh[24]a | sh[24]a*eb | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
|
||||||
| score \
|
|
||||||
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
|
||||||
| sh64 | sh64le \
|
| sh64 | sh64le \
|
||||||
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
|
| sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
|
||||||
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
|
| sparcv8 | sparcv9 | sparcv9b \
|
||||||
| spu | strongarm \
|
| strongarm \
|
||||||
| tahoe | thumb | tic4x | tic80 | tron \
|
| tahoe | thumb | tic4x | tic80 | tron \
|
||||||
| ubicom32 \
|
|
||||||
| v850 | v850e \
|
| v850 | v850e \
|
||||||
| we32k \
|
| we32k \
|
||||||
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
|
| x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
|
||||||
| z8k | z80)
|
| z8k)
|
||||||
basic_machine=$basic_machine-unknown
|
basic_machine=$basic_machine-unknown
|
||||||
;;
|
;;
|
||||||
m6811 | m68hc11 | m6812 | m68hc12 | picochip)
|
m32c)
|
||||||
|
basic_machine=$basic_machine-unknown
|
||||||
|
;;
|
||||||
|
m6811 | m68hc11 | m6812 | m68hc12)
|
||||||
# Motorola 68HC11/12.
|
# Motorola 68HC11/12.
|
||||||
basic_machine=$basic_machine-unknown
|
basic_machine=$basic_machine-unknown
|
||||||
os=-none
|
os=-none
|
||||||
@@ -312,6 +298,10 @@ case $basic_machine in
|
|||||||
ms1)
|
ms1)
|
||||||
basic_machine=mt-unknown
|
basic_machine=mt-unknown
|
||||||
;;
|
;;
|
||||||
|
nios2 | nios2-* | nios2 | nios2-*)
|
||||||
|
basic_machine=nios2-altera
|
||||||
|
os=-none
|
||||||
|
;;
|
||||||
|
|
||||||
# We use `pc' rather than `unknown'
|
# We use `pc' rather than `unknown'
|
||||||
# because (1) that's what they normally are, and
|
# because (1) that's what they normally are, and
|
||||||
@@ -331,28 +321,25 @@ case $basic_machine in
|
|||||||
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
|
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
|
||||||
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
|
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
|
||||||
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
||||||
| avr-* | avr32-* \
|
| avr-* \
|
||||||
| bfin-* | bs2000-* \
|
| bfin-* | bs2000-* \
|
||||||
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
|
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
|
||||||
| clipper-* | craynv-* | cydra-* \
|
| clipper-* | craynv-* | cydra-* \
|
||||||
| d10v-* | d30v-* | dlx-* \
|
| d10v-* | d30v-* | dlx-* \
|
||||||
| elxsi-* \
|
| elxsi-* \
|
||||||
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
|
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
|
||||||
| h8300-* | h8500-* \
|
| h8300-* | h8500-* \
|
||||||
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
||||||
| i*86-* | i860-* | i960-* | ia64-* \
|
| i*86-* | i860-* | i960-* | ia64-* \
|
||||||
| ip2k-* | iq2000-* \
|
| ip2k-* | iq2000-* \
|
||||||
| lm32-* \
|
| m32r-* | m32rle-* \
|
||||||
| m32c-* | m32r-* | m32rle-* \
|
|
||||||
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
||||||
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
|
| m88110-* | m88k-* | maxq-* | mcore-* \
|
||||||
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
||||||
| mips16-* \
|
| mips16-* \
|
||||||
| mips64-* | mips64el-* \
|
| mips64-* | mips64el-* \
|
||||||
| mips64octeon-* | mips64octeonel-* \
|
|
||||||
| mips64orion-* | mips64orionel-* \
|
|
||||||
| mips64r5900-* | mips64r5900el-* \
|
|
||||||
| mips64vr-* | mips64vrel-* \
|
| mips64vr-* | mips64vrel-* \
|
||||||
|
| mips64orion-* | mips64orionel-* \
|
||||||
| mips64vr4100-* | mips64vr4100el-* \
|
| mips64vr4100-* | mips64vr4100el-* \
|
||||||
| mips64vr4300-* | mips64vr4300el-* \
|
| mips64vr4300-* | mips64vr4300el-* \
|
||||||
| mips64vr5000-* | mips64vr5000el-* \
|
| mips64vr5000-* | mips64vr5000el-* \
|
||||||
@@ -367,32 +354,28 @@ case $basic_machine in
|
|||||||
| mmix-* \
|
| mmix-* \
|
||||||
| mt-* \
|
| mt-* \
|
||||||
| msp430-* \
|
| msp430-* \
|
||||||
| nios-* | nios2-* \
|
|
||||||
| none-* | np1-* | ns16k-* | ns32k-* \
|
| none-* | np1-* | ns16k-* | ns32k-* \
|
||||||
| orion-* \
|
| orion-* \
|
||||||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
||||||
| pyramid-* \
|
| pyramid-* \
|
||||||
| romp-* | rs6000-* | rx-* \
|
| romp-* | rs6000-* \
|
||||||
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
|
| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
|
||||||
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
||||||
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
|
| sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
|
||||||
| sparclite-* \
|
| sparclite-* \
|
||||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
|
| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
|
||||||
| tahoe-* | thumb-* \
|
| tahoe-* | thumb-* \
|
||||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
|
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
||||||
| tron-* \
|
| tron-* \
|
||||||
| ubicom32-* \
|
|
||||||
| v850-* | v850e-* | vax-* \
|
| v850-* | v850e-* | vax-* \
|
||||||
| we32k-* \
|
| we32k-* \
|
||||||
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
|
| x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
|
||||||
| xstormy16-* | xtensa*-* \
|
| xstormy16-* | xtensa-* \
|
||||||
| ymp-* \
|
| ymp-* \
|
||||||
| z8k-* | z80-*)
|
| z8k-*)
|
||||||
;;
|
;;
|
||||||
# Recognize the basic CPU types without company name, with glob match.
|
m32c-*)
|
||||||
xtensa*)
|
|
||||||
basic_machine=$basic_machine-unknown
|
|
||||||
;;
|
;;
|
||||||
# Recognize the various machine names and aliases which stand
|
# Recognize the various machine names and aliases which stand
|
||||||
# for a CPU type and a company and sometimes even an OS.
|
# for a CPU type and a company and sometimes even an OS.
|
||||||
@@ -456,10 +439,6 @@ case $basic_machine in
|
|||||||
basic_machine=m68k-apollo
|
basic_machine=m68k-apollo
|
||||||
os=-bsd
|
os=-bsd
|
||||||
;;
|
;;
|
||||||
aros)
|
|
||||||
basic_machine=i386-pc
|
|
||||||
os=-aros
|
|
||||||
;;
|
|
||||||
aux)
|
aux)
|
||||||
basic_machine=m68k-apple
|
basic_machine=m68k-apple
|
||||||
os=-aux
|
os=-aux
|
||||||
@@ -468,26 +447,10 @@ case $basic_machine in
|
|||||||
basic_machine=ns32k-sequent
|
basic_machine=ns32k-sequent
|
||||||
os=-dynix
|
os=-dynix
|
||||||
;;
|
;;
|
||||||
blackfin)
|
|
||||||
basic_machine=bfin-unknown
|
|
||||||
os=-linux
|
|
||||||
;;
|
|
||||||
blackfin-*)
|
|
||||||
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
|
|
||||||
os=-linux
|
|
||||||
;;
|
|
||||||
bluegene*)
|
|
||||||
basic_machine=powerpc-ibm
|
|
||||||
os=-cnk
|
|
||||||
;;
|
|
||||||
c90)
|
c90)
|
||||||
basic_machine=c90-cray
|
basic_machine=c90-cray
|
||||||
os=-unicos
|
os=-unicos
|
||||||
;;
|
;;
|
||||||
cegcc)
|
|
||||||
basic_machine=arm-unknown
|
|
||||||
os=-cegcc
|
|
||||||
;;
|
|
||||||
convex-c1)
|
convex-c1)
|
||||||
basic_machine=c1-convex
|
basic_machine=c1-convex
|
||||||
os=-bsd
|
os=-bsd
|
||||||
@@ -516,8 +479,8 @@ case $basic_machine in
|
|||||||
basic_machine=craynv-cray
|
basic_machine=craynv-cray
|
||||||
os=-unicosmp
|
os=-unicosmp
|
||||||
;;
|
;;
|
||||||
cr16)
|
cr16c)
|
||||||
basic_machine=cr16-unknown
|
basic_machine=cr16c-unknown
|
||||||
os=-elf
|
os=-elf
|
||||||
;;
|
;;
|
||||||
crds | unos)
|
crds | unos)
|
||||||
@@ -555,10 +518,6 @@ case $basic_machine in
|
|||||||
basic_machine=m88k-motorola
|
basic_machine=m88k-motorola
|
||||||
os=-sysv3
|
os=-sysv3
|
||||||
;;
|
;;
|
||||||
dicos)
|
|
||||||
basic_machine=i686-pc
|
|
||||||
os=-dicos
|
|
||||||
;;
|
|
||||||
djgpp)
|
djgpp)
|
||||||
basic_machine=i586-pc
|
basic_machine=i586-pc
|
||||||
os=-msdosdjgpp
|
os=-msdosdjgpp
|
||||||
@@ -713,14 +672,6 @@ case $basic_machine in
|
|||||||
basic_machine=m68k-isi
|
basic_machine=m68k-isi
|
||||||
os=-sysv
|
os=-sysv
|
||||||
;;
|
;;
|
||||||
m68knommu)
|
|
||||||
basic_machine=m68k-unknown
|
|
||||||
os=-linux
|
|
||||||
;;
|
|
||||||
m68knommu-*)
|
|
||||||
basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
|
|
||||||
os=-linux
|
|
||||||
;;
|
|
||||||
m88k-omron*)
|
m88k-omron*)
|
||||||
basic_machine=m88k-omron
|
basic_machine=m88k-omron
|
||||||
;;
|
;;
|
||||||
@@ -732,17 +683,10 @@ case $basic_machine in
|
|||||||
basic_machine=ns32k-utek
|
basic_machine=ns32k-utek
|
||||||
os=-sysv
|
os=-sysv
|
||||||
;;
|
;;
|
||||||
microblaze)
|
|
||||||
basic_machine=microblaze-xilinx
|
|
||||||
;;
|
|
||||||
mingw32)
|
mingw32)
|
||||||
basic_machine=i386-pc
|
basic_machine=i386-pc
|
||||||
os=-mingw32
|
os=-mingw32
|
||||||
;;
|
;;
|
||||||
mingw32ce)
|
|
||||||
basic_machine=arm-unknown
|
|
||||||
os=-mingw32ce
|
|
||||||
;;
|
|
||||||
miniframe)
|
miniframe)
|
||||||
basic_machine=m68000-convergent
|
basic_machine=m68000-convergent
|
||||||
;;
|
;;
|
||||||
@@ -750,6 +694,24 @@ case $basic_machine in
|
|||||||
basic_machine=m68k-atari
|
basic_machine=m68k-atari
|
||||||
os=-mint
|
os=-mint
|
||||||
;;
|
;;
|
||||||
|
mipsEE* | ee | ps2)
|
||||||
|
basic_machine=mips64r5900el-scei
|
||||||
|
case $os in
|
||||||
|
-linux*)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
os=-elf
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
iop)
|
||||||
|
basic_machine=mipsel-scei
|
||||||
|
os=-irx
|
||||||
|
;;
|
||||||
|
dvp)
|
||||||
|
basic_machine=dvp-scei
|
||||||
|
os=-elf
|
||||||
|
;;
|
||||||
mips3*-*)
|
mips3*-*)
|
||||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
|
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
|
||||||
;;
|
;;
|
||||||
@@ -869,14 +831,6 @@ case $basic_machine in
|
|||||||
basic_machine=i860-intel
|
basic_machine=i860-intel
|
||||||
os=-osf
|
os=-osf
|
||||||
;;
|
;;
|
||||||
parisc)
|
|
||||||
basic_machine=hppa-unknown
|
|
||||||
os=-linux
|
|
||||||
;;
|
|
||||||
parisc-*)
|
|
||||||
basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
|
|
||||||
os=-linux
|
|
||||||
;;
|
|
||||||
pbd)
|
pbd)
|
||||||
basic_machine=sparc-tti
|
basic_machine=sparc-tti
|
||||||
;;
|
;;
|
||||||
@@ -978,10 +932,6 @@ case $basic_machine in
|
|||||||
sb1el)
|
sb1el)
|
||||||
basic_machine=mipsisa64sb1el-unknown
|
basic_machine=mipsisa64sb1el-unknown
|
||||||
;;
|
;;
|
||||||
sde)
|
|
||||||
basic_machine=mipsisa32-sde
|
|
||||||
os=-elf
|
|
||||||
;;
|
|
||||||
sei)
|
sei)
|
||||||
basic_machine=mips-sei
|
basic_machine=mips-sei
|
||||||
os=-seiux
|
os=-seiux
|
||||||
@@ -993,9 +943,6 @@ case $basic_machine in
|
|||||||
basic_machine=sh-hitachi
|
basic_machine=sh-hitachi
|
||||||
os=-hms
|
os=-hms
|
||||||
;;
|
;;
|
||||||
sh5el)
|
|
||||||
basic_machine=sh5le-unknown
|
|
||||||
;;
|
|
||||||
sh64)
|
sh64)
|
||||||
basic_machine=sh64-unknown
|
basic_machine=sh64-unknown
|
||||||
;;
|
;;
|
||||||
@@ -1085,10 +1032,6 @@ case $basic_machine in
|
|||||||
basic_machine=tic6x-unknown
|
basic_machine=tic6x-unknown
|
||||||
os=-coff
|
os=-coff
|
||||||
;;
|
;;
|
||||||
tile*)
|
|
||||||
basic_machine=tile-unknown
|
|
||||||
os=-linux-gnu
|
|
||||||
;;
|
|
||||||
tx39)
|
tx39)
|
||||||
basic_machine=mipstx39-unknown
|
basic_machine=mipstx39-unknown
|
||||||
;;
|
;;
|
||||||
@@ -1164,10 +1107,6 @@ case $basic_machine in
|
|||||||
basic_machine=z8k-unknown
|
basic_machine=z8k-unknown
|
||||||
os=-sim
|
os=-sim
|
||||||
;;
|
;;
|
||||||
z80-*-coff)
|
|
||||||
basic_machine=z80-unknown
|
|
||||||
os=-sim
|
|
||||||
;;
|
|
||||||
none)
|
none)
|
||||||
basic_machine=none-none
|
basic_machine=none-none
|
||||||
os=-none
|
os=-none
|
||||||
@@ -1206,10 +1145,10 @@ case $basic_machine in
|
|||||||
we32k)
|
we32k)
|
||||||
basic_machine=we32k-att
|
basic_machine=we32k-att
|
||||||
;;
|
;;
|
||||||
sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
|
sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
|
||||||
basic_machine=sh-unknown
|
basic_machine=sh-unknown
|
||||||
;;
|
;;
|
||||||
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
|
sparc | sparcv8 | sparcv9 | sparcv9b)
|
||||||
basic_machine=sparc-sun
|
basic_machine=sparc-sun
|
||||||
;;
|
;;
|
||||||
cydra)
|
cydra)
|
||||||
@@ -1256,9 +1195,6 @@ case $os in
|
|||||||
# First match some system type aliases
|
# First match some system type aliases
|
||||||
# that might get confused with valid system types.
|
# that might get confused with valid system types.
|
||||||
# -solaris* is a basic system type, with this one exception.
|
# -solaris* is a basic system type, with this one exception.
|
||||||
-auroraux)
|
|
||||||
os=-auroraux
|
|
||||||
;;
|
|
||||||
-solaris1 | -solaris1.*)
|
-solaris1 | -solaris1.*)
|
||||||
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
||||||
;;
|
;;
|
||||||
@@ -1279,20 +1215,18 @@ case $os in
|
|||||||
# Each alternative MUST END IN A *, to match a version number.
|
# Each alternative MUST END IN A *, to match a version number.
|
||||||
# -sysv* is not here because it comes later, after sysvr4.
|
# -sysv* is not here because it comes later, after sysvr4.
|
||||||
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
||||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
|
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
|
||||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
|
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
|
||||||
| -sym* | -kopensolaris* \
|
|
||||||
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
||||||
| -aos* | -aros* \
|
| -aos* \
|
||||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||||
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
|
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
|
||||||
| -openbsd* | -solidbsd* \
|
|
||||||
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
|
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
|
||||||
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||||
| -chorusos* | -chorusrdb* | -cegcc* \
|
| -chorusos* | -chorusrdb* \
|
||||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||||
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
|
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
|
||||||
| -uxpv* | -beos* | -mpeix* | -udk* \
|
| -uxpv* | -beos* | -mpeix* | -udk* \
|
||||||
@@ -1302,7 +1236,7 @@ case $os in
|
|||||||
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
||||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
||||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
|
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
|
||||||
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
|
| -skyos* | -haiku* | -rdos* | -irx*)
|
||||||
# Remember, each alternative MUST END IN *, to match a version number.
|
# Remember, each alternative MUST END IN *, to match a version number.
|
||||||
;;
|
;;
|
||||||
-qnx*)
|
-qnx*)
|
||||||
@@ -1432,9 +1366,6 @@ case $os in
|
|||||||
-zvmoe)
|
-zvmoe)
|
||||||
os=-zvmoe
|
os=-zvmoe
|
||||||
;;
|
;;
|
||||||
-dicos*)
|
|
||||||
os=-dicos
|
|
||||||
;;
|
|
||||||
-none)
|
-none)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@@ -1457,12 +1388,6 @@ else
|
|||||||
# system, and we'll never get to this point.
|
# system, and we'll never get to this point.
|
||||||
|
|
||||||
case $basic_machine in
|
case $basic_machine in
|
||||||
score-*)
|
|
||||||
os=-elf
|
|
||||||
;;
|
|
||||||
spu-*)
|
|
||||||
os=-elf
|
|
||||||
;;
|
|
||||||
*-acorn)
|
*-acorn)
|
||||||
os=-riscix1.2
|
os=-riscix1.2
|
||||||
;;
|
;;
|
||||||
@@ -1472,9 +1397,9 @@ case $basic_machine in
|
|||||||
arm*-semi)
|
arm*-semi)
|
||||||
os=-aout
|
os=-aout
|
||||||
;;
|
;;
|
||||||
c4x-* | tic4x-*)
|
c4x-* | tic4x-*)
|
||||||
os=-coff
|
os=-coff
|
||||||
;;
|
;;
|
||||||
# This must come before the *-dec entry.
|
# This must come before the *-dec entry.
|
||||||
pdp10-*)
|
pdp10-*)
|
||||||
os=-tops20
|
os=-tops20
|
||||||
@@ -1500,9 +1425,6 @@ case $basic_machine in
|
|||||||
m68*-cisco)
|
m68*-cisco)
|
||||||
os=-aout
|
os=-aout
|
||||||
;;
|
;;
|
||||||
mep-*)
|
|
||||||
os=-elf
|
|
||||||
;;
|
|
||||||
mips*-cisco)
|
mips*-cisco)
|
||||||
os=-elf
|
os=-elf
|
||||||
;;
|
;;
|
||||||
@@ -1632,7 +1554,7 @@ case $basic_machine in
|
|||||||
-sunos*)
|
-sunos*)
|
||||||
vendor=sun
|
vendor=sun
|
||||||
;;
|
;;
|
||||||
-cnk*|-aix*)
|
-aix*)
|
||||||
vendor=ibm
|
vendor=ibm
|
||||||
;;
|
;;
|
||||||
-beos*)
|
-beos*)
|
||||||
|
|||||||
96
configure.ac
@@ -18,15 +18,15 @@ AC_PREREQ(2.59)
|
|||||||
|
|
||||||
dnl Version number stuff here:
|
dnl Version number stuff here:
|
||||||
|
|
||||||
AC_INIT([libpng], [1.5.2], [png-mng-implement@lists.sourceforge.net])
|
AC_INIT([libpng], [1.0.29rc2], [png-mng-implement@lists.sourceforge.net])
|
||||||
AM_INIT_AUTOMAKE
|
AM_INIT_AUTOMAKE
|
||||||
dnl stop configure from automagically running automake
|
dnl stop configure from automagically running automake
|
||||||
AM_MAINTAINER_MODE
|
AM_MAINTAINER_MODE
|
||||||
|
|
||||||
PNGLIB_VERSION=1.5.2
|
PNGLIB_VERSION=1.0.29rc2
|
||||||
PNGLIB_MAJOR=1
|
PNGLIB_MAJOR=1
|
||||||
PNGLIB_MINOR=5
|
PNGLIB_MINOR=0
|
||||||
PNGLIB_RELEASE=2
|
PNGLIB_RELEASE=29
|
||||||
|
|
||||||
dnl End of version number stuff
|
dnl End of version number stuff
|
||||||
|
|
||||||
@@ -34,38 +34,14 @@ AC_CONFIG_SRCDIR([pngget.c])
|
|||||||
AM_CONFIG_HEADER(config.h)
|
AM_CONFIG_HEADER(config.h)
|
||||||
|
|
||||||
# Checks for programs.
|
# Checks for programs.
|
||||||
AC_LANG([C])
|
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AC_PROG_LD
|
AC_PROG_LD
|
||||||
AC_PROG_CPP
|
AC_PROG_CPP
|
||||||
AC_CHECK_TOOL(SED, sed, :)
|
AC_CHECK_TOOL(SED, sed, :)
|
||||||
AC_CHECK_TOOL(AWK, awk, :)
|
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
AC_PROG_LN_S
|
AC_PROG_LN_S
|
||||||
AC_PROG_MAKE_SET
|
AC_PROG_MAKE_SET
|
||||||
LT_INIT([win32-dll])
|
AC_PROG_LIBTOOL
|
||||||
|
|
||||||
# On Solaris 10 and 12 CPP gets set to cc -E, however this still
|
|
||||||
# does some input parsing. We need strict ANSI-C style tokenization,
|
|
||||||
# check this:
|
|
||||||
AC_REQUIRE_CPP
|
|
||||||
AC_MSG_CHECKING([for a C preprocessor that does not parse its input])
|
|
||||||
AC_TRY_CPP([1.5.0 16BIT],
|
|
||||||
[DFNCPP="$CPP"],
|
|
||||||
[DFNCPP=""
|
|
||||||
sav_CPP="$CPP"
|
|
||||||
for CPP in "${CC-cc} -E" "${CC-cc} -E -traditional-cpp" "/lib/cpp" "cpp"; do
|
|
||||||
AC_TRY_CPP([1.5.0 16BIT],
|
|
||||||
[DFNCPP="$CPP"]
|
|
||||||
[break],,)
|
|
||||||
done
|
|
||||||
CPP="$sav_CPP"])
|
|
||||||
if test -n "$DFNCPP"; then
|
|
||||||
AC_MSG_RESULT([$DFNCPP])
|
|
||||||
AC_SUBST(DFNCPP)
|
|
||||||
else
|
|
||||||
AC_MSG_FAILURE([not found], 1)
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Checks for header files.
|
# Checks for header files.
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
@@ -80,30 +56,23 @@ AC_STRUCT_TM
|
|||||||
AC_FUNC_STRTOD
|
AC_FUNC_STRTOD
|
||||||
AC_CHECK_FUNCS([memset], , AC_ERROR([memset not found in libc]))
|
AC_CHECK_FUNCS([memset], , AC_ERROR([memset not found in libc]))
|
||||||
AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_ERROR([cannot find pow])) )
|
AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_ERROR([cannot find pow])) )
|
||||||
AC_ARG_WITH(zlib-prefix,
|
AC_CHECK_LIB(z, zlibVersion, , AC_ERROR([zlib not installed]))
|
||||||
AC_HELP_STRING([--with-zlib-prefix],
|
|
||||||
[prefix that may have been used in installed zlib]),
|
|
||||||
[ZPREFIX=${withval}],
|
|
||||||
[ZPREFIX='z_'])
|
|
||||||
AC_CHECK_LIB(z, zlibVersion, ,
|
|
||||||
AC_CHECK_LIB(z, ${ZPREFIX}zlibVersion, ,
|
|
||||||
AC_ERROR([zlib not installed])))
|
|
||||||
|
|
||||||
|
|
||||||
LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG
|
LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG
|
||||||
LIBPNG_DEFINES=$LIBPNG_DEFINES
|
AC_MSG_CHECKING(
|
||||||
|
[if assembler code in pnggccrd.c can be compiled without PNG_NO_MMX_CODE])
|
||||||
|
AC_TRY_COMPILE(
|
||||||
|
[#include "$srcdir/pnggccrd.c"],
|
||||||
|
[return 0;],
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
LIBPNG_NO_MMX="",
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
LIBPNG_NO_MMX=-DPNG_NO_MMX_CODE)
|
||||||
|
LIBPNG_DEFINES=$LIBPNG_DEFINES\ $LIBPNG_NO_MMX
|
||||||
AC_SUBST(LIBPNG_DEFINES)
|
AC_SUBST(LIBPNG_DEFINES)
|
||||||
|
AC_SUBST(LIBPNG_NO_MMX)
|
||||||
|
|
||||||
AC_MSG_CHECKING([if libraries can be versioned])
|
AC_MSG_CHECKING([if libraries can be versioned])
|
||||||
# Special case for PE/COFF platforms: ld reports
|
|
||||||
# support for version-script, but doesn't actually
|
|
||||||
# DO anything with it.
|
|
||||||
case $host in
|
|
||||||
*cygwin* | *mingw32* | *interix* )
|
|
||||||
have_ld_version_script=no
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
;;
|
|
||||||
* )
|
|
||||||
GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
|
GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
|
||||||
if test "$GLD"; then
|
if test "$GLD"; then
|
||||||
have_ld_version_script=yes
|
have_ld_version_script=yes
|
||||||
@@ -113,21 +82,8 @@ else
|
|||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
AC_MSG_WARN(*** You have not enabled versioned symbols.)
|
AC_MSG_WARN(*** You have not enabled versioned symbols.)
|
||||||
fi
|
fi
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
|
AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
|
||||||
|
|
||||||
if test "$have_ld_version_script" = "yes"; then
|
|
||||||
AC_MSG_CHECKING([for symbol prefix])
|
|
||||||
SYMBOL_PREFIX=`echo "PREFIX=__USER_LABEL_PREFIX__" \
|
|
||||||
| ${CPP-${CC-gcc} -E} - 2>&1 \
|
|
||||||
| ${EGREP-grep} "^PREFIX=" \
|
|
||||||
| ${SED-sed} "s:^PREFIX=::"`
|
|
||||||
AC_SUBST(SYMBOL_PREFIX)
|
|
||||||
AC_MSG_RESULT($SYMBOL_PREFIX)
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Substitutions for .in files
|
# Substitutions for .in files
|
||||||
AC_SUBST(PNGLIB_VERSION)
|
AC_SUBST(PNGLIB_VERSION)
|
||||||
AC_SUBST(PNGLIB_MAJOR)
|
AC_SUBST(PNGLIB_MAJOR)
|
||||||
@@ -159,9 +115,23 @@ AC_ARG_WITH(binconfigs,
|
|||||||
[binconfigs='${binconfigs}'])
|
[binconfigs='${binconfigs}'])
|
||||||
AC_SUBST([binconfigs])
|
AC_SUBST([binconfigs])
|
||||||
|
|
||||||
|
# Allow the old version number library, libpng.so, to be removed from
|
||||||
|
# the build
|
||||||
|
AC_ARG_WITH(libpng-compat,
|
||||||
|
AC_HELP_STRING([--with-libpng-compat],
|
||||||
|
[Generate the obsolete libpng.so library @<:@default=yes@:>@]),
|
||||||
|
[if test "${withval}" = no; then
|
||||||
|
compatlib=
|
||||||
|
AC_MSG_NOTICE([libpng.so will not be built])
|
||||||
|
else
|
||||||
|
compatlib=libpng.la
|
||||||
|
fi],
|
||||||
|
[compatlib=libpng.la])
|
||||||
|
AC_SUBST([compatlib])
|
||||||
|
|
||||||
# Config files, substituting as above
|
# Config files, substituting as above
|
||||||
AC_CONFIG_FILES([Makefile libpng.pc:libpng.pc.in])
|
AC_CONFIG_FILES([Makefile libpng.pc:scripts/libpng.pc-configure.in])
|
||||||
AC_CONFIG_FILES([libpng-config:libpng-config.in],
|
AC_CONFIG_FILES([libpng-config:scripts/libpng-config.in],
|
||||||
[chmod +x libpng-config])
|
[chmod +x libpng-config])
|
||||||
|
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
GNU GENERAL PUBLIC LICENSE
|
GNU GENERAL PUBLIC LICENSE
|
||||||
Version 2, June 1991
|
Version 2, June 1991
|
||||||
|
|
||||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
Preamble
|
Preamble
|
||||||
|
|
||||||
The licenses for most software are designed to take away your
|
The licenses for most software are designed to take away your
|
||||||
freedom to share and change it. By contrast, the GNU General Public
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
@@ -56,7 +56,7 @@ patent must be licensed for everyone's free use or not licensed at all.
|
|||||||
The precise terms and conditions for copying, distribution and
|
The precise terms and conditions for copying, distribution and
|
||||||
modification follow.
|
modification follow.
|
||||||
|
|
||||||
GNU GENERAL PUBLIC LICENSE
|
GNU GENERAL PUBLIC LICENSE
|
||||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
0. This License applies to any program or other work which contains
|
0. This License applies to any program or other work which contains
|
||||||
@@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals
|
|||||||
of preserving the free status of all derivatives of our free software and
|
of preserving the free status of all derivatives of our free software and
|
||||||
of promoting the sharing and reuse of software generally.
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
NO WARRANTY
|
NO WARRANTY
|
||||||
|
|
||||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
@@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
|||||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
POSSIBILITY OF SUCH DAMAGES.
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
If you develop a new program, and you want it to be of the greatest
|
||||||
possible use to the public, the best way to achieve this is to make it
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 1998-2008 Greg Roelofs. All rights reserved.
|
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
|
||||||
|
|
||||||
This software is provided "as is," without warranty of any kind,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
express or implied. In no event shall the author or contributors
|
||||||
|
|||||||
@@ -23,9 +23,9 @@
|
|||||||
|
|
||||||
# macros --------------------------------------------------------------------
|
# macros --------------------------------------------------------------------
|
||||||
|
|
||||||
PNGINC = -I/usr/local/include/libpng15
|
PNGINC = -I/usr/local/include/libpng12
|
||||||
PNGLIB = -L/usr/local/lib -lpng15 # dynamically linked against libpng
|
PNGLIB = -L/usr/local/lib -lpng12 # dynamically linked against libpng
|
||||||
#PNGLIB = /usr/local/lib/libpng15.a # statically linked against libpng
|
#PNGLIB = /usr/local/lib/libpng12.a # statically linked against libpng
|
||||||
# or:
|
# or:
|
||||||
#PNGINC = -I../..
|
#PNGINC = -I../..
|
||||||
#PNGLIB = -L../.. -lpng
|
#PNGLIB = -L../.. -lpng
|
||||||
|
|||||||
@@ -26,14 +26,14 @@
|
|||||||
# macros --------------------------------------------------------------------
|
# macros --------------------------------------------------------------------
|
||||||
|
|
||||||
#PNGDIR = /usr/local/lib
|
#PNGDIR = /usr/local/lib
|
||||||
#PNGINC = -I/usr/local/include/libpng15
|
#PNGINC = -I/usr/local/include/libpng12
|
||||||
#PNGLIBd = -L$(PNGDIR) -lpng15 # dynamically linked, installed libpng
|
#PNGLIBd = -L$(PNGDIR) -lpng12 # dynamically linked, installed libpng
|
||||||
#PNGLIBs = $(PNGDIR)/libpng15.a # statically linked, installed libpng
|
#PNGLIBs = $(PNGDIR)/libpng12.a # statically linked, installed libpng
|
||||||
# or:
|
# or:
|
||||||
PNGDIR = ../..# this one is for libpng-x.y.z/contrib/gregbook builds
|
PNGDIR = ../..# this one is for libpng-x.y.z/contrib/gregbook builds
|
||||||
#PNGDIR = ../libpng
|
#PNGDIR = ../libpng
|
||||||
PNGINC = -I$(PNGDIR)
|
PNGINC = -I$(PNGDIR)
|
||||||
PNGLIBd = -Wl,-rpath,$(PNGDIR) -L$(PNGDIR) -lpng15 # dynamically linked
|
PNGLIBd = -Wl,-rpath,$(PNGDIR) -L$(PNGDIR) -lpng12 # dynamically linked
|
||||||
PNGLIBs = $(PNGDIR)/libpng.a # statically linked, local libpng
|
PNGLIBs = $(PNGDIR)/libpng.a # statically linked, local libpng
|
||||||
|
|
||||||
ZDIR = /usr/local/lib
|
ZDIR = /usr/local/lib
|
||||||
|
|||||||
@@ -56,16 +56,16 @@ mation and links to the latest version of the source code, and Chapters
|
|||||||
|
|
||||||
Greg Roelofs
|
Greg Roelofs
|
||||||
http://pobox.com/~newt/greg_contact.html
|
http://pobox.com/~newt/greg_contact.html
|
||||||
16 March 2008
|
2 June 2007
|
||||||
|
|
||||||
|
|
||||||
BUILD INSTRUCTIONS
|
BUILD INSTRUCTIONS
|
||||||
|
|
||||||
- Prerequisites (in order of compilation):
|
- Prerequisites (in order of compilation):
|
||||||
|
|
||||||
- zlib http://zlib.net/
|
- zlib http://zlib.net/
|
||||||
- libpng http://www.libpng.org/pub/png/libpng.html
|
- libpng http://www.libpng.org/pub/png/libpng.html
|
||||||
- pngbook http://www.libpng.org/pub/png/book/sources.html
|
- pngbook http://www.libpng.org/pub/png/book/sources.html
|
||||||
|
|
||||||
The pngbook demo programs are explicitly designed to demonstrate proper
|
The pngbook demo programs are explicitly designed to demonstrate proper
|
||||||
coding techniques for using the libpng reference library. As a result,
|
coding techniques for using the libpng reference library. As a result,
|
||||||
@@ -165,19 +165,19 @@ RUNNING THE PROGRAMS: (VERY) BRIEF INTRO
|
|||||||
rpng is a simple PNG viewer that can display transparent PNGs with a
|
rpng is a simple PNG viewer that can display transparent PNGs with a
|
||||||
specified background color; for example,
|
specified background color; for example,
|
||||||
|
|
||||||
rpng -bgcolor \#ff0000 toucan.png
|
rpng -bgcolor #ff0000 toucan.png
|
||||||
|
|
||||||
would display the image with a red background. rpng2 is a progressive
|
would display the image with a red background. rpng2 is a progressive
|
||||||
viewer that simulates a web browser in some respects; it can display
|
viewer that simulates a web browser in some respects; it can display
|
||||||
images against either a background color or a dynamically generated
|
images against either a background color or a dynamically generated
|
||||||
background image. For example:
|
background image. For example:
|
||||||
|
|
||||||
rpng2 -bgpat 16 toucan.png
|
rpng2 -bgpat 16 toucan.png
|
||||||
|
|
||||||
wpng is a purely command-line image converter from binary PBMPLUS/NetPBM
|
wpng is a purely command-line image converter from binary PBMPLUS/NetPBM
|
||||||
format (.pgm or .ppm) to PNG; for example,
|
format (.pgm or .ppm) to PNG; for example,
|
||||||
|
|
||||||
wpng -time < toucan-notrans.ppm > toucan-notrans.png
|
wpng -time < toucan-notrans.ppm > toucan-notrans.png
|
||||||
|
|
||||||
would convert the specified PPM file (using redirection) to PNG, auto-
|
would convert the specified PPM file (using redirection) to PNG, auto-
|
||||||
matically setting the PNG modification-time chunk.
|
matically setting the PNG modification-time chunk.
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ int readpng_init(FILE *infile, ulg *pWidth, ulg *pHeight)
|
|||||||
* have used slightly more general png_sig_cmp() function instead */
|
* have used slightly more general png_sig_cmp() function instead */
|
||||||
|
|
||||||
fread(sig, 1, 8, infile);
|
fread(sig, 1, 8, infile);
|
||||||
if (png_sig_cmp(sig, 0, 8))
|
if (!png_check_sig(sig, 8))
|
||||||
return 1; /* bad signature */
|
return 1; /* bad signature */
|
||||||
|
|
||||||
|
|
||||||
@@ -263,8 +263,7 @@ uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Trace((stderr, "readpng_get_image: channels = %d, rowbytes = %ld, height = %ld\n",
|
Trace((stderr, "readpng_get_image: channels = %d, rowbytes = %ld, height = %ld\n", *pChannels, rowbytes, height));
|
||||||
*pChannels, rowbytes, height));
|
|
||||||
|
|
||||||
|
|
||||||
/* set the individual row_pointers to point at the correct offsets */
|
/* set the individual row_pointers to point at the correct offsets */
|
||||||
|
|||||||
@@ -55,10 +55,8 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <stdlib.h> /* for exit() prototype */
|
#include <stdlib.h> /* for exit() prototype */
|
||||||
#include <setjmp.h>
|
|
||||||
|
|
||||||
#include <zlib.h>
|
#include "png.h" /* libpng header; includes zlib.h and setjmp.h */
|
||||||
#include "png.h" /* libpng header from the local directory */
|
|
||||||
#include "readpng2.h" /* typedefs, common macros, public prototypes */
|
#include "readpng2.h" /* typedefs, common macros, public prototypes */
|
||||||
|
|
||||||
|
|
||||||
@@ -75,10 +73,84 @@ static void readpng2_error_handler(png_structp png_ptr, png_const_charp msg);
|
|||||||
|
|
||||||
void readpng2_version_info(void)
|
void readpng2_version_info(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, " Compiled with libpng %s; using libpng %s\n",
|
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && \
|
||||||
PNG_LIBPNG_VER_STRING, png_libpng_ver);
|
(defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) && \
|
||||||
|
defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
||||||
|
/*
|
||||||
|
* WARNING: This preprocessor approach means that the following code
|
||||||
|
* cannot be used with a libpng DLL older than 1.2.0--the
|
||||||
|
* compiled-in symbols for the new functions will not exist.
|
||||||
|
* (Could use dlopen() and dlsym() on Unix and corresponding
|
||||||
|
* calls for Windows, but not portable...)
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
int mmxsupport = png_mmx_support();
|
||||||
|
if (mmxsupport < 0)
|
||||||
|
fprintf(stderr, " Compiled with libpng %s; using libpng %s "
|
||||||
|
"without MMX support.\n", PNG_LIBPNG_VER_STRING, png_libpng_ver);
|
||||||
|
else {
|
||||||
|
int compilerID;
|
||||||
|
png_uint_32 mmx_mask = png_get_mmx_flagmask(
|
||||||
|
PNG_SELECT_READ | PNG_SELECT_WRITE, &compilerID);
|
||||||
|
|
||||||
fprintf(stderr, " and with zlib %s; using zlib %s.\n",
|
fprintf(stderr, " Compiled with libpng %s; using libpng %s "
|
||||||
|
"with MMX support\n (%s version).", PNG_LIBPNG_VER_STRING,
|
||||||
|
png_libpng_ver, compilerID == 1? "MSVC++" :
|
||||||
|
(compilerID == 2? "GNU C" : "unknown"));
|
||||||
|
fprintf(stderr, " Processor (x86%s) %s MMX instructions.\n",
|
||||||
|
#if defined(__x86_64__)
|
||||||
|
"_64",
|
||||||
|
#else
|
||||||
|
"",
|
||||||
|
#endif
|
||||||
|
mmxsupport? "supports" : "does not support");
|
||||||
|
if (mmxsupport > 0) {
|
||||||
|
int num_optims = 0;
|
||||||
|
|
||||||
|
fprintf(stderr,
|
||||||
|
" Potential MMX optimizations supported by libpng:\n");
|
||||||
|
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_FILTER_SUB)
|
||||||
|
++num_optims;
|
||||||
|
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_FILTER_UP)
|
||||||
|
++num_optims;
|
||||||
|
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_FILTER_AVG)
|
||||||
|
++num_optims;
|
||||||
|
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH)
|
||||||
|
++num_optims;
|
||||||
|
if (num_optims)
|
||||||
|
fprintf(stderr,
|
||||||
|
" decoding %s row filters (reading)\n",
|
||||||
|
(num_optims == 4)? "all non-trivial" : "some");
|
||||||
|
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) {
|
||||||
|
fprintf(stderr, " combining rows (reading)\n");
|
||||||
|
++num_optims;
|
||||||
|
}
|
||||||
|
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_INTERLACE) {
|
||||||
|
fprintf(stderr,
|
||||||
|
" expanding interlacing (reading)\n");
|
||||||
|
++num_optims;
|
||||||
|
}
|
||||||
|
mmx_mask &= ~( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_INTERLACE \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_UP \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH );
|
||||||
|
if (mmx_mask) {
|
||||||
|
fprintf(stderr, " other (unknown)\n");
|
||||||
|
++num_optims;
|
||||||
|
}
|
||||||
|
if (num_optims == 0)
|
||||||
|
fprintf(stderr, " (none)\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
fprintf(stderr, " Compiled with libpng %s; using libpng %s "
|
||||||
|
"without MMX support.\n", PNG_LIBPNG_VER_STRING, png_libpng_ver);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
fprintf(stderr, " Compiled with zlib %s; using zlib %s.\n",
|
||||||
ZLIB_VERSION, zlib_version);
|
ZLIB_VERSION, zlib_version);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,7 +159,7 @@ void readpng2_version_info(void)
|
|||||||
|
|
||||||
int readpng2_check_sig(uch *sig, int num)
|
int readpng2_check_sig(uch *sig, int num)
|
||||||
{
|
{
|
||||||
return !png_sig_cmp(sig, 0, num);
|
return png_check_sig(sig, num);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -131,7 +203,7 @@ int readpng2_init(mainprog_info *mainprog_ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
/* prepare the reader to ignore all recognized chunks whose data won't be
|
/* prepare the reader to ignore all recognized chunks whose data won't be
|
||||||
* used, i.e., all chunks recognized by libpng except for IHDR, PLTE, IDAT,
|
* used, i.e., all chunks recognized by libpng except for IHDR, PLTE, IDAT,
|
||||||
* IEND, tRNS, bKGD, gAMA, and sRGB (small performance improvement) */
|
* IEND, tRNS, bKGD, gAMA, and sRGB (small performance improvement) */
|
||||||
@@ -140,7 +212,7 @@ int readpng2_init(mainprog_info *mainprog_ptr)
|
|||||||
* version recognizes more chunks, add them to this list. If a
|
* version recognizes more chunks, add them to this list. If a
|
||||||
* future version of readpng2.c recognizes more chunks, delete them
|
* future version of readpng2.c recognizes more chunks, delete them
|
||||||
* from this list. */
|
* from this list. */
|
||||||
static /* const */ png_byte chunks_to_ignore[] = {
|
static const png_byte chunks_to_ignore[] = {
|
||||||
99, 72, 82, 77, '\0', /* cHRM */
|
99, 72, 82, 77, '\0', /* cHRM */
|
||||||
104, 73, 83, 84, '\0', /* hIST */
|
104, 73, 83, 84, '\0', /* hIST */
|
||||||
105, 67, 67, 80, '\0', /* iCCP */
|
105, 67, 67, 80, '\0', /* iCCP */
|
||||||
@@ -160,7 +232,7 @@ int readpng2_init(mainprog_info *mainprog_ptr)
|
|||||||
png_set_keep_unknown_chunks(png_ptr, 1 /* PNG_HANDLE_CHUNK_NEVER */,
|
png_set_keep_unknown_chunks(png_ptr, 1 /* PNG_HANDLE_CHUNK_NEVER */,
|
||||||
chunks_to_ignore, sizeof(chunks_to_ignore)/5);
|
chunks_to_ignore, sizeof(chunks_to_ignore)/5);
|
||||||
}
|
}
|
||||||
#endif /* PNG_HANDLE_AS_UNKNOWN_SUPPORTED */
|
#endif /* PNG_UNKNOWN_CHUNKS_SUPPORTED */
|
||||||
|
|
||||||
|
|
||||||
/* instead of doing png_init_io() here, now we set up our callback
|
/* instead of doing png_init_io() here, now we set up our callback
|
||||||
@@ -170,6 +242,96 @@ int readpng2_init(mainprog_info *mainprog_ptr)
|
|||||||
readpng2_info_callback, readpng2_row_callback, readpng2_end_callback);
|
readpng2_info_callback, readpng2_row_callback, readpng2_end_callback);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* may as well enable or disable MMX routines here, if supported;
|
||||||
|
*
|
||||||
|
* to enable all: mask = png_get_mmx_flagmask (
|
||||||
|
* PNG_SELECT_READ | PNG_SELECT_WRITE, &compilerID);
|
||||||
|
* flags = png_get_asm_flags (png_ptr);
|
||||||
|
* flags |= mask;
|
||||||
|
* png_set_asm_flags (png_ptr, flags);
|
||||||
|
*
|
||||||
|
* to disable all: mask = png_get_mmx_flagmask (
|
||||||
|
* PNG_SELECT_READ | PNG_SELECT_WRITE, &compilerID);
|
||||||
|
* flags = png_get_asm_flags (png_ptr);
|
||||||
|
* flags &= ~mask;
|
||||||
|
* png_set_asm_flags (png_ptr, flags);
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) && \
|
||||||
|
defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
||||||
|
/*
|
||||||
|
* WARNING: This preprocessor approach means that the following code
|
||||||
|
* cannot be used with a libpng DLL older than 1.2.0--the
|
||||||
|
* compiled-in symbols for the new functions will not exist.
|
||||||
|
* (Could use dlopen() and dlsym() on Unix and corresponding
|
||||||
|
* calls for Windows, but not portable...)
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
|
||||||
|
png_uint_32 mmx_disable_mask = 0;
|
||||||
|
png_uint_32 asm_flags, mmx_mask;
|
||||||
|
int compilerID;
|
||||||
|
|
||||||
|
if (mainprog_ptr->nommxfilters)
|
||||||
|
mmx_disable_mask |= ( PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_UP \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH );
|
||||||
|
if (mainprog_ptr->nommxcombine)
|
||||||
|
mmx_disable_mask |= PNG_ASM_FLAG_MMX_READ_COMBINE_ROW;
|
||||||
|
if (mainprog_ptr->nommxinterlace)
|
||||||
|
mmx_disable_mask |= PNG_ASM_FLAG_MMX_READ_INTERLACE;
|
||||||
|
asm_flags = png_get_asm_flags(png_ptr);
|
||||||
|
png_set_asm_flags(png_ptr, asm_flags & ~mmx_disable_mask);
|
||||||
|
|
||||||
|
|
||||||
|
/* Now query libpng's asm settings, just for yuks. Note that this
|
||||||
|
* differs from the querying of its *potential* MMX capabilities
|
||||||
|
* in readpng2_version_info(); this is true runtime verification. */
|
||||||
|
|
||||||
|
asm_flags = png_get_asm_flags(png_ptr);
|
||||||
|
mmx_mask = png_get_mmx_flagmask(PNG_SELECT_READ | PNG_SELECT_WRITE,
|
||||||
|
&compilerID);
|
||||||
|
if (asm_flags & PNG_ASM_FLAG_MMX_SUPPORT_COMPILED)
|
||||||
|
fprintf(stderr,
|
||||||
|
" MMX support (%s version) is compiled into libpng\n",
|
||||||
|
compilerID == 1? "MSVC++" :
|
||||||
|
(compilerID == 2? "GNU C" : "unknown"));
|
||||||
|
else
|
||||||
|
fprintf(stderr, " MMX support is not compiled into libpng\n");
|
||||||
|
fprintf(stderr, " MMX instructions are %ssupported by CPU\n",
|
||||||
|
(asm_flags & PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU)? "" : "not ");
|
||||||
|
fprintf(stderr, " MMX read support for combining rows is %sabled\n",
|
||||||
|
(asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)? "en" : "dis");
|
||||||
|
fprintf(stderr,
|
||||||
|
" MMX read support for expanding interlacing is %sabled\n",
|
||||||
|
(asm_flags & PNG_ASM_FLAG_MMX_READ_INTERLACE)? "en" : "dis");
|
||||||
|
fprintf(stderr, " MMX read support for \"sub\" filter is %sabled\n",
|
||||||
|
(asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB)? "en" : "dis");
|
||||||
|
fprintf(stderr, " MMX read support for \"up\" filter is %sabled\n",
|
||||||
|
(asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP)? "en" : "dis");
|
||||||
|
fprintf(stderr, " MMX read support for \"avg\" filter is %sabled\n",
|
||||||
|
(asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG)? "en" : "dis");
|
||||||
|
fprintf(stderr, " MMX read support for \"Paeth\" filter is %sabled\n",
|
||||||
|
(asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH)? "en" : "dis");
|
||||||
|
asm_flags &= (mmx_mask & ~( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_INTERLACE \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_UP \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ));
|
||||||
|
if (asm_flags)
|
||||||
|
fprintf(stderr,
|
||||||
|
" additional MMX support is also enabled (0x%02lx)\n",
|
||||||
|
asm_flags);
|
||||||
|
#else /* !PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||||
|
fprintf(stderr, " MMX querying is disabled in libpng.\n");
|
||||||
|
#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* make sure we save our pointers for use in readpng2_decode_data() */
|
/* make sure we save our pointers for use in readpng2_decode_data() */
|
||||||
|
|
||||||
mainprog_ptr->png_ptr = png_ptr;
|
mainprog_ptr->png_ptr = png_ptr;
|
||||||
@@ -217,12 +379,7 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
|
|||||||
{
|
{
|
||||||
mainprog_info *mainprog_ptr;
|
mainprog_info *mainprog_ptr;
|
||||||
int color_type, bit_depth;
|
int color_type, bit_depth;
|
||||||
png_uint_32 width, height;
|
|
||||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
|
||||||
double gamma;
|
double gamma;
|
||||||
#else
|
|
||||||
png_fixed_point gamma;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* setjmp() doesn't make sense here, because we'd either have to exit(),
|
/* setjmp() doesn't make sense here, because we'd either have to exit(),
|
||||||
@@ -257,10 +414,8 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
|
|||||||
|
|
||||||
/* this is just like in the non-progressive case */
|
/* this is just like in the non-progressive case */
|
||||||
|
|
||||||
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
|
png_get_IHDR(png_ptr, info_ptr, &mainprog_ptr->width,
|
||||||
NULL, NULL, NULL);
|
&mainprog_ptr->height, &bit_depth, &color_type, NULL, NULL, NULL);
|
||||||
mainprog_ptr->width = (ulg)width;
|
|
||||||
mainprog_ptr->height = (ulg)height;
|
|
||||||
|
|
||||||
|
|
||||||
/* since we know we've read all of the PNG file's "header" (i.e., up
|
/* since we know we've read all of the PNG file's "header" (i.e., up
|
||||||
@@ -333,19 +488,11 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
|
|||||||
* "gamma" value for the entire display system, i.e., the product of
|
* "gamma" value for the entire display system, i.e., the product of
|
||||||
* LUT_exponent and CRT_exponent. */
|
* LUT_exponent and CRT_exponent. */
|
||||||
|
|
||||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
|
||||||
if (png_get_gAMA(png_ptr, info_ptr, &gamma))
|
if (png_get_gAMA(png_ptr, info_ptr, &gamma))
|
||||||
png_set_gamma(png_ptr, mainprog_ptr->display_exponent, gamma);
|
png_set_gamma(png_ptr, mainprog_ptr->display_exponent, gamma);
|
||||||
else
|
else
|
||||||
png_set_gamma(png_ptr, mainprog_ptr->display_exponent, 0.45455);
|
png_set_gamma(png_ptr, mainprog_ptr->display_exponent, 0.45455);
|
||||||
#else
|
|
||||||
if (png_get_gAMA_fixed(png_ptr, info_ptr, &gamma))
|
|
||||||
png_set_gamma_fixed(png_ptr,
|
|
||||||
(png_fixed_point)(100000*mainprog_ptr->display_exponent+.5), gamma);
|
|
||||||
else
|
|
||||||
png_set_gamma_fixed(png_ptr,
|
|
||||||
(png_fixed_point)(100000*mainprog_ptr->display_exponent+.5), 45455);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* we'll let libpng expand interlaced images, too */
|
/* we'll let libpng expand interlaced images, too */
|
||||||
|
|
||||||
@@ -494,12 +641,5 @@ static void readpng2_error_handler(png_structp png_ptr, png_const_charp msg)
|
|||||||
exit(99);
|
exit(99);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now we have our data structure we can use the information in it
|
|
||||||
* to return control to our own higher level code (all the points
|
|
||||||
* where 'setjmp' is called in this file.) This will work with other
|
|
||||||
* error handling mechanisms as well - libpng always calls png_error
|
|
||||||
* when it can proceed no further, thus, so long as the error handler
|
|
||||||
* is intercepted, application code can do its own error recovery.
|
|
||||||
*/
|
|
||||||
longjmp(mainprog_ptr->jmpbuf, 1);
|
longjmp(mainprog_ptr->jmpbuf, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 1998-2008 Greg Roelofs. All rights reserved.
|
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
|
||||||
|
|
||||||
This software is provided "as is," without warranty of any kind,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
express or implied. In no event shall the author or contributors
|
||||||
@@ -69,12 +69,6 @@
|
|||||||
# define Trace(x) ;
|
# define Trace(x) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum rpng2_states {
|
|
||||||
kPreInit = 0,
|
|
||||||
kWindowInit,
|
|
||||||
kDone
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef unsigned char uch;
|
typedef unsigned char uch;
|
||||||
typedef unsigned short ush;
|
typedef unsigned short ush;
|
||||||
typedef unsigned long ulg;
|
typedef unsigned long ulg;
|
||||||
@@ -96,7 +90,12 @@ typedef struct _mainprog_info {
|
|||||||
int rowbytes;
|
int rowbytes;
|
||||||
int channels;
|
int channels;
|
||||||
int need_bgcolor;
|
int need_bgcolor;
|
||||||
int state;
|
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
|
||||||
|
int nommxfilters;
|
||||||
|
int nommxcombine;
|
||||||
|
int nommxinterlace;
|
||||||
|
#endif
|
||||||
|
int done;
|
||||||
uch bg_red;
|
uch bg_red;
|
||||||
uch bg_green;
|
uch bg_green;
|
||||||
uch bg_blue;
|
uch bg_blue;
|
||||||
|
|||||||
@@ -23,11 +23,10 @@
|
|||||||
command-line parsing bug
|
command-line parsing bug
|
||||||
- 1.10: enabled "message window"/console (thanks to David Geldreich)
|
- 1.10: enabled "message window"/console (thanks to David Geldreich)
|
||||||
- 2.00: dual-licensed (added GNU GPL)
|
- 2.00: dual-licensed (added GNU GPL)
|
||||||
- 2.01: fixed improper display of usage screen on PNG error(s)
|
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 1998-2008 Greg Roelofs. All rights reserved.
|
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
|
||||||
|
|
||||||
This software is provided "as is," without warranty of any kind,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
express or implied. In no event shall the author or contributors
|
||||||
@@ -78,40 +77,14 @@
|
|||||||
|
|
||||||
#define PROGNAME "rpng-win"
|
#define PROGNAME "rpng-win"
|
||||||
#define LONGNAME "Simple PNG Viewer for Windows"
|
#define LONGNAME "Simple PNG Viewer for Windows"
|
||||||
#define VERSION "2.01 of 16 March 2008"
|
#define VERSION "2.00 of 2 June 2007"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#ifdef __CYGWIN__
|
|
||||||
/* getch replacement. Turns out, we don't really need this,
|
|
||||||
* but leave it here if we ever enable any of the uses of
|
|
||||||
* _getch in the main code
|
|
||||||
*/
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <termio.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
int repl_getch( void )
|
|
||||||
{
|
|
||||||
char ch;
|
|
||||||
int fd = fileno(stdin);
|
|
||||||
struct termio old_tty, new_tty;
|
|
||||||
|
|
||||||
ioctl(fd, TCGETA, &old_tty);
|
|
||||||
new_tty = old_tty;
|
|
||||||
new_tty.c_lflag &= ~(ICANON | ECHO | ISIG);
|
|
||||||
ioctl(fd, TCSETA, &new_tty);
|
|
||||||
fread(&ch, 1, sizeof(ch), stdin);
|
|
||||||
ioctl(fd, TCSETA, &old_tty);
|
|
||||||
|
|
||||||
return ch;
|
|
||||||
}
|
|
||||||
#define _getch repl_getch
|
|
||||||
#else
|
|
||||||
#include <conio.h> /* only for _getch() */
|
#include <conio.h> /* only for _getch() */
|
||||||
#endif
|
|
||||||
|
|
||||||
/* #define DEBUG : this enables the Trace() macros */
|
/* #define DEBUG : this enables the Trace() macros */
|
||||||
|
|
||||||
@@ -179,7 +152,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
|
|
||||||
filename = (char *)NULL;
|
filename = (char *)NULL;
|
||||||
|
|
||||||
#ifndef __CYGWIN__
|
|
||||||
/* First reenable console output, which normally goes to the bit bucket
|
/* First reenable console output, which normally goes to the bit bucket
|
||||||
* for windowed apps. Closing the console window will terminate the
|
* for windowed apps. Closing the console window will terminate the
|
||||||
* app. Thanks to David.Geldreich@realviz.com for supplying the magical
|
* app. Thanks to David.Geldreich@realviz.com for supplying the magical
|
||||||
@@ -188,7 +161,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
AllocConsole();
|
AllocConsole();
|
||||||
freopen("CONOUT$", "a", stderr);
|
freopen("CONOUT$", "a", stderr);
|
||||||
freopen("CONOUT$", "a", stdout);
|
freopen("CONOUT$", "a", stdout);
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Next set the default value for our display-system exponent, i.e.,
|
/* Next set the default value for our display-system exponent, i.e.,
|
||||||
@@ -299,43 +271,9 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!filename)
|
if (!filename) {
|
||||||
++error;
|
++error;
|
||||||
|
} else if (!(infile = fopen(filename, "rb"))) {
|
||||||
|
|
||||||
/* print usage screen if any errors up to this point */
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
#ifndef __CYGWIN__
|
|
||||||
int ch;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname);
|
|
||||||
readpng_version_info();
|
|
||||||
fprintf(stderr, "\n"
|
|
||||||
"Usage: %s [-gamma exp] [-bgcolor bg] file.png\n"
|
|
||||||
" exp \ttransfer-function exponent (``gamma'') of the display\n"
|
|
||||||
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
|
|
||||||
"\t\t to the product of the lookup-table exponent (varies)\n"
|
|
||||||
"\t\t and the CRT exponent (usually 2.2); must be positive\n"
|
|
||||||
" bg \tdesired background color in 7-character hex RGB format\n"
|
|
||||||
"\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
|
|
||||||
"\t\t used with transparent images\n"
|
|
||||||
"\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
|
|
||||||
#ifndef __CYGWIN__
|
|
||||||
"Press Q or Esc to quit this usage screen.\n"
|
|
||||||
#endif
|
|
||||||
"\n", PROGNAME, default_display_exponent);
|
|
||||||
#ifndef __CYGWIN__
|
|
||||||
do
|
|
||||||
ch = _getch();
|
|
||||||
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
|
|
||||||
#endif
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (!(infile = fopen(filename, "rb"))) {
|
|
||||||
fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename);
|
fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename);
|
||||||
++error;
|
++error;
|
||||||
} else {
|
} else {
|
||||||
@@ -348,7 +286,8 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
fprintf(stderr, PROGNAME
|
fprintf(stderr, PROGNAME
|
||||||
": [%s] has bad IHDR (libpng longjmp)\n", filename);
|
": [%s] has bad IHDR (libpng longjmp)\n",
|
||||||
|
filename);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
fprintf(stderr, PROGNAME ": insufficient memory\n");
|
fprintf(stderr, PROGNAME ": insufficient memory\n");
|
||||||
@@ -365,25 +304,34 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (error) {
|
/* usage screen */
|
||||||
#ifndef __CYGWIN__
|
|
||||||
int ch;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fprintf(stderr, PROGNAME ": aborting.\n");
|
if (error) {
|
||||||
#ifndef __CYGWIN__
|
int ch;
|
||||||
|
|
||||||
|
fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname);
|
||||||
|
readpng_version_info();
|
||||||
|
fprintf(stderr, "\n"
|
||||||
|
"Usage: %s [-gamma exp] [-bgcolor bg] file.png\n"
|
||||||
|
" exp \ttransfer-function exponent (``gamma'') of the display\n"
|
||||||
|
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
|
||||||
|
"\t\t to the product of the lookup-table exponent (varies)\n"
|
||||||
|
"\t\t and the CRT exponent (usually 2.2); must be positive\n"
|
||||||
|
" bg \tdesired background color in 7-character hex RGB format\n"
|
||||||
|
"\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
|
||||||
|
"\t\t used with transparent images\n"
|
||||||
|
"\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
|
||||||
|
"Press Q or Esc to quit this usage screen.\n"
|
||||||
|
"\n", PROGNAME, default_display_exponent);
|
||||||
do
|
do
|
||||||
ch = _getch();
|
ch = _getch();
|
||||||
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
|
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
|
||||||
#endif
|
exit(1);
|
||||||
exit(2);
|
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
|
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
|
||||||
#ifndef __CYGWIN__
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"\n [console window: closing this window will terminate %s]\n\n",
|
"\n [console window: closing this window will terminate %s]\n\n",
|
||||||
PROGNAME);
|
PROGNAME);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -456,12 +404,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
/* wait for the user to tell us when to quit */
|
/* wait for the user to tell us when to quit */
|
||||||
|
|
||||||
printf(
|
printf(
|
||||||
#ifndef __CYGWIN__
|
"Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n");
|
||||||
"Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n"
|
|
||||||
#else
|
|
||||||
"Done. Press mouse button 1 (within image window) to quit.\n"
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
while (GetMessage(&msg, NULL, 0, 0)) {
|
while (GetMessage(&msg, NULL, 0, 0)) {
|
||||||
|
|||||||
@@ -25,11 +25,10 @@
|
|||||||
- 1.13: fixed XFreeGC() crash bug (thanks to Patrick Welche)
|
- 1.13: fixed XFreeGC() crash bug (thanks to Patrick Welche)
|
||||||
- 1.14: added support for X resources (thanks to Gerhard Niklasch)
|
- 1.14: added support for X resources (thanks to Gerhard Niklasch)
|
||||||
- 2.00: dual-licensed (added GNU GPL)
|
- 2.00: dual-licensed (added GNU GPL)
|
||||||
- 2.01: fixed improper display of usage screen on PNG error(s)
|
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 1998-2008 Greg Roelofs. All rights reserved.
|
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
|
||||||
|
|
||||||
This software is provided "as is," without warranty of any kind,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
express or implied. In no event shall the author or contributors
|
||||||
@@ -80,9 +79,9 @@
|
|||||||
|
|
||||||
#define PROGNAME "rpng-x"
|
#define PROGNAME "rpng-x"
|
||||||
#define LONGNAME "Simple PNG Viewer for X"
|
#define LONGNAME "Simple PNG Viewer for X"
|
||||||
#define VERSION "2.01 of 16 March 2008"
|
#define VERSION "2.00 of 2 June 2007"
|
||||||
#define RESNAME "rpng" /* our X resource application name */
|
#define RESNAME "rpng" /* our X resource application name */
|
||||||
#define RESCLASS "Rpng" /* our X resource class name */
|
#define RESCLASS "Rpng" /* our X resource class name */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -266,33 +265,9 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!filename)
|
if (!filename) {
|
||||||
++error;
|
++error;
|
||||||
|
} else if (!(infile = fopen(filename, "rb"))) {
|
||||||
|
|
||||||
/* print usage screen if any errors up to this point */
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
|
|
||||||
readpng_version_info();
|
|
||||||
fprintf(stderr, "\n"
|
|
||||||
"Usage: %s [-display xdpy] [-gamma exp] [-bgcolor bg] file.png\n"
|
|
||||||
" xdpy\tname of the target X display (e.g., ``hostname:0'')\n"
|
|
||||||
" exp \ttransfer-function exponent (``gamma'') of the display\n"
|
|
||||||
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
|
|
||||||
"\t\t to the product of the lookup-table exponent (varies)\n"
|
|
||||||
"\t\t and the CRT exponent (usually 2.2); must be positive\n"
|
|
||||||
" bg \tdesired background color in 7-character hex RGB format\n"
|
|
||||||
"\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
|
|
||||||
"\t\t used with transparent images\n"
|
|
||||||
"\nPress Q, Esc or mouse button 1 (within image window, after image\n"
|
|
||||||
"is displayed) to quit.\n"
|
|
||||||
"\n", PROGNAME, default_display_exponent);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (!(infile = fopen(filename, "rb"))) {
|
|
||||||
fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename);
|
fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename);
|
||||||
++error;
|
++error;
|
||||||
} else {
|
} else {
|
||||||
@@ -305,7 +280,8 @@ int main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
fprintf(stderr, PROGNAME
|
fprintf(stderr, PROGNAME
|
||||||
": [%s] has bad IHDR (libpng longjmp)\n", filename);
|
": [%s] has bad IHDR (libpng longjmp)\n",
|
||||||
|
filename);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
fprintf(stderr, PROGNAME ": insufficient memory\n");
|
fprintf(stderr, PROGNAME ": insufficient memory\n");
|
||||||
@@ -330,9 +306,25 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* usage screen */
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
fprintf(stderr, PROGNAME ": aborting.\n");
|
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
|
||||||
exit(2);
|
readpng_version_info();
|
||||||
|
fprintf(stderr, "\n"
|
||||||
|
"Usage: %s [-display xdpy] [-gamma exp] [-bgcolor bg] file.png\n"
|
||||||
|
" xdpy\tname of the target X display (e.g., ``hostname:0'')\n"
|
||||||
|
" exp \ttransfer-function exponent (``gamma'') of the display\n"
|
||||||
|
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
|
||||||
|
"\t\t to the product of the lookup-table exponent (varies)\n"
|
||||||
|
"\t\t and the CRT exponent (usually 2.2); must be positive\n"
|
||||||
|
" bg \tdesired background color in 7-character hex RGB format\n"
|
||||||
|
"\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
|
||||||
|
"\t\t used with transparent images\n"
|
||||||
|
"\nPress Q, Esc or mouse button 1 (within image window, after image\n"
|
||||||
|
"is displayed) to quit.\n"
|
||||||
|
"\n", PROGNAME, default_display_exponent);
|
||||||
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
tweaking (or maybe not). Thanks to Adam Costello and Pieter S. van der
|
tweaking (or maybe not). Thanks to Adam Costello and Pieter S. van der
|
||||||
Meulen for the "diamond" and "radial waves" patterns, respectively.
|
Meulen for the "diamond" and "radial waves" patterns, respectively.
|
||||||
|
|
||||||
to do (someday, maybe):
|
to do:
|
||||||
- handle quoted command-line args (especially filenames with spaces)
|
- handle quoted command-line args (especially filenames with spaces)
|
||||||
- finish resizable checkerboard-gradient (sizes 4-128?)
|
- finish resizable checkerboard-gradient (sizes 4-128?)
|
||||||
- use %.1023s to simplify truncation of title-bar string?
|
- use %.1023s to simplify truncation of title-bar string?
|
||||||
@@ -29,14 +29,10 @@
|
|||||||
- 1.21: made minor tweak to usage screen to fit within 25-line console
|
- 1.21: made minor tweak to usage screen to fit within 25-line console
|
||||||
- 1.22: added AMD64/EM64T support (__x86_64__)
|
- 1.22: added AMD64/EM64T support (__x86_64__)
|
||||||
- 2.00: dual-licensed (added GNU GPL)
|
- 2.00: dual-licensed (added GNU GPL)
|
||||||
- 2.01: fixed 64-bit typo in readpng2.c
|
|
||||||
- 2.02: fixed improper display of usage screen on PNG error(s); fixed
|
|
||||||
unexpected-EOF and file-read-error cases
|
|
||||||
- 2.03: removed runtime MMX-enabling/disabling and obsolete -mmx* options
|
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 1998-2008 Greg Roelofs. All rights reserved.
|
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
|
||||||
|
|
||||||
This software is provided "as is," without warranty of any kind,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
express or implied. In no event shall the author or contributors
|
||||||
@@ -87,7 +83,7 @@
|
|||||||
|
|
||||||
#define PROGNAME "rpng2-win"
|
#define PROGNAME "rpng2-win"
|
||||||
#define LONGNAME "Progressive PNG Viewer for Windows"
|
#define LONGNAME "Progressive PNG Viewer for Windows"
|
||||||
#define VERSION "2.02 of 16 March 2008"
|
#define VERSION "2.00 of 2 June 2007"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -96,33 +92,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <math.h> /* only for PvdM background code */
|
#include <math.h> /* only for PvdM background code */
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#ifdef __CYGWIN__
|
|
||||||
/* getch replacement. Turns out, we don't really need this,
|
|
||||||
* but leave it here if we ever enable any of the uses of
|
|
||||||
* _getch in the main code
|
|
||||||
*/
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <termio.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
int repl_getch( void )
|
|
||||||
{
|
|
||||||
char ch;
|
|
||||||
int fd = fileno(stdin);
|
|
||||||
struct termio old_tty, new_tty;
|
|
||||||
|
|
||||||
ioctl(fd, TCGETA, &old_tty);
|
|
||||||
new_tty = old_tty;
|
|
||||||
new_tty.c_lflag &= ~(ICANON | ECHO | ISIG);
|
|
||||||
ioctl(fd, TCSETA, &new_tty);
|
|
||||||
fread(&ch, 1, sizeof(ch), stdin);
|
|
||||||
ioctl(fd, TCSETA, &old_tty);
|
|
||||||
|
|
||||||
return ch;
|
|
||||||
}
|
|
||||||
#define _getch repl_getch
|
|
||||||
#else
|
|
||||||
#include <conio.h> /* only for _getch() */
|
#include <conio.h> /* only for _getch() */
|
||||||
#endif
|
|
||||||
|
|
||||||
/* all for PvdM background code: */
|
/* all for PvdM background code: */
|
||||||
#ifndef PI
|
#ifndef PI
|
||||||
@@ -296,7 +266,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
filename = (char *)NULL;
|
filename = (char *)NULL;
|
||||||
memset(&rpng2_info, 0, sizeof(mainprog_info));
|
memset(&rpng2_info, 0, sizeof(mainprog_info));
|
||||||
|
|
||||||
#ifndef __CYGWIN__
|
|
||||||
/* Next reenable console output, which normally goes to the bit bucket
|
/* Next reenable console output, which normally goes to the bit bucket
|
||||||
* for windowed apps. Closing the console window will terminate the
|
* for windowed apps. Closing the console window will terminate the
|
||||||
* app. Thanks to David.Geldreich@realviz.com for supplying the magical
|
* app. Thanks to David.Geldreich@realviz.com for supplying the magical
|
||||||
@@ -305,7 +275,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
AllocConsole();
|
AllocConsole();
|
||||||
freopen("CONOUT$", "a", stderr);
|
freopen("CONOUT$", "a", stderr);
|
||||||
freopen("CONOUT$", "a", stdout);
|
freopen("CONOUT$", "a", stdout);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Set the default value for our display-system exponent, i.e., the
|
/* Set the default value for our display-system exponent, i.e., the
|
||||||
* product of the CRT exponent and the exponent corresponding to
|
* product of the CRT exponent and the exponent corresponding to
|
||||||
@@ -422,6 +392,18 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
}
|
}
|
||||||
} else if (!strncmp(*argv, "-timing", 2)) {
|
} else if (!strncmp(*argv, "-timing", 2)) {
|
||||||
timing = TRUE;
|
timing = TRUE;
|
||||||
|
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
|
||||||
|
} else if (!strncmp(*argv, "-nommxfilters", 7)) {
|
||||||
|
rpng2_info.nommxfilters = TRUE;
|
||||||
|
} else if (!strncmp(*argv, "-nommxcombine", 7)) {
|
||||||
|
rpng2_info.nommxcombine = TRUE;
|
||||||
|
} else if (!strncmp(*argv, "-nommxinterlace", 7)) {
|
||||||
|
rpng2_info.nommxinterlace = TRUE;
|
||||||
|
} else if (!strcmp(*argv, "-nommx")) {
|
||||||
|
rpng2_info.nommxfilters = TRUE;
|
||||||
|
rpng2_info.nommxcombine = TRUE;
|
||||||
|
rpng2_info.nommxinterlace = TRUE;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
if (**argv != '-') {
|
if (**argv != '-') {
|
||||||
filename = *argv;
|
filename = *argv;
|
||||||
@@ -432,56 +414,9 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!filename)
|
if (!filename) {
|
||||||
++error;
|
++error;
|
||||||
|
} else if (!(infile = fopen(filename, "rb"))) {
|
||||||
|
|
||||||
/* print usage screen if any errors up to this point */
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
#ifndef __CYGWIN__
|
|
||||||
int ch;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname);
|
|
||||||
readpng2_version_info();
|
|
||||||
fprintf(stderr, "\n"
|
|
||||||
"Usage: %s [-gamma exp] [-bgcolor bg | -bgpat pat] [-timing]\n"
|
|
||||||
" %*s file.png\n\n"
|
|
||||||
" exp \ttransfer-function exponent (``gamma'') of the display\n"
|
|
||||||
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
|
|
||||||
"\t\t to the product of the lookup-table exponent (varies)\n"
|
|
||||||
"\t\t and the CRT exponent (usually 2.2); must be positive\n"
|
|
||||||
" bg \tdesired background color in 7-character hex RGB format\n"
|
|
||||||
"\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
|
|
||||||
"\t\t used with transparent images; overrides -bgpat option\n"
|
|
||||||
" pat \tdesired background pattern number (1-%d); used with\n"
|
|
||||||
"\t\t transparent images; overrides -bgcolor option\n"
|
|
||||||
" -timing\tenables delay for every block read, to simulate modem\n"
|
|
||||||
"\t\t download of image (~36 Kbps)\n"
|
|
||||||
"\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
|
|
||||||
#ifndef __CYGWIN__
|
|
||||||
"Press Q or Esc to quit this usage screen. ",
|
|
||||||
#else
|
|
||||||
,
|
|
||||||
#endif
|
|
||||||
PROGNAME,
|
|
||||||
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) && \
|
|
||||||
!(defined(__CYGWIN__) || defined(__MINGW32__))
|
|
||||||
(int)strlen(PROGNAME), " ",
|
|
||||||
#endif
|
|
||||||
(int)strlen(PROGNAME), " ", default_display_exponent, num_bgpat);
|
|
||||||
fflush(stderr);
|
|
||||||
#ifndef __CYGWIN__
|
|
||||||
do
|
|
||||||
ch = _getch();
|
|
||||||
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
|
|
||||||
#endif
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (!(infile = fopen(filename, "rb"))) {
|
|
||||||
fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename);
|
fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename);
|
||||||
++error;
|
++error;
|
||||||
} else {
|
} else {
|
||||||
@@ -495,7 +430,8 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
switch (rc) {
|
switch (rc) {
|
||||||
case 2:
|
case 2:
|
||||||
fprintf(stderr, PROGNAME
|
fprintf(stderr, PROGNAME
|
||||||
": [%s] has bad IHDR (libpng longjmp)\n", filename);
|
": [%s] has bad IHDR (libpng longjmp)\n",
|
||||||
|
filename);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
fprintf(stderr, PROGNAME ": insufficient memory\n");
|
fprintf(stderr, PROGNAME ": insufficient memory\n");
|
||||||
@@ -512,25 +448,51 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (error) {
|
/* usage screen */
|
||||||
#ifndef __CYGWIN__
|
|
||||||
int ch;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fprintf(stderr, PROGNAME ": aborting.\n");
|
if (error) {
|
||||||
#ifndef __CYGWIN__
|
int ch;
|
||||||
|
|
||||||
|
fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname);
|
||||||
|
readpng2_version_info();
|
||||||
|
fprintf(stderr, "\n"
|
||||||
|
"Usage: %s [-gamma exp] [-bgcolor bg | -bgpat pat] [-timing]\n"
|
||||||
|
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
|
||||||
|
" %*s [[-nommxfilters] [-nommxcombine] [-nommxinterlace] | -nommx]\n"
|
||||||
|
#endif
|
||||||
|
" %*s file.png\n\n"
|
||||||
|
" exp \ttransfer-function exponent (``gamma'') of the display\n"
|
||||||
|
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
|
||||||
|
"\t\t to the product of the lookup-table exponent (varies)\n"
|
||||||
|
"\t\t and the CRT exponent (usually 2.2); must be positive\n"
|
||||||
|
" bg \tdesired background color in 7-character hex RGB format\n"
|
||||||
|
"\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
|
||||||
|
"\t\t used with transparent images; overrides -bgpat option\n"
|
||||||
|
" pat \tdesired background pattern number (1-%d); used with\n"
|
||||||
|
"\t\t transparent images; overrides -bgcolor option\n"
|
||||||
|
" -timing\tenables delay for every block read, to simulate modem\n"
|
||||||
|
"\t\t download of image (~36 Kbps)\n"
|
||||||
|
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
|
||||||
|
" -nommx*\tdisable optimized MMX routines for decoding row filters,\n"
|
||||||
|
"\t\t combining rows, and expanding interlacing, respectively\n"
|
||||||
|
#endif
|
||||||
|
"\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
|
||||||
|
"Press Q or Esc to quit this usage screen. ",
|
||||||
|
PROGNAME,
|
||||||
|
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
|
||||||
|
(int)strlen(PROGNAME), " ",
|
||||||
|
#endif
|
||||||
|
(int)strlen(PROGNAME), " ", default_display_exponent, num_bgpat);
|
||||||
|
fflush(stderr);
|
||||||
do
|
do
|
||||||
ch = _getch();
|
ch = _getch();
|
||||||
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
|
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
|
||||||
#endif
|
exit(1);
|
||||||
exit(2);
|
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
|
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
|
||||||
#ifndef __CYGWIN__
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"\n [console window: closing this window will terminate %s]\n\n",
|
"\n [console window: closing this window will terminate %s]\n\n",
|
||||||
PROGNAME);
|
PROGNAME);
|
||||||
#endif
|
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -557,7 +519,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
} else
|
} else
|
||||||
rpng2_info.need_bgcolor = TRUE;
|
rpng2_info.need_bgcolor = TRUE;
|
||||||
|
|
||||||
rpng2_info.state = kPreInit;
|
rpng2_info.done = FALSE;
|
||||||
rpng2_info.mainprog_init = rpng2_win_init;
|
rpng2_info.mainprog_init = rpng2_win_init;
|
||||||
rpng2_info.mainprog_display_row = rpng2_win_display_row;
|
rpng2_info.mainprog_display_row = rpng2_win_display_row;
|
||||||
rpng2_info.mainprog_finish_display = rpng2_win_finish_display;
|
rpng2_info.mainprog_finish_display = rpng2_win_finish_display;
|
||||||
@@ -577,27 +539,10 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
if (readpng2_decode_data(&rpng2_info, inbuf, incount))
|
if (readpng2_decode_data(&rpng2_info, inbuf, incount))
|
||||||
++error;
|
++error;
|
||||||
Trace((stderr, "done with readpng2_decode_data()\n"))
|
Trace((stderr, "done with readpng2_decode_data()\n"))
|
||||||
|
if (error || feof(infile) || rpng2_info.done)
|
||||||
if (error || incount != INBUFSIZE || rpng2_info.state == kDone) {
|
|
||||||
if (rpng2_info.state == kDone) {
|
|
||||||
Trace((stderr, "done decoding PNG image\n"))
|
|
||||||
} else if (ferror(infile)) {
|
|
||||||
fprintf(stderr, PROGNAME
|
|
||||||
": error while reading PNG image file\n");
|
|
||||||
exit(3);
|
|
||||||
} else if (feof(infile)) {
|
|
||||||
fprintf(stderr, PROGNAME ": end of file reached "
|
|
||||||
"(unexpectedly) while reading PNG image file\n");
|
|
||||||
exit(3);
|
|
||||||
} else /* if (error) */ {
|
|
||||||
// will print error message below
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
if (timing)
|
if (timing)
|
||||||
Sleep(1000L);
|
Sleep(1000L);
|
||||||
|
|
||||||
incount = fread(inbuf, 1, INBUFSIZE, infile);
|
incount = fread(inbuf, 1, INBUFSIZE, infile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -644,7 +589,7 @@ static void rpng2_win_init()
|
|||||||
ulg rowbytes = rpng2_info.rowbytes;
|
ulg rowbytes = rpng2_info.rowbytes;
|
||||||
|
|
||||||
Trace((stderr, "beginning rpng2_win_init()\n"))
|
Trace((stderr, "beginning rpng2_win_init()\n"))
|
||||||
Trace((stderr, " rowbytes = %d\n", rpng2_info.rowbytes))
|
Trace((stderr, " rowbytes = %ld\n", rpng2_info.rowbytes))
|
||||||
Trace((stderr, " width = %ld\n", rpng2_info.width))
|
Trace((stderr, " width = %ld\n", rpng2_info.width))
|
||||||
Trace((stderr, " height = %ld\n", rpng2_info.height))
|
Trace((stderr, " height = %ld\n", rpng2_info.height))
|
||||||
|
|
||||||
@@ -674,8 +619,6 @@ static void rpng2_win_init()
|
|||||||
readpng2_cleanup(&rpng2_info);
|
readpng2_cleanup(&rpng2_info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rpng2_info.state = kWindowInit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1171,14 +1114,9 @@ static void rpng2_win_finish_display()
|
|||||||
* we have nothing to do here except set a flag and let the user know
|
* we have nothing to do here except set a flag and let the user know
|
||||||
* that the image is done */
|
* that the image is done */
|
||||||
|
|
||||||
rpng2_info.state = kDone;
|
rpng2_info.done = TRUE;
|
||||||
printf(
|
printf(
|
||||||
#ifndef __CYGWIN__
|
"Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n");
|
||||||
"Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n"
|
|
||||||
#else
|
|
||||||
"Done. Press mouse button 1 (within image window) to quit.\n"
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
Thanks to Adam Costello and Pieter S. van der Meulen for the "diamond"
|
Thanks to Adam Costello and Pieter S. van der Meulen for the "diamond"
|
||||||
and "radial waves" patterns, respectively.
|
and "radial waves" patterns, respectively.
|
||||||
|
|
||||||
to do (someday, maybe):
|
to do:
|
||||||
- fix expose/redraw code: don't draw entire row if only part exposed
|
- fix expose/redraw code: don't draw entire row if only part exposed
|
||||||
- 8-bit (colormapped) X support
|
- 8-bit (colormapped) X support
|
||||||
- finish resizable checkerboard-gradient (sizes 4-128?)
|
- finish resizable checkerboard-gradient (sizes 4-128?)
|
||||||
@@ -36,15 +36,10 @@
|
|||||||
- 1.32: added AMD64/EM64T support (__x86_64__); added basic expose/redraw
|
- 1.32: added AMD64/EM64T support (__x86_64__); added basic expose/redraw
|
||||||
handling
|
handling
|
||||||
- 2.00: dual-licensed (added GNU GPL)
|
- 2.00: dual-licensed (added GNU GPL)
|
||||||
- 2.01: fixed 64-bit typo in readpng2.c; fixed -pause usage description
|
|
||||||
- 2.02: fixed improper display of usage screen on PNG error(s); fixed
|
|
||||||
unexpected-EOF and file-read-error cases; fixed Trace() cut-and-
|
|
||||||
paste bugs
|
|
||||||
- 2.03: deleted runtime MMX-enabling/disabling and obsolete -mmx* options
|
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 1998-2008 Greg Roelofs. All rights reserved.
|
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
|
||||||
|
|
||||||
This software is provided "as is," without warranty of any kind,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
express or implied. In no event shall the author or contributors
|
||||||
@@ -95,9 +90,9 @@
|
|||||||
|
|
||||||
#define PROGNAME "rpng2-x"
|
#define PROGNAME "rpng2-x"
|
||||||
#define LONGNAME "Progressive PNG Viewer for X"
|
#define LONGNAME "Progressive PNG Viewer for X"
|
||||||
#define VERSION "2.03 of 25 February 2010"
|
#define VERSION "2.00 of 2 June 2007"
|
||||||
#define RESNAME "rpng2" /* our X resource application name */
|
#define RESNAME "rpng2" /* our X resource application name */
|
||||||
#define RESCLASS "Rpng" /* our X resource class name */
|
#define RESCLASS "Rpng" /* our X resource class name */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -132,7 +127,7 @@
|
|||||||
(e.type == KeyPress && /* v--- or 1 for shifted keys */ \
|
(e.type == KeyPress && /* v--- or 1 for shifted keys */ \
|
||||||
((k = XLookupKeysym(&e.xkey, 0)) == XK_q || k == XK_Escape)))
|
((k = XLookupKeysym(&e.xkey, 0)) == XK_q || k == XK_Escape)))
|
||||||
|
|
||||||
#define NO_24BIT_MASKS /* undef case not fully written--only for redisplay() */
|
#define NO_24BIT_MASKS /* undef case not fully written--only for redisplay() */
|
||||||
|
|
||||||
#define rgb1_max bg_freq
|
#define rgb1_max bg_freq
|
||||||
#define rgb1_min bg_gray
|
#define rgb1_min bg_gray
|
||||||
@@ -302,7 +297,7 @@ int main(int argc, char **argv)
|
|||||||
int have_bg = FALSE;
|
int have_bg = FALSE;
|
||||||
#ifdef FEATURE_LOOP
|
#ifdef FEATURE_LOOP
|
||||||
int loop = FALSE;
|
int loop = FALSE;
|
||||||
long loop_interval = -1; /* seconds (100,000 max) */
|
long loop_interval = -1; /* seconds (100,000 max) */
|
||||||
#endif
|
#endif
|
||||||
double LUT_exponent; /* just the lookup table */
|
double LUT_exponent; /* just the lookup table */
|
||||||
double CRT_exponent = 2.2; /* just the monitor */
|
double CRT_exponent = 2.2; /* just the monitor */
|
||||||
@@ -435,6 +430,18 @@ int main(int argc, char **argv)
|
|||||||
else if (loop_interval > 100000) /* bit more than one day */
|
else if (loop_interval > 100000) /* bit more than one day */
|
||||||
loop_interval = 100000;
|
loop_interval = 100000;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
|
||||||
|
} else if (!strncmp(*argv, "-nommxfilters", 7)) {
|
||||||
|
rpng2_info.nommxfilters = TRUE;
|
||||||
|
} else if (!strncmp(*argv, "-nommxcombine", 7)) {
|
||||||
|
rpng2_info.nommxcombine = TRUE;
|
||||||
|
} else if (!strncmp(*argv, "-nommxinterlace", 7)) {
|
||||||
|
rpng2_info.nommxinterlace = TRUE;
|
||||||
|
} else if (!strcmp(*argv, "-nommx")) {
|
||||||
|
rpng2_info.nommxfilters = TRUE;
|
||||||
|
rpng2_info.nommxcombine = TRUE;
|
||||||
|
rpng2_info.nommxinterlace = TRUE;
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
if (**argv != '-') {
|
if (**argv != '-') {
|
||||||
@@ -446,17 +453,58 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!filename)
|
if (!filename) {
|
||||||
++error;
|
++error;
|
||||||
|
} else if (!(infile = fopen(filename, "rb"))) {
|
||||||
|
fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename);
|
||||||
|
++error;
|
||||||
|
} else {
|
||||||
|
incount = fread(inbuf, 1, INBUFSIZE, infile);
|
||||||
|
if (incount < 8 || !readpng2_check_sig(inbuf, 8)) {
|
||||||
|
fprintf(stderr, PROGNAME
|
||||||
|
": [%s] is not a PNG file: incorrect signature\n",
|
||||||
|
filename);
|
||||||
|
++error;
|
||||||
|
} else if ((rc = readpng2_init(&rpng2_info)) != 0) {
|
||||||
|
switch (rc) {
|
||||||
|
case 2:
|
||||||
|
fprintf(stderr, PROGNAME
|
||||||
|
": [%s] has bad IHDR (libpng longjmp)\n",
|
||||||
|
filename);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
fprintf(stderr, PROGNAME ": insufficient memory\n");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fprintf(stderr, PROGNAME
|
||||||
|
": unknown readpng2_init() error\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
++error;
|
||||||
|
} else {
|
||||||
|
display = XOpenDisplay(displayname);
|
||||||
|
if (!display) {
|
||||||
|
readpng2_cleanup(&rpng2_info);
|
||||||
|
fprintf(stderr, PROGNAME ": can't open X display [%s]\n",
|
||||||
|
displayname? displayname : "default");
|
||||||
|
++error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (error)
|
||||||
|
fclose(infile);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* print usage screen if any errors up to this point */
|
/* usage screen */
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname);
|
fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname);
|
||||||
readpng2_version_info();
|
readpng2_version_info();
|
||||||
fprintf(stderr, "\n"
|
fprintf(stderr, "\n"
|
||||||
"Usage: %s [-display xdpy] [-gamma exp] [-bgcolor bg | -bgpat pat]\n"
|
"Usage: %s [-display xdpy] [-gamma exp] [-bgcolor bg | -bgpat pat]\n"
|
||||||
|
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
|
||||||
|
" %*s [[-nommxfilters] [-nommxcombine] [-nommxinterlace] | -nommx]\n"
|
||||||
|
#endif
|
||||||
#ifdef FEATURE_LOOP
|
#ifdef FEATURE_LOOP
|
||||||
" %*s [-usleep dur | -timing] [-pause] [-loop [sec]] file.png\n\n"
|
" %*s [-usleep dur | -timing] [-pause] [-loop [sec]] file.png\n\n"
|
||||||
#else
|
#else
|
||||||
@@ -476,66 +524,27 @@ int main(int argc, char **argv)
|
|||||||
" -loop\tloops through background images after initial display\n"
|
" -loop\tloops through background images after initial display\n"
|
||||||
"\t\t is complete (depends on -bgpat)\n"
|
"\t\t is complete (depends on -bgpat)\n"
|
||||||
" sec \tseconds to display each background image (default = 2)\n"
|
" sec \tseconds to display each background image (default = 2)\n"
|
||||||
|
#endif
|
||||||
|
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
|
||||||
|
" -nommx*\tdisable optimized MMX routines for decoding row filters,\n"
|
||||||
|
"\t\t combining rows, and expanding interlacing, respectively\n"
|
||||||
#endif
|
#endif
|
||||||
" dur \tduration in microseconds to wait after displaying each\n"
|
" dur \tduration in microseconds to wait after displaying each\n"
|
||||||
"\t\t row (for demo purposes)\n"
|
"\t\t row (for demo purposes)\n"
|
||||||
" -timing\tenables delay for every block read, to simulate modem\n"
|
" -timing\tenables delay for every block read, to simulate modem\n"
|
||||||
"\t\t download of image (~36 Kbps)\n"
|
"\t\t download of image (~36 Kbps)\n"
|
||||||
" -pause\tpauses after displaying each pass until mouse clicked\n"
|
" -pause\tpauses after displaying each pass until key pressed\n"
|
||||||
"\nPress Q, Esc or mouse button 1 (within image window, after image\n"
|
"\nPress Q, Esc or mouse button 1 (within image window, after image\n"
|
||||||
"is displayed) to quit.\n"
|
"is displayed) to quit.\n"
|
||||||
"\n", PROGNAME,
|
"\n", PROGNAME,
|
||||||
|
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
|
||||||
|
(int)strlen(PROGNAME), " ",
|
||||||
|
#endif
|
||||||
(int)strlen(PROGNAME), " ", default_display_exponent, num_bgpat-1);
|
(int)strlen(PROGNAME), " ", default_display_exponent, num_bgpat-1);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!(infile = fopen(filename, "rb"))) {
|
|
||||||
fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename);
|
|
||||||
++error;
|
|
||||||
} else {
|
|
||||||
incount = fread(inbuf, 1, INBUFSIZE, infile);
|
|
||||||
if (incount < 8 || !readpng2_check_sig(inbuf, 8)) {
|
|
||||||
fprintf(stderr, PROGNAME
|
|
||||||
": [%s] is not a PNG file: incorrect signature\n",
|
|
||||||
filename);
|
|
||||||
++error;
|
|
||||||
} else if ((rc = readpng2_init(&rpng2_info)) != 0) {
|
|
||||||
switch (rc) {
|
|
||||||
case 2:
|
|
||||||
fprintf(stderr, PROGNAME
|
|
||||||
": [%s] has bad IHDR (libpng longjmp)\n", filename);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
fprintf(stderr, PROGNAME ": insufficient memory\n");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fprintf(stderr, PROGNAME
|
|
||||||
": unknown readpng2_init() error\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
++error;
|
|
||||||
} else {
|
|
||||||
Trace((stderr, "about to call XOpenDisplay()\n"))
|
|
||||||
display = XOpenDisplay(displayname);
|
|
||||||
if (!display) {
|
|
||||||
readpng2_cleanup(&rpng2_info);
|
|
||||||
fprintf(stderr, PROGNAME ": can't open X display [%s]\n",
|
|
||||||
displayname? displayname : "default");
|
|
||||||
++error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (error)
|
|
||||||
fclose(infile);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
fprintf(stderr, PROGNAME ": aborting.\n");
|
|
||||||
exit(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* set the title-bar string, but make sure buffer doesn't overflow */
|
/* set the title-bar string, but make sure buffer doesn't overflow */
|
||||||
|
|
||||||
alen = strlen(appname);
|
alen = strlen(appname);
|
||||||
@@ -558,7 +567,7 @@ int main(int argc, char **argv)
|
|||||||
} else
|
} else
|
||||||
rpng2_info.need_bgcolor = TRUE;
|
rpng2_info.need_bgcolor = TRUE;
|
||||||
|
|
||||||
rpng2_info.state = kPreInit;
|
rpng2_info.done = FALSE;
|
||||||
rpng2_info.mainprog_init = rpng2_x_init;
|
rpng2_info.mainprog_init = rpng2_x_init;
|
||||||
rpng2_info.mainprog_display_row = rpng2_x_display_row;
|
rpng2_info.mainprog_display_row = rpng2_x_display_row;
|
||||||
rpng2_info.mainprog_finish_display = rpng2_x_finish_display;
|
rpng2_info.mainprog_finish_display = rpng2_x_finish_display;
|
||||||
@@ -578,27 +587,10 @@ int main(int argc, char **argv)
|
|||||||
if (readpng2_decode_data(&rpng2_info, inbuf, incount))
|
if (readpng2_decode_data(&rpng2_info, inbuf, incount))
|
||||||
++error;
|
++error;
|
||||||
Trace((stderr, "done with readpng2_decode_data()\n"))
|
Trace((stderr, "done with readpng2_decode_data()\n"))
|
||||||
|
if (error || feof(infile) || rpng2_info.done)
|
||||||
if (error || incount != INBUFSIZE || rpng2_info.state == kDone) {
|
|
||||||
if (rpng2_info.state == kDone) {
|
|
||||||
Trace((stderr, "done decoding PNG image\n"))
|
|
||||||
} else if (ferror(infile)) {
|
|
||||||
fprintf(stderr, PROGNAME
|
|
||||||
": error while reading PNG image file\n");
|
|
||||||
exit(3);
|
|
||||||
} else if (feof(infile)) {
|
|
||||||
fprintf(stderr, PROGNAME ": end of file reached "
|
|
||||||
"(unexpectedly) while reading PNG image file\n");
|
|
||||||
exit(3);
|
|
||||||
} else /* if (error) */ {
|
|
||||||
// will print error message below
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
if (timing)
|
if (timing)
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
|
||||||
incount = fread(inbuf, 1, INBUFSIZE, infile);
|
incount = fread(inbuf, 1, INBUFSIZE, infile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -618,7 +610,6 @@ int main(int argc, char **argv)
|
|||||||
#ifdef FEATURE_LOOP
|
#ifdef FEATURE_LOOP
|
||||||
|
|
||||||
if (loop && bg_image) {
|
if (loop && bg_image) {
|
||||||
Trace((stderr, "entering -loop loop (FEATURE_LOOP)\n"))
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
int i, use_sleep;
|
int i, use_sleep;
|
||||||
struct timeval now, then;
|
struct timeval now, then;
|
||||||
@@ -714,20 +705,13 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
/* wait for the user to tell us when to quit */
|
/* wait for the user to tell us when to quit */
|
||||||
|
|
||||||
if (rpng2_info.state >= kWindowInit) {
|
do {
|
||||||
Trace((stderr, "entering final wait-for-quit-event loop\n"))
|
XNextEvent(display, &e);
|
||||||
do {
|
if (e.type == Expose) {
|
||||||
XNextEvent(display, &e);
|
XExposeEvent *ex = (XExposeEvent *)&e;
|
||||||
if (e.type == Expose) {
|
rpng2_x_redisplay_image (ex->x, ex->y, ex->width, ex->height);
|
||||||
XExposeEvent *ex = (XExposeEvent *)&e;
|
}
|
||||||
rpng2_x_redisplay_image (ex->x, ex->y, ex->width, ex->height);
|
} while (!QUIT(e,k));
|
||||||
}
|
|
||||||
} while (!QUIT(e,k));
|
|
||||||
} else {
|
|
||||||
fprintf(stderr, PROGNAME ": init callback never called: probable "
|
|
||||||
"libpng error while decoding PNG metadata\n");
|
|
||||||
exit(4);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* we're done: clean up all image and X resources and go away */
|
/* we're done: clean up all image and X resources and go away */
|
||||||
@@ -752,7 +736,7 @@ static void rpng2_x_init(void)
|
|||||||
ulg rowbytes = rpng2_info.rowbytes;
|
ulg rowbytes = rpng2_info.rowbytes;
|
||||||
|
|
||||||
Trace((stderr, "beginning rpng2_x_init()\n"))
|
Trace((stderr, "beginning rpng2_x_init()\n"))
|
||||||
Trace((stderr, " rowbytes = %d\n", rpng2_info.rowbytes))
|
Trace((stderr, " rowbytes = %ld\n", rpng2_info.rowbytes))
|
||||||
Trace((stderr, " width = %ld\n", rpng2_info.width))
|
Trace((stderr, " width = %ld\n", rpng2_info.width))
|
||||||
Trace((stderr, " height = %ld\n", rpng2_info.height))
|
Trace((stderr, " height = %ld\n", rpng2_info.height))
|
||||||
|
|
||||||
@@ -781,17 +765,14 @@ static void rpng2_x_init(void)
|
|||||||
if (rpng2_x_create_window()) {
|
if (rpng2_x_create_window()) {
|
||||||
|
|
||||||
/* GRR TEMPORARY HACK: this is fundamentally no different from cases
|
/* GRR TEMPORARY HACK: this is fundamentally no different from cases
|
||||||
* above; libpng should call our error handler to longjmp() back to us
|
* above; libpng should longjmp() back to us when png_ptr goes away.
|
||||||
* when png_ptr goes away. If we/it segfault instead, seems like a
|
* If we/it segfault instead, seems like a libpng bug... */
|
||||||
* libpng bug... */
|
|
||||||
|
|
||||||
/* we're here via libpng callback, so if window fails, clean and bail */
|
/* we're here via libpng callback, so if window fails, clean and bail */
|
||||||
readpng2_cleanup(&rpng2_info);
|
readpng2_cleanup(&rpng2_info);
|
||||||
rpng2_x_cleanup();
|
rpng2_x_cleanup();
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
rpng2_info.state = kWindowInit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1277,7 +1258,7 @@ static int rpng2_x_load_bg_image(void)
|
|||||||
for (row = 0; row < rpng2_info.height; ++row) {
|
for (row = 0; row < rpng2_info.height; ++row) {
|
||||||
src = bg_data + row*bg_rowbytes;
|
src = bg_data + row*bg_rowbytes;
|
||||||
dest = ximage->data + row*ximage_rowbytes;
|
dest = ximage->data + row*ximage_rowbytes;
|
||||||
if (bpp == 32) { /* slightly optimized version */
|
if (bpp == 32) { /* slightly optimized version */
|
||||||
for (i = rpng2_info.width; i > 0; --i) {
|
for (i = rpng2_info.width; i > 0; --i) {
|
||||||
red = *src++;
|
red = *src++;
|
||||||
green = *src++;
|
green = *src++;
|
||||||
@@ -1575,7 +1556,7 @@ static void rpng2_x_finish_display(void)
|
|||||||
* have nothing to do here except set a flag and let the user know that
|
* have nothing to do here except set a flag and let the user know that
|
||||||
* the image is done */
|
* the image is done */
|
||||||
|
|
||||||
rpng2_info.state = kDone;
|
rpng2_info.done = TRUE;
|
||||||
printf(
|
printf(
|
||||||
"Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n");
|
"Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
@@ -1600,9 +1581,9 @@ static void rpng2_x_redisplay_image(ulg startcol, ulg startrow,
|
|||||||
|
|
||||||
|
|
||||||
Trace((stderr, "beginning display loop (image_channels == %d)\n",
|
Trace((stderr, "beginning display loop (image_channels == %d)\n",
|
||||||
rpng2_info.channels))
|
image_channels))
|
||||||
Trace((stderr, " (width = %ld, rowbytes = %d, ximage_rowbytes = %d)\n",
|
Trace((stderr, " (width = %ld, rowbytes = %ld, ximage_rowbytes = %d)\n",
|
||||||
rpng2_info.width, rpng2_info.rowbytes, ximage_rowbytes))
|
rpng2_info.width, image_rowbytes, ximage_rowbytes))
|
||||||
Trace((stderr, " (bpp = %d)\n", ximage->bits_per_pixel))
|
Trace((stderr, " (bpp = %d)\n", ximage->bits_per_pixel))
|
||||||
Trace((stderr, " (byte_order = %s)\n", ximage->byte_order == MSBFirst?
|
Trace((stderr, " (byte_order = %s)\n", ximage->byte_order == MSBFirst?
|
||||||
"MSBFirst" : (ximage->byte_order == LSBFirst? "LSBFirst" : "unknown")))
|
"MSBFirst" : (ximage->byte_order == LSBFirst? "LSBFirst" : "unknown")))
|
||||||
|
|||||||
@@ -104,8 +104,7 @@ int writepng_init(mainprog_info *mainprog_ptr)
|
|||||||
/* setjmp() must be called in every function that calls a PNG-writing
|
/* setjmp() must be called in every function that calls a PNG-writing
|
||||||
* libpng function, unless an alternate error handler was installed--
|
* libpng function, unless an alternate error handler was installed--
|
||||||
* but compatible error handlers must either use longjmp() themselves
|
* but compatible error handlers must either use longjmp() themselves
|
||||||
* (as in this program) or some other method to return control to
|
* (as in this program) or exit immediately, so here we go: */
|
||||||
* application code, so here we go: */
|
|
||||||
|
|
||||||
if (setjmp(mainprog_ptr->jmpbuf)) {
|
if (setjmp(mainprog_ptr->jmpbuf)) {
|
||||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||||
@@ -389,12 +388,5 @@ static void writepng_error_handler(png_structp png_ptr, png_const_charp msg)
|
|||||||
exit(99);
|
exit(99);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now we have our data structure we can use the information in it
|
|
||||||
* to return control to our own higher level code (all the points
|
|
||||||
* where 'setjmp' is called in this file.) This will work with other
|
|
||||||
* error handling mechanisms as well - libpng always calls png_error
|
|
||||||
* when it can proceed no further, thus, so long as the error handler
|
|
||||||
* is intercepted, application code can do its own error recovery.
|
|
||||||
*/
|
|
||||||
longjmp(mainprog_ptr->jmpbuf, 1);
|
longjmp(mainprog_ptr->jmpbuf, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
This demonstrates the use of PNG_USER_CONFIG, pngusr.h and pngusr.dfa
|
|
||||||
to build minimal decoder, encoder, and progressive reader applications.
|
|
||||||
|
|
||||||
See the individual README and pngusr.dfa files for more explanation.
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
This demonstrates the use of PNG_USER_CONFIG, pngusr.h and pngusr.dfa
|
|
||||||
|
|
||||||
The makefile builds a minimal read-only decoder with embedded libpng
|
|
||||||
and zlib.
|
|
||||||
|
|
||||||
Specify the location of the zlib source (1.2.1 or later) as ZLIBSRC
|
|
||||||
on the make command line.
|
|
||||||
|
|
||||||
If you prefer to use the shared libraries, go to contrib/pngminus
|
|
||||||
and build the png2pnm application there.
|
|
||||||
@@ -1,150 +0,0 @@
|
|||||||
# Makefile for PngMinus (pngm2pnm)
|
|
||||||
# Linux / Unix
|
|
||||||
|
|
||||||
#CC=cc
|
|
||||||
CC=gcc
|
|
||||||
LD=$(CC)
|
|
||||||
|
|
||||||
# If awk fails try
|
|
||||||
# make AWK=nawk
|
|
||||||
|
|
||||||
# If cpp fails try
|
|
||||||
# make CPP=/lib/cpp
|
|
||||||
|
|
||||||
RM=rm -f
|
|
||||||
COPY=cp
|
|
||||||
|
|
||||||
CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP -I. -O1
|
|
||||||
|
|
||||||
C=.c
|
|
||||||
O=.o
|
|
||||||
L=.a
|
|
||||||
E=
|
|
||||||
|
|
||||||
# Where to find the source code:
|
|
||||||
PNGSRC =../../..
|
|
||||||
ZLIBSRC=$(PNGSRC)/../zlib
|
|
||||||
PROGSRC=$(PNGSRC)/contrib/pngminus
|
|
||||||
|
|
||||||
# Zlib (minimal inflate requirements - crc32 is used by libpng)
|
|
||||||
# zutil can be eliminated if you provide your own zcalloc and zcfree
|
|
||||||
ZSRCS = adler32$(C) crc32$(C) \
|
|
||||||
inffast$(C) inflate$(C) inftrees$(C) \
|
|
||||||
zutil$(C)
|
|
||||||
|
|
||||||
# Standard headers
|
|
||||||
ZH = zlib.h crc32.h inffast.h inffixed.h \
|
|
||||||
inflate.h inftrees.h zutil.h
|
|
||||||
|
|
||||||
# Machine generated headers
|
|
||||||
ZCONF = zconf.h
|
|
||||||
|
|
||||||
# Headers callers use
|
|
||||||
ZINC = zlib.h $(ZCONF)
|
|
||||||
|
|
||||||
# Headers the Zlib source uses
|
|
||||||
ZHDRS = $(ZH) $(ZCONF)
|
|
||||||
|
|
||||||
ZOBJS = adler32$(O) crc32$(O) \
|
|
||||||
inffast$(O) inflate$(O) inftrees$(O) \
|
|
||||||
zutil$(O)
|
|
||||||
|
|
||||||
# libpng
|
|
||||||
PNGSRCS=png$(C) pngerror$(C) pngget$(C) pngmem$(C) \
|
|
||||||
pngread$(C) pngrio$(C) pngrtran$(C) pngrutil$(C) \
|
|
||||||
pngset$(C) pngtrans$(C)
|
|
||||||
|
|
||||||
# Standard headers
|
|
||||||
PNGH =png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
|
|
||||||
|
|
||||||
# Machine generated headers
|
|
||||||
PNGCONF=pnglibconf.h
|
|
||||||
|
|
||||||
# Headers callers use
|
|
||||||
PNGINC= png.h pngconf.h pngusr.h $(PNGCONF)
|
|
||||||
|
|
||||||
# Headers the PNG library uses
|
|
||||||
PNGHDRS=$(PNGH) $(PNGCONF) pngusr.h
|
|
||||||
|
|
||||||
PNGOBJS=png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
|
|
||||||
pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \
|
|
||||||
pngset$(O) pngtrans$(O)
|
|
||||||
|
|
||||||
PROGSRCS= pngm2pnm$(C)
|
|
||||||
PROGHDRS=
|
|
||||||
PROGDOCS=
|
|
||||||
PROGOBJS= pngm2pnm$(O)
|
|
||||||
|
|
||||||
OBJS = $(PROGOBJS) $(PNGOBJS) $(ZOBJS)
|
|
||||||
|
|
||||||
# implicit make rules -------------------------------------------------------
|
|
||||||
|
|
||||||
# note: dependencies do not work on implicit rule lines
|
|
||||||
.c$(O):
|
|
||||||
$(CC) -c $(CFLAGS) $<
|
|
||||||
|
|
||||||
# dependencies
|
|
||||||
|
|
||||||
all: pngm2pnm$(E)
|
|
||||||
|
|
||||||
pngm2pnm$(E): $(OBJS)
|
|
||||||
$(LD) -o pngm2pnm$(E) $(OBJS)
|
|
||||||
|
|
||||||
# The DFA_XTRA setting turns all libpng options off then
|
|
||||||
# turns on those required for this minimal build.
|
|
||||||
# The CPP_FLAGS setting causes pngusr.h to be included in
|
|
||||||
# both the build of pnglibconf.h and, subsequently, when
|
|
||||||
# building libpng itself.
|
|
||||||
$(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak\
|
|
||||||
$(PNGSRC)/scripts/pnglibconf.dfa \
|
|
||||||
$(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa
|
|
||||||
$(RM) pnglibconf.h pnglibconf.dfn
|
|
||||||
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
|
|
||||||
srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG"\
|
|
||||||
DFA_XTRA="pngusr.dfa" $@
|
|
||||||
|
|
||||||
clean:
|
|
||||||
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
|
|
||||||
srcdir=$(PNGSRC) clean
|
|
||||||
$(RM) pngm2pnm$(O)
|
|
||||||
$(RM) pngm2pnm$(E)
|
|
||||||
$(RM) $(OBJS)
|
|
||||||
|
|
||||||
# distclean also removes the copied source and headers
|
|
||||||
distclean: clean
|
|
||||||
$(RM) -r scripts # historical reasons
|
|
||||||
$(RM) $(PNGSRCS) $(PNGH)
|
|
||||||
$(RM) $(ZSRCS) $(ZH) $(ZCONF)
|
|
||||||
$(RM) $(PROGSRCS) $(PROGHDRS) $(PROGDOCS)
|
|
||||||
|
|
||||||
# Header file dependencies:
|
|
||||||
$(PROGOBJS): $(PROGHDRS) $(PNGINC) $(ZINC)
|
|
||||||
$(PNGOBJS): $(PNGHDRS) $(ZINC)
|
|
||||||
$(ZOBJS): $(ZHDRS)
|
|
||||||
|
|
||||||
# Gather the source code from the respective directories
|
|
||||||
$(PNGSRCS) $(PNGH): $(PNGSRC)/$@
|
|
||||||
$(RM) $@
|
|
||||||
$(COPY) $(PNGSRC)/$@ $@
|
|
||||||
|
|
||||||
# No dependency on the ZLIBSRC target so that it only needs
|
|
||||||
# to be specified once.
|
|
||||||
$(ZSRCS) $(ZH):
|
|
||||||
$(RM) $@
|
|
||||||
$(COPY) $(ZLIBSRC)/$@ $@
|
|
||||||
|
|
||||||
# The unconfigured zconf.h varies in name according to the
|
|
||||||
# zlib release
|
|
||||||
$(ZCONF):
|
|
||||||
$(RM) $@
|
|
||||||
@for f in zconf.h.in zconf.in.h zconf.h; do\
|
|
||||||
test -r $(ZLIBSRC)/$$f &&\
|
|
||||||
echo $(COPY) $(ZLIBSRC)/$$f $@ &&\
|
|
||||||
$(COPY) $(ZLIBSRC)/$$f $@ && exit 0;\
|
|
||||||
done; echo copy: $(ZLIBSRC)/zconf.h not found; exit 1
|
|
||||||
|
|
||||||
pngm2pnm.c: $(PROGSRC)/png2pnm.c
|
|
||||||
$(RM) $@
|
|
||||||
$(COPY) $(PROGSRC)/png2pnm.c $@
|
|
||||||
|
|
||||||
# End of makefile for pngm2pnm
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
# pngminim/decoder/pngusr.dfa
|
|
||||||
#
|
|
||||||
# Copyright (c) 2010-2011 Glenn Randers-Pehrson
|
|
||||||
#
|
|
||||||
# This code is released under the libpng license.
|
|
||||||
# For conditions of distribution and use, see the disclaimer
|
|
||||||
# and license in png.h
|
|
||||||
|
|
||||||
# First all the build options off:
|
|
||||||
|
|
||||||
everything = off
|
|
||||||
|
|
||||||
# All that is required is some read code. This example switches
|
|
||||||
# on the sequential read code (see ../preader for a progressive
|
|
||||||
# read example).
|
|
||||||
|
|
||||||
option SEQUENTIAL_READ on
|
|
||||||
|
|
||||||
# You must choose fixed or floating point arithmetic:
|
|
||||||
# option FLOATING_POINT on
|
|
||||||
|
|
||||||
option FIXED_POINT on
|
|
||||||
|
|
||||||
# You must chose the internal fixed point implementation or to
|
|
||||||
# use the system floating point. The latter is considerably
|
|
||||||
# smaller (by about 1kbyte on an x86 system):
|
|
||||||
# option FLOATING_ARITHMETIC on
|
|
||||||
|
|
||||||
option FLOATING_ARITHMETIC off
|
|
||||||
|
|
||||||
# Your program will probably need other options. The example
|
|
||||||
# program here, pngm2pnm, requires the following. Take a look
|
|
||||||
# at pnglibconf.h to find out the full set of what has to be
|
|
||||||
# enabled to make the following work.
|
|
||||||
|
|
||||||
option SETJMP on
|
|
||||||
option STDIO on
|
|
||||||
option READ_EXPAND on
|
|
||||||
option READ_16_TO_8 on
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
/* minrdpngconf.h: headers to make a minimal png-read-only library
|
|
||||||
*
|
|
||||||
* Copyright (c) 2007, 2010-2011 Glenn Randers-Pehrson
|
|
||||||
*
|
|
||||||
* This code is released under the libpng license.
|
|
||||||
* For conditions of distribution and use, see the disclaimer
|
|
||||||
* and license in png.h
|
|
||||||
*
|
|
||||||
* Derived from pngcrush.h, Copyright 1998-2007, Glenn Randers-Pehrson
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef MINRDPNGCONF_H
|
|
||||||
#define MINRDPNGCONF_H
|
|
||||||
|
|
||||||
/* To include pngusr.h set -DPNG_USER_CONFIG in CPPFLAGS */
|
|
||||||
|
|
||||||
/* List options to turn off features of the build that do not
|
|
||||||
* affect the API (so are not recorded in pnglibconf.h)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define PNG_NO_WARNINGS
|
|
||||||
|
|
||||||
#endif /* MINRDPNGCONF_H */
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
This demonstrates the use of PNG_USER_CONFIG and pngusr.h
|
|
||||||
|
|
||||||
The makefile builds a minimal write-only decoder with embedded libpng
|
|
||||||
and zlib.
|
|
||||||
|
|
||||||
Specify the location of the zlib source (1.2.1 or later) as ZLIBSRC
|
|
||||||
on the make command line.
|
|
||||||
|
|
||||||
If you prefer to use the shared libraries, go to contrib/pngminus
|
|
||||||
and build the pnm2png application there.
|
|
||||||
@@ -1,149 +0,0 @@
|
|||||||
# Makefile for PngMinus (pnm2pngm)
|
|
||||||
# Linux / Unix
|
|
||||||
|
|
||||||
#CC=cc
|
|
||||||
CC=gcc
|
|
||||||
LD=$(CC)
|
|
||||||
|
|
||||||
# If awk fails try
|
|
||||||
# make AWK=nawk
|
|
||||||
|
|
||||||
# If cpp fails try
|
|
||||||
# make CPP=/lib/cpp
|
|
||||||
|
|
||||||
RM=rm -f
|
|
||||||
COPY=cp
|
|
||||||
|
|
||||||
CFLAGS=-DPNG_USER_CONFIG -DNO_GZIP -I. -O1
|
|
||||||
|
|
||||||
C=.c
|
|
||||||
O=.o
|
|
||||||
L=.a
|
|
||||||
E=
|
|
||||||
|
|
||||||
# Where to find the source code:
|
|
||||||
PNGSRC =../../..
|
|
||||||
ZLIBSRC=$(PNGSRC)/../zlib
|
|
||||||
PROGSRC=$(PNGSRC)/contrib/pngminus
|
|
||||||
|
|
||||||
# Zlib
|
|
||||||
ZSRCS = adler32$(C) compress$(C) crc32$(C) deflate$(C) \
|
|
||||||
trees$(C) zutil$(C)
|
|
||||||
|
|
||||||
# Standard headers
|
|
||||||
#ZH = zlib.h crc32.h deflate.h trees.h zutil.h
|
|
||||||
ZH = zlib.h crc32.h deflate.h trees.h zutil.h
|
|
||||||
|
|
||||||
# Machine generated headers
|
|
||||||
ZCONF = zconf.h
|
|
||||||
|
|
||||||
# Headers callers use
|
|
||||||
ZINC = zlib.h $(ZCONF)
|
|
||||||
|
|
||||||
# Headers the Zlib source uses
|
|
||||||
ZHDRS = $(ZH) $(ZCONF)
|
|
||||||
|
|
||||||
# compress is not required; it is needed to link the zlib
|
|
||||||
# code because deflate defines an unused API function deflateBound
|
|
||||||
# which itself calls compressBound from compress.
|
|
||||||
ZOBJS = adler32$(O) compress$(O) crc32$(O) deflate$(O) \
|
|
||||||
trees$(O) zutil$(O)
|
|
||||||
|
|
||||||
# libpng
|
|
||||||
PNGSRCS=png$(C) pngerror$(C) pngget$(C) pngmem$(C) \
|
|
||||||
pngset$(C) pngtrans$(C) pngwio$(C) pngwrite$(C) \
|
|
||||||
pngwtran$(C) pngwutil$(C)
|
|
||||||
|
|
||||||
# Standard headers
|
|
||||||
PNGH =png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
|
|
||||||
|
|
||||||
# Machine generated headers
|
|
||||||
PNGCONF=pnglibconf.h
|
|
||||||
|
|
||||||
# Headers callers use
|
|
||||||
PNGINC= png.h pngconf.h pngusr.h $(PNGCONF)
|
|
||||||
|
|
||||||
# Headers the PNG library uses
|
|
||||||
PNGHDRS=$(PNGH) $(PNGCONF) pngusr.h
|
|
||||||
|
|
||||||
PNGOBJS=png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
|
|
||||||
pngset$(O) pngtrans$(O) pngwio$(O) pngwrite$(O) \
|
|
||||||
pngwtran$(O) pngwutil$(O)
|
|
||||||
|
|
||||||
PROGSRCS= pnm2pngm$(C)
|
|
||||||
PROGHDRS=
|
|
||||||
PROGDOCS=
|
|
||||||
PROGOBJS= pnm2pngm$(O)
|
|
||||||
|
|
||||||
OBJS = $(PROGOBJS) $(PNGOBJS) $(ZOBJS)
|
|
||||||
|
|
||||||
# implicit make rules -------------------------------------------------------
|
|
||||||
|
|
||||||
.c$(O):
|
|
||||||
$(CC) -c $(CFLAGS) $<
|
|
||||||
|
|
||||||
# dependencies
|
|
||||||
|
|
||||||
all: pnm2pngm$(E)
|
|
||||||
|
|
||||||
pnm2pngm$(E): $(OBJS)
|
|
||||||
$(LD) -o pnm2pngm$(E) $(OBJS)
|
|
||||||
|
|
||||||
# The DFA_XTRA setting turns all libpng options off then
|
|
||||||
# turns on those required for this minimal build.
|
|
||||||
# The CPP_FLAGS setting causes pngusr.h to be included in
|
|
||||||
# both the build of pnglibconf.h and, subsequently, when
|
|
||||||
# building libpng itself.
|
|
||||||
$(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak\
|
|
||||||
$(PNGSRC)/scripts/pnglibconf.dfa \
|
|
||||||
$(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa
|
|
||||||
$(RM) pnglibconf.h pnglibconf.dfn
|
|
||||||
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
|
|
||||||
srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG"\
|
|
||||||
DFA_XTRA="pngusr.dfa" $@
|
|
||||||
|
|
||||||
clean:
|
|
||||||
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
|
|
||||||
srcdir=$(PNGSRC) clean
|
|
||||||
$(RM) pnm2pngm$(O)
|
|
||||||
$(RM) pnm2pngm$(E)
|
|
||||||
$(RM) $(OBJS)
|
|
||||||
|
|
||||||
# distclean also removes the copied source and headers
|
|
||||||
distclean: clean
|
|
||||||
$(RM) -r scripts # historical reasons
|
|
||||||
$(RM) $(PNGSRCS) $(PNGH)
|
|
||||||
$(RM) $(ZSRCS) $(ZH) $(ZCONF)
|
|
||||||
$(RM) $(PROGSRCS) $(PROGHDRS) $(PROGDOCS)
|
|
||||||
|
|
||||||
# Header file dependencies:
|
|
||||||
$(PROGOBJS): $(PROGHDRS) $(PNGINC) $(ZINC)
|
|
||||||
$(PNGOBJS): $(PNGHDRS) $(ZINC)
|
|
||||||
$(ZOBJS): $(ZHDRS)
|
|
||||||
|
|
||||||
# Gather the source code from the respective directories
|
|
||||||
$(PNGSRCS) $(PNGH): $(PNGSRC)/$@
|
|
||||||
$(RM) $@
|
|
||||||
$(COPY) $(PNGSRC)/$@ $@
|
|
||||||
|
|
||||||
# No dependency on the ZLIBSRC target so that it only needs
|
|
||||||
# to be specified once.
|
|
||||||
$(ZSRCS) $(ZH):
|
|
||||||
$(RM) $@
|
|
||||||
$(COPY) $(ZLIBSRC)/$@ $@
|
|
||||||
|
|
||||||
# The unconfigured zconf.h varies in name according to the
|
|
||||||
# zlib release
|
|
||||||
$(ZCONF):
|
|
||||||
$(RM) $@
|
|
||||||
@for f in zconf.h.in zconf.in.h zconf.h; do\
|
|
||||||
test -r $(ZLIBSRC)/$$f &&\
|
|
||||||
echo $(COPY) $(ZLIBSRC)/$$f $@ &&\
|
|
||||||
$(COPY) $(ZLIBSRC)/$$f $@ && exit 0;\
|
|
||||||
done; echo copy: $(ZLIBSRC)/zconf.h not found; exit 1
|
|
||||||
|
|
||||||
pnm2pngm.c: $(PROGSRC)/pnm2png.c
|
|
||||||
$(RM) $@
|
|
||||||
$(COPY) $(PROGSRC)/pnm2png.c $@
|
|
||||||
|
|
||||||
# End of makefile for pnm2pngm
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
# pngminim/encoder/pngusr.dfa
|
|
||||||
#
|
|
||||||
# Copyright (c) 2010-2011 Glenn Randers-Pehrson
|
|
||||||
#
|
|
||||||
# This code is released under the libpng license.
|
|
||||||
# For conditions of distribution and use, see the disclaimer
|
|
||||||
# and license in png.h
|
|
||||||
|
|
||||||
# First all the build options off:
|
|
||||||
|
|
||||||
everything = off
|
|
||||||
|
|
||||||
# Switch on the write code - this makes a minimalist encoder
|
|
||||||
|
|
||||||
option WRITE on
|
|
||||||
|
|
||||||
# You must choose fixed or floating point arithmetic:
|
|
||||||
# option FLOATING_POINT on
|
|
||||||
|
|
||||||
option FIXED_POINT on
|
|
||||||
|
|
||||||
# You must chose the internal fixed point implementation or to
|
|
||||||
# use the system floating point. The latter is considerably
|
|
||||||
# smaller (by about 1kbyte on an x86 system):
|
|
||||||
# option FLOATING_ARITHMETIC on
|
|
||||||
|
|
||||||
option FLOATING_ARITHMETIC off
|
|
||||||
|
|
||||||
# Your program will probably need other options. The example
|
|
||||||
# program here, pnm2pngm, requires the following. Take a look
|
|
||||||
# at pnglibconf.h to find out the full set of what has to be
|
|
||||||
# enabled to make the following work.
|
|
||||||
|
|
||||||
option SETJMP on
|
|
||||||
option STDIO on
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
/* minwrpngconf.h: headers to make a minimal png-write-only library
|
|
||||||
*
|
|
||||||
* Copyright (c) 2007, 2010-2011 Glenn Randers-Pehrson
|
|
||||||
*
|
|
||||||
* This code is released under the libpng license.
|
|
||||||
* For conditions of distribution and use, see the disclaimer
|
|
||||||
* and license in png.h
|
|
||||||
*
|
|
||||||
* Derived from pngcrush.h, Copyright 1998-2007, Glenn Randers-Pehrson
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef MINWRPNGCONF_H
|
|
||||||
#define MINWRPNGCONF_H
|
|
||||||
|
|
||||||
/* To include pngusr.h set -DPNG_USER_CONFIG in CPPFLAGS */
|
|
||||||
|
|
||||||
/* List options to turn off features of the build that do not
|
|
||||||
* affect the API (so are not recorded in pnglibconf.h)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define PNG_NO_WARNINGS
|
|
||||||
|
|
||||||
#endif /* MINWRPNGCONF_H */
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
This demonstrates the use of PNG_USER_CONFIG and pngusr.h
|
|
||||||
|
|
||||||
The makefile builds a minimal read-only progressive decoder with
|
|
||||||
embedded libpng, zlib and your system's X library.
|
|
||||||
|
|
||||||
Specify the location of the zlib source (1.2.1 or later) as ZLIBSRC
|
|
||||||
on the make command line.
|
|
||||||
|
|
||||||
Edit makefile if required, to find your X library and include files,
|
|
||||||
then
|
|
||||||
|
|
||||||
make ZLIBSRC=directory
|
|
||||||
|
|
||||||
If you prefer to use the shared libraries, go to contrib/gregbook
|
|
||||||
and build the rpng2-x application there.
|
|
||||||
@@ -1,165 +0,0 @@
|
|||||||
# Makefile for PngMinus (rpng2)
|
|
||||||
# Linux / Unix
|
|
||||||
|
|
||||||
#CC=cc
|
|
||||||
CC=gcc
|
|
||||||
LD=$(CC)
|
|
||||||
|
|
||||||
# If awk fails try
|
|
||||||
# make AWK=nawk
|
|
||||||
|
|
||||||
# If cpp fails try
|
|
||||||
# make CPP=/lib/cpp
|
|
||||||
|
|
||||||
RM=rm -f
|
|
||||||
COPY=cp
|
|
||||||
|
|
||||||
#XINC = -I/usr/include # old-style, stock X distributions
|
|
||||||
#XLIB = -L/usr/lib/X11 -lX11 # (including SGI IRIX)
|
|
||||||
|
|
||||||
#XINC = -I/usr/openwin/include # Sun workstations (OpenWindows)
|
|
||||||
#XLIB = -L/usr/openwin/lib -lX11
|
|
||||||
|
|
||||||
XINC = -I/usr/X11R6/include # new X distributions (X.org, etc.)
|
|
||||||
XLIB = -L/usr/X11R6/lib -lX11
|
|
||||||
#XLIB = -L/usr/X11R6/lib64 -lX11 # e.g., Red Hat on AMD64
|
|
||||||
|
|
||||||
#XINC = -I/usr/local/include # FreeBSD
|
|
||||||
#XLIB = -L/usr/local/lib -lX11
|
|
||||||
|
|
||||||
#LIBS = $(XLIB)
|
|
||||||
LIBS = $(XLIB) -lm #platforms that need libm
|
|
||||||
|
|
||||||
CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP -I. $(XINC) -O1
|
|
||||||
|
|
||||||
C=.c
|
|
||||||
O=.o
|
|
||||||
L=.a
|
|
||||||
E=
|
|
||||||
|
|
||||||
# Where to find the source code:
|
|
||||||
PNGSRC =../../..
|
|
||||||
ZLIBSRC=$(PNGSRC)/../zlib
|
|
||||||
PROGSRC=$(PNGSRC)/contrib/gregbook
|
|
||||||
|
|
||||||
# Zlib (minimal inflate requirements - crc32 is used by libpng)
|
|
||||||
# zutil can be eliminated if you provide your own zcalloc and zcfree
|
|
||||||
ZSRCS = adler32$(C) crc32$(C) \
|
|
||||||
inffast$(C) inflate$(C) inftrees$(C) \
|
|
||||||
zutil$(C)
|
|
||||||
|
|
||||||
# Standard headers
|
|
||||||
ZH = zlib.h crc32.h inffast.h inffixed.h \
|
|
||||||
inflate.h inftrees.h zutil.h
|
|
||||||
|
|
||||||
# Machine generated headers
|
|
||||||
ZCONF = zconf.h
|
|
||||||
|
|
||||||
# Headers callers use
|
|
||||||
ZINC = zlib.h $(ZCONF)
|
|
||||||
|
|
||||||
# Headers the Zlib source uses
|
|
||||||
ZHDRS = $(ZH) $(ZCONF)
|
|
||||||
|
|
||||||
ZOBJS = adler32$(O) crc32$(O) \
|
|
||||||
inffast$(O) inflate$(O) inftrees$(O) \
|
|
||||||
zutil$(O)
|
|
||||||
|
|
||||||
# libpng
|
|
||||||
PNGSRCS=png$(C) pngerror$(C) pngget$(C) pngmem$(C) \
|
|
||||||
pngpread$(C) pngread$(C) pngrio$(C) pngrtran$(C) pngrutil$(C) \
|
|
||||||
pngset$(C) pngtrans$(C)
|
|
||||||
|
|
||||||
# Standard headers
|
|
||||||
PNGH =png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
|
|
||||||
|
|
||||||
# Machine generated headers
|
|
||||||
PNGCONF=pnglibconf.h
|
|
||||||
|
|
||||||
# Headers callers use
|
|
||||||
PNGINC= png.h pngconf.h pngusr.h $(PNGCONF)
|
|
||||||
|
|
||||||
# Headers the PNG library uses
|
|
||||||
PNGHDRS=$(PNGH) $(PNGCONF) pngusr.h
|
|
||||||
|
|
||||||
PNGOBJS=png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
|
|
||||||
pngpread$(O) pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \
|
|
||||||
pngset$(O) pngtrans$(O)
|
|
||||||
|
|
||||||
PROGSRCS= rpng2-x$(C) readpng2$(C)
|
|
||||||
PROGHDRS= readpng2.h
|
|
||||||
PROGDOCS= COPYING LICENSE
|
|
||||||
PROGOBJS= rpng2-x$(O) readpng2$(O)
|
|
||||||
|
|
||||||
OBJS = $(PROGOBJS) $(PNGOBJS) $(ZOBJS)
|
|
||||||
|
|
||||||
# implicit make rules -------------------------------------------------------
|
|
||||||
|
|
||||||
.c$(O):
|
|
||||||
$(CC) -c $(CFLAGS) $<
|
|
||||||
|
|
||||||
# dependencies
|
|
||||||
|
|
||||||
all: $(PROGDOCS) rpng2-x$(E)
|
|
||||||
|
|
||||||
rpng2-x$(E): $(OBJS)
|
|
||||||
$(LD) -o rpng2-x$(E) $(OBJS) $(LIBS)
|
|
||||||
|
|
||||||
# The DFA_XTRA setting turns all libpng options off then
|
|
||||||
# turns on those required for this minimal build.
|
|
||||||
# The CPP_FLAGS setting causes pngusr.h to be included in
|
|
||||||
# both the build of pnglibconf.h and, subsequently, when
|
|
||||||
# building libpng itself.
|
|
||||||
$(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak\
|
|
||||||
$(PNGSRC)/scripts/pnglibconf.dfa \
|
|
||||||
$(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa
|
|
||||||
$(RM) pnglibconf.h pnglibconf.dfn
|
|
||||||
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
|
|
||||||
srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG"\
|
|
||||||
DFA_XTRA="pngusr.dfa" $@
|
|
||||||
|
|
||||||
clean:
|
|
||||||
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
|
|
||||||
srcdir=$(PNGSRC) clean
|
|
||||||
$(RM) rpng2-x$(O)
|
|
||||||
$(RM) rpng2-x$(E)
|
|
||||||
$(RM) $(OBJS)
|
|
||||||
|
|
||||||
# distclean also removes the copied source and headers
|
|
||||||
distclean: clean
|
|
||||||
$(RM) -r scripts # historical reasons
|
|
||||||
$(RM) $(PNGSRCS) $(PNGH)
|
|
||||||
$(RM) $(ZSRCS) $(ZH) $(ZCONF)
|
|
||||||
$(RM) $(PROGSRCS) $(PROGHDRS) $(PROGDOCS)
|
|
||||||
|
|
||||||
# Header file dependencies:
|
|
||||||
$(PROGOBJS): $(PROGHDRS) $(PNGINC) $(ZINC)
|
|
||||||
$(PNGOBJS): $(PNGHDRS) $(ZINC)
|
|
||||||
$(ZOBJS): $(ZHDRS)
|
|
||||||
|
|
||||||
# Gather the source code from the respective directories
|
|
||||||
$(PNGSRCS) $(PNGH): $(PNGSRC)/$@
|
|
||||||
$(RM) $@
|
|
||||||
$(COPY) $(PNGSRC)/$@ $@
|
|
||||||
|
|
||||||
# No dependency on the ZLIBSRC target so that it only needs
|
|
||||||
# to be specified once.
|
|
||||||
$(ZSRCS) $(ZH):
|
|
||||||
$(RM) $@
|
|
||||||
$(COPY) $(ZLIBSRC)/$@ $@
|
|
||||||
|
|
||||||
# The unconfigured zconf.h varies in name according to the
|
|
||||||
# zlib release
|
|
||||||
$(ZCONF):
|
|
||||||
$(RM) $@
|
|
||||||
@for f in zconf.h.in zconf.in.h zconf.h; do\
|
|
||||||
test -r $(ZLIBSRC)/$$f &&\
|
|
||||||
echo $(COPY) $(ZLIBSRC)/$$f $@ &&\
|
|
||||||
$(COPY) $(ZLIBSRC)/$$f $@ && exit 0;\
|
|
||||||
done; echo copy: $(ZLIBSRC)/zconf.h not found; exit 1
|
|
||||||
|
|
||||||
$(PROGSRCS) $(PROGHDRS) $(PROGDOCS): $(PROGSRC)/$@
|
|
||||||
$(RM) $@
|
|
||||||
$(COPY) $(PROGSRC)/$@ $@
|
|
||||||
|
|
||||||
# End of makefile for rpng2-x
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
# pngminim/preader/pngusr.dfa
|
|
||||||
#
|
|
||||||
# Copyright (c) 2010-2011 Glenn Randers-Pehrson
|
|
||||||
#
|
|
||||||
# This code is released under the libpng license.
|
|
||||||
# For conditions of distribution and use, see the disclaimer
|
|
||||||
# and license in png.h
|
|
||||||
|
|
||||||
# First all the build options off:
|
|
||||||
|
|
||||||
everything = off
|
|
||||||
|
|
||||||
# Just switch on the progressive read code
|
|
||||||
|
|
||||||
option PROGRESSIVE_READ on
|
|
||||||
|
|
||||||
# You may choose fixed or floating point APIs:
|
|
||||||
# option FLOATING_POINT on
|
|
||||||
|
|
||||||
option FIXED_POINT on
|
|
||||||
|
|
||||||
# You must chose the internal fixed point implementation or to
|
|
||||||
# use the system floating point. The latter is considerably
|
|
||||||
# smaller (by about 1kbyte on an x86 system):
|
|
||||||
|
|
||||||
option FLOATING_ARITHMETIC on
|
|
||||||
# option FLOATING_ARITHMETIC off
|
|
||||||
|
|
||||||
# Your program will probably need other options. The example
|
|
||||||
# program here, rpng2-x, requires the following. Take a look
|
|
||||||
# at pnglibconf.h to find out the full set of what has to be
|
|
||||||
# enabled to make the following work.
|
|
||||||
|
|
||||||
option SETJMP on
|
|
||||||
option STDIO on
|
|
||||||
option READ_bKGD on
|
|
||||||
option READ_GAMMA on
|
|
||||||
option READ_EXPAND on
|
|
||||||
option READ_16_TO_8 on
|
|
||||||
option READ_GRAY_TO_RGB on
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
/* minrdpngconf.h: headers to make a minimal png-read-only library
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009, 2010-2011 Glenn Randers-Pehrson
|
|
||||||
*
|
|
||||||
* This code is released under the libpng license.
|
|
||||||
* For conditions of distribution and use, see the disclaimer
|
|
||||||
* and license in png.h
|
|
||||||
*
|
|
||||||
* Derived from pngcrush.h, Copyright 1998-2007, Glenn Randers-Pehrson
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef MINPRDPNGCONF_H
|
|
||||||
#define MINPRDPNGCONF_H
|
|
||||||
|
|
||||||
/* To include pngusr.h set -DPNG_USER_CONFIG in CPPFLAGS */
|
|
||||||
|
|
||||||
/* List options to turn off features of the build that do not
|
|
||||||
* affect the API (so are not recorded in pnglibconf.h)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define PNG_NO_WARNINGS
|
|
||||||
|
|
||||||
#endif /* MINPRDPNGCONF_H */
|
|
||||||
@@ -188,7 +188,7 @@ void usage()
|
|||||||
BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL alpha)
|
BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL alpha)
|
||||||
{
|
{
|
||||||
png_struct *png_ptr = NULL;
|
png_struct *png_ptr = NULL;
|
||||||
png_info *info_ptr = NULL;
|
png_info *info_ptr = NULL;
|
||||||
png_byte buf[8];
|
png_byte buf[8];
|
||||||
png_byte *png_pixels = NULL;
|
png_byte *png_pixels = NULL;
|
||||||
png_byte **row_pointers = NULL;
|
png_byte **row_pointers = NULL;
|
||||||
@@ -211,8 +211,8 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
|
|||||||
if (ret != 8)
|
if (ret != 8)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
ret = png_sig_cmp (buf, 0, 8);
|
ret = png_check_sig (buf, 8);
|
||||||
if (ret)
|
if (!ret)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* create png and info structures */
|
/* create png and info structures */
|
||||||
@@ -381,7 +381,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
|
|||||||
fputc ((int) *pix_ptr++ , pnm_file);
|
fputc ((int) *pix_ptr++ , pnm_file);
|
||||||
else
|
else
|
||||||
if (bit_depth == 16){
|
if (bit_depth == 16){
|
||||||
dep_16 = (long) *pix_ptr++;
|
dep_16 = (long) *pix_ptr++;
|
||||||
fprintf (pnm_file, "%ld ", (dep_16 << 8) + ((long) *pix_ptr++));
|
fprintf (pnm_file, "%ld ", (dep_16 << 8) + ((long) *pix_ptr++));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -401,9 +401,9 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
|
|||||||
fputc ((int) *pix_ptr++ , alpha_file);
|
fputc ((int) *pix_ptr++ , alpha_file);
|
||||||
else
|
else
|
||||||
if (bit_depth == 16){
|
if (bit_depth == 16){
|
||||||
dep_16 = (long) *pix_ptr++;
|
dep_16 = (long) *pix_ptr++;
|
||||||
fprintf (alpha_file, "%ld ", (dep_16 << 8) + (long) *pix_ptr++);
|
fprintf (alpha_file, "%ld ", (dep_16 << 8) + (long) *pix_ptr++);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fprintf (alpha_file, "%ld ", (long) *pix_ptr++);
|
fprintf (alpha_file, "%ld ", (long) *pix_ptr++);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,58 +1,41 @@
|
|||||||
|
|
||||||
pngsuite
|
pngsuite
|
||||||
--------
|
--------
|
||||||
(c) Willem van Schaik, 1999, 2011
|
(c) Willem van Schaik, 1999
|
||||||
|
|
||||||
Permission to use, copy, modify, and distribute these images for any
|
Permission to use, copy, and distribute these images for any purpose and
|
||||||
purpose and without fee is hereby granted.
|
without fee is hereby granted.
|
||||||
|
|
||||||
The 15 "bas*.png" images are part of the much larger PngSuite test-set of
|
These 15 images are part of the much larger PngSuite test-set of
|
||||||
images, available for developers of PNG supporting software. The
|
images, available for developers of PNG supporting software. The
|
||||||
complete set, available at http:/www.schaik.com/pngsuite/, contains
|
complete set, available at http:/www.schaik.com/pngsuite/, contains
|
||||||
a variety of images to test interlacing, gamma settings, ancillary
|
a variety of images to test interlacing, gamma settings, ancillary
|
||||||
chunks, etc.
|
chunks, etc.
|
||||||
|
|
||||||
The "ft*.png" images are "free/libre" replacements for the transparent
|
|
||||||
corresponding t*.png images in the PngSuite.
|
|
||||||
|
|
||||||
The images in this directory represent the basic PNG color-types:
|
The images in this directory represent the basic PNG color-types:
|
||||||
grayscale (1-16 bit deep), full color (8 or 16 bit), paletted
|
grayscale (1-16 bit deep), full color (8 or 16 bit), paletted
|
||||||
(1-8 bit) and grayscale or color images with alpha channel. You
|
(1-8 bit) and grayscale or color images with alpha channel. You
|
||||||
can use them to test the proper functioning of PNG software.
|
can use them to test the proper functioning of PNG software.
|
||||||
|
|
||||||
filename depth type
|
filename depth type
|
||||||
------------ ------ --------------
|
------------ ------ --------------
|
||||||
basn0g01.png 1-bit grayscale
|
basn0g01.png 1-bit grayscale
|
||||||
basn0g02.png 2-bit grayscale
|
basn0g02.png 2-bit grayscale
|
||||||
basn0g04.png 4-bit grayscale
|
basn0g04.png 4-bit grayscale
|
||||||
basn0g08.png 8-bit grayscale
|
basn0g08.png 8-bit grayscale
|
||||||
basn0g16.png 16-bit grayscale
|
basn0g16.png 16-bit grayscale
|
||||||
basn2c08.png 8-bit truecolor
|
basn2c08.png 8-bit truecolor
|
||||||
basn2c16.png 16-bit truecolor
|
basn2c16.png 16-bit truecolor
|
||||||
basn3p01.png 1-bit paletted
|
basn3p01.png 1-bit paletted
|
||||||
basn3p02.png 2-bit paletted
|
basn3p02.png 2-bit paletted
|
||||||
basn3p04.png 4-bit paletted
|
basn3p04.png 4-bit paletted
|
||||||
basn3p08.png 8-bit paletted
|
basn3p08.png 8-bit paletted
|
||||||
basn4a08.png 8-bit gray with alpha
|
basn4a08.png 8-bit gray with alpha
|
||||||
basn4a16.png 16-bit gray with alpha
|
basn4a16.png 16-bit gray with alpha
|
||||||
basn6a08.png 8-bit RGBA
|
basn6a08.png 8-bit RGBA
|
||||||
basn6a16.png 16-bit RGBA
|
basn6a16.png 16-bit RGBA
|
||||||
|
|
||||||
ftbbn0g04.png 4-bit grayscale, black bKGD
|
Here is the correct result of typing "pngtest -m *.png" in
|
||||||
ftbbn2c16.png 16-bit truecolor, black bKGD
|
|
||||||
ftbbn3p08.png 8-bit paletted, black bKGD
|
|
||||||
ftbgn2c16.png 16-bit truecolor, gray bKGD
|
|
||||||
ftbgn3p08.png 8-bit paletted, gray bKGD
|
|
||||||
ftbrn2c08.png 8-bit truecolor, red bKGD
|
|
||||||
ftbwn0g16.png 16-bit gray, white bKGD
|
|
||||||
ftbwn3p08.png 8-bit paletted, white bKGD
|
|
||||||
ftbyn3p08.png 8-bit paletted, yellow bKGD
|
|
||||||
ftp0n0g08.png 8-bit grayscale, opaque
|
|
||||||
ftp0n2c08.png 8-bit truecolor, opaque
|
|
||||||
ftp0n3p08.png 8-bit paletted, opaque
|
|
||||||
ftp1n3p08.png 8-bit paletted, no bKGD
|
|
||||||
|
|
||||||
Here is the correct result of typing "pngtest -m bas*.png" in
|
|
||||||
this directory:
|
this directory:
|
||||||
|
|
||||||
Testing basn0g01.png: PASS (524 zero samples)
|
Testing basn0g01.png: PASS (524 zero samples)
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 429 B |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 719 B |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
@@ -2,11 +2,8 @@
|
|||||||
// PNGFILE.C -- Image File Functions
|
// PNGFILE.C -- Image File Functions
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
|
|
||||||
// Copyright 2000, Willem van Schaik.
|
// Copyright 2000, Willem van Schaik. For conditions of distribution and
|
||||||
//
|
// use, see the copyright/license/disclaimer notice in png.h
|
||||||
// This code is released under the libpng license.
|
|
||||||
// For conditions of distribution and use, see the disclaimer
|
|
||||||
// and license in png.h
|
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <commdlg.h>
|
#include <commdlg.h>
|
||||||
@@ -35,7 +32,7 @@ png_cexcept_error(png_structp png_ptr, png_const_charp msg)
|
|||||||
{
|
{
|
||||||
if(png_ptr)
|
if(png_ptr)
|
||||||
;
|
;
|
||||||
#ifdef PNG_CONSOLE_IO_SUPPORTED
|
#ifndef PNG_NO_CONSOLE_IO
|
||||||
fprintf(stderr, "libpng error: %s\n", msg);
|
fprintf(stderr, "libpng error: %s\n", msg);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@@ -126,7 +123,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
|||||||
// first check the eight byte PNG signature
|
// first check the eight byte PNG signature
|
||||||
|
|
||||||
fread(pbSig, 1, 8, pfFile);
|
fread(pbSig, 1, 8, pfFile);
|
||||||
if (png_sig_cmp(pbSig, 0, 8))
|
if (!png_check_sig(pbSig, 8))
|
||||||
{
|
{
|
||||||
*ppbImageData = pbImageData = NULL;
|
*ppbImageData = pbImageData = NULL;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -155,7 +152,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
|||||||
|
|
||||||
// initialize the png structure
|
// initialize the png structure
|
||||||
|
|
||||||
#ifdef PNG_STDIO_SUPPORTED
|
#if !defined(PNG_NO_STDIO)
|
||||||
png_init_io(png_ptr, pfFile);
|
png_init_io(png_ptr, pfFile);
|
||||||
#else
|
#else
|
||||||
png_set_read_fn(png_ptr, (png_voidp)pfFile, png_read_data);
|
png_set_read_fn(png_ptr, (png_voidp)pfFile, png_read_data);
|
||||||
@@ -324,7 +321,7 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
|||||||
{
|
{
|
||||||
// initialize the png structure
|
// initialize the png structure
|
||||||
|
|
||||||
#ifdef PNG_STDIO_SUPPORTED
|
#if !defined(PNG_NO_STDIO)
|
||||||
png_init_io(png_ptr, pfFile);
|
png_init_io(png_ptr, pfFile);
|
||||||
#else
|
#else
|
||||||
png_set_write_fn(png_ptr, (png_voidp)pfFile, png_write_data, png_flush);
|
png_set_write_fn(png_ptr, (png_voidp)pfFile, png_write_data, png_flush);
|
||||||
@@ -395,7 +392,7 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef PNG_STDIO_SUPPORTED
|
#ifdef PNG_NO_STDIO
|
||||||
|
|
||||||
static void
|
static void
|
||||||
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
|
|||||||
@@ -2,11 +2,8 @@
|
|||||||
// PNGFILE.H -- Header File for pngfile.c
|
// PNGFILE.H -- Header File for pngfile.c
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
|
|
||||||
// Copyright 2000, Willem van Schaik.
|
// Copyright 2000, Willem van Schaik. For conditions of distribution and
|
||||||
|
// use, see the copyright/license/disclaimer notice in png.h
|
||||||
// This code is released under the libpng license.
|
|
||||||
// For conditions of distribution and use, see the disclaimer
|
|
||||||
// and license in png.h
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -22,7 +19,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
|||||||
BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
||||||
int iWidth, int iHeight, png_color BkgColor);
|
int iWidth, int iHeight, png_color BkgColor);
|
||||||
|
|
||||||
#ifndef PNG_STDIO_SUPPORTED
|
#if defined(PNG_NO_STDIO)
|
||||||
static void png_read_data(png_structp png_ptr, png_bytep data, png_size_t length);
|
static void png_read_data(png_structp png_ptr, png_bytep data, png_size_t length);
|
||||||
static void png_write_data(png_structp png_ptr, png_bytep data, png_size_t length);
|
static void png_write_data(png_structp png_ptr, png_bytep data, png_size_t length);
|
||||||
static void png_flush(png_structp png_ptr);
|
static void png_flush(png_structp png_ptr);
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
Microsoft Developer Studio Build File, Format Version 6.00 for VisualPng
|
Microsoft Developer Studio Build File, Format Version 6.00 for VisualPng
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright 2000, Willem van Schaik.
|
Copyright 2000, Willem van Schaik. For conditions of distribution and
|
||||||
|
use, see the copyright/license/disclaimer notice in png.h
|
||||||
This code is released under the libpng license.
|
|
||||||
For conditions of distribution and use, see the disclaimer
|
|
||||||
and license in png.h
|
|
||||||
|
|
||||||
As a PNG .dll demo VisualPng is finished. More features would only hinder
|
As a PNG .dll demo VisualPng is finished. More features would only hinder
|
||||||
the program's objective. However, further extensions (like support for other
|
the program's objective. However, further extensions (like support for other
|
||||||
|
|||||||
@@ -2,11 +2,8 @@
|
|||||||
// VisualPng.C -- Shows a PNG image
|
// VisualPng.C -- Shows a PNG image
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
|
|
||||||
// Copyright 2000, Willem van Schaik.
|
// Copyright 2000, Willem van Schaik. For conditions of distribution and
|
||||||
|
// use, see the copyright/license/disclaimer notice in png.h
|
||||||
// This code is released under the libpng license.
|
|
||||||
// For conditions of distribution and use, see the disclaimer
|
|
||||||
// and license in png.h
|
|
||||||
|
|
||||||
// switches
|
// switches
|
||||||
|
|
||||||
|
|||||||
@@ -43,9 +43,9 @@ RSC=rc.exe
|
|||||||
# PROP Intermediate_Dir "Release"
|
# PROP Intermediate_Dir "Release"
|
||||||
# PROP Ignore_Export_Lib 0
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_NO_STDIO" /FD /c
|
# ADD BASE CPP /nologo /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /c
|
||||||
# SUBTRACT BASE CPP /YX
|
# SUBTRACT BASE CPP /YX
|
||||||
# ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_NO_STDIO" /FD /c
|
# ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /c
|
||||||
# SUBTRACT CPP /YX
|
# SUBTRACT CPP /YX
|
||||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||||
@@ -77,9 +77,9 @@ PostBuild_Cmds=$(outdir)\VisualPng.exe ..\..\contrib\pngsuite\basn6a16.png
|
|||||||
# PROP Intermediate_Dir "Debug"
|
# PROP Intermediate_Dir "Debug"
|
||||||
# PROP Ignore_Export_Lib 0
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "PNG_NO_STDIO" /FD /GZ /c
|
# ADD BASE CPP /nologo /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /GZ /c
|
||||||
# SUBTRACT BASE CPP /YX
|
# SUBTRACT BASE CPP /YX
|
||||||
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "PNG_NO_STDIO" /FD /GZ /c
|
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /GZ /c
|
||||||
# SUBTRACT CPP /YX
|
# SUBTRACT CPP /YX
|
||||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||||
|
|||||||
@@ -1,30 +1,25 @@
|
|||||||
/*===
|
/*===
|
||||||
cexcept.h 2.0.1 (2008-Jul-19-Sat)
|
cexcept.h 2.0.0 (2001-Jul-12-Thu)
|
||||||
http://www.nicemice.net/cexcept/
|
Adam M. Costello <amc@cs.berkeley.edu>
|
||||||
Adam M. Costello
|
|
||||||
http://www.nicemice.net/amc/
|
|
||||||
|
|
||||||
An interface for exception-handling in ANSI C (C89 and subsequent ISO
|
An interface for exception-handling in ANSI C (C89 and subsequent ISO
|
||||||
standards), developed jointly with Cosmin Truta.
|
standards), developed jointly with Cosmin Truta <cosmin@cs.toronto.edu>.
|
||||||
|
|
||||||
Copyright (c) 2000-2008 Adam M. Costello and Cosmin Truta.
|
Copyright (c) 2001 Adam M. Costello and Cosmin Truta. Everyone
|
||||||
This software may be modified only if its author and version
|
is hereby granted permission to do whatever they like with this
|
||||||
information is updated accurately, and may be redistributed
|
file, provided that if they modify it they take reasonable steps to
|
||||||
only if accompanied by this unaltered notice. Subject to those
|
avoid confusing or misleading people about the authors, version,
|
||||||
restrictions, permission is granted to anyone to do anything
|
and terms of use of the derived file. The copyright holders make
|
||||||
with this software. The copyright holders make no guarantees
|
no guarantees regarding this file, and are not responsible for any
|
||||||
regarding this software, and are not responsible for any damage
|
damage resulting from its use.
|
||||||
resulting from its use.
|
|
||||||
|
|
||||||
The cexcept interface is not compatible with and cannot interact
|
Only user-defined exceptions are supported, not "real" exceptions like
|
||||||
with system exceptions (like division by zero or memory segmentation
|
division by zero or memory segmentation violations.
|
||||||
violation), compiler-generated exceptions (like C++ exceptions), or
|
|
||||||
other exception-handling interfaces.
|
|
||||||
|
|
||||||
When using this interface across multiple .c files, do not include
|
If this interface is used by multiple .c files, they shouldn't include
|
||||||
this header file directly. Instead, create a wrapper header file that
|
this header file directly. Instead, create a wrapper header file that
|
||||||
includes this header file and then invokes the define_exception_type
|
includes this header file and then invokes the define_exception_type
|
||||||
macro (see below). The .c files should then include that header file.
|
macro (see below), and let your .c files include that header file.
|
||||||
|
|
||||||
The interface consists of one type, one well-known name, and six macros.
|
The interface consists of one type, one well-known name, and six macros.
|
||||||
|
|
||||||
@@ -169,7 +164,7 @@ Throw expression;
|
|||||||
be compatible with the type passed to define_exception_type(). The
|
be compatible with the type passed to define_exception_type(). The
|
||||||
exception must be caught, otherwise the program may crash.
|
exception must be caught, otherwise the program may crash.
|
||||||
|
|
||||||
Slight limitation: If the expression is a comma-expression, it must
|
Slight limitation: If the expression is a comma-expression it must
|
||||||
be enclosed in parentheses.
|
be enclosed in parentheses.
|
||||||
|
|
||||||
|
|
||||||
@@ -214,11 +209,11 @@ struct exception_context { \
|
|||||||
exception__prev = the_exception_context->penv; \
|
exception__prev = the_exception_context->penv; \
|
||||||
the_exception_context->penv = &exception__env; \
|
the_exception_context->penv = &exception__env; \
|
||||||
if (setjmp(exception__env) == 0) { \
|
if (setjmp(exception__env) == 0) { \
|
||||||
do
|
if (&exception__prev)
|
||||||
|
|
||||||
#define exception__catch(action) \
|
#define exception__catch(action) \
|
||||||
while (the_exception_context->caught = 0, \
|
else { } \
|
||||||
the_exception_context->caught); \
|
the_exception_context->caught = 0; \
|
||||||
} \
|
} \
|
||||||
else { \
|
else { \
|
||||||
the_exception_context->caught = 1; \
|
the_exception_context->caught = 1; \
|
||||||
@@ -231,14 +226,14 @@ struct exception_context { \
|
|||||||
#define Catch(e) exception__catch(((e) = the_exception_context->v.etmp, 0))
|
#define Catch(e) exception__catch(((e) = the_exception_context->v.etmp, 0))
|
||||||
#define Catch_anonymous exception__catch(0)
|
#define Catch_anonymous exception__catch(0)
|
||||||
|
|
||||||
/* Try ends with do, and Catch begins with while(0) and ends with */
|
/* Try ends with if(), and Catch begins and ends with else. This */
|
||||||
/* else, to ensure that Try/Catch syntax is similar to if/else */
|
/* ensures that the Try/Catch syntax is really the same as the */
|
||||||
/* syntax. */
|
/* if/else syntax. */
|
||||||
/* */
|
/* */
|
||||||
/* The 0 in while(0) is expressed as x=0,x in order to appease */
|
/* We use &exception__prev instead of 1 to appease compilers that */
|
||||||
/* compilers that warn about constant expressions inside while(). */
|
/* warn about constant expressions inside if(). Most compilers */
|
||||||
/* Most compilers should still recognize that the condition is always */
|
/* should still recognize that &exception__prev is never zero and */
|
||||||
/* false and avoid generating code for it. */
|
/* avoid generating test code. */
|
||||||
|
|
||||||
#define Throw \
|
#define Throw \
|
||||||
for (;; longjmp(*the_exception_context->penv, 1)) \
|
for (;; longjmp(*the_exception_context->penv, 1)) \
|
||||||
|
|||||||
499
depcomp
@@ -1,10 +1,7 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# depcomp - compile a program generating dependencies as side-effects
|
# depcomp - compile a program generating dependencies as side-effects
|
||||||
|
# Copyright 1999, 2000 Free Software Foundation, Inc.
|
||||||
scriptversion=2009-04-28.21; # UTC
|
|
||||||
|
|
||||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
|
|
||||||
# Software Foundation, Inc.
|
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -17,7 +14,9 @@ scriptversion=2009-04-28.21; # UTC
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
|
# 02111-1307, USA.
|
||||||
|
|
||||||
# As a special exception to the GNU General Public License, if you
|
# As a special exception to the GNU General Public License, if you
|
||||||
# distribute this file as part of a program that contains a
|
# distribute this file as part of a program that contains a
|
||||||
@@ -26,45 +25,13 @@ scriptversion=2009-04-28.21; # UTC
|
|||||||
|
|
||||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||||
|
|
||||||
case $1 in
|
|
||||||
'')
|
|
||||||
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
|
||||||
exit 1;
|
|
||||||
;;
|
|
||||||
-h | --h*)
|
|
||||||
cat <<\EOF
|
|
||||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
|
||||||
|
|
||||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
|
||||||
as side-effects.
|
|
||||||
|
|
||||||
Environment variables:
|
|
||||||
depmode Dependency tracking mode.
|
|
||||||
source Source file read by `PROGRAMS ARGS'.
|
|
||||||
object Object file output by `PROGRAMS ARGS'.
|
|
||||||
DEPDIR directory where to store dependencies.
|
|
||||||
depfile Dependency file to output.
|
|
||||||
tmpdepfile Temporary file to use when outputing dependencies.
|
|
||||||
libtool Whether libtool is used (yes/no).
|
|
||||||
|
|
||||||
Report bugs to <bug-automake@gnu.org>.
|
|
||||||
EOF
|
|
||||||
exit $?
|
|
||||||
;;
|
|
||||||
-v | --v*)
|
|
||||||
echo "depcomp $scriptversion"
|
|
||||||
exit $?
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
# `libtool' can also be set to `yes' or `no'.
|
||||||
|
|
||||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`}
|
||||||
depfile=${depfile-`echo "$object" |
|
|
||||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
|
||||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||||
|
|
||||||
rm -f "$tmpdepfile"
|
rm -f "$tmpdepfile"
|
||||||
@@ -85,34 +52,12 @@ if test "$depmode" = dashXmstdout; then
|
|||||||
depmode=dashmstdout
|
depmode=dashmstdout
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cygpath_u="cygpath -u -f -"
|
|
||||||
if test "$depmode" = msvcmsys; then
|
|
||||||
# This is just like msvisualcpp but w/o cygpath translation.
|
|
||||||
# Just convert the backslash-escaped backslashes to single forward
|
|
||||||
# slashes to satisfy depend.m4
|
|
||||||
cygpath_u="sed s,\\\\\\\\,/,g"
|
|
||||||
depmode=msvisualcpp
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$depmode" in
|
case "$depmode" in
|
||||||
gcc3)
|
gcc3)
|
||||||
## gcc 3 implements dependency tracking that does exactly what
|
## gcc 3 implements dependency tracking that does exactly what
|
||||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
|
||||||
## the command line argument order; so add the flags where they
|
|
||||||
## appear in depend2.am. Note that the slowdown incurred here
|
|
||||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
|
||||||
for arg
|
|
||||||
do
|
|
||||||
case $arg in
|
|
||||||
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
|
||||||
*) set fnord "$@" "$arg" ;;
|
|
||||||
esac
|
|
||||||
shift # fnord
|
|
||||||
shift # $arg
|
|
||||||
done
|
|
||||||
"$@"
|
|
||||||
stat=$?
|
stat=$?
|
||||||
if test $stat -eq 0; then :
|
if test $stat -eq 0; then :
|
||||||
else
|
else
|
||||||
@@ -199,14 +144,14 @@ sgi)
|
|||||||
' < "$tmpdepfile" \
|
' < "$tmpdepfile" \
|
||||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
||||||
tr '
|
tr '
|
||||||
' ' ' >> "$depfile"
|
' ' ' >> $depfile
|
||||||
echo >> "$depfile"
|
echo >> $depfile
|
||||||
|
|
||||||
# The second pass generates a dummy entry for each header file.
|
# The second pass generates a dummy entry for each header file.
|
||||||
tr ' ' '
|
tr ' ' '
|
||||||
' < "$tmpdepfile" \
|
' < "$tmpdepfile" \
|
||||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||||
>> "$depfile"
|
>> $depfile
|
||||||
else
|
else
|
||||||
# The sourcefile does not contain any dependencies, so just
|
# The sourcefile does not contain any dependencies, so just
|
||||||
# store a dummy comment line, to avoid errors with the Makefile
|
# store a dummy comment line, to avoid errors with the Makefile
|
||||||
@@ -218,43 +163,31 @@ sgi)
|
|||||||
|
|
||||||
aix)
|
aix)
|
||||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||||
# in a .u file. In older versions, this file always lives in the
|
# in a .u file. This file always lives in the current directory.
|
||||||
# current directory. Also, the AIX compiler puts `$object:' at the
|
# Also, the AIX compiler puts `$object:' at the start of each line;
|
||||||
# start of each line; $object doesn't have directory information.
|
# $object doesn't have directory information.
|
||||||
# Version 6 uses the directory in both cases.
|
stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
|
||||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
tmpdepfile="$stripped.u"
|
||||||
test "x$dir" = "x$object" && dir=
|
outname="$stripped.o"
|
||||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
|
||||||
if test "$libtool" = yes; then
|
if test "$libtool" = yes; then
|
||||||
tmpdepfile1=$dir$base.u
|
|
||||||
tmpdepfile2=$base.u
|
|
||||||
tmpdepfile3=$dir.libs/$base.u
|
|
||||||
"$@" -Wc,-M
|
"$@" -Wc,-M
|
||||||
else
|
else
|
||||||
tmpdepfile1=$dir$base.u
|
|
||||||
tmpdepfile2=$dir$base.u
|
|
||||||
tmpdepfile3=$dir$base.u
|
|
||||||
"$@" -M
|
"$@" -M
|
||||||
fi
|
fi
|
||||||
stat=$?
|
|
||||||
|
|
||||||
|
stat=$?
|
||||||
if test $stat -eq 0; then :
|
if test $stat -eq 0; then :
|
||||||
else
|
else
|
||||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
rm -f "$tmpdepfile"
|
||||||
exit $stat
|
exit $stat
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
|
||||||
do
|
|
||||||
test -f "$tmpdepfile" && break
|
|
||||||
done
|
|
||||||
if test -f "$tmpdepfile"; then
|
if test -f "$tmpdepfile"; then
|
||||||
# Each line is of the form `foo.o: dependent.h'.
|
# Each line is of the form `foo.o: dependent.h'.
|
||||||
# Do two passes, one to just change these to
|
# Do two passes, one to just change these to
|
||||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
|
||||||
# That's a tab and a space in the [].
|
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
|
||||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
|
||||||
else
|
else
|
||||||
# The sourcefile does not contain any dependencies, so just
|
# The sourcefile does not contain any dependencies, so just
|
||||||
# store a dummy comment line, to avoid errors with the Makefile
|
# store a dummy comment line, to avoid errors with the Makefile
|
||||||
@@ -264,141 +197,37 @@ aix)
|
|||||||
rm -f "$tmpdepfile"
|
rm -f "$tmpdepfile"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
icc)
|
|
||||||
# Intel's C compiler understands `-MD -MF file'. However on
|
|
||||||
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
|
|
||||||
# ICC 7.0 will fill foo.d with something like
|
|
||||||
# foo.o: sub/foo.c
|
|
||||||
# foo.o: sub/foo.h
|
|
||||||
# which is wrong. We want:
|
|
||||||
# sub/foo.o: sub/foo.c
|
|
||||||
# sub/foo.o: sub/foo.h
|
|
||||||
# sub/foo.c:
|
|
||||||
# sub/foo.h:
|
|
||||||
# ICC 7.1 will output
|
|
||||||
# foo.o: sub/foo.c sub/foo.h
|
|
||||||
# and will wrap long lines using \ :
|
|
||||||
# foo.o: sub/foo.c ... \
|
|
||||||
# sub/foo.h ... \
|
|
||||||
# ...
|
|
||||||
|
|
||||||
"$@" -MD -MF "$tmpdepfile"
|
|
||||||
stat=$?
|
|
||||||
if test $stat -eq 0; then :
|
|
||||||
else
|
|
||||||
rm -f "$tmpdepfile"
|
|
||||||
exit $stat
|
|
||||||
fi
|
|
||||||
rm -f "$depfile"
|
|
||||||
# Each line is of the form `foo.o: dependent.h',
|
|
||||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
|
||||||
# Do two passes, one to just change these to
|
|
||||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
|
||||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
|
||||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
|
||||||
# correctly. Breaking it into two sed invocations is a workaround.
|
|
||||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
|
|
||||||
sed -e 's/$/ :/' >> "$depfile"
|
|
||||||
rm -f "$tmpdepfile"
|
|
||||||
;;
|
|
||||||
|
|
||||||
hp2)
|
|
||||||
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
|
||||||
# compilers, which have integrated preprocessors. The correct option
|
|
||||||
# to use with these is +Maked; it writes dependencies to a file named
|
|
||||||
# 'foo.d', which lands next to the object file, wherever that
|
|
||||||
# happens to be.
|
|
||||||
# Much of this is similar to the tru64 case; see comments there.
|
|
||||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
|
||||||
test "x$dir" = "x$object" && dir=
|
|
||||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
|
||||||
if test "$libtool" = yes; then
|
|
||||||
tmpdepfile1=$dir$base.d
|
|
||||||
tmpdepfile2=$dir.libs/$base.d
|
|
||||||
"$@" -Wc,+Maked
|
|
||||||
else
|
|
||||||
tmpdepfile1=$dir$base.d
|
|
||||||
tmpdepfile2=$dir$base.d
|
|
||||||
"$@" +Maked
|
|
||||||
fi
|
|
||||||
stat=$?
|
|
||||||
if test $stat -eq 0; then :
|
|
||||||
else
|
|
||||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
|
||||||
exit $stat
|
|
||||||
fi
|
|
||||||
|
|
||||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
|
||||||
do
|
|
||||||
test -f "$tmpdepfile" && break
|
|
||||||
done
|
|
||||||
if test -f "$tmpdepfile"; then
|
|
||||||
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
|
|
||||||
# Add `dependent.h:' lines.
|
|
||||||
sed -ne '2,${
|
|
||||||
s/^ *//
|
|
||||||
s/ \\*$//
|
|
||||||
s/$/:/
|
|
||||||
p
|
|
||||||
}' "$tmpdepfile" >> "$depfile"
|
|
||||||
else
|
|
||||||
echo "#dummy" > "$depfile"
|
|
||||||
fi
|
|
||||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
|
||||||
;;
|
|
||||||
|
|
||||||
tru64)
|
tru64)
|
||||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
# The Tru64 AIX compiler uses -MD to generate dependencies as a side
|
||||||
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
|
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
|
||||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||||
# dependencies in `foo.d' instead, so we check for that too.
|
# dependencies in `foo.d' instead, so we check for that too.
|
||||||
# Subdirectories are respected.
|
# Subdirectories are respected.
|
||||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
|
||||||
test "x$dir" = "x$object" && dir=
|
|
||||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
|
||||||
|
|
||||||
|
tmpdepfile1="$object.d"
|
||||||
|
tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'`
|
||||||
if test "$libtool" = yes; then
|
if test "$libtool" = yes; then
|
||||||
# With Tru64 cc, shared objects can also be used to make a
|
|
||||||
# static library. This mechanism is used in libtool 1.4 series to
|
|
||||||
# handle both shared and static libraries in a single compilation.
|
|
||||||
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
|
|
||||||
#
|
|
||||||
# With libtool 1.5 this exception was removed, and libtool now
|
|
||||||
# generates 2 separate objects for the 2 libraries. These two
|
|
||||||
# compilations output dependencies in $dir.libs/$base.o.d and
|
|
||||||
# in $dir$base.o.d. We have to check for both files, because
|
|
||||||
# one of the two compilations can be disabled. We should prefer
|
|
||||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
|
||||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
|
||||||
# the former would cause a distcleancheck panic.
|
|
||||||
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
|
|
||||||
tmpdepfile2=$dir$base.o.d # libtool 1.5
|
|
||||||
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
|
|
||||||
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
|
|
||||||
"$@" -Wc,-MD
|
"$@" -Wc,-MD
|
||||||
else
|
else
|
||||||
tmpdepfile1=$dir$base.o.d
|
|
||||||
tmpdepfile2=$dir$base.d
|
|
||||||
tmpdepfile3=$dir$base.d
|
|
||||||
tmpdepfile4=$dir$base.d
|
|
||||||
"$@" -MD
|
"$@" -MD
|
||||||
fi
|
fi
|
||||||
|
|
||||||
stat=$?
|
stat=$?
|
||||||
if test $stat -eq 0; then :
|
if test $stat -eq 0; then :
|
||||||
else
|
else
|
||||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||||
exit $stat
|
exit $stat
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
if test -f "$tmpdepfile1"; then
|
||||||
do
|
tmpdepfile="$tmpdepfile1"
|
||||||
test -f "$tmpdepfile" && break
|
else
|
||||||
done
|
tmpdepfile="$tmpdepfile2"
|
||||||
|
fi
|
||||||
if test -f "$tmpdepfile"; then
|
if test -f "$tmpdepfile"; then
|
||||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||||
# That's a tab and a space in the [].
|
# That's a space and a tab in the [].
|
||||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||||
else
|
else
|
||||||
echo "#dummy" > "$depfile"
|
echo "#dummy" > "$depfile"
|
||||||
fi
|
fi
|
||||||
@@ -411,42 +240,34 @@ tru64)
|
|||||||
|
|
||||||
dashmstdout)
|
dashmstdout)
|
||||||
# Important note: in order to support this mode, a compiler *must*
|
# Important note: in order to support this mode, a compiler *must*
|
||||||
# always write the preprocessed file to stdout, regardless of -o.
|
# always write the proprocessed file to stdout, regardless of -o,
|
||||||
"$@" || exit $?
|
# because we must use -o when running libtool.
|
||||||
|
test -z "$dashmflag" && dashmflag=-M
|
||||||
# Remove the call to Libtool.
|
( IFS=" "
|
||||||
if test "$libtool" = yes; then
|
case " $* " in
|
||||||
while test "X$1" != 'X--mode=compile'; do
|
*" --mode=compile "*) # this is libtool, let us make it quiet
|
||||||
shift
|
for arg
|
||||||
done
|
do # cycle over the arguments
|
||||||
shift
|
case "$arg" in
|
||||||
fi
|
"--mode=compile")
|
||||||
|
# insert --quiet before "--mode=compile"
|
||||||
# Remove `-o $object'.
|
set fnord "$@" --quiet
|
||||||
IFS=" "
|
shift # fnord
|
||||||
for arg
|
;;
|
||||||
do
|
esac
|
||||||
case $arg in
|
set fnord "$@" "$arg"
|
||||||
-o)
|
shift # fnord
|
||||||
shift
|
shift # "$arg"
|
||||||
;;
|
done
|
||||||
$object)
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
set fnord "$@" "$arg"
|
|
||||||
shift # fnord
|
|
||||||
shift # $arg
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
"$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||||
|
) &
|
||||||
test -z "$dashmflag" && dashmflag=-M
|
proc=$!
|
||||||
# Require at least two characters before searching for `:'
|
"$@"
|
||||||
# in the target name. This is to cope with DOS-style filenames:
|
stat=$?
|
||||||
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
|
wait "$proc"
|
||||||
"$@" $dashmflag |
|
if test "$stat" != 0; then exit $stat; fi
|
||||||
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
|
||||||
rm -f "$depfile"
|
rm -f "$depfile"
|
||||||
cat < "$tmpdepfile" > "$depfile"
|
cat < "$tmpdepfile" > "$depfile"
|
||||||
tr ' ' '
|
tr ' ' '
|
||||||
@@ -464,47 +285,36 @@ dashXmstdout)
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
makedepend)
|
makedepend)
|
||||||
"$@" || exit $?
|
|
||||||
# Remove any Libtool call
|
|
||||||
if test "$libtool" = yes; then
|
|
||||||
while test "X$1" != 'X--mode=compile'; do
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
shift
|
|
||||||
fi
|
|
||||||
# X makedepend
|
# X makedepend
|
||||||
shift
|
(
|
||||||
cleared=no eat=no
|
shift
|
||||||
for arg
|
cleared=no
|
||||||
do
|
for arg in "$@"; do
|
||||||
case $cleared in
|
case $cleared in no)
|
||||||
no)
|
set ""; shift
|
||||||
set ""; shift
|
cleared=yes
|
||||||
cleared=yes ;;
|
esac
|
||||||
esac
|
case "$arg" in
|
||||||
if test $eat = yes; then
|
-D*|-I*)
|
||||||
eat=no
|
set fnord "$@" "$arg"; shift;;
|
||||||
continue
|
-*)
|
||||||
fi
|
;;
|
||||||
case "$arg" in
|
*)
|
||||||
-D*|-I*)
|
set fnord "$@" "$arg"; shift;;
|
||||||
set fnord "$@" "$arg"; shift ;;
|
esac
|
||||||
# Strip any option that makedepend may not understand. Remove
|
done
|
||||||
# the object too, otherwise makedepend will parse it as a source file.
|
obj_suffix="`echo $object | sed 's/^.*\././'`"
|
||||||
-arch)
|
touch "$tmpdepfile"
|
||||||
eat=yes ;;
|
${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||||
-*|$object)
|
) &
|
||||||
;;
|
proc=$!
|
||||||
*)
|
"$@"
|
||||||
set fnord "$@" "$arg"; shift ;;
|
stat=$?
|
||||||
esac
|
wait "$proc"
|
||||||
done
|
if test "$stat" != 0; then exit $stat; fi
|
||||||
obj_suffix=`echo "$object" | sed 's/^.*\././'`
|
|
||||||
touch "$tmpdepfile"
|
|
||||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
|
||||||
rm -f "$depfile"
|
rm -f "$depfile"
|
||||||
cat < "$tmpdepfile" > "$depfile"
|
cat < "$tmpdepfile" > "$depfile"
|
||||||
sed '1,2d' "$tmpdepfile" | tr ' ' '
|
tail +3 "$tmpdepfile" | tr ' ' '
|
||||||
' | \
|
' | \
|
||||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||||
## correctly. Breaking it into two sed invocations is a workaround.
|
## correctly. Breaking it into two sed invocations is a workaround.
|
||||||
@@ -514,40 +324,35 @@ makedepend)
|
|||||||
|
|
||||||
cpp)
|
cpp)
|
||||||
# Important note: in order to support this mode, a compiler *must*
|
# Important note: in order to support this mode, a compiler *must*
|
||||||
# always write the preprocessed file to stdout.
|
# always write the proprocessed file to stdout, regardless of -o,
|
||||||
"$@" || exit $?
|
# because we must use -o when running libtool.
|
||||||
|
( IFS=" "
|
||||||
# Remove the call to Libtool.
|
case " $* " in
|
||||||
if test "$libtool" = yes; then
|
*" --mode=compile "*)
|
||||||
while test "X$1" != 'X--mode=compile'; do
|
for arg
|
||||||
shift
|
do # cycle over the arguments
|
||||||
done
|
case $arg in
|
||||||
shift
|
"--mode=compile")
|
||||||
fi
|
# insert --quiet before "--mode=compile"
|
||||||
|
set fnord "$@" --quiet
|
||||||
# Remove `-o $object'.
|
shift # fnord
|
||||||
IFS=" "
|
;;
|
||||||
for arg
|
esac
|
||||||
do
|
set fnord "$@" "$arg"
|
||||||
case $arg in
|
shift # fnord
|
||||||
-o)
|
shift # "$arg"
|
||||||
shift
|
done
|
||||||
;;
|
|
||||||
$object)
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
set fnord "$@" "$arg"
|
|
||||||
shift # fnord
|
|
||||||
shift # $arg
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
"$@" -E |
|
||||||
|
sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
||||||
"$@" -E |
|
|
||||||
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
|
||||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
|
||||||
sed '$ s: \\$::' > "$tmpdepfile"
|
sed '$ s: \\$::' > "$tmpdepfile"
|
||||||
|
) &
|
||||||
|
proc=$!
|
||||||
|
"$@"
|
||||||
|
stat=$?
|
||||||
|
wait "$proc"
|
||||||
|
if test "$stat" != 0; then exit $stat; fi
|
||||||
rm -f "$depfile"
|
rm -f "$depfile"
|
||||||
echo "$object : \\" > "$depfile"
|
echo "$object : \\" > "$depfile"
|
||||||
cat < "$tmpdepfile" >> "$depfile"
|
cat < "$tmpdepfile" >> "$depfile"
|
||||||
@@ -557,56 +362,42 @@ cpp)
|
|||||||
|
|
||||||
msvisualcpp)
|
msvisualcpp)
|
||||||
# Important note: in order to support this mode, a compiler *must*
|
# Important note: in order to support this mode, a compiler *must*
|
||||||
# always write the preprocessed file to stdout.
|
# always write the proprocessed file to stdout, regardless of -o,
|
||||||
"$@" || exit $?
|
# because we must use -o when running libtool.
|
||||||
|
( IFS=" "
|
||||||
# Remove the call to Libtool.
|
case " $* " in
|
||||||
if test "$libtool" = yes; then
|
*" --mode=compile "*)
|
||||||
while test "X$1" != 'X--mode=compile'; do
|
for arg
|
||||||
shift
|
do # cycle over the arguments
|
||||||
done
|
case $arg in
|
||||||
shift
|
"--mode=compile")
|
||||||
fi
|
# insert --quiet before "--mode=compile"
|
||||||
|
set fnord "$@" --quiet
|
||||||
IFS=" "
|
shift # fnord
|
||||||
for arg
|
;;
|
||||||
do
|
esac
|
||||||
case "$arg" in
|
|
||||||
-o)
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
$object)
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
|
||||||
set fnord "$@"
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
set fnord "$@" "$arg"
|
set fnord "$@" "$arg"
|
||||||
shift
|
shift # fnord
|
||||||
shift
|
shift # "$arg"
|
||||||
;;
|
done
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
"$@" -E |
|
||||||
"$@" -E 2>/dev/null |
|
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
|
||||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
) &
|
||||||
|
proc=$!
|
||||||
|
"$@"
|
||||||
|
stat=$?
|
||||||
|
wait "$proc"
|
||||||
|
if test "$stat" != 0; then exit $stat; fi
|
||||||
rm -f "$depfile"
|
rm -f "$depfile"
|
||||||
echo "$object : \\" > "$depfile"
|
echo "$object : \\" > "$depfile"
|
||||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
||||||
echo " " >> "$depfile"
|
echo " " >> "$depfile"
|
||||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||||
rm -f "$tmpdepfile"
|
rm -f "$tmpdepfile"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
msvcmsys)
|
|
||||||
# This case exists only to let depend.m4 do its work. It works by
|
|
||||||
# looking at the text of this script. This case will never be run,
|
|
||||||
# since it is checked for above.
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
|
|
||||||
none)
|
none)
|
||||||
exec "$@"
|
exec "$@"
|
||||||
;;
|
;;
|
||||||
@@ -618,13 +409,3 @@ none)
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
# Local Variables:
|
|
||||||
# mode: shell-script
|
|
||||||
# sh-indentation: 2
|
|
||||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
|
||||||
# time-stamp-start: "scriptversion="
|
|
||||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
|
||||||
# time-stamp-time-zone: "UTC"
|
|
||||||
# time-stamp-end: "; # UTC"
|
|
||||||
# End:
|
|
||||||
|
|||||||
377
example.c
@@ -2,15 +2,15 @@
|
|||||||
#if 0 /* in case someone actually tries to compile this */
|
#if 0 /* in case someone actually tries to compile this */
|
||||||
|
|
||||||
/* example.c - an example of using libpng
|
/* example.c - an example of using libpng
|
||||||
* Last changed in libpng 1.5.2 [March 31, 2011]
|
* Last changed in libpng 1.2.1 December 7, 2001.
|
||||||
* This file has been placed in the public domain by the authors.
|
* This file has been placed in the public domain by the authors.
|
||||||
* Maintained 1998-2011 Glenn Randers-Pehrson
|
* Maintained 1998-2007 Glenn Randers-Pehrson
|
||||||
* Maintained 1996, 1997 Andreas Dilger)
|
* Maintained 1996, 1997 Andreas Dilger)
|
||||||
* Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* This is an example of how to use libpng to read and write PNG files.
|
/* This is an example of how to use libpng to read and write PNG files.
|
||||||
* The file libpng-manual.txt is much more verbose then this. If you have not
|
* The file libpng.txt is much more verbose then this. If you have not
|
||||||
* read it, do so first. This was designed to be a starting point of an
|
* read it, do so first. This was designed to be a starting point of an
|
||||||
* implementation. This is not officially part of libpng, is hereby placed
|
* implementation. This is not officially part of libpng, is hereby placed
|
||||||
* in the public domain, and therefore does not require a copyright notice.
|
* in the public domain, and therefore does not require a copyright notice.
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef png_jmpbuf
|
#ifndef png_jmpbuf
|
||||||
# define png_jmpbuf(png_ptr) ((png_ptr)->png_jmpbuf)
|
# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Check to see if a file is a PNG file using png_sig_cmp(). png_sig_cmp()
|
/* Check to see if a file is a PNG file using png_sig_cmp(). png_sig_cmp()
|
||||||
@@ -91,15 +91,14 @@ void read_png(char *file_name) /* We need to open the file */
|
|||||||
|
|
||||||
if ((fp = fopen(file_name, "rb")) == NULL)
|
if ((fp = fopen(file_name, "rb")) == NULL)
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
|
|
||||||
#else no_open_file /* prototype 2 */
|
#else no_open_file /* prototype 2 */
|
||||||
void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
||||||
{
|
{
|
||||||
png_structp png_ptr;
|
png_structp png_ptr;
|
||||||
png_infop info_ptr;
|
png_infop info_ptr;
|
||||||
png_uint_32 width, height;
|
png_uint_32 width, height;
|
||||||
int bit_depth, color_type, interlace_type;
|
int bit_depth, color_type, interlace_type;
|
||||||
#endif no_open_file /* Only use one prototype! */
|
#endif no_open_file /* only use one prototype! */
|
||||||
|
|
||||||
/* Create and initialize the png_struct with the desired error handler
|
/* Create and initialize the png_struct with the desired error handler
|
||||||
* functions. If you want to use the default stderr and longjump method,
|
* functions. If you want to use the default stderr and longjump method,
|
||||||
@@ -121,7 +120,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
|||||||
if (info_ptr == NULL)
|
if (info_ptr == NULL)
|
||||||
{
|
{
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
png_destroy_read_struct(&png_ptr, NULL, NULL);
|
png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL);
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,7 +132,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
|||||||
if (setjmp(png_jmpbuf(png_ptr)))
|
if (setjmp(png_jmpbuf(png_ptr)))
|
||||||
{
|
{
|
||||||
/* Free all of the memory associated with the png_ptr and info_ptr */
|
/* Free all of the memory associated with the png_ptr and info_ptr */
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
/* If we get here, we had a problem reading the file */
|
/* If we get here, we had a problem reading the file */
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
@@ -160,12 +159,11 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
|||||||
* If you have enough memory to read in the entire image at once,
|
* If you have enough memory to read in the entire image at once,
|
||||||
* and you need to specify only transforms that can be controlled
|
* and you need to specify only transforms that can be controlled
|
||||||
* with one of the PNG_TRANSFORM_* bits (this presently excludes
|
* with one of the PNG_TRANSFORM_* bits (this presently excludes
|
||||||
* quantizing, filling, setting background, and doing gamma
|
* dithering, filling, setting background, and doing gamma
|
||||||
* adjustment), then you can read the entire image (including
|
* adjustment), then you can read the entire image (including
|
||||||
* pixels) into the info structure with this call:
|
* pixels) into the info structure with this call:
|
||||||
*/
|
*/
|
||||||
png_read_png(png_ptr, info_ptr, png_transforms, NULL);
|
png_read_png(png_ptr, info_ptr, png_transforms, png_voidp_NULL);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/* OK, you're doing it the hard way, with the lower-level functions */
|
/* OK, you're doing it the hard way, with the lower-level functions */
|
||||||
|
|
||||||
@@ -175,15 +173,15 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
|||||||
png_read_info(png_ptr, info_ptr);
|
png_read_info(png_ptr, info_ptr);
|
||||||
|
|
||||||
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
|
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
|
||||||
&interlace_type, NULL, NULL);
|
&interlace_type, int_p_NULL, int_p_NULL);
|
||||||
|
|
||||||
/* Set up the data transformations you want. Note that these are all
|
/* Set up the data transformations you want. Note that these are all
|
||||||
* optional. Only call them if you want/need them. Many of the
|
* optional. Only call them if you want/need them. Many of the
|
||||||
* transformations only work on specific types of images, and many
|
* transformations only work on specific types of images, and many
|
||||||
* are mutually exclusive.
|
* are mutually exclusive.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Tell libpng to strip 16 bit/color files down to 8 bits/color */
|
/* tell libpng to strip 16 bit/color files down to 8 bits/color */
|
||||||
png_set_strip_16(png_ptr);
|
png_set_strip_16(png_ptr);
|
||||||
|
|
||||||
/* Strip alpha bytes from the input data without combining with the
|
/* Strip alpha bytes from the input data without combining with the
|
||||||
@@ -206,7 +204,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
|||||||
|
|
||||||
/* Expand grayscale images to the full 8 bits from 1, 2, or 4 bits/pixel */
|
/* Expand grayscale images to the full 8 bits from 1, 2, or 4 bits/pixel */
|
||||||
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
|
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
|
||||||
png_set_expand_gray_1_2_4_to_8(png_ptr);
|
png_set_gray_1_2_4_to_8(png_ptr);
|
||||||
|
|
||||||
/* Expand paletted or RGB images with transparency to full alpha channels
|
/* Expand paletted or RGB images with transparency to full alpha channels
|
||||||
* so the data will be available as RGBA quartets.
|
* so the data will be available as RGBA quartets.
|
||||||
@@ -230,11 +228,10 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
|||||||
png_set_background(png_ptr, &my_background,
|
png_set_background(png_ptr, &my_background,
|
||||||
PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
|
PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
|
||||||
|
|
||||||
/* Some suggestions as to how to get a screen gamma value
|
/* Some suggestions as to how to get a screen gamma value */
|
||||||
*
|
|
||||||
* Note that screen gamma is the display_exponent, which includes
|
/* Note that screen gamma is the display_exponent, which includes
|
||||||
* the CRT_exponent and any correction for viewing conditions
|
* the CRT_exponent and any correction for viewing conditions */
|
||||||
*/
|
|
||||||
if (/* We have a user-defined screen gamma value */)
|
if (/* We have a user-defined screen gamma value */)
|
||||||
{
|
{
|
||||||
screen_gamma = user-defined screen_gamma;
|
screen_gamma = user-defined screen_gamma;
|
||||||
@@ -247,7 +244,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
|||||||
/* If we don't have another value */
|
/* If we don't have another value */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
screen_gamma = 2.2; /* A good guess for a PC monitor in a dimly
|
screen_gamma = 2.2; /* A good guess for a PC monitors in a dimly
|
||||||
lit room */
|
lit room */
|
||||||
screen_gamma = 1.7 or 1.0; /* A good guess for Mac systems */
|
screen_gamma = 1.7 or 1.0; /* A good guess for Mac systems */
|
||||||
}
|
}
|
||||||
@@ -271,8 +268,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
|||||||
png_set_gamma(png_ptr, screen_gamma, 0.45455);
|
png_set_gamma(png_ptr, screen_gamma, 0.45455);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
/* Dither 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.
|
* to the number of colors available on your screen.
|
||||||
*/
|
*/
|
||||||
if (color_type & PNG_COLOR_MASK_COLOR)
|
if (color_type & PNG_COLOR_MASK_COLOR)
|
||||||
@@ -281,13 +277,13 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
|||||||
png_colorp palette;
|
png_colorp palette;
|
||||||
|
|
||||||
/* This reduces the image to the application supplied palette */
|
/* This reduces the image to the application supplied palette */
|
||||||
if (/* We have our own palette */)
|
if (/* we have our own palette */)
|
||||||
{
|
{
|
||||||
/* An array of colors to which the image should be quantized */
|
/* An array of colors to which the image should be dithered */
|
||||||
png_color std_color_cube[MAX_SCREEN_COLORS];
|
png_color std_color_cube[MAX_SCREEN_COLORS];
|
||||||
|
|
||||||
png_set_quantize(png_ptr, std_color_cube, MAX_SCREEN_COLORS,
|
png_set_dither(png_ptr, std_color_cube, MAX_SCREEN_COLORS,
|
||||||
MAX_SCREEN_COLORS, NULL, 0);
|
MAX_SCREEN_COLORS, png_uint_16p_NULL, 0);
|
||||||
}
|
}
|
||||||
/* This reduces the image to the palette supplied in the file */
|
/* This reduces the image to the palette supplied in the file */
|
||||||
else if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette))
|
else if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette))
|
||||||
@@ -296,13 +292,12 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
|||||||
|
|
||||||
png_get_hIST(png_ptr, info_ptr, &histogram);
|
png_get_hIST(png_ptr, info_ptr, &histogram);
|
||||||
|
|
||||||
png_set_quantize(png_ptr, palette, num_palette,
|
png_set_dither(png_ptr, palette, num_palette,
|
||||||
max_screen_colors, histogram, 0);
|
max_screen_colors, histogram, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_READ_QUANTIZE_SUPPORTED */
|
|
||||||
|
|
||||||
/* Invert monochrome files to have 0 as white and 1 as black */
|
/* invert monochrome files to have 0 as white and 1 as black */
|
||||||
png_set_invert_mono(png_ptr);
|
png_set_invert_mono(png_ptr);
|
||||||
|
|
||||||
/* If you want to shift the pixel values from the range [0,255] or
|
/* If you want to shift the pixel values from the range [0,255] or
|
||||||
@@ -311,20 +306,20 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
|||||||
*/
|
*/
|
||||||
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT))
|
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT))
|
||||||
{
|
{
|
||||||
png_color_8p sig_bit_p;
|
png_color_8p sig_bit;
|
||||||
|
|
||||||
png_get_sBIT(png_ptr, info_ptr, &sig_bit_p);
|
png_get_sBIT(png_ptr, info_ptr, &sig_bit);
|
||||||
png_set_shift(png_ptr, sig_bit_p);
|
png_set_shift(png_ptr, sig_bit);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Flip the RGB pixels to BGR (or RGBA to BGRA) */
|
/* flip the RGB pixels to BGR (or RGBA to BGRA) */
|
||||||
if (color_type & PNG_COLOR_MASK_COLOR)
|
if (color_type & PNG_COLOR_MASK_COLOR)
|
||||||
png_set_bgr(png_ptr);
|
png_set_bgr(png_ptr);
|
||||||
|
|
||||||
/* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */
|
/* swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */
|
||||||
png_set_swap_alpha(png_ptr);
|
png_set_swap_alpha(png_ptr);
|
||||||
|
|
||||||
/* Swap bytes of 16 bit files to least significant byte first */
|
/* swap bytes of 16 bit files to least significant byte first */
|
||||||
png_set_swap(png_ptr);
|
png_set_swap(png_ptr);
|
||||||
|
|
||||||
/* Add filler (or alpha) byte (before/after each RGB triplet) */
|
/* Add filler (or alpha) byte (before/after each RGB triplet) */
|
||||||
@@ -347,13 +342,11 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
|||||||
/* The easiest way to read the image: */
|
/* The easiest way to read the image: */
|
||||||
png_bytep row_pointers[height];
|
png_bytep row_pointers[height];
|
||||||
|
|
||||||
/* Clear the pointer array */
|
|
||||||
for (row = 0; row < height; row++)
|
|
||||||
row_pointers[row] = NULL;
|
|
||||||
|
|
||||||
for (row = 0; row < height; row++)
|
for (row = 0; row < height; row++)
|
||||||
|
{
|
||||||
row_pointers[row] = png_malloc(png_ptr, png_get_rowbytes(png_ptr,
|
row_pointers[row] = png_malloc(png_ptr, png_get_rowbytes(png_ptr,
|
||||||
info_ptr));
|
info_ptr));
|
||||||
|
}
|
||||||
|
|
||||||
/* Now it's time to read the image. One of these methods is REQUIRED */
|
/* Now it's time to read the image. One of these methods is REQUIRED */
|
||||||
#ifdef entire /* Read the entire image in one go */
|
#ifdef entire /* Read the entire image in one go */
|
||||||
@@ -367,43 +360,44 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
|||||||
#ifdef single /* Read the image a single row at a time */
|
#ifdef single /* Read the image a single row at a time */
|
||||||
for (y = 0; y < height; y++)
|
for (y = 0; y < height; y++)
|
||||||
{
|
{
|
||||||
png_read_rows(png_ptr, &row_pointers[y], NULL, 1);
|
png_read_rows(png_ptr, &row_pointers[y], png_bytepp_NULL, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else no_single /* Read the image several rows at a time */
|
#else no_single /* Read the image several rows at a time */
|
||||||
for (y = 0; y < height; y += number_of_rows)
|
for (y = 0; y < height; y += number_of_rows)
|
||||||
{
|
{
|
||||||
#ifdef sparkle /* Read the image using the "sparkle" effect. */
|
#ifdef sparkle /* Read the image using the "sparkle" effect. */
|
||||||
png_read_rows(png_ptr, &row_pointers[y], NULL,
|
png_read_rows(png_ptr, &row_pointers[y], png_bytepp_NULL,
|
||||||
number_of_rows);
|
number_of_rows);
|
||||||
#else no_sparkle /* Read the image using the "rectangle" effect */
|
#else no_sparkle /* Read the image using the "rectangle" effect */
|
||||||
png_read_rows(png_ptr, NULL, &row_pointers[y],
|
png_read_rows(png_ptr, png_bytepp_NULL, &row_pointers[y],
|
||||||
number_of_rows);
|
number_of_rows);
|
||||||
#endif no_sparkle /* Use only one of these two methods */
|
#endif no_sparkle /* use only one of these two methods */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If you want to display the image after every pass, do so here */
|
/* if you want to display the image after every pass, do
|
||||||
#endif no_single /* Use only one of these two methods */
|
so here */
|
||||||
|
#endif no_single /* use only one of these two methods */
|
||||||
}
|
}
|
||||||
#endif no_entire /* Use only one of these two methods */
|
#endif no_entire /* use only one of these two methods */
|
||||||
|
|
||||||
/* Read rest of file, and get additional chunks in info_ptr - REQUIRED */
|
/* read rest of file, and get additional chunks in info_ptr - REQUIRED */
|
||||||
png_read_end(png_ptr, info_ptr);
|
png_read_end(png_ptr, info_ptr);
|
||||||
#endif hilevel
|
#endif hilevel
|
||||||
|
|
||||||
/* At this point you have read the entire image */
|
/* At this point you have read the entire image */
|
||||||
|
|
||||||
/* Clean up after the read, and free any memory allocated - REQUIRED */
|
/* clean up after the read, and free any memory allocated - REQUIRED */
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL);
|
||||||
|
|
||||||
/* Close the file */
|
/* close the file */
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
/* That's it */
|
/* that's it */
|
||||||
return (OK);
|
return (OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Progressively read a file */
|
/* progressively read a file */
|
||||||
|
|
||||||
int
|
int
|
||||||
initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr)
|
initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr)
|
||||||
@@ -427,13 +421,13 @@ initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr)
|
|||||||
|
|
||||||
if (*info_ptr == NULL)
|
if (*info_ptr == NULL)
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(png_ptr, info_ptr, NULL);
|
png_destroy_read_struct(png_ptr, info_ptr, png_infopp_NULL);
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setjmp(png_jmpbuf((*png_ptr))))
|
if (setjmp(png_jmpbuf((*png_ptr))))
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(png_ptr, info_ptr, NULL);
|
png_destroy_read_struct(png_ptr, info_ptr, png_infopp_NULL);
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -462,13 +456,13 @@ process_data(png_structp *png_ptr, png_infop *info_ptr,
|
|||||||
if (setjmp(png_jmpbuf((*png_ptr))))
|
if (setjmp(png_jmpbuf((*png_ptr))))
|
||||||
{
|
{
|
||||||
/* Free the png_ptr and info_ptr memory on error */
|
/* Free the png_ptr and info_ptr memory on error */
|
||||||
png_destroy_read_struct(png_ptr, info_ptr, NULL);
|
png_destroy_read_struct(png_ptr, info_ptr, png_infopp_NULL);
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This one's new also. Simply give it chunks of data as
|
/* This one's new also. Simply give it chunks of data as
|
||||||
* they arrive from the data stream (in order, of course).
|
* they arrive from the data stream (in order, of course).
|
||||||
* On segmented machines, don't give it any more than 64K.
|
* On Segmented machines, don't give it any more than 64K.
|
||||||
* The library seems to run fine with sizes of 4K, although
|
* The library seems to run fine with sizes of 4K, although
|
||||||
* you can give it much less if necessary (I assume you can
|
* you can give it much less if necessary (I assume you can
|
||||||
* give it chunks of 1 byte, but I haven't tried with less
|
* give it chunks of 1 byte, but I haven't tried with less
|
||||||
@@ -482,84 +476,86 @@ process_data(png_structp *png_ptr, png_infop *info_ptr,
|
|||||||
|
|
||||||
info_callback(png_structp png_ptr, png_infop info)
|
info_callback(png_structp png_ptr, png_infop info)
|
||||||
{
|
{
|
||||||
/* Do any setup here, including setting any of the transformations
|
/* do any setup here, including setting any of the transformations
|
||||||
* mentioned in the Reading PNG files section. For now, you _must_
|
* mentioned in the Reading PNG files section. For now, you _must_
|
||||||
* call either png_start_read_image() or png_read_update_info()
|
* call either png_start_read_image() or png_read_update_info()
|
||||||
* after all the transformations are set (even if you don't set
|
* after all the transformations are set (even if you don't set
|
||||||
* any). You may start getting rows before png_process_data()
|
* any). You may start getting rows before png_process_data()
|
||||||
* returns, so this is your last chance to prepare for that.
|
* returns, so this is your last chance to prepare for that.
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
row_callback(png_structp png_ptr, png_bytep new_row,
|
row_callback(png_structp png_ptr, png_bytep new_row,
|
||||||
png_uint_32 row_num, int pass)
|
png_uint_32 row_num, int pass)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* This function is called for every row in the image. If the
|
* This function is called for every row in the image. If the
|
||||||
* image is interlaced, and you turned on the interlace handler,
|
* image is interlaced, and you turned on the interlace handler,
|
||||||
* this function will be called for every row in every pass.
|
* this function will be called for every row in every pass.
|
||||||
*
|
*
|
||||||
* In this function you will receive a pointer to new row data from
|
* In this function you will receive a pointer to new row data from
|
||||||
* libpng called new_row that is to replace a corresponding row (of
|
* libpng called new_row that is to replace a corresponding row (of
|
||||||
* the same data format) in a buffer allocated by your application.
|
* the same data format) in a buffer allocated by your application.
|
||||||
*
|
*
|
||||||
* The new row data pointer "new_row" may be NULL, indicating there is
|
* The new row data pointer new_row may be NULL, indicating there is
|
||||||
* no new data to be replaced (in cases of interlace loading).
|
* no new data to be replaced (in cases of interlace loading).
|
||||||
*
|
*
|
||||||
* If new_row is not NULL then you need to call
|
* If new_row is not NULL then you need to call
|
||||||
* png_progressive_combine_row() to replace the corresponding row as
|
* png_progressive_combine_row() to replace the corresponding row as
|
||||||
* shown below:
|
* shown below:
|
||||||
*/
|
*/
|
||||||
|
/* Check if row_num is in bounds. */
|
||||||
|
if((row_num >= 0) && (row_num < height))
|
||||||
|
{
|
||||||
|
/* Get pointer to corresponding row in our
|
||||||
|
* PNG read buffer.
|
||||||
|
*/
|
||||||
|
png_bytep old_row = ((png_bytep *)our_data)[row_num];
|
||||||
|
|
||||||
/* Get pointer to corresponding row in our
|
/* If both rows are allocated then copy the new row
|
||||||
* PNG read buffer.
|
* data to the corresponding row data.
|
||||||
*/
|
*/
|
||||||
png_bytep old_row = ((png_bytep *)our_data)[row_num];
|
if((old_row != NULL) && (new_row != NULL))
|
||||||
|
png_progressive_combine_row(png_ptr, old_row, new_row);
|
||||||
/* If both rows are allocated then copy the new row
|
}
|
||||||
* data to the corresponding row data.
|
/*
|
||||||
*/
|
* The rows and passes are called in order, so you don't really
|
||||||
if ((old_row != NULL) && (new_row != NULL))
|
* need the row_num and pass, but I'm supplying them because it
|
||||||
png_progressive_combine_row(png_ptr, old_row, new_row);
|
* may make your life easier.
|
||||||
|
*
|
||||||
/*
|
* For the non-NULL rows of interlaced images, you must call
|
||||||
* The rows and passes are called in order, so you don't really
|
* png_progressive_combine_row() passing in the new row and the
|
||||||
* need the row_num and pass, but I'm supplying them because it
|
* old row, as demonstrated above. You can call this function for
|
||||||
* may make your life easier.
|
* NULL rows (it will just return) and for non-interlaced images
|
||||||
*
|
* (it just does the png_memcpy for you) if it will make the code
|
||||||
* For the non-NULL rows of interlaced images, you must call
|
* easier. Thus, you can just do this for all cases:
|
||||||
* png_progressive_combine_row() passing in the new row and the
|
*/
|
||||||
* old row, as demonstrated above. You can call this function for
|
|
||||||
* NULL rows (it will just return) and for non-interlaced images
|
|
||||||
* (it just does the png_memcpy for you) if it will make the code
|
|
||||||
* easier. Thus, you can just do this for all cases:
|
|
||||||
*/
|
|
||||||
|
|
||||||
png_progressive_combine_row(png_ptr, old_row, new_row);
|
png_progressive_combine_row(png_ptr, old_row, new_row);
|
||||||
|
|
||||||
/* where old_row is what was displayed for previous rows. Note
|
/* where old_row is what was displayed for previous rows. Note
|
||||||
* that the first pass (pass == 0 really) will completely cover
|
* that the first pass (pass == 0 really) will completely cover
|
||||||
* the old row, so the rows do not have to be initialized. After
|
* the old row, so the rows do not have to be initialized. After
|
||||||
* the first pass (and only for interlaced images), you will have
|
* the first pass (and only for interlaced images), you will have
|
||||||
* to pass the current row as new_row, and the function will combine
|
* to pass the current row as new_row, and the function will combine
|
||||||
* the old row and the new row.
|
* the old row and the new row.
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
end_callback(png_structp png_ptr, png_infop info)
|
end_callback(png_structp png_ptr, png_infop info)
|
||||||
{
|
{
|
||||||
/* This function is called when the whole image has been read,
|
/* this function is called when the whole image has been read,
|
||||||
* including any chunks after the image (up to and including
|
* including any chunks after the image (up to and including
|
||||||
* the IEND). You will usually have the same info chunk as you
|
* the IEND). You will usually have the same info chunk as you
|
||||||
* had in the header, although some data may have been added
|
* had in the header, although some data may have been added
|
||||||
* to the comments and time fields.
|
* to the comments and time fields.
|
||||||
*
|
*
|
||||||
* Most people won't do much here, perhaps setting a flag that
|
* Most people won't do much here, perhaps setting a flag that
|
||||||
* marks the image as finished.
|
* marks the image as finished.
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write a png file */
|
/* write a png file */
|
||||||
void write_png(char *file_name /* , ... other image information ... */)
|
void write_png(char *file_name /* , ... other image information ... */)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
@@ -567,7 +563,7 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
png_infop info_ptr;
|
png_infop info_ptr;
|
||||||
png_colorp palette;
|
png_colorp palette;
|
||||||
|
|
||||||
/* Open the file */
|
/* open the file */
|
||||||
fp = fopen(file_name, "wb");
|
fp = fopen(file_name, "wb");
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
@@ -592,7 +588,7 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
if (info_ptr == NULL)
|
if (info_ptr == NULL)
|
||||||
{
|
{
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
png_destroy_write_struct(&png_ptr, NULL);
|
png_destroy_write_struct(&png_ptr, png_infopp_NULL);
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -601,34 +597,30 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
*/
|
*/
|
||||||
if (setjmp(png_jmpbuf(png_ptr)))
|
if (setjmp(png_jmpbuf(png_ptr)))
|
||||||
{
|
{
|
||||||
/* If we get here, we had a problem writing the file */
|
/* If we get here, we had a problem reading the file */
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* One of the following I/O initialization functions is REQUIRED */
|
/* One of the following I/O initialization functions is REQUIRED */
|
||||||
|
|
||||||
#ifdef streams /* I/O initialization method 1 */
|
#ifdef streams /* I/O initialization method 1 */
|
||||||
/* Set up the output control if you are using standard C streams */
|
/* set up the output control if you are using standard C streams */
|
||||||
png_init_io(png_ptr, fp);
|
png_init_io(png_ptr, fp);
|
||||||
|
|
||||||
#else no_streams /* I/O initialization method 2 */
|
#else no_streams /* I/O initialization method 2 */
|
||||||
/* If you are using replacement write functions, instead of calling
|
/* If you are using replacement read functions, instead of calling
|
||||||
* png_init_io() here you would call
|
* png_init_io() here you would call */
|
||||||
*/
|
|
||||||
png_set_write_fn(png_ptr, (void *)user_io_ptr, user_write_fn,
|
png_set_write_fn(png_ptr, (void *)user_io_ptr, user_write_fn,
|
||||||
user_IO_flush_function);
|
user_IO_flush_function);
|
||||||
/* where user_io_ptr is a structure you want available to the callbacks */
|
/* where user_io_ptr is a structure you want available to the callbacks */
|
||||||
#endif no_streams /* Only use one initialization method */
|
#endif no_streams /* only use one initialization method */
|
||||||
|
|
||||||
#ifdef hilevel
|
#ifdef hilevel
|
||||||
/* This is the easy way. Use it if you already have all the
|
/* This is the easy way. Use it if you already have all the
|
||||||
* image info living in the structure. You could "|" many
|
* image info living info in the structure. You could "|" many
|
||||||
* PNG_TRANSFORM flags into the png_transforms integer here.
|
* PNG_TRANSFORM flags into the png_transforms integer here.
|
||||||
*/
|
*/
|
||||||
png_write_png(png_ptr, info_ptr, png_transforms, NULL);
|
png_write_png(png_ptr, info_ptr, png_transforms, png_voidp_NULL);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/* This is the hard way */
|
/* This is the hard way */
|
||||||
|
|
||||||
@@ -643,31 +635,25 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, PNG_COLOR_TYPE_???,
|
png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, PNG_COLOR_TYPE_???,
|
||||||
PNG_INTERLACE_????, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
PNG_INTERLACE_????, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
||||||
|
|
||||||
/* Set the palette if there is one. REQUIRED for indexed-color images */
|
/* set the palette if there is one. REQUIRED for indexed-color images */
|
||||||
palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH
|
palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH
|
||||||
* png_sizeof(png_color));
|
* png_sizeof (png_color));
|
||||||
/* ... Set palette colors ... */
|
/* ... set palette colors ... */
|
||||||
png_set_PLTE(png_ptr, info_ptr, palette, PNG_MAX_PALETTE_LENGTH);
|
png_set_PLTE(png_ptr, info_ptr, palette, PNG_MAX_PALETTE_LENGTH);
|
||||||
/* You must not free palette here, because png_set_PLTE only makes a link to
|
/* You must not free palette here, because png_set_PLTE only makes a link to
|
||||||
* the palette that you malloced. Wait until you are about to destroy
|
the palette that you malloced. Wait until you are about to destroy
|
||||||
* the png structure.
|
the png structure. */
|
||||||
*/
|
|
||||||
|
|
||||||
/* Optional significant bit (sBIT) chunk */
|
/* optional significant bit chunk */
|
||||||
png_color_8 sig_bit;
|
/* if we are dealing with a grayscale image then */
|
||||||
|
|
||||||
/* If we are dealing with a grayscale image then */
|
|
||||||
sig_bit.gray = true_bit_depth;
|
sig_bit.gray = true_bit_depth;
|
||||||
|
/* otherwise, if we are dealing with a color image then */
|
||||||
/* Otherwise, if we are dealing with a color image then */
|
|
||||||
sig_bit.red = true_red_bit_depth;
|
sig_bit.red = true_red_bit_depth;
|
||||||
sig_bit.green = true_green_bit_depth;
|
sig_bit.green = true_green_bit_depth;
|
||||||
sig_bit.blue = true_blue_bit_depth;
|
sig_bit.blue = true_blue_bit_depth;
|
||||||
|
/* if the image has an alpha channel then */
|
||||||
/* If the image has an alpha channel then */
|
|
||||||
sig_bit.alpha = true_alpha_bit_depth;
|
sig_bit.alpha = true_alpha_bit_depth;
|
||||||
|
png_set_sBIT(png_ptr, info_ptr, sig_bit);
|
||||||
png_set_sBIT(png_ptr, info_ptr, &sig_bit);
|
|
||||||
|
|
||||||
|
|
||||||
/* Optional gamma chunk is strongly suggested if you have any guess
|
/* Optional gamma chunk is strongly suggested if you have any guess
|
||||||
@@ -679,29 +665,22 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
text_ptr[0].key = "Title";
|
text_ptr[0].key = "Title";
|
||||||
text_ptr[0].text = "Mona Lisa";
|
text_ptr[0].text = "Mona Lisa";
|
||||||
text_ptr[0].compression = PNG_TEXT_COMPRESSION_NONE;
|
text_ptr[0].compression = PNG_TEXT_COMPRESSION_NONE;
|
||||||
text_ptr[0].itxt_length = 0;
|
|
||||||
text_ptr[0].lang = NULL;
|
|
||||||
text_ptr[0].lang_key = NULL;
|
|
||||||
text_ptr[1].key = "Author";
|
text_ptr[1].key = "Author";
|
||||||
text_ptr[1].text = "Leonardo DaVinci";
|
text_ptr[1].text = "Leonardo DaVinci";
|
||||||
text_ptr[1].compression = PNG_TEXT_COMPRESSION_NONE;
|
text_ptr[1].compression = PNG_TEXT_COMPRESSION_NONE;
|
||||||
text_ptr[1].itxt_length = 0;
|
|
||||||
text_ptr[1].lang = NULL;
|
|
||||||
text_ptr[1].lang_key = NULL;
|
|
||||||
text_ptr[2].key = "Description";
|
text_ptr[2].key = "Description";
|
||||||
text_ptr[2].text = "<long text>";
|
text_ptr[2].text = "<long text>";
|
||||||
text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt;
|
text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt;
|
||||||
text_ptr[2].itxt_length = 0;
|
#ifdef PNG_iTXt_SUPPORTED
|
||||||
|
text_ptr[0].lang = NULL;
|
||||||
|
text_ptr[1].lang = NULL;
|
||||||
text_ptr[2].lang = NULL;
|
text_ptr[2].lang = NULL;
|
||||||
text_ptr[2].lang_key = NULL;
|
#endif
|
||||||
png_set_text(png_ptr, info_ptr, text_ptr, 3);
|
png_set_text(png_ptr, info_ptr, text_ptr, 3);
|
||||||
|
|
||||||
/* Other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs */
|
/* other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs, */
|
||||||
|
/* note that if sRGB is present the gAMA and cHRM chunks must be ignored
|
||||||
/* Note that if sRGB is present the gAMA and cHRM chunks must be ignored
|
* on read and must be written in accordance with the sRGB profile */
|
||||||
* on read and, if your application chooses to write them, they must
|
|
||||||
* be written in accordance with the sRGB profile
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Write the file header information. REQUIRED */
|
/* Write the file header information. REQUIRED */
|
||||||
png_write_info(png_ptr, info_ptr);
|
png_write_info(png_ptr, info_ptr);
|
||||||
@@ -713,7 +692,7 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
* write_my_chunk();
|
* write_my_chunk();
|
||||||
* png_write_info(png_ptr, info_ptr);
|
* png_write_info(png_ptr, info_ptr);
|
||||||
*
|
*
|
||||||
* However, given the level of known- and unknown-chunk support in 1.2.0
|
* However, given the level of known- and unknown-chunk support in 1.1.0
|
||||||
* and up, this should no longer be necessary.
|
* and up, this should no longer be necessary.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -723,11 +702,11 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
* at the end.
|
* at the end.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Set up the transformations you want. Note that these are
|
/* set up the transformations you want. Note that these are
|
||||||
* all optional. Only call them if you want them.
|
* all optional. Only call them if you want them.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Invert monochrome pixels */
|
/* invert monochrome pixels */
|
||||||
png_set_invert_mono(png_ptr);
|
png_set_invert_mono(png_ptr);
|
||||||
|
|
||||||
/* Shift the pixels up to a legal bit depth and fill in
|
/* Shift the pixels up to a legal bit depth and fill in
|
||||||
@@ -735,10 +714,10 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
*/
|
*/
|
||||||
png_set_shift(png_ptr, &sig_bit);
|
png_set_shift(png_ptr, &sig_bit);
|
||||||
|
|
||||||
/* Pack pixels into bytes */
|
/* pack pixels into bytes */
|
||||||
png_set_packing(png_ptr);
|
png_set_packing(png_ptr);
|
||||||
|
|
||||||
/* Swap location of alpha bytes from ARGB to RGBA */
|
/* swap location of alpha bytes from ARGB to RGBA */
|
||||||
png_set_swap_alpha(png_ptr);
|
png_set_swap_alpha(png_ptr);
|
||||||
|
|
||||||
/* Get rid of filler (OR ALPHA) bytes, pack XRGB/RGBX/ARGB/RGBA into
|
/* Get rid of filler (OR ALPHA) bytes, pack XRGB/RGBX/ARGB/RGBA into
|
||||||
@@ -746,19 +725,18 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
*/
|
*/
|
||||||
png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
|
png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
|
||||||
|
|
||||||
/* Flip BGR pixels to RGB */
|
/* flip BGR pixels to RGB */
|
||||||
png_set_bgr(png_ptr);
|
png_set_bgr(png_ptr);
|
||||||
|
|
||||||
/* Swap bytes of 16-bit files to most significant byte first */
|
/* swap bytes of 16-bit files to most significant byte first */
|
||||||
png_set_swap(png_ptr);
|
png_set_swap(png_ptr);
|
||||||
|
|
||||||
/* Swap bits of 1, 2, 4 bit packed pixel formats */
|
/* swap bits of 1, 2, 4 bit packed pixel formats */
|
||||||
png_set_packswap(png_ptr);
|
png_set_packswap(png_ptr);
|
||||||
|
|
||||||
/* Turn on interlace handling if you are not using png_write_image() */
|
/* turn on interlace handling if you are not using png_write_image() */
|
||||||
if (interlacing)
|
if (interlacing)
|
||||||
number_passes = png_set_interlace_handling(png_ptr);
|
number_passes = png_set_interlace_handling(png_ptr);
|
||||||
|
|
||||||
else
|
else
|
||||||
number_passes = 1;
|
number_passes = 1;
|
||||||
|
|
||||||
@@ -777,14 +755,12 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
row_pointers[k] = image + k*width*bytes_per_pixel;
|
row_pointers[k] = image + k*width*bytes_per_pixel;
|
||||||
|
|
||||||
/* One of the following output methods is REQUIRED */
|
/* One of the following output methods is REQUIRED */
|
||||||
|
#ifdef entire /* write out the entire image data in one call */
|
||||||
#ifdef entire /* Write out the entire image data in one call */
|
|
||||||
png_write_image(png_ptr, row_pointers);
|
png_write_image(png_ptr, row_pointers);
|
||||||
|
|
||||||
/* The other way to write the image - deal with interlacing */
|
/* the other way to write the image - deal with interlacing */
|
||||||
|
|
||||||
#else no_entire /* Write out the image data by one or more scanlines */
|
|
||||||
|
|
||||||
|
#else no_entire /* write out the image data by one or more scanlines */
|
||||||
/* The number of passes is either 1 for non-interlaced images,
|
/* The number of passes is either 1 for non-interlaced images,
|
||||||
* or 7 for interlaced images.
|
* or 7 for interlaced images.
|
||||||
*/
|
*/
|
||||||
@@ -795,12 +771,14 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
|
|
||||||
/* If you are only writing one row at a time, this works */
|
/* If you are only writing one row at a time, this works */
|
||||||
for (y = 0; y < height; y++)
|
for (y = 0; y < height; y++)
|
||||||
|
{
|
||||||
png_write_rows(png_ptr, &row_pointers[y], 1);
|
png_write_rows(png_ptr, &row_pointers[y], 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif no_entire /* Use only one output method */
|
#endif no_entire /* use only one output method */
|
||||||
|
|
||||||
/* You can write optional chunks like tEXt, zTXt, and tIME at the end
|
/* You can write optional chunks like tEXt, zTXt, and tIME at the end
|
||||||
* as well. Shouldn't be necessary in 1.2.0 and up as all the public
|
* as well. Shouldn't be necessary in 1.1.0 and up as all the public
|
||||||
* chunks are supported and you can use png_set_unknown_chunks() to
|
* chunks are supported and you can use png_set_unknown_chunks() to
|
||||||
* register unknown chunks into the info structure to be written out.
|
* register unknown chunks into the info structure to be written out.
|
||||||
*/
|
*/
|
||||||
@@ -810,33 +788,26 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
#endif hilevel
|
#endif hilevel
|
||||||
|
|
||||||
/* If you png_malloced a palette, free it here (don't free info_ptr->palette,
|
/* If you png_malloced a palette, free it here (don't free info_ptr->palette,
|
||||||
* as recommended in versions 1.0.5m and earlier of this example; if
|
as recommended in versions 1.0.5m and earlier of this example; if
|
||||||
* libpng mallocs info_ptr->palette, libpng will free it). If you
|
libpng mallocs info_ptr->palette, libpng will free it). If you
|
||||||
* allocated it with malloc() instead of png_malloc(), use free() instead
|
allocated it with malloc() instead of png_malloc(), use free() instead
|
||||||
* of png_free().
|
of png_free(). */
|
||||||
*/
|
|
||||||
png_free(png_ptr, palette);
|
png_free(png_ptr, palette);
|
||||||
palette = NULL;
|
palette=NULL;
|
||||||
|
|
||||||
/* Similarly, if you png_malloced any data that you passed in with
|
/* Similarly, if you png_malloced any data that you passed in with
|
||||||
* png_set_something(), such as a hist or trans array, free it here,
|
png_set_something(), such as a hist or trans array, free it here,
|
||||||
* when you can be sure that libpng is through with it.
|
when you can be sure that libpng is through with it. */
|
||||||
*/
|
|
||||||
png_free(png_ptr, trans);
|
png_free(png_ptr, trans);
|
||||||
trans = NULL;
|
trans=NULL;
|
||||||
/* Whenever you use png_free() it is a good idea to set the pointer to
|
|
||||||
* NULL in case your application inadvertently tries to png_free() it
|
|
||||||
* again. When png_free() sees a NULL it returns without action, thus
|
|
||||||
* avoiding the double-free security problem.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Clean up after the write, and free any memory allocated */
|
/* clean up after the write, and free any memory allocated */
|
||||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||||
|
|
||||||
/* Close the file */
|
/* close the file */
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
/* That's it */
|
/* that's it */
|
||||||
return (OK);
|
return (OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
701
install-sh
@@ -1,520 +1,251 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
#
|
||||||
# install - install a program, script, or datafile
|
# install - install a program, script, or datafile
|
||||||
|
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||||
scriptversion=2009-04-28.21; # UTC
|
|
||||||
|
|
||||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
|
||||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
|
||||||
# following copyright and license.
|
|
||||||
#
|
#
|
||||||
# Copyright (C) 1994 X Consortium
|
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||||
#
|
#
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||||
# of this software and associated documentation files (the "Software"), to
|
# documentation for any purpose is hereby granted without fee, provided that
|
||||||
# deal in the Software without restriction, including without limitation the
|
# the above copyright notice appear in all copies and that both that
|
||||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
# copyright notice and this permission notice appear in supporting
|
||||||
# sell copies of the Software, and to permit persons to whom the Software is
|
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||||
# furnished to do so, subject to the following conditions:
|
# publicity pertaining to distribution of the software without specific,
|
||||||
#
|
# written prior permission. M.I.T. makes no representations about the
|
||||||
# The above copyright notice and this permission notice shall be included in
|
# suitability of this software for any purpose. It is provided "as is"
|
||||||
# all copies or substantial portions of the Software.
|
# without express or implied warranty.
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
||||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
|
||||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
#
|
|
||||||
# Except as contained in this notice, the name of the X Consortium shall not
|
|
||||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
|
||||||
# ings in this Software without prior written authorization from the X Consor-
|
|
||||||
# tium.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# FSF changes to this file are in the public domain.
|
|
||||||
#
|
#
|
||||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||||
# `make' implicit rules from creating a file called install from it
|
# `make' implicit rules from creating a file called install from it
|
||||||
# when there is no Makefile.
|
# when there is no Makefile.
|
||||||
#
|
#
|
||||||
# This script is compatible with the BSD install script, but was written
|
# This script is compatible with the BSD install script, but was written
|
||||||
# from scratch.
|
# from scratch. It can only install one file at a time, a restriction
|
||||||
|
# shared with many OS's install programs.
|
||||||
|
|
||||||
nl='
|
|
||||||
'
|
|
||||||
IFS=" "" $nl"
|
|
||||||
|
|
||||||
# set DOITPROG to echo to test this script
|
# set DOITPROG to echo to test this script
|
||||||
|
|
||||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||||
doit=${DOITPROG-}
|
doit="${DOITPROG-}"
|
||||||
if test -z "$doit"; then
|
|
||||||
doit_exec=exec
|
|
||||||
else
|
|
||||||
doit_exec=$doit
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Put in absolute file names if you don't have them in your path;
|
|
||||||
# or use environment vars.
|
|
||||||
|
|
||||||
chgrpprog=${CHGRPPROG-chgrp}
|
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||||
chmodprog=${CHMODPROG-chmod}
|
|
||||||
chownprog=${CHOWNPROG-chown}
|
|
||||||
cmpprog=${CMPPROG-cmp}
|
|
||||||
cpprog=${CPPROG-cp}
|
|
||||||
mkdirprog=${MKDIRPROG-mkdir}
|
|
||||||
mvprog=${MVPROG-mv}
|
|
||||||
rmprog=${RMPROG-rm}
|
|
||||||
stripprog=${STRIPPROG-strip}
|
|
||||||
|
|
||||||
posix_glob='?'
|
mvprog="${MVPROG-mv}"
|
||||||
initialize_posix_glob='
|
cpprog="${CPPROG-cp}"
|
||||||
test "$posix_glob" != "?" || {
|
chmodprog="${CHMODPROG-chmod}"
|
||||||
if (set -f) 2>/dev/null; then
|
chownprog="${CHOWNPROG-chown}"
|
||||||
posix_glob=
|
chgrpprog="${CHGRPPROG-chgrp}"
|
||||||
else
|
stripprog="${STRIPPROG-strip}"
|
||||||
posix_glob=:
|
rmprog="${RMPROG-rm}"
|
||||||
fi
|
mkdirprog="${MKDIRPROG-mkdir}"
|
||||||
}
|
|
||||||
'
|
|
||||||
|
|
||||||
posix_mkdir=
|
transformbasename=""
|
||||||
|
transform_arg=""
|
||||||
# Desired mode of installed file.
|
instcmd="$mvprog"
|
||||||
mode=0755
|
chmodcmd="$chmodprog 0755"
|
||||||
|
chowncmd=""
|
||||||
chgrpcmd=
|
chgrpcmd=""
|
||||||
chmodcmd=$chmodprog
|
stripcmd=""
|
||||||
chowncmd=
|
|
||||||
mvcmd=$mvprog
|
|
||||||
rmcmd="$rmprog -f"
|
rmcmd="$rmprog -f"
|
||||||
stripcmd=
|
mvcmd="$mvprog"
|
||||||
|
src=""
|
||||||
|
dst=""
|
||||||
|
dir_arg=""
|
||||||
|
|
||||||
src=
|
while [ x"$1" != x ]; do
|
||||||
dst=
|
case $1 in
|
||||||
dir_arg=
|
-c) instcmd="$cpprog"
|
||||||
dst_arg=
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
copy_on_change=false
|
-d) dir_arg=true
|
||||||
no_target_directory=
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
usage="\
|
-m) chmodcmd="$chmodprog $2"
|
||||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
shift
|
||||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
shift
|
||||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
continue;;
|
||||||
or: $0 [OPTION]... -d DIRECTORIES...
|
|
||||||
|
|
||||||
In the 1st form, copy SRCFILE to DSTFILE.
|
-o) chowncmd="$chownprog $2"
|
||||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
shift
|
||||||
In the 4th, create DIRECTORIES.
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
Options:
|
-g) chgrpcmd="$chgrpprog $2"
|
||||||
--help display this help and exit.
|
shift
|
||||||
--version display version info and exit.
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
-c (ignored)
|
-s) stripcmd="$stripprog"
|
||||||
-C install only if different (preserve the last data modification time)
|
shift
|
||||||
-d create directories instead of installing files.
|
continue;;
|
||||||
-g GROUP $chgrpprog installed files to GROUP.
|
|
||||||
-m MODE $chmodprog installed files to MODE.
|
|
||||||
-o USER $chownprog installed files to USER.
|
|
||||||
-s $stripprog installed files.
|
|
||||||
-t DIRECTORY install into DIRECTORY.
|
|
||||||
-T report an error if DSTFILE is a directory.
|
|
||||||
|
|
||||||
Environment variables override the default commands:
|
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
shift
|
||||||
RMPROG STRIPPROG
|
continue;;
|
||||||
"
|
|
||||||
|
|
||||||
while test $# -ne 0; do
|
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||||
case $1 in
|
shift
|
||||||
-c) ;;
|
continue;;
|
||||||
|
|
||||||
-C) copy_on_change=true;;
|
*) if [ x"$src" = x ]
|
||||||
|
|
||||||
-d) dir_arg=true;;
|
|
||||||
|
|
||||||
-g) chgrpcmd="$chgrpprog $2"
|
|
||||||
shift;;
|
|
||||||
|
|
||||||
--help) echo "$usage"; exit $?;;
|
|
||||||
|
|
||||||
-m) mode=$2
|
|
||||||
case $mode in
|
|
||||||
*' '* | *' '* | *'
|
|
||||||
'* | *'*'* | *'?'* | *'['*)
|
|
||||||
echo "$0: invalid mode: $mode" >&2
|
|
||||||
exit 1;;
|
|
||||||
esac
|
|
||||||
shift;;
|
|
||||||
|
|
||||||
-o) chowncmd="$chownprog $2"
|
|
||||||
shift;;
|
|
||||||
|
|
||||||
-s) stripcmd=$stripprog;;
|
|
||||||
|
|
||||||
-t) dst_arg=$2
|
|
||||||
shift;;
|
|
||||||
|
|
||||||
-T) no_target_directory=true;;
|
|
||||||
|
|
||||||
--version) echo "$0 $scriptversion"; exit $?;;
|
|
||||||
|
|
||||||
--) shift
|
|
||||||
break;;
|
|
||||||
|
|
||||||
-*) echo "$0: invalid option: $1" >&2
|
|
||||||
exit 1;;
|
|
||||||
|
|
||||||
*) break;;
|
|
||||||
esac
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
|
|
||||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
|
||||||
# When -d is used, all remaining arguments are directories to create.
|
|
||||||
# When -t is used, the destination is already specified.
|
|
||||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
|
||||||
for arg
|
|
||||||
do
|
|
||||||
if test -n "$dst_arg"; then
|
|
||||||
# $@ is not empty: it contains at least $arg.
|
|
||||||
set fnord "$@" "$dst_arg"
|
|
||||||
shift # fnord
|
|
||||||
fi
|
|
||||||
shift # arg
|
|
||||||
dst_arg=$arg
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test $# -eq 0; then
|
|
||||||
if test -z "$dir_arg"; then
|
|
||||||
echo "$0: no input file specified." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
# It's OK to call `install-sh -d' without argument.
|
|
||||||
# This can happen when creating conditional directories.
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -z "$dir_arg"; then
|
|
||||||
trap '(exit $?); exit' 1 2 13 15
|
|
||||||
|
|
||||||
# Set umask so as not to create temps with too-generous modes.
|
|
||||||
# However, 'strip' requires both read and write access to temps.
|
|
||||||
case $mode in
|
|
||||||
# Optimize common cases.
|
|
||||||
*644) cp_umask=133;;
|
|
||||||
*755) cp_umask=22;;
|
|
||||||
|
|
||||||
*[0-7])
|
|
||||||
if test -z "$stripcmd"; then
|
|
||||||
u_plus_rw=
|
|
||||||
else
|
|
||||||
u_plus_rw='% 200'
|
|
||||||
fi
|
|
||||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
|
||||||
*)
|
|
||||||
if test -z "$stripcmd"; then
|
|
||||||
u_plus_rw=
|
|
||||||
else
|
|
||||||
u_plus_rw=,u+rw
|
|
||||||
fi
|
|
||||||
cp_umask=$mode$u_plus_rw;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
for src
|
|
||||||
do
|
|
||||||
# Protect names starting with `-'.
|
|
||||||
case $src in
|
|
||||||
-*) src=./$src;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if test -n "$dir_arg"; then
|
|
||||||
dst=$src
|
|
||||||
dstdir=$dst
|
|
||||||
test -d "$dstdir"
|
|
||||||
dstdir_status=$?
|
|
||||||
else
|
|
||||||
|
|
||||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
|
||||||
# might cause directories to be created, which would be especially bad
|
|
||||||
# if $src (and thus $dsttmp) contains '*'.
|
|
||||||
if test ! -f "$src" && test ! -d "$src"; then
|
|
||||||
echo "$0: $src does not exist." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -z "$dst_arg"; then
|
|
||||||
echo "$0: no destination specified." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
dst=$dst_arg
|
|
||||||
# Protect names starting with `-'.
|
|
||||||
case $dst in
|
|
||||||
-*) dst=./$dst;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# If destination is a directory, append the input filename; won't work
|
|
||||||
# if double slashes aren't ignored.
|
|
||||||
if test -d "$dst"; then
|
|
||||||
if test -n "$no_target_directory"; then
|
|
||||||
echo "$0: $dst_arg: Is a directory" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
dstdir=$dst
|
|
||||||
dst=$dstdir/`basename "$src"`
|
|
||||||
dstdir_status=0
|
|
||||||
else
|
|
||||||
# Prefer dirname, but fall back on a substitute if dirname fails.
|
|
||||||
dstdir=`
|
|
||||||
(dirname "$dst") 2>/dev/null ||
|
|
||||||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
|
||||||
X"$dst" : 'X\(//\)[^/]' \| \
|
|
||||||
X"$dst" : 'X\(//\)$' \| \
|
|
||||||
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
|
|
||||||
echo X"$dst" |
|
|
||||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
|
|
||||||
s//\1/
|
|
||||||
q
|
|
||||||
}
|
|
||||||
/^X\(\/\/\)[^/].*/{
|
|
||||||
s//\1/
|
|
||||||
q
|
|
||||||
}
|
|
||||||
/^X\(\/\/\)$/{
|
|
||||||
s//\1/
|
|
||||||
q
|
|
||||||
}
|
|
||||||
/^X\(\/\).*/{
|
|
||||||
s//\1/
|
|
||||||
q
|
|
||||||
}
|
|
||||||
s/.*/./; q'
|
|
||||||
`
|
|
||||||
|
|
||||||
test -d "$dstdir"
|
|
||||||
dstdir_status=$?
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
obsolete_mkdir_used=false
|
|
||||||
|
|
||||||
if test $dstdir_status != 0; then
|
|
||||||
case $posix_mkdir in
|
|
||||||
'')
|
|
||||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
|
||||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
|
||||||
umask=`umask`
|
|
||||||
case $stripcmd.$umask in
|
|
||||||
# Optimize common cases.
|
|
||||||
*[2367][2367]) mkdir_umask=$umask;;
|
|
||||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
|
||||||
|
|
||||||
*[0-7])
|
|
||||||
mkdir_umask=`expr $umask + 22 \
|
|
||||||
- $umask % 100 % 40 + $umask % 20 \
|
|
||||||
- $umask % 10 % 4 + $umask % 2
|
|
||||||
`;;
|
|
||||||
*) mkdir_umask=$umask,go-w;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# With -d, create the new directory with the user-specified mode.
|
|
||||||
# Otherwise, rely on $mkdir_umask.
|
|
||||||
if test -n "$dir_arg"; then
|
|
||||||
mkdir_mode=-m$mode
|
|
||||||
else
|
|
||||||
mkdir_mode=
|
|
||||||
fi
|
|
||||||
|
|
||||||
posix_mkdir=false
|
|
||||||
case $umask in
|
|
||||||
*[123567][0-7][0-7])
|
|
||||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
|
||||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
|
||||||
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
|
|
||||||
|
|
||||||
if (umask $mkdir_umask &&
|
|
||||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
|
|
||||||
then
|
then
|
||||||
if test -z "$dir_arg" || {
|
src=$1
|
||||||
# Check for POSIX incompatibilities with -m.
|
|
||||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
|
||||||
# other-writeable bit of parent directory when it shouldn't.
|
|
||||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
|
||||||
ls_ld_tmpdir=`ls -ld "$tmpdir"`
|
|
||||||
case $ls_ld_tmpdir in
|
|
||||||
d????-?r-*) different_mode=700;;
|
|
||||||
d????-?--*) different_mode=755;;
|
|
||||||
*) false;;
|
|
||||||
esac &&
|
|
||||||
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
|
|
||||||
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
|
|
||||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
then posix_mkdir=:
|
|
||||||
fi
|
|
||||||
rmdir "$tmpdir/d" "$tmpdir"
|
|
||||||
else
|
else
|
||||||
# Remove any dirs left behind by ancient mkdir implementations.
|
# this colon is to work around a 386BSD /bin/sh bug
|
||||||
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
|
:
|
||||||
|
dst=$1
|
||||||
fi
|
fi
|
||||||
trap '' 0;;
|
shift
|
||||||
esac;;
|
continue;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if
|
|
||||||
$posix_mkdir && (
|
|
||||||
umask $mkdir_umask &&
|
|
||||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
|
||||||
)
|
|
||||||
then :
|
|
||||||
else
|
|
||||||
|
|
||||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
|
||||||
# or it failed possibly due to a race condition. Create the
|
|
||||||
# directory the slow way, step by step, checking for races as we go.
|
|
||||||
|
|
||||||
case $dstdir in
|
|
||||||
/*) prefix='/';;
|
|
||||||
-*) prefix='./';;
|
|
||||||
*) prefix='';;
|
|
||||||
esac
|
|
||||||
|
|
||||||
eval "$initialize_posix_glob"
|
|
||||||
|
|
||||||
oIFS=$IFS
|
|
||||||
IFS=/
|
|
||||||
$posix_glob set -f
|
|
||||||
set fnord $dstdir
|
|
||||||
shift
|
|
||||||
$posix_glob set +f
|
|
||||||
IFS=$oIFS
|
|
||||||
|
|
||||||
prefixes=
|
|
||||||
|
|
||||||
for d
|
|
||||||
do
|
|
||||||
test -z "$d" && continue
|
|
||||||
|
|
||||||
prefix=$prefix$d
|
|
||||||
if test -d "$prefix"; then
|
|
||||||
prefixes=
|
|
||||||
else
|
|
||||||
if $posix_mkdir; then
|
|
||||||
(umask=$mkdir_umask &&
|
|
||||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
|
||||||
# Don't fail if two instances are running concurrently.
|
|
||||||
test -d "$prefix" || exit 1
|
|
||||||
else
|
|
||||||
case $prefix in
|
|
||||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
|
||||||
*) qprefix=$prefix;;
|
|
||||||
esac
|
|
||||||
prefixes="$prefixes '$qprefix'"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
prefix=$prefix/
|
|
||||||
done
|
|
||||||
|
|
||||||
if test -n "$prefixes"; then
|
|
||||||
# Don't fail if two instances are running concurrently.
|
|
||||||
(umask $mkdir_umask &&
|
|
||||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
|
||||||
test -d "$dstdir" || exit 1
|
|
||||||
obsolete_mkdir_used=true
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -n "$dir_arg"; then
|
|
||||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
|
||||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
|
||||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
|
||||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
|
||||||
else
|
|
||||||
|
|
||||||
# Make a couple of temp file names in the proper directory.
|
|
||||||
dsttmp=$dstdir/_inst.$$_
|
|
||||||
rmtmp=$dstdir/_rm.$$_
|
|
||||||
|
|
||||||
# Trap to clean up those temp files at exit.
|
|
||||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
|
||||||
|
|
||||||
# Copy the file name to the temp name.
|
|
||||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
|
||||||
|
|
||||||
# and set any options; do chmod last to preserve setuid bits.
|
|
||||||
#
|
|
||||||
# If any of these fail, we abort the whole thing. If we want to
|
|
||||||
# ignore errors from any of these, just make sure not to ignore
|
|
||||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
|
||||||
#
|
|
||||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
|
||||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
|
||||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
|
||||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
|
||||||
|
|
||||||
# If -C, don't bother to copy if it wouldn't change the file.
|
|
||||||
if $copy_on_change &&
|
|
||||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
|
||||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
|
||||||
|
|
||||||
eval "$initialize_posix_glob" &&
|
|
||||||
$posix_glob set -f &&
|
|
||||||
set X $old && old=:$2:$4:$5:$6 &&
|
|
||||||
set X $new && new=:$2:$4:$5:$6 &&
|
|
||||||
$posix_glob set +f &&
|
|
||||||
|
|
||||||
test "$old" = "$new" &&
|
|
||||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
|
||||||
then
|
|
||||||
rm -f "$dsttmp"
|
|
||||||
else
|
|
||||||
# Rename the file to the real destination.
|
|
||||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
|
||||||
|
|
||||||
# The rename failed, perhaps because mv can't rename something else
|
|
||||||
# to itself, or perhaps because mv is so ancient that it does not
|
|
||||||
# support -f.
|
|
||||||
{
|
|
||||||
# Now remove or move aside any old file at destination location.
|
|
||||||
# We try this two ways since rm can't unlink itself on some
|
|
||||||
# systems and the destination file might be busy for other
|
|
||||||
# reasons. In this case, the final cleanup might fail but the new
|
|
||||||
# file should still install successfully.
|
|
||||||
{
|
|
||||||
test ! -f "$dst" ||
|
|
||||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
|
||||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
|
||||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
|
||||||
} ||
|
|
||||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
|
||||||
(exit 1); exit 1
|
|
||||||
}
|
|
||||||
} &&
|
|
||||||
|
|
||||||
# Now rename the file to the real destination.
|
|
||||||
$doit $mvcmd "$dsttmp" "$dst"
|
|
||||||
}
|
|
||||||
fi || exit 1
|
|
||||||
|
|
||||||
trap '' 0
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Local variables:
|
if [ x"$src" = x ]
|
||||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
then
|
||||||
# time-stamp-start: "scriptversion="
|
echo "install: no input file specified"
|
||||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
exit 1
|
||||||
# time-stamp-time-zone: "UTC"
|
else
|
||||||
# time-stamp-end: "; # UTC"
|
true
|
||||||
# End:
|
fi
|
||||||
|
|
||||||
|
if [ x"$dir_arg" != x ]; then
|
||||||
|
dst=$src
|
||||||
|
src=""
|
||||||
|
|
||||||
|
if [ -d $dst ]; then
|
||||||
|
instcmd=:
|
||||||
|
chmodcmd=""
|
||||||
|
else
|
||||||
|
instcmd=mkdir
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
|
||||||
|
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||||
|
# might cause directories to be created, which would be especially bad
|
||||||
|
# if $src (and thus $dsttmp) contains '*'.
|
||||||
|
|
||||||
|
if [ -f $src -o -d $src ]
|
||||||
|
then
|
||||||
|
true
|
||||||
|
else
|
||||||
|
echo "install: $src does not exist"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x"$dst" = x ]
|
||||||
|
then
|
||||||
|
echo "install: no destination specified"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If destination is a directory, append the input filename; if your system
|
||||||
|
# does not like double slashes in filenames, you may need to add some logic
|
||||||
|
|
||||||
|
if [ -d $dst ]
|
||||||
|
then
|
||||||
|
dst="$dst"/`basename $src`
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
## this sed command emulates the dirname command
|
||||||
|
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||||
|
|
||||||
|
# Make sure that the destination directory exists.
|
||||||
|
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||||
|
|
||||||
|
# Skip lots of stat calls in the usual case.
|
||||||
|
if [ ! -d "$dstdir" ]; then
|
||||||
|
defaultIFS='
|
||||||
|
'
|
||||||
|
IFS="${IFS-${defaultIFS}}"
|
||||||
|
|
||||||
|
oIFS="${IFS}"
|
||||||
|
# Some sh's can't handle IFS=/ for some reason.
|
||||||
|
IFS='%'
|
||||||
|
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||||
|
IFS="${oIFS}"
|
||||||
|
|
||||||
|
pathcomp=''
|
||||||
|
|
||||||
|
while [ $# -ne 0 ] ; do
|
||||||
|
pathcomp="${pathcomp}${1}"
|
||||||
|
shift
|
||||||
|
|
||||||
|
if [ ! -d "${pathcomp}" ] ;
|
||||||
|
then
|
||||||
|
$mkdirprog "${pathcomp}"
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
pathcomp="${pathcomp}/"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x"$dir_arg" != x ]
|
||||||
|
then
|
||||||
|
$doit $instcmd $dst &&
|
||||||
|
|
||||||
|
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||||
|
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||||
|
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||||
|
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||||
|
else
|
||||||
|
|
||||||
|
# If we're going to rename the final executable, determine the name now.
|
||||||
|
|
||||||
|
if [ x"$transformarg" = x ]
|
||||||
|
then
|
||||||
|
dstfile=`basename $dst`
|
||||||
|
else
|
||||||
|
dstfile=`basename $dst $transformbasename |
|
||||||
|
sed $transformarg`$transformbasename
|
||||||
|
fi
|
||||||
|
|
||||||
|
# don't allow the sed command to completely eliminate the filename
|
||||||
|
|
||||||
|
if [ x"$dstfile" = x ]
|
||||||
|
then
|
||||||
|
dstfile=`basename $dst`
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make a temp file name in the proper directory.
|
||||||
|
|
||||||
|
dsttmp=$dstdir/#inst.$$#
|
||||||
|
|
||||||
|
# Move or copy the file name to the temp name
|
||||||
|
|
||||||
|
$doit $instcmd $src $dsttmp &&
|
||||||
|
|
||||||
|
trap "rm -f ${dsttmp}" 0 &&
|
||||||
|
|
||||||
|
# and set any options; do chmod last to preserve setuid bits
|
||||||
|
|
||||||
|
# If any of these fail, we abort the whole thing. If we want to
|
||||||
|
# ignore errors from any of these, just make sure not to ignore
|
||||||
|
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||||
|
|
||||||
|
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||||
|
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||||
|
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||||
|
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||||
|
|
||||||
|
# Now rename the file to the real destination.
|
||||||
|
|
||||||
|
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||||
|
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||||
|
|
||||||
|
fi &&
|
||||||
|
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|||||||
11
libpng.pc.in
@@ -1,11 +0,0 @@
|
|||||||
prefix=@prefix@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
libdir=@libdir@
|
|
||||||
includedir=@includedir@/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
|
|
||||||
|
|
||||||
Name: libpng
|
|
||||||
Description: Loads and saves PNG files
|
|
||||||
Version: @PNGLIB_VERSION@
|
|
||||||
Libs: -L${libdir} -lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
|
|
||||||
Libs.private: @LIBS@
|
|
||||||
Cflags: -I${includedir}
|
|
||||||
266
libpngpf.3
@@ -1,30 +1,274 @@
|
|||||||
.TH LIBPNGPF 3 "March 31, 2011"
|
.TH LIBPNGPF 3 "September 26, 2007"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.5.2
|
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.29rc2
|
||||||
(private functions)
|
(private functions)
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
\fB#include \fI"pngpriv.h"
|
\fB#include <png.h>\fP
|
||||||
|
|
||||||
\fI\fB
|
\fBvoid png_build_gamma_table (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
\fBAs of libpng version \fP\fI1.5.1\fP\fB, this section is no longer \fP\fImaintained\fP\fB, now \fIthat
|
\fBvoid png_build_grayscale_palette (int \fP\fIbit_depth\fP\fB, png_colorp \fIpalette\fP\fB);\fP
|
||||||
|
|
||||||
\fBthe private function prototypes are hidden in pngpriv.h and not \fIaccessible
|
\fBvoid png_calculate_crc (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIptr\fP\fB, png_size_t \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
\fBto applications. Look in pngpriv.h for the prototypes and a short \fIdescription
|
\fBvoid png_check_chunk_name (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIchunk_name\fP\fB);\fP
|
||||||
|
|
||||||
\fBof each \fIfunction.
|
\fBpng_size_t png_check_keyword (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIkey\fP\fB, png_charpp \fInew_key\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_combine_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIrow\fP\fB, int \fImask\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_correct_palette (png_structp \fP\fIpng_ptr\fP\fB, png_colorp \fP\fIpalette\fP\fB, int \fInum_palette\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBint png_crc_error (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBint png_crc_finish (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIskip\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_crc_read (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuf\fP\fB, png_size_t \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBpng_voidp png_create_struct (int \fItype\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBpng_voidp png_create_struct_2 (int \fP\fItype\fP\fB, png_malloc_ptr \fP\fImalloc_fn\fP\fB, png_voidp \fImem_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBpng_charp png_decompress_chunk (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIcomp_type\fP\fB, png_charp \fP\fIchunkdata\fP\fB, png_size_t \fP\fIchunklength\fP\fB, png_size_t \fP\fIprefix_length\fP\fB, png_size_t \fI*data_length\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_destroy_struct (png_voidp \fIstruct_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_destroy_struct_2 (png_voidp \fP\fIstruct_ptr\fP\fB, png_free_ptr \fP\fIfree_fn\fP\fB, png_voidp \fImem_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_do_background (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_16p \fP\fItrans_values\fP\fB, png_color_16p \fP\fIbackground\fP\fB, png_color_16p \fP\fIbackground_1\fP\fB, png_bytep \fP\fIgamma_table\fP\fB, png_bytep \fP\fIgamma_from_1\fP\fB, png_bytep \fP\fIgamma_to_1\fP\fB, png_uint_16pp \fP\fIgamma_16\fP\fB, png_uint_16pp \fP\fIgamma_16_from_1\fP\fB, png_uint_16pp \fP\fIgamma_16_to_1\fP\fB, int \fIgamma_shift\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_do_bgr (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_do_chop (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_do_dither (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIpalette_lookup\fP\fB, png_bytep \fIdither_lookup\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_do_expand (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_16p \fItrans_value\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_do_expand_palette (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_colorp \fP\fIpalette\fP\fB, png_bytep \fP\fItrans\fP\fB, int \fInum_trans\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_do_gamma (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIgamma_table\fP\fB, png_uint_16pp \fP\fIgamma_16_table\fP\fB, int \fIgamma_shift\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_do_gray_to_rgb (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_do_invert (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_do_pack (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fIbit_depth\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_do_packswap (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_do_read_filler (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fP\fIfiller\fP\fB, png_uint_32 \fIflags\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_do_read_interlace (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, int \fP\fIpass\fP\fB, png_uint_32 \fItransformations\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_do_read_invert_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_do_read_swap_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_do_read_transformations (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBint png_do_rgb_to_gray (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_do_shift (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_8p \fIbit_depth\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_do_strip_filler (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fIflags\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_do_swap (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_do_unpack (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_do_unshift (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_8p \fIsig_bits\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_do_write_interlace (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, int \fIpass\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_do_write_invert_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_do_write_swap_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_do_write_transformations (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid *png_far_to_near (png_structp png_ptr,png_voidp \fP\fIptr\fP\fB, int \fIcheck\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_flush (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_handle_bKGD (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_handle_cHRM (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_handle_gAMA (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_handle_hIST (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_handle_IEND (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_handle_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_handle_iCCP (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_handle_iTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_handle_oFFs (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_handle_pCAL (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_handle_pHYs (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_handle_PLTE (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_handle_sBIT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_handle_sCAL (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_handle_sPLT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_handle_sRGB (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_handle_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_handle_tIME (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_handle_tRNS (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_handle_unknown (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_handle_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_info_destroy (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_init_mmx_flags (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_init_read_transformations (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_process_IDAT_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIbuffer_length\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_process_some_data (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_push_check_crc (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_push_crc_finish (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_push_crc_skip (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_push_fill_buffer (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_push_handle_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_push_handle_unknown (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_push_handle_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_push_have_end (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_push_have_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_push_have_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_push_process_row (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_push_read_chunk (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_push_read_end (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_push_read_IDAT (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_push_read_sig (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_push_read_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_push_read_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_push_restore_buffer (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIbuffer_length\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_push_save_buffer (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_read_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_read_filter_row (png_structp \fP\fIpng_ptr\fP\fB, png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIprev_row\fP\fB, int \fIfilter\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_read_finish_row (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_read_push_finish_row (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_read_start_row (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_read_transform_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_reset_crc (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBint png_set_text_2 (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_textp \fP\fItext_ptr\fP\fB, int \fInum_text\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_write_cHRM (png_structp \fP\fIpng_ptr\fP\fB, double \fP\fIwhite_x\fP\fB, double \fP\fIwhite_y\fP\fB, double \fP\fIred_x\fP\fB, double \fP\fIred_y\fP\fB, double \fP\fIgreen_x\fP\fB, double \fP\fIgreen_y\fP\fB, double \fP\fIblue_x\fP\fB, double \fIblue_y\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_write_cHRM_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIwhite_x\fP\fB, png_uint_32 \fP\fIwhite_y\fP\fB, png_uint_32 \fP\fIred_x\fP\fB, png_uint_32 \fP\fIred_y\fP\fB, png_uint_32 \fP\fIgreen_x\fP\fB, png_uint_32 \fP\fIgreen_y\fP\fB, png_uint_32 \fP\fIblue_x\fP\fB, png_uint_32 \fIblue_y\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_write_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_write_filtered_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIfiltered_row\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_write_find_filter (png_structp \fP\fIpng_ptr\fP\fB, png_row_infop \fIrow_info\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_write_finish_row (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_write_gAMA (png_structp \fP\fIpng_ptr\fP\fB, double \fIfile_gamma\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_write_gAMA_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIint_file_gamma\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_write_hIST (png_structp \fP\fIpng_ptr\fP\fB, png_uint_16p \fP\fIhist\fP\fB, int \fInum_hist\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_write_iCCP (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIname\fP\fB, int \fP\fIcompression_type\fP\fB, png_charp \fP\fIprofile\fP\fB, int \fIproflen\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_write_IDAT (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_write_IEND (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_write_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIwidth\fP\fB, png_uint_32 \fP\fIheight\fP\fB, int \fP\fIbit_depth\fP\fB, int \fP\fIcolor_type\fP\fB, int \fP\fIcompression_type\fP\fB, int \fP\fIfilter_type\fP\fB, int \fIinterlace_type\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_write_iTXt (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIcompression\fP\fB, png_charp \fP\fIkey\fP\fB, png_charp \fP\fIlang\fP\fB, png_charp \fP\fItranslated_key\fP\fB, png_charp \fItext\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_write_oFFs (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIx_offset\fP\fB, png_uint_32 \fP\fIy_offset\fP\fB, int \fIunit_type\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_write_pCAL (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIpurpose\fP\fB, png_int_32 \fP\fIX0\fP\fB, png_int_32 \fP\fIX1\fP\fB, int \fP\fItype\fP\fB, int \fP\fInparams\fP\fB, png_charp \fP\fIunits\fP\fB, png_charpp \fIparams\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_write_pHYs (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIx_pixels_per_unit\fP\fB, png_uint_32 \fP\fIy_pixels_per_unit\fP\fB, int \fIunit_type\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_write_PLTE (png_structp \fP\fIpng_ptr\fP\fB, png_colorp \fP\fIpalette\fP\fB, png_uint_32 \fInum_pal\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_write_sBIT (png_structp \fP\fIpng_ptr\fP\fB, png_color_8p \fP\fIsbit\fP\fB, int \fIcolor_type\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_write_sCAL (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIunit\fP\fB, double \fP\fIwidth\fP\fB, double \fIheight\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_write_sCAL_s (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIunit\fP\fB, png_charp \fP\fIwidth\fP\fB, png_charp \fIheight\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_write_sig (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_write_sRGB (png_structp \fP\fIpng_ptr\fP\fB, int \fIintent\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_write_sPLT (png_structp \fP\fIpng_ptr\fP\fB, png_spalette_p \fIpalette\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_write_start_row (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_write_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIkey\fP\fB, png_charp \fP\fItext\fP\fB, png_size_t \fItext_len\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_write_tIME (png_structp \fP\fIpng_ptr\fP\fB, png_timep \fImod_time\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_write_tRNS (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fItrans\fP\fB, png_color_16p \fP\fIvalues\fP\fB, int \fP\fInumber\fP\fB, int \fIcolor_type\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_write_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIkey\fP\fB, png_charp \fP\fItext\fP\fB, png_size_t \fP\fItext_len\fP\fB, int \fIcompression\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoidpf png_zalloc (voidpf \fP\fIpng_ptr\fP\fB, uInt \fP\fIitems\fP\fB, uInt \fIsize\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBvoid png_zfree (voidpf \fP\fIpng_ptr\fP\fB, voidpf \fIptr\fP\fB);\fP
|
||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
The functions previously listed here are used privately by libpng
|
The functions listed above are used privately by libpng
|
||||||
and are not recommended for use by applications. They are
|
and are not recommended for use by applications. They are
|
||||||
not "exported" to applications using shared libraries. They
|
not "exported" to applications using shared libraries. They
|
||||||
are listed alphabetically here as an aid to libpng maintainers.
|
are listed alphabetically here as an aid to libpng maintainers.
|
||||||
See pngpriv.h for more information on these functions.
|
See png.h for more information on these functions.
|
||||||
|
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR "png"(5), " libpng"(3), " zlib"(3), " deflate"(5), " " and " zlib"(5)
|
.IR libpng(3) ", " png(5)
|
||||||
.SH AUTHOR
|
.SH AUTHOR
|
||||||
Glenn Randers-Pehrson
|
Glenn Randers-Pehrson
|
||||||
|
|||||||
10284
ltmain.sh
Executable file → Normal file
227
missing
@@ -1,10 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Common stub for a few missing GNU programs while installing.
|
# Common stub for a few missing GNU programs while installing.
|
||||||
|
# Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
|
||||||
scriptversion=2009-04-28.21; # UTC
|
|
||||||
|
|
||||||
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
|
|
||||||
# 2008, 2009 Free Software Foundation, Inc.
|
|
||||||
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
@@ -18,7 +14,9 @@ scriptversion=2009-04-28.21; # UTC
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
|
# 02111-1307, USA.
|
||||||
|
|
||||||
# As a special exception to the GNU General Public License, if you
|
# As a special exception to the GNU General Public License, if you
|
||||||
# distribute this file as part of a program that contains a
|
# distribute this file as part of a program that contains a
|
||||||
@@ -31,8 +29,6 @@ if test $# -eq 0; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
run=:
|
run=:
|
||||||
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
|
|
||||||
sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
|
|
||||||
|
|
||||||
# In the cases where this matters, `missing' is being run in the
|
# In the cases where this matters, `missing' is being run in the
|
||||||
# srcdir already.
|
# srcdir already.
|
||||||
@@ -42,24 +38,18 @@ else
|
|||||||
configure_ac=configure.in
|
configure_ac=configure.in
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg="missing on your system"
|
case "$1" in
|
||||||
|
|
||||||
case $1 in
|
|
||||||
--run)
|
--run)
|
||||||
# Try to run requested program, and just exit if it succeeds.
|
# Try to run requested program, and just exit if it succeeds.
|
||||||
run=
|
run=
|
||||||
shift
|
shift
|
||||||
"$@" && exit 0
|
"$@" && exit 0
|
||||||
# Exit code 63 means version mismatch. This often happens
|
|
||||||
# when the user try to use an ancient version of a tool on
|
|
||||||
# a file that requires a minimum version. In this case we
|
|
||||||
# we should proceed has if the program had been absent, or
|
|
||||||
# if --run hadn't been passed.
|
|
||||||
if test $? = 63; then
|
|
||||||
run=:
|
|
||||||
msg="probably too old"
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# If it does not exist, or fails to run (possibly an outdated version),
|
||||||
|
# try to emulate it.
|
||||||
|
case "$1" in
|
||||||
|
|
||||||
-h|--h|--he|--hel|--help)
|
-h|--h|--he|--hel|--help)
|
||||||
echo "\
|
echo "\
|
||||||
@@ -77,7 +67,6 @@ Supported PROGRAM values:
|
|||||||
aclocal touch file \`aclocal.m4'
|
aclocal touch file \`aclocal.m4'
|
||||||
autoconf touch file \`configure'
|
autoconf touch file \`configure'
|
||||||
autoheader touch file \`config.h.in'
|
autoheader touch file \`config.h.in'
|
||||||
autom4te touch the output file, or create a stub one
|
|
||||||
automake touch all \`Makefile.in' files
|
automake touch all \`Makefile.in' files
|
||||||
bison create \`y.tab.[ch]', if possible, from existing .[ch]
|
bison create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||||
flex create \`lex.yy.c', if possible, from existing .c
|
flex create \`lex.yy.c', if possible, from existing .c
|
||||||
@@ -85,18 +74,11 @@ Supported PROGRAM values:
|
|||||||
lex create \`lex.yy.c', if possible, from existing .c
|
lex create \`lex.yy.c', if possible, from existing .c
|
||||||
makeinfo touch the output file
|
makeinfo touch the output file
|
||||||
tar try tar, gnutar, gtar, then tar without non-portable flags
|
tar try tar, gnutar, gtar, then tar without non-portable flags
|
||||||
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
|
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
|
||||||
|
|
||||||
Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
|
|
||||||
\`g' are ignored when checking the name.
|
|
||||||
|
|
||||||
Send bug reports to <bug-automake@gnu.org>."
|
|
||||||
exit $?
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||||
echo "missing $scriptversion (GNU Automake)"
|
echo "missing 0.3 - GNU automake"
|
||||||
exit $?
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-*)
|
-*)
|
||||||
@@ -105,69 +87,27 @@ Send bug reports to <bug-automake@gnu.org>."
|
|||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
|
|
||||||
esac
|
aclocal)
|
||||||
|
|
||||||
# normalize program name to check for.
|
|
||||||
program=`echo "$1" | sed '
|
|
||||||
s/^gnu-//; t
|
|
||||||
s/^gnu//; t
|
|
||||||
s/^g//; t'`
|
|
||||||
|
|
||||||
# Now exit if we have it, but it failed. Also exit now if we
|
|
||||||
# don't have it and --version was passed (most likely to detect
|
|
||||||
# the program). This is about non-GNU programs, so use $1 not
|
|
||||||
# $program.
|
|
||||||
case $1 in
|
|
||||||
lex*|yacc*)
|
|
||||||
# Not GNU programs, they don't have --version.
|
|
||||||
;;
|
|
||||||
|
|
||||||
tar*)
|
|
||||||
if test -n "$run"; then
|
|
||||||
echo 1>&2 "ERROR: \`tar' requires --run"
|
|
||||||
exit 1
|
|
||||||
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
|
||||||
# We have it, but it failed.
|
|
||||||
exit 1
|
|
||||||
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
|
|
||||||
# Could not run --version or --help. This is probably someone
|
|
||||||
# running `$TOOL --version' or `$TOOL --help' to check whether
|
|
||||||
# $TOOL exists and not knowing $TOOL uses missing.
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# If it does not exist, or fails to run (possibly an outdated version),
|
|
||||||
# try to emulate it.
|
|
||||||
case $program in
|
|
||||||
aclocal*)
|
|
||||||
echo 1>&2 "\
|
echo 1>&2 "\
|
||||||
WARNING: \`$1' is $msg. You should only need it if
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
|
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
|
||||||
to install the \`Automake' and \`Perl' packages. Grab them from
|
to install the \`Automake' and \`Perl' packages. Grab them from
|
||||||
any GNU archive site."
|
any GNU archive site."
|
||||||
touch aclocal.m4
|
touch aclocal.m4
|
||||||
;;
|
;;
|
||||||
|
|
||||||
autoconf*)
|
autoconf)
|
||||||
echo 1>&2 "\
|
echo 1>&2 "\
|
||||||
WARNING: \`$1' is $msg. You should only need it if
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
you modified \`${configure_ac}'. You might want to install the
|
you modified \`${configure_ac}'. You might want to install the
|
||||||
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
|
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
|
||||||
archive site."
|
archive site."
|
||||||
touch configure
|
touch configure
|
||||||
;;
|
;;
|
||||||
|
|
||||||
autoheader*)
|
autoheader)
|
||||||
echo 1>&2 "\
|
echo 1>&2 "\
|
||||||
WARNING: \`$1' is $msg. You should only need it if
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
you modified \`acconfig.h' or \`${configure_ac}'. You might want
|
you modified \`acconfig.h' or \`${configure_ac}'. You might want
|
||||||
to install the \`Autoconf' and \`GNU m4' packages. Grab them
|
to install the \`Autoconf' and \`GNU m4' packages. Grab them
|
||||||
from any GNU archive site."
|
from any GNU archive site."
|
||||||
@@ -175,7 +115,7 @@ WARNING: \`$1' is $msg. You should only need it if
|
|||||||
test -z "$files" && files="config.h"
|
test -z "$files" && files="config.h"
|
||||||
touch_files=
|
touch_files=
|
||||||
for f in $files; do
|
for f in $files; do
|
||||||
case $f in
|
case "$f" in
|
||||||
*:*) touch_files="$touch_files "`echo "$f" |
|
*:*) touch_files="$touch_files "`echo "$f" |
|
||||||
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
|
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
|
||||||
*) touch_files="$touch_files $f.in";;
|
*) touch_files="$touch_files $f.in";;
|
||||||
@@ -184,9 +124,9 @@ WARNING: \`$1' is $msg. You should only need it if
|
|||||||
touch $touch_files
|
touch $touch_files
|
||||||
;;
|
;;
|
||||||
|
|
||||||
automake*)
|
automake)
|
||||||
echo 1>&2 "\
|
echo 1>&2 "\
|
||||||
WARNING: \`$1' is $msg. You should only need it if
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
|
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
|
||||||
You might want to install the \`Automake' and \`Perl' packages.
|
You might want to install the \`Automake' and \`Perl' packages.
|
||||||
Grab them from any GNU archive site."
|
Grab them from any GNU archive site."
|
||||||
@@ -195,153 +135,128 @@ WARNING: \`$1' is $msg. You should only need it if
|
|||||||
while read f; do touch "$f"; done
|
while read f; do touch "$f"; done
|
||||||
;;
|
;;
|
||||||
|
|
||||||
autom4te*)
|
bison|yacc)
|
||||||
echo 1>&2 "\
|
echo 1>&2 "\
|
||||||
WARNING: \`$1' is needed, but is $msg.
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
You might have modified some files without having the
|
|
||||||
proper tools for further handling them.
|
|
||||||
You can get \`$1' as part of \`Autoconf' from any GNU
|
|
||||||
archive site."
|
|
||||||
|
|
||||||
file=`echo "$*" | sed -n "$sed_output"`
|
|
||||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
|
||||||
if test -f "$file"; then
|
|
||||||
touch $file
|
|
||||||
else
|
|
||||||
test -z "$file" || exec >$file
|
|
||||||
echo "#! /bin/sh"
|
|
||||||
echo "# Created by GNU Automake missing as a replacement of"
|
|
||||||
echo "# $ $@"
|
|
||||||
echo "exit 0"
|
|
||||||
chmod +x $file
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
bison*|yacc*)
|
|
||||||
echo 1>&2 "\
|
|
||||||
WARNING: \`$1' $msg. You should only need it if
|
|
||||||
you modified a \`.y' file. You may need the \`Bison' package
|
you modified a \`.y' file. You may need the \`Bison' package
|
||||||
in order for those modifications to take effect. You can get
|
in order for those modifications to take effect. You can get
|
||||||
\`Bison' from any GNU archive site."
|
\`Bison' from any GNU archive site."
|
||||||
rm -f y.tab.c y.tab.h
|
rm -f y.tab.c y.tab.h
|
||||||
if test $# -ne 1; then
|
if [ $# -ne 1 ]; then
|
||||||
eval LASTARG="\${$#}"
|
eval LASTARG="\${$#}"
|
||||||
case $LASTARG in
|
case "$LASTARG" in
|
||||||
*.y)
|
*.y)
|
||||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
||||||
if test -f "$SRCFILE"; then
|
if [ -f "$SRCFILE" ]; then
|
||||||
cp "$SRCFILE" y.tab.c
|
cp "$SRCFILE" y.tab.c
|
||||||
fi
|
fi
|
||||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
||||||
if test -f "$SRCFILE"; then
|
if [ -f "$SRCFILE" ]; then
|
||||||
cp "$SRCFILE" y.tab.h
|
cp "$SRCFILE" y.tab.h
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
if test ! -f y.tab.h; then
|
if [ ! -f y.tab.h ]; then
|
||||||
echo >y.tab.h
|
echo >y.tab.h
|
||||||
fi
|
fi
|
||||||
if test ! -f y.tab.c; then
|
if [ ! -f y.tab.c ]; then
|
||||||
echo 'main() { return 0; }' >y.tab.c
|
echo 'main() { return 0; }' >y.tab.c
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
lex*|flex*)
|
lex|flex)
|
||||||
echo 1>&2 "\
|
echo 1>&2 "\
|
||||||
WARNING: \`$1' is $msg. You should only need it if
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
you modified a \`.l' file. You may need the \`Flex' package
|
you modified a \`.l' file. You may need the \`Flex' package
|
||||||
in order for those modifications to take effect. You can get
|
in order for those modifications to take effect. You can get
|
||||||
\`Flex' from any GNU archive site."
|
\`Flex' from any GNU archive site."
|
||||||
rm -f lex.yy.c
|
rm -f lex.yy.c
|
||||||
if test $# -ne 1; then
|
if [ $# -ne 1 ]; then
|
||||||
eval LASTARG="\${$#}"
|
eval LASTARG="\${$#}"
|
||||||
case $LASTARG in
|
case "$LASTARG" in
|
||||||
*.l)
|
*.l)
|
||||||
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
||||||
if test -f "$SRCFILE"; then
|
if [ -f "$SRCFILE" ]; then
|
||||||
cp "$SRCFILE" lex.yy.c
|
cp "$SRCFILE" lex.yy.c
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
if test ! -f lex.yy.c; then
|
if [ ! -f lex.yy.c ]; then
|
||||||
echo 'main() { return 0; }' >lex.yy.c
|
echo 'main() { return 0; }' >lex.yy.c
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
help2man*)
|
help2man)
|
||||||
echo 1>&2 "\
|
echo 1>&2 "\
|
||||||
WARNING: \`$1' is $msg. You should only need it if
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
you modified a dependency of a manual page. You may need the
|
you modified a dependency of a manual page. You may need the
|
||||||
\`Help2man' package in order for those modifications to take
|
\`Help2man' package in order for those modifications to take
|
||||||
effect. You can get \`Help2man' from any GNU archive site."
|
effect. You can get \`Help2man' from any GNU archive site."
|
||||||
|
|
||||||
file=`echo "$*" | sed -n "$sed_output"`
|
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
if test -z "$file"; then
|
||||||
if test -f "$file"; then
|
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
|
||||||
|
fi
|
||||||
|
if [ -f "$file" ]; then
|
||||||
touch $file
|
touch $file
|
||||||
else
|
else
|
||||||
test -z "$file" || exec >$file
|
test -z "$file" || exec >$file
|
||||||
echo ".ab help2man is required to generate this page"
|
echo ".ab help2man is required to generate this page"
|
||||||
exit $?
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
makeinfo*)
|
makeinfo)
|
||||||
|
if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
|
||||||
|
# We have makeinfo, but it failed.
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo 1>&2 "\
|
echo 1>&2 "\
|
||||||
WARNING: \`$1' is $msg. You should only need it if
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
you modified a \`.texi' or \`.texinfo' file, or any other file
|
you modified a \`.texi' or \`.texinfo' file, or any other file
|
||||||
indirectly affecting the aspect of the manual. The spurious
|
indirectly affecting the aspect of the manual. The spurious
|
||||||
call might also be the consequence of using a buggy \`make' (AIX,
|
call might also be the consequence of using a buggy \`make' (AIX,
|
||||||
DU, IRIX). You might want to install the \`Texinfo' package or
|
DU, IRIX). You might want to install the \`Texinfo' package or
|
||||||
the \`GNU make' package. Grab either from any GNU archive site."
|
the \`GNU make' package. Grab either from any GNU archive site."
|
||||||
# The file to touch is that specified with -o ...
|
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||||
file=`echo "$*" | sed -n "$sed_output"`
|
|
||||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
|
||||||
if test -z "$file"; then
|
if test -z "$file"; then
|
||||||
# ... or it is the one specified with @setfilename ...
|
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
||||||
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
|
||||||
file=`sed -n '
|
|
||||||
/^@setfilename/{
|
|
||||||
s/.* \([^ ]*\) *$/\1/
|
|
||||||
p
|
|
||||||
q
|
|
||||||
}' $infile`
|
|
||||||
# ... or it is derived from the source name (dir/f.texi becomes f.info)
|
|
||||||
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
|
|
||||||
fi
|
fi
|
||||||
# If the file does not exist, the user really needs makeinfo;
|
|
||||||
# let's fail without touching anything.
|
|
||||||
test -f $file || exit 1
|
|
||||||
touch $file
|
touch $file
|
||||||
;;
|
;;
|
||||||
|
|
||||||
tar*)
|
tar)
|
||||||
shift
|
shift
|
||||||
|
if test -n "$run"; then
|
||||||
|
echo 1>&2 "ERROR: \`tar' requires --run"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# We have already tried tar in the generic part.
|
# We have already tried tar in the generic part.
|
||||||
# Look for gnutar/gtar before invocation to avoid ugly error
|
# Look for gnutar/gtar before invocation to avoid ugly error
|
||||||
# messages.
|
# messages.
|
||||||
if (gnutar --version > /dev/null 2>&1); then
|
if (gnutar --version > /dev/null 2>&1); then
|
||||||
gnutar "$@" && exit 0
|
gnutar ${1+"$@"} && exit 0
|
||||||
fi
|
fi
|
||||||
if (gtar --version > /dev/null 2>&1); then
|
if (gtar --version > /dev/null 2>&1); then
|
||||||
gtar "$@" && exit 0
|
gtar ${1+"$@"} && exit 0
|
||||||
fi
|
fi
|
||||||
firstarg="$1"
|
firstarg="$1"
|
||||||
if shift; then
|
if shift; then
|
||||||
case $firstarg in
|
case "$firstarg" in
|
||||||
*o*)
|
*o*)
|
||||||
firstarg=`echo "$firstarg" | sed s/o//`
|
firstarg=`echo "$firstarg" | sed s/o//`
|
||||||
tar "$firstarg" "$@" && exit 0
|
tar "$firstarg" ${1+"$@"} && exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
case $firstarg in
|
case "$firstarg" in
|
||||||
*h*)
|
*h*)
|
||||||
firstarg=`echo "$firstarg" | sed s/h//`
|
firstarg=`echo "$firstarg" | sed s/h//`
|
||||||
tar "$firstarg" "$@" && exit 0
|
tar "$firstarg" ${1+"$@"} && exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
@@ -355,10 +270,10 @@ WARNING: I can't seem to be able to run \`tar' with the given arguments.
|
|||||||
|
|
||||||
*)
|
*)
|
||||||
echo 1>&2 "\
|
echo 1>&2 "\
|
||||||
WARNING: \`$1' is needed, and is $msg.
|
WARNING: \`$1' is needed, and you do not seem to have it handy on your
|
||||||
You might have modified some files without having the
|
system. You might have modified some files without having the
|
||||||
proper tools for further handling them. Check the \`README' file,
|
proper tools for further handling them. Check the \`README' file,
|
||||||
it often tells you about the needed prerequisites for installing
|
it often tells you about the needed prerequirements for installing
|
||||||
this package. You may also peek at any GNU archive site, in case
|
this package. You may also peek at any GNU archive site, in case
|
||||||
some other package would contain this missing \`$1' program."
|
some other package would contain this missing \`$1' program."
|
||||||
exit 1
|
exit 1
|
||||||
@@ -366,11 +281,3 @@ WARNING: \`$1' is needed, and is $msg.
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
# Local variables:
|
|
||||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
|
||||||
# time-stamp-start: "scriptversion="
|
|
||||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
|
||||||
# time-stamp-time-zone: "UTC"
|
|
||||||
# time-stamp-end: "; # UTC"
|
|
||||||
# End:
|
|
||||||
|
|||||||
40
mkinstalldirs
Executable file
@@ -0,0 +1,40 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
# mkinstalldirs --- make directory hierarchy
|
||||||
|
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
|
||||||
|
# Created: 1993-05-16
|
||||||
|
# Public domain
|
||||||
|
|
||||||
|
# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
|
||||||
|
|
||||||
|
errstatus=0
|
||||||
|
|
||||||
|
for file
|
||||||
|
do
|
||||||
|
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
|
||||||
|
shift
|
||||||
|
|
||||||
|
pathcomp=
|
||||||
|
for d
|
||||||
|
do
|
||||||
|
pathcomp="$pathcomp$d"
|
||||||
|
case "$pathcomp" in
|
||||||
|
-* ) pathcomp=./$pathcomp ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if test ! -d "$pathcomp"; then
|
||||||
|
echo "mkdir $pathcomp"
|
||||||
|
|
||||||
|
mkdir "$pathcomp" || lasterr=$?
|
||||||
|
|
||||||
|
if test ! -d "$pathcomp"; then
|
||||||
|
errstatus=$lasterr
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
pathcomp="$pathcomp/"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
exit $errstatus
|
||||||
|
|
||||||
|
# mkinstalldirs ends here
|
||||||
4
png.5
@@ -1,4 +1,4 @@
|
|||||||
.TH PNG 5 "March 31, 2011"
|
.TH PNG 5 "September 26, 2007"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
png \- Portable Network Graphics (PNG) format
|
png \- Portable Network Graphics (PNG) format
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
@@ -18,7 +18,7 @@ gamma and chromaticity data for improved color matching on heterogeneous
|
|||||||
platforms.
|
platforms.
|
||||||
|
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.BR "libpng"(3), " libpngpf"(3), " zlib"(3), " deflate"(5), " " and " zlib"(5)
|
.IR libpng(3) ", " zlib(3) ", " deflate(5) ", and " zlib(5)
|
||||||
.LP
|
.LP
|
||||||
PNG specification (second edition), November 2003:
|
PNG specification (second edition), November 2003:
|
||||||
.IP
|
.IP
|
||||||
|
|||||||
157
pngdebug.h
@@ -1,157 +0,0 @@
|
|||||||
|
|
||||||
/* pngdebug.h - Debugging macros for libpng, also used in pngtest.c
|
|
||||||
*
|
|
||||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
|
||||||
*
|
|
||||||
* Last changed in libpng 1.5.0 [January 6, 2011]
|
|
||||||
*
|
|
||||||
* This code is released under the libpng license.
|
|
||||||
* For conditions of distribution and use, see the disclaimer
|
|
||||||
* and license in png.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Define PNG_DEBUG at compile time for debugging information. Higher
|
|
||||||
* numbers for PNG_DEBUG mean more debugging information. This has
|
|
||||||
* only been added since version 0.95 so it is not implemented throughout
|
|
||||||
* libpng yet, but more support will be added as needed.
|
|
||||||
*
|
|
||||||
* png_debug[1-2]?(level, message ,arg{0-2})
|
|
||||||
* Expands to a statement (either a simple expression or a compound
|
|
||||||
* do..while(0) statement) that outputs a message with parameter
|
|
||||||
* substitution if PNG_DEBUG is defined to 2 or more. If PNG_DEBUG
|
|
||||||
* is undefined, 0 or 1 every png_debug expands to a simple expression
|
|
||||||
* (actually ((void)0)).
|
|
||||||
*
|
|
||||||
* level: level of detail of message, starting at 0. A level 'n'
|
|
||||||
* message is preceded by 'n' tab characters (not implemented
|
|
||||||
* on Microsoft compilers unless PNG_DEBUG_FILE is also
|
|
||||||
* defined, to allow debug DLL compilation with no standard IO).
|
|
||||||
* message: a printf(3) style text string. A trailing '\n' is added
|
|
||||||
* to the message.
|
|
||||||
* arg: 0 to 2 arguments for printf(3) style substitution in message.
|
|
||||||
*/
|
|
||||||
#ifndef PNGDEBUG_H
|
|
||||||
#define PNGDEBUG_H
|
|
||||||
/* These settings control the formatting of messages in png.c and pngerror.c */
|
|
||||||
/* Moved to pngdebug.h at 1.5.0 */
|
|
||||||
# ifndef PNG_LITERAL_SHARP
|
|
||||||
# define PNG_LITERAL_SHARP 0x23
|
|
||||||
# endif
|
|
||||||
# ifndef PNG_LITERAL_LEFT_SQUARE_BRACKET
|
|
||||||
# define PNG_LITERAL_LEFT_SQUARE_BRACKET 0x5b
|
|
||||||
# endif
|
|
||||||
# ifndef PNG_LITERAL_RIGHT_SQUARE_BRACKET
|
|
||||||
# define PNG_LITERAL_RIGHT_SQUARE_BRACKET 0x5d
|
|
||||||
# endif
|
|
||||||
# ifndef PNG_STRING_NEWLINE
|
|
||||||
# define PNG_STRING_NEWLINE "\n"
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#ifdef PNG_DEBUG
|
|
||||||
# if (PNG_DEBUG > 0)
|
|
||||||
# if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER)
|
|
||||||
# include <crtdbg.h>
|
|
||||||
# if (PNG_DEBUG > 1)
|
|
||||||
# ifndef _DEBUG
|
|
||||||
# define _DEBUG
|
|
||||||
# endif
|
|
||||||
# ifndef png_debug
|
|
||||||
# define png_debug(l,m) _RPT0(_CRT_WARN,m PNG_STRING_NEWLINE)
|
|
||||||
# endif
|
|
||||||
# ifndef png_debug1
|
|
||||||
# define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m PNG_STRING_NEWLINE,p1)
|
|
||||||
# endif
|
|
||||||
# ifndef png_debug2
|
|
||||||
# define png_debug2(l,m,p1,p2) \
|
|
||||||
_RPT2(_CRT_WARN,m PNG_STRING_NEWLINE,p1,p2)
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
# else /* PNG_DEBUG_FILE || !_MSC_VER */
|
|
||||||
# ifndef PNG_STDIO_SUPPORTED
|
|
||||||
# include <stdio.h> /* not included yet */
|
|
||||||
# endif
|
|
||||||
# ifndef PNG_DEBUG_FILE
|
|
||||||
# define PNG_DEBUG_FILE stderr
|
|
||||||
# endif /* PNG_DEBUG_FILE */
|
|
||||||
|
|
||||||
# if (PNG_DEBUG > 1)
|
|
||||||
/* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on
|
|
||||||
* non-ISO compilers
|
|
||||||
*/
|
|
||||||
# ifdef __STDC__
|
|
||||||
# ifndef png_debug
|
|
||||||
# define png_debug(l,m) \
|
|
||||||
do { \
|
|
||||||
int num_tabs=l; \
|
|
||||||
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
|
|
||||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
|
|
||||||
} while (0)
|
|
||||||
# endif
|
|
||||||
# ifndef png_debug1
|
|
||||||
# define png_debug1(l,m,p1) \
|
|
||||||
do { \
|
|
||||||
int num_tabs=l; \
|
|
||||||
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
|
|
||||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
|
|
||||||
} while (0)
|
|
||||||
# endif
|
|
||||||
# ifndef png_debug2
|
|
||||||
# define png_debug2(l,m,p1,p2) \
|
|
||||||
do { \
|
|
||||||
int num_tabs=l; \
|
|
||||||
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
|
|
||||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
|
|
||||||
} while (0)
|
|
||||||
# endif
|
|
||||||
# else /* __STDC __ */
|
|
||||||
# ifndef png_debug
|
|
||||||
# define png_debug(l,m) \
|
|
||||||
do { \
|
|
||||||
int num_tabs=l; \
|
|
||||||
char format[256]; \
|
|
||||||
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
|
|
||||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
|
|
||||||
m,PNG_STRING_NEWLINE); \
|
|
||||||
fprintf(PNG_DEBUG_FILE,format); \
|
|
||||||
} while (0)
|
|
||||||
# endif
|
|
||||||
# ifndef png_debug1
|
|
||||||
# define png_debug1(l,m,p1) \
|
|
||||||
do { \
|
|
||||||
int num_tabs=l; \
|
|
||||||
char format[256]; \
|
|
||||||
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
|
|
||||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
|
|
||||||
m,PNG_STRING_NEWLINE); \
|
|
||||||
fprintf(PNG_DEBUG_FILE,format,p1); \
|
|
||||||
} while (0)
|
|
||||||
# endif
|
|
||||||
# ifndef png_debug2
|
|
||||||
# define png_debug2(l,m,p1,p2) \
|
|
||||||
do { \
|
|
||||||
int num_tabs=l; \
|
|
||||||
char format[256]; \
|
|
||||||
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
|
|
||||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
|
|
||||||
m,PNG_STRING_NEWLINE); \
|
|
||||||
fprintf(PNG_DEBUG_FILE,format,p1,p2); \
|
|
||||||
} while (0)
|
|
||||||
# endif
|
|
||||||
# endif /* __STDC __ */
|
|
||||||
# endif /* (PNG_DEBUG > 1) */
|
|
||||||
|
|
||||||
# endif /* _MSC_VER */
|
|
||||||
# endif /* (PNG_DEBUG > 0) */
|
|
||||||
#endif /* PNG_DEBUG */
|
|
||||||
#ifndef png_debug
|
|
||||||
# define png_debug(l, m) ((void)0)
|
|
||||||
#endif
|
|
||||||
#ifndef png_debug1
|
|
||||||
# define png_debug1(l, m, p1) ((void)0)
|
|
||||||
#endif
|
|
||||||
#ifndef png_debug2
|
|
||||||
# define png_debug2(l, m, p1, p2) ((void)0)
|
|
||||||
#endif
|
|
||||||
#endif /* PNGDEBUG_H */
|
|
||||||
386
pngerror.c
@@ -1,79 +1,72 @@
|
|||||||
|
|
||||||
/* pngerror.c - stub functions for i/o and memory allocation
|
/* pngerror.c - stub functions for i/o and memory allocation
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.5.1 [February 3, 2011]
|
* Last changed in libpng 1.2.20 September 26, 2007
|
||||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
* This code is released under the libpng license.
|
|
||||||
* For conditions of distribution and use, see the disclaimer
|
|
||||||
* and license in png.h
|
|
||||||
*
|
|
||||||
* This file provides a location for all error handling. Users who
|
* This file provides a location for all error handling. Users who
|
||||||
* need special error handling are expected to write replacement functions
|
* need special error handling are expected to write replacement functions
|
||||||
* and use png_set_error_fn() to use those functions. See the instructions
|
* and use png_set_error_fn() to use those functions. See the instructions
|
||||||
* at each function.
|
* at each function.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "pngpriv.h"
|
#define PNG_INTERNAL
|
||||||
|
#include "png.h"
|
||||||
|
|
||||||
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
||||||
|
static void /* PRIVATE */
|
||||||
static PNG_FUNCTION(void, png_default_error,PNGARG((png_structp png_ptr,
|
png_default_error PNGARG((png_structp png_ptr,
|
||||||
png_const_charp error_message)),PNG_NORETURN);
|
png_const_charp error_message));
|
||||||
|
#ifndef PNG_NO_WARNINGS
|
||||||
#ifdef PNG_WARNINGS_SUPPORTED
|
|
||||||
static void /* PRIVATE */
|
static void /* PRIVATE */
|
||||||
png_default_warning PNGARG((png_structp png_ptr,
|
png_default_warning PNGARG((png_structp png_ptr,
|
||||||
png_const_charp warning_message));
|
png_const_charp warning_message));
|
||||||
#endif /* PNG_WARNINGS_SUPPORTED */
|
#endif /* PNG_NO_WARNINGS */
|
||||||
|
|
||||||
/* This function is called whenever there is a fatal error. This function
|
/* This function is called whenever there is a fatal error. This function
|
||||||
* should not be changed. If there is a need to handle errors differently,
|
* should not be changed. If there is a need to handle errors differently,
|
||||||
* you should supply a replacement error function and use png_set_error_fn()
|
* you should supply a replacement error function and use png_set_error_fn()
|
||||||
* to replace the error function at run-time.
|
* to replace the error function at run-time.
|
||||||
*/
|
*/
|
||||||
#ifdef PNG_ERROR_TEXT_SUPPORTED
|
#ifndef PNG_NO_ERROR_TEXT
|
||||||
PNG_FUNCTION(void,PNGAPI
|
void PNGAPI
|
||||||
png_error,(png_structp png_ptr, png_const_charp error_message),PNG_NORETURN)
|
png_error(png_structp png_ptr, png_const_charp error_message)
|
||||||
{
|
{
|
||||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
char msg[16];
|
char msg[16];
|
||||||
if (png_ptr != NULL)
|
if (png_ptr != NULL)
|
||||||
{
|
{
|
||||||
if (png_ptr->flags&
|
if (png_ptr->flags&
|
||||||
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
|
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
|
||||||
{
|
{
|
||||||
if (*error_message == PNG_LITERAL_SHARP)
|
if (*error_message == '#')
|
||||||
{
|
{
|
||||||
/* Strip "#nnnn " from beginning of error message. */
|
int offset;
|
||||||
int offset;
|
for (offset=1; offset<15; offset++)
|
||||||
for (offset = 1; offset<15; offset++)
|
if (*(error_message+offset) == ' ')
|
||||||
if (error_message[offset] == ' ')
|
|
||||||
break;
|
break;
|
||||||
|
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
|
||||||
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
|
{
|
||||||
{
|
int i;
|
||||||
int i;
|
for (i=0; i<offset-1; i++)
|
||||||
for (i = 0; i < offset - 1; i++)
|
msg[i]=error_message[i+1];
|
||||||
msg[i] = error_message[i + 1];
|
msg[i]='\0';
|
||||||
msg[i - 1] = '\0';
|
error_message=msg;
|
||||||
error_message = msg;
|
}
|
||||||
}
|
else
|
||||||
|
error_message+=offset;
|
||||||
else
|
}
|
||||||
error_message += offset;
|
else
|
||||||
}
|
{
|
||||||
|
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
|
||||||
else
|
{
|
||||||
{
|
msg[0]='0';
|
||||||
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
|
msg[1]='\0';
|
||||||
{
|
error_message=msg;
|
||||||
msg[0] = '0';
|
}
|
||||||
msg[1] = '\0';
|
|
||||||
error_message = msg;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -86,8 +79,8 @@ png_error,(png_structp png_ptr, png_const_charp error_message),PNG_NORETURN)
|
|||||||
png_default_error(png_ptr, error_message);
|
png_default_error(png_ptr, error_message);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
PNG_FUNCTION(void,PNGAPI
|
void PNGAPI
|
||||||
png_err,(png_structp png_ptr),PNG_NORETURN)
|
png_err(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && png_ptr->error_fn != NULL)
|
if (png_ptr != NULL && png_ptr->error_fn != NULL)
|
||||||
(*(png_ptr->error_fn))(png_ptr, '\0');
|
(*(png_ptr->error_fn))(png_ptr, '\0');
|
||||||
@@ -96,9 +89,9 @@ png_err,(png_structp png_ptr),PNG_NORETURN)
|
|||||||
use the default handler, which will not return. */
|
use the default handler, which will not return. */
|
||||||
png_default_error(png_ptr, '\0');
|
png_default_error(png_ptr, '\0');
|
||||||
}
|
}
|
||||||
#endif /* PNG_ERROR_TEXT_SUPPORTED */
|
#endif /* PNG_NO_ERROR_TEXT */
|
||||||
|
|
||||||
#ifdef PNG_WARNINGS_SUPPORTED
|
#ifndef PNG_NO_WARNINGS
|
||||||
/* This function is called whenever there is a non-fatal error. This function
|
/* This function is called whenever there is a non-fatal error. This function
|
||||||
* should not be changed. If there is a need to handle warnings differently,
|
* should not be changed. If there is a need to handle warnings differently,
|
||||||
* you should supply a replacement warning function and use
|
* you should supply a replacement warning function and use
|
||||||
@@ -112,34 +105,24 @@ png_warning(png_structp png_ptr, png_const_charp warning_message)
|
|||||||
{
|
{
|
||||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
if (png_ptr->flags&
|
if (png_ptr->flags&
|
||||||
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
|
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (*warning_message == PNG_LITERAL_SHARP)
|
if (*warning_message == '#')
|
||||||
{
|
{
|
||||||
for (offset = 1; offset < 15; offset++)
|
for (offset=1; offset<15; offset++)
|
||||||
if (warning_message[offset] == ' ')
|
if (*(warning_message+offset) == ' ')
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (png_ptr != NULL && png_ptr->warning_fn != NULL)
|
||||||
|
(*(png_ptr->warning_fn))(png_ptr, warning_message+offset);
|
||||||
}
|
}
|
||||||
if (png_ptr != NULL && png_ptr->warning_fn != NULL)
|
|
||||||
(*(png_ptr->warning_fn))(png_ptr, warning_message + offset);
|
|
||||||
else
|
else
|
||||||
png_default_warning(png_ptr, warning_message + offset);
|
png_default_warning(png_ptr, warning_message+offset);
|
||||||
}
|
}
|
||||||
#endif /* PNG_WARNINGS_SUPPORTED */
|
#endif /* PNG_NO_WARNINGS */
|
||||||
|
|
||||||
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
|
||||||
void PNGAPI
|
|
||||||
png_benign_error(png_structp png_ptr, png_const_charp error_message)
|
|
||||||
{
|
|
||||||
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
|
|
||||||
png_warning(png_ptr, error_message);
|
|
||||||
else
|
|
||||||
png_error(png_ptr, error_message);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* These utilities are used internally to build an error message that relates
|
/* These utilities are used internally to build an error message that relates
|
||||||
* to the current chunk. The chunk name comes from png_ptr->chunk_name,
|
* to the current chunk. The chunk name comes from png_ptr->chunk_name,
|
||||||
@@ -153,11 +136,10 @@ static PNG_CONST char png_digit[16] = {
|
|||||||
'A', 'B', 'C', 'D', 'E', 'F'
|
'A', 'B', 'C', 'D', 'E', 'F'
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PNG_MAX_ERROR_TEXT 64
|
#if !defined(PNG_NO_WARNINGS) || !defined(PNG_NO_ERROR_TEXT)
|
||||||
#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED)
|
|
||||||
static void /* PRIVATE */
|
static void /* PRIVATE */
|
||||||
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
||||||
error_message)
|
error_message)
|
||||||
{
|
{
|
||||||
int iout = 0, iin = 0;
|
int iout = 0, iin = 0;
|
||||||
|
|
||||||
@@ -166,12 +148,11 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
|||||||
int c = png_ptr->chunk_name[iin++];
|
int c = png_ptr->chunk_name[iin++];
|
||||||
if (isnonalpha(c))
|
if (isnonalpha(c))
|
||||||
{
|
{
|
||||||
buffer[iout++] = PNG_LITERAL_LEFT_SQUARE_BRACKET;
|
buffer[iout++] = '[';
|
||||||
buffer[iout++] = png_digit[(c & 0xf0) >> 4];
|
buffer[iout++] = png_digit[(c & 0xf0) >> 4];
|
||||||
buffer[iout++] = png_digit[c & 0x0f];
|
buffer[iout++] = png_digit[c & 0x0f];
|
||||||
buffer[iout++] = PNG_LITERAL_RIGHT_SQUARE_BRACKET;
|
buffer[iout++] = ']';
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buffer[iout++] = (png_byte)c;
|
buffer[iout++] = (png_byte)c;
|
||||||
@@ -179,177 +160,104 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (error_message == NULL)
|
if (error_message == NULL)
|
||||||
buffer[iout] = '\0';
|
buffer[iout] = 0;
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buffer[iout++] = ':';
|
buffer[iout++] = ':';
|
||||||
buffer[iout++] = ' ';
|
buffer[iout++] = ' ';
|
||||||
png_memcpy(buffer + iout, error_message, PNG_MAX_ERROR_TEXT);
|
png_strncpy(buffer+iout, error_message, 63);
|
||||||
buffer[iout + PNG_MAX_ERROR_TEXT - 1] = '\0';
|
buffer[iout+63] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_WARNINGS_SUPPORTED || PNG_ERROR_TEXT_SUPPORTED */
|
|
||||||
|
|
||||||
#if defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)
|
#ifdef PNG_READ_SUPPORTED
|
||||||
PNG_FUNCTION(void,PNGAPI
|
void PNGAPI
|
||||||
png_chunk_error,(png_structp png_ptr, png_const_charp error_message),
|
png_chunk_error(png_structp png_ptr, png_const_charp error_message)
|
||||||
PNG_NORETURN)
|
|
||||||
{
|
{
|
||||||
char msg[18+PNG_MAX_ERROR_TEXT];
|
char msg[18+64];
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
png_error(png_ptr, error_message);
|
png_error(png_ptr, error_message);
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_format_buffer(png_ptr, msg, error_message);
|
png_format_buffer(png_ptr, msg, error_message);
|
||||||
png_error(png_ptr, msg);
|
png_error(png_ptr, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_READ_SUPPORTED && PNG_ERROR_TEXT_SUPPORTED */
|
#endif /* PNG_READ_SUPPORTED */
|
||||||
|
#endif /* !defined(PNG_NO_WARNINGS) || !defined(PNG_NO_ERROR_TEXT) */
|
||||||
|
|
||||||
#ifdef PNG_WARNINGS_SUPPORTED
|
#ifndef PNG_NO_WARNINGS
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
|
png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
|
||||||
{
|
{
|
||||||
char msg[18+PNG_MAX_ERROR_TEXT];
|
char msg[18+64];
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
png_warning(png_ptr, warning_message);
|
png_warning(png_ptr, warning_message);
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_format_buffer(png_ptr, msg, warning_message);
|
png_format_buffer(png_ptr, msg, warning_message);
|
||||||
png_warning(png_ptr, msg);
|
png_warning(png_ptr, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_WARNINGS_SUPPORTED */
|
#endif /* PNG_NO_WARNINGS */
|
||||||
|
|
||||||
#ifdef PNG_READ_SUPPORTED
|
|
||||||
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
|
||||||
void PNGAPI
|
|
||||||
png_chunk_benign_error(png_structp png_ptr, png_const_charp error_message)
|
|
||||||
{
|
|
||||||
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
|
|
||||||
png_chunk_warning(png_ptr, error_message);
|
|
||||||
|
|
||||||
else
|
|
||||||
png_chunk_error(png_ptr, error_message);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* PNG_READ_SUPPORTED */
|
|
||||||
|
|
||||||
#ifdef PNG_ERROR_TEXT_SUPPORTED
|
|
||||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
|
||||||
PNG_FUNCTION(void,
|
|
||||||
png_fixed_error,(png_structp png_ptr, png_const_charp name),PNG_NORETURN)
|
|
||||||
{
|
|
||||||
# define fixed_message "fixed point overflow in "
|
|
||||||
# define fixed_message_ln ((sizeof fixed_message)-1)
|
|
||||||
int iin;
|
|
||||||
char msg[fixed_message_ln+PNG_MAX_ERROR_TEXT];
|
|
||||||
png_memcpy(msg, fixed_message, fixed_message_ln);
|
|
||||||
iin = 0;
|
|
||||||
if (name != NULL) while (iin < (PNG_MAX_ERROR_TEXT-1) && name[iin] != 0)
|
|
||||||
{
|
|
||||||
msg[fixed_message_ln + iin] = name[iin];
|
|
||||||
++iin;
|
|
||||||
}
|
|
||||||
msg[fixed_message_ln + iin] = 0;
|
|
||||||
png_error(png_ptr, msg);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
|
||||||
/* This API only exists if ANSI-C style error handling is used,
|
|
||||||
* otherwise it is necessary for png_default_error to be overridden.
|
|
||||||
*/
|
|
||||||
jmp_buf* PNGAPI
|
|
||||||
png_set_longjmp_fn(png_structp png_ptr, png_longjmp_ptr longjmp_fn,
|
|
||||||
size_t jmp_buf_size)
|
|
||||||
{
|
|
||||||
if (png_ptr == NULL || jmp_buf_size != png_sizeof(jmp_buf))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
png_ptr->longjmp_fn = longjmp_fn;
|
|
||||||
return &png_ptr->png_jmpbuf;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* This is the default error handling function. Note that replacements for
|
/* This is the default error handling function. Note that replacements for
|
||||||
* this function MUST NOT RETURN, or the program will likely crash. This
|
* this function MUST NOT RETURN, or the program will likely crash. This
|
||||||
* function is used by default, or if the program supplies NULL for the
|
* function is used by default, or if the program supplies NULL for the
|
||||||
* error function pointer in png_set_error_fn().
|
* error function pointer in png_set_error_fn().
|
||||||
*/
|
*/
|
||||||
static PNG_FUNCTION(void /* PRIVATE */,
|
static void /* PRIVATE */
|
||||||
png_default_error,(png_structp png_ptr, png_const_charp error_message),
|
png_default_error(png_structp png_ptr, png_const_charp error_message)
|
||||||
PNG_NORETURN)
|
|
||||||
{
|
{
|
||||||
#ifdef PNG_CONSOLE_IO_SUPPORTED
|
#ifndef PNG_NO_CONSOLE_IO
|
||||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
if (*error_message == PNG_LITERAL_SHARP)
|
if (*error_message == '#')
|
||||||
{
|
{
|
||||||
/* Strip "#nnnn " from beginning of error message. */
|
int offset;
|
||||||
int offset;
|
char error_number[16];
|
||||||
char error_number[16];
|
for (offset=0; offset<15; offset++)
|
||||||
for (offset = 0; offset<15; offset++)
|
{
|
||||||
{
|
error_number[offset] = *(error_message+offset+1);
|
||||||
error_number[offset] = error_message[offset + 1];
|
if (*(error_message+offset) == ' ')
|
||||||
if (error_message[offset] == ' ')
|
break;
|
||||||
break;
|
}
|
||||||
}
|
if((offset > 1) && (offset < 15))
|
||||||
|
{
|
||||||
if ((offset > 1) && (offset < 15))
|
error_number[offset-1]='\0';
|
||||||
{
|
fprintf(stderr, "libpng error no. %s: %s\n", error_number,
|
||||||
error_number[offset - 1] = '\0';
|
error_message+offset);
|
||||||
fprintf(stderr, "libpng error no. %s: %s",
|
}
|
||||||
error_number, error_message + offset + 1);
|
else
|
||||||
fprintf(stderr, PNG_STRING_NEWLINE);
|
fprintf(stderr, "libpng error: %s, offset=%d\n", error_message,offset);
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fprintf(stderr, "libpng error: %s, offset=%d",
|
|
||||||
error_message, offset);
|
|
||||||
fprintf(stderr, PNG_STRING_NEWLINE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
fprintf(stderr, "libpng error: %s\n", error_message);
|
||||||
fprintf(stderr, "libpng error: %s", error_message);
|
|
||||||
fprintf(stderr, PNG_STRING_NEWLINE);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
#ifndef PNG_CONSOLE_IO_SUPPORTED
|
|
||||||
PNG_UNUSED(error_message) /* Make compiler happy */
|
|
||||||
#endif
|
|
||||||
png_longjmp(png_ptr, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
PNG_FUNCTION(void,PNGAPI
|
|
||||||
png_longjmp,(png_structp png_ptr, int val),PNG_NORETURN)
|
|
||||||
{
|
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
if (png_ptr && png_ptr->longjmp_fn)
|
if (png_ptr)
|
||||||
{
|
{
|
||||||
# ifdef USE_FAR_KEYWORD
|
# ifdef USE_FAR_KEYWORD
|
||||||
{
|
{
|
||||||
jmp_buf png_jmpbuf;
|
jmp_buf jmpbuf;
|
||||||
png_memcpy(png_jmpbuf, png_ptr->png_jmpbuf, png_sizeof(jmp_buf));
|
png_memcpy(jmpbuf, png_ptr->jmpbuf, png_sizeof(jmp_buf));
|
||||||
png_ptr->longjmp_fn(png_jmpbuf, val);
|
longjmp(jmpbuf, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
# else
|
# else
|
||||||
png_ptr->longjmp_fn(png_ptr->png_jmpbuf, val);
|
longjmp(png_ptr->jmpbuf, 1);
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
#endif
|
#else
|
||||||
/* Here if not setjmp support or if png_ptr is null. */
|
|
||||||
PNG_ABORT();
|
PNG_ABORT();
|
||||||
|
#endif
|
||||||
|
#ifdef PNG_NO_CONSOLE_IO
|
||||||
|
error_message = error_message; /* make compiler happy */
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_WARNINGS_SUPPORTED
|
#ifndef PNG_NO_WARNINGS
|
||||||
/* This function is called when there is a warning, but the library thinks
|
/* This function is called when there is a warning, but the library thinks
|
||||||
* it can continue anyway. Replacement functions don't have to do anything
|
* it can continue anyway. Replacement functions don't have to do anything
|
||||||
* here if you don't want them to. In the default configuration, png_ptr is
|
* here if you don't want them to. In the default configuration, png_ptr is
|
||||||
@@ -358,60 +266,48 @@ png_longjmp,(png_structp png_ptr, int val),PNG_NORETURN)
|
|||||||
static void /* PRIVATE */
|
static void /* PRIVATE */
|
||||||
png_default_warning(png_structp png_ptr, png_const_charp warning_message)
|
png_default_warning(png_structp png_ptr, png_const_charp warning_message)
|
||||||
{
|
{
|
||||||
#ifdef PNG_CONSOLE_IO_SUPPORTED
|
#ifndef PNG_NO_CONSOLE_IO
|
||||||
# ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
# ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
if (*warning_message == PNG_LITERAL_SHARP)
|
if (*warning_message == '#')
|
||||||
{
|
{
|
||||||
int offset;
|
int offset;
|
||||||
char warning_number[16];
|
char warning_number[16];
|
||||||
for (offset = 0; offset < 15; offset++)
|
for (offset=0; offset<15; offset++)
|
||||||
{
|
{
|
||||||
warning_number[offset] = warning_message[offset + 1];
|
warning_number[offset]=*(warning_message+offset+1);
|
||||||
if (warning_message[offset] == ' ')
|
if (*(warning_message+offset) == ' ')
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if((offset > 1) && (offset < 15))
|
||||||
if ((offset > 1) && (offset < 15))
|
{
|
||||||
{
|
warning_number[offset-1]='\0';
|
||||||
warning_number[offset + 1] = '\0';
|
fprintf(stderr, "libpng warning no. %s: %s\n", warning_number,
|
||||||
fprintf(stderr, "libpng warning no. %s: %s",
|
warning_message+offset);
|
||||||
warning_number, warning_message + offset);
|
}
|
||||||
fprintf(stderr, PNG_STRING_NEWLINE);
|
else
|
||||||
}
|
fprintf(stderr, "libpng warning: %s\n", warning_message);
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fprintf(stderr, "libpng warning: %s",
|
|
||||||
warning_message);
|
|
||||||
fprintf(stderr, PNG_STRING_NEWLINE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
# endif
|
# endif
|
||||||
|
fprintf(stderr, "libpng warning: %s\n", warning_message);
|
||||||
{
|
|
||||||
fprintf(stderr, "libpng warning: %s", warning_message);
|
|
||||||
fprintf(stderr, PNG_STRING_NEWLINE);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
PNG_UNUSED(warning_message) /* Make compiler happy */
|
warning_message = warning_message; /* make compiler happy */
|
||||||
#endif
|
#endif
|
||||||
PNG_UNUSED(png_ptr) /* Make compiler happy */
|
png_ptr = png_ptr; /* make compiler happy */
|
||||||
}
|
}
|
||||||
#endif /* PNG_WARNINGS_SUPPORTED */
|
#endif /* PNG_NO_WARNINGS */
|
||||||
|
|
||||||
/* This function is called when the application wants to use another method
|
/* This function is called when the application wants to use another method
|
||||||
* of handling errors and warnings. Note that the error function MUST NOT
|
* of handling errors and warnings. Note that the error function MUST NOT
|
||||||
* return to the calling routine or serious problems will occur. The return
|
* return to the calling routine or serious problems will occur. The return
|
||||||
* method used in the default routine calls longjmp(png_ptr->png_jmpbuf, 1)
|
* method used in the default routine calls longjmp(png_ptr->jmpbuf, 1)
|
||||||
*/
|
*/
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
|
png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
|
||||||
png_error_ptr error_fn, png_error_ptr warning_fn)
|
png_error_ptr error_fn, png_error_ptr warning_fn)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
png_ptr->error_ptr = error_ptr;
|
png_ptr->error_ptr = error_ptr;
|
||||||
png_ptr->error_fn = error_fn;
|
png_ptr->error_fn = error_fn;
|
||||||
png_ptr->warning_fn = warning_fn;
|
png_ptr->warning_fn = warning_fn;
|
||||||
@@ -423,11 +319,10 @@ png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
|
|||||||
* pointer before png_write_destroy and png_read_destroy are called.
|
* pointer before png_write_destroy and png_read_destroy are called.
|
||||||
*/
|
*/
|
||||||
png_voidp PNGAPI
|
png_voidp PNGAPI
|
||||||
png_get_error_ptr(png_const_structp png_ptr)
|
png_get_error_ptr(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return ((png_voidp)png_ptr->error_ptr);
|
return ((png_voidp)png_ptr->error_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,11 +331,10 @@ png_get_error_ptr(png_const_structp png_ptr)
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode)
|
png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL)
|
if(png_ptr != NULL)
|
||||||
{
|
{
|
||||||
png_ptr->flags &=
|
png_ptr->flags &=
|
||||||
((~(PNG_FLAG_STRIP_ERROR_NUMBERS |
|
((~(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))&strip_mode);
|
||||||
PNG_FLAG_STRIP_ERROR_TEXT))&strip_mode);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
101
pnggccrd.c
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
/* pnggccrd.c was removed from libpng-1.2.20. */
|
||||||
|
|
||||||
|
/* This code snippet is for use by configure's compilation test. */
|
||||||
|
|
||||||
|
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && \
|
||||||
|
defined(PNG_MMX_CODE_SUPPORTED)
|
||||||
|
int PNGAPI png_dummy_mmx_support(void);
|
||||||
|
|
||||||
|
static int _mmx_supported = 2; // 0: no MMX; 1: MMX supported; 2: not tested
|
||||||
|
|
||||||
|
int PNGAPI
|
||||||
|
png_dummy_mmx_support(void) __attribute__((noinline));
|
||||||
|
|
||||||
|
int PNGAPI
|
||||||
|
png_dummy_mmx_support(void)
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
#if defined(PNG_MMX_CODE_SUPPORTED) // superfluous, but what the heck
|
||||||
|
__asm__ __volatile__ (
|
||||||
|
#if defined(__x86_64__)
|
||||||
|
"pushq %%rbx \n\t" // rbx gets clobbered by CPUID instruction
|
||||||
|
"pushq %%rcx \n\t" // so does rcx...
|
||||||
|
"pushq %%rdx \n\t" // ...and rdx (but rcx & rdx safe on Linux)
|
||||||
|
"pushfq \n\t" // save Eflag to stack
|
||||||
|
"popq %%rax \n\t" // get Eflag from stack into rax
|
||||||
|
"movq %%rax, %%rcx \n\t" // make another copy of Eflag in rcx
|
||||||
|
"xorl $0x200000, %%eax \n\t" // toggle ID bit in Eflag (i.e., bit 21)
|
||||||
|
"pushq %%rax \n\t" // save modified Eflag back to stack
|
||||||
|
"popfq \n\t" // restore modified value to Eflag reg
|
||||||
|
"pushfq \n\t" // save Eflag to stack
|
||||||
|
"popq %%rax \n\t" // get Eflag from stack
|
||||||
|
"pushq %%rcx \n\t" // save original Eflag to stack
|
||||||
|
"popfq \n\t" // restore original Eflag
|
||||||
|
#else
|
||||||
|
"pushl %%ebx \n\t" // ebx gets clobbered by CPUID instruction
|
||||||
|
"pushl %%ecx \n\t" // so does ecx...
|
||||||
|
"pushl %%edx \n\t" // ...and edx (but ecx & edx safe on Linux)
|
||||||
|
"pushfl \n\t" // save Eflag to stack
|
||||||
|
"popl %%eax \n\t" // get Eflag from stack into eax
|
||||||
|
"movl %%eax, %%ecx \n\t" // make another copy of Eflag in ecx
|
||||||
|
"xorl $0x200000, %%eax \n\t" // toggle ID bit in Eflag (i.e., bit 21)
|
||||||
|
"pushl %%eax \n\t" // save modified Eflag back to stack
|
||||||
|
"popfl \n\t" // restore modified value to Eflag reg
|
||||||
|
"pushfl \n\t" // save Eflag to stack
|
||||||
|
"popl %%eax \n\t" // get Eflag from stack
|
||||||
|
"pushl %%ecx \n\t" // save original Eflag to stack
|
||||||
|
"popfl \n\t" // restore original Eflag
|
||||||
|
#endif
|
||||||
|
"xorl %%ecx, %%eax \n\t" // compare new Eflag with original Eflag
|
||||||
|
"jz 0f \n\t" // if same, CPUID instr. is not supported
|
||||||
|
|
||||||
|
"xorl %%eax, %%eax \n\t" // set eax to zero
|
||||||
|
// ".byte 0x0f, 0xa2 \n\t" // CPUID instruction (two-byte opcode)
|
||||||
|
"cpuid \n\t" // get the CPU identification info
|
||||||
|
"cmpl $1, %%eax \n\t" // make sure eax return non-zero value
|
||||||
|
"jl 0f \n\t" // if eax is zero, MMX is not supported
|
||||||
|
|
||||||
|
"xorl %%eax, %%eax \n\t" // set eax to zero and...
|
||||||
|
"incl %%eax \n\t" // ...increment eax to 1. This pair is
|
||||||
|
// faster than the instruction "mov eax, 1"
|
||||||
|
"cpuid \n\t" // get the CPU identification info again
|
||||||
|
"andl $0x800000, %%edx \n\t" // mask out all bits but MMX bit (23)
|
||||||
|
"cmpl $0, %%edx \n\t" // 0 = MMX not supported
|
||||||
|
"jz 0f \n\t" // non-zero = yes, MMX IS supported
|
||||||
|
|
||||||
|
"movl $1, %%eax \n\t" // set return value to 1
|
||||||
|
"jmp 1f \n\t" // DONE: have MMX support
|
||||||
|
|
||||||
|
"0: \n\t" // .NOT_SUPPORTED: target label for jump instructions
|
||||||
|
"movl $0, %%eax \n\t" // set return value to 0
|
||||||
|
"1: \n\t" // .RETURN: target label for jump instructions
|
||||||
|
#if defined(__x86_64__)
|
||||||
|
"popq %%rdx \n\t" // restore rdx
|
||||||
|
"popq %%rcx \n\t" // restore rcx
|
||||||
|
"popq %%rbx \n\t" // restore rbx
|
||||||
|
#else
|
||||||
|
"popl %%edx \n\t" // restore edx
|
||||||
|
"popl %%ecx \n\t" // restore ecx
|
||||||
|
"popl %%ebx \n\t" // restore ebx
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// "ret \n\t" // DONE: no MMX support
|
||||||
|
// (fall through to standard C "ret")
|
||||||
|
|
||||||
|
: "=a" (result) // output list
|
||||||
|
|
||||||
|
: // any variables used on input (none)
|
||||||
|
|
||||||
|
// no clobber list
|
||||||
|
// , "%ebx", "%ecx", "%edx" // GRR: we handle these manually
|
||||||
|
// , "memory" // if write to a variable gcc thought was in a reg
|
||||||
|
// , "cc" // "condition codes" (flag bits)
|
||||||
|
);
|
||||||
|
_mmx_supported = result;
|
||||||
|
#else
|
||||||
|
_mmx_supported = 0;
|
||||||
|
#endif /* PNG_MMX_CODE_SUPPORTED */
|
||||||
|
|
||||||
|
return _mmx_supported;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
270
pnginfo.h
@@ -1,270 +0,0 @@
|
|||||||
|
|
||||||
/* pnginfo.h - header file for PNG reference library
|
|
||||||
*
|
|
||||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
|
||||||
*
|
|
||||||
* Last changed in libpng 1.5.0 [January 6, 2011]
|
|
||||||
*
|
|
||||||
* This code is released under the libpng license.
|
|
||||||
* For conditions of distribution and use, see the disclaimer
|
|
||||||
* and license in png.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* png_info is a structure that holds the information in a PNG file so
|
|
||||||
* that the application can find out the characteristics of the image.
|
|
||||||
* If you are reading the file, this structure will tell you what is
|
|
||||||
* in the PNG file. If you are writing the file, fill in the information
|
|
||||||
* you want to put into the PNG file, using png_set_*() functions, then
|
|
||||||
* call png_write_info().
|
|
||||||
*
|
|
||||||
* The names chosen should be very close to the PNG specification, so
|
|
||||||
* consult that document for information about the meaning of each field.
|
|
||||||
*
|
|
||||||
* With libpng < 0.95, it was only possible to directly set and read the
|
|
||||||
* the values in the png_info_struct, which meant that the contents and
|
|
||||||
* order of the values had to remain fixed. With libpng 0.95 and later,
|
|
||||||
* however, there are now functions that abstract the contents of
|
|
||||||
* png_info_struct from the application, so this makes it easier to use
|
|
||||||
* libpng with dynamic libraries, and even makes it possible to use
|
|
||||||
* libraries that don't have all of the libpng ancillary chunk-handing
|
|
||||||
* functionality. In libpng-1.5.0 this was moved into a separate private
|
|
||||||
* file that is not visible to applications.
|
|
||||||
*
|
|
||||||
* The following members may have allocated storage attached that should be
|
|
||||||
* cleaned up before the structure is discarded: palette, trans, text,
|
|
||||||
* pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile,
|
|
||||||
* splt_palettes, scal_unit, row_pointers, and unknowns. By default, these
|
|
||||||
* are automatically freed when the info structure is deallocated, if they were
|
|
||||||
* allocated internally by libpng. This behavior can be changed by means
|
|
||||||
* of the png_data_freer() function.
|
|
||||||
*
|
|
||||||
* More allocation details: all the chunk-reading functions that
|
|
||||||
* change these members go through the corresponding png_set_*
|
|
||||||
* functions. A function to clear these members is available: see
|
|
||||||
* png_free_data(). The png_set_* functions do not depend on being
|
|
||||||
* able to point info structure members to any of the storage they are
|
|
||||||
* passed (they make their own copies), EXCEPT that the png_set_text
|
|
||||||
* functions use the same storage passed to them in the text_ptr or
|
|
||||||
* itxt_ptr structure argument, and the png_set_rows and png_set_unknowns
|
|
||||||
* functions do not make their own copies.
|
|
||||||
*/
|
|
||||||
#ifndef PNGINFO_H
|
|
||||||
#define PNGINFO_H
|
|
||||||
|
|
||||||
struct png_info_def
|
|
||||||
{
|
|
||||||
/* the following are necessary for every PNG file */
|
|
||||||
png_uint_32 width; /* width of image in pixels (from IHDR) */
|
|
||||||
png_uint_32 height; /* height of image in pixels (from IHDR) */
|
|
||||||
png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */
|
|
||||||
png_size_t rowbytes; /* bytes needed to hold an untransformed row */
|
|
||||||
png_colorp palette; /* array of color values (valid & PNG_INFO_PLTE) */
|
|
||||||
png_uint_16 num_palette; /* number of color entries in "palette" (PLTE) */
|
|
||||||
png_uint_16 num_trans; /* number of transparent palette color (tRNS) */
|
|
||||||
png_byte bit_depth; /* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */
|
|
||||||
png_byte color_type; /* see PNG_COLOR_TYPE_ below (from IHDR) */
|
|
||||||
/* The following three should have been named *_method not *_type */
|
|
||||||
png_byte compression_type; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */
|
|
||||||
png_byte filter_type; /* must be PNG_FILTER_TYPE_BASE (from IHDR) */
|
|
||||||
png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
|
|
||||||
|
|
||||||
/* The following is informational only on read, and not used on writes. */
|
|
||||||
png_byte channels; /* number of data channels per pixel (1, 2, 3, 4) */
|
|
||||||
png_byte pixel_depth; /* number of bits per pixel */
|
|
||||||
png_byte spare_byte; /* to align the data, and for future use */
|
|
||||||
png_byte signature[8]; /* magic bytes read by libpng from start of file */
|
|
||||||
|
|
||||||
/* The rest of the data is optional. If you are reading, check the
|
|
||||||
* valid field to see if the information in these are valid. If you
|
|
||||||
* are writing, set the valid field to those chunks you want written,
|
|
||||||
* and initialize the appropriate fields below.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined(PNG_gAMA_SUPPORTED)
|
|
||||||
/* The gAMA chunk describes the gamma characteristics of the system
|
|
||||||
* on which the image was created, normally in the range [1.0, 2.5].
|
|
||||||
* Data is valid if (valid & PNG_INFO_gAMA) is non-zero.
|
|
||||||
*/
|
|
||||||
png_fixed_point gamma;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_sRGB_SUPPORTED
|
|
||||||
/* GR-P, 0.96a */
|
|
||||||
/* Data valid if (valid & PNG_INFO_sRGB) non-zero. */
|
|
||||||
png_byte srgb_intent; /* sRGB rendering intent [0, 1, 2, or 3] */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_TEXT_SUPPORTED
|
|
||||||
/* The tEXt, and zTXt chunks contain human-readable textual data in
|
|
||||||
* uncompressed, compressed, and optionally compressed forms, respectively.
|
|
||||||
* The data in "text" is an array of pointers to uncompressed,
|
|
||||||
* null-terminated C strings. Each chunk has a keyword that describes the
|
|
||||||
* textual data contained in that chunk. Keywords are not required to be
|
|
||||||
* unique, and the text string may be empty. Any number of text chunks may
|
|
||||||
* be in an image.
|
|
||||||
*/
|
|
||||||
int num_text; /* number of comments read or comments to write */
|
|
||||||
int max_text; /* current size of text array */
|
|
||||||
png_textp text; /* array of comments read or comments to write */
|
|
||||||
#endif /* PNG_TEXT_SUPPORTED */
|
|
||||||
|
|
||||||
#ifdef PNG_tIME_SUPPORTED
|
|
||||||
/* The tIME chunk holds the last time the displayed image data was
|
|
||||||
* modified. See the png_time struct for the contents of this struct.
|
|
||||||
*/
|
|
||||||
png_time mod_time;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_sBIT_SUPPORTED
|
|
||||||
/* The sBIT chunk specifies the number of significant high-order bits
|
|
||||||
* in the pixel data. Values are in the range [1, bit_depth], and are
|
|
||||||
* only specified for the channels in the pixel data. The contents of
|
|
||||||
* the low-order bits is not specified. Data is valid if
|
|
||||||
* (valid & PNG_INFO_sBIT) is non-zero.
|
|
||||||
*/
|
|
||||||
png_color_8 sig_bit; /* significant bits in color channels */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_EXPAND_SUPPORTED) || \
|
|
||||||
defined(PNG_READ_BACKGROUND_SUPPORTED)
|
|
||||||
/* The tRNS chunk supplies transparency data for paletted images and
|
|
||||||
* other image types that don't need a full alpha channel. There are
|
|
||||||
* "num_trans" transparency values for a paletted image, stored in the
|
|
||||||
* same order as the palette colors, starting from index 0. Values
|
|
||||||
* for the data are in the range [0, 255], ranging from fully transparent
|
|
||||||
* to fully opaque, respectively. For non-paletted images, there is a
|
|
||||||
* single color specified that should be treated as fully transparent.
|
|
||||||
* Data is valid if (valid & PNG_INFO_tRNS) is non-zero.
|
|
||||||
*/
|
|
||||||
png_bytep trans; /* alpha values for paletted image */
|
|
||||||
png_bytep trans_alpha; /* alpha values for paletted image */
|
|
||||||
png_color_16 trans_color; /* transparent color for non-palette image */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
|
|
||||||
/* The bKGD chunk gives the suggested image background color if the
|
|
||||||
* display program does not have its own background color and the image
|
|
||||||
* is needs to composited onto a background before display. The colors
|
|
||||||
* in "background" are normally in the same color space/depth as the
|
|
||||||
* pixel data. Data is valid if (valid & PNG_INFO_bKGD) is non-zero.
|
|
||||||
*/
|
|
||||||
png_color_16 background;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_oFFs_SUPPORTED
|
|
||||||
/* The oFFs chunk gives the offset in "offset_unit_type" units rightwards
|
|
||||||
* and downwards from the top-left corner of the display, page, or other
|
|
||||||
* application-specific co-ordinate space. See the PNG_OFFSET_ defines
|
|
||||||
* below for the unit types. Valid if (valid & PNG_INFO_oFFs) non-zero.
|
|
||||||
*/
|
|
||||||
png_int_32 x_offset; /* x offset on page */
|
|
||||||
png_int_32 y_offset; /* y offset on page */
|
|
||||||
png_byte offset_unit_type; /* offset units type */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_pHYs_SUPPORTED
|
|
||||||
/* The pHYs chunk gives the physical pixel density of the image for
|
|
||||||
* display or printing in "phys_unit_type" units (see PNG_RESOLUTION_
|
|
||||||
* defines below). Data is valid if (valid & PNG_INFO_pHYs) is non-zero.
|
|
||||||
*/
|
|
||||||
png_uint_32 x_pixels_per_unit; /* horizontal pixel density */
|
|
||||||
png_uint_32 y_pixels_per_unit; /* vertical pixel density */
|
|
||||||
png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_hIST_SUPPORTED
|
|
||||||
/* The hIST chunk contains the relative frequency or importance of the
|
|
||||||
* various palette entries, so that a viewer can intelligently select a
|
|
||||||
* reduced-color palette, if required. Data is an array of "num_palette"
|
|
||||||
* values in the range [0,65535]. Data valid if (valid & PNG_INFO_hIST)
|
|
||||||
* is non-zero.
|
|
||||||
*/
|
|
||||||
png_uint_16p hist;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_cHRM_SUPPORTED
|
|
||||||
/* The cHRM chunk describes the CIE color characteristics of the monitor
|
|
||||||
* on which the PNG was created. This data allows the viewer to do gamut
|
|
||||||
* mapping of the input image to ensure that the viewer sees the same
|
|
||||||
* colors in the image as the creator. Values are in the range
|
|
||||||
* [0.0, 0.8]. Data valid if (valid & PNG_INFO_cHRM) non-zero.
|
|
||||||
*/
|
|
||||||
png_fixed_point x_white;
|
|
||||||
png_fixed_point y_white;
|
|
||||||
png_fixed_point x_red;
|
|
||||||
png_fixed_point y_red;
|
|
||||||
png_fixed_point x_green;
|
|
||||||
png_fixed_point y_green;
|
|
||||||
png_fixed_point x_blue;
|
|
||||||
png_fixed_point y_blue;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_pCAL_SUPPORTED
|
|
||||||
/* The pCAL chunk describes a transformation between the stored pixel
|
|
||||||
* values and original physical data values used to create the image.
|
|
||||||
* The integer range [0, 2^bit_depth - 1] maps to the floating-point
|
|
||||||
* range given by [pcal_X0, pcal_X1], and are further transformed by a
|
|
||||||
* (possibly non-linear) transformation function given by "pcal_type"
|
|
||||||
* and "pcal_params" into "pcal_units". Please see the PNG_EQUATION_
|
|
||||||
* defines below, and the PNG-Group's PNG extensions document for a
|
|
||||||
* complete description of the transformations and how they should be
|
|
||||||
* implemented, and for a description of the ASCII parameter strings.
|
|
||||||
* Data values are valid if (valid & PNG_INFO_pCAL) non-zero.
|
|
||||||
*/
|
|
||||||
png_charp pcal_purpose; /* pCAL chunk description string */
|
|
||||||
png_int_32 pcal_X0; /* minimum value */
|
|
||||||
png_int_32 pcal_X1; /* maximum value */
|
|
||||||
png_charp pcal_units; /* Latin-1 string giving physical units */
|
|
||||||
png_charpp pcal_params; /* ASCII strings containing parameter values */
|
|
||||||
png_byte pcal_type; /* equation type (see PNG_EQUATION_ below) */
|
|
||||||
png_byte pcal_nparams; /* number of parameters given in pcal_params */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* New members added in libpng-1.0.6 */
|
|
||||||
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
|
|
||||||
|
|
||||||
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) || \
|
|
||||||
defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
|
|
||||||
/* Storage for unknown chunks that the library doesn't recognize. */
|
|
||||||
png_unknown_chunkp unknown_chunks;
|
|
||||||
int unknown_chunks_num;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_iCCP_SUPPORTED
|
|
||||||
/* iCCP chunk data. */
|
|
||||||
png_charp iccp_name; /* profile name */
|
|
||||||
png_bytep iccp_profile; /* International Color Consortium profile data */
|
|
||||||
png_uint_32 iccp_proflen; /* ICC profile data length */
|
|
||||||
png_byte iccp_compression; /* Always zero */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_sPLT_SUPPORTED
|
|
||||||
/* Data on sPLT chunks (there may be more than one). */
|
|
||||||
png_sPLT_tp splt_palettes;
|
|
||||||
png_uint_32 splt_palettes_num;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_sCAL_SUPPORTED
|
|
||||||
/* The sCAL chunk describes the actual physical dimensions of the
|
|
||||||
* subject matter of the graphic. The chunk contains a unit specification
|
|
||||||
* a byte value, and two ASCII strings representing floating-point
|
|
||||||
* values. The values are width and height corresponsing to one pixel
|
|
||||||
* in the image. Data values are valid if (valid & PNG_INFO_sCAL) is
|
|
||||||
* non-zero.
|
|
||||||
*/
|
|
||||||
png_byte scal_unit; /* unit of physical scale */
|
|
||||||
png_charp scal_s_width; /* string containing height */
|
|
||||||
png_charp scal_s_height; /* string containing width */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_INFO_IMAGE_SUPPORTED
|
|
||||||
/* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS)
|
|
||||||
non-zero */
|
|
||||||
/* Data valid if (valid & PNG_INFO_IDAT) non-zero */
|
|
||||||
png_bytepp row_pointers; /* the image bits */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
};
|
|
||||||
#endif /* PNGINFO_H */
|
|
||||||
428
pngmem.c
@@ -1,15 +1,12 @@
|
|||||||
|
|
||||||
/* pngmem.c - stub functions for memory allocation
|
/* pngmem.c - stub functions for memory allocation
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.5.1 [February 3, 2011]
|
* Last changed in libpng 1.2.13 November 13, 2006
|
||||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
* This code is released under the libpng license.
|
|
||||||
* For conditions of distribution and use, see the disclaimer
|
|
||||||
* and license in png.h
|
|
||||||
*
|
|
||||||
* This file provides a location for all memory allocation. Users who
|
* This file provides a location for all memory allocation. Users who
|
||||||
* need special memory handling are expected to supply replacement
|
* need special memory handling are expected to supply replacement
|
||||||
* functions for png_malloc() and png_free(), and to use
|
* functions for png_malloc() and png_free(), and to use
|
||||||
@@ -17,56 +14,52 @@
|
|||||||
* identify the replacement functions.
|
* identify the replacement functions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "pngpriv.h"
|
#define PNG_INTERNAL
|
||||||
|
#include "png.h"
|
||||||
|
|
||||||
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
||||||
|
|
||||||
/* Borland DOS special memory handler */
|
/* Borland DOS special memory handler */
|
||||||
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
|
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
|
||||||
/* If you change this, be sure to change the one in png.h also */
|
/* if you change this, be sure to change the one in png.h also */
|
||||||
|
|
||||||
/* Allocate memory for a png_struct. The malloc and memset can be replaced
|
/* Allocate memory for a png_struct. The malloc and memset can be replaced
|
||||||
by a single call to calloc() if this is thought to improve performance. */
|
by a single call to calloc() if this is thought to improve performance. */
|
||||||
PNG_FUNCTION(png_voidp /* PRIVATE */,
|
png_voidp /* PRIVATE */
|
||||||
png_create_struct,(int type),PNG_ALLOCATED)
|
png_create_struct(int type)
|
||||||
{
|
{
|
||||||
# ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
return (png_create_struct_2(type, NULL, NULL));
|
return (png_create_struct_2(type, png_malloc_ptr_NULL, png_voidp_NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Alternate version of png_create_struct, for use with user-defined malloc. */
|
/* Alternate version of png_create_struct, for use with user-defined malloc. */
|
||||||
PNG_FUNCTION(png_voidp /* PRIVATE */,
|
png_voidp /* PRIVATE */
|
||||||
png_create_struct_2,(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr),
|
png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
|
||||||
PNG_ALLOCATED)
|
|
||||||
{
|
{
|
||||||
# endif /* PNG_USER_MEM_SUPPORTED */
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
png_size_t size;
|
png_size_t size;
|
||||||
png_voidp struct_ptr;
|
png_voidp struct_ptr;
|
||||||
|
|
||||||
if (type == PNG_STRUCT_INFO)
|
if (type == PNG_STRUCT_INFO)
|
||||||
size = png_sizeof(png_info);
|
size = png_sizeof(png_info);
|
||||||
|
|
||||||
else if (type == PNG_STRUCT_PNG)
|
else if (type == PNG_STRUCT_PNG)
|
||||||
size = png_sizeof(png_struct);
|
size = png_sizeof(png_struct);
|
||||||
|
|
||||||
else
|
else
|
||||||
return (png_get_copyright(NULL));
|
return (png_get_copyright(NULL));
|
||||||
|
|
||||||
# ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
if (malloc_fn != NULL)
|
if(malloc_fn != NULL)
|
||||||
{
|
{
|
||||||
png_struct dummy_struct;
|
png_struct dummy_struct;
|
||||||
png_structp png_ptr = &dummy_struct;
|
png_structp png_ptr = &dummy_struct;
|
||||||
png_ptr->mem_ptr=mem_ptr;
|
png_ptr->mem_ptr=mem_ptr;
|
||||||
struct_ptr = (*(malloc_fn))(png_ptr, (png_uint_32)size);
|
struct_ptr = (*(malloc_fn))(png_ptr, (png_uint_32)size);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
# endif /* PNG_USER_MEM_SUPPORTED */
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
struct_ptr = (png_voidp)farmalloc(size);
|
struct_ptr = (png_voidp)farmalloc(size);
|
||||||
if (struct_ptr != NULL)
|
if (struct_ptr != NULL)
|
||||||
png_memset(struct_ptr, 0, size);
|
png_memset(struct_ptr, 0, size);
|
||||||
|
|
||||||
return (struct_ptr);
|
return (struct_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,8 +67,8 @@ png_create_struct_2,(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr),
|
|||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_destroy_struct(png_voidp struct_ptr)
|
png_destroy_struct(png_voidp struct_ptr)
|
||||||
{
|
{
|
||||||
# ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
png_destroy_struct_2(struct_ptr, NULL, NULL);
|
png_destroy_struct_2(struct_ptr, png_free_ptr_NULL, png_voidp_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free memory allocated by a png_create_struct() call */
|
/* Free memory allocated by a png_create_struct() call */
|
||||||
@@ -83,11 +76,11 @@ void /* PRIVATE */
|
|||||||
png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
|
png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
|
||||||
png_voidp mem_ptr)
|
png_voidp mem_ptr)
|
||||||
{
|
{
|
||||||
# endif
|
#endif
|
||||||
if (struct_ptr != NULL)
|
if (struct_ptr != NULL)
|
||||||
{
|
{
|
||||||
# ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
if (free_fn != NULL)
|
if(free_fn != NULL)
|
||||||
{
|
{
|
||||||
png_struct dummy_struct;
|
png_struct dummy_struct;
|
||||||
png_structp png_ptr = &dummy_struct;
|
png_structp png_ptr = &dummy_struct;
|
||||||
@@ -95,8 +88,7 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
|
|||||||
(*(free_fn))(png_ptr, struct_ptr);
|
(*(free_fn))(png_ptr, struct_ptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
# endif /* PNG_USER_MEM_SUPPORTED */
|
|
||||||
farfree (struct_ptr);
|
farfree (struct_ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -120,67 +112,50 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
|
|||||||
* result, we would be truncating potentially larger memory requests
|
* result, we would be truncating potentially larger memory requests
|
||||||
* (which should cause a fatal error) and introducing major problems.
|
* (which should cause a fatal error) and introducing major problems.
|
||||||
*/
|
*/
|
||||||
PNG_FUNCTION(png_voidp,PNGAPI
|
|
||||||
png_calloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
|
|
||||||
{
|
|
||||||
png_voidp ret;
|
|
||||||
|
|
||||||
ret = (png_malloc(png_ptr, size));
|
png_voidp PNGAPI
|
||||||
|
png_malloc(png_structp png_ptr, png_uint_32 size)
|
||||||
if (ret != NULL)
|
|
||||||
png_memset(ret,0,(png_size_t)size);
|
|
||||||
|
|
||||||
return (ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
PNG_FUNCTION(png_voidp,PNGAPI
|
|
||||||
png_malloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
|
|
||||||
{
|
{
|
||||||
png_voidp ret;
|
png_voidp ret;
|
||||||
|
|
||||||
if (png_ptr == NULL || size == 0)
|
if (png_ptr == NULL || size == 0)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
# ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
if (png_ptr->malloc_fn != NULL)
|
if(png_ptr->malloc_fn != NULL)
|
||||||
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
|
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
|
||||||
|
|
||||||
else
|
else
|
||||||
ret = (png_malloc_default(png_ptr, size));
|
ret = (png_malloc_default(png_ptr, size));
|
||||||
|
|
||||||
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
png_error(png_ptr, "Out of memory");
|
png_error(png_ptr, "Out of memory!");
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
PNG_FUNCTION(png_voidp,PNGAPI
|
png_voidp PNGAPI
|
||||||
png_malloc_default,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
|
png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
||||||
{
|
{
|
||||||
png_voidp ret;
|
png_voidp ret;
|
||||||
# endif /* PNG_USER_MEM_SUPPORTED */
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
|
|
||||||
if (png_ptr == NULL || size == 0)
|
if (png_ptr == NULL || size == 0)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
# ifdef PNG_MAX_MALLOC_64K
|
#ifdef PNG_MAX_MALLOC_64K
|
||||||
if (size > (png_uint_32)65536L)
|
if (size > (png_uint_32)65536L)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Cannot Allocate > 64K");
|
png_warning(png_ptr, "Cannot Allocate > 64K");
|
||||||
ret = NULL;
|
ret = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
if (size != (size_t)size)
|
if (size != (size_t)size)
|
||||||
ret = NULL;
|
ret = NULL;
|
||||||
|
|
||||||
else if (size == (png_uint_32)65536L)
|
else if (size == (png_uint_32)65536L)
|
||||||
{
|
{
|
||||||
if (png_ptr->offset_table == NULL)
|
if (png_ptr->offset_table == NULL)
|
||||||
{
|
{
|
||||||
/* Try to see if we need to do any of this fancy stuff */
|
/* try to see if we need to do any of this fancy stuff */
|
||||||
ret = farmalloc(size);
|
ret = farmalloc(size);
|
||||||
if (ret == NULL || ((png_size_t)ret & 0xffff))
|
if (ret == NULL || ((png_size_t)ret & 0xffff))
|
||||||
{
|
{
|
||||||
@@ -196,15 +171,12 @@ png_malloc_default,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
|
|||||||
ret = NULL;
|
ret = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (png_ptr->zlib_window_bits > 14)
|
if(png_ptr->zlib_window_bits > 14)
|
||||||
num_blocks = (int)(1 << (png_ptr->zlib_window_bits - 14));
|
num_blocks = (int)(1 << (png_ptr->zlib_window_bits - 14));
|
||||||
|
|
||||||
else
|
else
|
||||||
num_blocks = 1;
|
num_blocks = 1;
|
||||||
|
|
||||||
if (png_ptr->zlib_mem_level >= 7)
|
if (png_ptr->zlib_mem_level >= 7)
|
||||||
num_blocks += (int)(1 << (png_ptr->zlib_mem_level - 7));
|
num_blocks += (int)(1 << (png_ptr->zlib_mem_level - 7));
|
||||||
|
|
||||||
else
|
else
|
||||||
num_blocks++;
|
num_blocks++;
|
||||||
|
|
||||||
@@ -214,43 +186,40 @@ png_malloc_default,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
|
|||||||
|
|
||||||
if (table == NULL)
|
if (table == NULL)
|
||||||
{
|
{
|
||||||
# ifndef PNG_USER_MEM_SUPPORTED
|
#ifndef PNG_USER_MEM_SUPPORTED
|
||||||
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
png_error(png_ptr, "Out Of Memory"); /* Note "O", "M" */
|
png_error(png_ptr, "Out Of Memory."); /* Note "O" and "M" */
|
||||||
|
|
||||||
else
|
else
|
||||||
png_warning(png_ptr, "Out Of Memory");
|
png_warning(png_ptr, "Out Of Memory.");
|
||||||
# endif
|
#endif
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((png_size_t)table & 0xfff0)
|
if ((png_size_t)table & 0xfff0)
|
||||||
{
|
{
|
||||||
# ifndef PNG_USER_MEM_SUPPORTED
|
#ifndef PNG_USER_MEM_SUPPORTED
|
||||||
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
png_error(png_ptr,
|
png_error(png_ptr,
|
||||||
"Farmalloc didn't return normalized pointer");
|
"Farmalloc didn't return normalized pointer");
|
||||||
|
|
||||||
else
|
else
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"Farmalloc didn't return normalized pointer");
|
"Farmalloc didn't return normalized pointer");
|
||||||
# endif
|
#endif
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
png_ptr->offset_table = table;
|
png_ptr->offset_table = table;
|
||||||
png_ptr->offset_table_ptr = farmalloc(num_blocks *
|
png_ptr->offset_table_ptr = farmalloc(num_blocks *
|
||||||
png_sizeof(png_bytep));
|
png_sizeof (png_bytep));
|
||||||
|
|
||||||
if (png_ptr->offset_table_ptr == NULL)
|
if (png_ptr->offset_table_ptr == NULL)
|
||||||
{
|
{
|
||||||
# ifndef PNG_USER_MEM_SUPPORTED
|
#ifndef PNG_USER_MEM_SUPPORTED
|
||||||
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
png_error(png_ptr, "Out Of memory"); /* Note "O", "m" */
|
png_error(png_ptr, "Out Of memory."); /* Note "O" and "M" */
|
||||||
|
|
||||||
else
|
else
|
||||||
png_warning(png_ptr, "Out Of memory");
|
png_warning(png_ptr, "Out Of memory.");
|
||||||
# endif
|
#endif
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,7 +229,6 @@ png_malloc_default,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
|
|||||||
hptr = (png_byte huge *)((long)(hptr) & 0xfffffff0L);
|
hptr = (png_byte huge *)((long)(hptr) & 0xfffffff0L);
|
||||||
hptr = hptr + 16L; /* "hptr += 16L" fails on Turbo C++ 3.0 */
|
hptr = hptr + 16L; /* "hptr += 16L" fails on Turbo C++ 3.0 */
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < num_blocks; i++)
|
for (i = 0; i < num_blocks; i++)
|
||||||
{
|
{
|
||||||
png_ptr->offset_table_ptr[i] = (png_bytep)hptr;
|
png_ptr->offset_table_ptr[i] = (png_bytep)hptr;
|
||||||
@@ -275,64 +243,57 @@ png_malloc_default,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
|
|||||||
|
|
||||||
if (png_ptr->offset_table_count >= png_ptr->offset_table_number)
|
if (png_ptr->offset_table_count >= png_ptr->offset_table_number)
|
||||||
{
|
{
|
||||||
# ifndef PNG_USER_MEM_SUPPORTED
|
#ifndef PNG_USER_MEM_SUPPORTED
|
||||||
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
png_error(png_ptr, "Out of Memory"); /* Note "o" and "M" */
|
png_error(png_ptr, "Out of Memory."); /* Note "o" and "M" */
|
||||||
|
|
||||||
else
|
else
|
||||||
png_warning(png_ptr, "Out of Memory");
|
png_warning(png_ptr, "Out of Memory.");
|
||||||
# endif
|
#endif
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = png_ptr->offset_table_ptr[png_ptr->offset_table_count++];
|
ret = png_ptr->offset_table_ptr[png_ptr->offset_table_count++];
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
ret = farmalloc(size);
|
ret = farmalloc(size);
|
||||||
|
|
||||||
# ifndef PNG_USER_MEM_SUPPORTED
|
#ifndef PNG_USER_MEM_SUPPORTED
|
||||||
if (ret == NULL)
|
if (ret == NULL)
|
||||||
{
|
{
|
||||||
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
png_error(png_ptr, "Out of memory"); /* Note "o" and "m" */
|
png_error(png_ptr, "Out of memory."); /* Note "o" and "m" */
|
||||||
|
|
||||||
else
|
else
|
||||||
png_warning(png_ptr, "Out of memory"); /* Note "o" and "m" */
|
png_warning(png_ptr, "Out of memory."); /* Note "o" and "m" */
|
||||||
}
|
}
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free a pointer allocated by png_malloc(). In the default
|
/* free a pointer allocated by png_malloc(). In the default
|
||||||
* configuration, png_ptr is not used, but is passed in case it
|
configuration, png_ptr is not used, but is passed in case it
|
||||||
* is needed. If ptr is NULL, return without taking any action.
|
is needed. If ptr is NULL, return without taking any action. */
|
||||||
*/
|
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_free(png_structp png_ptr, png_voidp ptr)
|
png_free(png_structp png_ptr, png_voidp ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL || ptr == NULL)
|
if (png_ptr == NULL || ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
# ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
if (png_ptr->free_fn != NULL)
|
if (png_ptr->free_fn != NULL)
|
||||||
{
|
{
|
||||||
(*(png_ptr->free_fn))(png_ptr, ptr);
|
(*(png_ptr->free_fn))(png_ptr, ptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else png_free_default(png_ptr, ptr);
|
||||||
else
|
|
||||||
png_free_default(png_ptr, ptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_free_default(png_structp png_ptr, png_voidp ptr)
|
png_free_default(png_structp png_ptr, png_voidp ptr)
|
||||||
{
|
{
|
||||||
# endif /* PNG_USER_MEM_SUPPORTED */
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
|
|
||||||
if (png_ptr == NULL || ptr == NULL)
|
if(png_ptr == NULL) return;
|
||||||
return;
|
|
||||||
|
|
||||||
if (png_ptr->offset_table != NULL)
|
if (png_ptr->offset_table != NULL)
|
||||||
{
|
{
|
||||||
@@ -357,7 +318,9 @@ png_free_default(png_structp png_ptr, png_voidp ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ptr != NULL)
|
if (ptr != NULL)
|
||||||
|
{
|
||||||
farfree(ptr);
|
farfree(ptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* Not the Borland DOS special memory handler */
|
#else /* Not the Borland DOS special memory handler */
|
||||||
@@ -365,58 +328,52 @@ png_free_default(png_structp png_ptr, png_voidp ptr)
|
|||||||
/* Allocate memory for a png_struct or a png_info. The malloc and
|
/* Allocate memory for a png_struct or a png_info. The malloc and
|
||||||
memset can be replaced by a single call to calloc() if this is thought
|
memset can be replaced by a single call to calloc() if this is thought
|
||||||
to improve performance noticably. */
|
to improve performance noticably. */
|
||||||
PNG_FUNCTION(png_voidp /* PRIVATE */,
|
png_voidp /* PRIVATE */
|
||||||
png_create_struct,(int type),PNG_ALLOCATED)
|
png_create_struct(int type)
|
||||||
{
|
{
|
||||||
# ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
return (png_create_struct_2(type, NULL, NULL));
|
return (png_create_struct_2(type, png_malloc_ptr_NULL, png_voidp_NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate memory for a png_struct or a png_info. The malloc and
|
/* Allocate memory for a png_struct or a png_info. The malloc and
|
||||||
memset can be replaced by a single call to calloc() if this is thought
|
memset can be replaced by a single call to calloc() if this is thought
|
||||||
to improve performance noticably. */
|
to improve performance noticably. */
|
||||||
PNG_FUNCTION(png_voidp /* PRIVATE */,
|
png_voidp /* PRIVATE */
|
||||||
png_create_struct_2,(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr),
|
png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
|
||||||
PNG_ALLOCATED)
|
|
||||||
{
|
{
|
||||||
# endif /* PNG_USER_MEM_SUPPORTED */
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
png_size_t size;
|
png_size_t size;
|
||||||
png_voidp struct_ptr;
|
png_voidp struct_ptr;
|
||||||
|
|
||||||
if (type == PNG_STRUCT_INFO)
|
if (type == PNG_STRUCT_INFO)
|
||||||
size = png_sizeof(png_info);
|
size = png_sizeof(png_info);
|
||||||
|
|
||||||
else if (type == PNG_STRUCT_PNG)
|
else if (type == PNG_STRUCT_PNG)
|
||||||
size = png_sizeof(png_struct);
|
size = png_sizeof(png_struct);
|
||||||
|
|
||||||
else
|
else
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
# ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
if (malloc_fn != NULL)
|
if(malloc_fn != NULL)
|
||||||
{
|
{
|
||||||
png_struct dummy_struct;
|
png_struct dummy_struct;
|
||||||
png_structp png_ptr = &dummy_struct;
|
png_structp png_ptr = &dummy_struct;
|
||||||
png_ptr->mem_ptr=mem_ptr;
|
png_ptr->mem_ptr=mem_ptr;
|
||||||
struct_ptr = (*(malloc_fn))(png_ptr, size);
|
struct_ptr = (*(malloc_fn))(png_ptr, size);
|
||||||
|
|
||||||
if (struct_ptr != NULL)
|
if (struct_ptr != NULL)
|
||||||
png_memset(struct_ptr, 0, size);
|
png_memset(struct_ptr, 0, size);
|
||||||
|
|
||||||
return (struct_ptr);
|
return (struct_ptr);
|
||||||
}
|
}
|
||||||
# endif /* PNG_USER_MEM_SUPPORTED */
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
|
|
||||||
# if defined(__TURBOC__) && !defined(__FLAT__)
|
#if defined(__TURBOC__) && !defined(__FLAT__)
|
||||||
struct_ptr = (png_voidp)farmalloc(size);
|
struct_ptr = (png_voidp)farmalloc(size);
|
||||||
# else
|
#else
|
||||||
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
||||||
struct_ptr = (png_voidp)halloc(size, 1);
|
struct_ptr = (png_voidp)halloc(size,1);
|
||||||
# else
|
# else
|
||||||
struct_ptr = (png_voidp)malloc(size);
|
struct_ptr = (png_voidp)malloc(size);
|
||||||
# endif
|
# endif
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
if (struct_ptr != NULL)
|
if (struct_ptr != NULL)
|
||||||
png_memset(struct_ptr, 0, size);
|
png_memset(struct_ptr, 0, size);
|
||||||
|
|
||||||
@@ -428,8 +385,8 @@ png_create_struct_2,(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr),
|
|||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_destroy_struct(png_voidp struct_ptr)
|
png_destroy_struct(png_voidp struct_ptr)
|
||||||
{
|
{
|
||||||
# ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
png_destroy_struct_2(struct_ptr, NULL, NULL);
|
png_destroy_struct_2(struct_ptr, png_free_ptr_NULL, png_voidp_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free memory allocated by a png_create_struct() call */
|
/* Free memory allocated by a png_create_struct() call */
|
||||||
@@ -437,11 +394,11 @@ void /* PRIVATE */
|
|||||||
png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
|
png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
|
||||||
png_voidp mem_ptr)
|
png_voidp mem_ptr)
|
||||||
{
|
{
|
||||||
# endif /* PNG_USER_MEM_SUPPORTED */
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
if (struct_ptr != NULL)
|
if (struct_ptr != NULL)
|
||||||
{
|
{
|
||||||
# ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
if (free_fn != NULL)
|
if(free_fn != NULL)
|
||||||
{
|
{
|
||||||
png_struct dummy_struct;
|
png_struct dummy_struct;
|
||||||
png_structp png_ptr = &dummy_struct;
|
png_structp png_ptr = &dummy_struct;
|
||||||
@@ -449,182 +406,178 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
|
|||||||
(*(free_fn))(png_ptr, struct_ptr);
|
(*(free_fn))(png_ptr, struct_ptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
# endif /* PNG_USER_MEM_SUPPORTED */
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
# if defined(__TURBOC__) && !defined(__FLAT__)
|
#if defined(__TURBOC__) && !defined(__FLAT__)
|
||||||
farfree(struct_ptr);
|
farfree(struct_ptr);
|
||||||
|
#else
|
||||||
# else
|
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
||||||
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
|
||||||
hfree(struct_ptr);
|
hfree(struct_ptr);
|
||||||
|
# else
|
||||||
# else
|
|
||||||
free(struct_ptr);
|
free(struct_ptr);
|
||||||
|
# endif
|
||||||
# endif
|
#endif
|
||||||
# endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate memory. For reasonable files, size should never exceed
|
/* Allocate memory. For reasonable files, size should never exceed
|
||||||
* 64K. However, zlib may allocate more then 64K if you don't tell
|
64K. However, zlib may allocate more then 64K if you don't tell
|
||||||
* it not to. See zconf.h and png.h for more information. zlib does
|
it not to. See zconf.h and png.h for more information. zlib does
|
||||||
* need to allocate exactly 64K, so whatever you call here must
|
need to allocate exactly 64K, so whatever you call here must
|
||||||
* have the ability to do that.
|
have the ability to do that. */
|
||||||
*/
|
|
||||||
|
|
||||||
PNG_FUNCTION(png_voidp,PNGAPI
|
png_voidp PNGAPI
|
||||||
png_calloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
|
png_malloc(png_structp png_ptr, png_uint_32 size)
|
||||||
{
|
{
|
||||||
png_voidp ret;
|
png_voidp ret;
|
||||||
|
|
||||||
ret = (png_malloc(png_ptr, size));
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
|
|
||||||
if (ret != NULL)
|
|
||||||
png_memset(ret,0,(png_size_t)size);
|
|
||||||
|
|
||||||
return (ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
PNG_FUNCTION(png_voidp,PNGAPI
|
|
||||||
png_malloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
|
|
||||||
{
|
|
||||||
png_voidp ret;
|
|
||||||
|
|
||||||
# ifdef PNG_USER_MEM_SUPPORTED
|
|
||||||
if (png_ptr == NULL || size == 0)
|
if (png_ptr == NULL || size == 0)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
if (png_ptr->malloc_fn != NULL)
|
if(png_ptr->malloc_fn != NULL)
|
||||||
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
|
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
|
||||||
|
|
||||||
else
|
else
|
||||||
ret = (png_malloc_default(png_ptr, size));
|
ret = (png_malloc_default(png_ptr, size));
|
||||||
|
|
||||||
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
png_error(png_ptr, "Out of Memory");
|
png_error(png_ptr, "Out of Memory!");
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
PNG_FUNCTION(png_voidp,PNGAPI
|
png_voidp PNGAPI
|
||||||
png_malloc_default,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
|
png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
||||||
{
|
{
|
||||||
png_voidp ret;
|
png_voidp ret;
|
||||||
# endif /* PNG_USER_MEM_SUPPORTED */
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
|
|
||||||
if (png_ptr == NULL || size == 0)
|
if (png_ptr == NULL || size == 0)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
# ifdef PNG_MAX_MALLOC_64K
|
#ifdef PNG_MAX_MALLOC_64K
|
||||||
if (size > (png_uint_32)65536L)
|
if (size > (png_uint_32)65536L)
|
||||||
{
|
{
|
||||||
# ifndef PNG_USER_MEM_SUPPORTED
|
#ifndef PNG_USER_MEM_SUPPORTED
|
||||||
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
if(png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
png_error(png_ptr, "Cannot Allocate > 64K");
|
png_error(png_ptr, "Cannot Allocate > 64K");
|
||||||
|
|
||||||
else
|
else
|
||||||
# endif
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
/* Check for overflow */
|
/* Check for overflow */
|
||||||
# if defined(__TURBOC__) && !defined(__FLAT__)
|
#if defined(__TURBOC__) && !defined(__FLAT__)
|
||||||
|
if (size != (unsigned long)size)
|
||||||
|
ret = NULL;
|
||||||
|
else
|
||||||
|
ret = farmalloc(size);
|
||||||
|
#else
|
||||||
|
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
||||||
|
if (size != (unsigned long)size)
|
||||||
|
ret = NULL;
|
||||||
|
else
|
||||||
|
ret = halloc(size, 1);
|
||||||
|
# else
|
||||||
|
if (size != (size_t)size)
|
||||||
|
ret = NULL;
|
||||||
|
else
|
||||||
|
ret = malloc((size_t)size);
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
if (size != (unsigned long)size)
|
#ifndef PNG_USER_MEM_SUPPORTED
|
||||||
ret = NULL;
|
|
||||||
|
|
||||||
else
|
|
||||||
ret = farmalloc(size);
|
|
||||||
|
|
||||||
# else
|
|
||||||
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
|
||||||
if (size != (unsigned long)size)
|
|
||||||
ret = NULL;
|
|
||||||
|
|
||||||
else
|
|
||||||
ret = halloc(size, 1);
|
|
||||||
|
|
||||||
# else
|
|
||||||
if (size != (size_t)size)
|
|
||||||
ret = NULL;
|
|
||||||
|
|
||||||
else
|
|
||||||
ret = malloc((size_t)size);
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifndef PNG_USER_MEM_SUPPORTED
|
|
||||||
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
png_error(png_ptr, "Out of Memory");
|
png_error(png_ptr, "Out of Memory");
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free a pointer allocated by png_malloc(). If ptr is NULL, return
|
/* Free a pointer allocated by png_malloc(). If ptr is NULL, return
|
||||||
* without taking any action.
|
without taking any action. */
|
||||||
*/
|
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_free(png_structp png_ptr, png_voidp ptr)
|
png_free(png_structp png_ptr, png_voidp ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL || ptr == NULL)
|
if (png_ptr == NULL || ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
# ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
if (png_ptr->free_fn != NULL)
|
if (png_ptr->free_fn != NULL)
|
||||||
{
|
{
|
||||||
(*(png_ptr->free_fn))(png_ptr, ptr);
|
(*(png_ptr->free_fn))(png_ptr, ptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else png_free_default(png_ptr, ptr);
|
||||||
else
|
|
||||||
png_free_default(png_ptr, ptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_free_default(png_structp png_ptr, png_voidp ptr)
|
png_free_default(png_structp png_ptr, png_voidp ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL || ptr == NULL)
|
if (png_ptr == NULL || ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
# endif /* PNG_USER_MEM_SUPPORTED */
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
|
|
||||||
# if defined(__TURBOC__) && !defined(__FLAT__)
|
#if defined(__TURBOC__) && !defined(__FLAT__)
|
||||||
farfree(ptr);
|
farfree(ptr);
|
||||||
|
#else
|
||||||
# else
|
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
||||||
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
|
||||||
hfree(ptr);
|
hfree(ptr);
|
||||||
|
# else
|
||||||
# else
|
|
||||||
free(ptr);
|
free(ptr);
|
||||||
|
# endif
|
||||||
# endif
|
#endif
|
||||||
# endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Not Borland DOS special memory handler */
|
#endif /* Not Borland DOS special memory handler */
|
||||||
|
|
||||||
|
#if defined(PNG_1_0_X)
|
||||||
|
# define png_malloc_warn png_malloc
|
||||||
|
#else
|
||||||
/* This function was added at libpng version 1.2.3. The png_malloc_warn()
|
/* This function was added at libpng version 1.2.3. The png_malloc_warn()
|
||||||
* function will set up png_malloc() to issue a png_warning and return NULL
|
* function will set up png_malloc() to issue a png_warning and return NULL
|
||||||
* instead of issuing a png_error, if it fails to allocate the requested
|
* instead of issuing a png_error, if it fails to allocate the requested
|
||||||
* memory.
|
* memory.
|
||||||
*/
|
*/
|
||||||
PNG_FUNCTION(png_voidp,PNGAPI
|
png_voidp PNGAPI
|
||||||
png_malloc_warn,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
|
png_malloc_warn(png_structp png_ptr, png_uint_32 size)
|
||||||
{
|
{
|
||||||
png_voidp ptr;
|
png_voidp ptr;
|
||||||
png_uint_32 save_flags;
|
png_uint_32 save_flags;
|
||||||
if (png_ptr == NULL)
|
if(png_ptr == NULL) return (NULL);
|
||||||
return (NULL);
|
|
||||||
|
|
||||||
save_flags = png_ptr->flags;
|
save_flags=png_ptr->flags;
|
||||||
png_ptr->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK;
|
png_ptr->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK;
|
||||||
ptr = (png_voidp)png_malloc((png_structp)png_ptr, size);
|
ptr = (png_voidp)png_malloc((png_structp)png_ptr, size);
|
||||||
png_ptr->flags=save_flags;
|
png_ptr->flags=save_flags;
|
||||||
return(ptr);
|
return(ptr);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
png_voidp PNGAPI
|
||||||
|
png_memcpy_check (png_structp png_ptr, png_voidp s1, png_voidp s2,
|
||||||
|
png_uint_32 length)
|
||||||
|
{
|
||||||
|
png_size_t size;
|
||||||
|
|
||||||
|
size = (png_size_t)length;
|
||||||
|
if ((png_uint_32)size != length)
|
||||||
|
png_error(png_ptr,"Overflow in png_memcpy_check.");
|
||||||
|
|
||||||
|
return(png_memcpy (s1, s2, size));
|
||||||
|
}
|
||||||
|
|
||||||
|
png_voidp PNGAPI
|
||||||
|
png_memset_check (png_structp png_ptr, png_voidp s1, int value,
|
||||||
|
png_uint_32 length)
|
||||||
|
{
|
||||||
|
png_size_t size;
|
||||||
|
|
||||||
|
size = (png_size_t)length;
|
||||||
|
if ((png_uint_32)size != length)
|
||||||
|
png_error(png_ptr,"Overflow in png_memset_check.");
|
||||||
|
|
||||||
|
return (png_memset (s1, value, size));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
/* This function is called when the application wants to use another method
|
/* This function is called when the application wants to use another method
|
||||||
@@ -634,11 +587,10 @@ void PNGAPI
|
|||||||
png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
|
png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
|
||||||
malloc_fn, png_free_ptr free_fn)
|
malloc_fn, png_free_ptr free_fn)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL)
|
if(png_ptr != NULL) {
|
||||||
{
|
png_ptr->mem_ptr = mem_ptr;
|
||||||
png_ptr->mem_ptr = mem_ptr;
|
png_ptr->malloc_fn = malloc_fn;
|
||||||
png_ptr->malloc_fn = malloc_fn;
|
png_ptr->free_fn = free_fn;
|
||||||
png_ptr->free_fn = free_fn;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -647,11 +599,9 @@ png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
|
|||||||
* pointer before png_write_destroy and png_read_destroy are called.
|
* pointer before png_write_destroy and png_read_destroy are called.
|
||||||
*/
|
*/
|
||||||
png_voidp PNGAPI
|
png_voidp PNGAPI
|
||||||
png_get_mem_ptr(png_const_structp png_ptr)
|
png_get_mem_ptr(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
if(png_ptr == NULL) return (NULL);
|
||||||
return (NULL);
|
|
||||||
|
|
||||||
return ((png_voidp)png_ptr->mem_ptr);
|
return ((png_voidp)png_ptr->mem_ptr);
|
||||||
}
|
}
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
|
|||||||
875
pngpread.c
131
pngrio.c
@@ -1,15 +1,12 @@
|
|||||||
|
|
||||||
/* pngrio.c - functions for data input
|
/* pngrio.c - functions for data input
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.5.0 [January 6, 2011]
|
* Last changed in libpng 1.2.13 November 13, 2006
|
||||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
* This code is released under the libpng license.
|
|
||||||
* For conditions of distribution and use, see the disclaimer
|
|
||||||
* and license in png.h
|
|
||||||
*
|
|
||||||
* This file provides a location for all input. Users who need
|
* This file provides a location for all input. Users who need
|
||||||
* special handling are expected to write a function that has the same
|
* special handling are expected to write a function that has the same
|
||||||
* arguments as this and performs a similar function, but that possibly
|
* arguments as this and performs a similar function, but that possibly
|
||||||
@@ -18,53 +15,54 @@
|
|||||||
* libpng use it at run time with png_set_read_fn(...).
|
* libpng use it at run time with png_set_read_fn(...).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "pngpriv.h"
|
#define PNG_INTERNAL
|
||||||
|
#include "png.h"
|
||||||
|
|
||||||
#ifdef PNG_READ_SUPPORTED
|
#if defined(PNG_READ_SUPPORTED)
|
||||||
|
|
||||||
/* Read the data from whatever input you are using. The default routine
|
/* Read the data from whatever input you are using. The default routine
|
||||||
* reads from a file pointer. Note that this routine sometimes gets called
|
reads from a file pointer. Note that this routine sometimes gets called
|
||||||
* with very small lengths, so you should implement some kind of simple
|
with very small lengths, so you should implement some kind of simple
|
||||||
* buffering if you are using unbuffered reads. This should never be asked
|
buffering if you are using unbuffered reads. This should never be asked
|
||||||
* to read more then 64K on a 16 bit machine.
|
to read more then 64K on a 16 bit machine. */
|
||||||
*/
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
png_debug1(4, "reading %d bytes", (int)length);
|
png_debug1(4,"reading %d bytes\n", (int)length);
|
||||||
|
|
||||||
if (png_ptr->read_data_fn != NULL)
|
if (png_ptr->read_data_fn != NULL)
|
||||||
(*(png_ptr->read_data_fn))(png_ptr, data, length);
|
(*(png_ptr->read_data_fn))(png_ptr, data, length);
|
||||||
|
|
||||||
else
|
else
|
||||||
png_error(png_ptr, "Call to NULL read function");
|
png_error(png_ptr, "Call to NULL read function");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_STDIO_SUPPORTED
|
#if !defined(PNG_NO_STDIO)
|
||||||
/* This is the function that does the actual reading of data. If you are
|
/* This is the function that does the actual reading of data. If you are
|
||||||
* not reading from a standard C stream, you should create a replacement
|
not reading from a standard C stream, you should create a replacement
|
||||||
* read_data function and use it at run time with png_set_read_fn(), rather
|
read_data function and use it at run time with png_set_read_fn(), rather
|
||||||
* than changing the library.
|
than changing the library. */
|
||||||
*/
|
#ifndef USE_FAR_KEYWORD
|
||||||
# ifndef USE_FAR_KEYWORD
|
void PNGAPI
|
||||||
void PNGCBAPI
|
|
||||||
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
png_size_t check;
|
png_size_t check;
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
if(png_ptr == NULL) return;
|
||||||
return;
|
|
||||||
|
|
||||||
/* fread() returns 0 on error, so it is OK to store this in a png_size_t
|
/* fread() returns 0 on error, so it is OK to store this in a png_size_t
|
||||||
* instead of an int, which is what fread() actually returns.
|
* instead of an int, which is what fread() actually returns.
|
||||||
*/
|
*/
|
||||||
check = fread(data, 1, length, (png_FILE_p)png_ptr->io_ptr);
|
#if defined(_WIN32_WCE)
|
||||||
|
if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
|
||||||
|
check = 0;
|
||||||
|
#else
|
||||||
|
check = (png_size_t)fread(data, (png_size_t)1, length,
|
||||||
|
(png_FILE_p)png_ptr->io_ptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (check != length)
|
if (check != length)
|
||||||
png_error(png_ptr, "Read Error");
|
png_error(png_ptr, "Read Error");
|
||||||
}
|
}
|
||||||
# else
|
#else
|
||||||
/* This is the model-independent version. Since the standard I/O library
|
/* this is the model-independent version. Since the standard I/O library
|
||||||
can't handle far buffers in the medium and small models, we have to copy
|
can't handle far buffers in the medium and small models, we have to copy
|
||||||
the data.
|
the data.
|
||||||
*/
|
*/
|
||||||
@@ -72,88 +70,80 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
#define NEAR_BUF_SIZE 1024
|
#define NEAR_BUF_SIZE 1024
|
||||||
#define MIN(a,b) (a <= b ? a : b)
|
#define MIN(a,b) (a <= b ? a : b)
|
||||||
|
|
||||||
static void PNGCBAPI
|
static void PNGAPI
|
||||||
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
png_size_t check;
|
int check;
|
||||||
png_byte *n_data;
|
png_byte *n_data;
|
||||||
png_FILE_p io_ptr;
|
png_FILE_p io_ptr;
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
if(png_ptr == NULL) return;
|
||||||
return;
|
|
||||||
|
|
||||||
/* Check if data really is near. If so, use usual code. */
|
/* Check if data really is near. If so, use usual code. */
|
||||||
n_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
n_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
||||||
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
|
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
|
||||||
|
|
||||||
if ((png_bytep)n_data == data)
|
if ((png_bytep)n_data == data)
|
||||||
{
|
{
|
||||||
|
#if defined(_WIN32_WCE)
|
||||||
|
if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
|
||||||
|
check = 0;
|
||||||
|
#else
|
||||||
check = fread(n_data, 1, length, io_ptr);
|
check = fread(n_data, 1, length, io_ptr);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_byte buf[NEAR_BUF_SIZE];
|
png_byte buf[NEAR_BUF_SIZE];
|
||||||
png_size_t read, remaining, err;
|
png_size_t read, remaining, err;
|
||||||
check = 0;
|
check = 0;
|
||||||
remaining = length;
|
remaining = length;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
read = MIN(NEAR_BUF_SIZE, remaining);
|
read = MIN(NEAR_BUF_SIZE, remaining);
|
||||||
err = fread(buf, 1, read, io_ptr);
|
#if defined(_WIN32_WCE)
|
||||||
|
if ( !ReadFile((HANDLE)(io_ptr), buf, read, &err, NULL) )
|
||||||
|
err = 0;
|
||||||
|
#else
|
||||||
|
err = fread(buf, (png_size_t)1, read, io_ptr);
|
||||||
|
#endif
|
||||||
png_memcpy(data, buf, read); /* copy far buffer to near buffer */
|
png_memcpy(data, buf, read); /* copy far buffer to near buffer */
|
||||||
|
if(err != read)
|
||||||
if (err != read)
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
else
|
else
|
||||||
check += err;
|
check += err;
|
||||||
|
|
||||||
data += read;
|
data += read;
|
||||||
remaining -= read;
|
remaining -= read;
|
||||||
}
|
}
|
||||||
while (remaining != 0);
|
while (remaining != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((png_uint_32)check != (png_uint_32)length)
|
if ((png_uint_32)check != (png_uint_32)length)
|
||||||
png_error(png_ptr, "read Error");
|
png_error(png_ptr, "read Error");
|
||||||
}
|
}
|
||||||
# endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This function allows the application to supply a new input function
|
/* This function allows the application to supply a new input function
|
||||||
* for libpng if standard C streams aren't being used.
|
for libpng if standard C streams aren't being used.
|
||||||
*
|
|
||||||
* This function takes as its arguments:
|
This function takes as its arguments:
|
||||||
*
|
png_ptr - pointer to a png input data structure
|
||||||
* png_ptr - pointer to a png input data structure
|
io_ptr - pointer to user supplied structure containing info about
|
||||||
*
|
the input functions. May be NULL.
|
||||||
* io_ptr - pointer to user supplied structure containing info about
|
read_data_fn - pointer to a new input function that takes as its
|
||||||
* the input functions. May be NULL.
|
arguments a pointer to a png_struct, a pointer to
|
||||||
*
|
a location where input data can be stored, and a 32-bit
|
||||||
* read_data_fn - pointer to a new input function that takes as its
|
unsigned int that is the number of bytes to be read.
|
||||||
* arguments a pointer to a png_struct, a pointer to
|
To exit and output any fatal error messages the new write
|
||||||
* a location where input data can be stored, and a 32-bit
|
function should call png_error(png_ptr, "Error msg"). */
|
||||||
* unsigned int that is the number of bytes to be read.
|
|
||||||
* To exit and output any fatal error messages the new write
|
|
||||||
* function should call png_error(png_ptr, "Error msg").
|
|
||||||
* May be NULL, in which case libpng's default function will
|
|
||||||
* be used.
|
|
||||||
*/
|
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
|
png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
|
||||||
png_rw_ptr read_data_fn)
|
png_rw_ptr read_data_fn)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
if(png_ptr == NULL) return;
|
||||||
return;
|
|
||||||
|
|
||||||
png_ptr->io_ptr = io_ptr;
|
png_ptr->io_ptr = io_ptr;
|
||||||
|
|
||||||
#ifdef PNG_STDIO_SUPPORTED
|
#if !defined(PNG_NO_STDIO)
|
||||||
if (read_data_fn != NULL)
|
if (read_data_fn != NULL)
|
||||||
png_ptr->read_data_fn = read_data_fn;
|
png_ptr->read_data_fn = read_data_fn;
|
||||||
|
|
||||||
else
|
else
|
||||||
png_ptr->read_data_fn = png_default_read_data;
|
png_ptr->read_data_fn = png_default_read_data;
|
||||||
#else
|
#else
|
||||||
@@ -165,11 +155,12 @@ png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
|
|||||||
{
|
{
|
||||||
png_ptr->write_data_fn = NULL;
|
png_ptr->write_data_fn = NULL;
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"Can't set both read_data_fn and write_data_fn in the"
|
"It's an error to set both read_data_fn and write_data_fn in the ");
|
||||||
" same structure");
|
png_warning(png_ptr,
|
||||||
|
"same structure. Resetting write_data_fn to NULL.");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
||||||
png_ptr->output_flush_fn = NULL;
|
png_ptr->output_flush_fn = NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
2642
pngrtran.c
2434
pngrutil.c
308
pngstruct.h
@@ -1,308 +0,0 @@
|
|||||||
|
|
||||||
/* pngstruct.h - header file for PNG reference library
|
|
||||||
*
|
|
||||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
|
||||||
*
|
|
||||||
* Last changed in libpng 1.5.0 [January 6, 2011]
|
|
||||||
*
|
|
||||||
* This code is released under the libpng license.
|
|
||||||
* For conditions of distribution and use, see the disclaimer
|
|
||||||
* and license in png.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* The structure that holds the information to read and write PNG files.
|
|
||||||
* The only people who need to care about what is inside of this are the
|
|
||||||
* people who will be modifying the library for their own special needs.
|
|
||||||
* It should NOT be accessed directly by an application.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef PNGSTRUCT_H
|
|
||||||
#define PNGSTRUCT_H
|
|
||||||
/* zlib.h defines the structure z_stream, an instance of which is included
|
|
||||||
* in this structure and is required for decompressing the LZ compressed
|
|
||||||
* data in PNG files.
|
|
||||||
*/
|
|
||||||
#include "zlib.h"
|
|
||||||
|
|
||||||
struct png_struct_def
|
|
||||||
{
|
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
|
||||||
jmp_buf png_jmpbuf; /* used in png_error */
|
|
||||||
png_longjmp_ptr longjmp_fn;/* setjmp non-local goto function. */
|
|
||||||
#endif
|
|
||||||
png_error_ptr error_fn; /* function for printing errors and aborting */
|
|
||||||
png_error_ptr warning_fn; /* function for printing warnings */
|
|
||||||
png_voidp error_ptr; /* user supplied struct for error functions */
|
|
||||||
png_rw_ptr write_data_fn; /* function for writing output data */
|
|
||||||
png_rw_ptr read_data_fn; /* function for reading input data */
|
|
||||||
png_voidp io_ptr; /* ptr to application struct for I/O functions */
|
|
||||||
|
|
||||||
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
|
|
||||||
png_user_transform_ptr read_user_transform_fn; /* user read transform */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
|
|
||||||
png_user_transform_ptr write_user_transform_fn; /* user write transform */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* These were added in libpng-1.0.2 */
|
|
||||||
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
|
|
||||||
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
|
|
||||||
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
|
||||||
png_voidp user_transform_ptr; /* user supplied struct for user transform */
|
|
||||||
png_byte user_transform_depth; /* bit depth of user transformed pixels */
|
|
||||||
png_byte user_transform_channels; /* channels in user transformed pixels */
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
png_uint_32 mode; /* tells us where we are in the PNG file */
|
|
||||||
png_uint_32 flags; /* flags indicating various things to libpng */
|
|
||||||
png_uint_32 transformations; /* which transformations to perform */
|
|
||||||
|
|
||||||
z_stream zstream; /* pointer to decompression structure (below) */
|
|
||||||
png_bytep zbuf; /* buffer for zlib */
|
|
||||||
uInt zbuf_size; /* size of zbuf (typically 65536) */
|
|
||||||
int zlib_level; /* holds zlib compression level */
|
|
||||||
int zlib_method; /* holds zlib compression method */
|
|
||||||
int zlib_window_bits; /* holds zlib compression window bits */
|
|
||||||
int zlib_mem_level; /* holds zlib compression memory level */
|
|
||||||
int zlib_strategy; /* holds zlib compression strategy */
|
|
||||||
|
|
||||||
png_uint_32 width; /* width of image in pixels */
|
|
||||||
png_uint_32 height; /* height of image in pixels */
|
|
||||||
png_uint_32 num_rows; /* number of rows in current pass */
|
|
||||||
png_uint_32 usr_width; /* width of row at start of write */
|
|
||||||
png_size_t rowbytes; /* size of row in bytes */
|
|
||||||
png_uint_32 iwidth; /* width of current interlaced row in pixels */
|
|
||||||
png_uint_32 row_number; /* current row in interlace pass */
|
|
||||||
png_bytep prev_row; /* buffer to save previous (unfiltered) row */
|
|
||||||
png_bytep row_buf; /* buffer to save current (unfiltered) row */
|
|
||||||
png_bytep sub_row; /* buffer to save "sub" row when filtering */
|
|
||||||
png_bytep up_row; /* buffer to save "up" row when filtering */
|
|
||||||
png_bytep avg_row; /* buffer to save "avg" row when filtering */
|
|
||||||
png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */
|
|
||||||
png_row_info row_info; /* used for transformation routines */
|
|
||||||
|
|
||||||
png_uint_32 idat_size; /* current IDAT size for read */
|
|
||||||
png_uint_32 crc; /* current chunk CRC value */
|
|
||||||
png_colorp palette; /* palette from the input file */
|
|
||||||
png_uint_16 num_palette; /* number of color entries in palette */
|
|
||||||
png_uint_16 num_trans; /* number of transparency values */
|
|
||||||
png_byte chunk_name[5]; /* null-terminated name of current chunk */
|
|
||||||
png_byte compression; /* file compression type (always 0) */
|
|
||||||
png_byte filter; /* file filter type (always 0) */
|
|
||||||
png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
|
|
||||||
png_byte pass; /* current interlace pass (0 - 6) */
|
|
||||||
png_byte do_filter; /* row filter flags (see PNG_FILTER_ below ) */
|
|
||||||
png_byte color_type; /* color type of file */
|
|
||||||
png_byte bit_depth; /* bit depth of file */
|
|
||||||
png_byte usr_bit_depth; /* bit depth of users row */
|
|
||||||
png_byte pixel_depth; /* number of bits per pixel */
|
|
||||||
png_byte channels; /* number of channels in file */
|
|
||||||
png_byte usr_channels; /* channels at start of write */
|
|
||||||
png_byte sig_bytes; /* magic bytes read/written from start of file */
|
|
||||||
|
|
||||||
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
|
|
||||||
png_uint_16 filler; /* filler bytes for pixel expansion */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_bKGD_SUPPORTED
|
|
||||||
png_byte background_gamma_type;
|
|
||||||
png_fixed_point background_gamma;
|
|
||||||
png_color_16 background; /* background color in screen gamma space */
|
|
||||||
#ifdef PNG_READ_GAMMA_SUPPORTED
|
|
||||||
png_color_16 background_1; /* background normalized to gamma 1.0 */
|
|
||||||
#endif
|
|
||||||
#endif /* PNG_bKGD_SUPPORTED */
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
|
||||||
png_flush_ptr output_flush_fn; /* Function for flushing output */
|
|
||||||
png_uint_32 flush_dist; /* how many rows apart to flush, 0 - no flush */
|
|
||||||
png_uint_32 flush_rows; /* number of rows written since last flush */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
|
|
||||||
int gamma_shift; /* number of "insignificant" bits in 16-bit gamma */
|
|
||||||
png_fixed_point gamma; /* file gamma value */
|
|
||||||
png_fixed_point screen_gamma; /* screen gamma value (display_exponent) */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
|
|
||||||
png_bytep gamma_table; /* gamma table for 8-bit depth files */
|
|
||||||
png_bytep gamma_from_1; /* converts from 1.0 to screen */
|
|
||||||
png_bytep gamma_to_1; /* converts from file to 1.0 */
|
|
||||||
png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */
|
|
||||||
png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */
|
|
||||||
png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED)
|
|
||||||
png_color_8 sig_bit; /* significant bits in each available channel */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
|
|
||||||
png_color_8 shift; /* shift for significant bit tranformation */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \
|
|
||||||
|| defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
|
|
||||||
png_bytep trans_alpha; /* alpha values for paletted files */
|
|
||||||
png_color_16 trans_color; /* transparent color for non-paletted files */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
png_read_status_ptr read_row_fn; /* called after each row is decoded */
|
|
||||||
png_write_status_ptr write_row_fn; /* called after each row is encoded */
|
|
||||||
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
|
|
||||||
png_progressive_info_ptr info_fn; /* called after header data fully read */
|
|
||||||
png_progressive_row_ptr row_fn; /* called after a prog. row is decoded */
|
|
||||||
png_progressive_end_ptr end_fn; /* called after image is complete */
|
|
||||||
png_bytep save_buffer_ptr; /* current location in save_buffer */
|
|
||||||
png_bytep save_buffer; /* buffer for previously read data */
|
|
||||||
png_bytep current_buffer_ptr; /* current location in current_buffer */
|
|
||||||
png_bytep current_buffer; /* buffer for recently used data */
|
|
||||||
png_uint_32 push_length; /* size of current input chunk */
|
|
||||||
png_uint_32 skip_length; /* bytes to skip in input data */
|
|
||||||
png_size_t save_buffer_size; /* amount of data now in save_buffer */
|
|
||||||
png_size_t save_buffer_max; /* total size of save_buffer */
|
|
||||||
png_size_t buffer_size; /* total amount of available input data */
|
|
||||||
png_size_t current_buffer_size; /* amount of data now in current_buffer */
|
|
||||||
int process_mode; /* what push library is currently doing */
|
|
||||||
int cur_palette; /* current push library palette index */
|
|
||||||
|
|
||||||
# ifdef PNG_TEXT_SUPPORTED
|
|
||||||
png_size_t current_text_size; /* current size of text input data */
|
|
||||||
png_size_t current_text_left; /* how much text left to read in input */
|
|
||||||
png_charp current_text; /* current text chunk buffer */
|
|
||||||
png_charp current_text_ptr; /* current location in current_text */
|
|
||||||
# endif /* PNG_PROGRESSIVE_READ_SUPPORTED && PNG_TEXT_SUPPORTED */
|
|
||||||
|
|
||||||
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
|
||||||
|
|
||||||
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
|
|
||||||
/* For the Borland special 64K segment handler */
|
|
||||||
png_bytepp offset_table_ptr;
|
|
||||||
png_bytep offset_table;
|
|
||||||
png_uint_16 offset_table_number;
|
|
||||||
png_uint_16 offset_table_count;
|
|
||||||
png_uint_16 offset_table_count_free;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
|
||||||
png_bytep palette_lookup; /* lookup table for quantizing */
|
|
||||||
png_bytep quantize_index; /* index translation for palette files */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_READ_QUANTIZE_SUPPORTED) || defined(PNG_hIST_SUPPORTED)
|
|
||||||
png_uint_16p hist; /* histogram */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
|
||||||
png_byte heuristic_method; /* heuristic for row filter selection */
|
|
||||||
png_byte num_prev_filters; /* number of weights for previous rows */
|
|
||||||
png_bytep prev_filters; /* filter type(s) of previous row(s) */
|
|
||||||
png_uint_16p filter_weights; /* weight(s) for previous line(s) */
|
|
||||||
png_uint_16p inv_filter_weights; /* 1/weight(s) for previous line(s) */
|
|
||||||
png_uint_16p filter_costs; /* relative filter calculation cost */
|
|
||||||
png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_TIME_RFC1123_SUPPORTED
|
|
||||||
png_charp time_buffer; /* String to hold RFC 1123 time text */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* New members added in libpng-1.0.6 */
|
|
||||||
|
|
||||||
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
|
|
||||||
|
|
||||||
#ifdef PNG_USER_CHUNKS_SUPPORTED
|
|
||||||
png_voidp user_chunk_ptr;
|
|
||||||
png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
|
||||||
int num_chunk_list;
|
|
||||||
png_bytep chunk_list;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* New members added in libpng-1.0.3 */
|
|
||||||
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
|
|
||||||
png_byte rgb_to_gray_status;
|
|
||||||
/* These were changed from png_byte in libpng-1.0.6 */
|
|
||||||
png_uint_16 rgb_to_gray_red_coeff;
|
|
||||||
png_uint_16 rgb_to_gray_green_coeff;
|
|
||||||
png_uint_16 rgb_to_gray_blue_coeff;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* New member added in libpng-1.0.4 (renamed in 1.0.9) */
|
|
||||||
#if defined(PNG_MNG_FEATURES_SUPPORTED) || \
|
|
||||||
defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
|
|
||||||
defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
|
|
||||||
/* Changed from png_byte to png_uint_32 at version 1.2.0 */
|
|
||||||
png_uint_32 mng_features_permitted;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */
|
|
||||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
|
||||||
png_byte filter_type;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* New members added in libpng-1.2.0 */
|
|
||||||
|
|
||||||
/* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
|
||||||
png_voidp mem_ptr; /* user supplied struct for mem functions */
|
|
||||||
png_malloc_ptr malloc_fn; /* function for allocating memory */
|
|
||||||
png_free_ptr free_fn; /* function for freeing memory */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* New member added in libpng-1.0.13 and 1.2.0 */
|
|
||||||
png_bytep big_row_buf; /* buffer to save current (unfiltered) row */
|
|
||||||
|
|
||||||
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
|
||||||
/* The following three members were added at version 1.0.14 and 1.2.4 */
|
|
||||||
png_bytep quantize_sort; /* working sort array */
|
|
||||||
png_bytep index_to_palette; /* where the original index currently is
|
|
||||||
in the palette */
|
|
||||||
png_bytep palette_to_index; /* which original index points to this
|
|
||||||
palette color */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* New members added in libpng-1.0.16 and 1.2.6 */
|
|
||||||
png_byte compression_type;
|
|
||||||
|
|
||||||
#ifdef PNG_USER_LIMITS_SUPPORTED
|
|
||||||
png_uint_32 user_width_max;
|
|
||||||
png_uint_32 user_height_max;
|
|
||||||
|
|
||||||
/* Added in libpng-1.4.0: Total number of sPLT, text, and unknown
|
|
||||||
* chunks that can be stored (0 means unlimited).
|
|
||||||
*/
|
|
||||||
png_uint_32 user_chunk_cache_max;
|
|
||||||
|
|
||||||
/* Total memory that a zTXt, sPLT, iTXt, iCCP, or unknown chunk
|
|
||||||
* can occupy when decompressed. 0 means unlimited.
|
|
||||||
*/
|
|
||||||
png_alloc_size_t user_chunk_malloc_max;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* New member added in libpng-1.0.25 and 1.2.17 */
|
|
||||||
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
|
|
||||||
/* Storage for unknown chunk that the library doesn't recognize. */
|
|
||||||
png_unknown_chunk unknown_chunk;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* New members added in libpng-1.2.26 */
|
|
||||||
png_size_t old_big_row_buf_size;
|
|
||||||
png_size_t old_prev_row_size;
|
|
||||||
|
|
||||||
/* New member added in libpng-1.2.30 */
|
|
||||||
png_charp chunkdata; /* buffer for reading chunk data */
|
|
||||||
|
|
||||||
#ifdef PNG_IO_STATE_SUPPORTED
|
|
||||||
/* New member added in libpng-1.4.0 */
|
|
||||||
png_uint_32 io_state;
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
#endif /* PNGSTRUCT_H */
|
|
||||||
BIN
pngtest.png
|
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.4 KiB |
486
pngtrans.c
@@ -1,59 +1,47 @@
|
|||||||
|
|
||||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.5.2 [March 31, 2011]
|
* Last changed in libpng 1.2.17 May 15, 2007
|
||||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
|
||||||
* This code is released under the libpng license.
|
|
||||||
* For conditions of distribution and use, see the disclaimer
|
|
||||||
* and license in png.h
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "pngpriv.h"
|
#define PNG_INTERNAL
|
||||||
|
#include "png.h"
|
||||||
|
|
||||||
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
||||||
|
|
||||||
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
|
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
|
||||||
/* Turn on BGR-to-RGB mapping */
|
/* turn on BGR-to-RGB mapping */
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_bgr(png_structp png_ptr)
|
png_set_bgr(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_bgr");
|
png_debug(1, "in png_set_bgr\n");
|
||||||
|
if(png_ptr == NULL) return;
|
||||||
if (png_ptr == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
png_ptr->transformations |= PNG_BGR;
|
png_ptr->transformations |= PNG_BGR;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
|
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
|
||||||
/* Turn on 16 bit byte swapping */
|
/* turn on 16 bit byte swapping */
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_swap(png_structp png_ptr)
|
png_set_swap(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_swap");
|
png_debug(1, "in png_set_swap\n");
|
||||||
|
if(png_ptr == NULL) return;
|
||||||
if (png_ptr == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (png_ptr->bit_depth == 16)
|
if (png_ptr->bit_depth == 16)
|
||||||
png_ptr->transformations |= PNG_SWAP_BYTES;
|
png_ptr->transformations |= PNG_SWAP_BYTES;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
||||||
/* Turn on pixel packing */
|
/* turn on pixel packing */
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_packing(png_structp png_ptr)
|
png_set_packing(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_packing");
|
png_debug(1, "in png_set_packing\n");
|
||||||
|
if(png_ptr == NULL) return;
|
||||||
if (png_ptr == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (png_ptr->bit_depth < 8)
|
if (png_ptr->bit_depth < 8)
|
||||||
{
|
{
|
||||||
png_ptr->transformations |= PNG_PACK;
|
png_ptr->transformations |= PNG_PACK;
|
||||||
@@ -63,15 +51,12 @@ png_set_packing(png_structp png_ptr)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
|
#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
|
||||||
/* Turn on packed pixel swapping */
|
/* turn on packed pixel swapping */
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_packswap(png_structp png_ptr)
|
png_set_packswap(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_packswap");
|
png_debug(1, "in png_set_packswap\n");
|
||||||
|
if(png_ptr == NULL) return;
|
||||||
if (png_ptr == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (png_ptr->bit_depth < 8)
|
if (png_ptr->bit_depth < 8)
|
||||||
png_ptr->transformations |= PNG_PACKSWAP;
|
png_ptr->transformations |= PNG_PACKSWAP;
|
||||||
}
|
}
|
||||||
@@ -79,13 +64,10 @@ png_set_packswap(png_structp png_ptr)
|
|||||||
|
|
||||||
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
|
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_shift(png_structp png_ptr, png_const_color_8p true_bits)
|
png_set_shift(png_structp png_ptr, png_color_8p true_bits)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_shift");
|
png_debug(1, "in png_set_shift\n");
|
||||||
|
if(png_ptr == NULL) return;
|
||||||
if (png_ptr == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
png_ptr->transformations |= PNG_SHIFT;
|
png_ptr->transformations |= PNG_SHIFT;
|
||||||
png_ptr->shift = *true_bits;
|
png_ptr->shift = *true_bits;
|
||||||
}
|
}
|
||||||
@@ -96,8 +78,7 @@ png_set_shift(png_structp png_ptr, png_const_color_8p true_bits)
|
|||||||
int PNGAPI
|
int PNGAPI
|
||||||
png_set_interlace_handling(png_structp png_ptr)
|
png_set_interlace_handling(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_interlace handling");
|
png_debug(1, "in png_set_interlace handling\n");
|
||||||
|
|
||||||
if (png_ptr && png_ptr->interlaced)
|
if (png_ptr && png_ptr->interlaced)
|
||||||
{
|
{
|
||||||
png_ptr->transformations |= PNG_INTERLACE;
|
png_ptr->transformations |= PNG_INTERLACE;
|
||||||
@@ -117,17 +98,12 @@ png_set_interlace_handling(png_structp png_ptr)
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_filler");
|
png_debug(1, "in png_set_filler\n");
|
||||||
|
if(png_ptr == NULL) return;
|
||||||
if (png_ptr == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
png_ptr->transformations |= PNG_FILLER;
|
png_ptr->transformations |= PNG_FILLER;
|
||||||
png_ptr->filler = (png_uint_16)filler;
|
png_ptr->filler = (png_byte)filler;
|
||||||
|
|
||||||
if (filler_loc == PNG_FILLER_AFTER)
|
if (filler_loc == PNG_FILLER_AFTER)
|
||||||
png_ptr->flags |= PNG_FLAG_FILLER_AFTER;
|
png_ptr->flags |= PNG_FLAG_FILLER_AFTER;
|
||||||
|
|
||||||
else
|
else
|
||||||
png_ptr->flags &= ~PNG_FLAG_FILLER_AFTER;
|
png_ptr->flags &= ~PNG_FLAG_FILLER_AFTER;
|
||||||
|
|
||||||
@@ -142,7 +118,7 @@ png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Also I added this in libpng-1.0.2a (what happens when we expand
|
/* Also I added this in libpng-1.0.2a (what happens when we expand
|
||||||
* a less-than-8-bit grayscale to GA?) */
|
* a less-than-8-bit grayscale to GA? */
|
||||||
|
|
||||||
if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY && png_ptr->bit_depth >= 8)
|
if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY && png_ptr->bit_depth >= 8)
|
||||||
{
|
{
|
||||||
@@ -150,18 +126,17 @@ png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(PNG_1_0_X)
|
||||||
/* Added to libpng-1.2.7 */
|
/* Added to libpng-1.2.7 */
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_add_alpha");
|
png_debug(1, "in png_set_add_alpha\n");
|
||||||
|
if(png_ptr == NULL) return;
|
||||||
if (png_ptr == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
png_set_filler(png_ptr, filler, filler_loc);
|
png_set_filler(png_ptr, filler, filler_loc);
|
||||||
png_ptr->transformations |= PNG_ADD_ALPHA;
|
png_ptr->transformations |= PNG_ADD_ALPHA;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -170,11 +145,8 @@ png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_swap_alpha(png_structp png_ptr)
|
png_set_swap_alpha(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_swap_alpha");
|
png_debug(1, "in png_set_swap_alpha\n");
|
||||||
|
if(png_ptr == NULL) return;
|
||||||
if (png_ptr == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
png_ptr->transformations |= PNG_SWAP_ALPHA;
|
png_ptr->transformations |= PNG_SWAP_ALPHA;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -184,11 +156,8 @@ png_set_swap_alpha(png_structp png_ptr)
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_invert_alpha(png_structp png_ptr)
|
png_set_invert_alpha(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_invert_alpha");
|
png_debug(1, "in png_set_invert_alpha\n");
|
||||||
|
if(png_ptr == NULL) return;
|
||||||
if (png_ptr == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
png_ptr->transformations |= PNG_INVERT_ALPHA;
|
png_ptr->transformations |= PNG_INVERT_ALPHA;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -197,28 +166,28 @@ png_set_invert_alpha(png_structp png_ptr)
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_invert_mono(png_structp png_ptr)
|
png_set_invert_mono(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_invert_mono");
|
png_debug(1, "in png_set_invert_mono\n");
|
||||||
|
if(png_ptr == NULL) return;
|
||||||
if (png_ptr == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
png_ptr->transformations |= PNG_INVERT_MONO;
|
png_ptr->transformations |= PNG_INVERT_MONO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Invert monochrome grayscale data */
|
/* invert monochrome grayscale data */
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_do_invert(png_row_infop row_info, png_bytep row)
|
png_do_invert(png_row_infop row_info, png_bytep row)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_invert");
|
png_debug(1, "in png_do_invert\n");
|
||||||
|
|
||||||
/* This test removed from libpng version 1.0.13 and 1.2.0:
|
/* This test removed from libpng version 1.0.13 and 1.2.0:
|
||||||
* if (row_info->bit_depth == 1 &&
|
* if (row_info->bit_depth == 1 &&
|
||||||
*/
|
*/
|
||||||
|
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
||||||
|
if (row == NULL || row_info == NULL)
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
if (row_info->color_type == PNG_COLOR_TYPE_GRAY)
|
if (row_info->color_type == PNG_COLOR_TYPE_GRAY)
|
||||||
{
|
{
|
||||||
png_bytep rp = row;
|
png_bytep rp = row;
|
||||||
png_size_t i;
|
png_uint_32 i;
|
||||||
png_size_t istop = row_info->rowbytes;
|
png_uint_32 istop = row_info->rowbytes;
|
||||||
|
|
||||||
for (i = 0; i < istop; i++)
|
for (i = 0; i < istop; i++)
|
||||||
{
|
{
|
||||||
@@ -226,49 +195,47 @@ png_do_invert(png_row_infop row_info, png_bytep row)
|
|||||||
rp++;
|
rp++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA &&
|
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA &&
|
||||||
row_info->bit_depth == 8)
|
row_info->bit_depth == 8)
|
||||||
{
|
{
|
||||||
png_bytep rp = row;
|
png_bytep rp = row;
|
||||||
png_size_t i;
|
png_uint_32 i;
|
||||||
png_size_t istop = row_info->rowbytes;
|
png_uint_32 istop = row_info->rowbytes;
|
||||||
|
|
||||||
for (i = 0; i < istop; i += 2)
|
for (i = 0; i < istop; i+=2)
|
||||||
{
|
{
|
||||||
*rp = (png_byte)(~(*rp));
|
*rp = (png_byte)(~(*rp));
|
||||||
rp += 2;
|
rp+=2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_16BIT_SUPPORTED
|
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA &&
|
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA &&
|
||||||
row_info->bit_depth == 16)
|
row_info->bit_depth == 16)
|
||||||
{
|
{
|
||||||
png_bytep rp = row;
|
png_bytep rp = row;
|
||||||
png_size_t i;
|
png_uint_32 i;
|
||||||
png_size_t istop = row_info->rowbytes;
|
png_uint_32 istop = row_info->rowbytes;
|
||||||
|
|
||||||
for (i = 0; i < istop; i += 4)
|
for (i = 0; i < istop; i+=4)
|
||||||
{
|
{
|
||||||
*rp = (png_byte)(~(*rp));
|
*rp = (png_byte)(~(*rp));
|
||||||
*(rp + 1) = (png_byte)(~(*(rp + 1)));
|
*(rp+1) = (png_byte)(~(*(rp+1)));
|
||||||
rp += 4;
|
rp+=4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_16BIT_SUPPORTED
|
|
||||||
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
|
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
|
||||||
/* Swaps byte order on 16 bit depth images */
|
/* swaps byte order on 16 bit depth images */
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_do_swap(png_row_infop row_info, png_bytep row)
|
png_do_swap(png_row_infop row_info, png_bytep row)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_swap");
|
png_debug(1, "in png_do_swap\n");
|
||||||
|
if (
|
||||||
if (row_info->bit_depth == 16)
|
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
||||||
|
row != NULL && row_info != NULL &&
|
||||||
|
#endif
|
||||||
|
row_info->bit_depth == 16)
|
||||||
{
|
{
|
||||||
png_bytep rp = row;
|
png_bytep rp = row;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
@@ -283,7 +250,6 @@ png_do_swap(png_row_infop row_info, png_bytep row)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
|
#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
|
||||||
static PNG_CONST png_byte onebppswaptable[256] = {
|
static PNG_CONST png_byte onebppswaptable[256] = {
|
||||||
@@ -391,28 +357,27 @@ static PNG_CONST png_byte fourbppswaptable[256] = {
|
|||||||
0x8F, 0x9F, 0xAF, 0xBF, 0xCF, 0xDF, 0xEF, 0xFF
|
0x8F, 0x9F, 0xAF, 0xBF, 0xCF, 0xDF, 0xEF, 0xFF
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Swaps pixel packing order within bytes */
|
/* swaps pixel packing order within bytes */
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_do_packswap(png_row_infop row_info, png_bytep row)
|
png_do_packswap(png_row_infop row_info, png_bytep row)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_packswap");
|
png_debug(1, "in png_do_packswap\n");
|
||||||
|
if (
|
||||||
if (row_info->bit_depth < 8)
|
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
||||||
|
row != NULL && row_info != NULL &&
|
||||||
|
#endif
|
||||||
|
row_info->bit_depth < 8)
|
||||||
{
|
{
|
||||||
png_bytep rp;
|
png_bytep rp, end, table;
|
||||||
png_const_bytep end, table;
|
|
||||||
|
|
||||||
end = row + row_info->rowbytes;
|
end = row + row_info->rowbytes;
|
||||||
|
|
||||||
if (row_info->bit_depth == 1)
|
if (row_info->bit_depth == 1)
|
||||||
table = onebppswaptable;
|
table = (png_bytep)onebppswaptable;
|
||||||
|
|
||||||
else if (row_info->bit_depth == 2)
|
else if (row_info->bit_depth == 2)
|
||||||
table = twobppswaptable;
|
table = (png_bytep)twobppswaptable;
|
||||||
|
|
||||||
else if (row_info->bit_depth == 4)
|
else if (row_info->bit_depth == 4)
|
||||||
table = fourbppswaptable;
|
table = (png_bytep)fourbppswaptable;
|
||||||
|
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -424,126 +389,174 @@ png_do_packswap(png_row_infop row_info, png_bytep row)
|
|||||||
|
|
||||||
#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
|
#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
|
||||||
defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
|
defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
|
||||||
/* Remove a channel - this used to be 'png_do_strip_filler' but it used a
|
/* remove filler or alpha byte(s) */
|
||||||
* somewhat weird combination of flags to determine what to do. All the calls
|
|
||||||
* to png_do_strip_filler are changed in 1.5.2 to call this instead with the
|
|
||||||
* correct arguments.
|
|
||||||
*
|
|
||||||
* The routine isn't general - the channel must be the channel at the start or
|
|
||||||
* end (not in the middle) of each pixel.
|
|
||||||
*/
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
||||||
{
|
{
|
||||||
png_bytep sp = row; /* source pointer */
|
png_debug(1, "in png_do_strip_filler\n");
|
||||||
png_bytep dp = row; /* destination pointer */
|
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
||||||
png_bytep ep = row + row_info->rowbytes; /* One beyond end of row */
|
if (row != NULL && row_info != NULL)
|
||||||
|
#endif
|
||||||
/* At the start sp will point to the first byte to copy and dp to where
|
|
||||||
* it is copied to. ep always points just beyond the end of the row, so
|
|
||||||
* the loop simply copies (channels-1) channels until sp reaches ep.
|
|
||||||
*/
|
|
||||||
/* GA, GX, XG cases */
|
|
||||||
if (row_info->channels == 2)
|
|
||||||
{
|
{
|
||||||
if (row_info->bit_depth == 8)
|
png_bytep sp=row;
|
||||||
|
png_bytep dp=row;
|
||||||
|
png_uint_32 row_width=row_info->width;
|
||||||
|
png_uint_32 i;
|
||||||
|
|
||||||
|
if ((row_info->color_type == PNG_COLOR_TYPE_RGB ||
|
||||||
|
(row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA &&
|
||||||
|
(flags & PNG_FLAG_STRIP_ALPHA))) &&
|
||||||
|
row_info->channels == 4)
|
||||||
{
|
{
|
||||||
if (at_start) /* Skip initial filler */
|
if (row_info->bit_depth == 8)
|
||||||
++sp;
|
|
||||||
else /* Skip initial channels and, for sp, the filler */
|
|
||||||
sp += 2, ++dp;
|
|
||||||
|
|
||||||
/* For a 1 pixel wide image there is nothing to do */
|
|
||||||
while (sp < ep)
|
|
||||||
*dp++ = *sp, sp += 2;
|
|
||||||
|
|
||||||
row_info->pixel_depth = 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (row_info->bit_depth == 16)
|
|
||||||
{
|
|
||||||
if (at_start)
|
|
||||||
sp += 2;
|
|
||||||
else
|
|
||||||
sp += 4, dp += 2;
|
|
||||||
|
|
||||||
while (sp < ep)
|
|
||||||
*dp++ = *sp++, *dp++ = *sp, sp += 3;
|
|
||||||
|
|
||||||
row_info->pixel_depth = 16;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
return; /* bad bit depth */
|
|
||||||
|
|
||||||
row_info->channels = 1;
|
|
||||||
|
|
||||||
/* Finally fix the color type if it records an alpha channel */
|
|
||||||
if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
|
||||||
row_info->color_type = PNG_COLOR_TYPE_GRAY;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* RGBA, RGBX, XRGB cases */
|
|
||||||
else if (row_info->channels == 4)
|
|
||||||
{
|
|
||||||
if (row_info->bit_depth == 8)
|
|
||||||
{
|
|
||||||
if (at_start) /* Skip initial filler */
|
|
||||||
++sp;
|
|
||||||
else /* Skip initial channels and, for sp, the filler */
|
|
||||||
sp += 4, dp += 3;
|
|
||||||
|
|
||||||
/* Note that the loop adds 3 to dp and 4 to sp each time. */
|
|
||||||
while (sp < ep)
|
|
||||||
*dp++ = *sp++, *dp++ = *sp++, *dp++ = *sp, sp += 2;
|
|
||||||
|
|
||||||
row_info->pixel_depth = 24;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (row_info->bit_depth == 16)
|
|
||||||
{
|
|
||||||
if (at_start)
|
|
||||||
sp += 2;
|
|
||||||
else
|
|
||||||
sp += 8, dp += 6;
|
|
||||||
|
|
||||||
while (sp < ep)
|
|
||||||
{
|
{
|
||||||
/* Copy 6 bytes, skip 2 */
|
/* This converts from RGBX or RGBA to RGB */
|
||||||
*dp++ = *sp++, *dp++ = *sp++;
|
if (flags & PNG_FLAG_FILLER_AFTER)
|
||||||
*dp++ = *sp++, *dp++ = *sp++;
|
{
|
||||||
*dp++ = *sp++, *dp++ = *sp, sp += 3;
|
dp+=3; sp+=4;
|
||||||
|
for (i = 1; i < row_width; i++)
|
||||||
|
{
|
||||||
|
*dp++ = *sp++;
|
||||||
|
*dp++ = *sp++;
|
||||||
|
*dp++ = *sp++;
|
||||||
|
sp++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* This converts from XRGB or ARGB to RGB */
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (i = 0; i < row_width; i++)
|
||||||
|
{
|
||||||
|
sp++;
|
||||||
|
*dp++ = *sp++;
|
||||||
|
*dp++ = *sp++;
|
||||||
|
*dp++ = *sp++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
row_info->pixel_depth = 24;
|
||||||
|
row_info->rowbytes = row_width * 3;
|
||||||
}
|
}
|
||||||
|
else /* if (row_info->bit_depth == 16) */
|
||||||
|
{
|
||||||
|
if (flags & PNG_FLAG_FILLER_AFTER)
|
||||||
|
{
|
||||||
|
/* This converts from RRGGBBXX or RRGGBBAA to RRGGBB */
|
||||||
|
sp += 8; dp += 6;
|
||||||
|
for (i = 1; i < row_width; i++)
|
||||||
|
{
|
||||||
|
/* This could be (although png_memcpy is probably slower):
|
||||||
|
png_memcpy(dp, sp, 6);
|
||||||
|
sp += 8;
|
||||||
|
dp += 6;
|
||||||
|
*/
|
||||||
|
|
||||||
row_info->pixel_depth = 48;
|
*dp++ = *sp++;
|
||||||
|
*dp++ = *sp++;
|
||||||
|
*dp++ = *sp++;
|
||||||
|
*dp++ = *sp++;
|
||||||
|
*dp++ = *sp++;
|
||||||
|
*dp++ = *sp++;
|
||||||
|
sp += 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* This converts from XXRRGGBB or AARRGGBB to RRGGBB */
|
||||||
|
for (i = 0; i < row_width; i++)
|
||||||
|
{
|
||||||
|
/* This could be (although png_memcpy is probably slower):
|
||||||
|
png_memcpy(dp, sp, 6);
|
||||||
|
sp += 8;
|
||||||
|
dp += 6;
|
||||||
|
*/
|
||||||
|
|
||||||
|
sp+=2;
|
||||||
|
*dp++ = *sp++;
|
||||||
|
*dp++ = *sp++;
|
||||||
|
*dp++ = *sp++;
|
||||||
|
*dp++ = *sp++;
|
||||||
|
*dp++ = *sp++;
|
||||||
|
*dp++ = *sp++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
row_info->pixel_depth = 48;
|
||||||
|
row_info->rowbytes = row_width * 6;
|
||||||
|
}
|
||||||
|
row_info->channels = 3;
|
||||||
}
|
}
|
||||||
|
else if ((row_info->color_type == PNG_COLOR_TYPE_GRAY ||
|
||||||
else
|
(row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA &&
|
||||||
return; /* bad bit depth */
|
(flags & PNG_FLAG_STRIP_ALPHA))) &&
|
||||||
|
row_info->channels == 2)
|
||||||
row_info->channels = 3;
|
{
|
||||||
|
if (row_info->bit_depth == 8)
|
||||||
/* Finally fix the color type if it records an alpha channel */
|
{
|
||||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
/* This converts from GX or GA to G */
|
||||||
row_info->color_type = PNG_COLOR_TYPE_RGB;
|
if (flags & PNG_FLAG_FILLER_AFTER)
|
||||||
|
{
|
||||||
|
for (i = 0; i < row_width; i++)
|
||||||
|
{
|
||||||
|
*dp++ = *sp++;
|
||||||
|
sp++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* This converts from XG or AG to G */
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (i = 0; i < row_width; i++)
|
||||||
|
{
|
||||||
|
sp++;
|
||||||
|
*dp++ = *sp++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
row_info->pixel_depth = 8;
|
||||||
|
row_info->rowbytes = row_width;
|
||||||
|
}
|
||||||
|
else /* if (row_info->bit_depth == 16) */
|
||||||
|
{
|
||||||
|
if (flags & PNG_FLAG_FILLER_AFTER)
|
||||||
|
{
|
||||||
|
/* This converts from GGXX or GGAA to GG */
|
||||||
|
sp += 4; dp += 2;
|
||||||
|
for (i = 1; i < row_width; i++)
|
||||||
|
{
|
||||||
|
*dp++ = *sp++;
|
||||||
|
*dp++ = *sp++;
|
||||||
|
sp += 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* This converts from XXGG or AAGG to GG */
|
||||||
|
for (i = 0; i < row_width; i++)
|
||||||
|
{
|
||||||
|
sp += 2;
|
||||||
|
*dp++ = *sp++;
|
||||||
|
*dp++ = *sp++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
row_info->pixel_depth = 16;
|
||||||
|
row_info->rowbytes = row_width * 2;
|
||||||
|
}
|
||||||
|
row_info->channels = 1;
|
||||||
|
}
|
||||||
|
if (flags & PNG_FLAG_STRIP_ALPHA)
|
||||||
|
row_info->color_type &= ~PNG_COLOR_MASK_ALPHA;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
|
||||||
return; /* The filler channel has gone already */
|
|
||||||
|
|
||||||
/* Fix the rowbytes value. */
|
|
||||||
row_info->rowbytes = dp-row;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
|
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
|
||||||
/* Swaps red and blue bytes within a pixel */
|
/* swaps red and blue bytes within a pixel */
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_do_bgr(png_row_infop row_info, png_bytep row)
|
png_do_bgr(png_row_infop row_info, png_bytep row)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_bgr");
|
png_debug(1, "in png_do_bgr\n");
|
||||||
|
if (
|
||||||
if ((row_info->color_type & PNG_COLOR_MASK_COLOR))
|
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
||||||
|
row != NULL && row_info != NULL &&
|
||||||
|
#endif
|
||||||
|
(row_info->color_type & PNG_COLOR_MASK_COLOR))
|
||||||
{
|
{
|
||||||
png_uint_32 row_width = row_info->width;
|
png_uint_32 row_width = row_info->width;
|
||||||
if (row_info->bit_depth == 8)
|
if (row_info->bit_depth == 8)
|
||||||
@@ -560,7 +573,6 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
|
|||||||
*(rp + 2) = save;
|
*(rp + 2) = save;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
{
|
{
|
||||||
png_bytep rp;
|
png_bytep rp;
|
||||||
@@ -574,8 +586,6 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_16BIT_SUPPORTED
|
|
||||||
else if (row_info->bit_depth == 16)
|
else if (row_info->bit_depth == 16)
|
||||||
{
|
{
|
||||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
||||||
@@ -593,7 +603,6 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
|
|||||||
*(rp + 5) = save;
|
*(rp + 5) = save;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
{
|
{
|
||||||
png_bytep rp;
|
png_bytep rp;
|
||||||
@@ -610,25 +619,28 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_READ_BGR_SUPPORTED or PNG_WRITE_BGR_SUPPORTED */
|
#endif /* PNG_READ_BGR_SUPPORTED or PNG_WRITE_BGR_SUPPORTED */
|
||||||
|
|
||||||
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
|
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
|
||||||
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
|
||||||
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
|
defined(PNG_LEGACY_SUPPORTED)
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_user_transform_info(png_structp png_ptr, png_voidp
|
png_set_user_transform_info(png_structp png_ptr, png_voidp
|
||||||
user_transform_ptr, int user_transform_depth, int user_transform_channels)
|
user_transform_ptr, int user_transform_depth, int user_transform_channels)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_user_transform_info");
|
png_debug(1, "in png_set_user_transform_info\n");
|
||||||
|
if(png_ptr == NULL) return;
|
||||||
if (png_ptr == NULL)
|
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
||||||
return;
|
|
||||||
png_ptr->user_transform_ptr = user_transform_ptr;
|
png_ptr->user_transform_ptr = user_transform_ptr;
|
||||||
png_ptr->user_transform_depth = (png_byte)user_transform_depth;
|
png_ptr->user_transform_depth = (png_byte)user_transform_depth;
|
||||||
png_ptr->user_transform_channels = (png_byte)user_transform_channels;
|
png_ptr->user_transform_channels = (png_byte)user_transform_channels;
|
||||||
|
#else
|
||||||
|
if(user_transform_ptr || user_transform_depth || user_transform_channels)
|
||||||
|
png_warning(png_ptr,
|
||||||
|
"This version of libpng does not support user transform info");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -637,38 +649,14 @@ png_set_user_transform_info(png_structp png_ptr, png_voidp
|
|||||||
* associated with this pointer before png_write_destroy and png_read_destroy
|
* associated with this pointer before png_write_destroy and png_read_destroy
|
||||||
* are called.
|
* are called.
|
||||||
*/
|
*/
|
||||||
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
|
|
||||||
png_voidp PNGAPI
|
png_voidp PNGAPI
|
||||||
png_get_user_transform_ptr(png_const_structp png_ptr)
|
png_get_user_transform_ptr(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
||||||
return (NULL);
|
if (png_ptr == NULL) return (NULL);
|
||||||
|
|
||||||
return ((png_voidp)png_ptr->user_transform_ptr);
|
return ((png_voidp)png_ptr->user_transform_ptr);
|
||||||
}
|
#else
|
||||||
|
return (NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_USER_TRANSFORM_INFO_SUPPORTED
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_current_row_number(png_const_structp png_ptr)
|
|
||||||
{
|
|
||||||
/* See the comments in png.h - this is the sub-image row when reading and
|
|
||||||
* interlaced image.
|
|
||||||
*/
|
|
||||||
if (png_ptr != NULL)
|
|
||||||
return png_ptr->row_number;
|
|
||||||
|
|
||||||
return PNG_UINT_32_MAX; /* help the app not to fail silently */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
png_byte PNGAPI
|
|
||||||
png_get_current_pass_number(png_const_structp png_ptr)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL)
|
|
||||||
return png_ptr->pass;
|
|
||||||
return 8; /* invalid */
|
|
||||||
}
|
|
||||||
#endif /* PNG_USER_TRANSFORM_INFO_SUPPORTED */
|
|
||||||
#endif /* PNG_READ_USER_TRANSFORM_SUPPORTED ||
|
|
||||||
PNG_WRITE_USER_TRANSFORM_SUPPORTED */
|
|
||||||
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
|
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
|
||||||
|
|||||||
6709
pngvalid.c
212
pngwio.c
@@ -1,15 +1,12 @@
|
|||||||
|
|
||||||
/* pngwio.c - functions for data output
|
/* pngwio.c - functions for data output
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.5.0 [January 6, 2011]
|
* Last changed in libpng 1.2.13 November 13, 2006
|
||||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
* This code is released under the libpng license.
|
|
||||||
* For conditions of distribution and use, see the disclaimer
|
|
||||||
* and license in png.h
|
|
||||||
*
|
|
||||||
* This file provides a location for all output. Users who need
|
* This file provides a location for all output. Users who need
|
||||||
* special handling are expected to write functions that have the same
|
* special handling are expected to write functions that have the same
|
||||||
* arguments as these and perform similar functions, but that possibly
|
* arguments as these and perform similar functions, but that possibly
|
||||||
@@ -18,101 +15,100 @@
|
|||||||
* them at run time with png_set_write_fn(...).
|
* them at run time with png_set_write_fn(...).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "pngpriv.h"
|
#define PNG_INTERNAL
|
||||||
|
#include "png.h"
|
||||||
#ifdef PNG_WRITE_SUPPORTED
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
|
|
||||||
/* Write the data to whatever output you are using. The default routine
|
/* Write the data to whatever output you are using. The default routine
|
||||||
* writes to a file pointer. Note that this routine sometimes gets called
|
writes to a file pointer. Note that this routine sometimes gets called
|
||||||
* with very small lengths, so you should implement some kind of simple
|
with very small lengths, so you should implement some kind of simple
|
||||||
* buffering if you are using unbuffered writes. This should never be asked
|
buffering if you are using unbuffered writes. This should never be asked
|
||||||
* to write more than 64K on a 16 bit machine.
|
to write more than 64K on a 16 bit machine. */
|
||||||
*/
|
|
||||||
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_write_data(png_structp png_ptr, png_const_bytep data, png_size_t length)
|
png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
/* NOTE: write_data_fn must not change the buffer! */
|
|
||||||
if (png_ptr->write_data_fn != NULL )
|
if (png_ptr->write_data_fn != NULL )
|
||||||
(*(png_ptr->write_data_fn))(png_ptr, (png_bytep)data, length);
|
(*(png_ptr->write_data_fn))(png_ptr, data, length);
|
||||||
|
|
||||||
else
|
else
|
||||||
png_error(png_ptr, "Call to NULL write function");
|
png_error(png_ptr, "Call to NULL write function");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_STDIO_SUPPORTED
|
#if !defined(PNG_NO_STDIO)
|
||||||
/* This is the function that does the actual writing of data. If you are
|
/* This is the function that does the actual writing of data. If you are
|
||||||
* not writing to a standard C stream, you should create a replacement
|
not writing to a standard C stream, you should create a replacement
|
||||||
* write_data function and use it at run time with png_set_write_fn(), rather
|
write_data function and use it at run time with png_set_write_fn(), rather
|
||||||
* than changing the library.
|
than changing the library. */
|
||||||
*/
|
|
||||||
#ifndef USE_FAR_KEYWORD
|
#ifndef USE_FAR_KEYWORD
|
||||||
void PNGCBAPI
|
void PNGAPI
|
||||||
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
png_size_t check;
|
png_uint_32 check;
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
|
if(png_ptr == NULL) return;
|
||||||
|
#if defined(_WIN32_WCE)
|
||||||
|
if ( !WriteFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
|
||||||
|
check = 0;
|
||||||
|
#else
|
||||||
check = fwrite(data, 1, length, (png_FILE_p)(png_ptr->io_ptr));
|
check = fwrite(data, 1, length, (png_FILE_p)(png_ptr->io_ptr));
|
||||||
|
#endif
|
||||||
if (check != length)
|
if (check != length)
|
||||||
png_error(png_ptr, "Write Error");
|
png_error(png_ptr, "Write Error");
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/* This is the model-independent version. Since the standard I/O library
|
/* this is the model-independent version. Since the standard I/O library
|
||||||
* can't handle far buffers in the medium and small models, we have to copy
|
can't handle far buffers in the medium and small models, we have to copy
|
||||||
* the data.
|
the data.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define NEAR_BUF_SIZE 1024
|
#define NEAR_BUF_SIZE 1024
|
||||||
#define MIN(a,b) (a <= b ? a : b)
|
#define MIN(a,b) (a <= b ? a : b)
|
||||||
|
|
||||||
void PNGCBAPI
|
void PNGAPI
|
||||||
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
png_uint_32 check;
|
png_uint_32 check;
|
||||||
png_byte *near_data; /* Needs to be "png_byte *" instead of "png_bytep" */
|
png_byte *near_data; /* Needs to be "png_byte *" instead of "png_bytep" */
|
||||||
png_FILE_p io_ptr;
|
png_FILE_p io_ptr;
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
if(png_ptr == NULL) return;
|
||||||
return;
|
|
||||||
|
|
||||||
/* Check if data really is near. If so, use usual code. */
|
/* Check if data really is near. If so, use usual code. */
|
||||||
near_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
near_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
||||||
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
|
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
|
||||||
|
|
||||||
if ((png_bytep)near_data == data)
|
if ((png_bytep)near_data == data)
|
||||||
{
|
{
|
||||||
|
#if defined(_WIN32_WCE)
|
||||||
|
if ( !WriteFile(io_ptr, near_data, length, &check, NULL) )
|
||||||
|
check = 0;
|
||||||
|
#else
|
||||||
check = fwrite(near_data, 1, length, io_ptr);
|
check = fwrite(near_data, 1, length, io_ptr);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_byte buf[NEAR_BUF_SIZE];
|
png_byte buf[NEAR_BUF_SIZE];
|
||||||
png_size_t written, remaining, err;
|
png_size_t written, remaining, err;
|
||||||
check = 0;
|
check = 0;
|
||||||
remaining = length;
|
remaining = length;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
written = MIN(NEAR_BUF_SIZE, remaining);
|
written = MIN(NEAR_BUF_SIZE, remaining);
|
||||||
png_memcpy(buf, data, written); /* Copy far buffer to near buffer */
|
png_memcpy(buf, data, written); /* copy far buffer to near buffer */
|
||||||
|
#if defined(_WIN32_WCE)
|
||||||
|
if ( !WriteFile(io_ptr, buf, written, &err, NULL) )
|
||||||
|
err = 0;
|
||||||
|
#else
|
||||||
err = fwrite(buf, 1, written, io_ptr);
|
err = fwrite(buf, 1, written, io_ptr);
|
||||||
|
#endif
|
||||||
if (err != written)
|
if (err != written)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
else
|
else
|
||||||
check += err;
|
check += err;
|
||||||
|
|
||||||
data += written;
|
data += written;
|
||||||
remaining -= written;
|
remaining -= written;
|
||||||
}
|
}
|
||||||
while (remaining != 0);
|
while (remaining != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check != length)
|
if (check != length)
|
||||||
png_error(png_ptr, "Write Error");
|
png_error(png_ptr, "Write Error");
|
||||||
}
|
}
|
||||||
@@ -121,10 +117,9 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This function is called to output any data pending writing (normally
|
/* This function is called to output any data pending writing (normally
|
||||||
* to disk). After png_flush is called, there should be no data pending
|
to disk). After png_flush is called, there should be no data pending
|
||||||
* writing in any buffers.
|
writing in any buffers. */
|
||||||
*/
|
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
||||||
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_flush(png_structp png_ptr)
|
png_flush(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
@@ -132,123 +127,108 @@ png_flush(png_structp png_ptr)
|
|||||||
(*(png_ptr->output_flush_fn))(png_ptr);
|
(*(png_ptr->output_flush_fn))(png_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
# ifdef PNG_STDIO_SUPPORTED
|
#if !defined(PNG_NO_STDIO)
|
||||||
void PNGCBAPI
|
void PNGAPI
|
||||||
png_default_flush(png_structp png_ptr)
|
png_default_flush(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
|
#if !defined(_WIN32_WCE)
|
||||||
png_FILE_p io_ptr;
|
png_FILE_p io_ptr;
|
||||||
|
#endif
|
||||||
if (png_ptr == NULL)
|
if(png_ptr == NULL) return;
|
||||||
return;
|
#if !defined(_WIN32_WCE)
|
||||||
|
|
||||||
io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
|
io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
|
||||||
fflush(io_ptr);
|
if (io_ptr != NULL)
|
||||||
|
fflush(io_ptr);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
# endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This function allows the application to supply new output functions for
|
/* This function allows the application to supply new output functions for
|
||||||
* libpng if standard C streams aren't being used.
|
libpng if standard C streams aren't being used.
|
||||||
*
|
|
||||||
* This function takes as its arguments:
|
This function takes as its arguments:
|
||||||
* png_ptr - pointer to a png output data structure
|
png_ptr - pointer to a png output data structure
|
||||||
* io_ptr - pointer to user supplied structure containing info about
|
io_ptr - pointer to user supplied structure containing info about
|
||||||
* the output functions. May be NULL.
|
the output functions. May be NULL.
|
||||||
* write_data_fn - pointer to a new output function that takes as its
|
write_data_fn - pointer to a new output function that takes as its
|
||||||
* arguments a pointer to a png_struct, a pointer to
|
arguments a pointer to a png_struct, a pointer to
|
||||||
* data to be written, and a 32-bit unsigned int that is
|
data to be written, and a 32-bit unsigned int that is
|
||||||
* the number of bytes to be written. The new write
|
the number of bytes to be written. The new write
|
||||||
* function should call png_error(png_ptr, "Error msg")
|
function should call png_error(png_ptr, "Error msg")
|
||||||
* to exit and output any fatal error messages. May be
|
to exit and output any fatal error messages.
|
||||||
* NULL, in which case libpng's default function will
|
flush_data_fn - pointer to a new flush function that takes as its
|
||||||
* be used.
|
arguments a pointer to a png_struct. After a call to
|
||||||
* flush_data_fn - pointer to a new flush function that takes as its
|
the flush function, there should be no data in any buffers
|
||||||
* arguments a pointer to a png_struct. After a call to
|
or pending transmission. If the output method doesn't do
|
||||||
* the flush function, there should be no data in any buffers
|
any buffering of ouput, a function prototype must still be
|
||||||
* or pending transmission. If the output method doesn't do
|
supplied although it doesn't have to do anything. If
|
||||||
* any buffering of output, a function prototype must still be
|
PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile
|
||||||
* supplied although it doesn't have to do anything. If
|
time, output_flush_fn will be ignored, although it must be
|
||||||
* PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile
|
supplied for compatibility. */
|
||||||
* time, output_flush_fn will be ignored, although it must be
|
|
||||||
* supplied for compatibility. May be NULL, in which case
|
|
||||||
* libpng's default function will be used, if
|
|
||||||
* PNG_WRITE_FLUSH_SUPPORTED is defined. This is not
|
|
||||||
* a good idea if io_ptr does not point to a standard
|
|
||||||
* *FILE structure.
|
|
||||||
*/
|
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
|
png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
|
||||||
png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)
|
png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
if(png_ptr == NULL) return;
|
||||||
return;
|
|
||||||
|
|
||||||
png_ptr->io_ptr = io_ptr;
|
png_ptr->io_ptr = io_ptr;
|
||||||
|
|
||||||
#ifdef PNG_STDIO_SUPPORTED
|
#if !defined(PNG_NO_STDIO)
|
||||||
if (write_data_fn != NULL)
|
if (write_data_fn != NULL)
|
||||||
png_ptr->write_data_fn = write_data_fn;
|
png_ptr->write_data_fn = write_data_fn;
|
||||||
|
|
||||||
else
|
else
|
||||||
png_ptr->write_data_fn = png_default_write_data;
|
png_ptr->write_data_fn = png_default_write_data;
|
||||||
#else
|
#else
|
||||||
png_ptr->write_data_fn = write_data_fn;
|
png_ptr->write_data_fn = write_data_fn;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
||||||
# ifdef PNG_STDIO_SUPPORTED
|
#if !defined(PNG_NO_STDIO)
|
||||||
|
|
||||||
if (output_flush_fn != NULL)
|
if (output_flush_fn != NULL)
|
||||||
png_ptr->output_flush_fn = output_flush_fn;
|
png_ptr->output_flush_fn = output_flush_fn;
|
||||||
|
|
||||||
else
|
else
|
||||||
png_ptr->output_flush_fn = png_default_flush;
|
png_ptr->output_flush_fn = png_default_flush;
|
||||||
|
#else
|
||||||
# else
|
|
||||||
png_ptr->output_flush_fn = output_flush_fn;
|
png_ptr->output_flush_fn = output_flush_fn;
|
||||||
# endif
|
#endif
|
||||||
#endif /* PNG_WRITE_FLUSH_SUPPORTED */
|
#endif /* PNG_WRITE_FLUSH_SUPPORTED */
|
||||||
|
|
||||||
/* It is an error to read while writing a png file */
|
/* It is an error to read while writing a png file */
|
||||||
if (png_ptr->read_data_fn != NULL)
|
if (png_ptr->read_data_fn != NULL)
|
||||||
{
|
{
|
||||||
png_ptr->read_data_fn = NULL;
|
png_ptr->read_data_fn = NULL;
|
||||||
|
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"Can't set both read_data_fn and write_data_fn in the"
|
"Attempted to set both read_data_fn and write_data_fn in");
|
||||||
" same structure");
|
png_warning(png_ptr,
|
||||||
|
"the same structure. Resetting read_data_fn to NULL.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_FAR_KEYWORD
|
#if defined(USE_FAR_KEYWORD)
|
||||||
# ifdef _MSC_VER
|
#if defined(_MSC_VER)
|
||||||
void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check)
|
void *png_far_to_near(png_structp png_ptr,png_voidp ptr, int check)
|
||||||
{
|
{
|
||||||
void *near_ptr;
|
void *near_ptr;
|
||||||
void FAR *far_ptr;
|
void FAR *far_ptr;
|
||||||
FP_OFF(near_ptr) = FP_OFF(ptr);
|
FP_OFF(near_ptr) = FP_OFF(ptr);
|
||||||
far_ptr = (void FAR *)near_ptr;
|
far_ptr = (void FAR *)near_ptr;
|
||||||
|
if(check != 0)
|
||||||
if (check != 0)
|
if(FP_SEG(ptr) != FP_SEG(far_ptr))
|
||||||
if (FP_SEG(ptr) != FP_SEG(far_ptr))
|
png_error(png_ptr,"segment lost in conversion");
|
||||||
png_error(png_ptr, "segment lost in conversion");
|
|
||||||
|
|
||||||
return(near_ptr);
|
return(near_ptr);
|
||||||
}
|
}
|
||||||
# else
|
# else
|
||||||
void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check)
|
void *png_far_to_near(png_structp png_ptr,png_voidp ptr, int check)
|
||||||
{
|
{
|
||||||
void *near_ptr;
|
void *near_ptr;
|
||||||
void FAR *far_ptr;
|
void FAR *far_ptr;
|
||||||
near_ptr = (void FAR *)ptr;
|
near_ptr = (void FAR *)ptr;
|
||||||
far_ptr = (void FAR *)near_ptr;
|
far_ptr = (void FAR *)near_ptr;
|
||||||
|
if(check != 0)
|
||||||
if (check != 0)
|
if(far_ptr != ptr)
|
||||||
if (far_ptr != ptr)
|
png_error(png_ptr,"segment lost in conversion");
|
||||||
png_error(png_ptr, "segment lost in conversion");
|
|
||||||
|
|
||||||
return(near_ptr);
|
return(near_ptr);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
#endif
|
# endif
|
||||||
#endif /* PNG_WRITE_SUPPORTED */
|
#endif /* PNG_WRITE_SUPPORTED */
|
||||||
|
|||||||