#include "jinclude.h"
#include "jpeglib.h"
#include "jmemsys.h"
Go to the source code of this file.
#define DEFAULT_MAX_MEM 1000000L |
Definition at line 184 of file jmemname.c.
#define JPEG_INTERNALS |
Definition at line 15 of file jmemname.c.
#define READ_BINARY "rb" |
Definition at line 37 of file jmemname.c.
#define RW_BINARY "w+b" |
#define SEEK_SET 0 |
Definition at line 26 of file jmemname.c.
#define TEMP_DIRECTORY "/usr/tmp/" |
#define TEMP_FILE_NAME "%sJPG%dXXXXXX" |
Definition at line 122 of file jmemname.c.
close_backing_store | ( | j_common_ptr | cinfo, | |
backing_store_ptr | info | |||
) |
Definition at line 230 of file jmemname.c.
References TRACEMSS.
00231 { 00232 fclose(info->temp_file); /* close the file */ 00233 unlink(info->temp_name); /* delete the file */ 00234 /* If your system doesn't have unlink(), use remove() instead. 00235 * remove() is the ANSI-standard name for this function, but if 00236 * your system was ANSI you'd be using jmemansi.c, right? 00237 */ 00238 TRACEMSS(cinfo, 1, JTRC_TFILE_CLOSE, info->temp_name); 00239 }
jpeg_free_large | ( | j_common_ptr | cinfo, | |
void FAR * | object, | |||
size_t | sizeofobject | |||
) |
jpeg_free_small | ( | j_common_ptr | cinfo, | |
void * | object, | |||
size_t | sizeofobject | |||
) |
jpeg_get_large | ( | j_common_ptr | cinfo, | |
size_t | sizeofobject | |||
) |
Definition at line 163 of file jmemname.c.
References malloc().
00164 { 00165 return (void FAR *) malloc(sizeofobject); 00166 }
jpeg_get_small | ( | j_common_ptr | cinfo, | |
size_t | sizeofobject | |||
) |
Definition at line 143 of file jmemname.c.
References malloc().
00144 { 00145 return (void *) malloc(sizeofobject); 00146 }
jpeg_mem_available | ( | j_common_ptr | cinfo, | |
long | min_bytes_needed, | |||
long | max_bytes_needed, | |||
long | already_allocated | |||
) |
Definition at line 188 of file jmemname.c.
00190 { 00191 return cinfo->mem->max_memory_to_use - already_allocated; 00192 }
jpeg_mem_init | ( | j_common_ptr | cinfo | ) |
Definition at line 266 of file jmemname.c.
References DEFAULT_MAX_MEM.
00267 { 00268 next_file_num = 0; /* initialize temp file name generator */ 00269 return DEFAULT_MAX_MEM; /* default for max_memory_to_use */ 00270 }
jpeg_mem_term | ( | j_common_ptr | cinfo | ) |
jpeg_open_backing_store | ( | j_common_ptr | cinfo, | |
backing_store_ptr | info, | |||
long | total_bytes_needed | |||
) |
Definition at line 247 of file jmemname.c.
References close_backing_store(), ERREXITS, read_backing_store(), RW_BINARY, select_file_name(), TRACEMSS, and write_backing_store().
00249 { 00250 select_file_name(info->temp_name); 00251 if ((info->temp_file = fopen(info->temp_name, RW_BINARY)) == NULL) 00252 ERREXITS(cinfo, JERR_TFILE_CREATE, info->temp_name); 00253 info->read_backing_store = read_backing_store; 00254 info->write_backing_store = write_backing_store; 00255 info->close_backing_store = close_backing_store; 00256 TRACEMSS(cinfo, 1, JTRC_TFILE_OPEN, info->temp_name); 00257 }
read_backing_store | ( | j_common_ptr | cinfo, | |
backing_store_ptr | info, | |||
void FAR * | buffer_address, | |||
long | file_offset, | |||
long | byte_count | |||
) |
Definition at line 204 of file jmemname.c.
References ERREXIT, JFREAD, and SEEK_SET.
00207 { 00208 if (fseek(info->temp_file, file_offset, SEEK_SET)) 00209 ERREXIT(cinfo, JERR_TFILE_SEEK); 00210 if (JFREAD(info->temp_file, buffer_address, byte_count) 00211 != (size_t) byte_count) 00212 ERREXIT(cinfo, JERR_TFILE_READ); 00213 }
select_file_name | ( | char * | fname | ) |
Definition at line 126 of file jmemname.c.
References TEMP_DIRECTORY, and TEMP_FILE_NAME.
00127 { 00128 next_file_num++; /* advance counter */ 00129 sprintf(fname, TEMP_FILE_NAME, TEMP_DIRECTORY, next_file_num); 00130 mktemp(fname); /* make sure file name is unique */ 00131 /* mktemp replaces the trailing XXXXXX with a unique string of characters */ 00132 }
write_backing_store | ( | j_common_ptr | cinfo, | |
backing_store_ptr | info, | |||
void FAR * | buffer_address, | |||
long | file_offset, | |||
long | byte_count | |||
) |
Definition at line 217 of file jmemname.c.
References ERREXIT, JFWRITE, and SEEK_SET.
00220 { 00221 if (fseek(info->temp_file, file_offset, SEEK_SET)) 00222 ERREXIT(cinfo, JERR_TFILE_SEEK); 00223 if (JFWRITE(info->temp_file, buffer_address, byte_count) 00224 != (size_t) byte_count) 00225 ERREXIT(cinfo, JERR_TFILE_WRITE); 00226 }
int next_file_num [static] |
Definition at line 73 of file jmemname.c.