aboutsummaryrefslogtreecommitdiffstats
path: root/pngtest.c
diff options
context:
space:
mode:
authorPatrick Scott <phanna@android.com>2010-06-28 16:55:16 -0400
committerPatrick Scott <phanna@android.com>2010-06-28 16:55:16 -0400
commit5f6bd84e375226bf228fc8ac90318957ec9e1e7f (patch)
treeda1284f5023ad422da3263b48f1cefa6d6443912 /pngtest.c
parent342380c79a16cc2e5ba7859c3fc4e40f2661ea45 (diff)
downloadexternal_libpng-5f6bd84e375226bf228fc8ac90318957ec9e1e7f.zip
external_libpng-5f6bd84e375226bf228fc8ac90318957ec9e1e7f.tar.gz
external_libpng-5f6bd84e375226bf228fc8ac90318957ec9e1e7f.tar.bz2
Upgrade libpng to 1.2.44 for security fixes.
Change-Id: Iae257ca6ea7031a99f38e9de196d71ef8b94f9aa
Diffstat (limited to 'pngtest.c')
-rw-r--r--pngtest.c179
1 files changed, 96 insertions, 83 deletions
diff --git a/pngtest.c b/pngtest.c
index d491063..fd0e432 100644
--- a/pngtest.c
+++ b/pngtest.c
@@ -1,8 +1,8 @@
/* pngtest.c - a simple test program to test libpng
*
- * Last changed in libpng 1.2.37 [June 4, 2009]
- * Copyright (c) 1998-2009 Glenn Randers-Pehrson
+ * Last changed in libpng 1.2.43 [February 25, 2010]
+ * Copyright (c) 1998-2010 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.)
*
@@ -31,9 +31,10 @@
* of files at once by typing "pngtest -m file1.png file2.png ..."
*/
+#define PNG_PEDANTIC_WARNINGS
#include "png.h"
-#if defined(_WIN32_WCE)
+#ifdef _WIN32_WCE
# if _WIN32_WCE < 211
__error__ (f|w)printf functions are not supported on old WindowsCE.;
# endif
@@ -54,8 +55,8 @@
# define FCLOSE(file) fclose(file)
#endif
-#if defined(PNG_NO_STDIO)
-# if defined(_WIN32_WCE)
+#ifndef PNG_STDIO_SUPPORTED
+# ifdef _WIN32_WCE
typedef HANDLE png_FILE_p;
# else
typedef FILE * png_FILE_p;
@@ -75,7 +76,7 @@
#define PNGTEST_TIMING
*/
-#ifdef PNG_NO_FLOATING_POINT_SUPPORTED
+#ifndef PNG_FLOATING_POINT_SUPPORTED
#undef PNGTEST_TIMING
#endif
@@ -84,7 +85,7 @@ static float t_start, t_stop, t_decode, t_encode, t_misc;
#include <time.h>
#endif
-#if defined(PNG_TIME_RFC1123_SUPPORTED)
+#ifdef PNG_TIME_RFC1123_SUPPORTED
#define PNG_tIME_STRING_LENGTH 29
static int tIME_chunk_present = 0;
static char tIME_string[PNG_tIME_STRING_LENGTH] = "tIME chunk is not present";
@@ -162,7 +163,7 @@ write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass)
}
-#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
+#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
/* Example of using user transform callback (we don't transform anything,
* but merely examine the row filters. We set this to 256 rather than
* 5 in case illegal filter values are present.)
@@ -184,7 +185,7 @@ count_filters(png_structp png_ptr, png_row_infop row_info, png_bytep data)
}
#endif
-#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
+#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
/* Example of using user transform callback (we don't transform anything,
* but merely count the zero samples)
*/
@@ -297,7 +298,7 @@ count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data)
static int wrote_question = 0;
-#if defined(PNG_NO_STDIO)
+#ifndef PNG_STDIO_SUPPORTED
/* START of code to validate stdio-free compilation */
/* These copies of the default read/write functions come from pngrio.c and
* pngwio.c. They allow "don't include stdio" testing of the library.
@@ -311,12 +312,17 @@ static int wrote_question = 0;
static void
pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
- png_size_t check;
+ png_size_t check = 0;
+ png_voidp io_ptr;
/* fread() returns 0 on error, so it is OK to store this in a png_size_t
* instead of an int, which is what fread() actually returns.
*/
- READFILE((png_FILE_p)png_ptr->io_ptr, data, length, check);
+ io_ptr = png_get_io_ptr(png_ptr);
+ if (io_ptr != NULL)
+ {
+ READFILE((png_FILE_p)io_ptr, data, length, check);
+ }
if (check != length)
{
@@ -371,7 +377,7 @@ pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
}
#endif /* USE_FAR_KEYWORD */
-#if defined(PNG_WRITE_FLUSH_SUPPORTED)
+#ifdef PNG_WRITE_FLUSH_SUPPORTED
static void
pngtest_flush(png_structp png_ptr)
{
@@ -456,9 +462,12 @@ static void
pngtest_warning(png_structp png_ptr, png_const_charp message)
{
PNG_CONST char *name = "UNKNOWN (ERROR!)";
- if (png_ptr != NULL && png_ptr->error_ptr != NULL)
- name = png_ptr->error_ptr;
- fprintf(STDERR, "%s: libpng warning: %s\n", name, message);
+ char *test;
+ test = png_get_error_ptr(png_ptr);
+ if (test == NULL)
+ fprintf(STDERR, "%s: libpng warning: %s\n", name, message);
+ else
+ fprintf(STDERR, "%s: libpng warning: %s\n", test, message);
}
/* This is the default error handling function. Note that replacements for
@@ -474,7 +483,7 @@ pngtest_error(png_structp png_ptr, png_const_charp message)
* actually OK in this case.
*/
}
-#endif /* PNG_NO_STDIO */
+#endif /* !PNG_STDIO_SUPPORTED */
/* END of code to validate stdio-free compilation */
/* START of code to validate memory allocation and deallocation */
@@ -607,7 +616,7 @@ png_debug_free(png_structp png_ptr, png_voidp ptr)
/* Demonstration of user chunk support of the sTER and vpAg chunks */
-#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
/* (sTER is a public chunk not yet known by libpng. vpAg is a private
chunk used in ImageMagick to store "virtual page" size). */
@@ -701,16 +710,17 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif
#endif
-#if defined(_WIN32_WCE)
+#ifdef _WIN32_WCE
TCHAR path[MAX_PATH];
#endif
char inbuf[256], outbuf[256];
row_buf = NULL;
-#if defined(_WIN32_WCE)
+#ifdef _WIN32_WCE
MultiByteToWideChar(CP_ACP, 0, inname, -1, path, MAX_PATH);
- if ((fpin = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE)
+ if ((fpin = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0,
+ NULL)) == INVALID_HANDLE_VALUE)
#else
if ((fpin = fopen(inname, "rb")) == NULL)
#endif
@@ -719,9 +729,10 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
return (1);
}
-#if defined(_WIN32_WCE)
+#ifdef _WIN32_WCE
MultiByteToWideChar(CP_ACP, 0, outname, -1, path, MAX_PATH);
- if ((fpout = CreateFile(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL)) == INVALID_HANDLE_VALUE)
+ if ((fpout = CreateFile(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
+ 0, NULL)) == INVALID_HANDLE_VALUE)
#else
if ((fpout = fopen(outname, "wb")) == NULL)
#endif
@@ -742,12 +753,12 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_create_read_struct(PNG_LIBPNG_VER_STRING, png_voidp_NULL,
png_error_ptr_NULL, png_error_ptr_NULL);
#endif
-#if defined(PNG_NO_STDIO)
+#ifndef PNG_STDIO_SUPPORTED
png_set_error_fn(read_ptr, (png_voidp)inname, pngtest_error,
pngtest_warning);
#endif
-#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
user_chunk_data[0] = 0;
user_chunk_data[1] = 0;
user_chunk_data[2] = 0;
@@ -767,7 +778,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_create_write_struct(PNG_LIBPNG_VER_STRING, png_voidp_NULL,
png_error_ptr_NULL, png_error_ptr_NULL);
#endif
-#if defined(PNG_NO_STDIO)
+#ifndef PNG_STDIO_SUPPORTED
png_set_error_fn(write_ptr, (png_voidp)inname, pngtest_error,
pngtest_warning);
#endif
@@ -829,7 +840,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif
png_debug(0, "Initializing input and output streams");
-#if !defined(PNG_NO_STDIO)
+#ifdef PNG_STDIO_SUPPORTED
png_init_io(read_ptr, fpin);
# ifdef PNG_WRITE_SUPPORTED
png_init_io(write_ptr, fpout);
@@ -838,7 +849,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_set_read_fn(read_ptr, (png_voidp)fpin, pngtest_read_data);
# ifdef PNG_WRITE_SUPPORTED
png_set_write_fn(write_ptr, (png_voidp)fpout, pngtest_write_data,
-# if defined(PNG_WRITE_FLUSH_SUPPORTED)
+# ifdef PNG_WRITE_FLUSH_SUPPORTED
pngtest_flush);
# else
NULL);
@@ -860,7 +871,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_set_read_status_fn(read_ptr, png_read_status_ptr_NULL);
}
-#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
+#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
{
int i;
for (i = 0; i<256; i++)
@@ -868,19 +879,19 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_set_read_user_transform_fn(read_ptr, count_filters);
}
#endif
-#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
+#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
zero_samples = 0;
png_set_write_user_transform_fn(write_ptr, count_zero_samples);
#endif
-#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
# ifndef PNG_HANDLE_CHUNK_ALWAYS
# define PNG_HANDLE_CHUNK_ALWAYS 3
# endif
png_set_keep_unknown_chunks(read_ptr, PNG_HANDLE_CHUNK_ALWAYS,
png_bytep_NULL, 0);
#endif
-#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
# ifndef PNG_HANDLE_CHUNK_IF_SAFE
# define PNG_HANDLE_CHUNK_IF_SAFE 2
# endif
@@ -899,27 +910,27 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
&color_type, &interlace_type, &compression_type, &filter_type))
{
png_set_IHDR(write_ptr, write_info_ptr, width, height, bit_depth,
-#if defined(PNG_WRITE_INTERLACING_SUPPORTED)
+#ifdef PNG_WRITE_INTERLACING_SUPPORTED
color_type, interlace_type, compression_type, filter_type);
#else
color_type, PNG_INTERLACE_NONE, compression_type, filter_type);
#endif
}
}
-#if defined(PNG_FIXED_POINT_SUPPORTED)
-#if defined(PNG_cHRM_SUPPORTED)
+#ifdef PNG_FIXED_POINT_SUPPORTED
+#ifdef PNG_cHRM_SUPPORTED
{
png_fixed_point white_x, white_y, red_x, red_y, green_x, green_y, blue_x,
blue_y;
- if (png_get_cHRM_fixed(read_ptr, read_info_ptr, &white_x, &white_y, &red_x,
- &red_y, &green_x, &green_y, &blue_x, &blue_y))
+ if (png_get_cHRM_fixed(read_ptr, read_info_ptr, &white_x, &white_y,
+ &red_x, &red_y, &green_x, &green_y, &blue_x, &blue_y))
{
png_set_cHRM_fixed(write_ptr, write_info_ptr, white_x, white_y, red_x,
red_y, green_x, green_y, blue_x, blue_y);
}
}
#endif
-#if defined(PNG_gAMA_SUPPORTED)
+#ifdef PNG_gAMA_SUPPORTED
{
png_fixed_point gamma;
@@ -928,8 +939,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
#endif
#else /* Use floating point versions */
-#if defined(PNG_FLOATING_POINT_SUPPORTED)
-#if defined(PNG_cHRM_SUPPORTED)
+#ifdef PNG_FLOATING_POINT_SUPPORTED
+#ifdef PNG_cHRM_SUPPORTED
{
double white_x, white_y, red_x, red_y, green_x, green_y, blue_x,
blue_y;
@@ -941,7 +952,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
-#if defined(PNG_gAMA_SUPPORTED)
+#ifdef PNG_gAMA_SUPPORTED
{
double gamma;
@@ -951,7 +962,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif
#endif /* Floating point */
#endif /* Fixed point */
-#if defined(PNG_iCCP_SUPPORTED)
+#ifdef PNG_iCCP_SUPPORTED
{
png_charp name;
png_charp profile;
@@ -966,7 +977,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
-#if defined(PNG_sRGB_SUPPORTED)
+#ifdef PNG_sRGB_SUPPORTED
{
int intent;
@@ -981,7 +992,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
if (png_get_PLTE(read_ptr, read_info_ptr, &palette, &num_palette))
png_set_PLTE(write_ptr, write_info_ptr, palette, num_palette);
}
-#if defined(PNG_bKGD_SUPPORTED)
+#ifdef PNG_bKGD_SUPPORTED
{
png_color_16p background;
@@ -991,7 +1002,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
-#if defined(PNG_hIST_SUPPORTED)
+#ifdef PNG_hIST_SUPPORTED
{
png_uint_16p hist;
@@ -999,7 +1010,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_set_hIST(write_ptr, write_info_ptr, hist);
}
#endif
-#if defined(PNG_oFFs_SUPPORTED)
+#ifdef PNG_oFFs_SUPPORTED
{
png_int_32 offset_x, offset_y;
int unit_type;
@@ -1011,7 +1022,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
-#if defined(PNG_pCAL_SUPPORTED)
+#ifdef PNG_pCAL_SUPPORTED
{
png_charp purpose, units;
png_charpp params;
@@ -1026,7 +1037,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
-#if defined(PNG_pHYs_SUPPORTED)
+#ifdef PNG_pHYs_SUPPORTED
{
png_uint_32 res_x, res_y;
int unit_type;
@@ -1035,7 +1046,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_set_pHYs(write_ptr, write_info_ptr, res_x, res_y, unit_type);
}
#endif
-#if defined(PNG_sBIT_SUPPORTED)
+#ifdef PNG_sBIT_SUPPORTED
{
png_color_8p sig_bit;
@@ -1043,7 +1054,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_set_sBIT(write_ptr, write_info_ptr, sig_bit);
}
#endif
-#if defined(PNG_sCAL_SUPPORTED)
+#ifdef PNG_sCAL_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
{
int unit;
@@ -1064,13 +1075,14 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
if (png_get_sCAL_s(read_ptr, read_info_ptr, &unit, &scal_width,
&scal_height))
{
- png_set_sCAL_s(write_ptr, write_info_ptr, unit, scal_width, scal_height);
+ png_set_sCAL_s(write_ptr, write_info_ptr, unit, scal_width,
+ scal_height);
}
}
#endif
#endif
#endif
-#if defined(PNG_TEXT_SUPPORTED)
+#ifdef PNG_TEXT_SUPPORTED
{
png_textp text_ptr;
int num_text;
@@ -1082,14 +1094,14 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
-#if defined(PNG_tIME_SUPPORTED)
+#ifdef PNG_tIME_SUPPORTED
{
png_timep mod_time;
if (png_get_tIME(read_ptr, read_info_ptr, &mod_time))
{
png_set_tIME(write_ptr, write_info_ptr, mod_time);
-#if defined(PNG_TIME_RFC1123_SUPPORTED)
+#ifdef PNG_TIME_RFC1123_SUPPORTED
/* We have to use png_memcpy instead of "=" because the string
* pointed to by png_convert_to_rfc1123() gets free'ed before
* we use it.
@@ -1103,7 +1115,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
-#if defined(PNG_tRNS_SUPPORTED)
+#ifdef PNG_tRNS_SUPPORTED
{
png_bytep trans;
int num_trans;
@@ -1112,11 +1124,11 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
if (png_get_tRNS(read_ptr, read_info_ptr, &trans, &num_trans,
&trans_values))
{
- int sample_max = (1 << read_info_ptr->bit_depth);
+ int sample_max = (1 << bit_depth);
/* libpng doesn't reject a tRNS chunk with out-of-range samples */
- if (!((read_info_ptr->color_type == PNG_COLOR_TYPE_GRAY &&
+ if (!((color_type == PNG_COLOR_TYPE_GRAY &&
(int)trans_values->gray > sample_max) ||
- (read_info_ptr->color_type == PNG_COLOR_TYPE_RGB &&
+ (color_type == PNG_COLOR_TYPE_RGB &&
((int)trans_values->red > sample_max ||
(int)trans_values->green > sample_max ||
(int)trans_values->blue > sample_max))))
@@ -1125,7 +1137,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
-#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
{
png_unknown_chunkp unknowns;
int num_unknowns = (int)png_get_unknown_chunks(read_ptr, read_info_ptr,
@@ -1154,7 +1166,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
*/
png_write_info(write_ptr, write_info_ptr);
-#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
if (user_chunk_data[0] != 0)
{
png_byte png_sTER[5] = {115, 84, 69, 82, '\0'};
@@ -1248,17 +1260,17 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
-#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
png_free_data(read_ptr, read_info_ptr, PNG_FREE_UNKN, -1);
#endif
-#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
png_free_data(write_ptr, write_info_ptr, PNG_FREE_UNKN, -1);
#endif
png_debug(0, "Reading and writing end_info data");
png_read_end(read_ptr, end_info_ptr);
-#if defined(PNG_TEXT_SUPPORTED)
+#ifdef PNG_TEXT_SUPPORTED
{
png_textp text_ptr;
int num_text;
@@ -1270,14 +1282,14 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
-#if defined(PNG_tIME_SUPPORTED)
+#ifdef PNG_tIME_SUPPORTED
{
png_timep mod_time;
if (png_get_tIME(read_ptr, end_info_ptr, &mod_time))
{
png_set_tIME(write_ptr, write_end_info_ptr, mod_time);
-#if defined(PNG_TIME_RFC1123_SUPPORTED)
+#ifdef PNG_TIME_RFC1123_SUPPORTED
/* We have to use png_memcpy instead of "=" because the string
pointed to by png_convert_to_rfc1123() gets free'ed before
we use it */
@@ -1290,7 +1302,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
-#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
{
png_unknown_chunkp unknowns;
int num_unknowns;
@@ -1346,9 +1358,10 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
FCLOSE(fpout);
png_debug(0, "Opening files for comparison");
-#if defined(_WIN32_WCE)
+#ifdef _WIN32_WCE
MultiByteToWideChar(CP_ACP, 0, inname, -1, path, MAX_PATH);
- if ((fpin = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE)
+ if ((fpin = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING,
+ 0, NULL)) == INVALID_HANDLE_VALUE)
#else
if ((fpin = fopen(inname, "rb")) == NULL)
#endif
@@ -1357,9 +1370,10 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
return (1);
}
-#if defined(_WIN32_WCE)
+#ifdef _WIN32_WCE
MultiByteToWideChar(CP_ACP, 0, outname, -1, path, MAX_PATH);
- if ((fpout = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE)
+ if ((fpout = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING,
+ 0, NULL)) == INVALID_HANDLE_VALUE)
#else
if ((fpout = fopen(outname, "rb")) == NULL)
#endif
@@ -1527,27 +1541,27 @@ main(int argc, char *argv[])
#endif
for (i=2; i<argc; ++i)
{
-#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
- int k;
-#endif
int kerror;
fprintf(STDERR, "\n Testing %s:", argv[i]);
kerror = test_one_file(argv[i], outname);
if (kerror == 0)
{
-#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
+#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
+ int k;
+#endif
+#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
fprintf(STDERR, "\n PASS (%lu zero samples)\n",
(unsigned long)zero_samples);
#else
fprintf(STDERR, " PASS\n");
#endif
-#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
+#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
for (k = 0; k<256; k++)
if (filters_used[k])
fprintf(STDERR, " Filter %d was used %lu times\n",
k, (unsigned long)filters_used[k]);
#endif
-#if defined(PNG_TIME_RFC1123_SUPPORTED)
+#ifdef PNG_TIME_RFC1123_SUPPORTED
if (tIME_chunk_present != 0)
fprintf(STDERR, " tIME = %s\n", tIME_string);
tIME_chunk_present = 0;
@@ -1607,23 +1621,22 @@ main(int argc, char *argv[])
{
if (verbose == 1 || i == 2)
{
-#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
+#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
int k;
#endif
-#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
+#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
fprintf(STDERR, "\n PASS (%lu zero samples)\n",
(unsigned long)zero_samples);
#else
fprintf(STDERR, " PASS\n");
#endif
-#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
+#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
for (k = 0; k<256; k++)
if (filters_used[k])
fprintf(STDERR, " Filter %d was used %lu times\n",
- k,
- (unsigned long)filters_used[k]);
+ k, (unsigned long)filters_used[k]);
#endif
-#if defined(PNG_TIME_RFC1123_SUPPORTED)
+#ifdef PNG_TIME_RFC1123_SUPPORTED
if (tIME_chunk_present != 0)
fprintf(STDERR, " tIME = %s\n", tIME_string);
#endif /* PNG_TIME_RFC1123_SUPPORTED */
@@ -1689,4 +1702,4 @@ main(int argc, char *argv[])
}
/* Generate a compiler error if there is an old png.h in the search path. */
-typedef version_1_2_38 your_png_h_is_not_version_1_2_38;
+typedef version_1_2_44 your_png_h_is_not_version_1_2_44;