OLD | NEW |
1 /* | 1 /* |
2 * jmemnobs.c | 2 * jmemnobs.c |
3 * | 3 * |
4 * Copyright (C) 1992-1996, Thomas G. Lane. | 4 * Copyright (C) 1992-1996, Thomas G. Lane. |
5 * This file is part of the Independent JPEG Group's software. | 5 * This file is part of the Independent JPEG Group's software. |
6 * For conditions of distribution and use, see the accompanying README file. | 6 * For conditions of distribution and use, see the accompanying README file. |
7 * | 7 * |
8 * This file provides a really simple implementation of the system- | 8 * This file provides a really simple implementation of the system- |
9 * dependent portion of the JPEG memory manager. This implementation | 9 * dependent portion of the JPEG memory manager. This implementation |
10 * assumes that no backing-store files are needed: all required space | 10 * assumes that no backing-store files are needed: all required space |
11 * can be obtained from malloc(). | 11 * can be obtained from malloc(). |
12 * This is very portable in the sense that it'll compile on almost anything, | 12 * This is very portable in the sense that it'll compile on almost anything, |
13 * but you'd better have lots of main memory (or virtual memory) if you want | 13 * but you'd better have lots of main memory (or virtual memory) if you want |
14 * to process big images. | 14 * to process big images. |
15 * Note that the max_memory_to_use option is ignored by this implementation. | 15 * Note that the max_memory_to_use option is ignored by this implementation. |
16 */ | 16 */ |
17 | 17 |
18 #define JPEG_INTERNALS | 18 #define JPEG_INTERNALS |
19 #include "jinclude.h" | 19 #include "jinclude.h" |
20 #include "jpeglib.h" | 20 #include "jpeglib.h" |
21 #include "jmemsys.h" /* import the system-dependent declarations */ | 21 #include "jmemsys.h" /* import the system-dependent declarations */ |
22 | 22 |
23 #ifndef HAVE_STDLIB_H /* <stdlib.h> should declare malloc(),free() */ | 23 #ifndef HAVE_STDLIB_H /* <stdlib.h> should declare malloc(),free() */ |
24 extern void * malloc JPP((size_t size)); | 24 extern void * malloc JPP((size_t size)); |
25 extern void free JPP((void *ptr)); | 25 extern void free JPP((void *ptr)); |
26 #endif | 26 #endif |
27 | 27 |
28 #if defined(_FX_MANAGED_CODE_) && defined(__cplusplus) | |
29 extern "C" { | |
30 #endif | |
31 | |
32 void* FXMEM_DefaultAlloc(int byte_size, int); | 28 void* FXMEM_DefaultAlloc(int byte_size, int); |
33 void FXMEM_DefaultFree(void* pointer, int); | 29 void FXMEM_DefaultFree(void* pointer, int); |
34 | 30 |
35 #if defined(_FX_MANAGED_CODE_) && defined(__cplusplus) | |
36 } | |
37 #endif | |
38 | |
39 /* | 31 /* |
40 * Memory allocation and freeing are controlled by the regular library | 32 * Memory allocation and freeing are controlled by the regular library |
41 * routines malloc() and free(). | 33 * routines malloc() and free(). |
42 */ | 34 */ |
43 | 35 |
44 GLOBAL(void *) | 36 GLOBAL(void *) |
45 jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject) | 37 jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject) |
46 { | 38 { |
47 // return (void *) malloc(sizeofobject); | 39 // return (void *) malloc(sizeofobject); |
48 return FXMEM_DefaultAlloc(sizeofobject, 0); | 40 return FXMEM_DefaultAlloc(sizeofobject, 0); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 jpeg_mem_init (j_common_ptr cinfo) | 106 jpeg_mem_init (j_common_ptr cinfo) |
115 { | 107 { |
116 return 0; /* just set max_memory_to_use to 0 */ | 108 return 0; /* just set max_memory_to_use to 0 */ |
117 } | 109 } |
118 | 110 |
119 GLOBAL(void) | 111 GLOBAL(void) |
120 jpeg_mem_term (j_common_ptr cinfo) | 112 jpeg_mem_term (j_common_ptr cinfo) |
121 { | 113 { |
122 /* no work */ | 114 /* no work */ |
123 } | 115 } |
OLD | NEW |