Imported from libpng-1.2.13rc2.tar

This commit is contained in:
Glenn Randers-Pehrson
2006-11-13 14:14:21 -06:00
parent 2e3980e1de
commit e88a5eca8b
55 changed files with 1136 additions and 134 deletions

View File

@@ -1,7 +1,7 @@
/* pngmem.c - stub functions for memory allocation
*
* Last changed in libpng 1.2.9 April 14, 2006
* Last changed in libpng 1.2.13 November 13, 2006
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -137,6 +137,9 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
png_voidp ret;
#endif /* PNG_USER_MEM_SUPPORTED */
if (png_ptr == NULL || size == 0)
return (NULL);
#ifdef PNG_MAX_MALLOC_64K
if (size > (png_uint_32)65536L)
{
@@ -290,6 +293,8 @@ png_free_default(png_structp png_ptr, png_voidp ptr)
{
#endif /* PNG_USER_MEM_SUPPORTED */
if(png_ptr == NULL) return;
if (png_ptr->offset_table != NULL)
{
int i;
@@ -536,6 +541,7 @@ png_voidp PNGAPI
png_malloc_warn(png_structp png_ptr, png_uint_32 size)
{
png_voidp ptr;
if(png_ptr == NULL) return (NULL);
png_uint_32 save_flags=png_ptr->flags;
png_ptr->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK;
@@ -580,9 +586,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;
}
}
/* This function returns a pointer to the mem_ptr associated with the user
@@ -592,6 +600,7 @@ png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
png_voidp PNGAPI
png_get_mem_ptr(png_structp png_ptr)
{
if(png_ptr == NULL) return (NULL);
return ((png_voidp)png_ptr->mem_ptr);
}
#endif /* PNG_USER_MEM_SUPPORTED */