Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

jmemansi.c File Reference

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

Go to the source code of this file.


Defines

#define JPEG_INTERNALS
#define SEEK_SET   0
#define DEFAULT_MAX_MEM   1000000L

Functions

void *malloc JPP ((size_t size))
void free JPP ((void *ptr))
 jpeg_get_small (j_common_ptr cinfo, 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)
 jpeg_free_large (j_common_ptr cinfo, void FAR *object, size_t sizeofobject)
 jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, long max_bytes_needed, long already_allocated)
 read_backing_store (j_common_ptr cinfo, backing_store_ptr info, void FAR *buffer_address, long file_offset, long byte_count)
 write_backing_store (j_common_ptr cinfo, backing_store_ptr info, void FAR *buffer_address, long file_offset, long byte_count)
 close_backing_store (j_common_ptr cinfo, backing_store_ptr info)
 jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, long total_bytes_needed)
 jpeg_mem_init (j_common_ptr cinfo)
 jpeg_mem_term (j_common_ptr cinfo)

Define Documentation

#define DEFAULT_MAX_MEM   1000000L
 

Definition at line 77 of file jmemansi.c.

Referenced by jpeg_mem_init().

#define JPEG_INTERNALS
 

Definition at line 15 of file jmemansi.c.

#define SEEK_SET   0
 

Definition at line 26 of file jmemansi.c.

Referenced by read_backing_store(), and write_backing_store().


Function Documentation

close_backing_store j_common_ptr    cinfo,
backing_store_ptr    info
 

Definition at line 123 of file jmemansi.c.

References backing_store_struct::temp_file.

Referenced by jpeg_open_backing_store().

00124 {
00125   fclose(info->temp_file);
00126   /* Since this implementation uses tmpfile() to create the file,
00127    * no explicit file deletion is needed.
00128    */
00129 }

jpeg_free_large j_common_ptr    cinfo,
void FAR *    object,
size_t    sizeofobject
 

Definition at line 62 of file jmemansi.c.

References free, object, and sizeofobject.

00063 {
00064   free(object);
00065 }

jpeg_free_small j_common_ptr    cinfo,
void *    object,
size_t    sizeofobject
 

Definition at line 42 of file jmemansi.c.

References free, object, and sizeofobject.

00043 {
00044   free(object);
00045 }

jpeg_get_large j_common_ptr    cinfo,
size_t    sizeofobject
 

Definition at line 56 of file jmemansi.c.

References malloc, and sizeofobject.

00057 {
00058   return (void FAR *) malloc(sizeofobject);
00059 }

jpeg_get_small j_common_ptr    cinfo,
size_t    sizeofobject
 

Definition at line 36 of file jmemansi.c.

References malloc, and sizeofobject.

00037 {
00038   return (void *) malloc(sizeofobject);
00039 }

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

Definition at line 81 of file jmemansi.c.

References already_allocated, max_bytes_needed, and min_bytes_needed.

00083 {
00084   return cinfo->mem->max_memory_to_use - already_allocated;
00085 }

jpeg_mem_init j_common_ptr    cinfo
 

Definition at line 158 of file jmemansi.c.

References DEFAULT_MAX_MEM.

00159 {
00160   return DEFAULT_MAX_MEM;       /* default for max_memory_to_use */
00161 }

jpeg_mem_term j_common_ptr    cinfo
 

Definition at line 164 of file jmemansi.c.

00165 {
00166   /* no work */
00167 }

jpeg_open_backing_store j_common_ptr    cinfo,
backing_store_ptr    info,
long    total_bytes_needed
 

Definition at line 141 of file jmemansi.c.

References close_backing_store(), ERREXITS, read_backing_store(), backing_store_struct::temp_file, total_bytes_needed, and write_backing_store().

00143 {
00144   if ((info->temp_file = tmpfile()) == NULL)
00145     ERREXITS(cinfo, JERR_TFILE_CREATE, "");
00146   info->read_backing_store = read_backing_store;
00147   info->write_backing_store = write_backing_store;
00148   info->close_backing_store = close_backing_store;
00149 }

void free JPP (void *ptr  
 

void* malloc JPP (size_t size  
 

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

Definition at line 97 of file jmemansi.c.

References ERREXIT, JFREAD, SEEK_SET, and backing_store_struct::temp_file.

Referenced by jpeg_open_backing_store().

00100 {
00101   if (fseek(info->temp_file, file_offset, SEEK_SET))
00102     ERREXIT(cinfo, JERR_TFILE_SEEK);
00103   if (JFREAD(info->temp_file, buffer_address, byte_count)
00104       != (size_t) byte_count)
00105     ERREXIT(cinfo, JERR_TFILE_READ);
00106 }

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

Definition at line 110 of file jmemansi.c.

References ERREXIT, JERR_TFILE_WRITE, JFWRITE, SEEK_SET, and backing_store_struct::temp_file.

Referenced by jpeg_open_backing_store().

00113 {
00114   if (fseek(info->temp_file, file_offset, SEEK_SET))
00115     ERREXIT(cinfo, JERR_TFILE_SEEK);
00116   if (JFWRITE(info->temp_file, buffer_address, byte_count)
00117       != (size_t) byte_count)
00118     ERREXIT(cinfo, JERR_TFILE_WRITE);
00119 }
 

Powered by Plone

This site conforms to the following standards: