[libpng17] Imported from libpng-1.7.0alpha10.tar
diff --git a/ANNOUNCE b/ANNOUNCE
index 916925b..2276ed1 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,5 +1,5 @@
 
-Libpng 1.7.0alpha10 - February 6, 2013
+Libpng 1.7.0alpha10 - February 7, 2013
 
 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.
@@ -116,7 +116,7 @@
 Version 1.7.0alpha09 [January 21, 2013]
   Pulled changes to multi-chunk handling from libpng-1.6.0beta40.
 
-Version 1.7.0alpha10 [February 6, 2013]
+Version 1.7.0alpha10 [February 7, 2013]
   Make symbol prefixing work with the ARM neon optimizations. Also
     allow pngpriv.h to be included for preprocessor definitions only, so
     it can be used in non-C/C++ files.
diff --git a/CHANGES b/CHANGES
index ddfeb68..7c9955c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4402,7 +4402,7 @@
 Version 1.7.0alpha09 [January 21, 2013]
   Pulled changes to multi-chunk handling from libpng-1.6.0beta40.
 
-Version 1.7.0alpha10 [February 6, 2013]
+Version 1.7.0alpha10 [February 7, 2013]
   Make symbol prefixing work with the ARM neon optimizations. Also
     allow pngpriv.h to be included for preprocessor definitions only, so
     it can be used in non-C/C++ files.
diff --git a/LICENSE b/LICENSE
index 51f083e..ab76e85 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.0alpha10, January 21, 2013, are
+libpng versions 1.2.6, August 15, 2004, through 1.7.0alpha10, February 7, 2013, are
 Copyright (c) 2004, 2006-2013 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
-January 21, 2013
+February 7, 2013
diff --git a/README b/README
index 2506c50..0b1c0ba 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-README for libpng version 1.7.0alpha10 - January 21, 2013 (shared library 17.0)
+README for libpng version 1.7.0alpha10 - February 7, 2013 (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/libpng-manual.txt b/libpng-manual.txt
index e4fd392..80271fc 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.0alpha10 - February 5, 2013
+ libpng version 1.7.0alpha10 - February 7, 2013
  Updated and distributed by Glenn Randers-Pehrson
  <glennrp at users.sourceforge.net>
  Copyright (c) 1998-2013 Glenn Randers-Pehrson
@@ -11,7 +11,7 @@
 
  Based on:
 
- libpng versions 0.97, January 1998, through 1.7.0alpha10 - February 5, 2013
+ libpng versions 0.97, January 1998, through 1.7.0alpha10 - February 7, 2013
  Updated and distributed by Glenn Randers-Pehrson
  Copyright (c) 1998-2011 Glenn Randers-Pehrson
 
@@ -5166,7 +5166,7 @@
 
 XVII. Y2K Compliance in libpng
 
-February 5, 2013
+February 7, 2013
 
 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 8f71abd..1f14d80 100644
--- a/libpng.3
+++ b/libpng.3
@@ -1,4 +1,4 @@
-.TH LIBPNG 3 "February 5, 2013"
+.TH LIBPNG 3 "February 7, 2013"
 .SH NAME
 libpng \- Portable Network Graphics (PNG) Reference Library 1.7.0alpha10
 .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.0alpha10 - February 5, 2013
+ libpng version 1.7.0alpha10 - February 7, 2013
  Updated and distributed by Glenn Randers-Pehrson
  <glennrp at users.sourceforge.net>
  Copyright (c) 1998-2013 Glenn Randers-Pehrson
@@ -505,7 +505,7 @@
 
  Based on:
 
- libpng versions 0.97, January 1998, through 1.7.0alpha10 - February 5, 2013
+ libpng versions 0.97, January 1998, through 1.7.0alpha10 - February 7, 2013
  Updated and distributed by Glenn Randers-Pehrson
  Copyright (c) 1998-2011 Glenn Randers-Pehrson
 
@@ -5661,7 +5661,7 @@
 
 .SH XVII. Y2K Compliance in libpng
 
-February 5, 2013
+February 7, 2013
 
 Since the PNG Development group is an ad-hoc body, we can't make
 an official declaration.
@@ -5930,7 +5930,7 @@
 
 Thanks to Frank J. T. Wojcik for helping with the documentation.
 
-Libpng version 1.7.0alpha10 - February 5, 2013:
+Libpng version 1.7.0alpha10 - February 7, 2013:
 Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
 Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
 
@@ -5953,7 +5953,7 @@
 
 This code is released under the libpng license.
 
-libpng versions 1.2.6, August 15, 2004, through 1.7.0alpha10, February 5, 2013, are
+libpng versions 1.2.6, August 15, 2004, through 1.7.0alpha10, February 7, 2013, 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
@@ -6052,7 +6052,7 @@
 
 Glenn Randers-Pehrson
 glennrp at users.sourceforge.net
-February 5, 2013
+February 7, 2013
 
 .\" end of man page
 
diff --git a/libpngpf.3 b/libpngpf.3
index d63ce27..b568752 100644
--- a/libpngpf.3
+++ b/libpngpf.3
@@ -1,4 +1,4 @@
-.TH LIBPNGPF 3 "January 21, 2013"
+.TH LIBPNGPF 3 "February 7, 2013"
 .SH NAME
 libpng \- Portable Network Graphics (PNG) Reference Library 1.7.0alpha10
 (private functions)
diff --git a/png.5 b/png.5
index f9044a4..ec3efaf 100644
--- a/png.5
+++ b/png.5
@@ -1,4 +1,4 @@
-.TH PNG 5 "January 21, 2013"
+.TH PNG 5 "February 7, 2013"
 .SH NAME
 png \- Portable Network Graphics (PNG) format
 .SH DESCRIPTION
diff --git a/png.c b/png.c
index 5d1fc9c..62191d8 100644
--- a/png.c
+++ b/png.c
@@ -691,13 +691,13 @@
 #else
 #  ifdef __STDC__
    return PNG_STRING_NEWLINE \
-     "libpng version 1.7.0alpha10 - February 5, 2013" PNG_STRING_NEWLINE \
+     "libpng version 1.7.0alpha10 - February 7, 2013" PNG_STRING_NEWLINE \
      "Copyright (c) 1998-2013 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.0alpha10 - February 5, 2013\
+      return "libpng version 1.7.0alpha10 - February 7, 2013\
       Copyright (c) 1998-2013 Glenn Randers-Pehrson\
       Copyright (c) 1996-1997 Andreas Dilger\
       Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
diff --git a/png.h b/png.h
index b6e949b..a2c2acf 100644
--- a/png.h
+++ b/png.h
@@ -1,7 +1,7 @@
 
 /* png.h - header file for PNG reference library
  *
- * libpng version 1.7.0alpha10 - February 6, 2013
+ * libpng version 1.7.0alpha10 - February 7, 2013
  * Copyright (c) 1998-2013 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.)
@@ -11,7 +11,7 @@
  * Authors and maintainers:
  *   libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
  *   libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
- *   libpng versions 0.97, January 1998, through 1.7.0alpha10 - February 6, 2013: Glenn
+ *   libpng versions 0.97, January 1998, through 1.7.0alpha10 - February 7, 2013: Glenn
  *   See also "Contributing Authors", below.
  *
  * Note about libpng version numbers:
@@ -199,7 +199,7 @@
  *
  * This code is released under the libpng license.
  *
- * libpng versions 1.2.6, August 15, 2004, through 1.7.0alpha10, February 6, 2013, are
+ * libpng versions 1.2.6, August 15, 2004, through 1.7.0alpha10, February 7, 2013, are
  * Copyright (c) 2004, 2006-2013 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:
@@ -311,7 +311,7 @@
  * Y2K compliance in libpng:
  * =========================
  *
- *    February 6, 2013
+ *    February 7, 2013
  *
  *    Since the PNG Development group is an ad-hoc body, we can't make
  *    an official declaration.
@@ -379,7 +379,7 @@
 /* Version information for png.h - this should match the version in png.c */
 #define PNG_LIBPNG_VER_STRING "1.7.0alpha10"
 #define PNG_HEADER_VERSION_STRING \
-     " libpng version 1.7.0alpha10 - February 6, 2013\n"
+     " libpng version 1.7.0alpha10 - February 7, 2013\n"
 
 #define PNG_LIBPNG_VER_SONUM   17
 #define PNG_LIBPNG_VER_DLLNUM  17
diff --git a/pngconf.h b/pngconf.h
index 929e795..81500ff 100644
--- a/pngconf.h
+++ b/pngconf.h
@@ -1,7 +1,7 @@
 
 /* pngconf.h - machine configurable file for libpng
  *
- * libpng version 1.7.0alpha10 - February 5, 2013
+ * libpng version 1.7.0alpha10 - February 7, 2013
  *
  * Copyright (c) 1998-2013 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/pngpriv.h b/pngpriv.h
index 9ebc510..a03c945 100644
--- a/pngpriv.h
+++ b/pngpriv.h
@@ -40,10 +40,17 @@
 #define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */
 
 #ifndef PNG_VERSION_INFO_ONLY
+/* Keep standard libraries at the top of this file */
+
 /* Standard library headers not required by png.h: */
 #  include <stdlib.h>
 #  include <string.h>
-#endif
+
+/* For headers only required with some build configurations see the lines after
+ * pnglibconf.h is included!
+ */
+
+#endif /* VERSION_INFO_ONLY */
 
 #define PNGLIB_BUILD /*libpng is being built, not used*/
 
@@ -88,6 +95,36 @@
 #  endif
 #endif
 
+#ifndef PNG_VERSION_INFO_ONLY
+/* Additional standard libaries required in certain cases, put only standard
+ * ANSI-C89 headers here.  If not available, or non-functional, the problem
+ * should be fixed by writing a wrapper for the header and the file on your
+ * include path.
+ */
+#if defined PNG_sCAL_SUPPORTED && defined PNG_FLOATING_POINT_SUPPORTED
+   /* png.c requires the following ANSI-C constants if the conversion of
+    * floating point to ASCII is implemented therein:
+    *
+    *  DBL_MIN_10_EXP Minimum negative integer such that 10^integer is a
+    *                 normalized (double) value.
+    *  DBL_DIG  Maximum number of decimal digits (can be set to any constant)
+    *  DBL_MIN  Smallest normalized fp number (can be set to an arbitrary value)
+    *  DBL_MAX  Maximum floating point number (can be set to an arbitrary value)
+    */
+#  include <float.h>
+#endif /* sCAL && FLOATING_POINT */
+
+#if defined PNG_FLOATING_ARITHMETIC_SUPPORTED ||\
+   defined PNG_FLOATING_POINT_SUPPORTED
+   /* ANSI-C90 math functions are required.  Full compliance with the standard
+    * is probably not a requirement, but the functions must exist and be
+    * declared in <math.h>
+    */
+#  include <math.h>
+#endif /* FLOATING_ARITHMETIC || FLOATING_POINT */
+
+#endif /* VERSION_INFO_ONLY */
+
 /* Is this a build of a DLL where compilation of the object modules requires
  * different preprocessor settings to those required for a simple library?  If
  * so PNG_BUILD_DLL must be set.
@@ -194,11 +231,27 @@
 #  endif
 #endif
 
+/* Include png.h here to get the version info and other macros, pngstruct.h and
+ * pnginfo.h are included later under the protection of !PNG_VERSION_INFO_ONLY
+ */
+#include "png.h"
+
 /* pngconf.h does not set PNG_DLL_EXPORT unless it is required, so: */
 #ifndef PNG_DLL_EXPORT
 #  define PNG_DLL_EXPORT
 #endif
 
+/* asserts are turned off in release code, but are in even in release candidates
+ * because often system builders only check future libpng releases when a
+ * release candidate is available.
+ */
+#if PNG_LIBPNG_BUILD_BASE_TYPE == PNG_LIBPNG_BUILD_STABLE
+#  define NDEBUG
+#endif
+#ifndef PNG_VERSION_INFO_ONLY
+#  include <assert.h>
+#endif
+
 /* SECURITY and SAFETY:
  *
  * By default libpng is built without any internal limits on image size,
@@ -326,50 +379,6 @@
 #  define PNGFAPI /* PRIVATE */
 #endif
 
-#ifndef PNG_VERSION_INFO_ONLY
-/* Other defines specific to compilers can go here.  Try to keep
- * them inside an appropriate ifdef/endif pair for portability.
- */
-#if defined PNG_sCAL_SUPPORTED && defined PNG_FLOATING_POINT_SUPPORTED
-   /* png.c requires the following ANSI-C constants if the conversion of
-    * floating point to ASCII is implemented therein:
-    *
-    *  DBL_MIN_10_EXP Minimum negative integer such that 10^integer is a
-    *                 normalized (double) value.
-    *  DBL_DIG  Maximum number of decimal digits (can be set to any constant)
-    *  DBL_MIN  Smallest normalized fp number (can be set to an arbitrary value)
-    *  DBL_MAX  Maximum floating point number (can be set to an arbitrary value)
-    */
-#  include <float.h>
-#endif /* sCAL && FLOATING_POINT */
-
-#if defined PNG_FLOATING_ARITHMETIC_SUPPORTED ||\
-   defined PNG_FLOATING_POINT_SUPPORTED
-   /* Certain floating point functions are used internally; only floor and ceil
-    * if FLOATING_POINT is supported, but if FLOATING_ARITHMETIC is used then
-    * pow and exp are needed too.
-    */
-#  if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
-    defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
-     /* We need to check that <math.h> hasn't already been included earlier
-      * as it seems it doesn't agree with <fp.h>, yet we should really use
-      * <fp.h> if possible.
-      */
-#    if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
-#      include <fp.h>
-#    endif
-#  else
-#    include <math.h>
-#  endif
-#  if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
-     /* Amiga SAS/C: We must include builtin FPU functions when compiling using
-      * MATH=68881
-      */
-#    include <m68881.h>
-#  endif
-#endif /* FLOATING_ARITHMETIC || FLOATING_POINT */
-#endif /* VERSION_INFO_ONLY */
-
 /* These macros may need to be architecture dependent. */
 #define PNG_ALIGN_NONE   0 /* do not use data alignment */
 #define PNG_ALIGN_ALWAYS 1 /* assume unaligned accesses are OK */
@@ -533,12 +542,15 @@
    abs((int)((c1).green) - (int)((c2).green)) + \
    abs((int)((c1).blue) - (int)((c2).blue)))
 
+#if defined PNG_SIMPLIFIED_READ_SUPPORTED ||\
+   defined PNG_SIMPLIFIED_WRITE_SUPPORTED
 /* See below for the definitions of the tables used in these macros */
 #define PNG_sRGB_FROM_LINEAR(linear) ((png_byte)((png_sRGB_base[(linear)>>15] +\
    ((((linear)&0x7fff)*png_sRGB_delta[(linear)>>15])>>12)) >> 8))
    /* Given a value 'linear' in the range 0..255*65535 calculate the 8-bit sRGB
     * encoded value with maximum error 0.646365.  Note that the input is not a
     * 16-bit value; it has been multiplied by 255! */
+#endif /* PNG_SIMPLIFIED_READ/WRITE */
 
 /* Added to libpng-1.6.0: scale a 16-bit value in the range 0..65535 to 0..255
  * by dividing by 257 *with rounding*.  This macro is exact for the given range.
@@ -679,7 +691,6 @@
  */
 #ifndef PNG_VERSION_INFO_ONLY
 
-#include "png.h"
 #include "pngstruct.h"
 #include "pnginfo.h"
 
@@ -691,6 +702,7 @@
 /* Added to libpng-1.5.7: sRGB conversion tables */
 #if defined PNG_SIMPLIFIED_READ_SUPPORTED ||\
    defined PNG_SIMPLIFIED_WRITE_SUPPORTED
+#ifdef PNG_SIMPLIFIED_READ_SUPPORTED
 PNG_INTERNAL_DATA(const png_uint_16, png_sRGB_table, [256]);
    /* Convert from an sRGB encoded value 0..255 to a 16-bit linear value,
     * 0..65535.  This table gives the closest 16-bit answers (no errors).
@@ -699,6 +711,7 @@
 
 PNG_INTERNAL_DATA(const png_uint_16, png_sRGB_base, [512]);
 PNG_INTERNAL_DATA(const png_byte, png_sRGB_delta, [512]);
+#endif /* PNG_SIMPLIFIED_READ/WRITE */
 
 
 /* Inhibit C++ name-mangling for libpng functions but not for system calls. */
diff --git a/projects/vstudio/readme.txt b/projects/vstudio/readme.txt
index 3b65e37..f162f32 100644
--- a/projects/vstudio/readme.txt
+++ b/projects/vstudio/readme.txt
@@ -1,7 +1,7 @@
 
 VisualStudio instructions
 
-libpng version 1.7.0alpha10 - January 21, 2013
+libpng version 1.7.0alpha10 - February 7, 2013
 
 Copyright (c) 1998-2010 Glenn Randers-Pehrson
 
diff --git a/projects/vstudio/zlib.props b/projects/vstudio/zlib.props
index 52717b7..5269343 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.0alpha10 - January 21, 2013
+ * libpng version 1.7.0alpha10 - February 7, 2013
  *
  * Copyright (c) 1998-2011 Glenn Randers-Pehrson
  *
diff --git a/scripts/README.txt b/scripts/README.txt
index 5ade432..8e3a0d3 100644
--- a/scripts/README.txt
+++ b/scripts/README.txt
@@ -1,5 +1,5 @@
 
-Makefiles for  libpng version 1.7.0alpha10 - February 5, 2013
+Makefiles for  libpng version 1.7.0alpha10 - February 7, 2013
 
 pnglibconf.h.prebuilt       =>  Stores configuration settings
  makefile.linux    =>  Linux/ELF makefile
diff --git a/scripts/options.awk b/scripts/options.awk
index c924b13..d178b49 100755
--- a/scripts/options.awk
+++ b/scripts/options.awk
@@ -30,7 +30,7 @@
 # are copied to the preprocessed file).
 
 BEGIN{
-   out="/dev/null"              # intermediate, preprocessed, file
+   out=""                       # intermediate, preprocessed, file
    pre=-1                       # preprocess (first line)
    version="libpng version unknown" # version information
    version_file=""              # where to find the version
@@ -79,7 +79,7 @@
 }
 
 # The output file must be specified before any input:
-out == "/dev/null" {
+out == "" {
    print "out=output.file must be given on the command line"
    err = 1
    exit 1
diff --git a/scripts/pnglibconf.h.prebuilt b/scripts/pnglibconf.h.prebuilt
index 47e0a0a..59bab94 100644
--- a/scripts/pnglibconf.h.prebuilt
+++ b/scripts/pnglibconf.h.prebuilt
@@ -1,6 +1,6 @@
 /* pnglibconf.h - library build configuration */
 
-/* libpng version 1.7.0alpha10 - February 5, 2013 */
+/* libpng version 1.7.0alpha10 - February 7, 2013 */
 
 /* Copyright (c) 1998-2013 Glenn Randers-Pehrson */