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