Path: blob/master/src/java.desktop/share/native/libjavajpeg/jinclude.h
41149 views
/*1* reserved comment block2* DO NOT REMOVE OR ALTER!3*/4/*5* jinclude.h6*7* Copyright (C) 1991-1994, Thomas G. Lane.8* This file is part of the Independent JPEG Group's software.9* For conditions of distribution and use, see the accompanying README file.10*11* This file exists to provide a single place to fix any problems with12* including the wrong system include files. (Common problems are taken13* care of by the standard jconfig symbols, but on really weird systems14* you may have to edit this file.)15*16* NOTE: this file is NOT intended to be included by applications using the17* JPEG library. Most applications need only include jpeglib.h.18*/192021/* Include auto-config file to find out which system include files we need. */2223#include "jconfig.h" /* auto configuration options */24#define JCONFIG_INCLUDED /* so that jpeglib.h doesn't do it again */2526/*27* We need the NULL macro and size_t typedef.28* On an ANSI-conforming system it is sufficient to include <stddef.h>.29* Otherwise, we get them from <stdlib.h> or <stdio.h>; we may have to30* pull in <sys/types.h> as well.31* Note that the core JPEG library does not require <stdio.h>;32* only the default error handler and data source/destination modules do.33* But we must pull it in because of the references to FILE in jpeglib.h.34* You can remove those references if you want to compile without <stdio.h>.35*/3637#ifdef HAVE_STDDEF_H38#include <stddef.h>39#endif4041#ifdef HAVE_STDLIB_H42#include <stdlib.h>43#endif4445#ifdef NEED_SYS_TYPES_H46#include <sys/types.h>47#endif4849#include <stdio.h>5051/*52* We need memory copying and zeroing functions, plus strncpy().53* ANSI and System V implementations declare these in <string.h>.54* BSD doesn't have the mem() functions, but it does have bcopy()/bzero().55* Some systems may declare memset and memcpy in <memory.h>.56*57* NOTE: we assume the size parameters to these functions are of type size_t.58* Change the casts in these macros if not!59*/6061#ifdef NEED_BSD_STRINGS6263#include <strings.h>64#define MEMZERO(target,size) bzero((void *)(target), (size_t)(size))65#define MEMCOPY(dest,src,size) bcopy((const void *)(src), (void *)(dest), (size_t)(size))6667#else /* not BSD, assume ANSI/SysV string lib */6869#include <string.h>70#define MEMZERO(target,size) memset((void *)(target), 0, (size_t)(size))71#define MEMCOPY(dest,src,size) memcpy((void *)(dest), (const void *)(src), (size_t)(size))7273#endif7475/*76* In ANSI C, and indeed any rational implementation, size_t is also the77* type returned by sizeof(). However, it seems there are some irrational78* implementations out there, in which sizeof() returns an int even though79* size_t is defined as long or unsigned long. To ensure consistent results80* we always use this SIZEOF() macro in place of using sizeof() directly.81*/8283#define SIZEOF(object) ((size_t) sizeof(object))8485/*86* The modules that use fread() and fwrite() always invoke them through87* these macros. On some systems you may need to twiddle the argument casts.88* CAUTION: argument order is different from underlying functions!89*/9091#define JFREAD(file,buf,sizeofbuf) \92((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))93#define JFWRITE(file,buf,sizeofbuf) \94((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))959697