Browse Source

libpng: Update to upstream version 1.6.30

Rémi Verschelde 8 years ago
parent
commit
b1ca62af52

+ 1 - 1
thirdparty/README.md

@@ -107,7 +107,7 @@ Files extracted from upstream source:
 ## libpng
 ## libpng
 
 
 - Upstream: http://libpng.org/pub/png/libpng.html
 - Upstream: http://libpng.org/pub/png/libpng.html
-- Version: 1.6.28
+- Version: 1.6.30
 - License: libpng/zlib
 - License: libpng/zlib
 
 
 Files extracted from upstream source:
 Files extracted from upstream source:

+ 36 - 19
thirdparty/libpng/png.c

@@ -1,7 +1,7 @@
 
 
 /* png.c - location for general purpose libpng functions
 /* png.c - location for general purpose libpng functions
  *
  *
- * Last changed in libpng 1.6.29 [March 16, 2017]
+ * Last changed in libpng 1.6.30 [(PENDING RELEASE)]
  * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
  * Copyright (c) 1998-2002,2004,2006-2017 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.)
@@ -14,7 +14,7 @@
 #include "pngpriv.h"
 #include "pngpriv.h"
 
 
 /* Generate a compiler error if there is an old png.h in the search path. */
 /* Generate a compiler error if there is an old png.h in the search path. */
-typedef png_libpng_version_1_6_29 Your_png_h_is_not_version_1_6_29;
+typedef png_libpng_version_1_6_30 Your_png_h_is_not_version_1_6_30;
 
 
 /* Tells libpng that we have already handled the first "num_bytes" bytes
 /* Tells libpng that we have already handled the first "num_bytes" bytes
  * of the PNG file signature.  If the PNG data is embedded into another
  * of the PNG file signature.  If the PNG data is embedded into another
@@ -776,14 +776,14 @@ png_get_copyright(png_const_structrp png_ptr)
 #else
 #else
 #  ifdef __STDC__
 #  ifdef __STDC__
    return PNG_STRING_NEWLINE \
    return PNG_STRING_NEWLINE \
-      "libpng version 1.6.29 - March 16, 2017" PNG_STRING_NEWLINE \
+      "libpng version 1.6.30 - June 28, 2017" PNG_STRING_NEWLINE \
       "Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson" \
       "Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson" \
       PNG_STRING_NEWLINE \
       PNG_STRING_NEWLINE \
       "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
       "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
       "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
       "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
       PNG_STRING_NEWLINE;
       PNG_STRING_NEWLINE;
 #  else
 #  else
-   return "libpng version 1.6.29 - March 16, 2017\
+   return "libpng version 1.6.30 - June 28, 2017\
       Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson\
       Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson\
       Copyright (c) 1996-1997 Andreas Dilger\
       Copyright (c) 1996-1997 Andreas Dilger\
       Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
       Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
@@ -2832,7 +2832,7 @@ png_pow10(int power)
    if (power < 0)
    if (power < 0)
    {
    {
       if (power < DBL_MIN_10_EXP) return 0;
       if (power < DBL_MIN_10_EXP) return 0;
-      recip = 1, power = -power;
+      recip = 1; power = -power;
    }
    }
 
 
    if (power > 0)
    if (power > 0)
@@ -2910,7 +2910,9 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
             double test = png_pow10(exp_b10+1);
             double test = png_pow10(exp_b10+1);
 
 
             if (test <= DBL_MAX)
             if (test <= DBL_MAX)
-               ++exp_b10, base = test;
+            {
+               ++exp_b10; base = test;
+            }
 
 
             else
             else
                break;
                break;
@@ -2924,7 +2926,10 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
           * test on DBL_MAX above.
           * test on DBL_MAX above.
           */
           */
          fp /= base;
          fp /= base;
-         while (fp >= 1) fp /= 10, ++exp_b10;
+         while (fp >= 1)
+         {
+            fp /= 10; ++exp_b10;
+         }
 
 
          /* Because of the code above fp may, at this point, be
          /* Because of the code above fp may, at this point, be
           * less than .1, this is ok because the code below can
           * less than .1, this is ok because the code below can
@@ -2975,7 +2980,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
                      /* Rounding up to 10, handle that here. */
                      /* Rounding up to 10, handle that here. */
                      if (czero > 0)
                      if (czero > 0)
                      {
                      {
-                        --czero, d = 1;
+                        --czero; d = 1;
                         if (cdigits == 0) --clead;
                         if (cdigits == 0) --clead;
                      }
                      }
                      else
                      else
@@ -2989,7 +2994,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
 
 
                            else if (ch == 46)
                            else if (ch == 46)
                            {
                            {
-                              ch = *--ascii, ++size;
+                              ch = *--ascii; ++size;
                               /* Advance exp_b10 to '1', so that the
                               /* Advance exp_b10 to '1', so that the
                                * decimal point happens after the
                                * decimal point happens after the
                                * previous digit.
                                * previous digit.
@@ -3016,7 +3021,9 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
                               int ch = *--ascii;
                               int ch = *--ascii;
 
 
                               if (ch == 46)
                               if (ch == 46)
-                                 ++size, exp_b10 = 1;
+                              {
+                                 ++size; exp_b10 = 1;
+                              }
 
 
                               /* Else lost a leading zero, so 'exp_b10' is
                               /* Else lost a leading zero, so 'exp_b10' is
                                * still ok at (-1)
                                * still ok at (-1)
@@ -3052,21 +3059,26 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
                       */
                       */
                      if (exp_b10 != (-1))
                      if (exp_b10 != (-1))
                      {
                      {
-                        if (exp_b10 == 0) *ascii++ = 46, --size;
+                        if (exp_b10 == 0)
+                        {
+                           *ascii++ = 46; --size;
+                        }
                         /* PLUS 1: TOTAL 4 */
                         /* PLUS 1: TOTAL 4 */
                         --exp_b10;
                         --exp_b10;
                      }
                      }
-                     *ascii++ = 48, --czero;
+                     *ascii++ = 48; --czero;
                   }
                   }
 
 
                   if (exp_b10 != (-1))
                   if (exp_b10 != (-1))
                   {
                   {
                      if (exp_b10 == 0)
                      if (exp_b10 == 0)
-                        *ascii++ = 46, --size; /* counted above */
+                     {
+                        *ascii++ = 46; --size; /* counted above */
+                     }
 
 
                      --exp_b10;
                      --exp_b10;
                   }
                   }
-                  *ascii++ = (char)(48 + (int)d), ++cdigits;
+                  *ascii++ = (char)(48 + (int)d); ++cdigits;
                }
                }
             }
             }
             while (cdigits+czero < precision+clead && fp > DBL_MIN);
             while (cdigits+czero < precision+clead && fp > DBL_MIN);
@@ -3107,7 +3119,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
              */
              */
             size -= cdigits;
             size -= cdigits;
 
 
-            *ascii++ = 69, --size;    /* 'E': PLUS 1 TOTAL 2+precision */
+            *ascii++ = 69; --size;    /* 'E': PLUS 1 TOTAL 2+precision */
 
 
             /* The following use of an unsigned temporary avoids ambiguities in
             /* The following use of an unsigned temporary avoids ambiguities in
              * the signed arithmetic on exp_b10 and permits GCC at least to do
              * the signed arithmetic on exp_b10 and permits GCC at least to do
@@ -3118,7 +3130,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
 
 
                if (exp_b10 < 0)
                if (exp_b10 < 0)
                {
                {
-                  *ascii++ = 45, --size; /* '-': PLUS 1 TOTAL 3+precision */
+                  *ascii++ = 45; --size; /* '-': PLUS 1 TOTAL 3+precision */
                   uexp_b10 = (unsigned int)(-exp_b10);
                   uexp_b10 = (unsigned int)(-exp_b10);
                }
                }
 
 
@@ -3185,7 +3197,9 @@ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii,
 
 
       /* Avoid overflow here on the minimum integer. */
       /* Avoid overflow here on the minimum integer. */
       if (fp < 0)
       if (fp < 0)
-         *ascii++ = 45, num = (png_uint_32)(-fp);
+      {
+         *ascii++ = 45; num = (png_uint_32)(-fp);
+      }
       else
       else
          num = (png_uint_32)fp;
          num = (png_uint_32)fp;
 
 
@@ -3223,7 +3237,10 @@ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii,
                 * then ndigits digits to first:
                 * then ndigits digits to first:
                 */
                 */
                i = 5;
                i = 5;
-               while (ndigits < i) *ascii++ = 48, --i;
+               while (ndigits < i)
+               {
+                  *ascii++ = 48; --i;
+               }
                while (ndigits >= first) *ascii++ = digits[--ndigits];
                while (ndigits >= first) *ascii++ = digits[--ndigits];
                /* Don't output the trailing zeros! */
                /* Don't output the trailing zeros! */
             }
             }
@@ -4278,7 +4295,7 @@ png_set_option(png_structrp png_ptr, int option, int onoff)
    defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
    defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
 /* sRGB conversion tables; these are machine generated with the code in
 /* sRGB conversion tables; these are machine generated with the code in
  * contrib/tools/makesRGB.c.  The actual sRGB transfer curve defined in the
  * contrib/tools/makesRGB.c.  The actual sRGB transfer curve defined in the
- * specification (see the article at http://en.wikipedia.org/wiki/SRGB)
+ * specification (see the article at https://en.wikipedia.org/wiki/SRGB)
  * is used, not the gamma=1/2.2 approximation use elsewhere in libpng.
  * is used, not the gamma=1/2.2 approximation use elsewhere in libpng.
  * The sRGB to linear table is exact (to the nearest 16-bit linear fraction).
  * The sRGB to linear table is exact (to the nearest 16-bit linear fraction).
  * The inverse (linear to sRGB) table has accuracies as follows:
  * The inverse (linear to sRGB) table has accuracies as follows:

+ 13 - 13
thirdparty/libpng/png.h

@@ -1,7 +1,7 @@
 
 
 /* png.h - header file for PNG reference library
 /* png.h - header file for PNG reference library
  *
  *
- * libpng version 1.6.29, March 16, 2017
+ * libpng version 1.6.30, June 28, 2017
  *
  *
  * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
  * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -12,7 +12,7 @@
  * Authors and maintainers:
  * Authors and maintainers:
  *   libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
  *   libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
  *   libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
  *   libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
- *   libpng versions 0.97, January 1998, through 1.6.29, March 16, 2017:
+ *   libpng versions 0.97, January 1998, through 1.6.30, June 28, 2017:
  *     Glenn Randers-Pehrson.
  *     Glenn Randers-Pehrson.
  *   See also "Contributing Authors", below.
  *   See also "Contributing Authors", below.
  */
  */
@@ -25,7 +25,7 @@
  *
  *
  * This code is released under the libpng license.
  * This code is released under the libpng license.
  *
  *
- * libpng versions 1.0.7, July 1, 2000 through 1.6.29, March 16, 2017 are
+ * libpng versions 1.0.7, July 1, 2000 through 1.6.30, June 28, 2017 are
  * Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
  * Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
  * derived from libpng-1.0.6, and are distributed according to the same
  * derived from libpng-1.0.6, and are distributed according to the same
  * disclaimer and license as libpng-1.0.6 with the following individuals
  * disclaimer and license as libpng-1.0.6 with the following individuals
@@ -213,7 +213,7 @@
  *    ...
  *    ...
  *    1.5.28                  15    10527  15.so.15.28[.0]
  *    1.5.28                  15    10527  15.so.15.28[.0]
  *    ...
  *    ...
- *    1.6.29                  16    10629  16.so.16.29[.0]
+ *    1.6.30                  16    10630  16.so.16.30[.0]
  *
  *
  *    Henceforth the source version will match the shared-library major
  *    Henceforth the source version will match the shared-library major
  *    and minor numbers; the shared-library major version number will be
  *    and minor numbers; the shared-library major version number will be
@@ -234,20 +234,20 @@
  *
  *
  * See libpng.txt or libpng.3 for more information.  The PNG specification
  * See libpng.txt or libpng.3 for more information.  The PNG specification
  * is available as a W3C Recommendation and as an ISO Specification,
  * is available as a W3C Recommendation and as an ISO Specification,
- * <http://www.w3.org/TR/2003/REC-PNG-20031110/
+ * <https://www.w3.org/TR/2003/REC-PNG-20031110/
  */
  */
 
 
 /*
 /*
  * Y2K compliance in libpng:
  * Y2K compliance in libpng:
  * =========================
  * =========================
  *
  *
- *    March 16, 2017
+ *    June 28, 2017
  *
  *
  *    Since the PNG Development group is an ad-hoc body, we can't make
  *    Since the PNG Development group is an ad-hoc body, we can't make
  *    an official declaration.
  *    an official declaration.
  *
  *
  *    This is your unofficial assurance that libpng from version 0.71 and
  *    This is your unofficial assurance that libpng from version 0.71 and
- *    upward through 1.6.29 are Y2K compliant.  It is my belief that
+ *    upward through 1.6.30 are Y2K compliant.  It is my belief that
  *    earlier versions were also Y2K compliant.
  *    earlier versions were also Y2K compliant.
  *
  *
  *    Libpng only has two year fields.  One is a 2-byte unsigned integer
  *    Libpng only has two year fields.  One is a 2-byte unsigned integer
@@ -309,8 +309,8 @@
  */
  */
 
 
 /* Version information for png.h - this should match the version in png.c */
 /* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.6.29"
-#define PNG_HEADER_VERSION_STRING " libpng version 1.6.29 - March 16, 2017\n"
+#define PNG_LIBPNG_VER_STRING "1.6.30"
+#define PNG_HEADER_VERSION_STRING " libpng version 1.6.30 - June 28, 2017\n"
 
 
 #define PNG_LIBPNG_VER_SONUM   16
 #define PNG_LIBPNG_VER_SONUM   16
 #define PNG_LIBPNG_VER_DLLNUM  16
 #define PNG_LIBPNG_VER_DLLNUM  16
@@ -318,7 +318,7 @@
 /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
 /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
 #define PNG_LIBPNG_VER_MAJOR   1
 #define PNG_LIBPNG_VER_MAJOR   1
 #define PNG_LIBPNG_VER_MINOR   6
 #define PNG_LIBPNG_VER_MINOR   6
-#define PNG_LIBPNG_VER_RELEASE 29
+#define PNG_LIBPNG_VER_RELEASE 30
 
 
 /* This should match the numeric part of the final component of
 /* This should match the numeric part of the final component of
  * PNG_LIBPNG_VER_STRING, omitting any leading zero:
  * PNG_LIBPNG_VER_STRING, omitting any leading zero:
@@ -349,7 +349,7 @@
  * version 1.0.0 was mis-numbered 100 instead of 10000).  From
  * version 1.0.0 was mis-numbered 100 instead of 10000).  From
  * version 1.0.1 it's    xxyyzz, where x=major, y=minor, z=release
  * version 1.0.1 it's    xxyyzz, where x=major, y=minor, z=release
  */
  */
-#define PNG_LIBPNG_VER 10629 /* 1.6.29 */
+#define PNG_LIBPNG_VER 10630 /* 1.6.30 */
 
 
 /* Library configuration: these options cannot be changed after
 /* Library configuration: these options cannot be changed after
  * the library has been built.
  * the library has been built.
@@ -459,7 +459,7 @@ extern "C" {
 /* This triggers a compiler error in png.c, if png.c and png.h
 /* This triggers a compiler error in png.c, if png.c and png.h
  * do not agree upon the version number.
  * do not agree upon the version number.
  */
  */
-typedef char* png_libpng_version_1_6_29;
+typedef char* png_libpng_version_1_6_30;
 
 
 /* Basic control structions.  Read libpng-manual.txt or libpng.3 for more info.
 /* Basic control structions.  Read libpng-manual.txt or libpng.3 for more info.
  *
  *
@@ -2753,7 +2753,7 @@ typedef struct
  *
  *
  * When the simplified API needs to convert between sRGB and linear colorspaces,
  * When the simplified API needs to convert between sRGB and linear colorspaces,
  * the actual sRGB transfer curve defined in the sRGB specification (see the
  * the actual sRGB transfer curve defined in the sRGB specification (see the
- * article at http://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2
+ * article at https://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2
  * approximation used elsewhere in libpng.
  * approximation used elsewhere in libpng.
  *
  *
  * When an alpha channel is present it is expected to denote pixel coverage
  * When an alpha channel is present it is expected to denote pixel coverage

+ 1 - 1
thirdparty/libpng/pngconf.h

@@ -1,7 +1,7 @@
 
 
 /* pngconf.h - machine configurable file for libpng
 /* pngconf.h - machine configurable file for libpng
  *
  *
- * libpng version 1.6.29, March 16, 2017
+ * libpng version 1.6.30, June 28, 2017
  *
  *
  * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
  * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

+ 3 - 3
thirdparty/libpng/pnglibconf.h

@@ -1,10 +1,10 @@
-/* libpng 1.6.29 STANDARD API DEFINITION */
+/* libpng 1.6.30 STANDARD API DEFINITION */
 
 
 /* pnglibconf.h - library build configuration */
 /* pnglibconf.h - library build configuration */
 
 
-/* Libpng version 1.6.29 - March 16, 2017 */
+/* Libpng version 1.6.30 - June 28, 2017 */
 
 
-/* Copyright (c) 1998-2015 Glenn Randers-Pehrson */
+/* Copyright (c) 1998-2017 Glenn Randers-Pehrson */
 
 
 /* This code is released under the libpng license. */
 /* This code is released under the libpng license. */
 /* For conditions of distribution and use, see the disclaimer */
 /* For conditions of distribution and use, see the disclaimer */

+ 11 - 2
thirdparty/libpng/pngpriv.h

@@ -1,7 +1,7 @@
 
 
 /* pngpriv.h - private declarations for use inside libpng
 /* pngpriv.h - private declarations for use inside libpng
  *
  *
- * Last changed in libpng 1.6.29 [March 16, 2017]
+ * Last changed in libpng 1.6.30 [(PENDING RELEASE)]
  * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
  * Copyright (c) 1998-2002,2004,2006-2017 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.)
@@ -466,7 +466,16 @@
    static_cast<type>(static_cast<const void*>(value))
    static_cast<type>(static_cast<const void*>(value))
 #else
 #else
 #  define png_voidcast(type, value) (value)
 #  define png_voidcast(type, value) (value)
-#  define png_constcast(type, value) ((type)(value))
+#  ifdef _WIN64
+#     ifdef __GNUC__
+         typedef unsigned long long png_ptruint;
+#     else
+         typedef unsigned __int64 png_ptruint;
+#     endif
+#  else
+      typedef unsigned long png_ptruint;
+#  endif
+#  define png_constcast(type, value) ((type)(png_ptruint)(const void*)(value))
 #  define png_aligncast(type, value) ((void*)(value))
 #  define png_aligncast(type, value) ((void*)(value))
 #  define png_aligncastconst(type, value) ((const void*)(value))
 #  define png_aligncastconst(type, value) ((const void*)(value))
 #endif /* __cplusplus */
 #endif /* __cplusplus */

+ 5 - 3
thirdparty/libpng/pngrtran.c

@@ -1,7 +1,7 @@
 
 
 /* pngrtran.c - transforms the data in a row for PNG readers
 /* pngrtran.c - transforms the data in a row for PNG readers
  *
  *
- * Last changed in libpng 1.6.29 [March 16, 2017]
+ * Last changed in libpng 1.6.30 [(PENDING RELEASE)]
  * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
  * Copyright (c) 1998-2002,2004,2006-2017 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.)
@@ -2934,7 +2934,7 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
  * using the equation given in Poynton's ColorFAQ of 1998-01-04 at
  * using the equation given in Poynton's ColorFAQ of 1998-01-04 at
  * <http://www.inforamp.net/~poynton/>  (THIS LINK IS DEAD June 2008 but
  * <http://www.inforamp.net/~poynton/>  (THIS LINK IS DEAD June 2008 but
  * versions dated 1998 through November 2002 have been archived at
  * versions dated 1998 through November 2002 have been archived at
- * http://web.archive.org/web/20000816232553/http://www.inforamp.net/
+ * https://web.archive.org/web/20000816232553/www.inforamp.net/
  * ~poynton/notes/colour_and_gamma/ColorFAQ.txt )
  * ~poynton/notes/colour_and_gamma/ColorFAQ.txt )
  * Charles Poynton poynton at poynton.com
  * Charles Poynton poynton at poynton.com
  *
  *
@@ -4601,7 +4601,9 @@ png_do_expand_16(png_row_infop row_info, png_bytep row)
       png_byte *sp = row + row_info->rowbytes; /* source, last byte + 1 */
       png_byte *sp = row + row_info->rowbytes; /* source, last byte + 1 */
       png_byte *dp = sp + row_info->rowbytes;  /* destination, end + 1 */
       png_byte *dp = sp + row_info->rowbytes;  /* destination, end + 1 */
       while (dp > sp)
       while (dp > sp)
-         dp[-2] = dp[-1] = *--sp, dp -= 2;
+      {
+         dp[-2] = dp[-1] = *--sp; dp -= 2;
+      }
 
 
       row_info->rowbytes *= 2;
       row_info->rowbytes *= 2;
       row_info->bit_depth = 16;
       row_info->bit_depth = 16;

+ 14 - 5
thirdparty/libpng/pngrutil.c

@@ -1,7 +1,7 @@
 
 
 /* pngrutil.c - utilities to read a PNG file
 /* pngrutil.c - utilities to read a PNG file
  *
  *
- * Last changed in libpng 1.6.29 [March 16, 2017]
+ * Last changed in libpng 1.6.30 [(PENDING RELEASE)]
  * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
  * Copyright (c) 1998-2002,2004,2006-2017 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.)
@@ -2537,6 +2537,9 @@ png_handle_zTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
    if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
    if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
       png_ptr->mode |= PNG_AFTER_IDAT;
       png_ptr->mode |= PNG_AFTER_IDAT;
 
 
+   /* Note, "length" is sufficient here; we won't be adding
+    * a null terminator later.
+    */
    buffer = png_read_buffer(png_ptr, length, 2/*silent*/);
    buffer = png_read_buffer(png_ptr, length, 2/*silent*/);
 
 
    if (buffer == NULL)
    if (buffer == NULL)
@@ -3377,7 +3380,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
                 */
                 */
                do
                do
                {
                {
-                  dp[0] = sp[0], dp[1] = sp[1];
+                  dp[0] = sp[0]; dp[1] = sp[1];
 
 
                   if (row_width <= bytes_to_jump)
                   if (row_width <= bytes_to_jump)
                      return;
                      return;
@@ -3398,7 +3401,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
                 */
                 */
                for (;;)
                for (;;)
                {
                {
-                  dp[0] = sp[0], dp[1] = sp[1], dp[2] = sp[2];
+                  dp[0] = sp[0]; dp[1] = sp[1]; dp[2] = sp[2];
 
 
                   if (row_width <= bytes_to_jump)
                   if (row_width <= bytes_to_jump)
                      return;
                      return;
@@ -3887,7 +3890,10 @@ png_read_filter_row_paeth_1byte_pixel(png_row_infop row_info, png_bytep row,
       /* Find the best predictor, the least of pa, pb, pc favoring the earlier
       /* Find the best predictor, the least of pa, pb, pc favoring the earlier
        * ones in the case of a tie.
        * ones in the case of a tie.
        */
        */
-      if (pb < pa) pa = pb, a = b;
+      if (pb < pa)
+      {
+         pa = pb; a = b;
+      }
       if (pc < pa) a = c;
       if (pc < pa) a = c;
 
 
       /* Calculate the current pixel in a, and move the previous row pixel to c
       /* Calculate the current pixel in a, and move the previous row pixel to c
@@ -3939,7 +3945,10 @@ png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row,
       pc = (p + pc) < 0 ? -(p + pc) : p + pc;
       pc = (p + pc) < 0 ? -(p + pc) : p + pc;
 #endif
 #endif
 
 
-      if (pb < pa) pa = pb, a = b;
+      if (pb < pa)
+      {
+         pa = pb; a = b;
+      }
       if (pc < pa) a = c;
       if (pc < pa) a = c;
 
 
       a += *row;
       a += *row;

+ 9 - 6
thirdparty/libpng/pngset.c

@@ -1,8 +1,8 @@
 
 
 /* pngset.c - storage of image information into info struct
 /* pngset.c - storage of image information into info struct
  *
  *
- * Last changed in libpng 1.6.26 [October 20, 2016]
- * Copyright (c) 1998-2016 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.30 [(PENDING RELEASE)]
+ * Copyright (c) 1998-2017 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.)
  *
  *
@@ -1102,8 +1102,9 @@ png_set_sPLT(png_const_structrp png_ptr,
       info_ptr->valid |= PNG_INFO_sPLT;
       info_ptr->valid |= PNG_INFO_sPLT;
       ++(info_ptr->splt_palettes_num);
       ++(info_ptr->splt_palettes_num);
       ++np;
       ++np;
+      ++entries;
    }
    }
-   while (++entries, --nentries);
+   while (--nentries);
 
 
    if (nentries > 0)
    if (nentries > 0)
       png_chunk_report(png_ptr, "sPLT out of memory", PNG_CHUNK_WRITE_ERROR);
       png_chunk_report(png_ptr, "sPLT out of memory", PNG_CHUNK_WRITE_ERROR);
@@ -1696,14 +1697,16 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
       png_byte ch = (png_byte)*key++;
       png_byte ch = (png_byte)*key++;
 
 
       if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/))
       if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/))
-         *new_key++ = ch, ++key_len, space = 0;
+      {
+         *new_key++ = ch; ++key_len; space = 0;
+      }
 
 
       else if (space == 0)
       else if (space == 0)
       {
       {
          /* A space or an invalid character when one wasn't seen immediately
          /* A space or an invalid character when one wasn't seen immediately
           * before; output just a space.
           * before; output just a space.
           */
           */
-         *new_key++ = 32, ++key_len, space = 1;
+         *new_key++ = 32; ++key_len; space = 1;
 
 
          /* If the character was not a space then it is invalid. */
          /* If the character was not a space then it is invalid. */
          if (ch != 32)
          if (ch != 32)
@@ -1716,7 +1719,7 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
 
 
    if (key_len > 0 && space != 0) /* trailing space */
    if (key_len > 0 && space != 0) /* trailing space */
    {
    {
-      --key_len, --new_key;
+      --key_len; --new_key;
       if (bad_character == 0)
       if (bad_character == 0)
          bad_character = 32;
          bad_character = 32;
    }
    }

+ 26 - 12
thirdparty/libpng/pngtrans.c

@@ -1,8 +1,8 @@
 
 
 /* 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.6.26 [October 20, 2016]
- * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.30 [(PENDING RELEASE)]
+ * Copyright (c) 1998-2002,2004,2006-2017 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.)
  *
  *
@@ -514,11 +514,15 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
          if (at_start != 0) /* Skip initial filler */
          if (at_start != 0) /* Skip initial filler */
             ++sp;
             ++sp;
          else          /* Skip initial channel and, for sp, the filler */
          else          /* Skip initial channel and, for sp, the filler */
-            sp += 2, ++dp;
+         {
+            sp += 2; ++dp;
+         }
 
 
          /* For a 1 pixel wide image there is nothing to do */
          /* For a 1 pixel wide image there is nothing to do */
          while (sp < ep)
          while (sp < ep)
-            *dp++ = *sp, sp += 2;
+         {
+            *dp++ = *sp; sp += 2;
+         }
 
 
          row_info->pixel_depth = 8;
          row_info->pixel_depth = 8;
       }
       }
@@ -528,10 +532,14 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
          if (at_start != 0) /* Skip initial filler */
          if (at_start != 0) /* Skip initial filler */
             sp += 2;
             sp += 2;
          else          /* Skip initial channel and, for sp, the filler */
          else          /* Skip initial channel and, for sp, the filler */
-            sp += 4, dp += 2;
+         {
+            sp += 4; dp += 2;
+         }
 
 
          while (sp < ep)
          while (sp < ep)
-            *dp++ = *sp++, *dp++ = *sp, sp += 3;
+         {
+            *dp++ = *sp++; *dp++ = *sp; sp += 3;
+         }
 
 
          row_info->pixel_depth = 16;
          row_info->pixel_depth = 16;
       }
       }
@@ -554,11 +562,15 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
          if (at_start != 0) /* Skip initial filler */
          if (at_start != 0) /* Skip initial filler */
             ++sp;
             ++sp;
          else          /* Skip initial channels and, for sp, the filler */
          else          /* Skip initial channels and, for sp, the filler */
-            sp += 4, dp += 3;
+         {
+            sp += 4; dp += 3;
+         }
 
 
          /* Note that the loop adds 3 to dp and 4 to sp each time. */
          /* Note that the loop adds 3 to dp and 4 to sp each time. */
          while (sp < ep)
          while (sp < ep)
-            *dp++ = *sp++, *dp++ = *sp++, *dp++ = *sp, sp += 2;
+         {
+            *dp++ = *sp++; *dp++ = *sp++; *dp++ = *sp; sp += 2;
+         }
 
 
          row_info->pixel_depth = 24;
          row_info->pixel_depth = 24;
       }
       }
@@ -568,14 +580,16 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
          if (at_start != 0) /* Skip initial filler */
          if (at_start != 0) /* Skip initial filler */
             sp += 2;
             sp += 2;
          else          /* Skip initial channels and, for sp, the filler */
          else          /* Skip initial channels and, for sp, the filler */
-            sp += 8, dp += 6;
+         {
+            sp += 8; dp += 6;
+         }
 
 
          while (sp < ep)
          while (sp < ep)
          {
          {
             /* Copy 6 bytes, skip 2 */
             /* Copy 6 bytes, skip 2 */
-            *dp++ = *sp++, *dp++ = *sp++;
-            *dp++ = *sp++, *dp++ = *sp++;
-            *dp++ = *sp++, *dp++ = *sp, sp += 3;
+            *dp++ = *sp++; *dp++ = *sp++;
+            *dp++ = *sp++; *dp++ = *sp++;
+            *dp++ = *sp++; *dp++ = *sp; sp += 3;
          }
          }
 
 
          row_info->pixel_depth = 48;
          row_info->pixel_depth = 48;

+ 4 - 2
thirdparty/libpng/pngwutil.c

@@ -1003,7 +1003,8 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input,
                optimize_cmf(data, png_image_size(png_ptr));
                optimize_cmf(data, png_image_size(png_ptr));
 #endif
 #endif
 
 
-         png_write_complete_chunk(png_ptr, png_IDAT, data, size);
+         if (size > 0)
+            png_write_complete_chunk(png_ptr, png_IDAT, data, size);
          png_ptr->mode |= PNG_HAVE_IDAT;
          png_ptr->mode |= PNG_HAVE_IDAT;
 
 
          png_ptr->zstream.next_out = data;
          png_ptr->zstream.next_out = data;
@@ -1049,7 +1050,8 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input,
             optimize_cmf(data, png_image_size(png_ptr));
             optimize_cmf(data, png_image_size(png_ptr));
 #endif
 #endif
 
 
-         png_write_complete_chunk(png_ptr, png_IDAT, data, size);
+         if (size > 0)
+            png_write_complete_chunk(png_ptr, png_IDAT, data, size);
          png_ptr->zstream.avail_out = 0;
          png_ptr->zstream.avail_out = 0;
          png_ptr->zstream.next_out = NULL;
          png_ptr->zstream.next_out = NULL;
          png_ptr->mode |= PNG_HAVE_IDAT | PNG_AFTER_IDAT;
          png_ptr->mode |= PNG_HAVE_IDAT | PNG_AFTER_IDAT;