ReactOS  0.4.14-dev-52-g6116262
jmemansi.c File Reference
#include "jinclude.h"
#include "jpeglib.h"
#include "jmemsys.h"
Include dependency graph for jmemansi.c:

Go to the source code of this file.

Macros

#define JPEG_INTERNALS
 
#define SEEK_SET   0 /* if not, assume 0 is correct */
 
#define DEFAULT_MAX_MEM   1000000L /* default: one megabyte */
 

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)
 

Macro Definition Documentation

◆ DEFAULT_MAX_MEM

#define DEFAULT_MAX_MEM   1000000L /* default: one megabyte */

Definition at line 77 of file jmemansi.c.

◆ JPEG_INTERNALS

#define JPEG_INTERNALS

Definition at line 15 of file jmemansi.c.

◆ SEEK_SET

#define SEEK_SET   0 /* if not, assume 0 is correct */

Definition at line 26 of file jmemansi.c.

Function Documentation

◆ close_backing_store()

close_backing_store ( j_common_ptr  cinfo,
backing_store_ptr  info 
)

Definition at line 123 of file jmemansi.c.

124 {
125  fclose(info->temp_file);
126  /* Since this implementation uses tmpfile() to create the file,
127  * no explicit file deletion is needed.
128  */
129 }
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)

Referenced by jpeg_open_backing_store().

◆ jpeg_free_large()

jpeg_free_large ( j_common_ptr  cinfo,
void FAR object,
size_t  sizeofobject 
)

Definition at line 62 of file jmemansi.c.

63 {
64  free(object);
65 }
#define free
Definition: debug_ros.c:5

Referenced by free_pool().

◆ jpeg_free_small()

jpeg_free_small ( j_common_ptr  cinfo,
void object,
size_t  sizeofobject 
)

Definition at line 42 of file jmemansi.c.

43 {
44  free(object);
45 }
#define free
Definition: debug_ros.c:5

Referenced by free_pool(), and self_destruct().

◆ jpeg_get_large()

jpeg_get_large ( j_common_ptr  cinfo,
size_t  sizeofobject 
)

Definition at line 56 of file jmemansi.c.

57 {
58  return (void FAR *) malloc(sizeofobject);
59 }
size_t sizeofobject
Definition: jmemsys.h:47
#define FAR
Definition: guiddef.h:36
#define malloc
Definition: debug_ros.c:4

Referenced by alloc_large().

◆ jpeg_get_small()

jpeg_get_small ( j_common_ptr  cinfo,
size_t  sizeofobject 
)

Definition at line 36 of file jmemansi.c.

37 {
38  return (void *) malloc(sizeofobject);
39 }
size_t sizeofobject
Definition: jmemsys.h:47
#define malloc
Definition: debug_ros.c:4

Referenced by alloc_small(), and jinit_memory_mgr().

◆ jpeg_mem_available()

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.

83 {
84  return cinfo->mem->max_memory_to_use - already_allocated;
85 }
long long long already_allocated
Definition: jmemsys.h:104

Referenced by realize_virt_arrays().

◆ jpeg_mem_init()

jpeg_mem_init ( j_common_ptr  cinfo)

Definition at line 158 of file jmemansi.c.

159 {
160  return DEFAULT_MAX_MEM; /* default for max_memory_to_use */
161 }
#define DEFAULT_MAX_MEM
Definition: jmemansi.c:77

Referenced by jinit_memory_mgr().

◆ jpeg_mem_term()

jpeg_mem_term ( j_common_ptr  cinfo)

Definition at line 164 of file jmemansi.c.

165 {
166  /* no work */
167 }

Referenced by jinit_memory_mgr(), and self_destruct().

◆ jpeg_open_backing_store()

jpeg_open_backing_store ( j_common_ptr  cinfo,
backing_store_ptr  info,
long  total_bytes_needed 
)

Definition at line 141 of file jmemansi.c.

143 {
144  if ((info->temp_file = tmpfile()) == NULL)
145  ERREXITS(cinfo, JERR_TFILE_CREATE, "");
146  info->read_backing_store = read_backing_store;
147  info->write_backing_store = write_backing_store;
148  info->close_backing_store = close_backing_store;
149 }
write_backing_store(j_common_ptr cinfo, backing_store_ptr info, void FAR *buffer_address, long file_offset, long byte_count)
Definition: jmemansi.c:110
smooth NULL
Definition: ftsmooth.c:416
_Check_return_ _CRTIMP FILE *__cdecl tmpfile(void)
Definition: file.c:3912
close_backing_store(j_common_ptr cinfo, backing_store_ptr info)
Definition: jmemansi.c:123
read_backing_store(j_common_ptr cinfo, backing_store_ptr info, void FAR *buffer_address, long file_offset, long byte_count)
Definition: jmemansi.c:97
#define ERREXITS(cinfo, code, str)
Definition: jerror.h:243

Referenced by realize_virt_arrays().

◆ JPP() [1/2]

void* malloc JPP ( (size_t size )

◆ JPP() [2/2]

void free JPP ( (void *ptr )

◆ read_backing_store()

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.

100 {
101  if (fseek(info->temp_file, file_offset, SEEK_SET))
102  ERREXIT(cinfo, JERR_TFILE_SEEK);
103  if (JFREAD(info->temp_file, buffer_address, byte_count)
104  != (size_t) byte_count)
105  ERREXIT(cinfo, JERR_TFILE_READ);
106 }
#define ERREXIT(msg)
Definition: rdjpgcom.c:72
#define JFREAD(file, buf, sizeofbuf)
Definition: jinclude.h:92
_Check_return_opt_ _CRTIMP int __cdecl fseek(_Inout_ FILE *_File, _In_ long _Offset, _In_ int _Origin)
#define SEEK_SET
Definition: jmemansi.c:26

Referenced by jpeg_open_backing_store().

◆ write_backing_store()

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.

113 {
114  if (fseek(info->temp_file, file_offset, SEEK_SET))
115  ERREXIT(cinfo, JERR_TFILE_SEEK);
116  if (JFWRITE(info->temp_file, buffer_address, byte_count)
117  != (size_t) byte_count)
118  ERREXIT(cinfo, JERR_TFILE_WRITE);
119 }
#define ERREXIT(msg)
Definition: rdjpgcom.c:72
#define JFWRITE(file, buf, sizeofbuf)
Definition: jinclude.h:94
_Check_return_opt_ _CRTIMP int __cdecl fseek(_Inout_ FILE *_File, _In_ long _Offset, _In_ int _Origin)
#define SEEK_SET
Definition: jmemansi.c:26

Referenced by jpeg_open_backing_store().