1 | /* Copyright (C) 2001-2017 Artifex Software, Inc. |
2 | * All Rights Reserved. |
3 | * |
4 | * This software is provided AS-IS with no warranty, either express or |
5 | * implied. |
6 | * |
7 | * This software is distributed under license and may not be copied, |
8 | * modified or distributed except as expressly authorized under the terms |
9 | * of the license contained in the file LICENSE in this distribution. |
10 | * |
11 | * Refer to licensing information at http://www.artifex.com or contact |
12 | * Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael, |
13 | * CA 94903, U.S.A., +1(415)492-9861, for further information. |
14 | */ |
15 | |
16 | typedef JMETHOD(long, j_custmem_init_ptr, (j_common_ptr cinfo)); |
17 | typedef JMETHOD(void, j_custmem_term_ptr, (j_common_ptr cinfo)); |
18 | typedef JMETHOD(long, j_custmem_avail_ptr, (j_common_ptr cinfo)); |
19 | typedef JMETHOD(void *, j_custmem_get_small_ptr, (j_common_ptr cinfo, size_t size)); |
20 | typedef JMETHOD(void, j_custmem_free_small_ptr, (j_common_ptr cinfo, void *object, size_t size)); |
21 | typedef JMETHOD(void *, j_cust_mem_get_large_ptr, (j_common_ptr cinfo, size_t size)); |
22 | typedef JMETHOD(void, j_custmem_free_large_ptr, (j_common_ptr cinfo, void *object, size_t size)); |
23 | typedef JMETHOD(void, j_custmem_open_backing_store_ptr, (j_common_ptr cinfo, backing_store_ptr info, long total_bytes_needed)); |
24 | |
25 | typedef struct { |
26 | j_custmem_init_ptr j_mem_init; |
27 | j_custmem_term_ptr j_mem_term; |
28 | j_custmem_avail_ptr j_mem_avail; |
29 | j_custmem_get_small_ptr j_mem_get_small; |
30 | j_custmem_free_small_ptr j_mem_free_small; |
31 | j_cust_mem_get_large_ptr j_mem_get_large; |
32 | j_custmem_free_large_ptr j_mem_free_large; |
33 | j_custmem_open_backing_store_ptr j_mem_open_backing_store; |
34 | void *priv; |
35 | } jpeg_cust_mem_data; |
36 | |
37 | #define GET_CUST_MEM_DATA(c) ((jpeg_cust_mem_data *)c->client_data) |
38 | |
39 | GLOBAL(jpeg_cust_mem_data *) |
40 | jpeg_cust_mem_init(jpeg_cust_mem_data *custm, void *priv, |
41 | j_custmem_init_ptr init, |
42 | j_custmem_term_ptr term, |
43 | j_custmem_avail_ptr avail, |
44 | j_custmem_get_small_ptr get_small, |
45 | j_custmem_free_small_ptr free_small, |
46 | j_cust_mem_get_large_ptr get_large, |
47 | j_custmem_free_large_ptr free_large, |
48 | j_custmem_open_backing_store_ptr open_backing_store); |
49 | |