Imported from libpng-1.4.0beta24.tar

This commit is contained in:
Glenn Randers-Pehrson
2008-07-25 08:51:18 -05:00
parent 72b633026b
commit 895a9c97e2
60 changed files with 262 additions and 219 deletions

View File

@@ -1,7 +1,7 @@
/* pngmem.c - stub functions for memory allocation
*
* Last changed in libpng 1.4.0 [July 22, 2008]
* Last changed in libpng 1.4.0 [July 25, 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)
@@ -272,6 +272,7 @@ png_malloc_default(png_structp png_ptr, png_alloc_size_t size)
/* free a pointer allocated by png_malloc(). In the default
configuration, png_ptr is not used, but is passed in case it
is needed. If ptr is NULL, return without taking any action. */
void PNGAPI
png_free(png_structp png_ptr, png_voidp ptr)
{
@@ -540,7 +541,7 @@ png_malloc_warn(png_structp png_ptr, png_alloc_size_t size)
png_uint_32 save_flags;
if (png_ptr == NULL) return (NULL);
save_flags=png_ptr->flags;
save_flags = png_ptr->flags;
png_ptr->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK;
ptr = (png_voidp)png_malloc((png_structp)png_ptr, size);
png_ptr->flags=save_flags;
@@ -556,10 +557,11 @@ void PNGAPI
png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
malloc_fn, png_free_ptr free_fn)
{
if (png_ptr != NULL) {
png_ptr->mem_ptr = mem_ptr;
png_ptr->malloc_fn = malloc_fn;
png_ptr->free_fn = free_fn;
if (png_ptr != NULL)
{
png_ptr->mem_ptr = mem_ptr;
png_ptr->malloc_fn = malloc_fn;
png_ptr->free_fn = free_fn;
}
}