7 * Copyright (C) 1992-1994, Thomas G. Lane.
9 * This file is part of the Independent JPEG Group's software.
11 * For conditions of distribution and use, see the accompanying README file.
15 * This file provides a really simple implementation of the system-
17 * dependent portion of the JPEG memory manager. This implementation
19 * assumes that no backing-store files are needed: all required space
21 * can be obtained from ri.Malloc().
23 * This is very portable in the sense that it'll compile on almost anything,
25 * but you'd better have lots of main memory (or virtual memory) if you want
27 * to process big images.
29 * Note that the max_memory_to_use option is ignored by this implementation.
35 #define JPEG_INTERNALS
39 #include "radiant_jpeglib.h"
41 #include "jmemsys.h" /* import the system-dependent declarations */
47 * Memory allocation and ri.Freeing are controlled by the regular library
49 * routines ri.Malloc() and ri.Free().
57 jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject)
61 return (void *) malloc(sizeofobject);
69 jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject)
83 * "Large" objects are treated the same as "small" ones.
85 * NB: although we include FAR keywords in the routine declarations,
87 * this file won't actually work in 80x86 small/medium model; at least,
89 * you probably won't be able to process useful-size images in only 64KB.
97 jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject)
101 return (void FAR *) malloc(sizeofobject);
109 jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject)
123 * This routine computes the total memory space available for allocation.
125 * Here we always say, "we got all you want bud!"
133 jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed,
135 long max_bytes_needed, long already_allocated)
139 return max_bytes_needed;
149 * Backing store (temporary file) management.
151 * Since jpeg_mem_available always promised the moon,
153 * this should never be called and we can just error out.
161 jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info,
163 long total_bytes_needed)
167 ERREXIT(cinfo, JERR_NO_BACKING_STORE);
177 * These routines take care of any system-dependent initialization and
179 * cleanup required. Here, there isn't any.
187 jpeg_mem_init (j_common_ptr cinfo)
191 return 0; /* just set max_memory_to_use to 0 */
199 jpeg_mem_term (j_common_ptr cinfo)