nuclear@26: /* nuclear@26: * jinclude.h nuclear@26: * nuclear@26: * Copyright (C) 1991-1994, Thomas G. Lane. nuclear@26: * This file is part of the Independent JPEG Group's software. nuclear@26: * For conditions of distribution and use, see the accompanying README file. nuclear@26: * nuclear@26: * This file exists to provide a single place to fix any problems with nuclear@26: * including the wrong system include files. (Common problems are taken nuclear@26: * care of by the standard jconfig symbols, but on really weird systems nuclear@26: * you may have to edit this file.) nuclear@26: * nuclear@26: * NOTE: this file is NOT intended to be included by applications using the nuclear@26: * JPEG library. Most applications need only include jpeglib.h. nuclear@26: */ nuclear@26: nuclear@26: nuclear@26: /* Include auto-config file to find out which system include files we need. */ nuclear@26: nuclear@26: #include "jconfig.h" /* auto configuration options */ nuclear@26: #define JCONFIG_INCLUDED /* so that jpeglib.h doesn't do it again */ nuclear@26: nuclear@26: /* nuclear@26: * We need the NULL macro and size_t typedef. nuclear@26: * On an ANSI-conforming system it is sufficient to include . nuclear@26: * Otherwise, we get them from or ; we may have to nuclear@26: * pull in as well. nuclear@26: * Note that the core JPEG library does not require ; nuclear@26: * only the default error handler and data source/destination modules do. nuclear@26: * But we must pull it in because of the references to FILE in jpeglib.h. nuclear@26: * You can remove those references if you want to compile without . nuclear@26: */ nuclear@26: nuclear@26: #ifdef HAVE_STDDEF_H nuclear@26: #include nuclear@26: #endif nuclear@26: nuclear@26: #ifdef HAVE_STDLIB_H nuclear@26: #include nuclear@26: #endif nuclear@26: nuclear@26: #ifdef NEED_SYS_TYPES_H nuclear@26: #include nuclear@26: #endif nuclear@26: nuclear@26: #include nuclear@26: nuclear@26: /* nuclear@26: * We need memory copying and zeroing functions, plus strncpy(). nuclear@26: * ANSI and System V implementations declare these in . nuclear@26: * BSD doesn't have the mem() functions, but it does have bcopy()/bzero(). nuclear@26: * Some systems may declare memset and memcpy in . nuclear@26: * nuclear@26: * NOTE: we assume the size parameters to these functions are of type size_t. nuclear@26: * Change the casts in these macros if not! nuclear@26: */ nuclear@26: nuclear@26: #ifdef NEED_BSD_STRINGS nuclear@26: nuclear@26: #include nuclear@26: #define MEMZERO(target,size) bzero((void *)(target), (size_t)(size)) nuclear@26: #define MEMCOPY(dest,src,size) bcopy((const void *)(src), (void *)(dest), (size_t)(size)) nuclear@26: nuclear@26: #else /* not BSD, assume ANSI/SysV string lib */ nuclear@26: nuclear@26: #include nuclear@26: #define MEMZERO(target,size) memset((void *)(target), 0, (size_t)(size)) nuclear@26: #define MEMCOPY(dest,src,size) memcpy((void *)(dest), (const void *)(src), (size_t)(size)) nuclear@26: nuclear@26: #endif nuclear@26: nuclear@26: /* nuclear@26: * In ANSI C, and indeed any rational implementation, size_t is also the nuclear@26: * type returned by sizeof(). However, it seems there are some irrational nuclear@26: * implementations out there, in which sizeof() returns an int even though nuclear@26: * size_t is defined as long or unsigned long. To ensure consistent results nuclear@26: * we always use this SIZEOF() macro in place of using sizeof() directly. nuclear@26: */ nuclear@26: nuclear@26: #define SIZEOF(object) ((size_t) sizeof(object)) nuclear@26: nuclear@26: /* nuclear@26: * The modules that use fread() and fwrite() always invoke them through nuclear@26: * these macros. On some systems you may need to twiddle the argument casts. nuclear@26: * CAUTION: argument order is different from underlying functions! nuclear@26: */ nuclear@26: nuclear@26: #define JFREAD(file,buf,sizeofbuf) \ nuclear@26: ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) nuclear@26: #define JFWRITE(file,buf,sizeofbuf) \ nuclear@26: ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))