summaryrefslogtreecommitdiff
path: root/Build/source/libs/libpng/libpng-src/pngtest.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/libpng/libpng-src/pngtest.c')
-rw-r--r--Build/source/libs/libpng/libpng-src/pngtest.c93
1 files changed, 71 insertions, 22 deletions
diff --git a/Build/source/libs/libpng/libpng-src/pngtest.c b/Build/source/libs/libpng/libpng-src/pngtest.c
index bdd37db4bcc..ce53345e13e 100644
--- a/Build/source/libs/libpng/libpng-src/pngtest.c
+++ b/Build/source/libs/libpng/libpng-src/pngtest.c
@@ -1,8 +1,8 @@
/* pngtest.c - a simple test program to test libpng
*
- * 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.32 [August 24, 2017]
+ * Copyright (c) 1998-2002,2004,2006-2017 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.)
*
@@ -144,6 +144,7 @@ tIME_to_str(png_structp png_ptr, png_charp ts, png_const_timep t)
static int verbose = 0;
static int strict = 0;
static int relaxed = 0;
+static int xfail = 0;
static int unsupported_chunks = 0; /* chunk unsupported by libpng in input */
static int error_count = 0; /* count calls to png_error */
static int warning_count = 0; /* count calls to png_warning */
@@ -463,7 +464,7 @@ pngtest_warning(png_structp png_ptr, png_const_charp message)
if (test != NULL && test->file_name != NULL)
name = test->file_name;
- fprintf(STDERR, "%s: libpng warning: %s\n", name, message);
+ fprintf(STDERR, "\n%s: libpng warning: %s\n", name, message);
}
/* This is the default error handling function. Note that replacements for
@@ -936,8 +937,12 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
fprintf(STDERR, "%s -> %s: libpng read error\n", inname, outname);
png_free(read_ptr, row_buf);
row_buf = NULL;
+ if (verbose != 0)
+ fprintf(STDERR, " destroy read structs\n");
png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr);
#ifdef PNG_WRITE_SUPPORTED
+ if (verbose != 0)
+ fprintf(STDERR, " destroy write structs\n");
png_destroy_info_struct(write_ptr, &write_end_info_ptr);
png_destroy_write_struct(&write_ptr, &write_info_ptr);
#endif
@@ -952,11 +957,13 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
if (setjmp(png_jmpbuf(write_ptr)))
{
fprintf(STDERR, "%s -> %s: libpng write error\n", inname, outname);
+ if (verbose != 0)
+ fprintf(STDERR, " destroying read structs\n");
png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr);
+ if (verbose != 0)
+ fprintf(STDERR, " destroying write structs\n");
png_destroy_info_struct(write_ptr, &write_end_info_ptr);
-#ifdef PNG_WRITE_SUPPORTED
png_destroy_write_struct(&write_ptr, &write_info_ptr);
-#endif
FCLOSE(fpin);
FCLOSE(fpout);
return (1);
@@ -1192,12 +1199,20 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
-#ifdef PNG_eXIf_SUPPORTED
+#ifdef PNG_READ_eXIf_SUPPORTED
{
- png_bytep exif;
+ png_bytep exif=NULL;
+ png_uint_32 exif_length;
- if (png_get_eXIf(read_ptr, read_info_ptr, &exif) != 0)
- png_set_eXIf(write_ptr, write_info_ptr, exif);
+ if (png_get_eXIf_1(read_ptr, read_info_ptr, &exif_length, &exif) != 0)
+ {
+ if (exif_length > 1)
+ fprintf(STDERR," eXIf type %c%c, %lu bytes\n",exif[0],exif[1],
+ (unsigned long)exif_length);
+# ifdef PNG_WRITE_eXIf_SUPPORTED
+ png_set_eXIf_1(write_ptr, write_info_ptr, exif_length, exif);
+# endif
+ }
}
#endif
#ifdef PNG_hIST_SUPPORTED
@@ -1310,10 +1325,10 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
{
int i;
- printf("\n");
+ fprintf(STDERR,"\n");
for (i=0; i<num_text; i++)
{
- printf(" Text compression[%d]=%d\n",
+ fprintf(STDERR," Text compression[%d]=%d\n",
i, text_ptr[i].compression);
}
}
@@ -1406,6 +1421,10 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
write_chunks(write_ptr, before_IDAT); /* after PLTE */
+ png_write_info(write_ptr, write_end_info_ptr);
+
+ write_chunks(write_ptr, after_IDAT); /* after IDAT */
+
#ifdef PNG_COMPRESSION_COMPAT
/* Test the 'compatibility' setting here, if it is available. */
png_set_compression(write_ptr, PNG_COMPRESSION_COMPAT);
@@ -1526,10 +1545,10 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
{
int i;
- printf("\n");
+ fprintf(STDERR,"\n");
for (i=0; i<num_text; i++)
{
- printf(" Text compression[%d]=%d\n",
+ fprintf(STDERR," Text compression[%d]=%d\n",
i, text_ptr[i].compression);
}
}
@@ -1538,12 +1557,20 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
-#ifdef PNG_eXIf_SUPPORTED
+#ifdef PNG_READ_eXIf_SUPPORTED
{
- png_bytep exif;
+ png_bytep exif=NULL;
+ png_uint_32 exif_length;
- if (png_get_eXIf(read_ptr, end_info_ptr, &exif) != 0)
- png_set_eXIf(write_ptr, write_end_info_ptr, exif);
+ if (png_get_eXIf_1(read_ptr, end_info_ptr, &exif_length, &exif) != 0)
+ {
+ if (exif_length > 1)
+ fprintf(STDERR," eXIf type %c%c, %lu bytes\n",exif[0],exif[1],
+ (unsigned long)exif_length);
+# ifdef PNG_WRITE_eXIf_SUPPORTED
+ png_set_eXIf_1(write_ptr, write_end_info_ptr, exif_length, exif);
+# endif
+ }
}
#endif
#ifdef PNG_tIME_SUPPORTED
@@ -1861,6 +1888,7 @@ main(int argc, char *argv[])
inname = argv[2];
strict++;
relaxed = 0;
+ multiple=1;
}
else if (strcmp(argv[1], "--relaxed") == 0)
@@ -1870,6 +1898,17 @@ main(int argc, char *argv[])
inname = argv[2];
strict = 0;
relaxed++;
+ multiple=1;
+ }
+ else if (strcmp(argv[1], "--xfail") == 0)
+ {
+ status_dots_requested = 0;
+ verbose = 1;
+ inname = argv[2];
+ strict = 0;
+ xfail++;
+ relaxed++;
+ multiple=1;
}
else
@@ -1927,8 +1966,13 @@ main(int argc, char *argv[])
else
{
- fprintf(STDERR, " FAIL\n");
- ierror += kerror;
+ if (xfail)
+ fprintf(STDERR, " XFAIL\n");
+ else
+ {
+ fprintf(STDERR, " FAIL\n");
+ ierror += kerror;
+ }
}
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
if (allocation_now != current_allocation)
@@ -2016,8 +2060,13 @@ main(int argc, char *argv[])
#endif
}
- fprintf(STDERR, " FAIL\n");
- ierror += kerror;
+ if (xfail)
+ fprintf(STDERR, " XFAIL\n");
+ else
+ {
+ fprintf(STDERR, " FAIL\n");
+ ierror += kerror;
+ }
}
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
if (allocation_now != current_allocation)
@@ -2104,4 +2153,4 @@ main(void)
#endif
/* Generate a compiler error if there is an old png.h in the search path. */
-typedef png_libpng_version_1_6_31 Your_png_h_is_not_version_1_6_31;
+typedef png_libpng_version_1_6_32 Your_png_h_is_not_version_1_6_32;