OLD | NEW |
1 /* pngmem.c - stub functions for memory allocation | 1 /* pngmem.c - stub functions for memory allocation |
2 * | 2 * |
3 * Last changed in libpng 1.6.0 [February 14, 2013] | 3 * Last changed in libpng 1.6.0 [February 14, 2013] |
4 * Copyright (c) 1998-2013 Glenn Randers-Pehrson | 4 * Copyright (c) 1998-2013 Glenn Randers-Pehrson |
5 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) | 5 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) |
6 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) | 6 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) |
7 * | 7 * |
8 * This code is released under the libpng license. | 8 * This code is released under the libpng license. |
9 * For conditions of distribution and use, see the disclaimer | 9 * For conditions of distribution and use, see the disclaimer |
10 * and license in png.h | 10 * and license in png.h |
11 * | 11 * |
12 * This file provides a location for all memory allocation. Users who | 12 * This file provides a location for all memory allocation. Users who |
13 * need special memory handling are expected to supply replacement | 13 * need special memory handling are expected to supply replacement |
14 * functions for png_malloc() and png_free(), and to use | 14 * functions for png_malloc() and png_free(), and to use |
15 * png_create_read_struct_2() and png_create_write_struct_2() to | 15 * png_create_read_struct_2() and png_create_write_struct_2() to |
16 * identify the replacement functions. | 16 * identify the replacement functions. |
17 */ | 17 */ |
18 | 18 |
19 #include "pngpriv.h" | 19 #include "pngpriv.h" |
20 | 20 |
21 #if defined(_FX_MANAGED_CODE_) && defined(__cplusplus) | |
22 extern "C" { | |
23 #endif | |
24 | |
25 void* FXMEM_DefaultAlloc(int byte_size, int); | 21 void* FXMEM_DefaultAlloc(int byte_size, int); |
26 void FXMEM_DefaultFree(void* pointer, int); | 22 void FXMEM_DefaultFree(void* pointer, int); |
27 | 23 |
28 #if defined(_FX_MANAGED_CODE_) && defined(__cplusplus) | |
29 } | |
30 #endif | |
31 | |
32 #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) | 24 #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) |
33 /* Free a png_struct */ | 25 /* Free a png_struct */ |
34 void /* PRIVATE */ | 26 void /* PRIVATE */ |
35 png_destroy_png_struct(png_structrp png_ptr) | 27 png_destroy_png_struct(png_structrp png_ptr) |
36 { | 28 { |
37 if (png_ptr != NULL) | 29 if (png_ptr != NULL) |
38 { | 30 { |
39 /* png_free might call png_error and may certainly call | 31 /* png_free might call png_error and may certainly call |
40 * png_get_mem_ptr, so fake a temporary png_struct to support this. | 32 * png_get_mem_ptr, so fake a temporary png_struct to support this. |
41 */ | 33 */ |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 png_voidp PNGAPI | 272 png_voidp PNGAPI |
281 png_get_mem_ptr(png_const_structrp png_ptr) | 273 png_get_mem_ptr(png_const_structrp png_ptr) |
282 { | 274 { |
283 if (png_ptr == NULL) | 275 if (png_ptr == NULL) |
284 return NULL; | 276 return NULL; |
285 | 277 |
286 return png_ptr->mem_ptr; | 278 return png_ptr->mem_ptr; |
287 } | 279 } |
288 #endif /* PNG_USER_MEM_SUPPORTED */ | 280 #endif /* PNG_USER_MEM_SUPPORTED */ |
289 #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ | 281 #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ |
OLD | NEW |