|
kusano |
7d535a |
/*
|
|
kusano |
7d535a |
* jinclude.h
|
|
kusano |
7d535a |
*
|
|
shun-iwasawa |
82a8f5 |
* This file was part of the Independent JPEG Group's software:
|
|
kusano |
7d535a |
* Copyright (C) 1991-1994, Thomas G. Lane.
|
|
shun-iwasawa |
82a8f5 |
* It was modified by The libjpeg-turbo Project to include only code relevant
|
|
shun-iwasawa |
82a8f5 |
* to libjpeg-turbo.
|
|
shun-iwasawa |
82a8f5 |
* For conditions of distribution and use, see the accompanying README.ijg
|
|
shun-iwasawa |
82a8f5 |
* file.
|
|
kusano |
7d535a |
*
|
|
kusano |
7d535a |
* This file exists to provide a single place to fix any problems with
|
|
kusano |
7d535a |
* including the wrong system include files. (Common problems are taken
|
|
kusano |
7d535a |
* care of by the standard jconfig symbols, but on really weird systems
|
|
kusano |
7d535a |
* you may have to edit this file.)
|
|
kusano |
7d535a |
*
|
|
kusano |
7d535a |
* NOTE: this file is NOT intended to be included by applications using the
|
|
kusano |
7d535a |
* JPEG library. Most applications need only include jpeglib.h.
|
|
kusano |
7d535a |
*/
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* Include auto-config file to find out which system include files we need. */
|
|
kusano |
7d535a |
|
|
shun-iwasawa |
82a8f5 |
#include "jconfig.h" /* auto configuration options */
|
|
shun-iwasawa |
82a8f5 |
#define JCONFIG_INCLUDED /* so that jpeglib.h doesn't do it again */
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/*
|
|
kusano |
7d535a |
* We need the NULL macro and size_t typedef.
|
|
kusano |
7d535a |
* On an ANSI-conforming system it is sufficient to include <stddef.h>.</stddef.h>
|
|
kusano |
7d535a |
* Otherwise, we get them from <stdlib.h> or <stdio.h>; we may have to</stdio.h></stdlib.h>
|
|
kusano |
7d535a |
* pull in <sys types.h=""> as well.</sys>
|
|
kusano |
7d535a |
* Note that the core JPEG library does not require <stdio.h>;</stdio.h>
|
|
kusano |
7d535a |
* only the default error handler and data source/destination modules do.
|
|
kusano |
7d535a |
* But we must pull it in because of the references to FILE in jpeglib.h.
|
|
kusano |
7d535a |
* You can remove those references if you want to compile without <stdio.h>.</stdio.h>
|
|
kusano |
7d535a |
*/
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
#ifdef HAVE_STDDEF_H
|
|
kusano |
7d535a |
#include <stddef.h></stddef.h>
|
|
kusano |
7d535a |
#endif
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
#ifdef HAVE_STDLIB_H
|
|
kusano |
7d535a |
#include <stdlib.h></stdlib.h>
|
|
kusano |
7d535a |
#endif
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
#ifdef NEED_SYS_TYPES_H
|
|
kusano |
7d535a |
#include <sys types.h=""></sys>
|
|
kusano |
7d535a |
#endif
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
#include <stdio.h></stdio.h>
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/*
|
|
kusano |
7d535a |
* We need memory copying and zeroing functions, plus strncpy().
|
|
kusano |
7d535a |
* ANSI and System V implementations declare these in <string.h>.</string.h>
|
|
kusano |
7d535a |
* BSD doesn't have the mem() functions, but it does have bcopy()/bzero().
|
|
kusano |
7d535a |
* Some systems may declare memset and memcpy in <memory.h>.</memory.h>
|
|
kusano |
7d535a |
*
|
|
kusano |
7d535a |
* NOTE: we assume the size parameters to these functions are of type size_t.
|
|
kusano |
7d535a |
* Change the casts in these macros if not!
|
|
kusano |
7d535a |
*/
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
#ifdef NEED_BSD_STRINGS
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
#include <strings.h></strings.h>
|
|
shun-iwasawa |
82a8f5 |
#define MEMZERO(target, size) \
|
|
shun-iwasawa |
82a8f5 |
bzero((void *)(target), (size_t)(size))
|
|
shun-iwasawa |
82a8f5 |
#define MEMCOPY(dest, src, size) \
|
|
shun-iwasawa |
82a8f5 |
bcopy((const void *)(src), (void *)(dest), (size_t)(size))
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
#else /* not BSD, assume ANSI/SysV string lib */
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
#include <string.h></string.h>
|
|
shun-iwasawa |
82a8f5 |
#define MEMZERO(target, size) \
|
|
shun-iwasawa |
82a8f5 |
memset((void *)(target), 0, (size_t)(size))
|
|
shun-iwasawa |
82a8f5 |
#define MEMCOPY(dest, src, size) \
|
|
shun-iwasawa |
82a8f5 |
memcpy((void *)(dest), (const void *)(src), (size_t)(size))
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
#endif
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/*
|
|
kusano |
7d535a |
* The modules that use fread() and fwrite() always invoke them through
|
|
kusano |
7d535a |
* these macros. On some systems you may need to twiddle the argument casts.
|
|
kusano |
7d535a |
* CAUTION: argument order is different from underlying functions!
|
|
kusano |
7d535a |
*/
|
|
kusano |
7d535a |
|
|
shun-iwasawa |
82a8f5 |
#define JFREAD(file, buf, sizeofbuf) \
|
|
shun-iwasawa |
82a8f5 |
((size_t)fread((void *)(buf), (size_t)1, (size_t)(sizeofbuf), (file)))
|
|
shun-iwasawa |
82a8f5 |
#define JFWRITE(file, buf, sizeofbuf) \
|
|
shun-iwasawa |
82a8f5 |
((size_t)fwrite((const void *)(buf), (size_t)1, (size_t)(sizeofbuf), (file)))
|