/src/gdal/build/frmts/jpeg/libjpeg12/jmemnobs12.c
Line  | Count  | Source (jump to first uncovered line)  | 
1  |  | /*  | 
2  |  |  * jmemnobs.c  | 
3  |  |  *  | 
4  |  |  * Copyright (C) 1992-1996, Thomas G. Lane.  | 
5  |  |  * This file is part of the Independent JPEG Group's software.  | 
6  |  |  * For conditions of distribution and use, see the accompanying README file.  | 
7  |  |  *  | 
8  |  |  * This file provides a really simple implementation of the system-  | 
9  |  |  * dependent portion of the JPEG memory manager.  This implementation  | 
10  |  |  * assumes that no backing-store files are needed: all required space  | 
11  |  |  * can be obtained from malloc().  | 
12  |  |  * This is very portable in the sense that it'll compile on almost anything,  | 
13  |  |  * but you'd better have lots of main memory (or virtual memory) if you want  | 
14  |  |  * to process big images.  | 
15  |  |  * Note that the max_memory_to_use option is ignored by this implementation.  | 
16  |  |  */  | 
17  |  |  | 
18  |  | #define JPEG_INTERNALS  | 
19  |  | #include "jinclude.h"  | 
20  |  | #include "jpeglib.h"  | 
21  |  | #include "jmemsys.h"    /* import the system-dependent declarations */  | 
22  |  |  | 
23  |  | #include "cpl_port.h"  | 
24  |  |  | 
25  |  | #ifndef HAVE_STDLIB_H   /* <stdlib.h> should declare malloc(),free() */  | 
26  |  | extern void * malloc JPP((size_t size));  | 
27  |  | extern void free JPP((void *ptr));  | 
28  |  | #endif  | 
29  |  |  | 
30  |  |  | 
31  |  | /*  | 
32  |  |  * Memory allocation and freeing are controlled by the regular library  | 
33  |  |  * routines malloc() and free().  | 
34  |  |  */  | 
35  |  |  | 
36  |  | GLOBAL(void *)  | 
37  |  | jpeg_get_small (CPL_UNUSED j_common_ptr cinfo, size_t sizeofobject)  | 
38  | 0  | { | 
39  | 0  |   return (void *) malloc(sizeofobject);  | 
40  | 0  | }  | 
41  |  |  | 
42  |  | GLOBAL(void)  | 
43  |  | jpeg_free_small (CPL_UNUSED j_common_ptr cinfo, void * object, CPL_UNUSED size_t sizeofobject)  | 
44  | 0  | { | 
45  | 0  |   free(object);  | 
46  | 0  | }  | 
47  |  |  | 
48  |  |  | 
49  |  | /*  | 
50  |  |  * "Large" objects are treated the same as "small" ones.  | 
51  |  |  * NB: although we include FAR keywords in the routine declarations,  | 
52  |  |  * this file won't actually work in 80x86 small/medium model; at least,  | 
53  |  |  * you probably won't be able to process useful-size images in only 64KB.  | 
54  |  |  */  | 
55  |  |  | 
56  |  | GLOBAL(void FAR *)  | 
57  |  | jpeg_get_large (CPL_UNUSED j_common_ptr cinfo, size_t sizeofobject)  | 
58  | 0  | { | 
59  | 0  |   return (void FAR *) malloc(sizeofobject);  | 
60  | 0  | }  | 
61  |  |  | 
62  |  | GLOBAL(void)  | 
63  |  | jpeg_free_large (CPL_UNUSED j_common_ptr cinfo, void FAR * object, CPL_UNUSED size_t sizeofobject)  | 
64  | 0  | { | 
65  | 0  |   free(object);  | 
66  | 0  | }  | 
67  |  |  | 
68  |  |  | 
69  |  | /*  | 
70  |  |  * This routine computes the total memory space available for allocation.  | 
71  |  |  * Here we always say, "we got all you want bud!"  | 
72  |  |  */  | 
73  |  |  | 
74  |  | GLOBAL(long)  | 
75  |  | jpeg_mem_available (CPL_UNUSED j_common_ptr cinfo, CPL_UNUSED long min_bytes_needed,  | 
76  |  |         long max_bytes_needed, CPL_UNUSED long already_allocated)  | 
77  | 0  | { | 
78  | 0  |   return max_bytes_needed;  | 
79  | 0  | }  | 
80  |  |  | 
81  |  |  | 
82  |  | /*  | 
83  |  |  * Backing store (temporary file) management.  | 
84  |  |  * Since jpeg_mem_available always promised the moon,  | 
85  |  |  * this should never be called and we can just error out.  | 
86  |  |  */  | 
87  |  |  | 
88  |  | GLOBAL(void)  | 
89  |  | jpeg_open_backing_store (j_common_ptr cinfo, CPL_UNUSED backing_store_ptr info,  | 
90  |  |        CPL_UNUSED long total_bytes_needed)  | 
91  | 0  | { | 
92  | 0  |   ERREXIT(cinfo, JERR_NO_BACKING_STORE);  | 
93  | 0  | }  | 
94  |  |  | 
95  |  |  | 
96  |  | /*  | 
97  |  |  * These routines take care of any system-dependent initialization and  | 
98  |  |  * cleanup required.  Here, there isn't any.  | 
99  |  |  */  | 
100  |  |  | 
101  |  | GLOBAL(long)  | 
102  |  | jpeg_mem_init (CPL_UNUSED j_common_ptr cinfo)  | 
103  | 0  | { | 
104  | 0  |   return 0;     /* just set max_memory_to_use to 0 */  | 
105  | 0  | }  | 
106  |  |  | 
107  |  | GLOBAL(void)  | 
108  |  | jpeg_mem_term (CPL_UNUSED j_common_ptr cinfo)  | 
109  | 0  | { | 
110  |  |   /* no work */  | 
111  | 0  | }  |