Imported from libpng-1.2.6rc2.tar

This commit is contained in:
Glenn Randers-Pehrson
2004-08-07 21:42:49 -05:00
parent 272489dc69
commit dff799ef89
56 changed files with 204 additions and 150 deletions

View File

@@ -1,7 +1,7 @@
/* pngtest.c - a simple test program to test libpng
*
* libpng 1.2.6rc1 - August 4, 2004
* libpng 1.2.6rc2 - August 8, 2004
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2004 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -510,7 +510,9 @@ png_debug_malloc(png_structp png_ptr, png_uint_32 size)
/* This calls the library allocator twice, once to get the requested
buffer and once to get a new free list entry. */
{
memory_infop pinfo = (memory_infop)png_malloc_default(png_ptr,
/* Disable malloc_fn and free_fn */
png_set_mem_fn(png_ptr, NULL, NULL, NULL);
memory_infop pinfo = (memory_infop)png_malloc(png_ptr,
(png_uint_32)png_sizeof (*pinfo));
pinfo->size = size;
current_allocation += size;
@@ -518,12 +520,16 @@ png_debug_malloc(png_structp png_ptr, png_uint_32 size)
num_allocations ++;
if (current_allocation > maximum_allocation)
maximum_allocation = current_allocation;
pinfo->pointer = (png_voidp)png_malloc_default(png_ptr, size);
pinfo->pointer = (png_voidp)png_malloc(png_ptr, size);
/* Restore malloc_fn and free_fn */
png_set_mem_fn(png_ptr, png_voidp_NULL, (png_malloc_ptr)png_debug_malloc,
(png_free_ptr)png_debug_free);
if (size != 0 && pinfo->pointer == NULL)
{
current_allocation -= size;
total_allocation -= size;
png_error(png_ptr,"out of memory in pngtest->png_malloc_default.\n");
png_error(png_ptr,
"out of memory in pngtest->png_debug_malloc.");
}
pinfo->next = pinformation;
pinformation = pinfo;
@@ -777,14 +783,18 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_set_write_user_transform_fn(write_ptr, count_zero_samples);
#endif
#define HANDLE_CHUNK_IF_SAFE 2
#define HANDLE_CHUNK_ALWAYS 3
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
png_set_keep_unknown_chunks(read_ptr, HANDLE_CHUNK_ALWAYS,
# 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)
png_set_keep_unknown_chunks(write_ptr, HANDLE_CHUNK_IF_SAFE,
# ifndef PNG_HANDLE_CHUNK_IF_SAFE
# define PNG_HANDLE_CHUNK_IF_SAFE 2
# endif
png_set_keep_unknown_chunks(write_ptr, PNG_HANDLE_CHUNK_IF_SAFE,
png_bytep_NULL, 0);
#endif
@@ -1544,4 +1554,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_6rc1 your_png_h_is_not_version_1_2_6rc1;
typedef version_1_2_6rc2 your_png_h_is_not_version_1_2_6rc2;