istereo2

annotate libs/libjpeg/jinclude.h @ 35:643f4ab609a4

added readme and license
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 31 Oct 2015 05:45:35 +0200
parents
children
rev   line source
nuclear@2 1 /*
nuclear@2 2 * jinclude.h
nuclear@2 3 *
nuclear@2 4 * Copyright (C) 1991-1994, Thomas G. Lane.
nuclear@2 5 * This file is part of the Independent JPEG Group's software.
nuclear@2 6 * For conditions of distribution and use, see the accompanying README file.
nuclear@2 7 *
nuclear@2 8 * This file exists to provide a single place to fix any problems with
nuclear@2 9 * including the wrong system include files. (Common problems are taken
nuclear@2 10 * care of by the standard jconfig symbols, but on really weird systems
nuclear@2 11 * you may have to edit this file.)
nuclear@2 12 *
nuclear@2 13 * NOTE: this file is NOT intended to be included by applications using the
nuclear@2 14 * JPEG library. Most applications need only include jpeglib.h.
nuclear@2 15 */
nuclear@2 16
nuclear@2 17
nuclear@2 18 /* Include auto-config file to find out which system include files we need. */
nuclear@2 19
nuclear@2 20 #include "jconfig.h" /* auto configuration options */
nuclear@2 21 #define JCONFIG_INCLUDED /* so that jpeglib.h doesn't do it again */
nuclear@2 22
nuclear@2 23 /*
nuclear@2 24 * We need the NULL macro and size_t typedef.
nuclear@2 25 * On an ANSI-conforming system it is sufficient to include <stddef.h>.
nuclear@2 26 * Otherwise, we get them from <stdlib.h> or <stdio.h>; we may have to
nuclear@2 27 * pull in <sys/types.h> as well.
nuclear@2 28 * Note that the core JPEG library does not require <stdio.h>;
nuclear@2 29 * only the default error handler and data source/destination modules do.
nuclear@2 30 * But we must pull it in because of the references to FILE in jpeglib.h.
nuclear@2 31 * You can remove those references if you want to compile without <stdio.h>.
nuclear@2 32 */
nuclear@2 33
nuclear@2 34 #ifdef HAVE_STDDEF_H
nuclear@2 35 #include <stddef.h>
nuclear@2 36 #endif
nuclear@2 37
nuclear@2 38 #ifdef HAVE_STDLIB_H
nuclear@2 39 #include <stdlib.h>
nuclear@2 40 #endif
nuclear@2 41
nuclear@2 42 #ifdef NEED_SYS_TYPES_H
nuclear@2 43 #include <sys/types.h>
nuclear@2 44 #endif
nuclear@2 45
nuclear@2 46 #include <stdio.h>
nuclear@2 47
nuclear@2 48 /*
nuclear@2 49 * We need memory copying and zeroing functions, plus strncpy().
nuclear@2 50 * ANSI and System V implementations declare these in <string.h>.
nuclear@2 51 * BSD doesn't have the mem() functions, but it does have bcopy()/bzero().
nuclear@2 52 * Some systems may declare memset and memcpy in <memory.h>.
nuclear@2 53 *
nuclear@2 54 * NOTE: we assume the size parameters to these functions are of type size_t.
nuclear@2 55 * Change the casts in these macros if not!
nuclear@2 56 */
nuclear@2 57
nuclear@2 58 #ifdef NEED_BSD_STRINGS
nuclear@2 59
nuclear@2 60 #include <strings.h>
nuclear@2 61 #define MEMZERO(target,size) bzero((void *)(target), (size_t)(size))
nuclear@2 62 #define MEMCOPY(dest,src,size) bcopy((const void *)(src), (void *)(dest), (size_t)(size))
nuclear@2 63
nuclear@2 64 #else /* not BSD, assume ANSI/SysV string lib */
nuclear@2 65
nuclear@2 66 #include <string.h>
nuclear@2 67 #define MEMZERO(target,size) memset((void *)(target), 0, (size_t)(size))
nuclear@2 68 #define MEMCOPY(dest,src,size) memcpy((void *)(dest), (const void *)(src), (size_t)(size))
nuclear@2 69
nuclear@2 70 #endif
nuclear@2 71
nuclear@2 72 /*
nuclear@2 73 * In ANSI C, and indeed any rational implementation, size_t is also the
nuclear@2 74 * type returned by sizeof(). However, it seems there are some irrational
nuclear@2 75 * implementations out there, in which sizeof() returns an int even though
nuclear@2 76 * size_t is defined as long or unsigned long. To ensure consistent results
nuclear@2 77 * we always use this SIZEOF() macro in place of using sizeof() directly.
nuclear@2 78 */
nuclear@2 79
nuclear@2 80 #define SIZEOF(object) ((size_t) sizeof(object))
nuclear@2 81
nuclear@2 82 /*
nuclear@2 83 * The modules that use fread() and fwrite() always invoke them through
nuclear@2 84 * these macros. On some systems you may need to twiddle the argument casts.
nuclear@2 85 * CAUTION: argument order is different from underlying functions!
nuclear@2 86 */
nuclear@2 87
nuclear@2 88 #define JFREAD(file,buf,sizeofbuf) \
nuclear@2 89 ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
nuclear@2 90 #define JFWRITE(file,buf,sizeofbuf) \
nuclear@2 91 ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))