mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Imported from libpng-1.4.0beta27.tar
This commit is contained in:
50
pngtest.c
50
pngtest.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngtest.c - a simple test program to test libpng
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [August 4, 2008]
|
||||
* Last changed in libpng 1.4.0 [August 5, 2008]
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@@ -658,7 +658,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
return (1);
|
||||
}
|
||||
|
||||
png_debug(0, "Allocating read and write structures\n");
|
||||
png_debug(0, "Allocating read and write structures");
|
||||
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
|
||||
read_ptr =
|
||||
png_create_read_struct_2(PNG_LIBPNG_VER_STRING, NULL,
|
||||
@@ -696,7 +696,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
pngtest_warning);
|
||||
#endif
|
||||
#endif
|
||||
png_debug(0, "Allocating read_info, write_info and end_info structures\n");
|
||||
png_debug(0, "Allocating read_info, write_info and end_info structures");
|
||||
read_info_ptr = png_create_info_struct(read_ptr);
|
||||
end_info_ptr = png_create_info_struct(read_ptr);
|
||||
#ifdef PNG_WRITE_SUPPORTED
|
||||
@@ -705,7 +705,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
#endif
|
||||
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
png_debug(0, "Setting jmpbuf for read struct\n");
|
||||
png_debug(0, "Setting jmpbuf for read struct");
|
||||
#ifdef USE_FAR_KEYWORD
|
||||
if (setjmp(jmpbuf))
|
||||
#else
|
||||
@@ -729,7 +729,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_SUPPORTED
|
||||
png_debug(0, "Setting jmpbuf for write struct\n");
|
||||
png_debug(0, "Setting jmpbuf for write struct");
|
||||
#ifdef USE_FAR_KEYWORD
|
||||
if (setjmp(jmpbuf))
|
||||
#else
|
||||
@@ -752,7 +752,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
png_debug(0, "Initializing input and output streams\n");
|
||||
png_debug(0, "Initializing input and output streams");
|
||||
#if !defined(PNG_NO_STDIO)
|
||||
png_init_io(read_ptr, fpin);
|
||||
# ifdef PNG_WRITE_SUPPORTED
|
||||
@@ -812,10 +812,10 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
NULL, 0);
|
||||
#endif
|
||||
|
||||
png_debug(0, "Reading info struct\n");
|
||||
png_debug(0, "Reading info struct");
|
||||
png_read_info(read_ptr, read_info_ptr);
|
||||
|
||||
png_debug(0, "Transferring info struct\n");
|
||||
png_debug(0, "Transferring info struct");
|
||||
{
|
||||
int interlace_type, compression_type, filter_type;
|
||||
|
||||
@@ -1015,7 +1015,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
|
||||
if (png_get_text(read_ptr, read_info_ptr, &text_ptr, &num_text) > 0)
|
||||
{
|
||||
png_debug1(0, "Handling %d iTXt/tEXt/zTXt chunks\n", num_text);
|
||||
png_debug1(0, "Handling %d iTXt/tEXt/zTXt chunks", num_text);
|
||||
png_set_text(write_ptr, write_info_ptr, text_ptr, num_text);
|
||||
}
|
||||
}
|
||||
@@ -1083,7 +1083,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_SUPPORTED
|
||||
png_debug(0, "\nWriting info struct\n");
|
||||
png_debug(0, "\nWriting info struct");
|
||||
|
||||
/* If we wanted, we could write info in two steps:
|
||||
png_write_info_before_PLTE(write_ptr, write_info_ptr);
|
||||
@@ -1129,9 +1129,9 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
png_debug(0, "\nAllocating row buffer...");
|
||||
row_buf = (png_bytep)png_malloc(read_ptr,
|
||||
png_get_rowbytes(read_ptr, read_info_ptr));
|
||||
png_debug1(0, "0x%08lx\n\n", (unsigned long)row_buf);
|
||||
png_debug1(0, "0x%08lx\n", (unsigned long)row_buf);
|
||||
#endif /* SINGLE_ROWBUF_ALLOC */
|
||||
png_debug(0, "Writing row data\n");
|
||||
png_debug(0, "Writing row data");
|
||||
|
||||
#if defined(PNG_READ_INTERLACING_SUPPORTED) || \
|
||||
defined(PNG_WRITE_INTERLACING_SUPPORTED)
|
||||
@@ -1150,14 +1150,14 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
#endif
|
||||
for (pass = 0; pass < num_pass; pass++)
|
||||
{
|
||||
png_debug1(0, "Writing row data for pass %d\n", pass);
|
||||
png_debug1(0, "Writing row data for pass %d", pass);
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
#ifndef SINGLE_ROWBUF_ALLOC
|
||||
png_debug2(0, "\nAllocating row buffer (pass %d, y = %ld)...", pass, y);
|
||||
row_buf = (png_bytep)png_malloc(read_ptr,
|
||||
png_get_rowbytes(read_ptr, read_info_ptr));
|
||||
png_debug2(0, "0x%08lx (%ld bytes)\n", (unsigned long)row_buf,
|
||||
png_debug2(0, "0x%08lx (%ld bytes)", (unsigned long)row_buf,
|
||||
png_get_rowbytes(read_ptr, read_info_ptr));
|
||||
#endif /* !SINGLE_ROWBUF_ALLOC */
|
||||
png_read_rows(read_ptr, (png_bytepp)&row_buf, NULL, 1);
|
||||
@@ -1177,7 +1177,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
#endif /* PNG_WRITE_SUPPORTED */
|
||||
|
||||
#ifndef SINGLE_ROWBUF_ALLOC
|
||||
png_debug2(0, "Freeing row buffer (pass %d, y = %ld)\n\n", pass, y);
|
||||
png_debug2(0, "Freeing row buffer (pass %d, y = %ld)\n", pass, y);
|
||||
png_free(read_ptr, row_buf);
|
||||
row_buf = NULL;
|
||||
#endif /* !SINGLE_ROWBUF_ALLOC */
|
||||
@@ -1191,7 +1191,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
png_free_data(write_ptr, write_info_ptr, PNG_FREE_UNKN, -1);
|
||||
#endif
|
||||
|
||||
png_debug(0, "Reading and writing end_info data\n");
|
||||
png_debug(0, "Reading and writing end_info data");
|
||||
|
||||
png_read_end(read_ptr, end_info_ptr);
|
||||
#if defined(PNG_TEXT_SUPPORTED)
|
||||
@@ -1201,7 +1201,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
|
||||
if (png_get_text(read_ptr, end_info_ptr, &text_ptr, &num_text) > 0)
|
||||
{
|
||||
png_debug1(0, "Handling %d iTXt/tEXt/zTXt chunks\n", num_text);
|
||||
png_debug1(0, "Handling %d iTXt/tEXt/zTXt chunks", num_text);
|
||||
png_set_text(write_ptr, write_end_info_ptr, text_ptr, num_text);
|
||||
}
|
||||
}
|
||||
@@ -1261,26 +1261,26 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
}
|
||||
#endif
|
||||
|
||||
png_debug(0, "Destroying data structs\n");
|
||||
png_debug(0, "Destroying data structs");
|
||||
#ifdef SINGLE_ROWBUF_ALLOC
|
||||
png_debug(1, "destroying row_buf for read_ptr\n");
|
||||
png_debug(1, "destroying row_buf for read_ptr");
|
||||
png_free(read_ptr, row_buf);
|
||||
row_buf = NULL;
|
||||
#endif /* SINGLE_ROWBUF_ALLOC */
|
||||
png_debug(1, "destroying read_ptr, read_info_ptr, end_info_ptr\n");
|
||||
png_debug(1, "destroying read_ptr, read_info_ptr, end_info_ptr");
|
||||
png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr);
|
||||
#ifdef PNG_WRITE_SUPPORTED
|
||||
png_debug(1, "destroying write_end_info_ptr\n");
|
||||
png_debug(1, "destroying write_end_info_ptr");
|
||||
png_destroy_info_struct(write_ptr, &write_end_info_ptr);
|
||||
png_debug(1, "destroying write_ptr, write_info_ptr\n");
|
||||
png_debug(1, "destroying write_ptr, write_info_ptr");
|
||||
png_destroy_write_struct(&write_ptr, &write_info_ptr);
|
||||
#endif
|
||||
png_debug(0, "Destruction complete.\n");
|
||||
png_debug(0, "Destruction complete.");
|
||||
|
||||
FCLOSE(fpin);
|
||||
FCLOSE(fpout);
|
||||
|
||||
png_debug(0, "Opening files for comparison\n");
|
||||
png_debug(0, "Opening files for comparison");
|
||||
if ((fpin = fopen(inname, "rb")) == NULL)
|
||||
{
|
||||
fprintf(STDERR, "Could not find file %s\n", inname);
|
||||
@@ -1613,4 +1613,4 @@ main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef version_1_4_0beta26 your_png_h_is_not_version_1_4_0beta26;
|
||||
typedef version_1_4_0beta27 your_png_h_is_not_version_1_4_0beta27;
|
||||
|
||||
Reference in New Issue
Block a user