[libpng16] Added sPLT support to pngtest.c
diff --git a/ANNOUNCE b/ANNOUNCE
index 30de9f5..e535721 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,4 +1,4 @@
-Libpng 1.6.19beta04 - October 3, 2015
+Libpng 1.6.19beta04 - October 10, 2015
 
 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.
@@ -92,7 +92,7 @@
     warning, updated pngstest-errors.h for the errors detected with the
     new contrib/testspngs PNG test files (John Bowler).
 
-Version 1.6.19beta04 [October 3, 2015]
+Version 1.6.19beta04 [October 10, 2015]
   Worked around rgb-to-gray issues in libpng 1.6.  The previous
     attempts to ignore the errors in the code aren't quite enough to
     deal with the 'channel selection' encoding added to libpng 1.7; abort.
@@ -101,6 +101,7 @@
     directives.  Make sure pow is a function where this happens. This is
     a minimal safe fix, the issue only arises in non-performance-critical
     code (bug report by Curtis Leach, fix by John Bowler).
+  Added sPLT support to pngtest.c
 
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
 (subscription required; visit
diff --git a/CHANGES b/CHANGES
index 5f339df..f770320 100644
--- a/CHANGES
+++ b/CHANGES
@@ -5375,7 +5375,7 @@
     warning, updated pngstest-errors.h for the errors detected with the
     new contrib/testspngs PNG test files (John Bowler).
 
-Version 1.6.19beta04 [October 3, 2015]
+Version 1.6.19beta04 [October 10, 2015]
   Worked around rgb-to-gray issues in libpng 1.6.  The previous
     attempts to ignore the errors in the code aren't quite enough to
     deal with the 'channel selection' encoding added to libpng 1.7; abort.
@@ -5385,6 +5385,7 @@
     directives.  Make sure pow is a function where this happens. This is
     a minimal safe fix, the issue only arises in non-performance-critical
     code (bug report by Curtis Leach, fix by John Bowler).
+  Added sPLT support to pngtest.c
 
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
 (subscription required; visit
diff --git a/pngtest.c b/pngtest.c
index f3513bb..c629118 100644
--- a/pngtest.c
+++ b/pngtest.c
@@ -1,7 +1,7 @@
 
 /* pngtest.c - a simple test program to test libpng
  *
- * Last changed in libpng 1.6.18 [July 23, 2015]
+ * Last changed in libpng 1.6.19 [(PENDING RELEASE)]
  * Copyright (c) 1998-2015 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.)
@@ -60,6 +60,7 @@
    defined PNG_READ_pHYs_SUPPORTED &&\
    defined PNG_READ_sBIT_SUPPORTED &&\
    defined PNG_READ_sCAL_SUPPORTED &&\
+   defined PNG_READ_sPLT_SUPPORTED &&\
    defined PNG_READ_sRGB_SUPPORTED &&\
    defined PNG_READ_tEXt_SUPPORTED &&\
    defined PNG_READ_tIME_SUPPORTED &&\
@@ -1076,6 +1077,7 @@
 #endif
       }
    }
+
 #ifdef PNG_FIXED_POINT_SUPPORTED
 #ifdef PNG_cHRM_SUPPORTED
    {
@@ -1090,6 +1092,7 @@
       }
    }
 #endif
+
 #ifdef PNG_gAMA_SUPPORTED
    {
       png_fixed_point gamma;
@@ -1123,6 +1126,7 @@
 #endif
 #endif /* Floating point */
 #endif /* Fixed point */
+
 #ifdef PNG_iCCP_SUPPORTED
    {
       png_charp name;
@@ -1138,6 +1142,7 @@
       }
    }
 #endif
+
 #ifdef PNG_sRGB_SUPPORTED
    {
       int intent;
@@ -1146,6 +1151,7 @@
          png_set_sRGB(write_ptr, write_info_ptr, intent);
    }
 #endif
+
    {
       png_colorp palette;
       int num_palette;
@@ -1153,6 +1159,7 @@
       if (png_get_PLTE(read_ptr, read_info_ptr, &palette, &num_palette) != 0)
          png_set_PLTE(write_ptr, write_info_ptr, palette, num_palette);
    }
+
 #ifdef PNG_bKGD_SUPPORTED
    {
       png_color_16p background;
@@ -1163,6 +1170,7 @@
       }
    }
 #endif
+
 #ifdef PNG_hIST_SUPPORTED
    {
       png_uint_16p hist;
@@ -1171,6 +1179,7 @@
          png_set_hIST(write_ptr, write_info_ptr, hist);
    }
 #endif
+
 #ifdef PNG_oFFs_SUPPORTED
    {
       png_int_32 offset_x, offset_y;
@@ -1183,6 +1192,7 @@
       }
    }
 #endif
+
 #ifdef PNG_pCAL_SUPPORTED
    {
       png_charp purpose, units;
@@ -1198,6 +1208,7 @@
       }
    }
 #endif
+
 #ifdef PNG_pHYs_SUPPORTED
    {
       png_uint_32 res_x, res_y;
@@ -1208,6 +1219,7 @@
          png_set_pHYs(write_ptr, write_info_ptr, res_x, res_y, unit_type);
    }
 #endif
+
 #ifdef PNG_sBIT_SUPPORTED
    {
       png_color_8p sig_bit;
@@ -1216,6 +1228,7 @@
          png_set_sBIT(write_ptr, write_info_ptr, sig_bit);
    }
 #endif
+
 #ifdef PNG_sCAL_SUPPORTED
 #if defined(PNG_FLOATING_POINT_SUPPORTED) && \
    defined(PNG_FLOATING_ARITHMETIC_SUPPORTED)
@@ -1242,9 +1255,22 @@
              scal_height);
       }
    }
-#endif
-#endif
-#endif
+#endif /* FIXED_POINT */
+#endif /* FLOATING_POINT */
+#endif /* sCAL */
+
+#ifdef PNG_sPLT_SUPPORTED
+   {
+       png_sPLT_tp entries;
+
+       int num_entries = (int) png_get_sPLT(read_ptr, read_info_ptr, &entries);
+       if (num_entries)
+       {
+           png_set_sPLT(write_ptr, write_info_ptr, entries, num_entries);
+       }
+   }
+#endif /* sPLT */
+
 #ifdef PNG_TEXT_SUPPORTED
    {
       png_textp text_ptr;
@@ -1271,7 +1297,8 @@
          png_set_text(write_ptr, write_info_ptr, text_ptr, num_text);
       }
    }
-#endif
+#endif /* TEXT */
+
 #ifdef PNG_tIME_SUPPORTED
    {
       png_timep mod_time;
@@ -1293,7 +1320,8 @@
 #endif /* TIME_RFC1123 */
       }
    }
-#endif
+#endif /* tIME */
+
 #ifdef PNG_tRNS_SUPPORTED
    {
       png_bytep trans_alpha;
@@ -1315,7 +1343,8 @@
                trans_color);
       }
    }
-#endif
+#endif /* tRNS */
+
 #ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
    {
       png_unknown_chunkp unknowns;