istereo

annotate libs/libjpeg/jmemnobs.c @ 26:862a3329a8f0

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