[libpng17] Imported from libpng-1.7.0beta31.tar
diff --git a/LICENSE b/LICENSE
index 711a73c..c2e68f0 100644
--- a/LICENSE
+++ b/LICENSE
@@ -10,7 +10,7 @@
This code is released under the libpng license.
-libpng versions 1.2.6, August 15, 2004, through 1.7.0beta31, February 2, 2014, are
+libpng versions 1.2.6, August 15, 2004, through 1.7.0beta31, February 6, 2014, are
Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors
@@ -108,4 +108,4 @@
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
-February 2, 2014
+February 6, 2014
diff --git a/README b/README
index 5d7ff97..fdccd7f 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-README for libpng version 1.7.0beta31 - February 2, 2014 (shared library 17.0)
+README for libpng version 1.7.0beta31 - February 6, 2014 (shared library 17.0)
See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng.
diff --git a/contrib/libtests/pngimage.c b/contrib/libtests/pngimage.c
index 8096fe7..a91fbb4 100644
--- a/contrib/libtests/pngimage.c
+++ b/contrib/libtests/pngimage.c
@@ -36,30 +36,7 @@
# include <setjmp.h> /* because png.h did *not* include this */
#endif
-#if defined(PNG_INFO_IMAGE_SUPPORTED) && defined(PNG_READ_SUPPORTED)
-/* Valid transformations to perform on read: */
-#define READ_TRANSFORMS (PNG_TRANSFORM_STRIP_16|PNG_TRANSFORM_STRIP_ALPHA|\
- PNG_TRANSFORM_PACKING|PNG_TRANSFORM_PACKSWAP|PNG_TRANSFORM_EXPAND|\
- PNG_TRANSFORM_INVERT_MONO|PNG_TRANSFORM_SHIFT|PNG_TRANSFORM_BGR|\
- PNG_TRANSFORM_SWAP_ALPHA|PNG_TRANSFORM_SWAP_ENDIAN|\
- PNG_TRANSFORM_INVERT_ALPHA|PNG_TRANSFORM_GRAY_TO_RGB|\
- PNG_TRANSFORM_EXPAND_16|PNG_TRANSFORM_SCALE_16)
-
-/* Valid transformations to perform on write: */
-#define WRITE_TRANSFORMS (PNG_TRANSFORM_PACKING|PNG_TRANSFORM_PACKSWAP|\
- PNG_TRANSFORM_INVERT_MONO|PNG_TRANSFORM_SHIFT|PNG_TRANSFORM_BGR|\
- PNG_TRANSFORM_SWAP_ALPHA|PNG_TRANSFORM_SWAP_ENDIAN|\
- PNG_TRANSFORM_INVERT_ALPHA|PNG_TRANSFORM_STRIP_FILLER|\
- PNG_TRANSFORM_STRIP_FILLER_BEFORE|PNG_TRANSFORM_STRIP_FILLER_AFTER)
-
-/* Reversible transforms */
-#define RW_TRANSFORMS (READ_TRANSFORMS & WRITE_TRANSFORMS)
-
-/* All transforms: this is a safety feature; examine png.h and set it to the
- * mask that should correspond to all the transforms.
- */
-#define ALL_TRANSFORMS 0xffff
-
+#if defined(PNG_INFO_IMAGE_SUPPORTED) && defined(PNG_SEQUENTIAL_READ_SUPPORTED)
/* If a transform is valid on both read and write this implies that if the
* transform is applied to read it must also be applied on write to produce
* meaningful data. This is because these transforms when performed on read
@@ -119,21 +96,44 @@
png_byte tested; /* the transform was tested somewhere */
} transform_info[] =
{
+ /* List ALL the PNG_TRANSFORM_ macros here. Check for support using the READ
+ * macros; even if the transform is supported on write it cannot be tested
+ * without the read support.
+ */
# define T(name,chunk,cm_required,cm_absent,bd,when)\
{ #name, PNG_TRANSFORM_ ## name, CHUNK_ ## chunk,\
COLOR_MASK_ ## cm_required, COLOR_MASK_ ## cm_absent, BD_ ## bd,\
TRANSFORM_ ## when, 0/*!tested*/ }
+#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
T(STRIP_16, NONE, X, X, 16, R),
/* drops the bottom 8 bits when bit depth is 16 */
+#endif
+#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
T(STRIP_ALPHA, NONE, A, X, ALL, R),
/* removes the alpha channel if present */
- T(PACKING, NONE, X, X, LOW, RW),
+#endif
+#ifdef PNG_WRITE_PACK_SUPPORTED
+# define TRANSFORM_RW_PACK TRANSFORM_RW
+#else
+# define TRANSFORM_RW_PACK TRANSFORM_R
+#endif
+#ifdef PNG_READ_PACK_SUPPORTED
+ T(PACKING, NONE, X, X, LOW, RW_PACK),
/* unpacks low-bit-depth components into 1 byte per component on read,
* reverses this on write.
*/
- T(PACKSWAP, NONE, X, X, LOW, RW),
+#endif
+#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
+# define TRANSFORM_RW_PACKSWAP TRANSFORM_RW
+#else
+# define TRANSFORM_RW_PACKSWAP TRANSFORM_R
+#endif
+#ifdef PNG_READ_PACKSWAP_SUPPORTED
+ T(PACKSWAP, NONE, X, X, LOW, RW_PACKSWAP),
/* reverses the order of low-bit-depth components packed into a byte */
+#endif
+#ifdef PNG_READ_EXPAND_SUPPORTED
T(EXPAND, NONE, P, X, ALL, R),
/* expands PLTE PNG files to RGB (no tRNS) or RGBA (tRNS) *
* Note that the 'EXPAND' transform does lots of different things: */
@@ -141,24 +141,68 @@
/* expands grayscale PNG files to RGB, or RGBA */
T(EXPAND, tRNS, X, A, ALL, R),
/* expands the tRNS chunk in files without alpha */
- T(INVERT_MONO, NONE, X, C, ALL, RW),
+#endif
+#ifdef PNG_WRITE_INVERT_SUPPORTED
+# define TRANSFORM_RW_INVERT TRANSFORM_RW
+#else
+# define TRANSFORM_RW_INVERT TRANSFORM_R
+#endif
+#ifdef PNG_READ_INVERT_SUPPORTED
+ T(INVERT_MONO, NONE, X, C, ALL, RW_INVERT),
/* converts gray-scale components to 1..0 from 0..1 */
- T(SHIFT, sBIT, X, X, ALL, RW),
+#endif
+#ifdef PNG_WRITE_SHIFT_SUPPORTED
+# define TRANSFORM_RW_SHIFT TRANSFORM_RW
+#else
+# define TRANSFORM_RW_SHIFT TRANSFORM_R
+#endif
+#ifdef PNG_READ_SHIFT_SUPPORTED
+ T(SHIFT, sBIT, X, X, ALL, RW_SHIFT),
/* reduces component values to the original range based on the sBIT chunk,
* this is only partially reversible - the low bits are lost and cannot be
* recovered on write. In fact write code replicates the bits to generate
* new low-order bits.
*/
- T(BGR, NONE, C, P, TRUE, RW),
+#endif
+#ifdef PNG_WRITE_BGR_SUPPORTED
+# define TRANSFORM_RW_BGR TRANSFORM_RW
+#else
+# define TRANSFORM_RW_BGR TRANSFORM_R
+#endif
+#ifdef PNG_READ_BGR_SUPPORTED
+ T(BGR, NONE, C, P, TRUE, RW_BGR),
/* reverses the rgb component values of true-color pixels */
- T(SWAP_ALPHA, NONE, A, X, TRUE, RW),
+#endif
+#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
+# define TRANSFORM_RW_SWAP_ALPHA TRANSFORM_RW
+#else
+# define TRANSFORM_RW_SWAP_ALPHA TRANSFORM_R
+#endif
+#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
+ T(SWAP_ALPHA, NONE, A, X, TRUE, RW_SWAP_ALPHA),
/* swaps the alpha channel of RGBA or GA pixels to the front - ARGB or
* AG, on write reverses the process.
*/
- T(SWAP_ENDIAN, NONE, X, P, 16, RW),
+#endif
+#ifdef PNG_WRITE_SWAP_SUPPORTED
+# define TRANSFORM_RW_SWAP TRANSFORM_RW
+#else
+# define TRANSFORM_RW_SWAP TRANSFORM_R
+#endif
+#ifdef PNG_READ_SWAP_SUPPORTED
+ T(SWAP_ENDIAN, NONE, X, P, 16, RW_SWAP),
/* byte-swaps 16-bit component values */
- T(INVERT_ALPHA, NONE, A, X, TRUE, RW),
+#endif
+#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
+# define TRANSFORM_RW_INVERT_ALPHA TRANSFORM_RW
+#else
+# define TRANSFORM_RW_INVERT_ALPHA TRANSFORM_R
+#endif
+#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
+ T(INVERT_ALPHA, NONE, A, X, TRUE, RW_INVERT_ALPHA),
/* converts an alpha channel from 0..1 to 1..0 */
+#endif
+#ifdef PNG_WRITE_FILLER_SUPPORTED
T(STRIP_FILLER_BEFORE, NONE, A, P, TRUE, W), /* 'A' for a filler! */
/* on write skips a leading filler channel; testing requires data with a
* filler channel so this is produced from RGBA or GA images by removing
@@ -166,6 +210,8 @@
*/
T(STRIP_FILLER_AFTER, NONE, A, P, TRUE, W),
/* on write strips a trailing filler channel */
+#endif
+#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
T(GRAY_TO_RGB, NONE, X, C, ALL, R),
/* expands grayscale images to RGB, also causes the palette part of
* 'EXPAND' to happen. Low bit depth grayscale images are expanded to
@@ -177,6 +223,8 @@
/* The 'palette' side effect mentioned above; a bit bogus but this is the
* way the libpng code works.
*/
+#endif
+#ifdef PNG_READ_EXPAND_16_SUPPORTED
T(EXPAND_16, NONE, X, X, PAL, R),
/* expands images to 16-bits per component, as a side effect expands
* palette images to RGB and expands the tRNS chunk if present, so it can
@@ -186,8 +234,11 @@
/* side effect of EXPAND_16 - expands the tRNS chunk in an RGB or G 16-bit
* image.
*/
+#endif
+#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
T(SCALE_16, NONE, X, X, 16, R)
/* scales 16-bit components to 8-bits. */
+#endif
#undef T
};
@@ -252,21 +303,20 @@
return "invalid transform";
}
+/* Variables calculated by validate_T below and used to record all the supported
+ * transforms. Need (unsigned int) here because of the places where these
+ * values are used (unsigned compares in the 'exhaustive' iterator.)
+ */
+static unsigned int read_transforms, write_transforms, rw_transforms;
+
static void
validate_T(void)
- /* Validate the above table - this is done mainly to ensure that all the
- * transforms are being tested.
- */
+ /* Validate the above table - this just builds the above values */
{
unsigned int i;
- int read_transforms = 0;
- int write_transforms = 0;
- int all_transforms = 0;
for (i=0; i<TTABLE_SIZE; ++i)
{
- all_transforms |= transform_info[i].transform;
-
if (transform_info[i].when & TRANSFORM_R)
read_transforms |= transform_info[i].transform;
@@ -274,13 +324,10 @@
write_transforms |= transform_info[i].transform;
}
- if (read_transforms != READ_TRANSFORMS ||
- write_transforms != WRITE_TRANSFORMS ||
- all_transforms != ALL_TRANSFORMS)
- {
- fprintf(stderr, "pngimage: transform_info incorrect\n");
- exit(99); /* internal test error */
- }
+ /* Reversible transforms are those which are supported on both read and
+ * write.
+ */
+ rw_transforms = read_transforms & write_transforms;
}
/* FILE DATA HANDLING
@@ -1335,7 +1382,7 @@
* we should get back to the place where we started.
*/
#ifdef PNG_WRITE_SUPPORTED
- if ((current & WRITE_TRANSFORMS) == current)
+ if ((current & write_transforms) == current)
{
/* All transforms reversible: write the PNG with the transformations
* reversed, then read it back in with no transformations. The
@@ -1375,19 +1422,19 @@
do
{
- if (next == READ_TRANSFORMS) /* Everything tested */
+ if (next == read_transforms) /* Everything tested */
goto combo;
++next;
} /* skip known bad combos if the relevant option is set; skip
* combos involving known bad single transforms in all cases.
*/
- while ( (next & READ_TRANSFORMS) <= current
+ while ( (next & read_transforms) <= current
|| (next & active) == 0 /* skip cases that do nothing */
|| (next & bad_transforms) != 0
|| skip_transform(dp, next));
- assert((next & READ_TRANSFORMS) == next);
+ assert((next & read_transforms) == next);
current = next;
}
@@ -1412,7 +1459,7 @@
if (bad_combo != ~0U)
printf("%s[0x%x]: PROBLEM: 0x%x[0x%x] ANTIDOTE: 0x%x\n",
dp->filename, active, bad_combo, bad_combo_list,
- RW_TRANSFORMS & ~bad_combo_list);
+ rw_transforms & ~bad_combo_list);
else
printf("%s: no %sbad combos found\n", dp->filename,
diff --git a/libpng-manual.txt b/libpng-manual.txt
index df3f9eb..134b466 100644
--- a/libpng-manual.txt
+++ b/libpng-manual.txt
@@ -1,6 +1,6 @@
libpng-manual.txt - A description on how to use and modify libpng
- libpng version 1.7.0beta31 - February 2, 2014
+ libpng version 1.7.0beta31 - February 6, 2014
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2014 Glenn Randers-Pehrson
@@ -11,7 +11,7 @@
Based on:
- libpng versions 0.97, January 1998, through 1.7.0beta31 - February 2, 2014
+ libpng versions 0.97, January 1998, through 1.7.0beta31 - February 6, 2014
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2014 Glenn Randers-Pehrson
@@ -5270,7 +5270,7 @@
XVII. Y2K Compliance in libpng
-February 2, 2014
+February 6, 2014
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
diff --git a/libpng.3 b/libpng.3
index 3bc944b..24c967e 100644
--- a/libpng.3
+++ b/libpng.3
@@ -1,4 +1,4 @@
-.TH LIBPNG 3 "February 2, 2014"
+.TH LIBPNG 3 "February 6, 2014"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.7.0beta31
.SH SYNOPSIS
@@ -494,7 +494,7 @@
.SH LIBPNG.TXT
libpng-manual.txt - A description on how to use and modify libpng
- libpng version 1.7.0beta31 - February 2, 2014
+ libpng version 1.7.0beta31 - February 6, 2014
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2014 Glenn Randers-Pehrson
@@ -505,7 +505,7 @@
Based on:
- libpng versions 0.97, January 1998, through 1.7.0beta31 - February 2, 2014
+ libpng versions 0.97, January 1998, through 1.7.0beta31 - February 6, 2014
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2014 Glenn Randers-Pehrson
@@ -5765,7 +5765,7 @@
.SH XVII. Y2K Compliance in libpng
-February 2, 2014
+February 6, 2014
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
@@ -6035,7 +6035,7 @@
Thanks to Frank J. T. Wojcik for helping with the documentation.
-Libpng version 1.7.0beta31 - February 2, 2014:
+Libpng version 1.7.0beta31 - February 6, 2014:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
@@ -6058,7 +6058,7 @@
This code is released under the libpng license.
-libpng versions 1.2.6, August 15, 2004, through 1.7.0beta31, February 2, 2014, are
+libpng versions 1.2.6, August 15, 2004, through 1.7.0beta31, February 6, 2014, are
Copyright (c) 2004,2006-2007 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors
@@ -6157,7 +6157,7 @@
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
-February 2, 2014
+February 6, 2014
.\" end of man page
diff --git a/libpngpf.3 b/libpngpf.3
index 92df01a..9d24855 100644
--- a/libpngpf.3
+++ b/libpngpf.3
@@ -1,4 +1,4 @@
-.TH LIBPNGPF 3 "February 2, 2014"
+.TH LIBPNGPF 3 "February 6, 2014"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.7.0beta31
(private functions)
diff --git a/png.5 b/png.5
index 6b00194..3f0c50d 100644
--- a/png.5
+++ b/png.5
@@ -1,4 +1,4 @@
-.TH PNG 5 "February 2, 2014"
+.TH PNG 5 "February 6, 2014"
.SH NAME
png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION
diff --git a/png.c b/png.c
index bb77f01..340df72 100644
--- a/png.c
+++ b/png.c
@@ -696,13 +696,13 @@
#else
# ifdef __STDC__
return PNG_STRING_NEWLINE \
- "libpng version 1.7.0beta31 - February 2, 2014" PNG_STRING_NEWLINE \
+ "libpng version 1.7.0beta31 - February 6, 2014" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE;
# else
- return "libpng version 1.7.0beta31 - February 2, 2014\
+ return "libpng version 1.7.0beta31 - February 6, 2014\
Copyright (c) 1998-2014 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
diff --git a/pngconf.h b/pngconf.h
index eb15518..df9f60d 100644
--- a/pngconf.h
+++ b/pngconf.h
@@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng
*
- * libpng version 1.7.0beta31 - February 2, 2014
+ * libpng version 1.7.0beta31 - February 6, 2014
*
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/projects/vstudio/readme.txt b/projects/vstudio/readme.txt
index b882e9a..64de7c9 100644
--- a/projects/vstudio/readme.txt
+++ b/projects/vstudio/readme.txt
@@ -1,7 +1,7 @@
VisualStudio instructions
-libpng version 1.7.0beta31 - February 2, 2014
+libpng version 1.7.0beta31 - February 6, 2014
Copyright (c) 1998-2010 Glenn Randers-Pehrson
diff --git a/projects/vstudio/zlib.props b/projects/vstudio/zlib.props
index 32d0661..dbbc556 100644
--- a/projects/vstudio/zlib.props
+++ b/projects/vstudio/zlib.props
@@ -2,7 +2,7 @@
<!--
* zlib.props - location of zlib source
*
- * libpng version 1.7.0beta31 - February 2, 2014
+ * libpng version 1.7.0beta31 - February 6, 2014
*
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
*
diff --git a/scripts/README.txt b/scripts/README.txt
index 9d1d889..0e2484e 100644
--- a/scripts/README.txt
+++ b/scripts/README.txt
@@ -1,5 +1,5 @@
-Makefiles for libpng version 1.7.0beta31 - February 2, 2014
+Makefiles for libpng version 1.7.0beta31 - February 6, 2014
pnglibconf.h.prebuilt => Stores configuration settings
makefile.linux => Linux/ELF makefile
diff --git a/scripts/pnglibconf.h.prebuilt b/scripts/pnglibconf.h.prebuilt
index 4322b00..df4e229 100644
--- a/scripts/pnglibconf.h.prebuilt
+++ b/scripts/pnglibconf.h.prebuilt
@@ -2,7 +2,7 @@
/* pnglibconf.h - library build configuration */
-/* Libpng version 1.7.0beta31 - February 2, 2014 */
+/* Libpng version 1.7.0beta31 - February 6, 2014 */
/* Copyright (c) 1998-2013 Glenn Randers-Pehrson */