istereo

diff libs/libjpeg/jinclude.h @ 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
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/libs/libjpeg/jinclude.h	Thu Sep 08 06:28:38 2011 +0300
     1.3 @@ -0,0 +1,91 @@
     1.4 +/*
     1.5 + * jinclude.h
     1.6 + *
     1.7 + * Copyright (C) 1991-1994, 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 exists to provide a single place to fix any problems with
    1.12 + * including the wrong system include files.  (Common problems are taken
    1.13 + * care of by the standard jconfig symbols, but on really weird systems
    1.14 + * you may have to edit this file.)
    1.15 + *
    1.16 + * NOTE: this file is NOT intended to be included by applications using the
    1.17 + * JPEG library.  Most applications need only include jpeglib.h.
    1.18 + */
    1.19 +
    1.20 +
    1.21 +/* Include auto-config file to find out which system include files we need. */
    1.22 +
    1.23 +#include "jconfig.h"		/* auto configuration options */
    1.24 +#define JCONFIG_INCLUDED	/* so that jpeglib.h doesn't do it again */
    1.25 +
    1.26 +/*
    1.27 + * We need the NULL macro and size_t typedef.
    1.28 + * On an ANSI-conforming system it is sufficient to include <stddef.h>.
    1.29 + * Otherwise, we get them from <stdlib.h> or <stdio.h>; we may have to
    1.30 + * pull in <sys/types.h> as well.
    1.31 + * Note that the core JPEG library does not require <stdio.h>;
    1.32 + * only the default error handler and data source/destination modules do.
    1.33 + * But we must pull it in because of the references to FILE in jpeglib.h.
    1.34 + * You can remove those references if you want to compile without <stdio.h>.
    1.35 + */
    1.36 +
    1.37 +#ifdef HAVE_STDDEF_H
    1.38 +#include <stddef.h>
    1.39 +#endif
    1.40 +
    1.41 +#ifdef HAVE_STDLIB_H
    1.42 +#include <stdlib.h>
    1.43 +#endif
    1.44 +
    1.45 +#ifdef NEED_SYS_TYPES_H
    1.46 +#include <sys/types.h>
    1.47 +#endif
    1.48 +
    1.49 +#include <stdio.h>
    1.50 +
    1.51 +/*
    1.52 + * We need memory copying and zeroing functions, plus strncpy().
    1.53 + * ANSI and System V implementations declare these in <string.h>.
    1.54 + * BSD doesn't have the mem() functions, but it does have bcopy()/bzero().
    1.55 + * Some systems may declare memset and memcpy in <memory.h>.
    1.56 + *
    1.57 + * NOTE: we assume the size parameters to these functions are of type size_t.
    1.58 + * Change the casts in these macros if not!
    1.59 + */
    1.60 +
    1.61 +#ifdef NEED_BSD_STRINGS
    1.62 +
    1.63 +#include <strings.h>
    1.64 +#define MEMZERO(target,size)	bzero((void *)(target), (size_t)(size))
    1.65 +#define MEMCOPY(dest,src,size)	bcopy((const void *)(src), (void *)(dest), (size_t)(size))
    1.66 +
    1.67 +#else /* not BSD, assume ANSI/SysV string lib */
    1.68 +
    1.69 +#include <string.h>
    1.70 +#define MEMZERO(target,size)	memset((void *)(target), 0, (size_t)(size))
    1.71 +#define MEMCOPY(dest,src,size)	memcpy((void *)(dest), (const void *)(src), (size_t)(size))
    1.72 +
    1.73 +#endif
    1.74 +
    1.75 +/*
    1.76 + * In ANSI C, and indeed any rational implementation, size_t is also the
    1.77 + * type returned by sizeof().  However, it seems there are some irrational
    1.78 + * implementations out there, in which sizeof() returns an int even though
    1.79 + * size_t is defined as long or unsigned long.  To ensure consistent results
    1.80 + * we always use this SIZEOF() macro in place of using sizeof() directly.
    1.81 + */
    1.82 +
    1.83 +#define SIZEOF(object)	((size_t) sizeof(object))
    1.84 +
    1.85 +/*
    1.86 + * The modules that use fread() and fwrite() always invoke them through
    1.87 + * these macros.  On some systems you may need to twiddle the argument casts.
    1.88 + * CAUTION: argument order is different from underlying functions!
    1.89 + */
    1.90 +
    1.91 +#define JFREAD(file,buf,sizeofbuf)  \
    1.92 +  ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
    1.93 +#define JFWRITE(file,buf,sizeofbuf)  \
    1.94 +  ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))