| Index: third_party/libpng/pngmem.c
|
| ===================================================================
|
| --- third_party/libpng/pngmem.c (revision 18910)
|
| +++ third_party/libpng/pngmem.c (working copy)
|
| @@ -1,9 +1,9 @@
|
|
|
| /* pngmem.c - stub functions for memory allocation
|
| *
|
| - * Last changed in libpng 1.2.30 [August 15, 2008]
|
| + * Last changed in libpng 1.2.37 [June 4, 2009]
|
| * For conditions of distribution and use, see copyright notice in png.h
|
| - * Copyright (c) 1998-2008 Glenn Randers-Pehrson
|
| + * Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
| * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
| * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
| *
|
| @@ -20,7 +20,7 @@
|
|
|
| /* Borland DOS special memory handler */
|
| #if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
|
| -/* if you change this, be sure to change the one in png.h also */
|
| +/* If you change this, be sure to change the one in png.h also */
|
|
|
| /* Allocate memory for a png_struct. The malloc and memset can be replaced
|
| by a single call to calloc() if this is thought to improve performance. */
|
| @@ -40,11 +40,11 @@
|
| png_voidp struct_ptr;
|
|
|
| if (type == PNG_STRUCT_INFO)
|
| - size = png_sizeof(png_info);
|
| + size = png_sizeof(png_info);
|
| else if (type == PNG_STRUCT_PNG)
|
| - size = png_sizeof(png_struct);
|
| + size = png_sizeof(png_struct);
|
| else
|
| - return (png_get_copyright(NULL));
|
| + return (png_get_copyright(NULL));
|
|
|
| #ifdef PNG_USER_MEM_SUPPORTED
|
| if (malloc_fn != NULL)
|
| @@ -56,7 +56,7 @@
|
| }
|
| else
|
| #endif /* PNG_USER_MEM_SUPPORTED */
|
| - struct_ptr = (png_voidp)farmalloc(size);
|
| + struct_ptr = (png_voidp)farmalloc(size);
|
| if (struct_ptr != NULL)
|
| png_memset(struct_ptr, 0, size);
|
| return (struct_ptr);
|
| @@ -122,9 +122,9 @@
|
|
|
| #ifdef PNG_USER_MEM_SUPPORTED
|
| if (png_ptr->malloc_fn != NULL)
|
| - ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
|
| + ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
|
| else
|
| - ret = (png_malloc_default(png_ptr, size));
|
| + ret = (png_malloc_default(png_ptr, size));
|
| if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
| png_error(png_ptr, "Out of memory!");
|
| return (ret);
|
| @@ -149,12 +149,12 @@
|
| #endif
|
|
|
| if (size != (size_t)size)
|
| - ret = NULL;
|
| + ret = NULL;
|
| else if (size == (png_uint_32)65536L)
|
| {
|
| if (png_ptr->offset_table == NULL)
|
| {
|
| - /* try to see if we need to do any of this fancy stuff */
|
| + /* Try to see if we need to do any of this fancy stuff */
|
| ret = farmalloc(size);
|
| if (ret == NULL || ((png_size_t)ret & 0xffff))
|
| {
|
| @@ -269,10 +269,10 @@
|
| return (ret);
|
| }
|
|
|
| -/* 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. */
|
| -
|
| +/* 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)
|
| {
|
| @@ -285,7 +285,8 @@
|
| (*(png_ptr->free_fn))(png_ptr, ptr);
|
| return;
|
| }
|
| - else png_free_default(png_ptr, ptr);
|
| + else
|
| + png_free_default(png_ptr, ptr);
|
| }
|
|
|
| void PNGAPI
|
| @@ -293,7 +294,8 @@
|
| {
|
| #endif /* PNG_USER_MEM_SUPPORTED */
|
|
|
| - if (png_ptr == NULL || ptr == NULL) return;
|
| + if (png_ptr == NULL || ptr == NULL)
|
| + return;
|
|
|
| if (png_ptr->offset_table != NULL)
|
| {
|
| @@ -420,10 +422,11 @@
|
| }
|
|
|
| /* Allocate memory. For reasonable files, size should never exceed
|
| - 64K. However, zlib may allocate more then 64K if you don't tell
|
| - it not to. See zconf.h and png.h for more information. zlib does
|
| - need to allocate exactly 64K, so whatever you call here must
|
| - have the ability to do that. */
|
| + * 64K. However, zlib may allocate more then 64K if you don't tell
|
| + * it not to. See zconf.h and png.h for more information. zlib does
|
| + * need to allocate exactly 64K, so whatever you call here must
|
| + * have the ability to do that.
|
| + */
|
|
|
|
|
| png_voidp PNGAPI
|
| @@ -436,9 +439,9 @@
|
| return (NULL);
|
|
|
| if (png_ptr->malloc_fn != NULL)
|
| - ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
|
| + ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
|
| else
|
| - ret = (png_malloc_default(png_ptr, size));
|
| + ret = (png_malloc_default(png_ptr, size));
|
| if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
| png_error(png_ptr, "Out of Memory!");
|
| return (ret);
|
| @@ -465,23 +468,23 @@
|
| }
|
| #endif
|
|
|
| - /* Check for overflow */
|
| + /* Check for overflow */
|
| #if defined(__TURBOC__) && !defined(__FLAT__)
|
| - if (size != (unsigned long)size)
|
| - ret = NULL;
|
| - else
|
| - ret = farmalloc(size);
|
| + if (size != (unsigned long)size)
|
| + ret = NULL;
|
| + else
|
| + ret = farmalloc(size);
|
| #else
|
| # if defined(_MSC_VER) && defined(MAXSEG_64K)
|
| - if (size != (unsigned long)size)
|
| - ret = NULL;
|
| - else
|
| - ret = halloc(size, 1);
|
| + if (size != (unsigned long)size)
|
| + ret = NULL;
|
| + else
|
| + ret = halloc(size, 1);
|
| # else
|
| - if (size != (size_t)size)
|
| - ret = NULL;
|
| - else
|
| - ret = malloc((size_t)size);
|
| + if (size != (size_t)size)
|
| + ret = NULL;
|
| + else
|
| + ret = malloc((size_t)size);
|
| # endif
|
| #endif
|
|
|
| @@ -494,7 +497,8 @@
|
| }
|
|
|
| /* Free a pointer allocated by png_malloc(). If ptr is NULL, return
|
| - without taking any action. */
|
| + * without taking any action.
|
| + */
|
| void PNGAPI
|
| png_free(png_structp png_ptr, png_voidp ptr)
|
| {
|
| @@ -507,7 +511,8 @@
|
| (*(png_ptr->free_fn))(png_ptr, ptr);
|
| return;
|
| }
|
| - else png_free_default(png_ptr, ptr);
|
| + else
|
| + png_free_default(png_ptr, ptr);
|
| }
|
| void PNGAPI
|
| png_free_default(png_structp png_ptr, png_voidp ptr)
|
| @@ -543,7 +548,8 @@
|
| {
|
| png_voidp ptr;
|
| png_uint_32 save_flags;
|
| - if (png_ptr == NULL) return (NULL);
|
| + if (png_ptr == NULL)
|
| + return (NULL);
|
|
|
| save_flags = png_ptr->flags;
|
| png_ptr->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK;
|
| @@ -603,7 +609,8 @@
|
| png_voidp PNGAPI
|
| png_get_mem_ptr(png_structp png_ptr)
|
| {
|
| - if (png_ptr == NULL) return (NULL);
|
| + if (png_ptr == NULL)
|
| + return (NULL);
|
| return ((png_voidp)png_ptr->mem_ptr);
|
| }
|
| #endif /* PNG_USER_MEM_SUPPORTED */
|
|
|