Main MRPT website > C++ reference for MRPT 1.9.9
jmemnobs.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #define JPEG_INTERNALS
11 #include "jinclude.h"
12 #include "mrpt_jpeglib.h"
13 #include "jmemsys.h" /* import the system-dependent declarations */
14 
15 #ifndef HAVE_STDLIB_H /* <stdlib.h> should declare malloc(),free() */
16 extern void* malloc JPP((size_t size));
17 extern void free JPP((void* ptr));
18 #endif
19 
20 /*
21  * Memory allocation and freeing are controlled by the regular library
22  * routines malloc() and free().
23  */
24 
25 GLOBAL(void*)
27 {
28  return (void*)malloc(sizeofobject);
29 }
30 
31 GLOBAL(void)
32 jpeg_free_small(j_common_ptr, void* object, size_t) { free(object); }
33 /*
34  * "Large" objects are treated the same as "small" ones.
35  * NB: although we include FAR keywords in the routine declarations,
36  * this file won't actually work in 80x86 small/medium model; at least,
37  * you probably won't be able to process useful-size images in only 64KB.
38  */
39 
40 GLOBAL(void FAR*)
42 {
43  return (void FAR*)malloc(sizeofobject);
44 }
45 
46 GLOBAL(void)
47 jpeg_free_large(j_common_ptr, void FAR* object, size_t) { free(object); }
48 /*
49  * This routine computes the total memory space available for allocation.
50  * Here we always say, "we got all you want bud!"
51  */
52 
53 GLOBAL(long)
54 jpeg_mem_available(j_common_ptr, long, long max_bytes_needed, long)
55 {
56  return max_bytes_needed;
57 }
58 
59 /*
60  * Backing store (temporary file) management.
61  * Since jpeg_mem_available always promised the moon,
62  * this should never be called and we can just error out.
63  */
64 
65 GLOBAL(void)
67 {
68  ERREXIT(cinfo, JERR_NO_BACKING_STORE);
69 }
70 
71 /*
72  * These routines take care of any system-dependent initialization and
73  * cleanup required. Here, there isn't any.
74  */
75 
76 GLOBAL(long)
77 jpeg_mem_init(j_common_ptr) { return 0; /* just set max_memory_to_use to 0 */ }
78 GLOBAL(void)
79 jpeg_mem_term(j_common_ptr) { /* no work */}
jpeg_mem_init(j_common_ptr)
Definition: jmemnobs.cpp:77
jpeg_get_small(j_common_ptr, size_t sizeofobject)
Definition: jmemnobs.cpp:26
jpeg_free_small(j_common_ptr, void *object, size_t)
Definition: jmemnobs.cpp:32
#define ERREXIT(cinfo, code)
Definition: jerror.h:451
jpeg_open_backing_store(j_common_ptr cinfo, backing_store_ptr, long)
Definition: jmemnobs.cpp:66
size_t sizeofobject
Definition: jmemsys.h:34
#define JPP(arglist)
Definition: mrpt_jpeglib.h:815
jpeg_mem_available(j_common_ptr, long, long max_bytes_needed, long)
Definition: jmemnobs.cpp:54
jpeg_mem_term(j_common_ptr)
Definition: jmemnobs.cpp:79
#define GLOBAL(type)
Definition: jmorecfg.h:177
jpeg_free_large(j_common_ptr, void FAR *object, size_t)
Definition: jmemnobs.cpp:47
GLsizeiptr size
Definition: glext.h:3923
#define FAR
Definition: zconf.h:262
jpeg_get_large(j_common_ptr, size_t sizeofobject)
Definition: jmemnobs.cpp:41



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019