diff options
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jmemmac.c')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jmemmac.c | 578 |
1 files changed, 289 insertions, 289 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jmemmac.c b/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jmemmac.c index a6f043e..106f9be 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jmemmac.c +++ b/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jmemmac.c | |||
@@ -1,289 +1,289 @@ | |||
1 | /* | 1 | /* |
2 | * jmemmac.c | 2 | * jmemmac.c |
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 | * jmemmac.c provides an Apple Macintosh implementation of the system- | 8 | * jmemmac.c provides an Apple Macintosh implementation of the system- |
9 | * dependent portion of the JPEG memory manager. | 9 | * dependent portion of the JPEG memory manager. |
10 | * | 10 | * |
11 | * If you use jmemmac.c, then you must define USE_MAC_MEMMGR in the | 11 | * If you use jmemmac.c, then you must define USE_MAC_MEMMGR in the |
12 | * JPEG_INTERNALS part of jconfig.h. | 12 | * JPEG_INTERNALS part of jconfig.h. |
13 | * | 13 | * |
14 | * jmemmac.c uses the Macintosh toolbox routines NewPtr and DisposePtr | 14 | * jmemmac.c uses the Macintosh toolbox routines NewPtr and DisposePtr |
15 | * instead of malloc and free. It accurately determines the amount of | 15 | * instead of malloc and free. It accurately determines the amount of |
16 | * memory available by using CompactMem. Notice that if left to its | 16 | * memory available by using CompactMem. Notice that if left to its |
17 | * own devices, this code can chew up all available space in the | 17 | * own devices, this code can chew up all available space in the |
18 | * application's zone, with the exception of the rather small "slop" | 18 | * application's zone, with the exception of the rather small "slop" |
19 | * factor computed in jpeg_mem_available(). The application can ensure | 19 | * factor computed in jpeg_mem_available(). The application can ensure |
20 | * that more space is left over by reducing max_memory_to_use. | 20 | * that more space is left over by reducing max_memory_to_use. |
21 | * | 21 | * |
22 | * Large images are swapped to disk using temporary files and System 7.0+'s | 22 | * Large images are swapped to disk using temporary files and System 7.0+'s |
23 | * temporary folder functionality. | 23 | * temporary folder functionality. |
24 | * | 24 | * |
25 | * Note that jmemmac.c depends on two features of MacOS that were first | 25 | * Note that jmemmac.c depends on two features of MacOS that were first |
26 | * introduced in System 7: FindFolder and the FSSpec-based calls. | 26 | * introduced in System 7: FindFolder and the FSSpec-based calls. |
27 | * If your application uses jmemmac.c and is run under System 6 or earlier, | 27 | * If your application uses jmemmac.c and is run under System 6 or earlier, |
28 | * and the jpeg library decides it needs a temporary file, it will abort, | 28 | * and the jpeg library decides it needs a temporary file, it will abort, |
29 | * printing error messages about requiring System 7. (If no temporary files | 29 | * printing error messages about requiring System 7. (If no temporary files |
30 | * are created, it will run fine.) | 30 | * are created, it will run fine.) |
31 | * | 31 | * |
32 | * If you want to use jmemmac.c in an application that might be used with | 32 | * If you want to use jmemmac.c in an application that might be used with |
33 | * System 6 or earlier, then you should remove dependencies on FindFolder | 33 | * System 6 or earlier, then you should remove dependencies on FindFolder |
34 | * and the FSSpec calls. You will need to replace FindFolder with some | 34 | * and the FSSpec calls. You will need to replace FindFolder with some |
35 | * other mechanism for finding a place to put temporary files, and you | 35 | * other mechanism for finding a place to put temporary files, and you |
36 | * should replace the FSSpec calls with their HFS equivalents: | 36 | * should replace the FSSpec calls with their HFS equivalents: |
37 | * | 37 | * |
38 | * FSpDelete -> HDelete | 38 | * FSpDelete -> HDelete |
39 | * FSpGetFInfo -> HGetFInfo | 39 | * FSpGetFInfo -> HGetFInfo |
40 | * FSpCreate -> HCreate | 40 | * FSpCreate -> HCreate |
41 | * FSpOpenDF -> HOpen *** Note: not HOpenDF *** | 41 | * FSpOpenDF -> HOpen *** Note: not HOpenDF *** |
42 | * FSMakeFSSpec -> (fill in spec by hand.) | 42 | * FSMakeFSSpec -> (fill in spec by hand.) |
43 | * | 43 | * |
44 | * (Use HOpen instead of HOpenDF. HOpen is just a glue-interface to PBHOpen, | 44 | * (Use HOpen instead of HOpenDF. HOpen is just a glue-interface to PBHOpen, |
45 | * which is on all HFS macs. HOpenDF is a System 7 addition which avoids the | 45 | * which is on all HFS macs. HOpenDF is a System 7 addition which avoids the |
46 | * ages-old problem of names starting with a period.) | 46 | * ages-old problem of names starting with a period.) |
47 | * | 47 | * |
48 | * Contributed by Sam Bushell (jsam@iagu.on.net) and | 48 | * Contributed by Sam Bushell (jsam@iagu.on.net) and |
49 | * Dan Gildor (gyld@in-touch.com). | 49 | * Dan Gildor (gyld@in-touch.com). |
50 | */ | 50 | */ |
51 | 51 | ||
52 | #define JPEG_INTERNALS | 52 | #define JPEG_INTERNALS |
53 | #include "jinclude.h" | 53 | #include "jinclude.h" |
54 | #include "jpeglib.h" | 54 | #include "jpeglib.h" |
55 | #include "jmemsys.h" /* import the system-dependent declarations */ | 55 | #include "jmemsys.h" /* import the system-dependent declarations */ |
56 | 56 | ||
57 | #ifndef USE_MAC_MEMMGR /* make sure user got configuration right */ | 57 | #ifndef USE_MAC_MEMMGR /* make sure user got configuration right */ |
58 | You forgot to define USE_MAC_MEMMGR in jconfig.h. /* deliberate syntax error */ | 58 | You forgot to define USE_MAC_MEMMGR in jconfig.h. /* deliberate syntax error */ |
59 | #endif | 59 | #endif |
60 | 60 | ||
61 | #include <Memory.h> /* we use the MacOS memory manager */ | 61 | #include <Memory.h> /* we use the MacOS memory manager */ |
62 | #include <Files.h> /* we use the MacOS File stuff */ | 62 | #include <Files.h> /* we use the MacOS File stuff */ |
63 | #include <Folders.h> /* we use the MacOS HFS stuff */ | 63 | #include <Folders.h> /* we use the MacOS HFS stuff */ |
64 | #include <Script.h> /* for smSystemScript */ | 64 | #include <Script.h> /* for smSystemScript */ |
65 | #include <Gestalt.h> /* we use Gestalt to test for specific functionality */ | 65 | #include <Gestalt.h> /* we use Gestalt to test for specific functionality */ |
66 | 66 | ||
67 | #ifndef TEMP_FILE_NAME /* can override from jconfig.h or Makefile */ | 67 | #ifndef TEMP_FILE_NAME /* can override from jconfig.h or Makefile */ |
68 | #define TEMP_FILE_NAME "JPG%03d.TMP" | 68 | #define TEMP_FILE_NAME "JPG%03d.TMP" |
69 | #endif | 69 | #endif |
70 | 70 | ||
71 | static int next_file_num; /* to distinguish among several temp files */ | 71 | static int next_file_num; /* to distinguish among several temp files */ |
72 | 72 | ||
73 | 73 | ||
74 | /* | 74 | /* |
75 | * Memory allocation and freeing are controlled by the MacOS library | 75 | * Memory allocation and freeing are controlled by the MacOS library |
76 | * routines NewPtr() and DisposePtr(), which allocate fixed-address | 76 | * routines NewPtr() and DisposePtr(), which allocate fixed-address |
77 | * storage. Unfortunately, the IJG library isn't smart enough to cope | 77 | * storage. Unfortunately, the IJG library isn't smart enough to cope |
78 | * with relocatable storage. | 78 | * with relocatable storage. |
79 | */ | 79 | */ |
80 | 80 | ||
81 | GLOBAL(void *) | 81 | GLOBAL(void *) |
82 | jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject) | 82 | jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject) |
83 | { | 83 | { |
84 | return (void *) NewPtr(sizeofobject); | 84 | return (void *) NewPtr(sizeofobject); |
85 | } | 85 | } |
86 | 86 | ||
87 | GLOBAL(void) | 87 | GLOBAL(void) |
88 | jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject) | 88 | jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject) |
89 | { | 89 | { |
90 | DisposePtr((Ptr) object); | 90 | DisposePtr((Ptr) object); |
91 | } | 91 | } |
92 | 92 | ||
93 | 93 | ||
94 | /* | 94 | /* |
95 | * "Large" objects are treated the same as "small" ones. | 95 | * "Large" objects are treated the same as "small" ones. |
96 | * NB: we include FAR keywords in the routine declarations simply for | 96 | * NB: we include FAR keywords in the routine declarations simply for |
97 | * consistency with the rest of the IJG code; FAR should expand to empty | 97 | * consistency with the rest of the IJG code; FAR should expand to empty |
98 | * on rational architectures like the Mac. | 98 | * on rational architectures like the Mac. |
99 | */ | 99 | */ |
100 | 100 | ||
101 | GLOBAL(void FAR *) | 101 | GLOBAL(void FAR *) |
102 | jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject) | 102 | jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject) |
103 | { | 103 | { |
104 | return (void FAR *) NewPtr(sizeofobject); | 104 | return (void FAR *) NewPtr(sizeofobject); |
105 | } | 105 | } |
106 | 106 | ||
107 | GLOBAL(void) | 107 | GLOBAL(void) |
108 | jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) | 108 | jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) |
109 | { | 109 | { |
110 | DisposePtr((Ptr) object); | 110 | DisposePtr((Ptr) object); |
111 | } | 111 | } |
112 | 112 | ||
113 | 113 | ||
114 | /* | 114 | /* |
115 | * This routine computes the total memory space available for allocation. | 115 | * This routine computes the total memory space available for allocation. |
116 | */ | 116 | */ |
117 | 117 | ||
118 | GLOBAL(long) | 118 | GLOBAL(long) |
119 | jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, | 119 | jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, |
120 | long max_bytes_needed, long already_allocated) | 120 | long max_bytes_needed, long already_allocated) |
121 | { | 121 | { |
122 | long limit = cinfo->mem->max_memory_to_use - already_allocated; | 122 | long limit = cinfo->mem->max_memory_to_use - already_allocated; |
123 | long slop, mem; | 123 | long slop, mem; |
124 | 124 | ||
125 | /* Don't ask for more than what application has told us we may use */ | 125 | /* Don't ask for more than what application has told us we may use */ |
126 | if (max_bytes_needed > limit && limit > 0) | 126 | if (max_bytes_needed > limit && limit > 0) |
127 | max_bytes_needed = limit; | 127 | max_bytes_needed = limit; |
128 | /* Find whether there's a big enough free block in the heap. | 128 | /* Find whether there's a big enough free block in the heap. |
129 | * CompactMem tries to create a contiguous block of the requested size, | 129 | * CompactMem tries to create a contiguous block of the requested size, |
130 | * and then returns the size of the largest free block (which could be | 130 | * and then returns the size of the largest free block (which could be |
131 | * much more or much less than we asked for). | 131 | * much more or much less than we asked for). |
132 | * We add some slop to ensure we don't use up all available memory. | 132 | * We add some slop to ensure we don't use up all available memory. |
133 | */ | 133 | */ |
134 | slop = max_bytes_needed / 16 + 32768L; | 134 | slop = max_bytes_needed / 16 + 32768L; |
135 | mem = CompactMem(max_bytes_needed + slop) - slop; | 135 | mem = CompactMem(max_bytes_needed + slop) - slop; |
136 | if (mem < 0) | 136 | if (mem < 0) |
137 | mem = 0; /* sigh, couldn't even get the slop */ | 137 | mem = 0; /* sigh, couldn't even get the slop */ |
138 | /* Don't take more than the application says we can have */ | 138 | /* Don't take more than the application says we can have */ |
139 | if (mem > limit && limit > 0) | 139 | if (mem > limit && limit > 0) |
140 | mem = limit; | 140 | mem = limit; |
141 | return mem; | 141 | return mem; |
142 | } | 142 | } |
143 | 143 | ||
144 | 144 | ||
145 | /* | 145 | /* |
146 | * Backing store (temporary file) management. | 146 | * Backing store (temporary file) management. |
147 | * Backing store objects are only used when the value returned by | 147 | * Backing store objects are only used when the value returned by |
148 | * jpeg_mem_available is less than the total space needed. You can dispense | 148 | * jpeg_mem_available is less than the total space needed. You can dispense |
149 | * with these routines if you have plenty of virtual memory; see jmemnobs.c. | 149 | * with these routines if you have plenty of virtual memory; see jmemnobs.c. |
150 | */ | 150 | */ |
151 | 151 | ||
152 | 152 | ||
153 | METHODDEF(void) | 153 | METHODDEF(void) |
154 | read_backing_store (j_common_ptr cinfo, backing_store_ptr info, | 154 | read_backing_store (j_common_ptr cinfo, backing_store_ptr info, |
155 | void FAR * buffer_address, | 155 | void FAR * buffer_address, |
156 | long file_offset, long byte_count) | 156 | long file_offset, long byte_count) |
157 | { | 157 | { |
158 | long bytes = byte_count; | 158 | long bytes = byte_count; |
159 | long retVal; | 159 | long retVal; |
160 | 160 | ||
161 | if ( SetFPos ( info->temp_file, fsFromStart, file_offset ) != noErr ) | 161 | if ( SetFPos ( info->temp_file, fsFromStart, file_offset ) != noErr ) |
162 | ERREXIT(cinfo, JERR_TFILE_SEEK); | 162 | ERREXIT(cinfo, JERR_TFILE_SEEK); |
163 | 163 | ||
164 | retVal = FSRead ( info->temp_file, &bytes, | 164 | retVal = FSRead ( info->temp_file, &bytes, |
165 | (unsigned char *) buffer_address ); | 165 | (unsigned char *) buffer_address ); |
166 | if ( retVal != noErr || bytes != byte_count ) | 166 | if ( retVal != noErr || bytes != byte_count ) |
167 | ERREXIT(cinfo, JERR_TFILE_READ); | 167 | ERREXIT(cinfo, JERR_TFILE_READ); |
168 | } | 168 | } |
169 | 169 | ||
170 | 170 | ||
171 | METHODDEF(void) | 171 | METHODDEF(void) |
172 | write_backing_store (j_common_ptr cinfo, backing_store_ptr info, | 172 | write_backing_store (j_common_ptr cinfo, backing_store_ptr info, |
173 | void FAR * buffer_address, | 173 | void FAR * buffer_address, |
174 | long file_offset, long byte_count) | 174 | long file_offset, long byte_count) |
175 | { | 175 | { |
176 | long bytes = byte_count; | 176 | long bytes = byte_count; |
177 | long retVal; | 177 | long retVal; |
178 | 178 | ||
179 | if ( SetFPos ( info->temp_file, fsFromStart, file_offset ) != noErr ) | 179 | if ( SetFPos ( info->temp_file, fsFromStart, file_offset ) != noErr ) |
180 | ERREXIT(cinfo, JERR_TFILE_SEEK); | 180 | ERREXIT(cinfo, JERR_TFILE_SEEK); |
181 | 181 | ||
182 | retVal = FSWrite ( info->temp_file, &bytes, | 182 | retVal = FSWrite ( info->temp_file, &bytes, |
183 | (unsigned char *) buffer_address ); | 183 | (unsigned char *) buffer_address ); |
184 | if ( retVal != noErr || bytes != byte_count ) | 184 | if ( retVal != noErr || bytes != byte_count ) |
185 | ERREXIT(cinfo, JERR_TFILE_WRITE); | 185 | ERREXIT(cinfo, JERR_TFILE_WRITE); |
186 | } | 186 | } |
187 | 187 | ||
188 | 188 | ||
189 | METHODDEF(void) | 189 | METHODDEF(void) |
190 | close_backing_store (j_common_ptr cinfo, backing_store_ptr info) | 190 | close_backing_store (j_common_ptr cinfo, backing_store_ptr info) |
191 | { | 191 | { |
192 | FSClose ( info->temp_file ); | 192 | FSClose ( info->temp_file ); |
193 | FSpDelete ( &(info->tempSpec) ); | 193 | FSpDelete ( &(info->tempSpec) ); |
194 | } | 194 | } |
195 | 195 | ||
196 | 196 | ||
197 | /* | 197 | /* |
198 | * Initial opening of a backing-store object. | 198 | * Initial opening of a backing-store object. |
199 | * | 199 | * |
200 | * This version uses FindFolder to find the Temporary Items folder, | 200 | * This version uses FindFolder to find the Temporary Items folder, |
201 | * and puts the temporary file in there. | 201 | * and puts the temporary file in there. |
202 | */ | 202 | */ |
203 | 203 | ||
204 | GLOBAL(void) | 204 | GLOBAL(void) |
205 | jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, | 205 | jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, |
206 | long total_bytes_needed) | 206 | long total_bytes_needed) |
207 | { | 207 | { |
208 | short tmpRef, vRefNum; | 208 | short tmpRef, vRefNum; |
209 | long dirID; | 209 | long dirID; |
210 | FInfo finderInfo; | 210 | FInfo finderInfo; |
211 | FSSpec theSpec; | 211 | FSSpec theSpec; |
212 | Str255 fName; | 212 | Str255 fName; |
213 | OSErr osErr; | 213 | OSErr osErr; |
214 | long gestaltResponse = 0; | 214 | long gestaltResponse = 0; |
215 | 215 | ||
216 | /* Check that FSSpec calls are available. */ | 216 | /* Check that FSSpec calls are available. */ |
217 | osErr = Gestalt( gestaltFSAttr, &gestaltResponse ); | 217 | osErr = Gestalt( gestaltFSAttr, &gestaltResponse ); |
218 | if ( ( osErr != noErr ) | 218 | if ( ( osErr != noErr ) |
219 | || !( gestaltResponse & (1<<gestaltHasFSSpecCalls) ) ) | 219 | || !( gestaltResponse & (1<<gestaltHasFSSpecCalls) ) ) |
220 | ERREXITS(cinfo, JERR_TFILE_CREATE, "- System 7.0 or later required"); | 220 | ERREXITS(cinfo, JERR_TFILE_CREATE, "- System 7.0 or later required"); |
221 | /* TO DO: add a proper error message to jerror.h. */ | 221 | /* TO DO: add a proper error message to jerror.h. */ |
222 | 222 | ||
223 | /* Check that FindFolder is available. */ | 223 | /* Check that FindFolder is available. */ |
224 | osErr = Gestalt( gestaltFindFolderAttr, &gestaltResponse ); | 224 | osErr = Gestalt( gestaltFindFolderAttr, &gestaltResponse ); |
225 | if ( ( osErr != noErr ) | 225 | if ( ( osErr != noErr ) |
226 | || !( gestaltResponse & (1<<gestaltFindFolderPresent) ) ) | 226 | || !( gestaltResponse & (1<<gestaltFindFolderPresent) ) ) |
227 | ERREXITS(cinfo, JERR_TFILE_CREATE, "- System 7.0 or later required."); | 227 | ERREXITS(cinfo, JERR_TFILE_CREATE, "- System 7.0 or later required."); |
228 | /* TO DO: add a proper error message to jerror.h. */ | 228 | /* TO DO: add a proper error message to jerror.h. */ |
229 | 229 | ||
230 | osErr = FindFolder ( kOnSystemDisk, kTemporaryFolderType, kCreateFolder, | 230 | osErr = FindFolder ( kOnSystemDisk, kTemporaryFolderType, kCreateFolder, |
231 | &vRefNum, &dirID ); | 231 | &vRefNum, &dirID ); |
232 | if ( osErr != noErr ) | 232 | if ( osErr != noErr ) |
233 | ERREXITS(cinfo, JERR_TFILE_CREATE, "- temporary items folder unavailable"); | 233 | ERREXITS(cinfo, JERR_TFILE_CREATE, "- temporary items folder unavailable"); |
234 | /* TO DO: Try putting the temp files somewhere else. */ | 234 | /* TO DO: Try putting the temp files somewhere else. */ |
235 | 235 | ||
236 | /* Keep generating file names till we find one that's not in use */ | 236 | /* Keep generating file names till we find one that's not in use */ |
237 | for (;;) { | 237 | for (;;) { |
238 | next_file_num++; /* advance counter */ | 238 | next_file_num++; /* advance counter */ |
239 | 239 | ||
240 | sprintf(info->temp_name, TEMP_FILE_NAME, next_file_num); | 240 | sprintf(info->temp_name, TEMP_FILE_NAME, next_file_num); |
241 | strcpy ( (Ptr)fName+1, info->temp_name ); | 241 | strcpy ( (Ptr)fName+1, info->temp_name ); |
242 | *fName = strlen (info->temp_name); | 242 | *fName = strlen (info->temp_name); |
243 | osErr = FSMakeFSSpec ( vRefNum, dirID, fName, &theSpec ); | 243 | osErr = FSMakeFSSpec ( vRefNum, dirID, fName, &theSpec ); |
244 | 244 | ||
245 | if ( (osErr = FSpGetFInfo ( &theSpec, &finderInfo ) ) != noErr ) | 245 | if ( (osErr = FSpGetFInfo ( &theSpec, &finderInfo ) ) != noErr ) |
246 | break; | 246 | break; |
247 | } | 247 | } |
248 | 248 | ||
249 | osErr = FSpCreate ( &theSpec, '????', '????', smSystemScript ); | 249 | osErr = FSpCreate ( &theSpec, '????', '????', smSystemScript ); |
250 | if ( osErr != noErr ) | 250 | if ( osErr != noErr ) |
251 | ERREXITS(cinfo, JERR_TFILE_CREATE, info->temp_name); | 251 | ERREXITS(cinfo, JERR_TFILE_CREATE, info->temp_name); |
252 | 252 | ||
253 | osErr = FSpOpenDF ( &theSpec, fsRdWrPerm, &(info->temp_file) ); | 253 | osErr = FSpOpenDF ( &theSpec, fsRdWrPerm, &(info->temp_file) ); |
254 | if ( osErr != noErr ) | 254 | if ( osErr != noErr ) |
255 | ERREXITS(cinfo, JERR_TFILE_CREATE, info->temp_name); | 255 | ERREXITS(cinfo, JERR_TFILE_CREATE, info->temp_name); |
256 | 256 | ||
257 | info->tempSpec = theSpec; | 257 | info->tempSpec = theSpec; |
258 | 258 | ||
259 | info->read_backing_store = read_backing_store; | 259 | info->read_backing_store = read_backing_store; |
260 | info->write_backing_store = write_backing_store; | 260 | info->write_backing_store = write_backing_store; |
261 | info->close_backing_store = close_backing_store; | 261 | info->close_backing_store = close_backing_store; |
262 | TRACEMSS(cinfo, 1, JTRC_TFILE_OPEN, info->temp_name); | 262 | TRACEMSS(cinfo, 1, JTRC_TFILE_OPEN, info->temp_name); |
263 | } | 263 | } |
264 | 264 | ||
265 | 265 | ||
266 | /* | 266 | /* |
267 | * These routines take care of any system-dependent initialization and | 267 | * These routines take care of any system-dependent initialization and |
268 | * cleanup required. | 268 | * cleanup required. |
269 | */ | 269 | */ |
270 | 270 | ||
271 | GLOBAL(long) | 271 | GLOBAL(long) |
272 | jpeg_mem_init (j_common_ptr cinfo) | 272 | jpeg_mem_init (j_common_ptr cinfo) |
273 | { | 273 | { |
274 | next_file_num = 0; | 274 | next_file_num = 0; |
275 | 275 | ||
276 | /* max_memory_to_use will be initialized to FreeMem()'s result; | 276 | /* max_memory_to_use will be initialized to FreeMem()'s result; |
277 | * the calling application might later reduce it, for example | 277 | * the calling application might later reduce it, for example |
278 | * to leave room to invoke multiple JPEG objects. | 278 | * to leave room to invoke multiple JPEG objects. |
279 | * Note that FreeMem returns the total number of free bytes; | 279 | * Note that FreeMem returns the total number of free bytes; |
280 | * it may not be possible to allocate a single block of this size. | 280 | * it may not be possible to allocate a single block of this size. |
281 | */ | 281 | */ |
282 | return FreeMem(); | 282 | return FreeMem(); |
283 | } | 283 | } |
284 | 284 | ||
285 | GLOBAL(void) | 285 | GLOBAL(void) |
286 | jpeg_mem_term (j_common_ptr cinfo) | 286 | jpeg_mem_term (j_common_ptr cinfo) |
287 | { | 287 | { |
288 | /* no work */ | 288 | /* no work */ |
289 | } | 289 | } |