Imported from libpng-1.2.0beta2.tar

This commit is contained in:
Glenn Randers-Pehrson
2001-05-07 14:52:45 -05:00
parent 1fd5fb33c2
commit 3097f618f2
53 changed files with 413 additions and 283 deletions

View File

@@ -1,7 +1,7 @@
/* pngmem.c - stub functions for memory allocation
*
* libpng 1.2.0beta1 - May 6, 2001
* libpng 1.2.0beta2 - May 7, 2001
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -119,7 +119,12 @@ png_malloc(png_structp png_ptr, png_uint_32 size)
#ifdef PNG_USER_MEM_SUPPORTED
if(png_ptr->malloc_fn != NULL)
return ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, size));
{
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, size));
if (ret == NULL)
png_error(png_ptr, "Out of memory!");
return (ret);
}
else
return png_malloc_default(png_ptr, size);
}
@@ -373,15 +378,18 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn)
png_voidp PNGAPI
png_malloc(png_structp png_ptr, png_uint_32 size)
{
#ifndef PNG_USER_MEM_SUPPORTED
png_voidp ret;
#endif
if (png_ptr == NULL || size == 0)
return ((png_voidp)NULL);
#ifdef PNG_USER_MEM_SUPPORTED
if(png_ptr->malloc_fn != NULL)
return ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, size));
{
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, size));
if (ret == NULL)
png_error(png_ptr, "Out of Memory!");
return (ret);
}
else
return (png_malloc_default(png_ptr, size));
}
@@ -407,9 +415,7 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
#endif
if (ret == NULL)
{
png_error(png_ptr, "Out of Memory");
}
return (ret);
}