[libpng16] Imported from libpng-1.6.0beta05.tar

This commit is contained in:
Glenn Randers-Pehrson
2012-02-02 23:11:45 -06:00
parent 96cf4bde0e
commit f3af706c2a
186 changed files with 8544 additions and 20666 deletions

View File

@@ -1,102 +0,0 @@
/* checksum-icc.c
*
* Copyright (c) 2013 John Cunningham Bowler
*
* Last changed in libpng 1.6.0 [February 14, 2013]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
* Generate crc32 and adler32 checksums of the given input files, used to
* generate check-codes for use when matching ICC profiles within libpng.
*/
#include <stdio.h>
#include <zlib.h>
static int
read_one_file(FILE *ip, const char *name)
{
uLong length = 0;
uLong a32 = adler32(0, NULL, 0);
uLong c32 = crc32(0, NULL, 0);
Byte header[132];
for (;;)
{
int ch = getc(ip);
Byte b;
if (ch == EOF) break;
b = (Byte)ch;
if (length < sizeof header)
header[length] = b;
++length;
a32 = adler32(a32, &b, 1);
c32 = crc32(c32, &b, 1);
}
if (ferror(ip))
return 0;
/* Success */
printf("PNG_ICC_CHECKSUM(0x%8.8lx, 0x%8.8lx,\n PNG_MD5("
"0x%2.2x%2.2x%2.2x%2.2x, 0x%2.2x%2.2x%2.2x%2.2x, 0x%2.2x%2.2x%2.2x%2.2x,"
" 0x%2.2x%2.2x%2.2x%2.2x), %d,\n"
" \"%4.4d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d\", %lu, \"%s\")\n",
(unsigned long)a32, (unsigned long)c32,
header[84], header[85], header[86], header[87],
header[88], header[89], header[90], header[91],
header[92], header[93], header[94], header[95],
header[96], header[97], header[98], header[99],
# define u16(x) (header[x] * 256 + header[x+1])
# define u32(x) (u16(x) * 65536 + u16(x+2))
u32(64), u16(24), u16(26), u16(28), u16(30), u16(32), u16(34),
(unsigned long)length, name);
return 1;
}
int main(int argc, char **argv)
{
int err = 0;
printf("/* adler32, crc32, MD5[16], intent, date, length, file-name */\n");
if (argc > 1)
{
int i;
for (i=1; i<argc; ++i)
{
FILE *ip = fopen(argv[i], "rb");
if (ip == NULL || !read_one_file(ip, argv[i]))
{
err = 1;
perror(argv[i]);
fprintf(stderr, "%s: read error\n", argv[i]);
printf("/* ERROR: %s */\n", argv[i]);
}
(void)fclose(ip);
}
}
else
{
if (!read_one_file(stdin, "-"))
{
err = 1;
perror("stdin");
fprintf(stderr, "stdin: read error\n");
printf("/* ERROR: stdin */\n");
}
}
return err;
}

View File

@@ -1,137 +0,0 @@
#!/bin/sh
#
# Check the format of the source files in the current directory - checks for a
# line length of 80 characters max and no tab characters.
#
# Optionally arguments are files or directories to check.
#
# -v: output the long lines (makes fixing them easier)
# -e: spawn an editor for each file that needs a change ($EDITOR must be
# defined). When using -e the script MUST be run from an interactive
# command line.
verbose=
edit=
vers=
test "$1" = "-v" && {
shift
verbose=yes
}
test "$1" = "-e" && {
shift
if test -n "$EDITOR"
then
edit=yes
# Copy the standard streams for the editor
exec 3>&0 4>&1 5>&2
else
echo "chkfmt -e: EDITOR must be defined" >&2
exit 1
fi
}
# Function to edit a single file - if the file isn't changed ask the user
# whether or not to continue. This stuff only works if the script is run from
# the command line (otherwise, don't specify -e or you will be sorry).
doed(){
cp "$file" "$file".orig
"$EDITOR" "$file" 0>&3 1>&4 2>&5 3>&- 4>&- 5>&- || exit 1
if cmp -s "$file".orig "$file"
then
rm "$file".orig
echo -n "$file: file not changed, type anything to continue: " >&5
read ans 0>&3
test -n "$ans" || return 1
fi
return 0
}
# In beta versions the version string which appears in files can be a little
# long and cause spuriously overlong lines. To avoid this subtitute the version
# string with a 'standard' version a.b.cc before checking for long lines.
if test -r png.h
then
vers="`sed -n -e \
's/^#define PNG_LIBPNG_VER_STRING .\([0-9]\.[0-9]\.[0-9][0-9a-z]*\).$/\1/p' \
png.h`"
echo "chkfmt: checking version $vers"
fi
if test -z "$vers"
then
echo "chkfmt: png.h not found, ignoring version number" >&2
fi
test -n "$1" || set -- .
find "$@" \( -type d \( -name '.git' -o -name '.libs' -o -name 'projects' \) \
-prune \) -o \( -type f \
! -name '*.[oa]' ! -name '*.l[oa]' ! -name '*.png' ! -name '*.out' \
! -name '*.jpg' ! -name '*.patch' ! -name '*.obj' ! -name '*.exe' \
! -name '*.com' ! -name '*.tar.*' ! -name '*.zip' ! -name '*.ico' \
! -name '*.res' ! -name '*.rc' ! -name '*.mms' ! -name '*.rej' \
! -name '*.dsp' ! -name '*.orig' ! -name '*.dfn' ! -name '*.swp' \
! -name '~*' ! -name '*.3' \
! -name 'missing' ! -name 'mkinstalldirs' ! -name 'depcomp' \
! -name 'aclocal.m4' ! -name 'install-sh' ! -name 'Makefile.in' \
! -name 'ltmain.sh' ! -name 'config*' -print \) | {
st=0
while read file
do
case "$file" in
*.mak|*[Mm]akefile.*|*[Mm]akefile)
# Makefiles require tabs, dependency lines can be this long.
check_tabs=
line_length=100;;
*.awk)
# Includes literal tabs
check_tabs=
# The following is arbitrary
line_length=132;;
*contrib/*/*.[ch])
check_tabs=yes
line_length=96;;
*)
check_tabs=yes
line_length=80;;
esac
# Note that vers can only contain 0-9, . and a-z
if test -n "$vers"
then
sed -e "s/$vers/a.b.cc/g" "$file" >"$file".$$
else
cp "$file" "$file".$$
fi
splt="`fold -$line_length "$file".$$ | diff -c "$file".$$ -`"
rm "$file".$$
if test -n "$splt"
then
echo "$file: lines too long"
st=1
if test -n "$EDITOR" -a -n "$edit"
then
doed "$file" || exit 1
elif test -n "$verbose"
then
echo "$splt"
fi
fi
if test -n "$check_tabs"
then
tab="`tr -c -d '\t' <"$file"`"
if test -n "$tab"
then
echo "$file: file contains tab characters"
st=1
if test -n "$EDITOR" -a -n "$edit"
then
doed "$file" || exit 1
elif test -n "$verbose"
then
echo "$splt"
fi
fi
fi
done
exit $st
}

View File

@@ -1,9 +1,9 @@
/*-
* convert.c
*
* Last changed in libpng 1.6.0 [February 14, 2013]
* Last changed in libpng 1.6.0 [(PENDING RELEASE)]
*
* COPYRIGHT: Written by John Cunningham Bowler, 2013.
* COPYRIGHT: Written by John Cunningham Bowler, 2012.
* To the extent possible under law, the author has waived all copyright and
* related or neighboring rights to this work. This work is published from:
* United States.

View File

@@ -2,9 +2,9 @@
#
# intgamma.sh
#
# Last changed in libpng 1.6.0 [February 14, 2013]
# Last changed in libpng 1.6.0 [(PENDING RELEASE)]
#
# COPYRIGHT: Written by John Cunningham Bowler, 2013.
# COPYRIGHT: Written by John Cunningham Bowler, 2012.
# To the extent possible under law, the author has waived all copyright and
# related or neighboring rights to this work. This work is published from:
# United States.

View File

@@ -1,8 +1,8 @@
/* makesRGB.c -- build sRGB-to-linear and linear-to-sRGB conversion tables
*
* Last changed in libpng 1.6.0 [February 14, 2013]
* Last changed in libpng 1.6.0 [(PENDING RELEASE)]
*
* COPYRIGHT: Written by John Cunningham Bowler, 2013.
* COPYRIGHT: Written by John Cunningham Bowler, 2012.
* To the extent possible under law, the author has waived all copyright and
* related or neighboring rights to this work. This work is published from:
* United States.

View File

@@ -1,9 +1,9 @@
/*-
* sRGB.h
*
* Last changed in libpng 1.6.0 [February 14, 2013]
* Last changed in libpng 1.6.0 [(PENDING RELEASE)]
*
* COPYRIGHT: Written by John Cunningham Bowler, 2013.
* COPYRIGHT: Written by John Cunningham Bowler, 2012.
* To the extent possible under law, the author has waived all copyright and
* related or neighboring rights to this work. This work is published from:
* United States.