3dphotoshoot

diff libs/libjpeg/jmemnobs.c @ 14:06dc8b9b4f89

added libimago, libjpeg and libpng
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 07 Jun 2015 17:25:49 +0300
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/libs/libjpeg/jmemnobs.c	Sun Jun 07 17:25:49 2015 +0300
     1.3 @@ -0,0 +1,109 @@
     1.4 +/*
     1.5 + * jmemnobs.c
     1.6 + *
     1.7 + * Copyright (C) 1992-1996, Thomas G. Lane.
     1.8 + * This file is part of the Independent JPEG Group's software.
     1.9 + * For conditions of distribution and use, see the accompanying README file.
    1.10 + *
    1.11 + * This file provides a really simple implementation of the system-
    1.12 + * dependent portion of the JPEG memory manager.  This implementation
    1.13 + * assumes that no backing-store files are needed: all required space
    1.14 + * can be obtained from malloc().
    1.15 + * This is very portable in the sense that it'll compile on almost anything,
    1.16 + * but you'd better have lots of main memory (or virtual memory) if you want
    1.17 + * to process big images.
    1.18 + * Note that the max_memory_to_use option is ignored by this implementation.
    1.19 + */
    1.20 +
    1.21 +#define JPEG_INTERNALS
    1.22 +#include "jinclude.h"
    1.23 +#include "jpeglib.h"
    1.24 +#include "jmemsys.h"		/* import the system-dependent declarations */
    1.25 +
    1.26 +#ifndef HAVE_STDLIB_H		/* <stdlib.h> should declare malloc(),free() */
    1.27 +extern void * malloc JPP((size_t size));
    1.28 +extern void free JPP((void *ptr));
    1.29 +#endif
    1.30 +
    1.31 +
    1.32 +/*
    1.33 + * Memory allocation and freeing are controlled by the regular library
    1.34 + * routines malloc() and free().
    1.35 + */
    1.36 +
    1.37 +GLOBAL(void *)
    1.38 +jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject)
    1.39 +{
    1.40 +  return (void *) malloc(sizeofobject);
    1.41 +}
    1.42 +
    1.43 +GLOBAL(void)
    1.44 +jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject)
    1.45 +{
    1.46 +  free(object);
    1.47 +}
    1.48 +
    1.49 +
    1.50 +/*
    1.51 + * "Large" objects are treated the same as "small" ones.
    1.52 + * NB: although we include FAR keywords in the routine declarations,
    1.53 + * this file won't actually work in 80x86 small/medium model; at least,
    1.54 + * you probably won't be able to process useful-size images in only 64KB.
    1.55 + */
    1.56 +
    1.57 +GLOBAL(void FAR *)
    1.58 +jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject)
    1.59 +{
    1.60 +  return (void FAR *) malloc(sizeofobject);
    1.61 +}
    1.62 +
    1.63 +GLOBAL(void)
    1.64 +jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject)
    1.65 +{
    1.66 +  free(object);
    1.67 +}
    1.68 +
    1.69 +
    1.70 +/*
    1.71 + * This routine computes the total memory space available for allocation.
    1.72 + * Here we always say, "we got all you want bud!"
    1.73 + */
    1.74 +
    1.75 +GLOBAL(long)
    1.76 +jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed,
    1.77 +		    long max_bytes_needed, long already_allocated)
    1.78 +{
    1.79 +  return max_bytes_needed;
    1.80 +}
    1.81 +
    1.82 +
    1.83 +/*
    1.84 + * Backing store (temporary file) management.
    1.85 + * Since jpeg_mem_available always promised the moon,
    1.86 + * this should never be called and we can just error out.
    1.87 + */
    1.88 +
    1.89 +GLOBAL(void)
    1.90 +jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info,
    1.91 +			 long total_bytes_needed)
    1.92 +{
    1.93 +  ERREXIT(cinfo, JERR_NO_BACKING_STORE);
    1.94 +}
    1.95 +
    1.96 +
    1.97 +/*
    1.98 + * These routines take care of any system-dependent initialization and
    1.99 + * cleanup required.  Here, there isn't any.
   1.100 + */
   1.101 +
   1.102 +GLOBAL(long)
   1.103 +jpeg_mem_init (j_common_ptr cinfo)
   1.104 +{
   1.105 +  return 0;			/* just set max_memory_to_use to 0 */
   1.106 +}
   1.107 +
   1.108 +GLOBAL(void)
   1.109 +jpeg_mem_term (j_common_ptr cinfo)
   1.110 +{
   1.111 +  /* no work */
   1.112 +}