| OLD | NEW |
| 1 /* | 1 /* |
| 2 * jmemsys.h | 2 * jmemsys.h |
| 3 * | 3 * |
| 4 * Copyright (C) 1992-1997, Thomas G. Lane. | 4 * Copyright (C) 1992-1997, 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 include file defines the interface between the system-independent | 8 * This include file defines the interface between the system-independent |
| 9 * and system-dependent portions of the JPEG memory manager. No other | 9 * and system-dependent portions of the JPEG memory manager. No other |
| 10 * modules need include it. (The system-independent portion is jmemmgr.c; | 10 * modules need include it. (The system-independent portion is jmemmgr.c; |
| 11 * there are several different versions of the system-dependent portion.) | 11 * there are several different versions of the system-dependent portion.) |
| 12 * | 12 * |
| 13 * This file works as-is for the system-dependent memory managers supplied | 13 * This file works as-is for the system-dependent memory managers supplied |
| 14 * in the IJG distribution. You may need to modify it if you write a | 14 * in the IJG distribution. You may need to modify it if you write a |
| 15 * custom memory manager. If system-dependent changes are needed in | 15 * custom memory manager. |
| 16 * this file, the best method is to #ifdef them based on a configuration | |
| 17 * symbol supplied in jconfig.h, as we have done with USE_MSDOS_MEMMGR | |
| 18 * and USE_MAC_MEMMGR. | |
| 19 */ | 16 */ |
| 20 | 17 |
| 21 | 18 |
| 22 /* Short forms of external names for systems with brain-damaged linkers. */ | 19 /* Short forms of external names for systems with brain-damaged linkers. */ |
| 23 | 20 |
| 24 #ifdef NEED_SHORT_EXTERNAL_NAMES | 21 #ifdef NEED_SHORT_EXTERNAL_NAMES |
| 25 #define jpeg_get_small jGetSmall | 22 #define jpeg_get_small jGetSmall |
| 26 #define jpeg_free_small jFreeSmall | 23 #define jpeg_free_small jFreeSmall |
| 27 #define jpeg_get_large jGetLarge | 24 #define jpeg_get_large jGetLarge |
| 28 #define jpeg_free_large jFreeLarge | 25 #define jpeg_free_large jFreeLarge |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 105 |
| 109 /* | 106 /* |
| 110 * This structure holds whatever state is needed to access a single | 107 * This structure holds whatever state is needed to access a single |
| 111 * backing-store object. The read/write/close method pointers are called | 108 * backing-store object. The read/write/close method pointers are called |
| 112 * by jmemmgr.c to manipulate the backing-store object; all other fields | 109 * by jmemmgr.c to manipulate the backing-store object; all other fields |
| 113 * are private to the system-dependent backing store routines. | 110 * are private to the system-dependent backing store routines. |
| 114 */ | 111 */ |
| 115 | 112 |
| 116 #define TEMP_NAME_LENGTH 64 /* max length of a temporary file's name */ | 113 #define TEMP_NAME_LENGTH 64 /* max length of a temporary file's name */ |
| 117 | 114 |
| 118 | |
| 119 #ifdef USE_MSDOS_MEMMGR /* DOS-specific junk */ | |
| 120 | |
| 121 typedef unsigned short XMSH; /* type of extended-memory handles */ | |
| 122 typedef unsigned short EMSH; /* type of expanded-memory handles */ | |
| 123 | |
| 124 typedef union { | |
| 125 short file_handle; /* DOS file handle if it's a temp file */ | |
| 126 XMSH xms_handle; /* handle if it's a chunk of XMS */ | |
| 127 EMSH ems_handle; /* handle if it's a chunk of EMS */ | |
| 128 } handle_union; | |
| 129 | |
| 130 #endif /* USE_MSDOS_MEMMGR */ | |
| 131 | |
| 132 #ifdef USE_MAC_MEMMGR /* Mac-specific junk */ | |
| 133 #include <Files.h> | |
| 134 #endif /* USE_MAC_MEMMGR */ | |
| 135 | |
| 136 | |
| 137 typedef struct backing_store_struct * backing_store_ptr; | 115 typedef struct backing_store_struct * backing_store_ptr; |
| 138 | 116 |
| 139 typedef struct backing_store_struct { | 117 typedef struct backing_store_struct { |
| 140 /* Methods for reading/writing/closing this backing-store object */ | 118 /* Methods for reading/writing/closing this backing-store object */ |
| 141 JMETHOD(void, read_backing_store, (j_common_ptr cinfo, | 119 JMETHOD(void, read_backing_store, (j_common_ptr cinfo, |
| 142 backing_store_ptr info, | 120 backing_store_ptr info, |
| 143 void FAR * buffer_address, | 121 void FAR * buffer_address, |
| 144 long file_offset, long byte_count)); | 122 long file_offset, long byte_count)); |
| 145 JMETHOD(void, write_backing_store, (j_common_ptr cinfo, | 123 JMETHOD(void, write_backing_store, (j_common_ptr cinfo, |
| 146 backing_store_ptr info, | 124 backing_store_ptr info, |
| 147 void FAR * buffer_address, | 125 void FAR * buffer_address, |
| 148 long file_offset, long byte_count)); | 126 long file_offset, long byte_count)); |
| 149 JMETHOD(void, close_backing_store, (j_common_ptr cinfo, | 127 JMETHOD(void, close_backing_store, (j_common_ptr cinfo, |
| 150 backing_store_ptr info)); | 128 backing_store_ptr info)); |
| 151 | 129 |
| 152 /* Private fields for system-dependent backing-store management */ | 130 /* Private fields for system-dependent backing-store management */ |
| 153 #ifdef USE_MSDOS_MEMMGR | |
| 154 /* For the MS-DOS manager (jmemdos.c), we need: */ | |
| 155 handle_union handle; /* reference to backing-store storage object */ | |
| 156 char temp_name[TEMP_NAME_LENGTH]; /* name if it's a file */ | |
| 157 #else | |
| 158 #ifdef USE_MAC_MEMMGR | |
| 159 /* For the Mac manager (jmemmac.c), we need: */ | |
| 160 short temp_file; /* file reference number to temp file */ | |
| 161 FSSpec tempSpec; /* the FSSpec for the temp file */ | |
| 162 char temp_name[TEMP_NAME_LENGTH]; /* name if it's a file */ | |
| 163 #else | |
| 164 /* For a typical implementation with temp files, we need: */ | 131 /* For a typical implementation with temp files, we need: */ |
| 165 #ifndef _FPDFAPI_MINI_ | |
| 166 FXSYS_FILE * temp_file; /* stdio reference to temp file */ | 132 FXSYS_FILE * temp_file; /* stdio reference to temp file */ |
| 167 char temp_name[TEMP_NAME_LENGTH]; /* name of temp file */ | 133 char temp_name[TEMP_NAME_LENGTH]; /* name of temp file */ |
| 168 #endif | |
| 169 #endif | |
| 170 #endif | |
| 171 } backing_store_info; | 134 } backing_store_info; |
| 172 | 135 |
| 173 | 136 |
| 174 /* | 137 /* |
| 175 * Initial opening of a backing-store object. This must fill in the | 138 * Initial opening of a backing-store object. This must fill in the |
| 176 * read/write/close pointers in the object. The read/write routines | 139 * read/write/close pointers in the object. The read/write routines |
| 177 * may take an error exit if the specified maximum file size is exceeded. | 140 * may take an error exit if the specified maximum file size is exceeded. |
| 178 * (If jpeg_mem_available always returns a large value, this routine can | 141 * (If jpeg_mem_available always returns a large value, this routine can |
| 179 * just take an error exit.) | 142 * just take an error exit.) |
| 180 */ | 143 */ |
| (...skipping 10 matching lines...) Expand all Loading... |
| 191 * manager pointer). It should return a suitable default value for | 154 * manager pointer). It should return a suitable default value for |
| 192 * max_memory_to_use; this may subsequently be overridden by the surrounding | 155 * max_memory_to_use; this may subsequently be overridden by the surrounding |
| 193 * application. (Note that max_memory_to_use is only important if | 156 * application. (Note that max_memory_to_use is only important if |
| 194 * jpeg_mem_available chooses to consult it ... no one else will.) | 157 * jpeg_mem_available chooses to consult it ... no one else will.) |
| 195 * jpeg_mem_term may assume that all requested memory has been freed and that | 158 * jpeg_mem_term may assume that all requested memory has been freed and that |
| 196 * all opened backing-store objects have been closed. | 159 * all opened backing-store objects have been closed. |
| 197 */ | 160 */ |
| 198 | 161 |
| 199 EXTERN(long) jpeg_mem_init JPP((j_common_ptr cinfo)); | 162 EXTERN(long) jpeg_mem_init JPP((j_common_ptr cinfo)); |
| 200 EXTERN(void) jpeg_mem_term JPP((j_common_ptr cinfo)); | 163 EXTERN(void) jpeg_mem_term JPP((j_common_ptr cinfo)); |
| OLD | NEW |