diff options
author | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-18 18:43:47 +0000 |
---|---|---|
committer | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-18 18:43:47 +0000 |
commit | 7e1e1d207ef6e11fb5790b95c737c9b1f4ffdada (patch) | |
tree | 9f6784239ab8fae1ab8d6c26ae783c8c0976896e /third_party/libpng/pngmem.c | |
parent | f71a1883052a6d722c57b7f08b7770a9d6e0a7fa (diff) | |
download | chromium_src-7e1e1d207ef6e11fb5790b95c737c9b1f4ffdada.zip chromium_src-7e1e1d207ef6e11fb5790b95c737c9b1f4ffdada.tar.gz chromium_src-7e1e1d207ef6e11fb5790b95c737c9b1f4ffdada.tar.bz2 |
Update libpng to 1.2.33.
Review URL: http://codereview.chromium.org/15041
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7230 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/libpng/pngmem.c')
-rw-r--r-- | third_party/libpng/pngmem.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/third_party/libpng/pngmem.c b/third_party/libpng/pngmem.c index 13cc60c..e28476f 100644 --- a/third_party/libpng/pngmem.c +++ b/third_party/libpng/pngmem.c @@ -1,7 +1,7 @@ /* pngmem.c - stub functions for memory allocation * - * Last changed in libpng 1.2.27 [April 29, 2008] + * Last changed in libpng 1.2.30 [August 15, 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) @@ -16,7 +16,6 @@ #define PNG_INTERNAL #include "png.h" - #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) /* Borland DOS special memory handler */ @@ -48,7 +47,7 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr) return (png_get_copyright(NULL)); #ifdef PNG_USER_MEM_SUPPORTED - if(malloc_fn != NULL) + if (malloc_fn != NULL) { png_struct dummy_struct; png_structp png_ptr = &dummy_struct; @@ -80,7 +79,7 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn, if (struct_ptr != NULL) { #ifdef PNG_USER_MEM_SUPPORTED - if(free_fn != NULL) + if (free_fn != NULL) { png_struct dummy_struct; png_structp png_ptr = &dummy_struct; @@ -122,7 +121,7 @@ png_malloc(png_structp png_ptr, png_uint_32 size) return (NULL); #ifdef PNG_USER_MEM_SUPPORTED - if(png_ptr->malloc_fn != NULL) + if (png_ptr->malloc_fn != NULL) ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size)); else ret = (png_malloc_default(png_ptr, size)); @@ -171,7 +170,7 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size) ret = NULL; } - if(png_ptr->zlib_window_bits > 14) + if (png_ptr->zlib_window_bits > 14) num_blocks = (int)(1 << (png_ptr->zlib_window_bits - 14)); else num_blocks = 1; @@ -210,7 +209,7 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size) png_ptr->offset_table = table; png_ptr->offset_table_ptr = farmalloc(num_blocks * - png_sizeof (png_bytep)); + png_sizeof(png_bytep)); if (png_ptr->offset_table_ptr == NULL) { @@ -273,6 +272,7 @@ png_malloc_default(png_structp png_ptr, png_uint_32 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) { @@ -293,7 +293,7 @@ png_free_default(png_structp png_ptr, png_voidp ptr) { #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) { @@ -353,7 +353,7 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr) return (NULL); #ifdef PNG_USER_MEM_SUPPORTED - if(malloc_fn != NULL) + if (malloc_fn != NULL) { png_struct dummy_struct; png_structp png_ptr = &dummy_struct; @@ -369,7 +369,7 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr) struct_ptr = (png_voidp)farmalloc(size); #else # if defined(_MSC_VER) && defined(MAXSEG_64K) - struct_ptr = (png_voidp)halloc(size,1); + struct_ptr = (png_voidp)halloc(size, 1); # else struct_ptr = (png_voidp)malloc(size); # endif @@ -398,7 +398,7 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn, if (struct_ptr != NULL) { #ifdef PNG_USER_MEM_SUPPORTED - if(free_fn != NULL) + if (free_fn != NULL) { png_struct dummy_struct; png_structp png_ptr = &dummy_struct; @@ -434,7 +434,7 @@ png_malloc(png_structp png_ptr, png_uint_32 size) if (png_ptr == NULL || size == 0) return (NULL); - if(png_ptr->malloc_fn != NULL) + if (png_ptr->malloc_fn != NULL) ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size)); else ret = (png_malloc_default(png_ptr, size)); @@ -542,9 +542,9 @@ png_malloc_warn(png_structp png_ptr, png_uint_32 size) { 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; + 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; @@ -560,7 +560,7 @@ png_memcpy_check (png_structp png_ptr, png_voidp s1, png_voidp s2, size = (png_size_t)length; if ((png_uint_32)size != length) - png_error(png_ptr,"Overflow in png_memcpy_check."); + png_error(png_ptr, "Overflow in png_memcpy_check."); return(png_memcpy (s1, s2, size)); } @@ -573,7 +573,7 @@ png_memset_check (png_structp png_ptr, png_voidp s1, int value, size = (png_size_t)length; if ((png_uint_32)size != length) - png_error(png_ptr,"Overflow in png_memset_check."); + png_error(png_ptr, "Overflow in png_memset_check."); return (png_memset (s1, value, size)); @@ -587,10 +587,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; } } @@ -601,7 +602,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); + if (png_ptr == NULL) return (NULL); return ((png_voidp)png_ptr->mem_ptr); } #endif /* PNG_USER_MEM_SUPPORTED */ |