Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

jmemname.c File Reference

#include "jinclude.h"
#include "jpeglib.h"
#include "jmemsys.h"

Include dependency graph for jmemname.c:

Include dependency graph

Go to the source code of this file.

Defines

#define DEFAULT_MAX_MEM   1000000L
#define JPEG_INTERNALS
#define READ_BINARY   "rb"
#define RW_BINARY   "w+b"
#define SEEK_SET   0
#define TEMP_DIRECTORY   "/usr/tmp/"
#define TEMP_FILE_NAME   "%sJPG%dXXXXXX"

Functions

METHODDEF void close_backing_store (j_common_ptr cinfo, backing_store_ptr info)
GLOBAL void jpeg_free_large (j_common_ptr cinfo, void FAR *object, size_t sizeofobject)
GLOBAL void jpeg_free_small (j_common_ptr cinfo, void *object, size_t sizeofobject)
GLOBAL void FAR * jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject)
GLOBAL void * jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject)
GLOBAL long jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, long max_bytes_needed, long already_allocated)
GLOBAL long jpeg_mem_init (j_common_ptr cinfo)
GLOBAL void jpeg_mem_term (j_common_ptr cinfo)
GLOBAL void jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, long total_bytes_needed)
METHODDEF void read_backing_store (j_common_ptr cinfo, backing_store_ptr info, void FAR *buffer_address, long file_offset, long byte_count)
LOCAL void select_file_name (char *fname)
METHODDEF void write_backing_store (j_common_ptr cinfo, backing_store_ptr info, void FAR *buffer_address, long file_offset, long byte_count)

Variables

int next_file_num


Define Documentation

#define DEFAULT_MAX_MEM   1000000L
 

Definition at line 179 of file jmemname.c.

#define JPEG_INTERNALS
 

Definition at line 15 of file jmemname.c.

#define READ_BINARY   "rb"
 

Definition at line 33 of file jmemname.c.

#define RW_BINARY   "w+b"
 

Definition at line 34 of file jmemname.c.

Referenced by jpeg_open_backing_store().

#define SEEK_SET   0
 

Definition at line 26 of file jmemname.c.

#define TEMP_DIRECTORY   "/usr/tmp/"
 

Definition at line 65 of file jmemname.c.

Referenced by select_file_name().

#define TEMP_FILE_NAME   "%sJPG%dXXXXXX"
 

Definition at line 117 of file jmemname.c.

Referenced by select_file_name().


Function Documentation

METHODDEF void close_backing_store j_common_ptr  cinfo,
backing_store_ptr  info
 

Definition at line 225 of file jmemname.c.

References backing_store_ptr, fclose(), j_common_ptr, backing_store_struct::temp_file, backing_store_struct::temp_name, and TRACEMSS.

00226 {
00227   fclose(info->temp_file);  /* close the file */
00228   unlink(info->temp_name);  /* delete the file */
00229 /* If your system doesn't have unlink(), use remove() instead.
00230  * remove() is the ANSI-standard name for this function, but if
00231  * your system was ANSI you'd be using jmemansi.c, right?
00232  */
00233   TRACEMSS(cinfo, 1, JTRC_TFILE_CLOSE, info->temp_name);
00234 }

Here is the call graph for this function:

GLOBAL void jpeg_free_large j_common_ptr  cinfo,
void FAR *  object,
size_t  sizeofobject
 

Definition at line 164 of file jmemname.c.

References free(), and j_common_ptr.

00165 {
00166   free(object);
00167 }

Here is the call graph for this function:

GLOBAL void jpeg_free_small j_common_ptr  cinfo,
void *  object,
size_t  sizeofobject
 

Definition at line 144 of file jmemname.c.

References free(), and j_common_ptr.

00145 {
00146   free(object);
00147 }

Here is the call graph for this function:

GLOBAL void FAR* jpeg_get_large j_common_ptr  cinfo,
size_t  sizeofobject
 

Definition at line 158 of file jmemname.c.

References FAR, j_common_ptr, and malloc().

00159 {
00160   return (void FAR *) malloc(sizeofobject);
00161 }

Here is the call graph for this function:

GLOBAL void* jpeg_get_small j_common_ptr  cinfo,
size_t  sizeofobject
 

Definition at line 138 of file jmemname.c.

References j_common_ptr, and malloc().

00139 {
00140   return (void *) malloc(sizeofobject);
00141 }

Here is the call graph for this function:

GLOBAL long jpeg_mem_available j_common_ptr  cinfo,
long  min_bytes_needed,
long  max_bytes_needed,
long  already_allocated
 

Definition at line 183 of file jmemname.c.

References j_common_ptr.

00185 {
00186   return cinfo->mem->max_memory_to_use - already_allocated;
00187 }

GLOBAL long jpeg_mem_init j_common_ptr  cinfo  ) 
 

Definition at line 261 of file jmemname.c.

References j_common_ptr, and next_file_num.

00262 {
00263   next_file_num = 0;        /* initialize temp file name generator */
00264   return DEFAULT_MAX_MEM;   /* default for max_memory_to_use */
00265 }

GLOBAL void jpeg_mem_term j_common_ptr  cinfo  ) 
 

Definition at line 268 of file jmemname.c.

References j_common_ptr.

00269 {
00270   /* no work */
00271 }

GLOBAL void jpeg_open_backing_store j_common_ptr  cinfo,
backing_store_ptr  info,
long  total_bytes_needed
 

Definition at line 242 of file jmemname.c.

References backing_store_ptr, ERREXITS, fopen(), j_common_ptr, JERR_TFILE_CREATE, RW_BINARY, select_file_name(), backing_store_struct::temp_file, backing_store_struct::temp_name, and TRACEMSS.

00244 {
00245   select_file_name(info->temp_name);
00246   if ((info->temp_file = fopen(info->temp_name, RW_BINARY)) == NULL)
00247     ERREXITS(cinfo, JERR_TFILE_CREATE, info->temp_name);
00248   info->read_backing_store = read_backing_store;
00249   info->write_backing_store = write_backing_store;
00250   info->close_backing_store = close_backing_store;
00251   TRACEMSS(cinfo, 1, JTRC_TFILE_OPEN, info->temp_name);
00252 }

Here is the call graph for this function:

METHODDEF void read_backing_store j_common_ptr  cinfo,
backing_store_ptr  info,
void FAR *  buffer_address,
long  file_offset,
long  byte_count
 

Definition at line 199 of file jmemname.c.

References backing_store_ptr, ERREXIT, fseek(), j_common_ptr, JERR_TFILE_READ, JERR_TFILE_SEEK, JFREAD, SEEK_SET, and backing_store_struct::temp_file.

00202 {
00203   if (fseek(info->temp_file, file_offset, SEEK_SET))
00204     ERREXIT(cinfo, JERR_TFILE_SEEK);
00205   if (JFREAD(info->temp_file, buffer_address, byte_count)
00206       != (size_t) byte_count)
00207     ERREXIT(cinfo, JERR_TFILE_READ);
00208 }

Here is the call graph for this function:

LOCAL void select_file_name char *  fname  ) 
 

Definition at line 121 of file jmemname.c.

References next_file_num, sprintf(), TEMP_DIRECTORY, and TEMP_FILE_NAME.

Referenced by jpeg_open_backing_store(), and open_file_store().

00122 {
00123   next_file_num++;      /* advance counter */
00124   sprintf(fname, TEMP_FILE_NAME, TEMP_DIRECTORY, next_file_num);
00125   mktemp(fname);        /* make sure file name is unique */
00126   /* mktemp replaces the trailing XXXXXX with a unique string of characters */
00127 }

Here is the call graph for this function:

METHODDEF void write_backing_store j_common_ptr  cinfo,
backing_store_ptr  info,
void FAR *  buffer_address,
long  file_offset,
long  byte_count
 

Definition at line 212 of file jmemname.c.

References backing_store_ptr, ERREXIT, fseek(), j_common_ptr, JERR_TFILE_SEEK, JERR_TFILE_WRITE, JFWRITE, SEEK_SET, and backing_store_struct::temp_file.

00215 {
00216   if (fseek(info->temp_file, file_offset, SEEK_SET))
00217     ERREXIT(cinfo, JERR_TFILE_SEEK);
00218   if (JFWRITE(info->temp_file, buffer_address, byte_count)
00219       != (size_t) byte_count)
00220     ERREXIT(cinfo, JERR_TFILE_WRITE);
00221 }

Here is the call graph for this function:


Variable Documentation

int next_file_num [static]
 

Definition at line 68 of file jmemname.c.

Referenced by jpeg_mem_init(), and select_file_name().


Generated on Thu Aug 25 14:16:40 2005 for Quake III Arena by  doxygen 1.3.9.1