]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - libs/jpeg6/jmemnobs.cpp
...
[xonotic/netradiant.git] / libs / jpeg6 / jmemnobs.cpp
1 /*
2
3  * jmemnobs.c
4
5  *
6
7  * Copyright (C) 1992-1994, Thomas G. Lane.
8
9  * This file is part of the Independent JPEG Group's software.
10
11  * For conditions of distribution and use, see the accompanying README file.
12
13  *
14
15  * This file provides a really simple implementation of the system-
16
17  * dependent portion of the JPEG memory manager.  This implementation
18
19  * assumes that no backing-store files are needed: all required space
20
21  * can be obtained from ri.Malloc().
22
23  * This is very portable in the sense that it'll compile on almost anything,
24
25  * but you'd better have lots of main memory (or virtual memory) if you want
26
27  * to process big images.
28
29  * Note that the max_memory_to_use option is ignored by this implementation.
30
31  */
32
33
34
35 #define JPEG_INTERNALS
36
37 #include "jinclude.h"
38
39 #include "radiant_jpeglib.h"
40
41 #include "jmemsys.h"            /* import the system-dependent declarations */
42
43
44
45 /*
46
47  * Memory allocation and ri.Freeing are controlled by the regular library
48
49  * routines ri.Malloc() and ri.Free().
50
51  */
52
53
54
55 GLOBAL void *
56
57 jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject)
58
59 {
60
61   return (void *) malloc(sizeofobject);
62
63 }
64
65
66
67 GLOBAL void
68
69 jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject)
70
71 {
72
73   free(object);
74
75 }
76
77
78
79
80
81 /*
82
83  * "Large" objects are treated the same as "small" ones.
84
85  * NB: although we include FAR keywords in the routine declarations,
86
87  * this file won't actually work in 80x86 small/medium model; at least,
88
89  * you probably won't be able to process useful-size images in only 64KB.
90
91  */
92
93
94
95 GLOBAL void FAR *
96
97 jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject)
98
99 {
100
101   return (void FAR *) malloc(sizeofobject);
102
103 }
104
105
106
107 GLOBAL void
108
109 jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject)
110
111 {
112
113   free(object);
114
115 }
116
117
118
119
120
121 /*
122
123  * This routine computes the total memory space available for allocation.
124
125  * Here we always say, "we got all you want bud!"
126
127  */
128
129
130
131 GLOBAL long
132
133 jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed,
134
135                     long max_bytes_needed, long already_allocated)
136
137 {
138
139   return max_bytes_needed;
140
141 }
142
143
144
145
146
147 /*
148
149  * Backing store (temporary file) management.
150
151  * Since jpeg_mem_available always promised the moon,
152
153  * this should never be called and we can just error out.
154
155  */
156
157
158
159 GLOBAL void
160
161 jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info,
162
163                          long total_bytes_needed)
164
165 {
166
167   ERREXIT(cinfo, JERR_NO_BACKING_STORE);
168
169 }
170
171
172
173
174
175 /*
176
177  * These routines take care of any system-dependent initialization and
178
179  * cleanup required.  Here, there isn't any.
180
181  */
182
183
184
185 GLOBAL long
186
187 jpeg_mem_init (j_common_ptr cinfo)
188
189 {
190
191   return 0;                     /* just set max_memory_to_use to 0 */
192
193 }
194
195
196
197 GLOBAL void
198
199 jpeg_mem_term (j_common_ptr cinfo)
200
201 {
202
203   /* no work */
204
205 }
206